C

BezierEdgeSegmentLabelModel

An edge label model that allows placement of labels relative to an edge segment for bezier edges.
ImplementsInheritance Hierarchy

Remarks

This model is intended to work with a BezierEdgeStyle and assumes an edge path consisting of cubic segments.

It places the label at a fixed segment with a given ratio (a cubic curve parameter value) and distance from the path, which are parameter specific. Additionally, the label can be automatically rotated to be parallel to the tangent vector at the given ratio ( autoRotation) and can have an additional rotation angle (independently of the automatic rotation (angle)

If the segment index is less than 0, a placement outside of the path is assumed by taking the connection between source and target as the baseline and applying the ratio to this line segment. In this case, if auto rotation is enabled, the label will be rotated to match the path slope at the beginning resp. end of the edge path in order to ensure a smooth movement.

Labels are freely movable and movement can optionally be snapped so that the center of the label lies on the edge path, if the label intersects the edge path.

Members

No filters for this type

Constructors

Creates a default instance of the label model with no angle, auto ratio enabled, and snapping disabled.

Parameters

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 or not edge labels are automatically rotated according to the tangent 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 whether the model should snap automatically the layout center to the edge path.
If set to true: - The distance of the parameter will be adjusted so that the whole box has a minimum distance to the edge path - Interactive movements will snap to the edge path as soon as the label layout would come too near to the edge path. Default value is false
final

Methods

Creates a parameter at the given segment measured from the source side of the edge path, segment ratio, and distance from the segment.
final

Parameters

segmentIndex: number
The segment index. If this value is negative, placement outside of the edge path is assumed.
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 are interpreted as parameter values of a cubic spline, i.e. not as percentages of the segment length. If the index is -1, ratios are interpreted as absolute values instead. The default is 0.5.
distance?: number
The distance from the segment. This may be interpreted differently, depending on whether autoSnapping is enabled or not.

Return Value

BezierEdgeSegmentLabelModelParameter
A new parameter with the given specification.
Creates a parameter at the given segment measured from the target side of the edge path, segment ratio, and distance from the segment.
final

Parameters

segmentIndex: number
The segment index. If this value is negative, placement outside of the edge path is assumed.
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 are interpreted as parameter values of a cubic spline, i.e. not as percentages of the segment length. If the index is -1, ratios are interpreted as absolute values instead. The default is 0.5.
distance?: number
The distance from the segment. This may be interpreted differently, depending on whether autoSnapping is enabled or not.

Return Value

BezierEdgeSegmentLabelModelParameter
A new parameter with the given specification.
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.