public class DeleteCommand extends Command
| Modifier and Type | Class and Description |
|---|---|
private static class |
DeleteCommand.DeleteChildCommand |
Command.OldNodeState| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<OsmPrimitive,PrimitiveData> |
clonedPrimitives |
private java.util.Collection<? extends OsmPrimitive> |
toDelete
The primitives that get deleted.
|
IS_INCOMPLETE, IS_OK, IS_OUTSIDE| Constructor and Description |
|---|
DeleteCommand(java.util.Collection<? extends OsmPrimitive> data)
Constructor.
|
DeleteCommand(DataSet dataset,
java.util.Collection<? extends OsmPrimitive> data)
Constructor for a collection of data to be deleted in the context of
a specific data set
|
DeleteCommand(OsmDataLayer layer,
java.util.Collection<? extends OsmPrimitive> data)
Constructor for a collection of data to be deleted in the context of
a specific layer
|
DeleteCommand(OsmDataLayer layer,
OsmPrimitive data)
Constructor for a single data item.
|
DeleteCommand(OsmPrimitive data)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkAndConfirmOutlyingDelete(java.util.Collection<? extends OsmPrimitive> primitives,
java.util.Collection<? extends OsmPrimitive> ignore) |
private void |
checkConsistency() |
protected static java.util.Collection<Node> |
computeNodesToDelete(java.util.Collection<OsmPrimitive> primitivesToDelete)
Replies the collection of nodes referred to by primitives in
primitivesToDelete which
can be deleted too. |
private static boolean |
confirmRelationDeletion(java.util.Collection<Relation> relations) |
static Command |
delete(OsmDataLayer layer,
java.util.Collection<? extends OsmPrimitive> selection)
Try to delete all given primitives.
|
static Command |
delete(OsmDataLayer layer,
java.util.Collection<? extends OsmPrimitive> selection,
boolean alsoDeleteNodesInWay)
Try to delete all given primitives.
|
static Command |
delete(OsmDataLayer layer,
java.util.Collection<? extends OsmPrimitive> selection,
boolean alsoDeleteNodesInWay,
boolean silent)
Try to delete all given primitives.
|
static Command |
deleteWaySegment(OsmDataLayer layer,
WaySegment ws)
Create a command that deletes a single way segment.
|
static Command |
deleteWithReferences(OsmDataLayer layer,
java.util.Collection<? extends OsmPrimitive> selection)
Delete the primitives and everything they reference.
|
static Command |
deleteWithReferences(OsmDataLayer layer,
java.util.Collection<? extends OsmPrimitive> selection,
boolean silent)
Delete the primitives and everything they reference.
|
boolean |
equals(java.lang.Object obj) |
boolean |
executeCommand()
Executes the command on the dataset.
|
void |
fillModifiedData(java.util.Collection<OsmPrimitive> modified,
java.util.Collection<OsmPrimitive> deleted,
java.util.Collection<OsmPrimitive> added)
Fill in the changed data this command operates on.
|
java.util.Collection<PseudoCommand> |
getChildren()
Returns the subcommands of this command.
|
javax.swing.Icon |
getDescriptionIcon()
Provides a descriptive icon of this command.
|
java.lang.String |
getDescriptionText()
Provides a description text representing this command.
|
java.util.Collection<? extends OsmPrimitive> |
getParticipatingPrimitives()
Return the primitives that take part in this command.
|
private java.util.EnumSet<OsmPrimitiveType> |
getTypesToDelete() |
int |
hashCode() |
void |
undoCommand()
Undoes the command.
|
checkAndConfirmOutlyingOperation, checkOutlyingOrIncompleteOperation, getAffectedDataSet, getLayer, getOrig, invalidateAffectedLayers, invalidBecauselayerRemovedprivate final java.util.Collection<? extends OsmPrimitive> toDelete
private final java.util.Map<OsmPrimitive,PrimitiveData> clonedPrimitives
public DeleteCommand(java.util.Collection<? extends OsmPrimitive> data)
data - the primitives to delete. Must neither be null nor empty.java.lang.IllegalArgumentException - if data is null or emptypublic DeleteCommand(OsmPrimitive data)
data - the primitive to delete. Must not be null.java.lang.IllegalArgumentException - if data is nullpublic DeleteCommand(OsmDataLayer layer, OsmPrimitive data)
layer - the layer context for deleting this primitive. Must not be null.data - the primitive to delete. Must not be null.java.lang.IllegalArgumentException - if data is nulljava.lang.IllegalArgumentException - if layer is nullpublic DeleteCommand(OsmDataLayer layer, java.util.Collection<? extends OsmPrimitive> data)
layer - the layer context for deleting these primitives. Must not be null.data - the primitives to delete. Must neither be null nor empty.java.lang.IllegalArgumentException - if layer is nulljava.lang.IllegalArgumentException - if data is null or emptypublic DeleteCommand(DataSet dataset, java.util.Collection<? extends OsmPrimitive> data)
dataset - the dataset context for deleting these primitives. Must not be null.data - the primitives to delete. Must neither be null nor empty.java.lang.IllegalArgumentException - if dataset is nulljava.lang.IllegalArgumentException - if data is null or emptyprivate void checkConsistency()
public boolean executeCommand()
CommandThe layer should be invalidated after execution so that it can be re-painted.
executeCommand in class CommandCommand.invalidateAffectedLayers()public void undoCommand()
CommandundoCommand in class Commandpublic void fillModifiedData(java.util.Collection<OsmPrimitive> modified, java.util.Collection<OsmPrimitive> deleted, java.util.Collection<OsmPrimitive> added)
CommandfillModifiedData in class Commandmodified - The modified primitivesdeleted - The deleted primitivesadded - The added primitivesprivate java.util.EnumSet<OsmPrimitiveType> getTypesToDelete()
public java.lang.String getDescriptionText()
PseudoCommandpublic javax.swing.Icon getDescriptionIcon()
PseudoCommandpublic java.util.Collection<PseudoCommand> getChildren()
PseudoCommandpublic java.util.Collection<? extends OsmPrimitive> getParticipatingPrimitives()
CommandgetParticipatingPrimitives in interface PseudoCommandgetParticipatingPrimitives in class Commandpublic static Command deleteWithReferences(OsmDataLayer layer, java.util.Collection<? extends OsmPrimitive> selection, boolean silent)
layer - the OsmDataLayer in whose context primitives are deleted. Must not be null.selection - The list of all object to be deleted.silent - Set to true if the user should not be bugged with additional dialogsjava.lang.IllegalArgumentException - if layer is nullpublic static Command deleteWithReferences(OsmDataLayer layer, java.util.Collection<? extends OsmPrimitive> selection)
layer - the OsmDataLayer in whose context primitives are deleted. Must not be null.selection - The list of all object to be deleted.java.lang.IllegalArgumentException - if layer is nullpublic static Command delete(OsmDataLayer layer, java.util.Collection<? extends OsmPrimitive> selection)
layer - the OsmDataLayer in whose context the primitives are deletedselection - the objects to delete.protected static java.util.Collection<Node> computeNodesToDelete(java.util.Collection<OsmPrimitive> primitivesToDelete)
primitivesToDelete which
can be deleted too. A node can be deleted if
OsmPrimitive.isTagged()primitivesToDeleteprimitivesToDelete - the primitives to deleteprimitivesToDelete which
can be deleted toopublic static Command delete(OsmDataLayer layer, java.util.Collection<? extends OsmPrimitive> selection, boolean alsoDeleteNodesInWay)
layer - the OsmDataLayer in whose context the primitives are deletedselection - the objects to delete.alsoDeleteNodesInWay - true if nodes should be deleted as wellpublic static Command delete(OsmDataLayer layer, java.util.Collection<? extends OsmPrimitive> selection, boolean alsoDeleteNodesInWay, boolean silent)
layer - the OsmDataLayer in whose context the primitives are deletedselection - the objects to delete.alsoDeleteNodesInWay - true if nodes should be deleted as wellsilent - set to true if the user should not be bugged with additional questionspublic static Command deleteWaySegment(OsmDataLayer layer, WaySegment ws)
layer - The layer the segment is in.ws - The way segment that should be deletedpublic static boolean checkAndConfirmOutlyingDelete(java.util.Collection<? extends OsmPrimitive> primitives, java.util.Collection<? extends OsmPrimitive> ignore)
private static boolean confirmRelationDeletion(java.util.Collection<Relation> relations)