- I
Remarks
The set of positions can be influenced by specifying the sideOfEdge value that controls on which side of the edge labels positions should be considered. Furthermore, it's possible to specify distance values that control the distance between label and edge and between label and nodes.
If a label model parameter is created ON_EDGE, the label's center is usually placed on the edge. It can be shifted by specifying a offset value but the distance value is ignored. For all other values of EdgeSides the total distance between the label bounds and the edge path is the sum of offset and distance.
The label placements use a ratio value as fraction of the full edge path length. This is the main difference to the EdgeSegmentLabelModel which uses a specified segment index from the source or target side and a ratio on this segment.
See Also
Developer's Guide
Members
Constructors
Initializes a new instance of the EdgePathLabelModel class.
Parameters
- distance?: number
- The distance to the edge.
- offset?: number
- The offset to the default placement.
- angle?: number
- The angle of the label's rotation in radians.
- autoRotation?: boolean
- If set to
trueauto rotation is enabled. - sideOfEdge?: EdgeSides
- The side of the edge labels.
Properties
Property Value
Property Value
true if edge labels are automatically rotated; false otherwise.The interpretation of the values depends on the sideOfEdge of the individual ILabelModelParameter.
Note that for ON_EDGE this property is ignored. For all other values of EdgeSides the offset property is added to this distance.
The default value is 2.
Property Value
See Also
API
- sideOfEdge, EdgeSides, offset
Property Value
See Also
API
- sideOfEdge, EdgeSides
Gets or sets the side placement specifiers for edge labels.
See Also
API
- EdgeSides
Methods
Creates a parameter at the provided edge path ratio.
Parameters
- edgePathRatio?: number
- The ratio at which to place the label at the edge path. A ratio of 0.0 will place the label at the source side of the edge path, a ratio of 1.0 at the target side. The default is 0.5.
- sideOfEdge?: EdgeSides
- The side of the edge the label is placed on. Note that only single enum values but no combined ones are allowed. The default is ON_EDGE.
Return Value
- EdgePathLabelModelParameter
- A label parameter at the provided edge path ratio for this model instance.
Tries to find a parameter that best matches the given layout for the provided label instance.
Parameters
- label: ILabel
- The label to find a parameter for.
- layout: IOrientedRectangle
- The anticipated layout for the label.
Return Value
- ILabelModelParameter
- A non-
nullparameter that can be used for the label to approximate the provided layout.
Parameters
- label: ILabel
- The label to use in the context.
Return Value
- ILookup
- An empty context.
Implements
ILabelModel.getContextCalculates the geometry of the given label using the given model parameter.
Parameters
- label: ILabel
- The label to calculate the geometry for.
- layoutParameter: ILabelModelParameter
- A parameter that is compatible with this model. Typically, this is a parameter that has been created by this model, and its property model returns this instance.
Return Value
- IOrientedRectangle
- An IOrientedRectangle that describes the geometry of the label. This is typically designed as a flyweight, therefore clients should not cache the instance but store the values if they need a snapshot for later use.