FreeEdgeLabelLayoutModel allows placing edge labels at any location.
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.FreeEdgeLabelLayoutModel
See Also
Constructors
Creates a new instance of FreeEdgeLabelLayoutModel.
Properties
Gets the model parameter that encodes the default position of FreeEdgeLabelLayoutModel.
Remarks
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 to retrieve the corresponding label box.
Implements
Methods
createModelParameter
(labelBounds: YOrientedRectangle, edgeLayout: IEdgeLayout, sourceLayout: INodeLayout, targetLayout: INodeLayout) : ObjectCreates a model parameter that represents the given edge label position within this model.
Remarks
The created model parameter represents the current location of the given label.
This parameter can be passed to getLabelPlacement to retrieve the current label box.
Parameters
A map of options to pass to the method.
- labelBounds - YOrientedRectangle
- the oriented box of the label the parameter represents
- edgeLayout - IEdgeLayout
- the layout of the edge to which the label belongs
- sourceLayout - INodeLayout
- the layout of the source node of the label-owning edge
- targetLayout - INodeLayout
- the layout of the target node of the label-owning edge
Returns
- ↪Object
- the model parameter representing the given label location
Throws
- Exception({ name: 'ArgumentError' })
- if one or more of the given bounds' values are invalid, i.e.,
NaN
See Also
Implements
getLabelCandidates
(labelLayout: IEdgeLabelLayout, edgeLayout: IEdgeLayout, sourceLayout: INodeLayout, targetLayout: INodeLayout) : YListReturns the EdgeLabelCandidate that describes the current label position.
Parameters
A map of options to pass to the method.
- labelLayout - IEdgeLabelLayout
- the label for which candidates should be generated
- edgeLayout - IEdgeLayout
- the layout of the edge to which the label belongs
- sourceLayout - INodeLayout
- the layout of the source node of the label-owning edge
- targetLayout - INodeLayout
- the layout of the target node of the label-owning edge
Returns
- ↪YList
- a list of EdgeLabelCandidate instances
Implements
getLabelPlacement
(labelSize: YDimension, edgeLayout: IEdgeLayout, sourceNode: INodeLayout, targetNode: INodeLayout, param: Object) : YOrientedRectangleReturns the oriented box of the label for the position encoded by the given model parameter.
Parameters
A map of options to pass to the method.
- labelSize - YDimension
- the width and height of the label
- edgeLayout - IEdgeLayout
- the layout of the edge to which the label belongs
- sourceNode - INodeLayout
- the layout of the source node of the label-owning edge
- targetNode - INodeLayout
- the layout of the target node of the label-owning edge
- param - Object
- the model parameter that describes the abstract position of the label within this model
Returns
- ↪YOrientedRectangle
- the oriented bounds of the label