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 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(String operation,
String dialogTitle,
String outsideDialogMessage,
String incompleteDialogMessage,
Area area,
Collection<? extends OsmPrimitive> primitives,
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(Collection<OsmPrimitive> modified,
Collection<OsmPrimitive> deleted,
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.
|
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. it was part of
the removed layer)
|
private static boolean |
isOutlying(OsmPrimitive osm,
Area area) |
void |
undoCommand()
Undoes the command.
|
getChildren, getDescriptionIcon, getDescriptionText
private Map<OsmPrimitive,PrimitiveData> cloneMap
private final OsmDataLayer layer
public Command()
public Command(OsmDataLayer layer) throws IllegalArgumentException
layer
- the data layer. Must not be null.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(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added)
modified
- The modified primitivesdeleted
- The deleted primitivesadded
- The added primitivespublic Collection<? extends OsmPrimitive> getParticipatingPrimitives()
getParticipatingPrimitives
in class PseudoCommand
public static boolean checkAndConfirmOutlyingOperation(String operation, String dialogTitle, String outsideDialogMessage, String incompleteDialogMessage, Area area, Collection<? extends OsmPrimitive> primitives, 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 incompletearea
- the area used to determine whether data is outlyingprimitives
- the primitives to operate onignore
- null
or a primitive to be ignoredprivate static boolean isOutlying(OsmPrimitive osm, Area area)