|
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 | |
---|---|
java.lang.Object |
createModelParameter(OrientedRectangle labelBounds,
EdgeLayout edgeLayout,
NodeLayout sourceLayout,
NodeLayout targetLayout)
Creates a model parameter that represents the given edge label position 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. |
java.lang.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 all EdgeLabelCandidate s that describe valid label positions within this model. |
OrientedRectangle |
getLabelPlacement(YDimension labelSize,
EdgeLayout edgeLayout,
NodeLayout sourceLayout,
NodeLayout targetLayout,
java.lang.Object param)
Returns the oriented box 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,
java.lang.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 java.lang.Object getDefaultParameter()
getDefaultParameter
in interface EdgeLabelModel
public OrientedRectangle getLabelPlacement(YDimension labelSize, EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout, java.lang.Object param)
EdgeLabelModel
getLabelPlacement
in interface EdgeLabelModel
labelSize
- the width and height of the labeledgeLayout
- 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 edgeparam
- the model parameter that describes the abstract position of the label within 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
s that describe valid label positions within this model.
In case the implementing EdgeLabelModel
allows every possible location, this method always returns the
current location as a LabelCandidate
.
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 sourceLayout, NodeLayout targetLayout)
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 belongssourceLayout
- the layout of the source node of the label-owning edgetargetLayout
- the layout of the target node of the label-owning edge
EdgeLabelModel.getLabelPlacement(YDimension, EdgeLayout, NodeLayout, NodeLayout, Object)
public double getRotationAngle(EdgeLabel label)
label
- the label that has been configured with this model.
public double getRotationAngle(EdgeLayout edgeLayout, NodeLayout sourceLayout, NodeLayout targetLayout, java.lang.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-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |