|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.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 model 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 model specifier. |
static byte |
TAIL_RATIO
Symbolic ratio specifier. |
| Constructor Summary | |
|---|---|
SliderEdgeLabelModel(byte mode)
Returns a new instance of SliderEdgeLabelModel. |
|
| Method Summary | |
|---|---|
Object |
createModelParameter(YRectangle 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. |
YList |
getLabelCandidates(EdgeLabelLayout label,
EdgeLayout edgeLayout,
NodeLayout sourceNode,
NodeLayout targetNode)
Returns a list of candidate positions for the given edge label. |
YPoint |
getLabelPlacement(YDimension labelSize,
EdgeLayout edgeLayout,
NodeLayout sourceNode,
NodeLayout targetNode,
Object para)
Returns the coordinates of the upper-left corner of the label position encoded by the given model parameter. |
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 |
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)
mode - Determines which slider model to use.
Possible values are either CENTER_SLIDER or SIDE_SLIDER.| Method Detail |
|---|
public void setDistances(double minDistance,
double maxDistance)
minDistance - The minimal distance between label and edge.maxDistance - The maximal distance between label and edge.public void setDensity(double density)
density - The density value.
It has a range of 0.0 to 1.0.public void setNodeBorderDistance(double value)
value - The distance between label and node border.public Object getDefaultParameter()
SIDE_SLIDER
model) or at its middle (CENTER_SLIDER model).
getDefaultParameter in interface EdgeLabelModelEdgeLabelModel.getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object)
method.
public YPoint getLabelPlacement(YDimension labelSize,
EdgeLayout edgeLayout,
NodeLayout sourceNode,
NodeLayout targetNode,
Object para)
EdgeLabelModel
getLabelPlacement in interface EdgeLabelModellabelSize - 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 EdgeLabelModellabel - 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(YRectangle labelBounds,
EdgeLayout edgeLayout,
NodeLayout sourceNode,
NodeLayout targetNode)
EdgeLabelModel
createModelParameter in interface EdgeLabelModellabelBounds - 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-2008, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||