|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.PreferredPlacementDescriptor
public class PreferredPlacementDescriptor
A descriptor that holds preferred placement information for automatic edge labeling.
It provides methods to specify
LabelLayoutConstants.PLACE_AT_SOURCE
, LabelLayoutConstants.PLACE_AT_CENTER
, LabelLayoutConstants.PLACE_AT_TARGET
)LabelLayoutConstants.PLACE_LEFT_OF_EDGE
, LabelLayoutConstants.PLACE_ON_EDGE
, LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
)SIDE_IS_RELATIVE_TO_EDGE_FLOW
, SIDE_IS_ABSOLUTE_WITH_LEFT_IN_NORTH
, SIDE_IS_ABSOLUTE_WITH_RIGHT_IN_NORTH
)ANGLE_IS_ABSOLUTE
, ANGLE_IS_RELATIVE_TO_EDGE_FLOW
)ANGLE_ON_RIGHT_SIDE_CO_ROTATING
, ANGLE_ON_RIGHT_SIDE_COUNTER_ROTATING
)ANGLE_OFFSET_ON_RIGHT_SIDE_0
, ANGLE_OFFSET_ON_RIGHT_SIDE_180
)
Field Summary | |
---|---|
static byte |
ANGLE_IS_ABSOLUTE
Angle interpretation specifier for edge labels. |
static byte |
ANGLE_IS_RELATIVE_TO_EDGE_FLOW
Angle interpretation specifier for edge labels. |
static byte |
ANGLE_OFFSET_ON_RIGHT_SIDE_0
Angle offset specifier for edge labels whose descriptor isRightOfEdge() . |
static byte |
ANGLE_OFFSET_ON_RIGHT_SIDE_180
Angle offset specifier for edge labels whose descriptor isRightOfEdge() . |
static byte |
ANGLE_ON_RIGHT_SIDE_CO_ROTATING
Angle interpretation specifier for edge labels whose descriptor isRightOfEdge() . |
static byte |
ANGLE_ON_RIGHT_SIDE_COUNTER_ROTATING
Angle interpretation specifier for edge labels whose descriptor isRightOfEdge() . |
static byte |
SIDE_IS_ABSOLUTE_WITH_LEFT_IN_NORTH
Side placement specifier for edge labels. |
static byte |
SIDE_IS_ABSOLUTE_WITH_RIGHT_IN_NORTH
Side placement specifier for edge labels. |
static byte |
SIDE_IS_RELATIVE_TO_EDGE_FLOW
Side placement specifier for edge labels. |
Fields inherited from interface y.layout.LabelLayoutConstants |
---|
PLACE_ANYWHERE, PLACE_AT_CENTER, PLACE_AT_SOURCE, PLACE_AT_TARGET, 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 mutable instance of this descriptor. |
|
PreferredPlacementDescriptor(PreferredPlacementDescriptor descriptor)
Creates a mutable copy of the given PreferredPlacementDescriptor. |
Method Summary | |
---|---|
boolean |
equals(Object o)
|
void |
freeze()
Makes this 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()
Specifies the reference of the angle given by getAngle() . |
byte |
getAngleRotationOnRightSide()
Specifies 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()
Specifies how to interpret the preferred side as given by LabelLayoutConstants.PLACE_LEFT_OF_EDGE and LabelLayoutConstants.PLACE_RIGHT_OF_EDGE . |
int |
hashCode()
|
boolean |
isAngleAbsolute()
Returns if one of the angle interpretations is to interpret the angle absolute. |
boolean |
isAngleOffsetOnRightSide0()
Returns if one of the angle interpretations is to add no additional angle offset to labels that are right of the edge. |
boolean |
isAngleOffsetOnRightSide180()
Returns if one of the angle interpretations is to add an additional angle offset of 180 degree to labels that are right of the edge. |
boolean |
isAngleOnRightSideCoRotating()
Returns if one of the angle interpretations is to interpret the angle of labels that are right of the edge as co-rotating with the labels left of or centered on edge, i.e. the angle of all labels is interpreted clockwise. |
boolean |
isAngleOnRightSideCounterRotating()
Returns if one of the angle interpretations is to interpret the angle of labels that are right of the edge as counter-rotating with the labels left of or centered on 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 if one of the angle interpretations is to interpret the angle relative to the edge slope. |
boolean |
isAtCenter()
Returns if one of the preferred placements for this label is at center. |
boolean |
isAtSource()
Returns if one of the preferred placements for this label is at source. |
boolean |
isAtTarget()
Returns if one of the preferred placements for this label is at target. |
boolean |
isFrozen()
Returns whether or not this is an immutable descriptor instance. |
boolean |
isLeftOfEdge()
Returns if one of the preferred sides for this label is left of the edge. |
boolean |
isOnEdge()
Returns if one of the preferred sides for this label is on the edge. |
boolean |
isRightOfEdge()
Returns if one of the preferred sides for this label is right of the edge. |
boolean |
isSideAbsoluteWithLeftInNorth()
Returns if the preferred side specified by LabelLayoutConstants.PLACE_LEFT_OF_EDGE and LabelLayoutConstants.PLACE_RIGHT_OF_EDGE is interpreted absolute and on horizontal segments, labels with preferred
side LabelLayoutConstants.PLACE_LEFT_OF_EDGE are placed above the segment. |
boolean |
isSideAbsoluteWithRightInNorth()
Returns if the preferred side specified by LabelLayoutConstants.PLACE_LEFT_OF_EDGE and LabelLayoutConstants.PLACE_RIGHT_OF_EDGE is interpreted absolute and on horizontal segments, labels with preferred
side LabelLayoutConstants.PLACE_RIGHT_OF_EDGE are placed above the segment. |
boolean |
isSideRelativeToEdgeFlow()
Returns if the preferred side specified by LabelLayoutConstants.PLACE_LEFT_OF_EDGE and LabelLayoutConstants.PLACE_RIGHT_OF_EDGE 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)
Sets the angle (in radians) for the label rotation. |
void |
setAngleOffsetOnRightSide(byte angleOffset)
Sets 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)
Sets the preferred placement along the edge. |
void |
setSideOfEdge(byte sideOfEdge)
Sets the preferred side of the edge. |
void |
setSideReference(byte sideReference)
Specifies how to interpret the preferred side as given by LabelLayoutConstants.PLACE_RIGHT_OF_EDGE and LabelLayoutConstants.PLACE_LEFT_OF_EDGE . |
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
LabelLayoutConstants.PLACE_LEFT_OF_EDGE
and
LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
) is interpreted relative
to the edge flow.
setSideReference(byte)
,
getSideReference()
,
Constant Field Valuespublic static final byte SIDE_IS_ABSOLUTE_WITH_LEFT_IN_NORTH
LabelLayoutConstants.PLACE_LEFT_OF_EDGE
and
LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
) is interpreted absolute.
On horizontal segments labels with preferred side
LabelLayoutConstants.PLACE_LEFT_OF_EDGE
are placed above the
segment.
setSideReference(byte)
,
getSideReference()
,
Constant Field Valuespublic static final byte SIDE_IS_ABSOLUTE_WITH_RIGHT_IN_NORTH
LabelLayoutConstants.PLACE_LEFT_OF_EDGE
and
LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
) is interpreted absolute.
On horizontal segments labels with preferred side
LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
are placed above the
segment.
setSideReference(byte)
,
getSideReference()
,
Constant Field Valuespublic static final byte ANGLE_IS_ABSOLUTE
setAngleReference(byte)
,
getAngleReference()
,
Constant Field Valuespublic static final byte ANGLE_IS_RELATIVE_TO_EDGE_FLOW
setAngleReference(byte)
,
getAngleReference()
,
Constant Field Valuespublic static final byte ANGLE_ON_RIGHT_SIDE_CO_ROTATING
isRightOfEdge()
. Expresses that the angle
should be interpreted as clockwise and therefore as co-rotating with the angle of labels that are
left of or centered on edge.
setAngleRotationOnRightSide(byte)
,
getAngleRotationOnRightSide()
,
Constant Field Valuespublic static final byte ANGLE_ON_RIGHT_SIDE_COUNTER_ROTATING
isRightOfEdge()
. Expresses that the angle
should be interpreted as counter-clockwise and therefore as counter-rotating with the angle of
labels that are left of or centered on edge.
setAngleRotationOnRightSide(byte)
,
getAngleRotationOnRightSide()
,
Constant Field Valuespublic static final byte ANGLE_OFFSET_ON_RIGHT_SIDE_0
isRightOfEdge()
. Expresses that for labels
right of edge no additional offset should be added to the angle offset.
setAngleOffsetOnRightSide(byte)
,
getAngleOffsetOnRightSide()
,
Constant Field Valuespublic static final byte ANGLE_OFFSET_ON_RIGHT_SIDE_180
isRightOfEdge()
. Expresses that for labels
right of edge an additional offset of 180 degree should be added to the angle offset so that point symmetric label
placements left and right of the edge can be attained.
setAngleOffsetOnRightSide(byte)
,
getAngleOffsetOnRightSide()
,
Constant Field ValuesConstructor Detail |
---|
public PreferredPlacementDescriptor()
public PreferredPlacementDescriptor(PreferredPlacementDescriptor descriptor)
descriptor
- PreferredPlacementDescriptor to make a copy fromMethod Detail |
---|
public byte getPlaceAlongEdge()
LabelLayoutConstants.PLACE_AT_CENTER
.
LabelLayoutConstants.PLACE_AT_SOURCE
, LabelLayoutConstants.PLACE_AT_CENTER
, LabelLayoutConstants.PLACE_AT_TARGET
.public void setPlaceAlongEdge(byte placeAlongEdge)
LabelLayoutConstants.PLACE_AT_CENTER
.
IllegalStateException
- if this instance is immutable
.placeAlongEdge
- any combination of LabelLayoutConstants.PLACE_AT_SOURCE
, LabelLayoutConstants.PLACE_AT_CENTER
and LabelLayoutConstants.PLACE_AT_TARGET
.public byte getSideOfEdge()
LabelLayoutConstants.PLACE_ON_EDGE
.
LabelLayoutConstants.PLACE_LEFT_OF_EDGE
, LabelLayoutConstants.PLACE_ON_EDGE
and LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
.public void setSideOfEdge(byte sideOfEdge)
LabelLayoutConstants.PLACE_ON_EDGE
.
IllegalStateException
- if this instance is immutable
.sideOfEdge
- any combination of LabelLayoutConstants.PLACE_LEFT_OF_EDGE
, LabelLayoutConstants.PLACE_ON_EDGE
and LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
.public byte getSideReference()
LabelLayoutConstants.PLACE_LEFT_OF_EDGE
and LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
. Default is SIDE_IS_RELATIVE_TO_EDGE_FLOW
.
SIDE_IS_RELATIVE_TO_EDGE_FLOW
, SIDE_IS_ABSOLUTE_WITH_LEFT_IN_NORTH
and
SIDE_IS_ABSOLUTE_WITH_RIGHT_IN_NORTH
public void setSideReference(byte sideReference)
LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
and LabelLayoutConstants.PLACE_LEFT_OF_EDGE
.
IllegalStateException
- if this instance is immutable
.
IllegalArgumentException
- if the specified value has not at least
one of the required bits set.sideReference
- any combination of SIDE_IS_RELATIVE_TO_EDGE_FLOW
, SIDE_IS_ABSOLUTE_WITH_LEFT_IN_NORTH
and SIDE_IS_ABSOLUTE_WITH_RIGHT_IN_NORTH
public double getAngle()
getAngleReference()
, getAngleRotationOnRightSide()
and getAngleOffsetOnRightSide()
. Default is
0.
public void setAngle(double angle)
getAngleReference()
, getAngleRotationOnRightSide()
and getAngleOffsetOnRightSide()
. Default is
0.
IllegalStateException
- if this instance is immutable
.angle
- the angle.public byte getAngleReference()
getAngle()
. Default is
ANGLE_IS_ABSOLUTE
.
ANGLE_IS_ABSOLUTE
and ANGLE_IS_RELATIVE_TO_EDGE_FLOW
public void setAngleReference(byte angleReference)
getAngle()
. Default is
ANGLE_IS_ABSOLUTE
.
IllegalStateException
- if this instance is immutable
.
IllegalArgumentException
- if the specified value has not at least
one of the required bits set.angleReference
- any combination of ANGLE_IS_ABSOLUTE
and ANGLE_IS_RELATIVE_TO_EDGE_FLOW
public byte getAngleRotationOnRightSide()
ANGLE_ON_RIGHT_SIDE_CO_ROTATING
.
ANGLE_ON_RIGHT_SIDE_CO_ROTATING
and ANGLE_ON_RIGHT_SIDE_COUNTER_ROTATING
public void setAngleRotationOnRightSide(byte angleRotation)
ANGLE_ON_RIGHT_SIDE_CO_ROTATING
.
IllegalStateException
- if this instance is immutable
.
IllegalArgumentException
- if the specified value has not at least
one of the required bits set.angleRotation
- any combination of ANGLE_ON_RIGHT_SIDE_CO_ROTATING
and ANGLE_ON_RIGHT_SIDE_COUNTER_ROTATING
public byte getAngleOffsetOnRightSide()
ANGLE_OFFSET_ON_RIGHT_SIDE_0
.
ANGLE_OFFSET_ON_RIGHT_SIDE_0
and ANGLE_OFFSET_ON_RIGHT_SIDE_180
public void setAngleOffsetOnRightSide(byte angleOffset)
ANGLE_OFFSET_ON_RIGHT_SIDE_0
.
IllegalStateException
- if this instance is immutable
.
IllegalArgumentException
- if the specified value has not at least
one of the required bits set.angleOffset
- any combination of ANGLE_OFFSET_ON_RIGHT_SIDE_0
and ANGLE_OFFSET_ON_RIGHT_SIDE_180
public double getDistanceToEdge()
public void setDistanceToEdge(double distance)
IllegalArgumentException
- if the specified value is infinite or NaN.
IllegalStateException
- if this instance is immutable
.distance
- preferred distance between a label and the corresponding edge segment.public boolean isAtSource()
true
if at source is a possible placement for this label, false
otherwise.public boolean isAtCenter()
true
if at center is a possible placement for this label, false
otherwise.public boolean isAtTarget()
true
if at target is a possible placement for this label, false
otherwise.public boolean isLeftOfEdge()
true
if left of the edge is a possible side for this label, false
otherwise.public boolean isOnEdge()
true
if on the edge is a possible side for this label, false
otherwise.public boolean isRightOfEdge()
true
if right of the edge is a possible side for this label, false
otherwise.public boolean isAngleAbsolute()
true
if absolute angle interpretation is a possible angle interpretation for this label, false
otherwise.public boolean isAngleRelativeToEdgeFlow()
true
if interpreting the angle relative to the edge slope is a possible angle interpretation
for this label, false
otherwise.public boolean isAngleOnRightSideCoRotating()
true
if co-rotating angle interpretation for right-side edges is a possible angle
interpretation for this label, false
otherwise.isRightOfEdge()
public boolean isAngleOnRightSideCounterRotating()
true
if counter-rotating angle interpretation for right-side edges is a possible angle
interpretation for this label, false
otherwise.isRightOfEdge()
public boolean isAngleOffsetOnRightSide0()
true
if adding no additional angle offset for right-side edges is a possible angle
interpretation for this label, false
otherwise.isRightOfEdge()
public boolean isAngleOffsetOnRightSide180()
true
if adding an additional angle offset of 180 degree for right-side edges is a possible
angle interpretation for this label, false
otherwise.isRightOfEdge()
public boolean isSideRelativeToEdgeFlow()
LabelLayoutConstants.PLACE_LEFT_OF_EDGE
and LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
is interpreted relative to the edge flow.
true
if the preferred side is interpreted relative to the edge flow.public boolean isSideAbsoluteWithLeftInNorth()
LabelLayoutConstants.PLACE_LEFT_OF_EDGE
and LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
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.public boolean isSideAbsoluteWithRightInNorth()
LabelLayoutConstants.PLACE_LEFT_OF_EDGE
and LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
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.public String toString()
toString
in class Object
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public boolean isFrozen()
set
methods will throw an
IllegalStateException
when invoked.
true
if this instance is immutable; false
otherwise.freeze()
public void freeze()
set
methods will throw an
IllegalStateException
when invoked.
isFrozen()
public static PreferredPlacementDescriptor newSharedInstance(byte placement)
placement along edge
and side of edge
.
placement
- an ORed combination of
LabelLayoutConstants.PLACE_ANYWHERE
, LabelLayoutConstants.PLACE_AT_SOURCE
,
LabelLayoutConstants.PLACE_AT_TARGET
, or LabelLayoutConstants.PLACE_AT_CENTER
and
LabelLayoutConstants.PLACE_LEFT_OF_EDGE
, LabelLayoutConstants.PLACE_RIGHT_OF_EDGE
, or
LabelLayoutConstants.PLACE_ON_EDGE
.
isFrozen()
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |