Package org.openstreetmap.josm.command
Class ScaleCommand
- java.lang.Object
-
- org.openstreetmap.josm.command.Command
-
- org.openstreetmap.josm.command.TransformNodesCommand
-
- org.openstreetmap.josm.command.ScaleCommand
-
- All Implemented Interfaces:
PseudoCommand
public class ScaleCommand extends TransformNodesCommand
Command, to scale a given set of primitives. The relative distance of the nodes will be increased/decreased.
-
-
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
scalingFactor
Current scaling factor appliedprivate EastNorth
startEN
World position of the mouse when the user started the command.-
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 ScaleCommand(java.util.Collection<? extends OsmPrimitive> objects, EastNorth currentEN)
Creates a ScaleCommand.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.lang.String
getDescriptionText()
Provides a description text representing this command.double
getScalingFactor()
Returns the scaling factor.void
handleEvent(EastNorth currentEN)
Compute new scaling factor and transform nodes accordingly.int
hashCode()
protected void
setScalingFactor(double scalingFactor)
Set the scaling factorprotected void
transformNodes()
Scale 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
-
scalingFactor
private double scalingFactor
Current scaling factor applied
-
-
Constructor Detail
-
ScaleCommand
public ScaleCommand(java.util.Collection<? extends OsmPrimitive> objects, EastNorth currentEN)
Creates a ScaleCommand. Assign the initial object set, compute pivot point. Computation of pivot point is done by the same rules that are used in the "align nodes in circle" action.- Parameters:
objects
- objects to fetch nodes fromcurrentEN
- current east/north
-
-
Method Detail
-
handleEvent
public final void handleEvent(EastNorth currentEN)
Compute new scaling factor and transform nodes accordingly.- Specified by:
handleEvent
in classTransformNodesCommand
- Parameters:
currentEN
- the current world position of the mouse
-
setScalingFactor
protected void setScalingFactor(double scalingFactor)
Set the scaling factor- Parameters:
scalingFactor
- The scaling factor.
-
getScalingFactor
public double getScalingFactor()
Returns the scaling factor.- Returns:
- The scaling factor
-
transformNodes
protected void transformNodes()
Scale 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
-
-