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
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
FieldsModifier and TypeFieldDescriptionprivate doublescaling factor applied previouslyprivate final EastNorthPivot pointprivate doubleCurrent scaling factor appliedprivate EastNorthWorld position of the mouse when the user started the command.Fields 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
ConstructorsConstructorDescriptionScaleCommand(Collection<? extends OsmPrimitive> objects, EastNorth currentEN) Creates a ScaleCommand. -
Method Summary
Modifier and TypeMethodDescriptionprivate doublecalcScalingFactor(EastNorth currentEN) booleanProvides a description text representing this command.doubleReturns the scaling factor.final voidhandleEvent(EastNorth currentEN) Compute new scaling factor and transform nodes accordingly.voidhandleUpdate(EastNorth newStartEN) Handle a repeated scaling action where the mouse was moved to a different position see #24695inthashCode()protected voidsetScalingFactor(double scalingFactor) Set the scaling factorprotected voidScale 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 -
scalingFactor
Current scaling factor applied -
deltaScalingFactor
scaling factor applied previously -
startEN
World position of the mouse when the user started the command.
-
-
Constructor Details
-
ScaleCommand
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 Details
-
handleEvent
Compute new scaling factor and transform nodes accordingly.- Specified by:
handleEventin classTransformNodesCommand- Parameters:
currentEN- the current world position of the mouse
-
handleUpdate
Handle a repeated scaling action where the mouse was moved to a different position see #24695- Parameters:
newStartEN- start cursor position of a repeated scaling- Since:
- 19566
-
calcScalingFactor
-
setScalingFactor
Set the scaling factor- Parameters:
scalingFactor- The scaling factor.
-
getScalingFactor
Returns the scaling factor.- Returns:
- The scaling factor
-
transformNodes
Scale 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
-