|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.SliderEdgeLabelModel
public class SliderEdgeLabelModel
An edge label model that allows placement of labels at a set of continuous positions along both sides of an edge or directly on the edge path.
The set of positions can be influenced by specifying the density value that controls the spacing between adjacent label positions. Furthermore, it's possible to specify distance values that control the distance between label and edge and between label and nodes.
Nested Class Summary | |
---|---|
static class |
SliderEdgeLabelModel.ModelParameter
Encodes the model parameters for the two slider edge label models specified by CENTER_SLIDER and SIDE_SLIDER . |
Field Summary | |
---|---|
static byte |
CENTER_RATIO
Symbolic ratio specifier. |
static byte |
CENTER_SLIDER
Symbolic slider mode specifier. |
static byte |
HEAD_RATIO
Symbolic ratio specifier. |
static byte |
LEFT_RATIO
Symbolic ratio specifier. |
static byte |
RIGHT_RATIO
Symbolic ratio specifier. |
static byte |
SIDE_SLIDER
Symbolic slider mode specifier. |
static byte |
TAIL_RATIO
Symbolic ratio specifier. |
Constructor Summary | |
---|---|
SliderEdgeLabelModel(byte mode)
Initializes a new instance of SliderEdgeLabelModel . |
Method Summary | |
---|---|
Object |
createModelParameter(OrientedRectangle labelBounds,
EdgeLayout edgeLayout,
NodeLayout sourceNode,
NodeLayout targetNode)
Creates a model parameter that represents the given edge label context best within this model. |
Object |
getDefaultParameter()
Returns a model parameter that encodes the default position of this model's allowed edge label positions. |
double |
getDensity()
Returns the density to generate label candidate positions. |
YList |
getLabelCandidates(EdgeLabelLayout label,
EdgeLayout edgeLayout,
NodeLayout sourceNode,
NodeLayout targetNode)
Returns a list of candidate positions for the given edge label. |
OrientedRectangle |
getLabelPlacement(YDimension labelSize,
EdgeLayout edgeLayout,
NodeLayout sourceNode,
NodeLayout targetNode,
Object para)
Returns the bounds of the label for the position encoded by the given model parameter. |
double |
getMaximumDistance()
Returns the maximum distance between the label's bounding box and the edge's path. |
double |
getMinimumDistance()
Returns the minimum distance between the label's bounding box and the edge's path. |
byte |
getMode()
Returns the model's slider mode. |
double |
getNodeBorderDistance()
Returns the minimal distance between the label's bounding box and a node's borders. |
YVector |
getOffsetVec(double dx,
double dy,
double width,
double height,
byte labelPosition)
Returns the offset vector for a given edge label and a given edge segment. |
void |
setDensity(double density)
Sets the density to generate label candidate positions. |
void |
setDistances(double minDistance,
double maxDistance)
Sets the minimum and maximum distances between the label's bounding box and the edge's path. |
void |
setMaximumDistance(double distance)
Sets the maximum distance between the label's bounding box and the edge's path. |
void |
setMinimumDistance(double distance)
Sets the minimum distance between the label's bounding box and the edge's path. |
void |
setNodeBorderDistance(double value)
Sets the minimal distance between the label's bounding box and a node's borders. |
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 CENTER_RATIO
CENTER_SLIDER
.
public static final byte TAIL_RATIO
SIDE_SLIDER
.
Determines a label to be right of or below the edge's path.
public static final byte HEAD_RATIO
SIDE_SLIDER
.
Determines a label to be left of or above the edge's path.
public static final byte LEFT_RATIO
SIDE_SLIDER
.
Determines a label to be left of the edge's path.
public static final byte RIGHT_RATIO
SIDE_SLIDER
.
Determines a label to be right of the edge's path.
Constructor Detail |
---|
public SliderEdgeLabelModel(byte mode)
SliderEdgeLabelModel
.
mode
- Determines which slider mode to use.
Possible values are either CENTER_SLIDER
or SIDE_SLIDER
.Method Detail |
---|
public byte getMode()
public void setDistances(double minDistance, double maxDistance)
minDistance
- The minimal distance between label and edge.maxDistance
- The maximal distance between label and edge.getMaximumDistance()
,
getMinimumDistance()
,
setMaximumDistance(double)
,
setMinimumDistance(double)
public double getMaximumDistance()
By default, a maximum distance of 1.0
is set.
setMaximumDistance(double)
,
setDistances(double, double)
public void setMaximumDistance(double distance)
By default, a maximum distance of 1.0
is set.
distance
- The maximal distance between label and edge.getMaximumDistance()
,
setDistances(double, double)
public double getMinimumDistance()
By default, a minimum distance of 1.0
is set.
setMinimumDistance(double)
,
setDistances(double, double)
public void setMinimumDistance(double distance)
By default, a minimum distance of 1.0
is set.
distance
- The minimal distance between label and edge.getMinimumDistance()
,
setDistances(double, double)
public double getDensity()
A density value of 1.0
(which is the default) generates the
most possible candidate positions without overlap.
setDensity(double)
public void setDensity(double density)
A density value of 1.0
(which is the default) generates the
most possible candidate positions without overlap.
density
- The density value.
It has a range of 0.0
to 1.0
.getDensity()
public double getNodeBorderDistance()
setNodeBorderDistance(double)
public void setNodeBorderDistance(double value)
value
- The distance between label and node border.getNodeBorderDistance()
public Object getDefaultParameter()
SIDE_SLIDER
model) or at its middle (CENTER_SLIDER
model).
getDefaultParameter
in interface EdgeLabelModel
EdgeLabelModel.getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object)
method.public OrientedRectangle getLabelPlacement(YDimension labelSize, EdgeLayout edgeLayout, NodeLayout sourceNode, NodeLayout targetNode, Object para)
EdgeLabelModel
getLabelPlacement
in interface EdgeLabelModel
labelSize
- The size of the label that should be placed.edgeLayout
- The layout of the edge to which the label belongs.sourceNode
- The layout of the source node of the label owning edge.targetNode
- The layout of the target node of the label owning edge.para
- The model parameter that describes the abstract position of the label within
this model.
The parameter must have been generated by this model.
public YList getLabelCandidates(EdgeLabelLayout label, EdgeLayout edgeLayout, NodeLayout sourceNode, NodeLayout targetNode)
getLabelCandidates
in interface EdgeLabelModel
label
- The label for which candidates should be generated.edgeLayout
- The layout of the edge to which the label belongs.sourceNode
- The layout of the source node of the label owning edge.targetNode
- The layout of the target node of the label owning edge.
EdgeLabelCandidate
objects.public Object createModelParameter(OrientedRectangle labelBounds, EdgeLayout edgeLayout, NodeLayout sourceNode, NodeLayout targetNode)
EdgeLabelModel
createModelParameter
in interface EdgeLabelModel
labelBounds
- The bounds of the label for which a parameter representation is sought.edgeLayout
- The layout of the edge to which the label belongs.sourceNode
- The layout of the source node of the label owning edge.targetNode
- The layout of the target node of the label owning edge.
EdgeLabelModel.getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object)
method.public YVector getOffsetVec(double dx, double dy, double width, double height, byte labelPosition)
dx
- x-coordinates delta for an edge segment.dy
- y-coordinates delta for an edge segment.width
- The label's width.height
- The label's height.labelPosition
- One of the symbolic ratio specifiers CENTER_RATIO
, LEFT_RATIO
,
or RIGHT_RATIO
.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |