|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.LabelLayoutData
public class LabelLayoutData
LabelLayoutData
encapsulates layout information for a label.
The information is used by clients to inform label-aware layout algorithms
about labeling
constraints like label size and preferred placement.
Label-aware algorithms like IncrementalHierarchicLayouter
return the calculated label positions by assigning the
corresponding box to the provided LabelLayoutData
instances.
DataProviders
are used for associating an array of LabelLayoutData
instances with either the
nodes or the edges of a LayoutGraph
. The DataProviders
must be registered with the
input graph using one of the keys defined in LabelLayoutKeys
.
Field Summary |
---|
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 |
Fields inherited from interface y.layout.LabelLayoutKeys |
---|
EDGE_LABEL_LAYOUT_KEY, IGNORE_LABEL_KEY, NODE_LABEL_LAYOUT_KEY |
Constructor Summary | |
---|---|
LabelLayoutData(double width,
double height)
Creates a new instance of LabelLayoutData for a label with the given width and height. |
|
LabelLayoutData(double width,
double height,
byte preferredPlacement)
Deprecated. |
|
LabelLayoutData(OrientedRectangle bounds)
Creates a new instance of LabelLayoutData for a label with the given oriented box. |
|
LabelLayoutData(OrientedRectangle bounds,
byte preferredPlacement)
Deprecated. |
|
LabelLayoutData(OrientedRectangle bounds,
PreferredPlacementDescriptor preferredPlacement)
Creates a new instance of LabelLayoutData for a label with the given oriented box and preferred placement
descriptor. |
Method Summary | |
---|---|
OrientedRectangle |
getBounds()
Returns the oriented box of the label. |
double |
getHeight()
Returns the height of the label's bounding box. |
byte |
getPreferredPlacement()
Deprecated. use setPreferredPlacementDescriptor(PreferredPlacementDescriptor) instead |
PreferredPlacementDescriptor |
getPreferredPlacementDescriptor()
Returns the preferred placement of this label. |
double |
getWidth()
Returns the width of the label's bounding box. |
double |
getX()
Returns the x-coordinate of the upper-left corner of the label's bounding box. |
double |
getY()
Returns the y-coordinate of the upper-left corner of the label's bounding box. |
void |
setBounds(OrientedRectangle bounds)
Specifies the oriented box of the label. |
void |
setLocation(double x,
double y)
Specifies the coordinates of the upper-left corner of the bounding box of the label. |
void |
setPreferredPlacement(byte placement)
Deprecated. use setPreferredPlacementDescriptor(PreferredPlacementDescriptor) instead |
void |
setPreferredPlacementDescriptor(PreferredPlacementDescriptor placement)
Specifies the preferred placement of this label. |
void |
setSize(double width,
double height)
Specifies the width and height of the oriented box of this label. |
java.lang.String |
toString()
Returns a String representation of LabelLayoutData . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LabelLayoutData(double width, double height)
LabelLayoutData
for a label with the given width and height.
width
- the width of the labelheight
- the height of the labelpublic LabelLayoutData(double width, double height, byte preferredPlacement)
LabelLayoutData
for a label with the given width, height and preferred placement.
width
- the width of the labelheight
- the height of the labelpreferredPlacement
- a preferred placement specifierLabelLayoutConstants
,
setPreferredPlacement(byte)
public LabelLayoutData(OrientedRectangle bounds)
LabelLayoutData
for a label with the given oriented box.
bounds
- the box of the labelpublic LabelLayoutData(OrientedRectangle bounds, byte preferredPlacement)
LabelLayoutData
for a label with the given oriented box and preferred placement.
bounds
- the box of the labelpreferredPlacement
- a preferred placement specifierLabelLayoutConstants
,
setPreferredPlacement(byte)
public LabelLayoutData(OrientedRectangle bounds, PreferredPlacementDescriptor preferredPlacement)
LabelLayoutData
for a label with the given oriented box and preferred placement
descriptor.
bounds
- the box of the labelpreferredPlacement
- a preferred placement descriptor
java.lang.IllegalArgumentException
- if the specified descriptor is null
PreferredPlacementDescriptor
,
setPreferredPlacementDescriptor(PreferredPlacementDescriptor)
Method Detail |
---|
public void setBounds(OrientedRectangle bounds)
oriented box
of the label.
bounds
- the box of the labelpublic OrientedRectangle getBounds()
oriented box
of the label.
setBounds(OrientedRectangle)
public void setSize(double width, double height)
oriented box
of this label.
getWidth()
and getHeight()
in contrast yield the width and height of the paraxial
bounding box of the oriented box. Both sizes only coincide in the case the oriented box is not
rotated.width
- the width of the oriented boxheight
- the height of the oriented boxsetBounds(OrientedRectangle)
public double getWidth()
OrientedRectangle.getBoundingBox()
public double getHeight()
OrientedRectangle.getBoundingBox()
public void setLocation(double x, double y)
x
- the new x-coordinate of the upper-left cornery
- the new y-coordinate of the upper-left cornergetX()
,
getY()
,
OrientedRectangle.getBoundingBox()
public double getX()
OrientedRectangle.getBoundingBox()
public double getY()
OrientedRectangle.getBoundingBox()
public void setPreferredPlacement(byte placement)
setPreferredPlacementDescriptor(PreferredPlacementDescriptor)
instead
LabelLayoutConstants.PLACE_ANYWHERE
placement
- the preferred placementpublic byte getPreferredPlacement()
setPreferredPlacementDescriptor(PreferredPlacementDescriptor)
instead
setPreferredPlacement(byte)
public void setPreferredPlacementDescriptor(PreferredPlacementDescriptor placement)
PreferredPlacementDescriptor
. A descriptor that allows all placements
LabelLayoutConstants.PLACE_ANYWHERE
placement
- the desired placement
java.lang.IllegalArgumentException
- if the specified descriptor is null
public PreferredPlacementDescriptor getPreferredPlacementDescriptor()
setPreferredPlacementDescriptor(PreferredPlacementDescriptor)
public java.lang.String toString()
String
representation of LabelLayoutData
.
The String
contains the bounds of the label and the preferred placement
toString
in class java.lang.Object
String
representation of LabelLayoutData
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |