|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.DiscreteNodeLabelModel
public class DiscreteNodeLabelModel
A node label model that allows placement of labels at eight positions around a node and at nine positions inside the node.
It's possible to specify an insets value that controls the distance between label and node.
Field Summary | |
---|---|
static int |
BOTTOM
Symbolic position specifier. |
static int |
BOTTOM_LEFT
Symbolic position specifier. |
static int |
BOTTOM_RIGHT
Symbolic position specifier. |
static int |
CENTER
Symbolic position specifier. |
static int |
CORNER_MASK
Position mask that constrains the positions to NORTH_EAST , NORTH_WEST , SOUTH_EAST , and SOUTH_WEST . |
static int |
EAST
Symbolic position specifier. |
static int |
EIGHT_POS_MASK
Position mask that allows only the eight node-external positions. |
static int |
INTERNAL_MASK
Position mask that allows only the nine node-internal positions. |
static int |
LEFT
Symbolic position specifier. |
static int |
NORTH
Symbolic position specifier. |
static int |
NORTH_EAST
Symbolic position specifier. |
static int |
NORTH_WEST
Symbolic position specifier. |
static int |
RIGHT
Symbolic position specifier. |
static int |
SANDWICH_MASK
Position mask that constrains the positions to NORTH and SOUTH . |
static int |
SIDES_MASK
Position mask that constrains the positions to EAST , WEST , NORTH , and SOUTH . |
static int |
SOUTH
Symbolic position specifier. |
static int |
SOUTH_EAST
Symbolic position specifier. |
static int |
SOUTH_WEST
Symbolic position specifier. |
static int |
TOP
Symbolic position specifier. |
static int |
TOP_LEFT
Symbolic position specifier. |
static int |
TOP_RIGHT
Symbolic position specifier. |
static int |
WEST
Symbolic position specifier. |
Constructor Summary | |
---|---|
DiscreteNodeLabelModel()
Returns a new instance of DiscreteNodeLabelModel. |
|
DiscreteNodeLabelModel(int candidateMask)
Returns a new instance of DiscreteNodeLabelModel. |
|
DiscreteNodeLabelModel(int candidateMask,
double inset)
Returns a new instance of DiscreteNodeLabelModel. |
Method Summary | |
---|---|
Object |
createModelParameter(OrientedRectangle labelBounds,
NodeLayout nodeLayout)
Creates a model parameter that represents the given node label context best within this model. |
int |
getCandidateMask()
Allowed candidate positions, default is all positions. |
Object |
getDefaultParameter()
Returns a model parameter that encodes the default position of this model's allowed node label positions. |
double |
getDistance()
Returns the distance between the bounding boxes of label and node. |
YList |
getLabelCandidates(NodeLabelLayout nl,
NodeLayout nodeLayout)
Returns a list of candidate positions for the given node label. |
protected OrientedRectangle |
getLabelPlacement(YDimension labelSize,
NodeLayout nodeLayout,
int pos)
Returns the oriented label position and bounds for a node label of the specified size. |
OrientedRectangle |
getLabelPlacement(YDimension labelSize,
NodeLayout nodeLayout,
Object param)
Returns the the oriented label position and bounds encoded by the given model parameter. |
boolean |
isParameterValid(Object parameter)
Checks if the given model parameter encodes a node label position that is valid in this model. |
void |
setDistance(double distance)
Sets the distance between the bounding boxes of label and node in the manner of an insets. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NORTH
public static final int NORTH_WEST
public static final int NORTH_EAST
public static final int EAST
public static final int WEST
public static final int SOUTH
public static final int SOUTH_WEST
public static final int SOUTH_EAST
public static final int CENTER
public static final int BOTTOM
public static final int TOP
public static final int LEFT
public static final int RIGHT
public static final int TOP_LEFT
public static final int TOP_RIGHT
public static final int BOTTOM_LEFT
public static final int BOTTOM_RIGHT
public static final int SANDWICH_MASK
NORTH
and SOUTH
.
public static final int INTERNAL_MASK
public static final int SIDES_MASK
EAST
, WEST
, NORTH
, and SOUTH
.
public static final int CORNER_MASK
NORTH_EAST
, NORTH_WEST
, SOUTH_EAST
, and SOUTH_WEST
.
public static final int EIGHT_POS_MASK
Constructor Detail |
---|
public DiscreteNodeLabelModel()
INTERNAL_MASK
is used to define the allowed positions for the node
label.
The distance between label and node is set to 4.0 [pixel].
setDistance(double)
public DiscreteNodeLabelModel(int candidateMask)
candidateMask
- Defines the allowed positions for the node label.setDistance(double)
public DiscreteNodeLabelModel(int candidateMask, double inset)
candidateMask
- Defines the allowed positions for the node label.inset
- The distance between label and node.setDistance(double)
Method Detail |
---|
public int getCandidateMask()
public double getDistance()
setDistance(double)
public void setDistance(double distance)
CENTER
position.
distance
- A non-negative value.public Object getDefaultParameter()
CENTER
when none of the above
default positions is part of the allowed positions.
getDefaultParameter
in interface NodeLabelModel
NodeLabelModel.getLabelPlacement(YDimension, NodeLayout, Object)
method.public boolean isParameterValid(Object parameter)
public OrientedRectangle getLabelPlacement(YDimension labelSize, NodeLayout nodeLayout, Object param)
getLabelPlacement
in interface NodeLabelModel
labelSize
- The size of the label.nodeLayout
- The geometric description of the label's node.param
- A model parameter that encodes a label position that is valid
in this model.
public YList getLabelCandidates(NodeLabelLayout nl, NodeLayout nodeLayout)
getLabelCandidates
in interface NodeLabelModel
nl
- The label layout for which candidates should be generated.nodeLayout
- The layout of the node to which the label belongs.
NodeLabelCandidate
objects.protected OrientedRectangle getLabelPlacement(YDimension labelSize, NodeLayout nodeLayout, int pos)
labelSize
- The size of the label.nodeLayout
- The geometric description of the label's node.pos
- A label position that is valid in this model.
public Object createModelParameter(OrientedRectangle labelBounds, NodeLayout nodeLayout)
NodeLabelModel
createModelParameter
in interface NodeLabelModel
labelBounds
- The bounds of the label for which a parameter representation is sought.nodeLayout
- The layout of the node to which the label belongs.
NodeLabelModel.getLabelPlacement(YDimension, NodeLayout, Object)
method.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |