Changeset 86 in josm for src/org/openstreetmap/josm/command/DeleteCommand.java
- Timestamp:
- 2006-04-21T14:31:51+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/command/DeleteCommand.java
r40 r86 4 4 import java.util.HashSet; 5 5 6 import org.openstreetmap.josm. data.osm.DataSet;6 import org.openstreetmap.josm.Main; 7 7 import org.openstreetmap.josm.data.osm.OsmPrimitive; 8 8 import org.openstreetmap.josm.data.osm.visitor.CollectBackReferencesVisitor; … … 12 12 * @author imi 13 13 */ 14 public class DeleteCommand implements Command {14 public class DeleteCommand extends Command { 15 15 16 /**17 * The dataset this command operates on.18 */19 final DataSet ds;20 16 /** 21 17 * The primitive that get deleted. … … 23 19 final Collection<OsmPrimitive> data = new HashSet<OsmPrimitive>(); 24 20 25 public DeleteCommand(DataSet ds, OsmPrimitive osm) { 26 this.ds = ds; 27 CollectBackReferencesVisitor v = new CollectBackReferencesVisitor(ds); 21 public DeleteCommand(OsmPrimitive osm) { 22 CollectBackReferencesVisitor v = new CollectBackReferencesVisitor(Main.ds); 28 23 osm.visit(v); 29 24 data.addAll(v.data); … … 31 26 } 32 27 33 public void executeCommand() { 28 @Override public void executeCommand() { 29 super.executeCommand(); 34 30 for (OsmPrimitive osm : data) 35 osm. setDeleted(true);31 osm.delete(true); 36 32 } 37 33 38 public void undoCommand() { 39 for (OsmPrimitive osm : data) 40 osm.setDeleted(false); 41 } 42 43 public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) { 34 @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) { 44 35 deleted.addAll(data); 45 36 }
Note:
See TracChangeset
for help on using the changeset viewer.