public class MoveCommand extends Command
Command.OldNodeState| Modifier and Type | Field and Description |
|---|---|
private double |
backupX |
private double |
backupY |
private java.util.Collection<Node> |
nodes
The objects that should be moved.
|
private java.util.List<Command.OldNodeState> |
oldState
List of all old states of the objects.
|
private EastNorth |
startEN
Starting position, base command point, current (mouse-drag) position = startEN + (x,y) =
|
private double |
x
x difference movement.
|
private double |
y
y difference movement.
|
| Constructor and Description |
|---|
MoveCommand(java.util.Collection<OsmPrimitive> objects,
double x,
double y)
Constructs a new
MoveCommand and assign the initial object set and movement vector. |
MoveCommand(java.util.Collection<OsmPrimitive> objects,
EastNorth offset)
Constructs a new
MoveCommand to move a collection of primitives. |
MoveCommand(java.util.Collection<OsmPrimitive> objects,
EastNorth start,
EastNorth end) |
MoveCommand(Node node,
LatLon position)
Constructs a new
MoveCommand to move a node. |
MoveCommand(OsmPrimitive osm,
double x,
double y)
Constructs a new
MoveCommand to move a primitive. |
MoveCommand(OsmPrimitive p,
EastNorth start,
EastNorth end) |
| Modifier and Type | Method and Description |
|---|---|
void |
applyVectorTo(EastNorth currentEN)
Change the displacement vector to have endpoint @param currentEN
starting point is startEN
|
void |
changeStartPoint(EastNorth newDraggedStartPoint)
Changes base point of movement
|
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.
|
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<Node> |
getParticipatingPrimitives()
Return the primitives that take part in this command.
|
void |
moveAgain(double x,
double y)
Move the same set of objects again by the specified vector.
|
void |
moveAgainTo(double x,
double y) |
void |
resetToCheckpoint()
Restore old displacement in case of some problems
|
void |
saveCheckpoint()
Save curent displacement to restore in case of some problems
|
void |
undoCommand()
Undoes the command.
|
private void |
updateCoordinates() |
checkAndConfirmOutlyingOperation, getLayer, getOrig, invalidBecauselayerRemovedgetChildrenprivate EastNorth startEN
private double x
private double y
private double backupX
private double backupY
private java.util.List<Command.OldNodeState> oldState
public MoveCommand(OsmPrimitive osm, double x, double y)
MoveCommand to move a primitive.osm - The primitive to movex - X difference movement. Coordinates are in northern/easterny - Y difference movement. Coordinates are in northern/easternpublic MoveCommand(Node node, LatLon position)
MoveCommand to move a node.node - The node to movepublic MoveCommand(java.util.Collection<OsmPrimitive> objects, EastNorth offset)
MoveCommand to move a collection of primitives.objects - The primitives to moveoffset - The movement vectorpublic MoveCommand(java.util.Collection<OsmPrimitive> objects, double x, double y)
MoveCommand and assign the initial object set and movement vector.objects - The primitives to movex - X difference movement. Coordinates are in northern/easterny - Y difference movement. Coordinates are in northern/easternpublic MoveCommand(java.util.Collection<OsmPrimitive> objects, EastNorth start, EastNorth end)
public MoveCommand(OsmPrimitive p, EastNorth start, EastNorth end)
public void moveAgain(double x, double y)
x - X difference movement. Coordinates are in northern/easterny - Y difference movement. Coordinates are in northern/easternpublic void moveAgainTo(double x, double y)
public void applyVectorTo(EastNorth currentEN)
public void changeStartPoint(EastNorth newDraggedStartPoint)
newDraggedStartPoint - - new starting point after movement (where user clicks to start new drag)public final void saveCheckpoint()
public void resetToCheckpoint()
private void updateCoordinates()
public boolean executeCommand()
CommandexecuteCommand in class Commandpublic 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 primitivespublic java.lang.String getDescriptionText()
PseudoCommandgetDescriptionText in class PseudoCommandpublic javax.swing.Icon getDescriptionIcon()
PseudoCommandgetDescriptionIcon in class PseudoCommandpublic java.util.Collection<Node> getParticipatingPrimitives()
CommandgetParticipatingPrimitives in class Command