Changeset 18724 in josm for trunk/src/org/openstreetmap/josm/command
- Timestamp:
- 2023-05-10T19:37:19+02:00 (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java
r17240 r18724 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 19 import org.openstreetmap.josm.data.osm.PrimitiveData; 20 import org.openstreetmap.josm.data.osm.PrimitiveId; 20 21 import org.openstreetmap.josm.tools.CheckParameterUtil; 21 22 … … 128 129 } 129 130 // reversed order, see #14620 130 for (int i = createdPrimitives.size() - 1; i >= 0; i--) { 131 OsmPrimitive osm = createdPrimitives.get(i); 132 Optional<PrimitiveData> previous = preExistingData.stream() 133 .filter(pd -> pd.getPrimitiveId().equals(osm.getPrimitiveId())).findAny(); 134 if (previous.isPresent()) { 135 osm.load(previous.get()); 136 } else { 137 ds.removePrimitive(osm); 138 } 139 } 131 final List<PrimitiveId> toRemove = new ArrayList<>(this.createdPrimitives.size()); 132 ds.update(() -> { 133 for (int i = createdPrimitives.size() - 1; i >= 0; i--) { 134 OsmPrimitive osm = createdPrimitives.get(i); 135 Optional<PrimitiveData> previous = preExistingData.stream() 136 .filter(pd -> pd.getPrimitiveId().equals(osm.getPrimitiveId())).findAny(); 137 if (previous.isPresent()) { 138 osm.load(previous.get()); 139 } else { 140 toRemove.add(osm); 141 } 142 } 143 }); 144 ds.removePrimitives(toRemove); 140 145 } 141 146
Note:
See TracChangeset
for help on using the changeset viewer.