An object literal defining placement instructions for label positioning along a path (e.g., along a line's path or along a polygon's boundary).

Use constants from PathLabelPosition to set the position of a label.

Use OnPathLabelRepeatOptions to set options for repeating labels along a path. When this property is not provided, the label is placed at a single location. LuciadRIA optimizes label positioning by assessing its visibility. If the initial position leads to the label being outside the view or colliding with other elements as determined by the decluttering algorithm, LuciadRIA will find an alternative position.

interface OnPathLabelStyle {
    group?: string | number;
    padding?: number;
    perpendicularOffset?: number;
    positions?: PathLabelPosition | PathLabelPosition[];
    priority?: number;
    repeat?: OnPathLabelRepeatOptions;
    rotation?: PathLabelRotation;
}

Hierarchy (view full)

Properties

group?: string | number

The group name for this label style. This can be a custom name or the predefined constant: "NON_DECLUTTERED".

Labels that are painted with the same group name will automatically be decluttered, labels across different groups will not. The only exception to this is "NON_DECLUTTERED". When using this group, all labels inside this group will be painted without label decluttering. This parameter is optional. The default value is "DEFAULT". In practice, this means that - if no group is specified - all labels will be decluttered in the same group.

padding?: number

The amount of padding that should be added around the label. This value describes the amount in pixels by which the labels extent should grow for the decluttering purpose. A negative number will be ignored. This parameter is optional. The default is no padding.

perpendicularOffset?: number

Defines the perpendicular distance from the path at which a label will be placed. This distance is expressed in pixels. If the value is positive, labels are placed above the path. Negative numbers mean that labels are placed below the path. The positions property is disregarded when the perpendicularOffset property is a non-zero value.

Determines positions for label placement with this style. You can use any constant from PathLabelPosition, combine constants using a bitwise OR operation for multiple permissible positions, or provide an array of constants. For example, PathLabelPosition.BELOW | PathLabelPosition.ABOVE will permit both BELOW and ABOVE alignments for the label. If an array is used, the order represents positioning priority. If no positions are specified, the default position is CENTER.

Note: The perpendicularOffset property takes precedence over the positions property.

  const pathLabelStyle = {
positions: [PathLabelPosition.ABOVE, PathLabelPosition.BELOW]
};
priority?: number

Priority for this label style. A lower number means that the label will have a higher probability of being painted. If you do not explicitly assign a priority, the default priority of 0 is applied. The priority can be a negative number if you want to indicate that a label has a higher priority than the default.

The object that controls how the label is repeated alongside the path. If this property is missing a single label is placed along a path.

The label rotation setting for this label style. Note that this parameter only affects on-path labeling! This parameter is optional. The default is PathLabelRotation.FIXED_LINE_ANGLE.