Changeset 304 in josm for src/org/openstreetmap/josm/command/Command.java
- Timestamp:
- 2007-08-10T21:12:53+02:00 (19 years ago)
- File:
-
- 1 edited
-
src/org/openstreetmap/josm/command/Command.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/command/Command.java
r298 r304 1 // License: GPL. Copyright 2007 by Immanuel Scholz and others1 //License: GPL. Copyright 2007 by Immanuel Scholz and others 2 2 package org.openstreetmap.josm.command; 3 3 … … 15 15 import org.openstreetmap.josm.data.osm.Way; 16 16 import org.openstreetmap.josm.data.osm.visitor.Visitor; 17 import org.openstreetmap.josm.gui.layer.Layer; 18 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 17 19 18 20 … … 31 33 private static final class CloneVisitor implements Visitor { 32 34 public Map<OsmPrimitive, OsmPrimitive> orig = new HashMap<OsmPrimitive, OsmPrimitive>(); 33 35 34 36 public void visit(Node n) { 35 37 orig.put(n, new Node(n)); 36 }38 } 37 39 public void visit(Segment s) { 38 40 orig.put(s, new Segment(s)); 39 }41 } 40 42 public void visit(Way w) { 41 43 orig.put(w, new Way(w)); 42 }44 } 43 45 } 44 46 45 47 private CloneVisitor orig; 46 48 47 49 /** 48 50 * Executes the command on the dataset. This implementation will remember all … … 69 71 } 70 72 73 74 /** 75 * Called, when a layer has been removed to have the command remove itself from 76 * any buffer if it is not longer applicable to the dataset (e.g. it was part of 77 * the removed layer) 78 */ 79 public boolean invalidBecauselayerRemoved(Layer oldLayer) { 80 if (!(oldLayer instanceof OsmDataLayer)) 81 return false; 82 HashSet<OsmPrimitive> modified = new HashSet<OsmPrimitive>(); 83 fillModifiedData(modified, modified, modified); 84 if (modified.isEmpty()) 85 return false; 86 87 HashSet<OsmPrimitive> all = new HashSet<OsmPrimitive>(((OsmDataLayer)oldLayer).data.allPrimitives()); 88 for (OsmPrimitive osm : all) 89 if (all.contains(osm)) 90 return true; 91 92 return false; 93 } 94 71 95 /** 72 96 * Fill in the changed data this command operates on.
Note:
See TracChangeset
for help on using the changeset viewer.
