Package org.openstreetmap.josm.command
Class RotateCommand
- java.lang.Object
-
- org.openstreetmap.josm.command.Command
-
- org.openstreetmap.josm.command.TransformNodesCommand
-
- org.openstreetmap.josm.command.RotateCommand
-
- All Implemented Interfaces:
PseudoCommand
public class RotateCommand extends TransformNodesCommand
RotateCommand rotates a number of objects around their centre.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.command.Command
Command.OldNodeState
-
-
Field Summary
Fields Modifier and Type Field Description private EastNorth
pivot
Pivot pointprivate double
rotationAngle
computed rotation angle between starting click and current mouse posprivate double
startAngle
angle of rotation starting click to pivot-
Fields inherited from class org.openstreetmap.josm.command.TransformNodesCommand
nodes, oldStates
-
Fields inherited from class org.openstreetmap.josm.command.Command
IS_INCOMPLETE, IS_OK, IS_OUTSIDE
-
-
Constructor Summary
Constructors Constructor Description RotateCommand(java.util.Collection<? extends OsmPrimitive> objects, EastNorth currentEN)
Creates a RotateCommand.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
protected double
getAngle(EastNorth currentEN)
Get angle between the horizontal axis and the line formed by the pivot and given point.java.lang.String
getDescriptionText()
Provides a description text representing this command.double
getRotationAngle()
Returns the rotation angle.void
handleEvent(EastNorth currentEN)
Compute new rotation angle and transform nodes accordingly.int
hashCode()
protected void
setRotationAngle(double rotationAngle)
Set the rotation angle.protected void
transformNodes()
Rotate nodes.-
Methods inherited from class org.openstreetmap.josm.command.TransformNodesCommand
executeCommand, fillModifiedData, flagNodesAsModified, getDescriptionIcon, getNodesCenter, getParticipatingPrimitives, getTransformedNodes, storeOldState, undoCommand
-
Methods inherited from class org.openstreetmap.josm.command.Command
checkOutlyingOrIncompleteOperation, ensurePrimitivesAreInDataset, getAffectedDataSet, getOrig
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.command.PseudoCommand
getChildren
-
-
-
-
Field Detail
-
startAngle
private final double startAngle
angle of rotation starting click to pivot
-
rotationAngle
private double rotationAngle
computed rotation angle between starting click and current mouse pos
-
-
Constructor Detail
-
RotateCommand
public RotateCommand(java.util.Collection<? extends OsmPrimitive> objects, EastNorth currentEN)
Creates a RotateCommand. Assign the initial object set, compute pivot point and initial rotation angle.- Parameters:
objects
- objects to fetch nodes fromcurrentEN
- current east/north
-
-
Method Detail
-
getAngle
protected final double getAngle(EastNorth currentEN)
Get angle between the horizontal axis and the line formed by the pivot and given point.- Parameters:
currentEN
- current east/north- Returns:
- angle between the horizontal axis and the line formed by the pivot and given point
-
handleEvent
public final void handleEvent(EastNorth currentEN)
Compute new rotation angle and transform nodes accordingly.- Specified by:
handleEvent
in classTransformNodesCommand
- Parameters:
currentEN
- the current world position of the mouse
-
setRotationAngle
protected void setRotationAngle(double rotationAngle)
Set the rotation angle.- Parameters:
rotationAngle
- The rotate angle
-
getRotationAngle
public double getRotationAngle()
Returns the rotation angle.- Returns:
- The rotation angle
-
transformNodes
protected void transformNodes()
Rotate nodes.- Specified by:
transformNodes
in classTransformNodesCommand
-
getDescriptionText
public java.lang.String getDescriptionText()
Description copied from interface:PseudoCommand
Provides a description text representing this command.- Specified by:
getDescriptionText
in interfacePseudoCommand
- Overrides:
getDescriptionText
in classTransformNodesCommand
- Returns:
- description text representing this command
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classTransformNodesCommand
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classTransformNodesCommand
-
-