public class DynamicAnchor extends AbstractAnchor
DynamicAnchor
computes anchor positions based on a reference
position per anchored and one reference position for the anchorage. The
anchoreds' reference positions are provided when
attaching
an AnchorKey
. The
computation is carried out by a DynamicAnchor.IComputationStrategy
. The default
computation strategy (DynamicAnchor.ProjectionStrategy
) will connect anchored and
anchorage reference position and compute the intersection with the outline of
the anchorage.Type | Property and Description |
---|---|
javafx.beans.property.ReadOnlyMapProperty<AnchorKey,DynamicAnchor.IComputationStrategy> |
computationStrategy
Returns a
ReadOnlyMapProperty that stores the individual
DynamicAnchor.IComputationStrategy for each AnchorKey . |
javafx.beans.property.ObjectProperty<DynamicAnchor.IComputationStrategy> |
defaultComputationStrategy
Returns a writable object property for the
DynamicAnchor.IComputationStrategy
used by this DynamicAnchor . |
javafx.beans.property.ReadOnlyMapProperty<AnchorKey,Point> |
referencePoint
Provides a
ReadOnlyMapProperty that stores positions (in the
local coordinate system of the anchored Node ) for all attached
AnchorKey s. |
anchorage, position
Modifier and Type | Class and Description |
---|---|
static class |
DynamicAnchor.AbstractComputationStrategy
Abstract base class for
computation
strategies that are based on the outline of the anchorage reference
geometry. |
static interface |
DynamicAnchor.IComputationStrategy
The
DynamicAnchor.IComputationStrategy is responsible for computing anchor
positions based on an anchorage Node , an anchored Node ,
and an anchored reference position (
DynamicAnchor.IComputationStrategy.computePositionInScene(Node, Node, Point) ). |
static class |
DynamicAnchor.OrthogonalProjectionStrategy
An
DynamicAnchor.IComputationStrategy that computes anchor position by
orthogonally projecting the respective anchored reference point to the
outline of the anchorage reference geometry so that the respective point
has minimal distance to the anchored reference point and resembles the
same x- (vertical projection) or y-coordinate (horizontal projection). |
static class |
DynamicAnchor.ProjectionStrategy
An
DynamicAnchor.IComputationStrategy that computes anchor position by
projecting the respective anchored reference point to the outline of the
anchorage reference geometry so that the respective point has minimal
distance to the anchored reference point. |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_COMPUTATION_STRATEGY_PROPERTY
The name of the
computation
strategy property . |
Constructor and Description |
---|
DynamicAnchor(javafx.scene.Node anchorage)
Constructs a new
DynamicAnchor for the given anchorage visual. |
DynamicAnchor(javafx.scene.Node anchorage,
DynamicAnchor.IComputationStrategy computationStrategy)
Constructs a new
DynamicAnchor for the given anchorage visual
using the given DynamicAnchor.IComputationStrategy . |
Modifier and Type | Method and Description |
---|---|
javafx.beans.property.ReadOnlyMapProperty<AnchorKey,DynamicAnchor.IComputationStrategy> |
computationStrategyProperty()
Returns a
ReadOnlyMapProperty that stores the individual
DynamicAnchor.IComputationStrategy for each AnchorKey . |
protected Point |
computePosition(AnchorKey key)
Recomputes the position for the given attached
AnchorKey . |
Point |
computePosition(javafx.scene.Node anchored,
Point anchoredReferencePointInLocal,
DynamicAnchor.IComputationStrategy computationStrategy)
Computes the point of intersection between the outline of the anchorage
reference shape and the line through the reference points of anchorage
and anchored.
|
javafx.beans.property.ObjectProperty<DynamicAnchor.IComputationStrategy> |
defaultComputationStrategyProperty()
Returns a writable object property for the
DynamicAnchor.IComputationStrategy
used by this DynamicAnchor . |
DynamicAnchor.IComputationStrategy |
getComputationStrategy(AnchorKey key)
Returns the
DynamicAnchor.IComputationStrategy that is used by this
DynamicAnchor to compute the position for the given
AnchorKey . |
DynamicAnchor.IComputationStrategy |
getDefaultComputationStrategy()
Returns the default
DynamicAnchor.IComputationStrategy used by this
DynamicAnchor when no DynamicAnchor.IComputationStrategy is explicitly
set for an AnchorKey . |
Point |
getReferencePoint(AnchorKey key)
|
javafx.beans.property.ReadOnlyMapProperty<AnchorKey,Point> |
referencePointProperty()
Provides a
ReadOnlyMapProperty that stores positions (in the
local coordinate system of the anchored Node ) for all attached
AnchorKey s. |
void |
removeComputationStrategy(AnchorKey key)
Removes the
DynamicAnchor.IComputationStrategy that is currently registered for
the given AnchorKey . |
void |
setComputationStrategy(AnchorKey key,
DynamicAnchor.IComputationStrategy computationStrategy)
Sets the given
DynamicAnchor.IComputationStrategy to be used by this
DynamicAnchor to compute the position for the given
AnchorKey . |
void |
setDefaultComputationStrategy(DynamicAnchor.IComputationStrategy computationStrategy)
Sets the given
DynamicAnchor.IComputationStrategy for this
DynamicAnchor as the default strategy. |
anchorageProperty, attach, detach, getAnchorage, getKeys, getPosition, isAttached, positionProperty, registerVCL, registerVCLs, setAnchorage, unregisterVCL, unregisterVCLs, updatePosition
public javafx.beans.property.ReadOnlyMapProperty<AnchorKey,DynamicAnchor.IComputationStrategy> computationStrategyProperty
ReadOnlyMapProperty
that stores the individual
DynamicAnchor.IComputationStrategy
for each AnchorKey
.public javafx.beans.property.ObjectProperty<DynamicAnchor.IComputationStrategy> defaultComputationStrategyProperty
DynamicAnchor.IComputationStrategy
used by this DynamicAnchor
.public static final java.lang.String DEFAULT_COMPUTATION_STRATEGY_PROPERTY
computation
strategy property
.public DynamicAnchor(javafx.scene.Node anchorage)
DynamicAnchor
for the given anchorage visual.
Uses the default computation strategy ( DynamicAnchor.ProjectionStrategy
).anchorage
- The anchorage visual.public DynamicAnchor(javafx.scene.Node anchorage, DynamicAnchor.IComputationStrategy computationStrategy)
DynamicAnchor
for the given anchorage visual
using the given DynamicAnchor.IComputationStrategy
.anchorage
- The anchorage visual.computationStrategy
- The DynamicAnchor.IComputationStrategy
to use.public javafx.beans.property.ReadOnlyMapProperty<AnchorKey,DynamicAnchor.IComputationStrategy> computationStrategyProperty()
ReadOnlyMapProperty
that stores the individual
DynamicAnchor.IComputationStrategy
for each AnchorKey
.protected Point computePosition(AnchorKey key)
AnchorKey
.computePosition
in class AbstractAnchor
key
- The AnchorKey
for which to compute an anchor position.AnchorKey
.public Point computePosition(javafx.scene.Node anchored, Point anchoredReferencePointInLocal, DynamicAnchor.IComputationStrategy computationStrategy)
anchored
- The to be anchored Node
for which the anchor position
is to be determined.anchoredReferencePointInLocal
- A reference Point
used for calculation of the anchor
position, provided within the local coordinate system of the
to be anchored Node
.computationStrategy
- The DynamicAnchor.IComputationStrategy
that is used to compute the
position based on the given reference point.Node
.public javafx.beans.property.ObjectProperty<DynamicAnchor.IComputationStrategy> defaultComputationStrategyProperty()
DynamicAnchor.IComputationStrategy
used by this DynamicAnchor
.public DynamicAnchor.IComputationStrategy getComputationStrategy(AnchorKey key)
DynamicAnchor.IComputationStrategy
that is used by this
DynamicAnchor
to compute the position for the given
AnchorKey
. If no DynamicAnchor.IComputationStrategy
was explicitly set
for the given AnchorKey
, then the
getDefaultComputationStrategy()
is returned.key
- The AnchorKey
for which the
DynamicAnchor.IComputationStrategy
is determined.DynamicAnchor.IComputationStrategy
that is used by this
DynamicAnchor
to compute the position for the given
AnchorKey
.public DynamicAnchor.IComputationStrategy getDefaultComputationStrategy()
DynamicAnchor.IComputationStrategy
used by this
DynamicAnchor
when no DynamicAnchor.IComputationStrategy
is explicitly
set for an AnchorKey
.DynamicAnchor.IComputationStrategy
.public javafx.beans.property.ReadOnlyMapProperty<AnchorKey,Point> referencePointProperty()
ReadOnlyMapProperty
that stores positions (in the
local coordinate system of the anchored Node
) for all attached
AnchorKey
s.public void removeComputationStrategy(AnchorKey key)
DynamicAnchor.IComputationStrategy
that is currently registered for
the given AnchorKey
.key
- The AnchorKey
for which to remove the associated
DynamicAnchor.IComputationStrategy
.public void setComputationStrategy(AnchorKey key, DynamicAnchor.IComputationStrategy computationStrategy)
DynamicAnchor.IComputationStrategy
to be used by this
DynamicAnchor
to compute the position for the given
AnchorKey
.key
- The AnchorKey
for which the given
DynamicAnchor.IComputationStrategy
will be used to compute its
position.computationStrategy
- The DynamicAnchor.IComputationStrategy
that will be used to compute
positions for the given AnchorKey
.public void setDefaultComputationStrategy(DynamicAnchor.IComputationStrategy computationStrategy)
DynamicAnchor.IComputationStrategy
for this
DynamicAnchor
as the default strategy.computationStrategy
- The new default DynamicAnchor.IComputationStrategy
.Copyright (c) 2014 itemis AG and others. All rights reserved.