public class FreeEdgeLabelLayoutModel extends Object implements IEdgeLabelLayoutModel
FreeEdgeLabelLayoutModel
allows placing edge labels at any location.Modifier and Type | Class and Description |
---|---|
static class |
FreeEdgeLabelLayoutModel.ModelParameter
This model parameter encodes a label position within
FreeEdgeLabelLayoutModel . |
Constructor and Description |
---|
FreeEdgeLabelLayoutModel()
Creates a new instance of
FreeEdgeLabelLayoutModel . |
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 the model parameter that encodes the default position of
FreeEdgeLabelLayoutModel . |
YList |
getLabelCandidates(IEdgeLabelLayout labelLayout,
IEdgeLayout edgeLayout,
INodeLayout sourceLayout,
INodeLayout targetLayout)
Returns the
EdgeLabelCandidate that describes the current label position. |
YOrientedRectangle |
getLabelPlacement(YDimension labelSize,
IEdgeLayout edgeLayout,
INodeLayout sourceNode,
INodeLayout targetNode,
Object param)
Returns the oriented box of the label for the position encoded by the given model parameter.
|
public FreeEdgeLabelLayoutModel()
FreeEdgeLabelLayoutModel
.public Object createModelParameter(YOrientedRectangle labelBounds, IEdgeLayout edgeLayout, INodeLayout sourceLayout, INodeLayout targetLayout)
The created model parameter represents the current location of the given label.
This parameter can be passed to getLabelPlacement(YDimension, IEdgeLayout, INodeLayout, INodeLayout, Object)
to
retrieve the current label box.
createModelParameter
in interface IEdgeLabelLayoutModel
IllegalArgumentException
- if one or more of the given bounds' values are invalid, i.e., NaN
labelBounds
- the oriented box of the label the parameter representsedgeLayout
- 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)
public Object getDefaultParameter()
FreeEdgeLabelLayoutModel
.
The distance of the label to the edge's source point will be 20
. The angle between the line to the center of the
label and the first segment is 20
radians. The label is not rotated.
This parameter can be passed to getLabelPlacement(YDimension, IEdgeLayout, INodeLayout, INodeLayout, Object)
to
retrieve the corresponding label box.
getDefaultParameter
in interface IEdgeLabelLayoutModel
public YList getLabelCandidates(IEdgeLabelLayout labelLayout, IEdgeLayout edgeLayout, INodeLayout sourceLayout, INodeLayout targetLayout)
EdgeLabelCandidate
that describes the current label position.getLabelCandidates
in interface IEdgeLabelLayoutModel
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
instancespublic YOrientedRectangle getLabelPlacement(YDimension labelSize, IEdgeLayout edgeLayout, INodeLayout sourceNode, INodeLayout targetNode, Object param)
IEdgeLabelLayoutModel
getLabelPlacement
in interface IEdgeLabelLayoutModel
labelSize
- the width and height of the labeledgeLayout
- the layout of the edge to which the label belongssourceNode
- the layout of the source node of the label-owning edgetargetNode
- the layout of the target node of the label-owning edgeparam
- the model parameter that describes the abstract position of the label within this model