|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.EdgeLabelOrientationSupport
public class EdgeLabelOrientationSupport
Helper for layouter with integrated edge labeling to support orientation and mirroring.
To calculate the position and orientation of edge labels, whose placements are defined with the
PreferredPlacementDescriptor
, the OrientationLayouter
would need the direction of the associated
edge. Since this direction is not available for the OrientationLayouter
, because it is a wrapper, the
calculation must be done in the core layouter itself with the help of the EdgeLabelOrientationSupport
.
Important: Since all layouters with integrated edge labeling could not deal with ambiguous preferred placement
descriptors (combinations of the same setting e.g. source or target for the
PreferredPlacementDescriptor.getPlaceAlongEdge()
),
preProcessLabel(y.base.Graph, LabelLayoutData, Direction)
removes combinations and replaces the original
descriptor with a "non-ambiguous" one during the layout calculation.
Constructor Summary | |
---|---|
EdgeLabelOrientationSupport()
Creates an instance. |
Method Summary | |
---|---|
static YVector |
getEdgeLabelUpVector(PreferredPlacementDescriptor descriptor,
Direction segmentDirection)
Calculates the up vector of an edge label considering the preferred placement of the label as well as the direction of the edge segment the label is attached to. |
static YVector |
getLabelUpVector(double rightVectorAngle)
Calculates the up vector for a label whose right vector is rotated clockwise by the given rightVectorAngle. |
static Direction |
getOrientedDirection(Direction direction,
byte orientation,
int mirrorMask)
Transforms a direction of the layout to the oriented layout. |
static boolean |
isOrientationMirrored(byte orientation,
int mirrorMask)
Returns whether or not the orientation is mirrored. |
void |
postProcessLabel(Graph graph,
LabelLayoutData label)
Called by the core layouter with the integrated edge labeling for each edge label after the location of the label is determined. |
void |
preProcessLabel(Graph graph,
LabelLayoutData label,
Direction segmentDirection)
Called by the core layouter with the integrated edge labeling for each edge label before the layouter uses the labels geometry. |
void |
replaceAmbiguousLabelDescriptors(Graph graph)
Replaces the PreferredPlacementDescriptor s of all edge labels in the given graph with non-ambiguous
descriptors. |
void |
resetAmbiguousLabelDescriptors(Graph graph)
Restores the PreferredPlacementDescriptor s of all edge labels in the given graph with their orignial
descriptors. |
static void |
updateLabelOrientation(LabelLayoutData label,
Direction segmentDirection)
Calculates and sets the up vector of an edge label considering the preferred placement of the label as well as the direction of the edge segment the label is attached to. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EdgeLabelOrientationSupport()
OrientationLayouter
off.
Method Detail |
---|
public void replaceAmbiguousLabelDescriptors(Graph graph)
PreferredPlacementDescriptor
s of all edge labels in the given graph with non-ambiguous
descriptors.
It should be called by a layouter at the beginning of layout calculation to assure that the label's placement is handled consistently.
public void resetAmbiguousLabelDescriptors(Graph graph)
PreferredPlacementDescriptor
s of all edge labels in the given graph with their orignial
descriptors.
It should be called by a layouter at the end of layout calculation to assure that the original state of the graph is not corrupted.
public void preProcessLabel(Graph graph, LabelLayoutData label, Direction segmentDirection)
First it replaces the LabelLayoutData.getPreferredPlacementDescriptor()
of the edge label by a
PreferredPlacementDescriptor
that has only relative references. This descriptor is orientation
independent and could be used in the core layouter. Second it rotates the
label
in respect of it PreferredPlacementDescriptor
and
the direction of the segment it belongs to. After that call the core layouter could use the geometry
(LabelLayoutData.getWidth()
and LabelLayoutData.getWidth()
) of the label to
calculate its location.
graph
- graph to get the orientation information fromlabel
- edge label whose segment direction is determinedsegmentDirection
- direction of the segment the edge label belongs topublic void postProcessLabel(Graph graph, LabelLayoutData label)
It restores the original LabelLayoutData.getPreferredPlacementDescriptor()
that has been replaced
in preProcessLabel(y.base.Graph, LabelLayoutData, Direction)
. Then it move and rotates the
label
in respect of the orientation.
graph
- graph to get the orientation information fromlabel
- edge label whose location is determinedpublic static Direction getOrientedDirection(Direction direction, byte orientation, int mirrorMask)
direction
- direction in the layoutorientation
- mirrorMask
- @return the direction in the oriented layoutpublic static boolean isOrientationMirrored(byte orientation, int mirrorMask)
orientation
- mirrorMask
-
true
if the orientation is mirrored; false
otherwisepublic static void updateLabelOrientation(LabelLayoutData label, Direction segmentDirection)
label
- The data that describes the label orientation and is used to set the new up vector.segmentDirection
- The direction the edge segment is pointing to.getEdgeLabelUpVector(PreferredPlacementDescriptor, Direction)
public static YVector getEdgeLabelUpVector(PreferredPlacementDescriptor descriptor, Direction segmentDirection)
descriptor
- The data describing the preferred label orientation.segmentDirection
- The direction the edge segment is pointing to.
public static YVector getLabelUpVector(double rightVectorAngle)
rightVectorAngle
- The angle in radians the right vector is rotated by.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |