public abstract class Command extends PseudoCommand
OsmDataLayer
it is operating on.Modifier and Type | Class and Description |
---|---|
private static class |
Command.CloneVisitor |
static class |
Command.OldNodeState
Small helper for holding the interesting part of the old data state of the objects.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Map<OsmPrimitive,PrimitiveData> |
cloneMap
the map of OsmPrimitives in the original state to OsmPrimitives in cloned state
|
private OsmDataLayer |
layer
the layer which this command is applied to
|
Constructor and Description |
---|
Command()
Creates a new command in the context of the current edit layer, if any
|
Command(OsmDataLayer layer)
Creates a new command in the context of a specific data layer
|
Modifier and Type | Method and Description |
---|---|
static boolean |
checkAndConfirmOutlyingOperation(java.lang.String operation,
java.lang.String dialogTitle,
java.lang.String outsideDialogMessage,
java.lang.String incompleteDialogMessage,
java.util.Collection<? extends OsmPrimitive> primitives,
java.util.Collection<? extends OsmPrimitive> ignore)
Check whether user is about to operate on data outside of the download area.
|
boolean |
executeCommand()
Executes the command on the dataset.
|
abstract 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.
|
protected OsmDataLayer |
getLayer()
Replies the layer this command is (or was) applied to.
|
PrimitiveData |
getOrig(OsmPrimitive osm)
Lets other commands access the original version
of the object.
|
java.util.Collection<? extends OsmPrimitive> |
getParticipatingPrimitives()
Return the primitives that take part in this command.
|
boolean |
invalidBecauselayerRemoved(Layer oldLayer)
Called when a layer has been removed to have the command remove itself from
any buffer if it is not longer applicable to the dataset (e.g.
|
void |
undoCommand()
Undoes the command.
|
getChildren, getDescriptionIcon, getDescriptionText
private java.util.Map<OsmPrimitive,PrimitiveData> cloneMap
private final OsmDataLayer layer
public Command()
public Command(OsmDataLayer layer) throws java.lang.IllegalArgumentException
layer
- the data layer. Must not be null.java.lang.IllegalArgumentException
- thrown if layer is nullpublic boolean executeCommand()
public void undoCommand()
public boolean invalidBecauselayerRemoved(Layer oldLayer)
oldLayer
- the old layerpublic PrimitiveData getOrig(OsmPrimitive osm)
osm
- The requested OSM objectprotected OsmDataLayer getLayer()
public abstract void fillModifiedData(java.util.Collection<OsmPrimitive> modified, java.util.Collection<OsmPrimitive> deleted, java.util.Collection<OsmPrimitive> added)
modified
- The modified primitivesdeleted
- The deleted primitivesadded
- The added primitivespublic java.util.Collection<? extends OsmPrimitive> getParticipatingPrimitives()
getParticipatingPrimitives
in class PseudoCommand
public static boolean checkAndConfirmOutlyingOperation(java.lang.String operation, java.lang.String dialogTitle, java.lang.String outsideDialogMessage, java.lang.String incompleteDialogMessage, java.util.Collection<? extends OsmPrimitive> primitives, java.util.Collection<? extends OsmPrimitive> ignore)
operation
- the operation name which is used for setting some preferencesdialogTitle
- the title of the dialog being displayedoutsideDialogMessage
- the message text to be displayed when data is outside of the download areaincompleteDialogMessage
- the message text to be displayed when data is incompleteprimitives
- the primitives to operate onignore
- null
or a primitive to be ignored