C

EdgeSegmentLabelModel

An edge label model that allows placement of labels relative to an edge segment at a set of continuous positions at specified sides of the edge path.
ImplementsInheritance Hierarchy

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 specified segment index from the source or target side and a ratio on this segment. This is the main difference to the EdgePathLabelModel which only uses a ratio value of the full edge path.

See Also

Developer's Guide

Members

No filters for this type

Constructors

Initializes a new instance of the EdgeSegmentLabelModel 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 true auto rotation is enabled.
sideOfEdge?: EdgeSides
The side of the edge labels.

Properties

Gets or sets the rotation angle of all labels with this model in radians.
final

Property Value

The rotation angle of all labels with this model in radians.
Gets or sets whether edge labels are automatically rotated according to the angle of the corresponding reference edge segment.
By default, this feature is enabled.
final

Property Value

true if edge labels are automatically rotated; false otherwise.
Gets or sets the distance between the label box and the edge path.

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.

final

Property Value

The distance between the label box and the edge path.

See Also

API
sideOfEdge, EdgeSides, offset
Gets or sets the offset of the label box and the edge path relative to the default placement.
For ON_EDGE this is the offset between the center of the label box and the edge path. For all other EdgeSides values this offset is added to the distance property which results in the total distance between the label box and the edge path.
final

Property Value

The offset of the label box and the edge path relative to the default placement.

See Also

API
sideOfEdge, EdgeSides
Gets or sets the side placement specifiers for edge labels.
The ILabelModelParameterFinder and ILabelModelParameterProvider in the context consider the specified sides.
conversionfinal

See Also

API
EdgeSides

Methods

Creates a parameter where the label is attached to the edge segment that contains the edge's midpoint.
final

Parameters

segmentRatio?: number
The ratio at which to place the label at the segment. A ratio of 0.0 will place the label at the source side of the segment, a ratio of 1.0 at the target side. Ratios < 0.0 or > 1.0 will be interpreted as absolute values in world coordinates. 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

EdgeSegmentLabelModelParameter
A label parameter that describes the provided parameters for this model instance.
Creates a parameter that describes the provided segment index and ratio from the source side of the edge path.
final

Parameters

segmentIndex: number
The zero-based index of the segment beginning from the source side.
segmentRatio?: number
The ratio at which to place the label at the segment. A ratio of 0.0 will place the label at the source side of the segment, a ratio of 1.0 at the target side. Ratios < 0.0 or > 1.0 will be interpreted as absolute values in world coordinates. 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

EdgeSegmentLabelModelParameter
A label parameter that describes the provided parameters for this model instance.
Creates a parameter that describes the provided segment index and ratio from the target side of the edge path.
final

Parameters

segmentIndex: number
The zero-based index of the segment beginning from the target side.
segmentRatio?: number
The ratio at which to place the label at the segment. A ratio of 0.0 will place the label at the target side of the segment, a ratio of 1.0 at the source side. Ratios < 0.0 or > 1.0 will be interpreted as absolute values in world coordinates. 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

EdgeSegmentLabelModelParameter
A label parameter that describes the provided parameters for this model instance.
Tries to find a parameter that best matches the given layout for the provided label instance.
This method does not necessarily have to find a parameter that exactly matches the specified layout.
final

Parameters

label: ILabel
The label to find a parameter for.
layout: IOrientedRectangle
The anticipated layout for the label.

Return Value

ILabelModelParameter
A non-null parameter that can be used for the label to approximate the provided layout.
Returns an empty context.
final

Parameters

label: ILabel
The label to use in the context.

Return Value

ILookup
An empty context.
Calculates the geometry of the given label using the given model parameter.
final

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.