Home Reference Source Repository
import {VerticalAxis} from 'leaflet-coverage/'
public class | source

VerticalAxis

Extends:

L.Layer → VerticalAxis

Displays a simple vertical coordinate dropdown selector for a coverage data layer.

Example:

Coverage data layer
new C.VerticalAxis(covLayer).addTo(map)
// Selecting a vertical coordinate automatically sets the 'vertical' property in the layer.
// Similarly, when the layer fires an 'axisChange' event with {axis: 'vertical'}
// the control reflects that change.
Fake layer
var heights = [0,10,20,50,100,500,1000]
var fakeLayer = {
  verticalSlices: heights,
  vertical: heights[1], // select the second height step initially
  crsVerticalAxis: {
    name: { 
      en: 'Gravity-related height'
    },
    unit: {
      symbol: 'm'
    }
  }
}
var verticalAxis = new C.VerticalAxis(fakeLayer).addTo(map)

// change the height and trigger a manual update
fakeLayer.vertical = heights[0]
verticalAxis.update()

Constructor Summary

Public Constructor
public

constructor(covLayer: object, options: object)

Creates a vertical axis control.

Method Summary

Public Methods
public

update()

Triggers a manual update of the vertical axis control based on the vertical property of the layer.

Public Constructors

public constructor(covLayer: object, options: object) source

Creates a vertical axis control.

Params:

NameTypeAttributeDescription
covLayer object

The coverage data layer, or any object with verticalSlices and vertical properties, optionally crsVerticalAxis property. If the object has on/off methods, then the control will listen for axisChange events with {axis: 'vertical'} and update itself automatically. If the layer fires a remove event, then the control will remove itself from the map.

options object
  • optional

Control options.

options.position string
  • optional
  • default: 'topleft'

The initial position of the control (see Leaflet docs).

options.title string
  • optional
  • default: 'Vertical'

The label to show above the control if covLayer.crsVerticalAxis.name is missing.

options.templateId string
  • optional

Element ID of an alternative HTML <template> element to use.

Public Methods

public update() source

Triggers a manual update of the vertical axis control based on the vertical property of the layer.

Useful if the supplied coverage data layer is not a real layer and won't fire the necessary events for automatic updates.