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 EastNorthpivotPivot pointprivate doublescalingFactorCurrent scaling factor appliedprivate EastNorthstartENWorld 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 booleanequals(java.lang.Object obj)java.lang.StringgetDescriptionText()Provides a description text representing this command.doublegetScalingFactor()Returns the scaling factor.voidhandleEvent(EastNorth currentEN)Compute new scaling factor and transform nodes accordingly.inthashCode()protected voidsetScalingFactor(double scalingFactor)Set the scaling factorprotected voidtransformNodes()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:
handleEventin 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:
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
-
-