A PreferredPlacementDescriptor provides placement information for automatic edge labeling.
Remarks
It provides several options that influence the label placement in generic labeling algorithms and layout algorithms that support integrated label placement.
The preferred placement can describe multiple locations. For some options, like the placement along the edge, it is possible to have a combination of the valid values. These values can be connected with a logical or
-operation.
The following options describe the preferred placement:
- the placement along the edge
- the side of the edge
- the reference of the side
- the rotation angle of the label
- the reference for the rotation angle
- the rotation behavior for label on the right side of the edge
- the angle offset for label on the right side of the edge
- the distance between the label and its edge segment
The PreferredPlacementDescriptor will be immutable after freeze is called.
A PreferredPlacementDescriptor must be set for each label and will be retrieved by the layout algorithms calling preferredPlacementDescriptor.
Default Values of Properties
angle | 0 | |
angleOffsetOnRightSide | NONE
| |
angleReference | ABSOLUTE
| |
angleRotationOnRightSide | CLOCKWISE
| |
distanceToEdge | -1 | |
placeAlongEdge | AT_CENTER
| |
sideOfEdge | ON_EDGE
| |
sideReference | RELATIVE_TO_EDGE_FLOW
|
Type Details
- yfiles module
- layout-core
- yfiles-umd modules
- All layout modules, view-layout-bridge
- Legacy UMD name
- yfiles.layout.PreferredPlacementDescriptor
See Also
Constructors
Creates a new PreferredPlacementDescriptor instance with default settings.
Parameters
A map of options to pass to the method.
- placeAlongEdge - LabelPlacements
The preferred placement along the edge. This option sets the placeAlongEdge property on the created object.
- sideOfEdge - LabelPlacements
The preferred side of the edge. This option sets the sideOfEdge property on the created object.
- sideReference - LabelSideReferences
How to interpret the preferred side as given by sideOfEdge. This option sets the sideReference property on the created object.
- angle - number
The angle (in radians) for the label rotation. This option sets the angle property on the created object.
- angleReference - LabelAngleReferences
The reference of the angle given by angle. This option sets the angleReference property on the created object.
- angleRotationOnRightSide - LabelAngleOnRightSideRotations
How the angle is applied to labels on the right side in respect of the labels of the left side of the edge. This option sets the angleRotationOnRightSide property on the created object.
- angleOffsetOnRightSide - LabelAngleOnRightSideOffsets
The angle offset for labels that are placed on the right side of the edge. This option sets the angleOffsetOnRightSide property on the created object.
- distanceToEdge - number
The preferred distance between a label and the corresponding edge segment. This option sets the distanceToEdge property on the created object.
Creates a new PreferredPlacementDescriptor instance that copies the given descriptor.
Parameters
A map of options to pass to the method.
- descriptor - PreferredPlacementDescriptor
- the PreferredPlacementDescriptor that is copied
Properties
Gets or sets the angle (in radians) for the label rotation.
Remarks
Default Value
0
.Throws
- Exception({ name: 'InvalidOperationError' })
- if this instance is
See Also
Sample Graphs
Gets or sets how the angle is applied to labels on the right side in respect of the labels of the left side of the edge.
Gets or sets the preferred distance between a label and the corresponding edge segment.
Remarks
< 0
, the distance is not fixed, i.e., it is chosen by the automatic labeling algorithm.Default Value
-1
.Throws
- Exception({ name: 'InvalidOperationError' })
- if this instance is
- Exception({ name: 'ArgumentError' })
- if the specified value is infinite or
NaN
See Also
Sample Graphs
Gets whether or not one of the angle interpretations is absolute.
See Also
Gets whether or not one of the angle interpretations is to add an angle offset of 180
degrees to labels that are right of the edge.
Gets whether or not one of the angle interpretations is to add no angle offset to labels that are right of the edge.
Gets whether or not one of the angle interpretations is to rotate the angle of labels that are right of the edge co-rotating with the labels left of or centered on the edge, i.e., the angle of all labels is interpreted clockwise.
Gets whether or not one of the angle interpretations is to rotate the angle of labels that are right of the edge counter-rotating with the labels left of or centered on the edge, i.e., the angle of labels left or centered on edge is interpreted clockwise while the angle of labels right of edge is interpreted counter-clockwise.
Gets whether or not one of the angle interpretation is relative to the edge slope.
Gets whether or not one of the preferred placement locations for this label is at center.
See Also
Gets whether or not one of the preferred placement locations for this label is at source.
See Also
Gets whether or not one of the preferred placements for this label is at the source port.
See Also
Gets whether or not one of the preferred placements for this label is at target.
See Also
Gets whether or not one of the preferred placements for this label is at the target port.
See Also
Gets whether or not one of the preferred sides for this label is left of the edge.
See Also
Gets whether or not one of the preferred sides for this label is on the edge.
See Also
Gets whether or not one of the preferred sides for this label is right of the edge.
See Also
Gets whether or not the preferred side specified by sideOfEdge is interpreted absolute, and on horizontal segments, labels with preferred side LEFT_OF_EDGE are placed above the segment.
Gets whether or not the preferred side specified by sideOfEdge is interpreted absolute, and on horizontal segments, labels with preferred side RIGHT_OF_EDGE are placed above the segment.
Gets whether or not the preferred side specified by sideOfEdge is interpreted relative to the edge flow.
Gets or sets the preferred placement along the edge.
Default Value
AT_CENTER.Throws
- Exception({ name: 'InvalidOperationError' })
- if this instance is
See Also
Gets or sets how to interpret the preferred side as given by sideOfEdge.
Default Value
RELATIVE_TO_EDGE_FLOW.Throws
- Exception({ name: 'InvalidOperationError' })
- if this instance is
- Exception({ name: 'ArgumentError' })
- if the specified side reference is invalid
See Also
Methods
Clones this instance by returning a memberwiseClone or this in case this instance is already frozen.
Returns
- ↪any
- An instance of the same type as this instance.
Makes this PreferredPlacementDescriptor instance immutable.
Remarks
setter
methods will throw an InvalidOperationError when invoked.See Also
Returns a hash code for this object.
Remarks
The hash code is a numeric value that can be used to treat this object as a key in a hash table or similar data structure.
Two objects that are considered equal must have the same hash code. However, the reverse does not hold and two objects having the same hash code don't have to be equal. Ideally, the hash code should be roughly uniformly-distributed to prevent hash tables from performing poorly. Calculating the hash code is also a potentially frequent operation and should therefore be fast.
Returns
- ↪number
- the hash code for this object
Returns whether or not this is an immutable instance of PreferredPlacementDescriptor.
Remarks
setter
methods will throw an InvalidOperationError when invoked.Returns
- ↪boolean
true
if this instance is immutable,false
otherwise
See Also
Static Methods
Returns a PreferredPlacementDescriptor which matches positions supported by the given labelModel
.
Parameters
A map of options to pass to the method.
- labelModel - ILabelModel
- The ILabelModel to get a PreferredPlacementDescriptor for.
Returns
- ↪PreferredPlacementDescriptor
- A PreferredPlacementDescriptor which matches the given ILabelModel as good as possible.
Examples
See Also
Class.ensure(LayoutExecutor)
More information.Returns a PreferredPlacementDescriptor which matches the given parameter
best.
Parameters
A map of options to pass to the method.
- parameter - ILabelModelParameter
- The ILabelModelParameter to get a PreferredPlacementDescriptor for.
Returns
- ↪PreferredPlacementDescriptor
- A PreferredPlacementDescriptor which matches the given ILabelModelParameter as good as possible.
Throws
- Exception({ name: 'ArgumentError' })
- If the given
parameter
has a known model but theparameter
's type is not known.
Examples
See Also
Class.ensure(LayoutExecutor)
More information.