public class FreeNodeLabelLayoutModel extends Object implements INodeLabelLayoutModel
FreeNodeLabelLayoutModel allows placing node labels at any desired position.
The location of the label does not need to satisfy any constraints. The model parameter
describes a fixed offset between the upper-left corner of the node and the center of the label.
| Modifier and Type | Class and Description |
|---|---|
static class |
FreeNodeLabelLayoutModel.ModelParameter
The model parameter that encodes a label position within
FreeNodeLabelLayoutModel. |
| Constructor and Description |
|---|
FreeNodeLabelLayoutModel()
Returns a new instance of
FreeNodeLabelLayoutModel. |
| Modifier and Type | Method and Description |
|---|---|
Object |
createModelParameter(YOrientedRectangle labelBounds,
INodeLayout nodeLayout)
Creates a model parameter that represents the given node label position within this model.
|
Object |
getDefaultParameter()
Gets a model parameter that encodes the default position of
INodeLabelLayoutModel. |
YList |
getLabelCandidates(INodeLabelLayout labelLayout,
INodeLayout nodeLayout)
Returns the
NodeLabelCandidate that describes the current label position. |
YOrientedRectangle |
getLabelPlacement(YDimension labelSize,
INodeLayout nodeLayout,
Object param)
Returns the bounds of the label for the position encoded by the given model parameter.
|
public FreeNodeLabelLayoutModel()
FreeNodeLabelLayoutModel.public Object createModelParameter(YOrientedRectangle labelBounds, INodeLayout nodeLayout)
The created model parameter represents the current location of the given label.
This parameter can be passed to getLabelPlacement(YDimension, INodeLayout, Object) to retrieve the current
label box.
createModelParameter in interface INodeLabelLayoutModelIllegalArgumentException - if one or more of the given bounds' values are invalid, i.e., NaNlabelBounds - the bounds of the label the parameter representsnodeLayout - the layout of the node to which the label belongsgetLabelPlacement(YDimension, INodeLayout, Object)public Object getDefaultParameter()
INodeLabelLayoutModel.
The node label's upper-left corner is placed 20 pixels to the left and 20 pixels above the node.
This parameter can be passed to getLabelPlacement(YDimension, INodeLayout, Object) to retrieve the
corresponding label box.
getDefaultParameter in interface INodeLabelLayoutModelpublic YList getLabelCandidates(INodeLabelLayout labelLayout, INodeLayout nodeLayout)
NodeLabelCandidate that describes the current label position.getLabelCandidates in interface INodeLabelLayoutModellabelLayout - the label for which candidates should be generatednodeLayout - the layout of the node to which the label belongsNodeLabelCandidate instancespublic YOrientedRectangle getLabelPlacement(YDimension labelSize, INodeLayout nodeLayout, Object param)
INodeLabelLayoutModelgetLabelPlacement in interface INodeLabelLayoutModellabelSize - 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