|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.PreferredPlacementDescriptor
public class PreferredPlacementDescriptor
A PreferredPlacementDescriptor provides placement information for automatic edge labeling.
It provides several options that influence the label placement in generic labeling algorithms and layout algorithms
that support integrated label placement.
The preferred placement can describe multiple locations. For some options, like the
placement along the edge, it is possible to have a combination of the valid values.
These values can be connected with a logical or-operation.
PreferredPlacementDescriptor will be immutable after freeze() is called.
A PreferredPlacementDescriptor must be set for each label and will be retrieved by the layout algorithms
calling EdgeLabelLayout.getPreferredPlacementDescriptor().
![]() |
![]() |
| Field Summary | |
|---|---|
static byte |
ANGLE_IS_ABSOLUTE
Angle interpretation specifier for edge labels which expresses that the rotation angle should be interpreted absolute and not relative to the edge slope. |
static byte |
ANGLE_IS_RELATIVE_TO_EDGE_FLOW
Angle interpretation specifier for edge labels which expresses that the rotation angle should be interpreted relative to the edge slope. |
static byte |
ANGLE_OFFSET_ON_RIGHT_SIDE_0
Angle offset specifier for edge labels which expresses that no additional offset should be added to the angle. |
static byte |
ANGLE_OFFSET_ON_RIGHT_SIDE_180
Angle offset specifier for edge labels which expresses that an additional offset of 180 degrees
should be added to the angle. |
static byte |
ANGLE_ON_RIGHT_SIDE_CO_ROTATING
Angle interpretation specifier which expresses that the rotation angle should be interpreted clockwise. |
static byte |
ANGLE_ON_RIGHT_SIDE_COUNTER_ROTATING
Angle interpretation specifier which expresses that the rotation angle should be interpreted counter-clockwise. |
static byte |
SIDE_IS_ABSOLUTE_WITH_LEFT_IN_NORTH
Side placement specifier for edge labels which defines that the preferred side for the label is interpreted independently of the edge direction placing left labels above horizontal segments. |
static byte |
SIDE_IS_ABSOLUTE_WITH_RIGHT_IN_NORTH
Side placement specifier for edge labels which defines that the preferred side for the label is interpreted independently of the edge direction placing left labels above horizontal segments. |
static byte |
SIDE_IS_RELATIVE_TO_EDGE_FLOW
Side placement specifier for edge labels which expresses that the preferred side of the edge is interpreted relative to the edge flow. |
| Fields inherited from interface y.layout.LabelLayoutConstants |
|---|
PLACE_ANYWHERE, PLACE_AT_CENTER, PLACE_AT_SOURCE, PLACE_AT_SOURCE_PORT, PLACE_AT_TARGET, PLACE_AT_TARGET_PORT, PLACE_LEFT_OF_EDGE, PLACE_ON_EDGE, PLACE_RIGHT_OF_EDGE, PLACEMENT_ALONG_EDGE_MASK, PLACEMENT_ON_SIDE_OF_EDGE_MASK |
| Constructor Summary | |
|---|---|
PreferredPlacementDescriptor()
Creates a new PreferredPlacementDescriptor instance with default settings. |
|
PreferredPlacementDescriptor(PreferredPlacementDescriptor descriptor)
Creates a new PreferredPlacementDescriptor instance that copies the given descriptor. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
|
void |
freeze()
Makes this PreferredPlacementDescriptor instance immutable. |
double |
getAngle()
Returns the angle (in radians) for the label rotation. |
byte |
getAngleOffsetOnRightSide()
Returns the angle offset for labels that are placed on the right side of the edge. |
byte |
getAngleReference()
Returns the reference of the angle given by getAngle(). |
byte |
getAngleRotationOnRightSide()
Returns how the angle is applied to labels on the right side in respect of the labels of the left side of the edge. |
double |
getDistanceToEdge()
Returns the preferred distance between a label and the corresponding edge segment. |
byte |
getPlaceAlongEdge()
Returns the preferred placement along the edge. |
byte |
getSideOfEdge()
Returns the preferred side of the edge. |
byte |
getSideReference()
Returns how to interpret the preferred side as given by getSideOfEdge(). |
int |
hashCode()
|
boolean |
isAngleAbsolute()
Returns whether or not one of the angle interpretations is absolute. |
boolean |
isAngleOffsetOnRightSide0()
Returns whether or not one of the angle interpretations is to add no angle offset to labels that are right of the edge. |
boolean |
isAngleOffsetOnRightSide180()
Returns whether or not one of the angle interpretations is to add an angle offset of 180 degrees
to labels that are right of the edge. |
boolean |
isAngleOnRightSideCoRotating()
Returns whether or not one of the angle interpretations is to rotate the angle of labels that are right of the edge co-rotating with the labels left of or centered on the edge, i.e., the angle of all labels is interpreted clockwise. |
boolean |
isAngleOnRightSideCounterRotating()
Returns whether or not one of the angle interpretations is to rotate the angle of labels that are right of the edge counter-rotating with the labels left of or centered on the edge, i.e., the angle of labels left or centered on edge is interpreted clockwise while the angle of labels right of edge is interpreted counter-clockwise. |
boolean |
isAngleRelativeToEdgeFlow()
Returns whether or not one of the angle interpretation is relative to the edge slope. |
boolean |
isAtCenter()
Returns whether or not one of the preferred placement locations for this label is at center. |
boolean |
isAtSource()
Returns whether or not one of the preferred placement locations for this label is at source. |
boolean |
isAtSourcePort()
Returns whether or not one of the preferred placements for this label is at the source port. |
boolean |
isAtTarget()
Returns whether or not one of the preferred placements for this label is at target. |
boolean |
isAtTargetPort()
Returns whether or not one of the preferred placements for this label is at the target port. |
boolean |
isFrozen()
Returns whether or not this is an immutable instance of PreferredPlacementDescriptor. |
boolean |
isLeftOfEdge()
Returns whether or not one of the preferred sides for this label is left of the edge. |
boolean |
isOnEdge()
Returns whether or not one of the preferred sides for this label is on the edge. |
boolean |
isRightOfEdge()
Returns whether or not one of the preferred sides for this label is right of the edge. |
boolean |
isSideAbsoluteWithLeftInNorth()
Returns whether or not the preferred side specified by getSideOfEdge() is interpreted absolute, and on
horizontal segments, labels with preferred side LabelLayoutConstants.PLACE_LEFT_OF_EDGE are placed above
the segment. |
boolean |
isSideAbsoluteWithRightInNorth()
Returns whether or not the preferred side specified by getSideOfEdge() is interpreted absolute, and on
horizontal segments, labels with preferred side LabelLayoutConstants.PLACE_RIGHT_OF_EDGE are placed above
the segment. |
boolean |
isSideRelativeToEdgeFlow()
Returns whether or not the preferred side specified by getSideOfEdge() is interpreted relative to the edge
flow. |
static PreferredPlacementDescriptor |
newSharedInstance(byte placement)
Returns an immutable descriptor instance for the specified placement. |
void |
setAngle(double angle)
Specifies the angle (in radians) for the label rotation. |
void |
setAngleOffsetOnRightSide(byte angleOffset)
Specifies the angle offset for labels that are placed on the right side of the edge. |
void |
setAngleReference(byte angleReference)
Specifies the reference of the angle given by getAngle(). |
void |
setAngleRotationOnRightSide(byte angleRotation)
Specifies how the angle is applied to labels on the right side in respect of the labels of the left side of the edge. |
void |
setDistanceToEdge(double distance)
Specifies the preferred distance between a label and the corresponding edge segment. |
void |
setPlaceAlongEdge(byte placeAlongEdge)
Specifies the preferred placement along the edge. |
void |
setSideOfEdge(byte sideOfEdge)
Specifies the preferred side of the edge. |
void |
setSideReference(byte sideReference)
Specifies how to interpret the preferred side as given by getSideOfEdge(). |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte SIDE_IS_RELATIVE_TO_EDGE_FLOW
public static final byte SIDE_IS_ABSOLUTE_WITH_LEFT_IN_NORTH
left labels above horizontal segments.
For vertical segments the label is placed left or right
of the edge. In case the segment is horizontal, the label is placed above the segment if it should be left of the
edge, otherwise below the segment.
public static final byte SIDE_IS_ABSOLUTE_WITH_RIGHT_IN_NORTH
left labels above horizontal segments.
For vertical segments the label is placed left or right
of the edge. In case the segment is horizontal, the label is placed above the segment if it should be right of
the edge, otherwise below the segment.
public static final byte ANGLE_IS_ABSOLUTE
public static final byte ANGLE_IS_RELATIVE_TO_EDGE_FLOW
public static final byte ANGLE_ON_RIGHT_SIDE_CO_ROTATING
Therefore, edge labels whose descriptor isRightOfEdge() will be co-rotating with the angle of labels that
are placed left of or centered on the edge.
public static final byte ANGLE_ON_RIGHT_SIDE_COUNTER_ROTATING
Therefore, edge labels whose descriptor isRightOfEdge() will be counter-rotating with the angle of labels
that are placed left of or centered on the edge.
public static final byte ANGLE_OFFSET_ON_RIGHT_SIDE_0
public static final byte ANGLE_OFFSET_ON_RIGHT_SIDE_180
180 degrees
should be added to the angle.
That way, point-symmetric label placements left and right of the edge can be attained.
| Constructor Detail |
|---|
public PreferredPlacementDescriptor()
PreferredPlacementDescriptor instance with default settings.
public PreferredPlacementDescriptor(PreferredPlacementDescriptor descriptor)
PreferredPlacementDescriptor instance that copies the given descriptor.
descriptor - the PreferredPlacementDescriptor that is copied| Method Detail |
|---|
public byte getPlaceAlongEdge()
setPlaceAlongEdge(byte)public void setPlaceAlongEdge(byte placeAlongEdge)
LabelLayoutConstants.PLACE_AT_SOURCE_PORT and LabelLayoutConstants.PLACE_AT_TARGET_PORT that indicate a placement
directly at the edge port are currently only supported by
IncrementalHierarchicLayouter.LabelLayoutConstants.PLACE_AT_CENTERplaceAlongEdge - any combination of the valid positions along the edge
java.lang.IllegalStateException - if this instance is immutablepublic byte getSideOfEdge()
setSideOfEdge(byte)public void setSideOfEdge(byte sideOfEdge)
LabelLayoutConstants.PLACE_ON_EDGEsideOfEdge - any combination of the valid sides of the edge
java.lang.IllegalStateException - if this instance is immutablepublic byte getSideReference()
getSideOfEdge().
setSideReference(byte)public void setSideReference(byte sideReference)
getSideOfEdge().
SIDE_IS_RELATIVE_TO_EDGE_FLOWsideReference - any combination of the valid side references
java.lang.IllegalStateException - if this instance is immutable
java.lang.IllegalArgumentException - if the specified side reference is invalidpublic double getAngle()
How this angle is applied depends on the angle reference, the
rotation and the offset for labels on
the right side of the edge.
setAngle(double),
setAngleReference(byte),
setAngleRotationOnRightSide(byte),
setAngleOffsetOnRightSide(byte)public void setAngle(double angle)
How this angle is applied depends on the angle reference, the
rotation and the offset for labels on
the right side of the edge.
angle - the angle in radians
java.lang.IllegalStateException - if this instance is immutablesetAngleReference(byte),
setAngleRotationOnRightSide(byte),
setAngleOffsetOnRightSide(byte)![]() 0 radians (0 degree) with an absolute angle reference | ![]() 0.78 radians (45 degree) with an absolute angle reference |
public byte getAngleReference()
getAngle().
setAngleReference(byte)public void setAngleReference(byte angleReference)
getAngle().
ANGLE_IS_ABSOLUTEangleReference - any combination of valid angle references
java.lang.IllegalStateException - if this instance is immutable
java.lang.IllegalArgumentException - if the specified value is not a valid angle referencepublic byte getAngleRotationOnRightSide()
setAngleRotationOnRightSide(byte)public void setAngleRotationOnRightSide(byte angleRotation)
ANGLE_ON_RIGHT_SIDE_CO_ROTATINGangleRotation - any combination of valid rotation directions
java.lang.IllegalStateException - if this instance is immutable
java.lang.IllegalArgumentException - if the specified value is not a valid angle rotationpublic byte getAngleOffsetOnRightSide()
0 or 180 degrees)setAngleOffsetOnRightSide(byte)public void setAngleOffsetOnRightSide(byte angleOffset)
ANGLE_OFFSET_ON_RIGHT_SIDE_0angleOffset - any combination of valid offsets (0 or 180 degrees)
java.lang.IllegalStateException - if this instance is immutable
java.lang.IllegalArgumentException - if the specified value is not valid angle offsetpublic double getDistanceToEdge()
If the given distance is < 0, the distance is not fixed, i.e., it is chosen by the automatic
labeling algorithm.
setDistanceToEdge(double)public void setDistanceToEdge(double distance)
If the given distance is < 0, the distance is not fixed, i.e., it is chosen by the automatic
labeling algorithm.
distance - preferred distance between a label and the corresponding edge segment
java.lang.IllegalStateException - if this instance is immutable
java.lang.IllegalArgumentException - if the specified value is infinite or NaN![]() 0 | ![]() 20 |
public boolean isAtSource()
true if at source is a possible placement for this label, false otherwiseLabelLayoutConstants.PLACE_AT_SOURCEpublic boolean isAtCenter()
true if at center is a possible placement for this label, false otherwiseLabelLayoutConstants.PLACE_AT_CENTERpublic boolean isAtTarget()
true if at target is a possible placement for this label, false otherwiseLabelLayoutConstants.PLACE_AT_TARGETpublic boolean isAtSourcePort()
true if at source port is a possible placement for this label, false otherwiseLabelLayoutConstants.PLACE_AT_SOURCE_PORTpublic boolean isAtTargetPort()
true if at target port is a possible placement for this label, false otherwiseLabelLayoutConstants.PLACE_AT_TARGET_PORTpublic boolean isLeftOfEdge()
true if left of the edge is a possible side for this label, false otherwiseLabelLayoutConstants.PLACE_LEFT_OF_EDGEpublic boolean isOnEdge()
true if on the edge is a possible side for this label, false otherwiseLabelLayoutConstants.PLACE_ON_EDGEpublic boolean isRightOfEdge()
true if right of the edge is a possible side for this label, false otherwiseLabelLayoutConstants.PLACE_RIGHT_OF_EDGEpublic boolean isAngleAbsolute()
true if absolute angle interpretation is a possible angle interpretation for this label,
false otherwiseANGLE_IS_ABSOLUTEpublic boolean isAngleRelativeToEdgeFlow()
true if angle interpretation relative to the edge slope is a possible angle interpretation
for this label, false otherwiseANGLE_IS_RELATIVE_TO_EDGE_FLOWpublic boolean isAngleOnRightSideCoRotating()
true if co-rotating angle interpretation for right-side edges is a possible angle
interpretation for this label, false otherwiseisRightOfEdge(),
ANGLE_ON_RIGHT_SIDE_CO_ROTATINGpublic boolean isAngleOnRightSideCounterRotating()
true if counter-rotating angle interpretation for right-side edges is a possible angle
interpretation for this label, false otherwiseisRightOfEdge(),
ANGLE_ON_RIGHT_SIDE_COUNTER_ROTATINGpublic boolean isAngleOffsetOnRightSide0()
true if adding no angle offset for right-side edges is a possible angle interpretation for
this label, false otherwiseisRightOfEdge(),
ANGLE_OFFSET_ON_RIGHT_SIDE_0public boolean isAngleOffsetOnRightSide180()
180 degrees
to labels that are right of the edge.
true if adding an angle offset of 180 degrees for right-side edges is a possible
angle interpretation for this label, false otherwise.isRightOfEdge(),
ANGLE_OFFSET_ON_RIGHT_SIDE_180public boolean isSideRelativeToEdgeFlow()
getSideOfEdge() is interpreted relative to the edge
flow.
true if the preferred side is interpreted relative to the edge flow, false
otherwiseSIDE_IS_RELATIVE_TO_EDGE_FLOWpublic boolean isSideAbsoluteWithLeftInNorth()
getSideOfEdge() is interpreted absolute, and on
horizontal segments, labels with preferred side LabelLayoutConstants.PLACE_LEFT_OF_EDGE are placed above
the segment.
true if the preferred side is interpreted absolute, false otherwiseSIDE_IS_ABSOLUTE_WITH_LEFT_IN_NORTHpublic boolean isSideAbsoluteWithRightInNorth()
getSideOfEdge() is interpreted absolute, and on
horizontal segments, labels with preferred side LabelLayoutConstants.PLACE_RIGHT_OF_EDGE are placed above
the segment.
true if the preferred side is interpreted absolute, false otherwiseSIDE_IS_ABSOLUTE_WITH_RIGHT_IN_NORTHpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean isFrozen()
PreferredPlacementDescriptor.
If this instance is immutable, all setter methods will throw an
IllegalStateException when invoked.
true if this instance is immutable, false otherwisefreeze()public void freeze()
PreferredPlacementDescriptor instance immutable.
If this instance is immutable, all setter methods will throw an
IllegalStateException when invoked.
isFrozen()public static PreferredPlacementDescriptor newSharedInstance(byte placement)
Descriptor instances returned by this method will use default values for all properties but
placement along edge and side of edge.
placement - a combination of valid placements along the edge and valid sides of the edge
isFrozen(),
getPlaceAlongEdge(),
getSideOfEdge()
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||