Changeset 3335 in josm for trunk/src/org
- Timestamp:
- 2010-06-19T14:21:38+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/PurgePrimitivesCommand.java
r3262 r3335 8 8 import java.util.Collection; 9 9 import java.util.Collections; 10 import java.util.HashMap; 10 11 import java.util.HashSet; 11 12 import java.util.List; 13 import java.util.Map; 12 14 import java.util.Set; 15 import java.util.Map.Entry; 13 16 import java.util.logging.Logger; 14 17 … … 19 22 import org.openstreetmap.josm.data.osm.Node; 20 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 24 import org.openstreetmap.josm.data.osm.PrimitiveData; 21 25 import org.openstreetmap.josm.data.osm.Relation; 22 26 import org.openstreetmap.josm.data.osm.Way; … … 48 52 private Set<OsmPrimitive> purgedPrimitives; 49 53 50 private Set<OsmPrimitive> origVersionsOfTouchedPrimitives;54 private Map<OsmPrimitive,PrimitiveData> origVersionsOfTouchedPrimitives; 51 55 52 56 protected void init(Collection<OsmPrimitive> toPurge) { 53 57 this.toPurge = toPurge; 54 58 this.purgedPrimitives = new HashSet<OsmPrimitive>(); 55 this.origVersionsOfTouchedPrimitives = new Hash Set<OsmPrimitive>();59 this.origVersionsOfTouchedPrimitives = new HashMap<OsmPrimitive,PrimitiveData>(); 56 60 } 57 61 … … 149 153 if (parent instanceof Way) { 150 154 Way w = (Way)parent; 151 if (!origVersionsOfTouchedPrimitives.contains (w)) {152 origVersionsOfTouchedPrimitives. add(w);155 if (!origVersionsOfTouchedPrimitives.containsKey(w)) { 156 origVersionsOfTouchedPrimitives.put(w,w.save()); 153 157 } 154 158 w.removeNode((Node)child); … … 163 167 } else if (parent instanceof Relation) { 164 168 Relation r = (Relation)parent; 165 if (!origVersionsOfTouchedPrimitives.contains (r)) {166 origVersionsOfTouchedPrimitives. add(r);169 if (!origVersionsOfTouchedPrimitives.containsKey(r)) { 170 origVersionsOfTouchedPrimitives.put(r,r.save()); 167 171 } 168 172 System.out.println(tr("Removing reference from relation {0}",r.getId())); … … 200 204 public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, 201 205 Collection<OsmPrimitive> added) { 202 modified.addAll(origVersionsOfTouchedPrimitives);203 206 } 204 207 … … 219 222 getLayer().data.addPrimitive(purged); 220 223 } 224 225 for (Entry<OsmPrimitive, PrimitiveData> entry: origVersionsOfTouchedPrimitives.entrySet()) { 226 entry.getKey().load(entry.getValue()); 227 } 228 221 229 reconstituteConflicts(); 222 230
Note:
See TracChangeset
for help on using the changeset viewer.