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
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
FieldsModifier and TypeFieldDescriptionprivate doubleprivate final EastNorthPivot pointprivate doublecomputed rotation angle between starting click and current mouse posprivate doubleangle of rotation starting click to pivotFields inherited from class org.openstreetmap.josm.command.TransformNodesCommand
nodes, oldStatesFields inherited from class org.openstreetmap.josm.command.Command
IS_INCOMPLETE, IS_OK, IS_OUTSIDE -
Constructor Summary
ConstructorsConstructorDescriptionRotateCommand(Collection<? extends OsmPrimitive> objects, EastNorth currentEN) Creates a RotateCommand. -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected final doubleGet angle between the horizontal axis and the line formed by the pivot and given point.Provides a description text representing this command.doubleReturns the rotation angle.final voidhandleEvent(EastNorth currentEN) Compute new rotation angle and transform nodes accordingly.voidhandleUpdate(EastNorth startEN) Handle a repeated rotation action where the mouse was moved to a different position see #24695inthashCode()protected voidsetRotationAngle(double rotationAngle) Set the rotation angle.protected voidRotate nodes.Methods inherited from class org.openstreetmap.josm.command.TransformNodesCommand
executeCommand, fillModifiedData, flagNodesAsModified, getDescriptionIcon, getNodesCenter, getParticipatingPrimitives, getTransformedNodes, storeOldState, undoCommandMethods inherited from class org.openstreetmap.josm.command.Command
checkOutlyingOrIncompleteOperation, ensurePrimitivesAreInDataset, getAffectedDataSet, getOrigMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.command.PseudoCommand
getChildren
-
Field Details
-
pivot
Pivot point -
startAngle
angle of rotation starting click to pivot -
rotationAngle
computed rotation angle between starting click and current mouse pos -
deltaAngle
-
-
Constructor Details
-
RotateCommand
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 Details
-
getAngle
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
Compute new rotation angle and transform nodes accordingly.- Specified by:
handleEventin classTransformNodesCommand- Parameters:
currentEN- the current world position of the mouse
-
handleUpdate
Handle a repeated rotation action where the mouse was moved to a different position see #24695- Parameters:
startEN- start cursor position of a repeated rotation- Since:
- 19566
-
setRotationAngle
Set the rotation angle.- Parameters:
rotationAngle- The rotate angle
-
getRotationAngle
Returns the rotation angle.- Returns:
- The rotation angle
-
transformNodes
Rotate nodes.- Specified by:
transformNodesin classTransformNodesCommand
-
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
- Overrides:
hashCodein classTransformNodesCommand
-
equals
- Overrides:
equalsin classTransformNodesCommand
-