@watergis/maplibre-gl-terradraw
    Preparing search index...

    Maplibre GL Terra Draw Control

    Hierarchy (View Summary)

    Implements

    • IControl
    Index

    Constructors

    Properties

    _cssPrefix: string = ''
    _isExpanded: boolean = false
    controlContainer?: HTMLElement
    defaultMode: string = 'render'
    events: { [key: string]: [(event: EventArgs) => void] } = {}
    map?: Map$1
    modeButtons: { [key: string]: HTMLButtonElement } = {}
    options: TerradrawControlOptions = defaultControlOptions
    terradraw?: TerraDraw

    Accessors

    • get isExpanded(): boolean

      get the state of whether the control is expanded or collapsed

      Returns boolean

    • set isExpanded(value: boolean): void

      set the state of the control either expanded or collapsed. terradraw mode will be reset if the state is changed. either expanded or collapsed event is dispatched when changed

      Parameters

      • value: boolean

      Returns void

    • get showDeleteConfirmation(): boolean

      Show delete confirmation popup when deleting features if true. Default is false

      Returns boolean

    • set showDeleteConfirmation(value: boolean): void

      Set show delete confirmation popup when deleting features if true. Default is false

      Parameters

      • value: boolean

      Returns void

    Methods

    • clean maplibre style to filter only for terradraw related layers or without them. If options are not set, returns original style given to the function.

      This can be useful incase users only want to get terradraw related layers or without it.

      Usage: cleanStyle(map.getStyle, { excludeTerraDrawLayers: true}) cleanStyle(map.getStyle, { onlyTerraDrawLayers: true})

      Parameters

      • style: StyleSpecification

        maplibre style spec

      • Optionaloptions: { excludeTerraDrawLayers?: boolean; onlyTerraDrawLayers?: boolean }
        • OptionalexcludeTerraDrawLayers?: boolean

          return maplibre style without terradraw layers and sources

        • OptionalonlyTerraDrawLayers?: boolean

          return maplibre style with only terradraw layers and sources

      Returns StyleSpecification

    • Clear GeoJSON feature related to extended control such as measure and valhalla by TerraDraw feature ID

      Parameters

      • sourceIds: string[]

        the array of source ID to delete

      • ids: FeatureId[] = undefined

        the array of feature ID. Optional, if undefined, delete all labels for source

      Returns void

      void

    • Dispatch an event. Pass the current snapshot of features and mode

      Parameters

      • event: EventType

        event type

      • Optionalargs: { [key: string]: unknown }

        additional arguments

      Returns void

    • Get the default control position

      Returns ControlPosition

      default control position. Default is 'top-right'

    • get GeoJSON features

      Parameters

      • onlySelected: boolean = false

        If true, returns only selected features. Default is false.

      Returns { features: GeoJSONStoreFeatures<GeoJSONStoreGeometries>[]; type: string }

      FeatureCollection in GeoJSON format

    • Handle mode change operations that should be executed after setMode is called

      Parameters

      • mode: string

        The active mode name

      • target: TerraDraw

        The Terra Draw instance

      Returns void

      The result of the setMode operation

    • add the plugin control to maplibre

      Parameters

      • map: Map$1

        Maplibre Map object

      Returns HTMLElement

      HTML Element

    • Show delete confirmation dialog.

      Parameters

      • onConfirm: () => void

        Callback function that will be invoked when the user confirms deletion by clicking the "Delete" button in the dialog; typically used to delete all features before the dialog is closed.

      Returns void

    • Synchronize button states with the current Terra Draw mode

      Parameters

      • mode: string

        The active mode name

      Returns void