public interface IEdgeLabelLayoutModel
IEdgeLabelLayout
.
An IEdgeLabelLayoutModel
provides a set of possible candidates for the placement of an edge 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
. IEdgeLabelLayoutModel
instances may be shared between multiple edge labels but produce different parameters for labels with different
locations.
Modifier and Type | Method and Description |
---|---|
Object |
createModelParameter(YOrientedRectangle labelBounds,
IEdgeLayout edgeLayout,
INodeLayout sourceLayout,
INodeLayout targetLayout)
Creates a model parameter that represents the given edge label position within this model.
|
Object |
getDefaultParameter()
Gets a model parameter that encodes the default position of this model's allowed edge label positions.
|
YList |
getLabelCandidates(IEdgeLabelLayout labelLayout,
IEdgeLayout edgeLayout,
INodeLayout sourceLayout,
INodeLayout targetLayout)
Returns all
EdgeLabelCandidate s that describe valid label positions within this model. |
YOrientedRectangle |
getLabelPlacement(YDimension labelSize,
IEdgeLayout edgeLayout,
INodeLayout sourceLayout,
INodeLayout targetLayout,
Object parameter)
Returns the oriented box of the label for the position encoded by the given model parameter.
|
Object createModelParameter(YOrientedRectangle labelBounds, IEdgeLayout edgeLayout, INodeLayout sourceLayout, INodeLayout targetLayout)
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, IEdgeLayout, INodeLayout, INodeLayout, 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 IEdgeLabelLayoutModel
.
labelBounds
- the oriented box of the label, encoding the label location for which the parameter should be creatededgeLayout
- the layout of the edge to which the label belongssourceLayout
- the layout of the source node of the label-owning edgetargetLayout
- the layout of the target node of the label-owning edgegetLabelPlacement(YDimension, IEdgeLayout, INodeLayout, INodeLayout, Object)
Object getDefaultParameter()
This parameter can be passed to getLabelPlacement(YDimension, IEdgeLayout, INodeLayout, INodeLayout, Object)
to
retrieve the corresponding label box.
YList getLabelCandidates(IEdgeLabelLayout labelLayout, IEdgeLayout edgeLayout, INodeLayout sourceLayout, INodeLayout targetLayout)
EdgeLabelCandidate
s that describe valid label positions within this model.
In case the implementing IEdgeLabelLayoutModel
allows every possible location, this method always returns the
current location as a LabelCandidate
.
labelLayout
- the label for which candidates should be generatededgeLayout
- the layout of the edge to which the label belongssourceLayout
- the layout of the source node of the label-owning edgetargetLayout
- the layout of the target node of the label-owning edgeEdgeLabelCandidate
instancesYOrientedRectangle getLabelPlacement(YDimension labelSize, IEdgeLayout edgeLayout, INodeLayout sourceLayout, INodeLayout targetLayout, Object parameter)
labelSize
- the width and height of the labeledgeLayout
- the layout of the edge to which the label belongssourceLayout
- the layout of the source node of the label-owning edgetargetLayout
- the layout of the target node of the label-owning edgeparameter
- the model parameter that describes the abstract position of the label within this model