Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Layers

Hierarchy

  • Control
    • Layers

Implements

Index

Constructors

constructor

  • Creates an attribution control with the given layers. Base layers will be switched with radio buttons, while overlays will be switched with checkboxes.

    Parameters

    • Optional baseLayers: any
    • Optional overlays: any
    • Optional options: LayersOptions

    Returns Layers

Methods

addBaseLayer

  • Adds a base layer (radio button entry) with the given name to the control.

    Parameters

    Returns Layers

addEventListener

  • addEventListener(type: string, fn: function, context?: any): Layers
  • addEventListener(eventMap: any, context?: any): Layers
  • Parameters

    Returns Layers

  • Parameters

    • eventMap: any
    • Optional context: any

    Returns Layers

addOneTimeEventListener

  • addOneTimeEventListener(type: string, fn: function, context?: any): Layers
  • Parameters

    Returns Layers

addOverlay

  • Adds an overlay (checkbox entry) with the given name to the control.

    Parameters

    Returns Layers

addTo

  • addTo(map: Map): Control
  • Adds the control to the map.

    Parameters

    Returns Control

clearAllEventListeners

  • clearAllEventListeners(): Layers

fire

  • fire(type: string, data?: any): Layers
  • Parameters

    • type: string
    • Optional data: any

    Returns Layers

fireEvent

  • fireEvent(type: string, data?: any): Layers
  • Parameters

    • type: string
    • Optional data: any

    Returns Layers

getContainer

  • getContainer(): HTMLElement
  • Returns the HTML container of the control.

    Returns HTMLElement

getPosition

  • getPosition(): string
  • Returns the current position of the control.

    Returns string

hasEventListeners

  • hasEventListeners(type: string): boolean

off

  • off(type: string, fn?: function, context?: any): Layers
  • off(eventMap?: any, context?: any): Layers
  • Parameters

    • type: string
    • Optional fn: function
    • Optional context: any

    Returns Layers

  • Parameters

    • Optional eventMap: any
    • Optional context: any

    Returns Layers

on

  • on(type: string, fn: function, context?: any): Layers
  • on(eventMap: any, context?: any): Layers
  • Parameters

    Returns Layers

  • Parameters

    • eventMap: any
    • Optional context: any

    Returns Layers

onAdd

  • onAdd(map: Map): HTMLElement
  • Should contain code that creates all the neccessary DOM elements for the control, adds listeners on relevant map events, and returns the element containing the control. Called on map.addControl(control) or control.addTo(map).

    Parameters

    Returns HTMLElement

onRemove

  • onRemove(map: Map): void
  • Optional, should contain all clean up code (e.g. removes control's event listeners). Called on map.removeControl(control) or control.removeFrom(map). The control's DOM container is removed automatically.

    Parameters

    Returns void

once

  • once(type: string, fn: function, context?: any): Layers
  • Parameters

    Returns Layers

removeEventListener

  • removeEventListener(type: string, fn?: function, context?: any): Layers
  • removeEventListener(eventMap?: any, context?: any): Layers
  • Parameters

    • type: string
    • Optional fn: function
    • Optional context: any

    Returns Layers

  • Parameters

    • Optional eventMap: any
    • Optional context: any

    Returns Layers

removeFrom

  • removeFrom(map: Map): Control
  • Removes the control from the map.

    Parameters

    Returns Control

removeLayer

  • Remove the given layer from the control.

    Parameters

    Returns Layers

setPosition

  • setPosition(position: string): Control
  • Sets the position of the control. See control positions.

    Parameters

    • position: string

    Returns Control

Static addInitHook

  • addInitHook(methodName: string, ...args: any[]): void
  • You can also use the following shortcut when you just need to make one additional method call.

    Parameters

    • methodName: string
    • Rest ...args: any[]

    Returns void

Static extend

  • You use L.Class.extend to define new classes, but you can use the same method on any class to inherit from it.

    Parameters

    Returns any