Changeset 142 in josm for src/org/openstreetmap/josm/data/osm/visitor/AddVisitor.java
- Timestamp:
- 2006-09-24T11:15:39+02:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/data/osm/visitor/AddVisitor.java
r86 r142 18 18 19 19 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 } 20 26 21 27 public AddVisitor(DataSet ds) { 22 this .ds = ds;28 this(ds, false); 23 29 } 24 30 25 31 public void visit(Node n) { 26 ds.nodes.add(n); 32 if (!includeReferences || !ds.nodes.contains(n)) 33 ds.nodes.add(n); 27 34 } 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 } 30 43 } 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); 33 50 } 34 51 }
Note:
See TracChangeset
for help on using the changeset viewer.
