- I
Remarks
Similar to EdgeSegmentLabelModel, a position is specified by an edge segment and a ratio on that segment, amongst others. During changes of the edge path, the label keeps its relative location with respect to the bends of the reference segment in a similar way.
In contrast to EdgeSegmentLabelModel, the distance from the edge path is not a property of the model but of the particular parameter. In addition, this class does not implement ILabelModelParameterProvider and therefore, labels with this model can be moved freely and are not restricted to a fixed set of candidates at a given distance from the edge.
If autoRotation is enabled, labels are automatically rotated according to the angle of the corresponding reference edge segment.
During movements, labels with this model snap to notable positions if the MoveInputMode provides a GraphSnapContext that is enabled and has a suitable configuration.
See Also
Developer's Guide
Members
Constructors
Properties
Property Value
Methods
Creates a parameter where the label is attached to the edge segment that contains the edge's midpoint.
Parameters
- distance?: number
- The distance between the label's box and the edge's path. The default is 0.
- segmentRatio?: number
- The ratio at which to place the label at the segment. A ratio of
0.0will place the label at the source side of the segment, a ratio of1.0at the target side. Ratios less than0.0or greater than1.0will be interpreted as absolute values in world coordinates. The default is 0.5.
Return Value
- SmartEdgeLabelModelParameter
- A label parameter that describes the provided parameters for this model instance.
createParameterFromSource
(segmentIndex: numberdistance?: numbersegmentRatio?: number): SmartEdgeLabelModelParameterCreates a parameter that measures the provided segment index from the source side of the edge path.
createParameterFromSource
(Parameters
- segmentIndex: number
- The zero-based index of the segment beginning from the source side.
- distance?: number
- The distance between the label's box and the edge's path. The default is 0.
- segmentRatio?: number
- The ratio at which to place the label at the segment. A ratio of
0.0will place the label at the source side of the segment, a ratio of1.0at the target side. Ratios less than0.0or greater than1.0will be interpreted as absolute values in world coordinates. The default is 0.5.
Return Value
- SmartEdgeLabelModelParameter
- A label parameter that describes the provided parameters for this model instance.
createParameterFromTarget
(segmentIndex: numberdistance?: numbersegmentRatio?: number): SmartEdgeLabelModelParameterCreates a parameter that measures the provided segment index from the target side of the edge path.
createParameterFromTarget
(Parameters
- segmentIndex: number
- The zero-based index of the segment beginning from the target side.
- distance?: number
- The distance between the label's box and the edge's path. The default is 0.
- segmentRatio?: number
- The ratio at which to place the label at the segment. A ratio of
0.0will place the label at the target side of the segment, a ratio of1.0at the source side. Ratios less than0.0or greater than1.0will be interpreted as absolute values in world coordinates. The default is 0.5.
Return Value
- SmartEdgeLabelModelParameter
- 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.
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.
Provides a lookup context for the given label.
Parameters
- label: ILabel
- The label to use in the context.
Return Value
- ILookup
- An implementation of the ILookup interface that can be used to query additional aspects of the label.
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.