A utility class that can be used to implement a UI component that shows an overlay text for a layer, for example an overlay that shows the current MGRS grid zone.

The text can be based on the following types of coordinates:

This utility fires events whenever the text changes, or the visibility of the layer changes. You can use these events to update the state of your UI component.

Since

2022.0

Hierarchy

Implements

Constructors

  • Constructs a new OverlayTextProvider

    Parameters

    • layer: Layer

      The layer to provide overlay text for

    • settings: OverlayTextSetting[]

      Specifies what format string to use at what scale range

    • defaultFormat: string

      The default format string. This is used if no format string was found for the current scale.

    • Optional options: OverlayTextProviderConstructorOptions

      Options for this OverlayTextProvider.

    Returns OverlayTextProvider

Accessors

  • get visible(): boolean
  • Returns the current state of visibility. Visible is true when:

    • the layer is added to a map
    • the layer's Layer.visible is true
    • labeling is turned on for the current layer

    Returns boolean

Methods

  • Destroy this OverlayTextProvider. This cleans up all map / layer listeners it has set up.

    Returns void

  • Called whenever a common map coordinate (OverlayTextCoordinateType.COMMON_MAP_COORDINATE) needs to be formatted to a string.

    Parameters

    • map: Map

      A reference to the map for which to determine the common map coordinate.

    • format: string

      The format string to use. This is the format string that matches the current scale range (as passed into the constructor), or the default format string if no matching scale range was found.

    Returns string

  • Called whenever a single (model) point needs to be formatted to a string.

    Parameters

    • modelPoint: Point

      The point to format to a string

    • format: string

      The format string to use. This is the format string that matches the current scale range (as passed into the constructor), or the default format string if no matching scale range was found.

    Returns string

  • Call this to update text. For example, this is called when the map is moved.

    Returns void

  • Protected

    Transform a view point (pixels) to the model reference

    Parameters

    • viewPoint: Point

      A view point (pixel coordinaes) to transform to the model reference

    Returns Point

Events

"TextChanged" event

  • on("TextChanged", callback: ((newText) => void)) : Handle
  • This event fires whenever OverlayTextProvider.text changes.

    Parameters

    • event: "TextChanged"
    • callback: ((newText) => void)
        • (newText): void
        • Parameters

          • newText: string

          Returns void

    Returns Handle

"VisibilityChanged" event

  • on("VisibilityChanged", callback: ((newVisibility) => void)) : Handle
  • This event fires whenever OverlayTextProvider.visible changes.

    Parameters

    • event: "VisibilityChanged"
    • callback: ((newVisibility) => void)
        • (newVisibility): void
        • Parameters

          • newVisibility: boolean

          Returns void

    Returns Handle