|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.DiscreteEdgeLabelModel
public class DiscreteEdgeLabelModel
An edge label model that allows placement of labels at some positions along an edge.
It's possible to specify a distance value that controls the distance between label and edge. Furthermore, there's the possibility to mask out arbitrary edge label candidates. This can either be done by specifying predefined candidate masks or by OR-ing allowed label candidates to a user defined mask.
Field Summary | |
---|---|
static int |
CENTER
Symbolic position specifier. |
static int |
CENTERED
Position mask that constrains allowed positions to CENTER . |
static int |
HEAD
Symbolic position specifier. |
static int |
SCENTER
Symbolic position specifier. |
static int |
SHEAD
Symbolic position specifier. |
static int |
SIX_POS
Position mask that constrains allowed positions to a set of six positions on the "head" and "tail" sides of an edge. |
static int |
STAIL
Symbolic position specifier. |
static int |
TAIL
Symbolic position specifier. |
static int |
TCENTER
Symbolic position specifier. |
static int |
THEAD
Symbolic position specifier. |
static int |
THREE_CENTER
Position mask that constrains allowed positions to a set of three positions directly on the edge's path. |
static int |
TTAIL
Symbolic position specifier. |
static int |
TWO_POS
Position mask that constrains allowed positions to the two near the edge's end points. |
Constructor Summary | |
---|---|
DiscreteEdgeLabelModel()
Returns a new instance of DiscreteEdgeLabelModel. |
|
DiscreteEdgeLabelModel(int candidateMask)
Returns a new instance of DiscreteEdgeLabelModel. |
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. |
static Object |
createPositionParameter(int position)
Returns a model parameter that encodes the specified position. |
int |
getCandidateMask()
Returns the bit mask specifying the valid positions for edge labels. |
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 bounding box and the edge's path. |
YList |
getLabelCandidates(EdgeLabelLayout label,
EdgeLayout edgeLayout,
NodeLayout sourceNode,
NodeLayout targetNode)
Returns a list of EdgeLabelCandidate objects each of which describes
a valid label position within this model. |
protected OrientedRectangle |
getLabelPlacement(YDimension labelSize,
EdgeLayout edgeLayout,
NodeLayout sourceNode,
NodeLayout targetNode,
int pos)
Returns the coordinates of the upper-left corner of the given label position. |
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. |
boolean |
isParameterValid(Object parameter)
Checks if the given model parameter encodes an edge label position that is valid in this model. |
void |
setDistance(double value)
Sets the distance between the label's bounding box and 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 int SHEAD
public static final int HEAD
public static final int THEAD
public static final int STAIL
public static final int TAIL
public static final int TTAIL
public static final int SCENTER
public static final int CENTER
public static final int TCENTER
public static final int TWO_POS
HEAD
and TAIL
.
public static final int CENTERED
CENTER
.
public static final int SIX_POS
SHEAD
, HEAD
, THEAD
, STAIL
,
TAIL
, and TTAIL
.
public static final int THREE_CENTER
SCENTER
, CENTER
, and TCENTER
.
Constructor Detail |
---|
public DiscreteEdgeLabelModel()
SIX_POS
is used to define the allowed positions for
an edge label.
public DiscreteEdgeLabelModel(int candidateMask)
candidateMask
- Position mask that defines the allowed positions for an edge label.Method Detail |
---|
public int getCandidateMask()
Defaults to SIX_POS
.
public double getDistance()
public void setDistance(double value)
value
- A non-negative value.public Object getDefaultParameter()
CENTER
when none of the above
default positions is part of the allowed positions.
getDefaultParameter
in interface EdgeLabelModel
EdgeLabelModel.getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object)
method.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 static Object createPositionParameter(int position)
public boolean isParameterValid(Object parameter)
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)
EdgeLabelModel
EdgeLabelCandidate
objects each of which describes
a valid label position within this model.
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.protected OrientedRectangle getLabelPlacement(YDimension labelSize, EdgeLayout edgeLayout, NodeLayout sourceNode, NodeLayout targetNode, int pos)
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.pos
- A label position (given by a symbolic position specifier) that is valid in
this model.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |