|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface NodeLabelModel
NodeLabelModel
defines the properties of the model associated with a NodeLabelLayout
.
A NodeLabelModel
provides a set of possible candidates for the placement of a node label.
It also defines a parameter that describes the current location of the label.
It is important that all state information is encapsulated in the
model parameter
.
NodeLabelModel
instances may be shared between multiple node labels but produce different parameters for
labels with different locations.
Method Summary | |
---|---|
java.lang.Object |
createModelParameter(OrientedRectangle labelBounds,
NodeLayout nodeLayout)
Creates a model parameter that represents the given node label position within this model. |
java.lang.Object |
getDefaultParameter()
Returns a model parameter that encodes the default position of this model's allowed node label positions. |
YList |
getLabelCandidates(NodeLabelLayout labelLayout,
NodeLayout nodeLayout)
Returns all NodeLabelCandidate s that describe valid label positions within this model. |
OrientedRectangle |
getLabelPlacement(YDimension labelSize,
NodeLayout nodeLayout,
java.lang.Object param)
Returns the bounds of the label for the position encoded by the given model parameter. |
Method Detail |
---|
java.lang.Object getDefaultParameter()
This parameter can be passed to getLabelPlacement(YDimension, NodeLayout, Object)
to retrieve the
corresponding label box.
OrientedRectangle getLabelPlacement(YDimension labelSize, NodeLayout nodeLayout, java.lang.Object param)
labelSize
- the width and height of the labelnodeLayout
- the layout of the node to which the label belongsparam
- the model parameter that describes the abstract position of the label within this model
YList getLabelCandidates(NodeLabelLayout labelLayout, NodeLayout nodeLayout)
NodeLabelCandidate
s that describe valid label positions within this model.
In case the implementing NodeLabelModel
allows every possible location, this method always returns the
current location as a LabelCandidate
.
labelLayout
- the label for which candidates should be generatednodeLayout
- the layout of the node to which the label belongs
NodeLabelCandidate
instancesjava.lang.Object createModelParameter(OrientedRectangle labelBounds, NodeLayout nodeLayout)
The created model parameter is the closest parameter representation of the given label location that can be achieved within this model.
This parameter can be passed to getLabelPlacement(YDimension, NodeLayout, Object)
to retrieve the
current label box.
A model parameter can be an arbitrary Object
. However it must contain all information to allow restoring
of the encoded location with this NodeLabelModel
.
labelBounds
- the box of the label, encoding the label location for which the parameter should be creatednodeLayout
- the layout of the node to which the label belongs
getLabelPlacement(YDimension, NodeLayout, Object)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |