Ignore:
Timestamp:
2006-09-24T11:15:39+02:00 (20 years ago)
Author:
imi
Message:
  • added External Tool support (no gui configuration yet)
  • applied patch for bug that Save action does not set filename (thanks Dean)
  • fixed case sensitiveness of search tool (now insensitive, like google)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/data/osm/visitor/AddVisitor.java

    r86 r142  
    1818       
    1919        private final DataSet ds;
     20        private final boolean includeReferences;
     21       
     22        public AddVisitor(DataSet ds, boolean includeReferences) {
     23                this.ds = ds;
     24                this.includeReferences = includeReferences;
     25        }
    2026       
    2127        public AddVisitor(DataSet ds) {
    22                 this.ds = ds;
     28                this(ds, false);
    2329        }
    2430       
    2531        public void visit(Node n) {
    26                 ds.nodes.add(n);
     32                if (!includeReferences || !ds.nodes.contains(n))
     33                        ds.nodes.add(n);
    2734        }
    28         public void visit(Segment ls) {
    29                 ds.segments.add(ls);
     35        public void visit(Segment s) {
     36                ds.segments.add(s);
     37                if (includeReferences && !s.incomplete) {
     38                        if (!ds.nodes.contains(s.from))
     39                                s.from.visit(this);
     40                        if (!ds.nodes.contains(s.to))
     41                                s.to.visit(this);
     42                }
    3043        }
    31         public void visit(Way t) {
    32                 ds.ways.add(t);
     44        public void visit(Way w) {
     45                ds.ways.add(w);
     46                if (includeReferences)
     47                        for (Segment s : w.segments)
     48                                if (!ds.segments.contains(s))
     49                                        s.visit(this);
    3350        }
    3451}
Note: See TracChangeset for help on using the changeset viewer.