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 EastNorthpivotPivot pointprivate doublerotationAnglecomputed rotation angle between starting click and current mouse posprivate doublestartAngleangle 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 booleanequals(java.lang.Object obj)protected doublegetAngle(EastNorth currentEN)Get angle between the horizontal axis and the line formed by the pivot and given point.java.lang.StringgetDescriptionText()Provides a description text representing this command.doublegetRotationAngle()Returns the rotation angle.voidhandleEvent(EastNorth currentEN)Compute new rotation angle and transform nodes accordingly.inthashCode()protected voidsetRotationAngle(double rotationAngle)Set the rotation angle.protected voidtransformNodes()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:
handleEventin 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:
transformNodesin classTransformNodesCommand
-
getDescriptionText
public java.lang.String getDescriptionText()
Description copied from interface:PseudoCommandProvides a description text representing this command.- Specified by:
getDescriptionTextin interfacePseudoCommand- Overrides:
getDescriptionTextin classTransformNodesCommand- Returns:
- description text representing this command
-
hashCode
public int hashCode()
- Overrides:
hashCodein classTransformNodesCommand
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classTransformNodesCommand
-
-