public class MoveCommand extends Command
Command.OldNodeState
Modifier and Type | Field and Description |
---|---|
private double |
backupX |
private double |
backupY |
private Collection<Node> |
nodes
The objects that should be moved.
|
private 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(Collection<OsmPrimitive> objects,
double x,
double y)
Constructs a new
MoveCommand and assign the initial object set and movement vector. |
MoveCommand(Collection<OsmPrimitive> objects,
EastNorth offset)
Constructs a new
MoveCommand to move a collection of primitives. |
MoveCommand(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(Collection<OsmPrimitive> modified,
Collection<OsmPrimitive> deleted,
Collection<OsmPrimitive> added)
Fill in the changed data this command operates on.
|
Icon |
getDescriptionIcon()
Provides a descriptive icon of this command.
|
String |
getDescriptionText()
Provides a description text representing this command.
|
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, invalidBecauselayerRemoved
getChildren
private Collection<Node> nodes
private EastNorth startEN
private double x
private double y
private double backupX
private double backupY
private 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(Collection<OsmPrimitive> objects, EastNorth offset)
MoveCommand
to move a collection of primitives.objects
- The primitives to moveoffset
- The movement vectorpublic MoveCommand(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(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()
Command
executeCommand
in class Command
public void undoCommand()
Command
undoCommand
in class Command
public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added)
Command
fillModifiedData
in class Command
modified
- The modified primitivesdeleted
- The deleted primitivesadded
- The added primitivespublic String getDescriptionText()
PseudoCommand
getDescriptionText
in class PseudoCommand
public Icon getDescriptionIcon()
PseudoCommand
getDescriptionIcon
in class PseudoCommand
public Collection<Node> getParticipatingPrimitives()
Command
getParticipatingPrimitives
in class Command