|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.AutoRotationSliderEdgeLabelModel
public class AutoRotationSliderEdgeLabelModel
Special EdgeLabelModel
implementation used specifically for labels
that are being rotated automatically according to the path of the edge.
This model allows for the specification of a rotation center around which the
label is being rotated, as well as where the rotation center is located
relative to the edge path.
To use this label model do the following:
EdgeLabel label = edge.createLabel(); AutoRotationSliderEdgeLabelModel model = new AutoRotationSliderEdgeLabelModel(); //configure model.setDistance(0.0d); //register label.setLabelModel(model); label.setModelParameter(model.getDefaultParameter());Note that this implementation is currently not being serialized.
setDistance(double)
,
setAngle(double)
,
setAnchorRatioX(double)
,
setAnchorRatioY(double)
Nested Class Summary | |
---|---|
static class |
AutoRotationSliderEdgeLabelModel.Handler
Provides GraphML (de-)serialization support for AutoRotationSliderEdgeLabelModel and its parameters. |
Constructor Summary | |
---|---|
AutoRotationSliderEdgeLabelModel()
|
Method Summary | |
---|---|
Object |
createModelParameter(OrientedRectangle labelBounds,
EdgeLayout edgeLayout,
NodeLayout sourceLayout,
NodeLayout targetLayout)
Creates a model parameter that represents the given edge label context best within this model. |
protected double |
determineRotationAngle(double dx,
double dy)
Callback method that determines the rotation angle for a given edge segment's slope. |
double |
getAnchorRatioX()
Returns the position of the rotation point as a ratio within in the label's bounds. |
double |
getAnchorRatioY()
Returns the position of the rotation point as a ratio within in the label's bounds. |
double |
getAngle()
Returns the angle between the base line of the label and the edge segment. |
Object |
getDefaultParameter()
Returns a default parameter that indicates a position at the center of the edge's path. |
double |
getDensity()
Yields the density factor that influences the number of candidates that are yield during getLabelCandidates(y.layout.EdgeLabelLayout, y.layout.EdgeLayout, y.layout.NodeLayout, y.layout.NodeLayout) . |
double |
getDistance()
Determines how far away from the edge's path the rotation point lies. |
YList |
getLabelCandidates(EdgeLabelLayout labelLayout,
EdgeLayout edgeLayout,
NodeLayout sourceLayout,
NodeLayout targetLayout)
Returns a list of EdgeLabelCandidate objects each of which describes
a valid label position within this model. |
OrientedRectangle |
getLabelPlacement(YDimension labelSize,
EdgeLayout edgeLayout,
NodeLayout sourceLayout,
NodeLayout targetLayout,
Object param)
Returns the bounds of the label for the position encoded by the given model parameter. |
protected YPointPath |
getPointPath(EdgeLayout edgeLayout,
NodeLayout sourceLayout,
NodeLayout targetLayout)
Returns the point path associated with the given edge layout. |
double |
getRotationAngle(EdgeLabel label)
Returns the current rotation angle for the given label for this model. |
double |
getRotationAngle(EdgeLayout edgeLayout,
NodeLayout sourceLayout,
NodeLayout targetLayout,
Object param)
Returns the rotation angle for the given set of entities that would be used by this instance of the label model. |
void |
setAnchorRatioX(double anchorRatioX)
Sets the relative position of the rotation point as a ratio within in the label's bounds. |
void |
setAnchorRatioY(double anchorRatioY)
Sets the relative position of the rotation point as a ratio within in the label's bounds. |
void |
setAngle(double angle)
Sets the angle between the base line of the label and the edge segment. |
void |
setDensity(double density)
Sets the density factor that influences the number of candidates that are yield during getLabelCandidates(y.layout.EdgeLabelLayout, y.layout.EdgeLayout, y.layout.NodeLayout, y.layout.NodeLayout) . |
void |
setDistance(double distance)
Determines how far away from the edge's path the rotation point lies. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AutoRotationSliderEdgeLabelModel()
Method Detail |
---|
public double getDensity()
getLabelCandidates(y.layout.EdgeLabelLayout, y.layout.EdgeLayout, y.layout.NodeLayout, y.layout.NodeLayout)
.
Values greater than 1 will yield more candidates, values smaller than 1 will decrease the number of candidates.
The default is 1.0d
public void setDensity(double density)
getLabelCandidates(y.layout.EdgeLabelLayout, y.layout.EdgeLayout, y.layout.NodeLayout, y.layout.NodeLayout)
.
Values greater than 1 will yield more candidates, values smaller than 1 will decrease the number of candidates.
The default is 1.0d
density
- the density factor for label candidatespublic double getAngle()
0
results in the label being aligned in parallel with
the edge's segment.
public void setAngle(double angle)
0
results in the label being aligned in parallel with
the edge's segment.
angle
- the new angle in radianpublic double getAnchorRatioX()
0.0d
results in the label being rotated around its left
border.
getAnchorRatioY()
public void setAnchorRatioX(double anchorRatioX)
0.0d
results in the label being rotated around its left
border.
anchorRatioX
- the ratio that indicates the position of the rotation point within the labelpublic double getAnchorRatioY()
0.0d
results in the label being rotated around its upper
border.
getAnchorRatioX()
public void setAnchorRatioY(double anchorRatioY)
0.0d
results in the label being rotated around its upper
border.
anchorRatioY
- the ratio that indicates the position of the rotation point within the labelpublic double getDistance()
public void setDistance(double distance)
distance
- the signed distancepublic Object getDefaultParameter()
getDefaultParameter
in interface EdgeLabelModel
public OrientedRectangle getLabelPlacement(YDimension labelSize, EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout, Object param)
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.sourceLayout
- The layout of the source node of the label owning edge.targetLayout
- The layout of the target node of the label owning edge.param
- The model parameter that describes the abstract position of the label within
this model.
The parameter must have been generated by this model.
protected YPointPath getPointPath(EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout)
protected double determineRotationAngle(double dx, double dy)
dx
- the normalized dx of the direction vector of the segment.dy
- the normalized dy of the direction vector of the segment.
public YList getLabelCandidates(EdgeLabelLayout labelLayout, EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout)
EdgeLabelModel
EdgeLabelCandidate
objects each of which describes
a valid label position within this model.
getLabelCandidates
in interface EdgeLabelModel
labelLayout
- The label for which candidates should be generated.edgeLayout
- The layout of the edge to which the label belongs.sourceLayout
- The layout of the source node of the label owning edge.targetLayout
- The layout of the target node of the label owning edge.
EdgeLabelCandidate
objects.public Object createModelParameter(OrientedRectangle labelBounds, EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout)
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.sourceLayout
- The layout of the source node of the label owning edge.targetLayout
- The layout of the target node of the label owning edge.
EdgeLabelModel.getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object)
method.public double getRotationAngle(EdgeLabel label)
label
- the label that has been configured with this model.
public double getRotationAngle(EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout, Object param)
edgeLayout
- the layout of the edgesourceLayout
- the layout of the source nodetargetLayout
- the layout of the target nodeparam
- the currently being used parameter
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |