Changeset 5102 in josm for trunk/src/org
- Timestamp:
- 2012-03-18T14:03:12+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r5101 r5102 58 58 */ 59 59 private Set<OsmPrimitive> oldHighlights = new HashSet<OsmPrimitive>(); 60 private WaySegment oldHighlightedWaySegment = null; 60 61 61 62 private boolean drawTargetHighlight; … … 194 195 195 196 Set<OsmPrimitive> newHighlights = new HashSet<OsmPrimitive>(); 196 197 197 DeleteParameters parameters = getDeleteParameters(e, modifiers); 198 198 … … 200 200 // deleting segments is the only action not working on OsmPrimitives 201 201 // so we have to handle them separately. 202 DataSet ds = getCurrentDataSet(); 203 if(ds != null) { 204 ds.setHighlightedWaySegments(Collections.singleton(parameters.nearestSegment)); 205 } 202 repaintIfRequired(newHighlights, parameters.nearestSegment); 206 203 } else { 207 204 // don't call buildDeleteCommands for DeleteMode.segment because it doesn't support 208 205 // silent operation and SplitWayAction will show dialogs. A lot. 209 206 Command delCmd = buildDeleteCommands(e, modifiers, true); 210 if(delCmd == null) { 211 repaintIfRequired(newHighlights); 212 return; 213 } 214 215 // all other cases delete OsmPrimitives directly, so we can 216 // safely do the following 217 for(OsmPrimitive osm : delCmd.getParticipatingPrimitives()) { 218 newHighlights.add(osm); 219 } 220 } 221 repaintIfRequired(newHighlights); 222 } 223 224 private void repaintIfRequired(Set<OsmPrimitive> newHighlights) { 207 if(delCmd != null) { 208 // all other cases delete OsmPrimitives directly, so we can 209 // safely do the following 210 for(OsmPrimitive osm : delCmd.getParticipatingPrimitives()) { 211 newHighlights.add(osm); 212 } 213 } 214 repaintIfRequired(newHighlights, null); 215 } 216 } 217 218 private void repaintIfRequired(Set<OsmPrimitive> newHighlights, WaySegment newHighlightedWaySegment) { 225 219 boolean needsRepaint = false; 220 DataSet ds = getCurrentDataSet(); 221 222 if(newHighlightedWaySegment == null && oldHighlightedWaySegment != null) { 223 if(ds != null) { 224 ds.clearHighlightedWaySegments(); 225 needsRepaint = true; 226 } 227 oldHighlightedWaySegment = null; 228 } else if(newHighlightedWaySegment != null && !newHighlightedWaySegment.equals(oldHighlightedWaySegment)) { 229 if(ds != null) { 230 ds.setHighlightedWaySegments(Collections.singleton(newHighlightedWaySegment)); 231 needsRepaint = true; 232 } 233 oldHighlightedWaySegment = newHighlightedWaySegment; 234 } 235 226 236 for(OsmPrimitive x : newHighlights) { 227 237 if(oldHighlights.contains(x)) {
Note:
See TracChangeset
for help on using the changeset viewer.