public class DeleteCommand extends Command
setDeletionCallback(DeletionCallback)
to
allow interactive confirmation actions.Modifier and Type | Class and Description |
---|---|
private static class |
DeleteCommand.DeleteChildCommand |
static interface |
DeleteCommand.DeletionCallback
Called when a deletion operation must be checked and confirmed by user.
|
Command.OldNodeState
Modifier and Type | Field and Description |
---|---|
private static DeleteCommand.DeletionCallback |
callback |
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(DataSet dataset,
OsmPrimitive data)
Constructor for a single data item.
|
DeleteCommand(OsmPrimitive data)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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. |
static Command |
delete(java.util.Collection<? extends OsmPrimitive> selection)
Try to delete all given primitives.
|
static Command |
delete(java.util.Collection<? extends OsmPrimitive> selection,
boolean alsoDeleteNodesInWay)
Try to delete all given primitives.
|
static Command |
delete(java.util.Collection<? extends OsmPrimitive> selection,
boolean alsoDeleteNodesInWay,
boolean silent)
Try to delete all given primitives.
|
static Command |
deleteWaySegment(WaySegment ws)
Create a command that deletes a single way segment.
|
static Command |
deleteWithReferences(java.util.Collection<? extends OsmPrimitive> selection)
Delete the primitives and everything they reference.
|
static Command |
deleteWithReferences(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() |
static void |
setDeletionCallback(DeleteCommand.DeletionCallback deletionCallback)
Sets the global
DeleteCommand.DeletionCallback . |
void |
undoCommand()
Undoes the command.
|
checkOutlyingOrIncompleteOperation, ensurePrimitivesAreInDataset, getAffectedDataSet, getOrig
private static volatile DeleteCommand.DeletionCallback callback
private 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, and belong to a data setjava.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(DataSet dataset, OsmPrimitive data)
dataset
- the data set 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(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 emptypublic static void setDeletionCallback(DeleteCommand.DeletionCallback deletionCallback)
DeleteCommand.DeletionCallback
.deletionCallback
- the new DeletionCallback
. Must not be nulljava.lang.NullPointerException
- if deletionCallback
is nullprivate void checkConsistency()
public boolean executeCommand()
Command
The layer should be invalidated after execution so that it can be re-painted.
executeCommand
in class Command
public void undoCommand()
Command
undoCommand
in class Command
public void fillModifiedData(java.util.Collection<OsmPrimitive> modified, java.util.Collection<OsmPrimitive> deleted, java.util.Collection<OsmPrimitive> added)
Command
fillModifiedData
in class Command
modified
- The modified primitivesdeleted
- The deleted primitivesadded
- The added primitivesprivate java.util.EnumSet<OsmPrimitiveType> getTypesToDelete()
public java.lang.String getDescriptionText()
PseudoCommand
public javax.swing.Icon getDescriptionIcon()
PseudoCommand
public java.util.Collection<PseudoCommand> getChildren()
PseudoCommand
public java.util.Collection<? extends OsmPrimitive> getParticipatingPrimitives()
Command
getParticipatingPrimitives
in interface PseudoCommand
getParticipatingPrimitives
in class Command
public static Command deleteWithReferences(java.util.Collection<? extends OsmPrimitive> selection, boolean silent)
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(java.util.Collection<? extends OsmPrimitive> selection)
selection
- The list of all object to be deleted.java.lang.IllegalArgumentException
- if layer is nullpublic static Command delete(java.util.Collection<? extends OsmPrimitive> selection)
selection
- 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()
primitivesToDelete
primitivesToDelete
- the primitives to deleteprimitivesToDelete
which
can be deleted toopublic static Command delete(java.util.Collection<? extends OsmPrimitive> selection, boolean alsoDeleteNodesInWay)
selection
- the objects to delete.alsoDeleteNodesInWay
- true
if nodes should be deleted as wellpublic static Command delete(java.util.Collection<? extends OsmPrimitive> selection, boolean alsoDeleteNodesInWay, boolean silent)
selection
- 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(WaySegment ws)
ws
- The way segment that should be deleted