|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.RotatedSliderEdgeLabelModel
public class RotatedSliderEdgeLabelModel
RotatedSliderEdgeLabelModel
allows placement of labels at a set of continuous rotated positions
along both sides of an edge or directly on the edge path.
It is possible to specify distance values that control the distance between label and edge and between label and nodes.
CENTER_SLIDER
mode on the left, SIDE_SLIDER
mode in the middle and SINGLE_SIDE_SLIDER
on the right
Field Summary | |
---|---|
static byte |
CENTER_SLIDER
Slider mode specifier which describes continuous label positions directly on the edge path. |
static byte |
SIDE_SLIDER
Slider mode specifier which describes continuous label positions along the sides of the edge path. |
static byte |
SINGLE_SIDE_SLIDER
Slider mode specifier which describes continuous label positions along one side of the edge path. |
Constructor Summary | |
---|---|
RotatedSliderEdgeLabelModel(byte mode)
Creates a new instance of RotatedSliderEdgeLabelModel with the given mode. |
Method Summary | |
---|---|
java.lang.Object |
createModelParameter(OrientedRectangle labelBounds,
EdgeLayout edgeLayout,
NodeLayout sourceNode,
NodeLayout targetNode)
Creates a model parameter that represents the given edge label position within this model. |
double |
getAngle()
Returns the angle (measured in radians) of the label model. |
java.lang.Object |
getDefaultParameter()
Returns a model parameter that encodes the default position of this model's allowed edge label positions. |
double |
getDistance()
Returns the distance between the label's box and the edge's path. |
YList |
getLabelCandidates(EdgeLabelLayout labelLayout,
EdgeLayout edgeLayout,
NodeLayout sourceLayout,
NodeLayout targetLayout)
Returns all EdgeLabelCandidate s that describe valid label positions within this model. |
OrientedRectangle |
getLabelPlacement(YDimension labelSize,
EdgeLayout edgeLayout,
NodeLayout sourceNode,
NodeLayout targetNode,
java.lang.Object para)
Returns the oriented box of the label for the position encoded by the given model parameter. |
byte |
getMode()
Returns the model's slider mode which determines whether the label slides on the edge ,
along both sides of the edge or along one side of the edge . |
boolean |
isAutoFlippingEnabled()
Returns whether or not edge labels get flipped if they would be upside down in their current position. |
boolean |
isAutoRotationEnabled()
Returns whether or not edge labels are automatically rotated according to the angle of the corresponding reference edge segment. |
boolean |
isDistanceRelativeToEdge()
Returns whether or not the distance to the edge is interpreted relative to the edge's path. |
void |
setAngle(double angle)
Specifies the angle (measured in radians) of the label model. |
void |
setAutoFlippingEnabled(boolean autoFlippingEnabled)
Specifies whether or not edge labels get flipped if they would be upside down in their current position. |
void |
setAutoRotationEnabled(boolean enabled)
Specifies whether or not edge labels are automatically rotated according to the angle of the corresponding reference edge segment. |
void |
setDistance(double distance)
Specifies the distance between the label's box and the edge's path. |
void |
setDistanceRelativeToEdge(boolean distanceRelativeToEdge)
Specifies whether or not the distance to the edge is interpreted relative to the edge's path. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte CENTER_SLIDER
public static final byte SIDE_SLIDER
public static final byte SINGLE_SIDE_SLIDER
distance
. A positive distance will
result in a right slider while negative distance will result in a left slider. Those sides are defined
relative to the segment's direction.getMode()
,
Constant Field ValuesLabels are placed at one side of the edge |
Constructor Detail |
---|
public RotatedSliderEdgeLabelModel(byte mode)
RotatedSliderEdgeLabelModel
with the given mode.
mode
- the slider modegetMode()
Method Detail |
---|
public byte getMode()
on the edge
,
along both sides of the edge
or along one side of the edge
.
public boolean isDistanceRelativeToEdge()
If enabled, the label is placed to the left of the edge segment (relative to the segment direction) if the given
distance is less than 0
and to the right of the edge segment if the given distance is greater than
0
.
If disabled, the label is placed below the edge segment (in geometric sense) if the distance is less than
0
and above the edge segment if the distance is greater than 0
.
true
if the distance is described relative to the edge, false
otherwisesetDistanceRelativeToEdge(boolean)
,
setDistance(double)
public void setDistanceRelativeToEdge(boolean distanceRelativeToEdge)
If enabled, the label is placed to the left of the edge segment (relative to the segment direction) if the given
distance is less than 0
and to the right of the edge segment if the given distance is greater than
0
.
If disabled, the label is placed below the edge segment (in geometric sense) if the distance is less than
0
and above the edge segment if the distance is greater than 0
.
distanceRelativeToEdge
- true
if the distance should be described relative to the edge,
false
otherwisesetDistance(double)
public double getDistance()
isDistanceRelativeToEdge()
.setDistanceRelativeToEdge(boolean)
,
setDistance(double)
public void setDistance(double distance)
public boolean isAutoRotationEnabled()
true
if edge labels are automatically rotated according to the angle of the corresponding
reference edge segment, false
otherwisesetAutoRotationEnabled(boolean)
public void setAutoRotationEnabled(boolean enabled)
public boolean isAutoFlippingEnabled()
true
if edge labels get flipped if they would be upside down in their current position,
false
otherwisesetAutoFlippingEnabled(boolean)
public void setAutoFlippingEnabled(boolean autoFlippingEnabled)
public double getAngle()
setAngle(double)
public void setAngle(double angle)
public java.lang.Object getDefaultParameter()
This parameter can be passed to getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object)
to retrieve the corresponding label box.
slider modes
are relative to the
first edge segment, either at the beginning of the segment (SIDE_SLIDER
or SINGLE_SIDE_SLIDER
) or
at its middle (CENTER_SLIDER
).
getDefaultParameter
in interface EdgeLabelModel
getMode()
public OrientedRectangle getLabelPlacement(YDimension labelSize, EdgeLayout edgeLayout, NodeLayout sourceNode, NodeLayout targetNode, java.lang.Object para)
EdgeLabelModel
getLabelPlacement
in interface EdgeLabelModel
labelSize
- the width and height of the labeledgeLayout
- the layout of the edge to which the label belongssourceNode
- the layout of the source node of the label-owning edgetargetNode
- the layout of the target node of the label-owning edgepara
- the model parameter that describes the abstract position of the label within this model
public YList getLabelCandidates(EdgeLabelLayout labelLayout, EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout)
EdgeLabelCandidate
s that describe valid label positions within this model.
The number of candidates and their respective locations are computed depending on the geometries of both label and
edge.
getLabelCandidates
in interface EdgeLabelModel
labelLayout
- the label for which candidates should be generatededgeLayout
- the layout of the edge to which the label belongssourceLayout
- the layout of the source node of the label-owning edgetargetLayout
- the layout of the target node of the label-owning edge
EdgeLabelCandidate
instancespublic java.lang.Object createModelParameter(OrientedRectangle labelBounds, EdgeLayout edgeLayout, NodeLayout sourceNode, NodeLayout targetNode)
EdgeLabelModel
The created model parameter is the closest parameter representation of the given label location that can be achieved within this model.
This parameter can be passed to EdgeLabelModel.getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object)
to retrieve the current label box.
A model parameter can be an arbitrary Object
. However it must contain all information to allow restoring
of the encoded location with this EdgeLabelModel
.
createModelParameter
in interface EdgeLabelModel
labelBounds
- the oriented box of the label, encoding the label location for which the parameter should be creatededgeLayout
- the layout of the edge to which the label belongssourceNode
- the layout of the source node of the label-owning edgetargetNode
- the layout of the target node of the label-owning edge
EdgeLabelModel.getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |