public class FXTransformPolicy extends AbstractPolicy<javafx.scene.Node> implements ITransactional
Modifier and Type | Field and Description |
---|---|
protected boolean |
initialized
Stores the initialized flag for this policy, i.e.
|
static java.lang.String |
TRANSFORMATION_PROVIDER_ROLE
The role name for the
Provider<Affine> that will be
used to obtain the host's Affine transformation. |
Constructor and Description |
---|
FXTransformPolicy() |
Modifier and Type | Method and Description |
---|---|
IUndoableOperation |
commit()
Returns an
IUndoableOperation that performs all manipulations
applied by the policy since the last ITransactional.init() call. |
javafx.scene.transform.Affine |
getNodeTransform()
Returns the
Affine transformation that is returned by the
Provider<Affine> that is installed on the
host under the TRANSFORMATION_PROVIDER_ROLE
role. |
protected static Dimension |
getSnapToGridOffset(GridModel gridModel,
double localX,
double localY,
double gridCellWidthFraction,
double gridCellHeightFraction)
Computes the offset which needs to be added to the given local
coordinates in order to stay on the grid/snap to the grid.
|
void |
init()
Initializes the policy, so that the policy's "work" methods can be used.
|
void |
setConcatenation(AffineTransform transform)
Concatenates the given
AffineTransform to the initial
transformation. |
void |
setPreConcatenation(AffineTransform transform)
Concatenates the initial transformation to the given
AffineTransform . |
void |
setTransform(AffineTransform newTransform)
Changes the
host's transformation to the given
AffineTransform . |
commit, disableRefreshVisuals, enableRefreshVisuals, getAdaptable, getHost, init, setAdaptable
public static final java.lang.String TRANSFORMATION_PROVIDER_ROLE
Provider<Affine>
that will be
used to obtain the host's Affine
transformation.protected boolean initialized
protected static Dimension getSnapToGridOffset(GridModel gridModel, double localX, double localY, double gridCellWidthFraction, double gridCellHeightFraction)
gridModel
- The GridModel
of the host's IViewer
.localX
- The x-coordinate in host coordinates.localY
- The y-coordinate in host coordinates.gridCellWidthFraction
- The granularity of the horizontal grid steps.gridCellHeightFraction
- The granularity of the vertical grid steps.Dimension
representing the offset that needs to be
added to the local coordinates so that they snap to the grid.public IUndoableOperation commit()
ITransactional
IUndoableOperation
that performs all manipulations
applied by the policy since the last ITransactional.init()
call. When called
multiple times in sequence, only the first call will yield an operation,
the subsequent calls will yield null
.commit
in interface ITransactional
IUndoableOperation
that performs all manipulations
applied by the policy since the last ITransactional.init()
call.public javafx.scene.transform.Affine getNodeTransform()
Affine
transformation that is returned by the
Provider<Affine>
that is installed on the
host
under the TRANSFORMATION_PROVIDER_ROLE
role.Affine
transformation that is returned by the
Provider<Affine>
that is installed on the
host
under the
TRANSFORMATION_PROVIDER_ROLE
role.public void init()
ITransactional
IllegalStateException
. It is safe to call ITransactional.init()
multiple times in sequence.init
in interface ITransactional
public void setConcatenation(AffineTransform transform)
AffineTransform
to the initial
transformation.transform
- The AffineTransform
that is concatenated to the
initial transformation.public void setPreConcatenation(AffineTransform transform)
AffineTransform
.transform
- The AffineTransform
to which the initial
transformation is concatenated.public void setTransform(AffineTransform newTransform)
host's
transformation to the given
AffineTransform
.newTransform
- The new AffineTransform
for the host
.Copyright (c) 2014 itemis AG and others. All rights reserved.