org.openstreetmap.josm.command
Class RotateCommand

java.lang.Object
  extended by org.openstreetmap.josm.command.PseudoCommand
      extended by org.openstreetmap.josm.command.Command
          extended by org.openstreetmap.josm.command.TransformNodesCommand
              extended by org.openstreetmap.josm.command.RotateCommand

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.TransformNodesCommand
TransformNodesCommand.OldState
 
Field Summary
private  EastNorth pivot
          Pivot point
private  double rotationAngle
          computed rotation angle between starting click and current mouse pos
private  double startAngle
          angle of rotation starting click to pivot
(package private)  EastNorth startEN
          World position of the mouse when the user started the command.
 
Fields inherited from class org.openstreetmap.josm.command.TransformNodesCommand
nodes, oldStates
 
Constructor Summary
RotateCommand(java.util.Collection<OsmPrimitive> objects, EastNorth currentEN)
          Creates a RotateCommand.
 
Method Summary
protected  double getAngle(EastNorth currentEN)
          Get angle between the horizontal axis and the line formed by the pivot and give points.
 javax.swing.Icon getDescriptionIcon()
          Provides a descriptive icon of this command.
 java.lang.String getDescriptionText()
          Provides a description text representing this command.
 void handleEvent(EastNorth currentEN)
          Compute new rotation angle and transform nodes accordingly.
protected  void transformNodes()
          Rotate nodes.
 
Methods inherited from class org.openstreetmap.josm.command.TransformNodesCommand
executeCommand, fillModifiedData, flagNodesAsModified, getNodesCenter, getParticipatingPrimitives, getTransformedNodes, storeOldState, undoCommand
 
Methods inherited from class org.openstreetmap.josm.command.Command
checkAndConfirmOutlyingOperation, getLayer, getOrig, invalidBecauselayerRemoved
 
Methods inherited from class org.openstreetmap.josm.command.PseudoCommand
getChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pivot

private EastNorth pivot
Pivot point


startEN

EastNorth startEN
World position of the mouse when the user started the command.


startAngle

private 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<OsmPrimitive> objects,
                     EastNorth currentEN)
Creates a RotateCommand. Assign the initial object set, compute pivot point and inital rotation angle.

Method Detail

getAngle

protected double getAngle(EastNorth currentEN)
Get angle between the horizontal axis and the line formed by the pivot and give points.


handleEvent

public void handleEvent(EastNorth currentEN)
Compute new rotation angle and transform nodes accordingly.

Specified by:
handleEvent in class TransformNodesCommand
Parameters:
currentEN - the current world position of the mouse

transformNodes

protected void transformNodes()
Rotate nodes.

Specified by:
transformNodes in class TransformNodesCommand

getDescriptionText

public java.lang.String getDescriptionText()
Description copied from class: PseudoCommand
Provides a description text representing this command.

Overrides:
getDescriptionText in class TransformNodesCommand

getDescriptionIcon

public javax.swing.Icon getDescriptionIcon()
Description copied from class: PseudoCommand
Provides a descriptive icon of this command.

Overrides:
getDescriptionIcon in class TransformNodesCommand


JOSM