public class DeleteCommand extends Command
Command.OldNodeState| Modifier and Type | Field and Description |
|---|---|
private Map<OsmPrimitive,PrimitiveData> |
clonedPrimitives |
private Collection<? extends OsmPrimitive> |
toDelete
The primitives that get deleted.
|
| Constructor and Description |
|---|
DeleteCommand(Collection<? extends OsmPrimitive> data)
Constructor.
|
DeleteCommand(OsmDataLayer layer,
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(Collection<? extends OsmPrimitive> primitives,
Collection<? extends OsmPrimitive> ignore) |
private void |
checkConsistency() |
protected static Collection<Node> |
computeNodesToDelete(Collection<OsmPrimitive> primitivesToDelete)
Replies the collection of nodes referred to by primitives in
primitivesToDelete which
can be deleted too. |
private static boolean |
confirmRelationDeletion(Collection<Relation> relations) |
static Command |
delete(OsmDataLayer layer,
Collection<? extends OsmPrimitive> selection)
Try to delete all given primitives.
|
static Command |
delete(OsmDataLayer layer,
Collection<? extends OsmPrimitive> selection,
boolean alsoDeleteNodesInWay)
Try to delete all given primitives.
|
static Command |
delete(OsmDataLayer layer,
Collection<? extends OsmPrimitive> selection,
boolean alsoDeleteNodesInWay,
boolean silent)
Try to delete all given primitives.
|
static Command |
deleteWaySegment(OsmDataLayer layer,
WaySegment ws) |
static Command |
deleteWithReferences(OsmDataLayer layer,
Collection<? extends OsmPrimitive> selection)
Delete the primitives and everything they reference.
|
static Command |
deleteWithReferences(OsmDataLayer layer,
Collection<? extends OsmPrimitive> selection,
boolean silent)
Delete the primitives and everything they reference.
|
boolean |
equals(Object obj) |
boolean |
executeCommand()
Executes the command on the dataset.
|
void |
fillModifiedData(Collection<OsmPrimitive> modified,
Collection<OsmPrimitive> deleted,
Collection<OsmPrimitive> added)
Fill in the changed data this command operates on.
|
Collection<PseudoCommand> |
getChildren()
Returns the subcommands of this command.
|
Icon |
getDescriptionIcon()
Provides a descriptive icon of this command.
|
String |
getDescriptionText()
Provides a description text representing this command.
|
Collection<? extends OsmPrimitive> |
getParticipatingPrimitives()
Return the primitives that take part in this command.
|
private Set<OsmPrimitiveType> |
getTypesToDelete() |
int |
hashCode() |
void |
undoCommand()
Undoes the command.
|
checkAndConfirmOutlyingOperation, getLayer, getOrig, invalidBecauselayerRemovedprivate final Collection<? extends OsmPrimitive> toDelete
private final Map<OsmPrimitive,PrimitiveData> clonedPrimitives
public DeleteCommand(Collection<? extends OsmPrimitive> data)
data - the primitives to delete. Must neither be null nor empty.IllegalArgumentException - if data is null or emptypublic DeleteCommand(OsmPrimitive data)
data - the primitive to delete. Must not be null.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.IllegalArgumentException - if data is nullIllegalArgumentException - if layer is nullpublic DeleteCommand(OsmDataLayer layer, 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.IllegalArgumentException - if layer is nullIllegalArgumentException - if data is null or emptyprivate void checkConsistency()
public boolean executeCommand()
CommandexecuteCommand in class Commandpublic void undoCommand()
CommandundoCommand in class Commandpublic void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added)
CommandfillModifiedData in class Commandmodified - The modified primitivesdeleted - The deleted primitivesadded - The added primitivesprivate Set<OsmPrimitiveType> getTypesToDelete()
public String getDescriptionText()
PseudoCommandgetDescriptionText in class PseudoCommandpublic Icon getDescriptionIcon()
PseudoCommandgetDescriptionIcon in class PseudoCommandpublic Collection<PseudoCommand> getChildren()
PseudoCommandgetChildren in class PseudoCommandpublic Collection<? extends OsmPrimitive> getParticipatingPrimitives()
CommandgetParticipatingPrimitives in class Commandpublic static Command deleteWithReferences(OsmDataLayer layer, 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 dialogsIllegalArgumentException - if layer is nullpublic static Command deleteWithReferences(OsmDataLayer layer, 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.IllegalArgumentException - if layer is nullpublic static Command delete(OsmDataLayer layer, Collection<? extends OsmPrimitive> selection)
layer - the OsmDataLayer in whose context the primitives are deletedselection - the objects to delete.protected static Collection<Node> computeNodesToDelete(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, 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, 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)
public static boolean checkAndConfirmOutlyingDelete(Collection<? extends OsmPrimitive> primitives, Collection<? extends OsmPrimitive> ignore)
private static boolean confirmRelationDeletion(Collection<Relation> relations)