A high-level canvas to draw text labels on a map. To enable painting, implement the paintLabel method on your FeaturePainter. Within this method, you can make one or more draw* calls on the LabelCanvas. Each such call will attempt to place a label on screen. However, this does not necessarily mean that every label will be visible on screen. Visibility of a label depends on styling properties such as label-priority, label-grouping and whether you want to avoid overlapping labels by the de-cluttering mechanism.

In a 3D scene, the label placement procedure hides labels when the label's shape, the shape that is used by the label command, is obscured by other objects. Although, if the corresponding shape's body is painted with the OcclusionMode.ALWAYS_VISIBLE or OcclusionMode.OCCLUDED_ONLY style, then the label stays visible too.

For more information on the behaviour of label placement, please refer to LabelStyle.

Hierarchy

  • LabelCanvas

Methods

  • Draw a HTML label on the map at the specified position. The html should be a text-string and should not contain dynamic content.

    Parameters

    • html: string | HTMLElement

      The HTML to place on the map. It may contain HTML markup and CSS styling properties.

    • shape: Shape

      The shape for which the label should be drawn.

    • labelStyle: PointLabelStyle

      An object containing labeling properties. Note that the padding property is not supported. Use CSS padding and margin properties to simulate padding.

    Returns void

  • Draw a HTML label on the map inside the shape. The html should be a text-string and should not contain dynamic content.

    Parameters

    • html: string | HTMLElement

      The HTML to place on the map. It may contain HTML markup and CSS styling properties.

    • shape: Shape

      The shape along which the label should be drawn.

    • labelStyle: InPathLabelStyle

      an object containing labeling properties.

    Returns void

  • Draw a HTML label on the map along the specified shape. The html should be a text-string and should not contain dynamic content.

    Parameters

    • html: string | HTMLElement

      The HTML to place on the map. It may contain HTML markup and CSS styling properties.

    • shape: Shape

      The shape in which to place the label.

    • labelStyle: OnPathLabelStyle

      an object containing labeling properties.

    Returns void