UNPKG

1.71 kBTypeScriptView Raw
1import { DoCheck, EventEmitter, KeyValueDiffer, KeyValueDiffers, NgZone, OnDestroy, OnInit } from '@angular/core';
2import { Control, Layer } from 'leaflet';
3import { LeafletDirective } from '../../core/leaflet.directive';
4/**
5 * Baselayers directive
6 *
7 * This directive is provided as a convenient way to add baselayers to the map. The input accepts
8 * a key-value map of layer name -> layer. Mutable changed are detected. On changes, a differ is
9 * used to determine what changed so that layers are appropriately added or removed. This directive
10 * will also add the layers control so users can switch between available base layers.
11 *
12 * To specify which layer to show as the 'active' baselayer, you will want to add it to the map
13 * using the layers directive. Otherwise, the plugin will use the last one it sees.
14 */
15export declare class LeafletBaseLayersDirective implements DoCheck, OnDestroy, OnInit {
16 private differs;
17 private zone;
18 baseLayersValue: {
19 [name: string]: Layer;
20 };
21 baseLayersDiffer: KeyValueDiffer<string, Layer>;
22 set baseLayers(v: {
23 [name: string]: Layer;
24 });
25 get baseLayers(): {
26 [name: string]: Layer;
27 };
28 layersControlOptions: Control.LayersOptions;
29 layersControlReady: EventEmitter<Control.Layers>;
30 private baseLayer;
31 private leafletDirective;
32 private controlLayers;
33 constructor(leafletDirective: LeafletDirective, differs: KeyValueDiffers, zone: NgZone);
34 ngOnDestroy(): void;
35 ngOnInit(): void;
36 ngDoCheck(): void;
37 protected updateBaseLayers(): void;
38 /**
39 * Check the current base layer and change it to the new one if necessary
40 */
41 protected syncBaseLayer(): void;
42}