Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Overview

Constructors

constructor

  • 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

Events

on

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

    Parameters

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

          • newText: string

          Returns void

    Returns Handle

  • This event fires whenever OverlayTextProvider.visible changes.

    Parameters

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

          • newVisibility: boolean

          Returns void

    Returns Handle

Accessors

text

  • get text(): string

visible

  • 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

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

    Returns void

Protected Abstract formatCommonMapCoordinate

  • (map: Map, format: string): string
  • 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

Protected Abstract formatModelPoint

  • (modelPoint: Point, format: string): 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

Protected update

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

    Returns void

Protected viewPointToModel

  • 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

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method