@geoimpact/sep-map-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -0
- package/dist/index.d.ts +2485 -0
- package/dist/sep-map-sdk.css +1 -0
- package/dist/sep-map.esm.js +50 -0
- package/dist/sep-map.esm.js.map +1 -0
- package/dist/sep-map.js +2 -0
- package/dist/sep-map.js.map +1 -0
- package/dist/sep-map.umd.js +2 -0
- package/dist/sep-map.umd.js.map +1 -0
- package/package.json +65 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2485 @@
|
|
|
1
|
+
interface Address {
|
|
2
|
+
id: number;
|
|
3
|
+
label: string;
|
|
4
|
+
street: string;
|
|
5
|
+
houseNumber: string;
|
|
6
|
+
zip: string;
|
|
7
|
+
town: string;
|
|
8
|
+
coordinates: [lat: number, lng: number];
|
|
9
|
+
raw?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface PerimeterProperties {
|
|
13
|
+
name: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
interface Perimeter {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
properties: PerimeterProperties;
|
|
21
|
+
geometry: GeoJSON.Geometry;
|
|
22
|
+
centroid: [lat: number, lng: number];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Base layer types supported by the SDK
|
|
27
|
+
*/
|
|
28
|
+
type LayerType = 'raster-tile' | 'wms' | 'wmts' | 'vector-tile' | 'geojson';
|
|
29
|
+
/**
|
|
30
|
+
* Predefined layer preset identifiers
|
|
31
|
+
*/
|
|
32
|
+
type LayerPresetId = 'osm-standard' | 'osm-humanitarian' | 'osm-topo' | 'swisstopo-color' | 'swisstopo-grey' | 'swisstopo-satellite' | 'swisstopo-cadastral' | 'swisstopo-streets' | 'swisstopo-addresses' | 'swisstopo-vector-light' | 'swisstopo-vector-dark' | 'swisstopo-labels' | 'custom';
|
|
33
|
+
/**
|
|
34
|
+
* Layer category for grouping in UI
|
|
35
|
+
*/
|
|
36
|
+
type LayerCategory = 'base' | 'overlay' | 'label';
|
|
37
|
+
/**
|
|
38
|
+
* Base configuration for all layers
|
|
39
|
+
*/
|
|
40
|
+
interface BaseLayerConfig {
|
|
41
|
+
/** Unique identifier */
|
|
42
|
+
id: string;
|
|
43
|
+
/** Display name (can be i18n key) */
|
|
44
|
+
name: string;
|
|
45
|
+
/** Layer type */
|
|
46
|
+
type: LayerType;
|
|
47
|
+
/** Layer category */
|
|
48
|
+
category: LayerCategory;
|
|
49
|
+
/** Whether layer is visible */
|
|
50
|
+
visible?: boolean;
|
|
51
|
+
/** Layer opacity (0-1) */
|
|
52
|
+
opacity?: number;
|
|
53
|
+
/** Minimum zoom level */
|
|
54
|
+
minZoom?: number;
|
|
55
|
+
/** Maximum zoom level */
|
|
56
|
+
maxZoom?: number;
|
|
57
|
+
/** Maximum native zoom (for overzooming) */
|
|
58
|
+
maxNativeZoom?: number;
|
|
59
|
+
/** Attribution HTML */
|
|
60
|
+
attribution?: string;
|
|
61
|
+
/** Z-index order (higher = on top) */
|
|
62
|
+
zIndex?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Raster tile layer configuration
|
|
66
|
+
*/
|
|
67
|
+
interface RasterTileLayerConfig extends BaseLayerConfig {
|
|
68
|
+
type: 'raster-tile';
|
|
69
|
+
/** URL template with {x}, {y}, {z} placeholders */
|
|
70
|
+
url: string;
|
|
71
|
+
/** Subdomains for load balancing */
|
|
72
|
+
subdomains?: string | string[];
|
|
73
|
+
/** Tile size in pixels */
|
|
74
|
+
tileSize?: number;
|
|
75
|
+
/** Enable retina tiles (@2x) */
|
|
76
|
+
retina?: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* WMS layer configuration
|
|
80
|
+
*/
|
|
81
|
+
interface WMSLayerConfig extends BaseLayerConfig {
|
|
82
|
+
type: 'wms';
|
|
83
|
+
/** WMS service base URL */
|
|
84
|
+
url: string;
|
|
85
|
+
/** WMS layer names */
|
|
86
|
+
layers: string;
|
|
87
|
+
/** Image format */
|
|
88
|
+
format?: 'image/png' | 'image/jpeg' | 'image/gif';
|
|
89
|
+
/** Transparent background */
|
|
90
|
+
transparent?: boolean;
|
|
91
|
+
/** WMS version */
|
|
92
|
+
version?: '1.1.1' | '1.3.0';
|
|
93
|
+
/** Additional WMS parameters */
|
|
94
|
+
params?: Record<string, string>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Vector tile layer configuration (MapLibre GL)
|
|
98
|
+
*/
|
|
99
|
+
interface VectorTileLayerConfig extends BaseLayerConfig {
|
|
100
|
+
type: 'vector-tile';
|
|
101
|
+
/** MapLibre GL style specification */
|
|
102
|
+
style: maplibregl.StyleSpecification;
|
|
103
|
+
/** Interactive (allows click events) */
|
|
104
|
+
interactive?: boolean;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* GeoJSON overlay layer configuration
|
|
108
|
+
*/
|
|
109
|
+
interface GeoJSONLayerConfig extends BaseLayerConfig {
|
|
110
|
+
type: 'geojson';
|
|
111
|
+
/** GeoJSON data or URL to fetch */
|
|
112
|
+
data: GeoJSON.GeoJSON | string;
|
|
113
|
+
/** Style options */
|
|
114
|
+
style?: {
|
|
115
|
+
color?: string;
|
|
116
|
+
weight?: number;
|
|
117
|
+
opacity?: number;
|
|
118
|
+
fillColor?: string;
|
|
119
|
+
fillOpacity?: number;
|
|
120
|
+
};
|
|
121
|
+
/** Cluster points */
|
|
122
|
+
cluster?: boolean;
|
|
123
|
+
/** Click handler */
|
|
124
|
+
onClick?: (feature: GeoJSON.Feature) => void;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Union type of all layer configurations
|
|
128
|
+
*/
|
|
129
|
+
type LayerConfig = RasterTileLayerConfig | WMSLayerConfig | VectorTileLayerConfig | GeoJSONLayerConfig;
|
|
130
|
+
/**
|
|
131
|
+
* Helper options for adding a WMS layer
|
|
132
|
+
*/
|
|
133
|
+
interface AddWMSLayerOptions {
|
|
134
|
+
id: string;
|
|
135
|
+
name: string;
|
|
136
|
+
url: string;
|
|
137
|
+
layers: string;
|
|
138
|
+
visible?: boolean;
|
|
139
|
+
transparent?: boolean;
|
|
140
|
+
format?: 'image/png' | 'image/jpeg' | 'image/gif';
|
|
141
|
+
opacity?: number;
|
|
142
|
+
minZoom?: number;
|
|
143
|
+
maxZoom?: number;
|
|
144
|
+
params?: Record<string, string>;
|
|
145
|
+
attribution?: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Helper options for adding a tile layer
|
|
149
|
+
*/
|
|
150
|
+
interface AddTileLayerOptions {
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
url: string;
|
|
154
|
+
visible?: boolean;
|
|
155
|
+
maxZoom?: number;
|
|
156
|
+
minZoom?: number;
|
|
157
|
+
subdomains?: string | string[];
|
|
158
|
+
attribution?: string;
|
|
159
|
+
opacity?: number;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Helper options for adding a GeoJSON layer
|
|
163
|
+
*/
|
|
164
|
+
interface AddGeoJSONLayerOptions {
|
|
165
|
+
id: string;
|
|
166
|
+
name: string;
|
|
167
|
+
data: GeoJSON.GeoJSON | string;
|
|
168
|
+
visible?: boolean;
|
|
169
|
+
style?: {
|
|
170
|
+
color?: string;
|
|
171
|
+
weight?: number;
|
|
172
|
+
opacity?: number;
|
|
173
|
+
fillColor?: string;
|
|
174
|
+
fillOpacity?: number;
|
|
175
|
+
};
|
|
176
|
+
cluster?: boolean;
|
|
177
|
+
onClick?: (feature: GeoJSON.Feature) => void;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Map layer configuration for the SDK
|
|
181
|
+
*/
|
|
182
|
+
interface MapLayersConfig {
|
|
183
|
+
/** Base layer preset ID or custom config */
|
|
184
|
+
baseLayer: LayerPresetId | LayerConfig;
|
|
185
|
+
/** Overlay layers (on top of base) */
|
|
186
|
+
overlays?: Array<LayerPresetId | LayerConfig>;
|
|
187
|
+
/** Whether to show layer control UI */
|
|
188
|
+
showLayerControl?: boolean;
|
|
189
|
+
/** Available base layers for switcher (supports both presets and custom configs) */
|
|
190
|
+
availableBaseLayers?: Array<LayerPresetId | LayerConfig>;
|
|
191
|
+
/** Available overlay layers for toggling (supports both presets and custom configs) */
|
|
192
|
+
availableOverlays?: Array<LayerPresetId | LayerConfig>;
|
|
193
|
+
/** Additional custom layers that are always rendered (not in layer control) */
|
|
194
|
+
customLayers?: LayerConfig[];
|
|
195
|
+
/** Callback when a layer is added */
|
|
196
|
+
onLayerAdd?: (layer: LayerConfig) => void;
|
|
197
|
+
/** Callback when a layer is removed */
|
|
198
|
+
onLayerRemove?: (layer: LayerConfig) => void;
|
|
199
|
+
/** Callback when a layer visibility changes */
|
|
200
|
+
onLayerVisibilityChange?: (layerId: string, visible: boolean) => void;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface SEPMapConfig {
|
|
204
|
+
clientId: string;
|
|
205
|
+
token?: string;
|
|
206
|
+
apiUrl?: string;
|
|
207
|
+
/** Container property for convenience (not used in core config but in initialization) */
|
|
208
|
+
container?: string | HTMLElement;
|
|
209
|
+
/** Whether to use Shadow DOM (default: true) */
|
|
210
|
+
useShadowDom?: boolean;
|
|
211
|
+
language?: SupportedLocale;
|
|
212
|
+
/** Custom translations to override defaults (deeply merged) */
|
|
213
|
+
translations?: Record<string, any>;
|
|
214
|
+
features?: FeatureConfig;
|
|
215
|
+
map?: MapConfig;
|
|
216
|
+
ui?: UIConfig;
|
|
217
|
+
}
|
|
218
|
+
interface FeatureConfig {
|
|
219
|
+
addressSearch?: boolean;
|
|
220
|
+
perimeterSelection?: boolean;
|
|
221
|
+
mapClickSelect?: boolean;
|
|
222
|
+
multiSelect?: boolean | {
|
|
223
|
+
maxSelections?: number;
|
|
224
|
+
};
|
|
225
|
+
polygonDraw?: boolean;
|
|
226
|
+
search?: SearchConfig;
|
|
227
|
+
}
|
|
228
|
+
interface SearchConfig {
|
|
229
|
+
mode?: 'normal' | 'advanced' | 'perimeter' | 'all';
|
|
230
|
+
prefetchPerimeters?: boolean;
|
|
231
|
+
districts?: number[];
|
|
232
|
+
cantons?: string[];
|
|
233
|
+
renderResultChip?: (item: any, type: 'address' | 'parcel' | 'region' | 'egid' | 'egrid') => React.ReactNode;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Options for flyTo animations
|
|
237
|
+
*/
|
|
238
|
+
interface FlyToOptions {
|
|
239
|
+
/** Whether to animate the transition. Default: true */
|
|
240
|
+
animate?: boolean;
|
|
241
|
+
/** Animation duration in seconds. Default: 0.25 (Leaflet default) */
|
|
242
|
+
duration?: number;
|
|
243
|
+
/** Easing function. Default: 'easeLinearity' */
|
|
244
|
+
easeLinearity?: number;
|
|
245
|
+
/** If true, panning will always be animated. Default: false */
|
|
246
|
+
noMoveStart?: boolean;
|
|
247
|
+
}
|
|
248
|
+
interface MapConfig {
|
|
249
|
+
center?: [lat: number, lng: number];
|
|
250
|
+
zoom?: number;
|
|
251
|
+
minZoom?: number;
|
|
252
|
+
maxZoom?: number;
|
|
253
|
+
bounds?: [[number, number], [number, number]];
|
|
254
|
+
maxBounds?: [[number, number], [number, number]];
|
|
255
|
+
attribution?: string | {
|
|
256
|
+
text: string;
|
|
257
|
+
position?: 'topleft' | 'topright' | 'bottomleft' | 'bottomright';
|
|
258
|
+
prefix?: string | false;
|
|
259
|
+
};
|
|
260
|
+
/** Default options for flyTo animations */
|
|
261
|
+
flyTo?: FlyToOptions;
|
|
262
|
+
/**
|
|
263
|
+
* Layer configuration for base layers and overlays.
|
|
264
|
+
* Allows setting the default layer even when layer control is hidden.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* layers: {
|
|
269
|
+
* baseLayer: 'swisstopo-color', // Use color map instead of satellite
|
|
270
|
+
* overlays: ['swisstopo-cadastral']
|
|
271
|
+
* }
|
|
272
|
+
* ```
|
|
273
|
+
*
|
|
274
|
+
* Available base layers: 'swisstopo-satellite', 'swisstopo-color', 'swisstopo-grey',
|
|
275
|
+
* 'osm-standard', 'osm-humanitarian', 'osm-topo'
|
|
276
|
+
*
|
|
277
|
+
* Available overlays: 'swisstopo-cadastral', 'swisstopo-vector-light',
|
|
278
|
+
* 'swisstopo-streets', 'swisstopo-addresses'
|
|
279
|
+
*/
|
|
280
|
+
layers?: MapLayersConfig;
|
|
281
|
+
}
|
|
282
|
+
interface MarkerConfig {
|
|
283
|
+
/** URL to marker icon image (PNG, SVG, etc.) */
|
|
284
|
+
iconUrl?: string;
|
|
285
|
+
/** Icon size in pixels [width, height] */
|
|
286
|
+
iconSize?: [number, number];
|
|
287
|
+
/** Icon anchor point [x, y] - point of the icon which will correspond to marker's location */
|
|
288
|
+
iconAnchor?: [number, number];
|
|
289
|
+
/** Popup anchor point [x, y] - point from which the popup should open relative to the iconAnchor */
|
|
290
|
+
popupAnchor?: [number, number];
|
|
291
|
+
/** Shadow image URL */
|
|
292
|
+
shadowUrl?: string;
|
|
293
|
+
/** Shadow size in pixels [width, height] */
|
|
294
|
+
shadowSize?: [number, number];
|
|
295
|
+
/** Shadow anchor point [x, y] */
|
|
296
|
+
shadowAnchor?: [number, number];
|
|
297
|
+
/** CSS class name added to the icon element */
|
|
298
|
+
className?: string;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Search UI customization options
|
|
302
|
+
*/
|
|
303
|
+
interface SearchUIConfig {
|
|
304
|
+
/** Custom CSS class for the search container */
|
|
305
|
+
className?: string;
|
|
306
|
+
/** Custom inline styles for the search container */
|
|
307
|
+
style?: React.CSSProperties;
|
|
308
|
+
/** Custom placeholder text */
|
|
309
|
+
placeholder?: string;
|
|
310
|
+
/** Width of the search input (CSS value, e.g., '300px', '100%') */
|
|
311
|
+
width?: string;
|
|
312
|
+
}
|
|
313
|
+
interface UIConfig {
|
|
314
|
+
searchPlacement?: 'top-left' | 'top-right' | 'external';
|
|
315
|
+
layerControlPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
316
|
+
showLayerControl?: boolean;
|
|
317
|
+
theme?: 'light' | 'dark';
|
|
318
|
+
externalSearchContainer?: HTMLElement;
|
|
319
|
+
/** Custom marker icon configuration */
|
|
320
|
+
marker?: MarkerConfig;
|
|
321
|
+
/** Custom search UI configuration */
|
|
322
|
+
search?: SearchUIConfig;
|
|
323
|
+
/** Custom CSS to inject into the map container (works with Shadow DOM) */
|
|
324
|
+
customCss?: string;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
type SelectionItem = {
|
|
328
|
+
type: 'address';
|
|
329
|
+
data: Address;
|
|
330
|
+
} | {
|
|
331
|
+
type: 'perimeter';
|
|
332
|
+
data: Perimeter;
|
|
333
|
+
};
|
|
334
|
+
interface DecisionTreeResult {
|
|
335
|
+
clientId: string;
|
|
336
|
+
context: 'address' | 'perimeter' | 'multi';
|
|
337
|
+
selection: SelectionItem | SelectionItem[];
|
|
338
|
+
result: Record<string, any>;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Note: as of the RFC 7946 version of GeoJSON, Coordinate Reference Systems
|
|
342
|
+
// are no longer supported. (See https://tools.ietf.org/html/rfc7946#appendix-B)}
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* The value values for the "type" property of GeoJSON Objects.
|
|
348
|
+
* https://tools.ietf.org/html/rfc7946#section-1.4
|
|
349
|
+
*/
|
|
350
|
+
type GeoJsonTypes = GeoJSON$1["type"];
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Bounding box
|
|
354
|
+
* https://tools.ietf.org/html/rfc7946#section-5
|
|
355
|
+
*/
|
|
356
|
+
type BBox = [number, number, number, number] | [number, number, number, number, number, number];
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* A Position is an array of coordinates.
|
|
360
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.1
|
|
361
|
+
* Array should contain between two and three elements.
|
|
362
|
+
* The previous GeoJSON specification allowed more elements (e.g., which could be used to represent M values),
|
|
363
|
+
* but the current specification only allows X, Y, and (optionally) Z to be defined.
|
|
364
|
+
*
|
|
365
|
+
* Note: the type will not be narrowed down to `[number, number] | [number, number, number]` due to
|
|
366
|
+
* marginal benefits and the large impact of breaking change.
|
|
367
|
+
*
|
|
368
|
+
* See previous discussions on the type narrowing:
|
|
369
|
+
* - {@link https://github.com/DefinitelyTyped/DefinitelyTyped/pull/21590|Nov 2017}
|
|
370
|
+
* - {@link https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/67773|Dec 2023}
|
|
371
|
+
* - {@link https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/71441| Dec 2024}
|
|
372
|
+
*
|
|
373
|
+
* One can use a
|
|
374
|
+
* {@link https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates|user-defined type guard that returns a type predicate}
|
|
375
|
+
* to determine if a position is a 2D or 3D position.
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* import type { Position } from 'geojson';
|
|
379
|
+
*
|
|
380
|
+
* type StrictPosition = [x: number, y: number] | [x: number, y: number, z: number]
|
|
381
|
+
*
|
|
382
|
+
* function isStrictPosition(position: Position): position is StrictPosition {
|
|
383
|
+
* return position.length === 2 || position.length === 3
|
|
384
|
+
* };
|
|
385
|
+
*
|
|
386
|
+
* let position: Position = [-116.91, 45.54];
|
|
387
|
+
*
|
|
388
|
+
* let x: number;
|
|
389
|
+
* let y: number;
|
|
390
|
+
* let z: number | undefined;
|
|
391
|
+
*
|
|
392
|
+
* if (isStrictPosition(position)) {
|
|
393
|
+
* // `tsc` would throw an error if we tried to destructure a fourth parameter
|
|
394
|
+
* [x, y, z] = position;
|
|
395
|
+
* } else {
|
|
396
|
+
* throw new TypeError("Position is not a 2D or 3D point");
|
|
397
|
+
* }
|
|
398
|
+
*/
|
|
399
|
+
type Position = number[];
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* The base GeoJSON object.
|
|
403
|
+
* https://tools.ietf.org/html/rfc7946#section-3
|
|
404
|
+
* The GeoJSON specification also allows foreign members
|
|
405
|
+
* (https://tools.ietf.org/html/rfc7946#section-6.1)
|
|
406
|
+
* Developers should use "&" type in TypeScript or extend the interface
|
|
407
|
+
* to add these foreign members.
|
|
408
|
+
*/
|
|
409
|
+
interface GeoJsonObject {
|
|
410
|
+
// Don't include foreign members directly into this type def.
|
|
411
|
+
// in order to preserve type safety.
|
|
412
|
+
// [key: string]: any;
|
|
413
|
+
/**
|
|
414
|
+
* Specifies the type of GeoJSON object.
|
|
415
|
+
*/
|
|
416
|
+
type: GeoJsonTypes;
|
|
417
|
+
/**
|
|
418
|
+
* Bounding box of the coordinate range of the object's Geometries, Features, or Feature Collections.
|
|
419
|
+
* The value of the bbox member is an array of length 2*n where n is the number of dimensions
|
|
420
|
+
* represented in the contained geometries, with all axes of the most southwesterly point
|
|
421
|
+
* followed by all axes of the more northeasterly point.
|
|
422
|
+
* The axes order of a bbox follows the axes order of geometries.
|
|
423
|
+
* https://tools.ietf.org/html/rfc7946#section-5
|
|
424
|
+
*/
|
|
425
|
+
bbox?: BBox | undefined;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Union of GeoJSON objects.
|
|
430
|
+
*/
|
|
431
|
+
type GeoJSON$1<G extends Geometry | null = Geometry, P = GeoJsonProperties> =
|
|
432
|
+
| G
|
|
433
|
+
| Feature<G, P>
|
|
434
|
+
| FeatureCollection<G, P>;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Geometry object.
|
|
438
|
+
* https://tools.ietf.org/html/rfc7946#section-3
|
|
439
|
+
*/
|
|
440
|
+
type Geometry = Point$1 | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection;
|
|
441
|
+
type GeometryObject = Geometry;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Point geometry object.
|
|
445
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.2
|
|
446
|
+
*/
|
|
447
|
+
interface Point$1 extends GeoJsonObject {
|
|
448
|
+
type: "Point";
|
|
449
|
+
coordinates: Position;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* MultiPoint geometry object.
|
|
454
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.3
|
|
455
|
+
*/
|
|
456
|
+
interface MultiPoint extends GeoJsonObject {
|
|
457
|
+
type: "MultiPoint";
|
|
458
|
+
coordinates: Position[];
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* LineString geometry object.
|
|
463
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.4
|
|
464
|
+
*/
|
|
465
|
+
interface LineString extends GeoJsonObject {
|
|
466
|
+
type: "LineString";
|
|
467
|
+
coordinates: Position[];
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* MultiLineString geometry object.
|
|
472
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.5
|
|
473
|
+
*/
|
|
474
|
+
interface MultiLineString extends GeoJsonObject {
|
|
475
|
+
type: "MultiLineString";
|
|
476
|
+
coordinates: Position[][];
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Polygon geometry object.
|
|
481
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
482
|
+
*/
|
|
483
|
+
interface Polygon extends GeoJsonObject {
|
|
484
|
+
type: "Polygon";
|
|
485
|
+
coordinates: Position[][];
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* MultiPolygon geometry object.
|
|
490
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.7
|
|
491
|
+
*/
|
|
492
|
+
interface MultiPolygon extends GeoJsonObject {
|
|
493
|
+
type: "MultiPolygon";
|
|
494
|
+
coordinates: Position[][][];
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Geometry Collection
|
|
499
|
+
* https://tools.ietf.org/html/rfc7946#section-3.1.8
|
|
500
|
+
*/
|
|
501
|
+
interface GeometryCollection<G extends Geometry = Geometry> extends GeoJsonObject {
|
|
502
|
+
type: "GeometryCollection";
|
|
503
|
+
geometries: G[];
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
type GeoJsonProperties = { [name: string]: any } | null;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* A feature object which contains a geometry and associated properties.
|
|
510
|
+
* https://tools.ietf.org/html/rfc7946#section-3.2
|
|
511
|
+
*/
|
|
512
|
+
interface Feature<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
|
|
513
|
+
type: "Feature";
|
|
514
|
+
/**
|
|
515
|
+
* The feature's geometry
|
|
516
|
+
*/
|
|
517
|
+
geometry: G;
|
|
518
|
+
/**
|
|
519
|
+
* A value that uniquely identifies this feature in a
|
|
520
|
+
* https://tools.ietf.org/html/rfc7946#section-3.2.
|
|
521
|
+
*/
|
|
522
|
+
id?: string | number | undefined;
|
|
523
|
+
/**
|
|
524
|
+
* Properties associated with this feature.
|
|
525
|
+
*/
|
|
526
|
+
properties: P;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* A collection of feature objects.
|
|
531
|
+
* https://tools.ietf.org/html/rfc7946#section-3.3
|
|
532
|
+
*/
|
|
533
|
+
interface FeatureCollection<G extends Geometry | null = Geometry, P = GeoJsonProperties> extends GeoJsonObject {
|
|
534
|
+
type: "FeatureCollection";
|
|
535
|
+
features: Array<Feature<G, P>>;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
declare class Class {
|
|
539
|
+
static extend(props: any): { new(...args: any[]): any } & typeof Class;
|
|
540
|
+
static include(props: any): any & typeof Class;
|
|
541
|
+
static mergeOptions(props: any): any & typeof Class;
|
|
542
|
+
|
|
543
|
+
static addInitHook(initHookFn: () => void): any & typeof Class;
|
|
544
|
+
static addInitHook(methodName: string, ...args: any[]): any & typeof Class;
|
|
545
|
+
|
|
546
|
+
static callInitHooks(): void;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
interface CRS {
|
|
550
|
+
latLngToPoint(latlng: LatLngExpression, zoom: number): Point;
|
|
551
|
+
pointToLatLng(point: PointExpression, zoom: number): LatLng;
|
|
552
|
+
project(latlng: LatLng | LatLngLiteral): Point;
|
|
553
|
+
unproject(point: PointExpression): LatLng;
|
|
554
|
+
scale(zoom: number): number;
|
|
555
|
+
zoom(scale: number): number;
|
|
556
|
+
getProjectedBounds(zoom: number): Bounds;
|
|
557
|
+
distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number;
|
|
558
|
+
wrapLatLng(latlng: LatLng | LatLngLiteral): LatLng;
|
|
559
|
+
|
|
560
|
+
code?: string | undefined;
|
|
561
|
+
wrapLng?: [number, number] | undefined;
|
|
562
|
+
wrapLat?: [number, number] | undefined;
|
|
563
|
+
infinite: boolean;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
declare namespace CRS {
|
|
567
|
+
const EPSG3395: CRS;
|
|
568
|
+
const EPSG3857: CRS;
|
|
569
|
+
const EPSG4326: CRS;
|
|
570
|
+
const EPSG900913: CRS;
|
|
571
|
+
const Earth: CRS;
|
|
572
|
+
const Simple: CRS;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
declare class LatLng {
|
|
576
|
+
constructor(latitude: number, longitude: number, altitude?: number);
|
|
577
|
+
equals(otherLatLng: LatLngExpression, maxMargin?: number): boolean;
|
|
578
|
+
toString(): string;
|
|
579
|
+
distanceTo(otherLatLng: LatLngExpression): number;
|
|
580
|
+
wrap(): LatLng;
|
|
581
|
+
toBounds(sizeInMeters: number): LatLngBounds;
|
|
582
|
+
clone(): LatLng;
|
|
583
|
+
|
|
584
|
+
lat: number;
|
|
585
|
+
lng: number;
|
|
586
|
+
alt?: number | undefined;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
interface LatLngLiteral {
|
|
590
|
+
lat: number;
|
|
591
|
+
lng: number;
|
|
592
|
+
alt?: number;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
type LatLngTuple = [number, number, number?];
|
|
596
|
+
|
|
597
|
+
type LatLngExpression = LatLng | LatLngLiteral | LatLngTuple;
|
|
598
|
+
|
|
599
|
+
declare class LatLngBounds {
|
|
600
|
+
constructor(southWest: LatLngExpression, northEast: LatLngExpression);
|
|
601
|
+
constructor(latlngs: LatLngExpression[]);
|
|
602
|
+
extend(latlngOrBounds: LatLngExpression | LatLngBoundsExpression): this;
|
|
603
|
+
pad(bufferRatio: number): LatLngBounds; // Returns a new LatLngBounds
|
|
604
|
+
getCenter(): LatLng;
|
|
605
|
+
getSouthWest(): LatLng;
|
|
606
|
+
getNorthEast(): LatLng;
|
|
607
|
+
getNorthWest(): LatLng;
|
|
608
|
+
getSouthEast(): LatLng;
|
|
609
|
+
getWest(): number;
|
|
610
|
+
getSouth(): number;
|
|
611
|
+
getEast(): number;
|
|
612
|
+
getNorth(): number;
|
|
613
|
+
contains(otherBoundsOrLatLng: LatLngBoundsExpression | LatLngExpression): boolean;
|
|
614
|
+
intersects(otherBounds: LatLngBoundsExpression): boolean;
|
|
615
|
+
overlaps(otherBounds: LatLngBoundsExpression): boolean;
|
|
616
|
+
toBBoxString(): string;
|
|
617
|
+
equals(otherBounds: LatLngBoundsExpression, maxMargin?: number): boolean;
|
|
618
|
+
isValid(): boolean;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
type LatLngBoundsLiteral = LatLngTuple[]; // Must be [LatLngTuple, LatLngTuple], cant't change because Map.setMaxBounds
|
|
622
|
+
|
|
623
|
+
type LatLngBoundsExpression = LatLngBounds | LatLngBoundsLiteral;
|
|
624
|
+
|
|
625
|
+
type PointTuple = [number, number];
|
|
626
|
+
|
|
627
|
+
declare class Point {
|
|
628
|
+
constructor(x: number, y: number, round?: boolean);
|
|
629
|
+
clone(): Point;
|
|
630
|
+
add(otherPoint: PointExpression): Point; // non-destructive, returns a new point
|
|
631
|
+
subtract(otherPoint: PointExpression): Point;
|
|
632
|
+
divideBy(num: number): Point;
|
|
633
|
+
multiplyBy(num: number): Point;
|
|
634
|
+
scaleBy(scale: PointExpression): Point;
|
|
635
|
+
unscaleBy(scale: PointExpression): Point;
|
|
636
|
+
round(): Point;
|
|
637
|
+
floor(): Point;
|
|
638
|
+
ceil(): Point;
|
|
639
|
+
trunc(): Point;
|
|
640
|
+
distanceTo(otherPoint: PointExpression): number;
|
|
641
|
+
equals(otherPoint: PointExpression): boolean;
|
|
642
|
+
contains(otherPoint: PointExpression): boolean;
|
|
643
|
+
toString(): string;
|
|
644
|
+
x: number;
|
|
645
|
+
y: number;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
interface Coords extends Point {
|
|
649
|
+
z: number;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
type PointExpression = Point | PointTuple;
|
|
653
|
+
|
|
654
|
+
type BoundsLiteral = [PointTuple, PointTuple];
|
|
655
|
+
|
|
656
|
+
declare class Bounds {
|
|
657
|
+
constructor(topLeft: PointExpression, bottomRight: PointExpression);
|
|
658
|
+
constructor(points?: Point[] | BoundsLiteral);
|
|
659
|
+
|
|
660
|
+
// tslint:disable:unified-signatures
|
|
661
|
+
extend(point: PointExpression): this;
|
|
662
|
+
extend(otherBounds: BoundsExpression): this;
|
|
663
|
+
// tslint:enable:unified-signatures
|
|
664
|
+
|
|
665
|
+
getCenter(round?: boolean): Point;
|
|
666
|
+
getBottomLeft(): Point;
|
|
667
|
+
getBottomRight(): Point;
|
|
668
|
+
getTopLeft(): Point;
|
|
669
|
+
getTopRight(): Point;
|
|
670
|
+
getSize(): Point;
|
|
671
|
+
contains(pointOrBounds: BoundsExpression | PointExpression): boolean;
|
|
672
|
+
intersects(otherBounds: BoundsExpression): boolean;
|
|
673
|
+
overlaps(otherBounds: BoundsExpression): boolean;
|
|
674
|
+
isValid(): boolean;
|
|
675
|
+
pad(bufferRatio: number): Bounds; // Returns a new Bounds
|
|
676
|
+
equals(otherBounds: BoundsExpression): boolean;
|
|
677
|
+
|
|
678
|
+
min?: Point | undefined;
|
|
679
|
+
max?: Point | undefined;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
type BoundsExpression = Bounds | BoundsLiteral;
|
|
683
|
+
|
|
684
|
+
// Event handler types
|
|
685
|
+
|
|
686
|
+
type LeafletEventHandlerFn = (event: LeafletEvent) => void;
|
|
687
|
+
|
|
688
|
+
type LayersControlEventHandlerFn = (event: LayersControlEvent) => void;
|
|
689
|
+
|
|
690
|
+
type LayerEventHandlerFn = (event: LayerEvent) => void;
|
|
691
|
+
|
|
692
|
+
type ResizeEventHandlerFn = (event: ResizeEvent) => void;
|
|
693
|
+
|
|
694
|
+
type PopupEventHandlerFn = (event: PopupEvent) => void;
|
|
695
|
+
|
|
696
|
+
type TooltipEventHandlerFn = (event: TooltipEvent) => void;
|
|
697
|
+
|
|
698
|
+
type ErrorEventHandlerFn = (event: ErrorEvent) => void;
|
|
699
|
+
|
|
700
|
+
type LocationEventHandlerFn = (event: LocationEvent) => void;
|
|
701
|
+
|
|
702
|
+
type LeafletMouseEventHandlerFn = (event: LeafletMouseEvent) => void;
|
|
703
|
+
|
|
704
|
+
type LeafletKeyboardEventHandlerFn = (event: LeafletKeyboardEvent) => void;
|
|
705
|
+
|
|
706
|
+
type ZoomAnimEventHandlerFn = (event: ZoomAnimEvent) => void;
|
|
707
|
+
|
|
708
|
+
type DragEndEventHandlerFn = (event: DragEndEvent) => void;
|
|
709
|
+
|
|
710
|
+
type TileEventHandlerFn = (event: TileEvent) => void;
|
|
711
|
+
|
|
712
|
+
type TileErrorEventHandlerFn = (event: TileErrorEvent) => void;
|
|
713
|
+
|
|
714
|
+
interface LeafletEventHandlerFnMap {
|
|
715
|
+
baselayerchange?: LayersControlEventHandlerFn | undefined;
|
|
716
|
+
overlayadd?: LayersControlEventHandlerFn | undefined;
|
|
717
|
+
overlayremove?: LayersControlEventHandlerFn | undefined;
|
|
718
|
+
|
|
719
|
+
layeradd?: LayerEventHandlerFn | undefined;
|
|
720
|
+
layerremove?: LayerEventHandlerFn | undefined;
|
|
721
|
+
|
|
722
|
+
zoomlevelschange?: LeafletEventHandlerFn | undefined;
|
|
723
|
+
unload?: LeafletEventHandlerFn | undefined;
|
|
724
|
+
viewreset?: LeafletEventHandlerFn | undefined;
|
|
725
|
+
load?: LeafletEventHandlerFn | undefined;
|
|
726
|
+
zoomstart?: LeafletEventHandlerFn | undefined;
|
|
727
|
+
movestart?: LeafletEventHandlerFn | undefined;
|
|
728
|
+
zoom?: LeafletEventHandlerFn | undefined;
|
|
729
|
+
move?: LeafletEventHandlerFn | undefined;
|
|
730
|
+
zoomend?: LeafletEventHandlerFn | undefined;
|
|
731
|
+
moveend?: LeafletEventHandlerFn | undefined;
|
|
732
|
+
autopanstart?: LeafletEventHandlerFn | undefined;
|
|
733
|
+
dragstart?: LeafletEventHandlerFn | undefined;
|
|
734
|
+
drag?: LeafletEventHandlerFn | undefined;
|
|
735
|
+
add?: LeafletEventHandlerFn | undefined;
|
|
736
|
+
remove?: LeafletEventHandlerFn | undefined;
|
|
737
|
+
loading?: LeafletEventHandlerFn | undefined;
|
|
738
|
+
error?: LeafletEventHandlerFn | undefined;
|
|
739
|
+
update?: LeafletEventHandlerFn | undefined;
|
|
740
|
+
down?: LeafletEventHandlerFn | undefined;
|
|
741
|
+
predrag?: LeafletEventHandlerFn | undefined;
|
|
742
|
+
|
|
743
|
+
resize?: ResizeEventHandlerFn | undefined;
|
|
744
|
+
|
|
745
|
+
popupopen?: PopupEventHandlerFn | undefined;
|
|
746
|
+
popupclose?: PopupEventHandlerFn | undefined;
|
|
747
|
+
|
|
748
|
+
tooltipopen?: TooltipEventHandlerFn | undefined;
|
|
749
|
+
tooltipclose?: TooltipEventHandlerFn | undefined;
|
|
750
|
+
|
|
751
|
+
locationerror?: ErrorEventHandlerFn | undefined;
|
|
752
|
+
|
|
753
|
+
locationfound?: LocationEventHandlerFn | undefined;
|
|
754
|
+
|
|
755
|
+
click?: LeafletMouseEventHandlerFn | undefined;
|
|
756
|
+
dblclick?: LeafletMouseEventHandlerFn | undefined;
|
|
757
|
+
mousedown?: LeafletMouseEventHandlerFn | undefined;
|
|
758
|
+
mouseup?: LeafletMouseEventHandlerFn | undefined;
|
|
759
|
+
mouseover?: LeafletMouseEventHandlerFn | undefined;
|
|
760
|
+
mouseout?: LeafletMouseEventHandlerFn | undefined;
|
|
761
|
+
mousemove?: LeafletMouseEventHandlerFn | undefined;
|
|
762
|
+
contextmenu?: LeafletMouseEventHandlerFn | undefined;
|
|
763
|
+
preclick?: LeafletMouseEventHandlerFn | undefined;
|
|
764
|
+
|
|
765
|
+
keypress?: LeafletKeyboardEventHandlerFn | undefined;
|
|
766
|
+
keydown?: LeafletKeyboardEventHandlerFn | undefined;
|
|
767
|
+
keyup?: LeafletKeyboardEventHandlerFn | undefined;
|
|
768
|
+
|
|
769
|
+
zoomanim?: ZoomAnimEventHandlerFn | undefined;
|
|
770
|
+
|
|
771
|
+
dragend?: DragEndEventHandlerFn | undefined;
|
|
772
|
+
|
|
773
|
+
tileunload?: TileEventHandlerFn | undefined;
|
|
774
|
+
tileloadstart?: TileEventHandlerFn | undefined;
|
|
775
|
+
tileload?: TileEventHandlerFn | undefined;
|
|
776
|
+
tileabort?: TileEventHandlerFn | undefined;
|
|
777
|
+
|
|
778
|
+
tileerror?: TileErrorEventHandlerFn | undefined;
|
|
779
|
+
|
|
780
|
+
// [name: string]: any;
|
|
781
|
+
// You are able add additional properties, but it makes this interface uncheckable.
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Base class of Leaflet classes supporting events
|
|
786
|
+
*/
|
|
787
|
+
declare abstract class Evented extends Class {
|
|
788
|
+
/**
|
|
789
|
+
* Adds a listener function (fn) to a particular event type of the object.
|
|
790
|
+
* You can optionally specify the context of the listener (object the this
|
|
791
|
+
* keyword will point to). You can also pass several space-separated types
|
|
792
|
+
* (e.g. 'click dblclick').
|
|
793
|
+
*/
|
|
794
|
+
// tslint:disable:unified-signatures
|
|
795
|
+
on(type: "baselayerchange" | "overlayadd" | "overlayremove", fn: LayersControlEventHandlerFn, context?: any): this;
|
|
796
|
+
on(type: "layeradd" | "layerremove", fn: LayerEventHandlerFn, context?: any): this;
|
|
797
|
+
on(
|
|
798
|
+
type:
|
|
799
|
+
| "zoomlevelschange"
|
|
800
|
+
| "unload"
|
|
801
|
+
| "viewreset"
|
|
802
|
+
| "load"
|
|
803
|
+
| "zoomstart"
|
|
804
|
+
| "movestart"
|
|
805
|
+
| "zoom"
|
|
806
|
+
| "move"
|
|
807
|
+
| "zoomend"
|
|
808
|
+
| "moveend"
|
|
809
|
+
| "autopanstart"
|
|
810
|
+
| "dragstart"
|
|
811
|
+
| "drag"
|
|
812
|
+
| "add"
|
|
813
|
+
| "remove"
|
|
814
|
+
| "loading"
|
|
815
|
+
| "error"
|
|
816
|
+
| "update"
|
|
817
|
+
| "down"
|
|
818
|
+
| "predrag",
|
|
819
|
+
fn: LeafletEventHandlerFn,
|
|
820
|
+
context?: any,
|
|
821
|
+
): this;
|
|
822
|
+
on(type: "resize", fn: ResizeEventHandlerFn, context?: any): this;
|
|
823
|
+
on(type: "popupopen" | "popupclose", fn: PopupEventHandlerFn, context?: any): this;
|
|
824
|
+
on(type: "tooltipopen" | "tooltipclose", fn: TooltipEventHandlerFn, context?: any): this;
|
|
825
|
+
on(type: "locationerror", fn: ErrorEventHandlerFn, context?: any): this;
|
|
826
|
+
on(type: "locationfound", fn: LocationEventHandlerFn, context?: any): this;
|
|
827
|
+
on(
|
|
828
|
+
type:
|
|
829
|
+
| "click"
|
|
830
|
+
| "dblclick"
|
|
831
|
+
| "mousedown"
|
|
832
|
+
| "mouseup"
|
|
833
|
+
| "mouseover"
|
|
834
|
+
| "mouseout"
|
|
835
|
+
| "mousemove"
|
|
836
|
+
| "contextmenu"
|
|
837
|
+
| "preclick",
|
|
838
|
+
fn: LeafletMouseEventHandlerFn,
|
|
839
|
+
context?: any,
|
|
840
|
+
): this;
|
|
841
|
+
on(type: "keypress" | "keydown" | "keyup", fn: LeafletKeyboardEventHandlerFn, context?: any): this;
|
|
842
|
+
on(type: "zoomanim", fn: ZoomAnimEventHandlerFn, context?: any): this;
|
|
843
|
+
on(type: "dragend", fn: DragEndEventHandlerFn, context?: any): this;
|
|
844
|
+
on(type: "tileunload" | "tileloadstart" | "tileload" | "tileabort", fn: TileEventHandlerFn, context?: any): this;
|
|
845
|
+
on(type: "tileerror", fn: TileErrorEventHandlerFn, context?: any): this;
|
|
846
|
+
on(type: string, fn: LeafletEventHandlerFn, context?: any): this;
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
|
|
850
|
+
*/
|
|
851
|
+
on(eventMap: LeafletEventHandlerFnMap): this;
|
|
852
|
+
// tslint:enable:unified-signatures
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Removes a previously added listener function. If no function is specified,
|
|
856
|
+
* it will remove all the listeners of that particular event from the object.
|
|
857
|
+
* Note that if you passed a custom context to on, you must pass the same context
|
|
858
|
+
* to off in order to remove the listener.
|
|
859
|
+
*/
|
|
860
|
+
// tslint:disable:unified-signatures
|
|
861
|
+
off(
|
|
862
|
+
type: "baselayerchange" | "overlayadd" | "overlayremove",
|
|
863
|
+
fn?: LayersControlEventHandlerFn,
|
|
864
|
+
context?: any,
|
|
865
|
+
): this;
|
|
866
|
+
off(type: "layeradd" | "layerremove", fn?: LayerEventHandlerFn, context?: any): this;
|
|
867
|
+
off(
|
|
868
|
+
type:
|
|
869
|
+
| "zoomlevelschange"
|
|
870
|
+
| "unload"
|
|
871
|
+
| "viewreset"
|
|
872
|
+
| "load"
|
|
873
|
+
| "zoomstart"
|
|
874
|
+
| "movestart"
|
|
875
|
+
| "zoom"
|
|
876
|
+
| "move"
|
|
877
|
+
| "zoomend"
|
|
878
|
+
| "moveend"
|
|
879
|
+
| "autopanstart"
|
|
880
|
+
| "dragstart"
|
|
881
|
+
| "drag"
|
|
882
|
+
| "add"
|
|
883
|
+
| "remove"
|
|
884
|
+
| "loading"
|
|
885
|
+
| "error"
|
|
886
|
+
| "update"
|
|
887
|
+
| "down"
|
|
888
|
+
| "predrag",
|
|
889
|
+
fn?: LeafletEventHandlerFn,
|
|
890
|
+
context?: any,
|
|
891
|
+
): this;
|
|
892
|
+
off(type: "resize", fn?: ResizeEventHandlerFn, context?: any): this;
|
|
893
|
+
off(type: "popupopen" | "popupclose", fn?: PopupEventHandlerFn, context?: any): this;
|
|
894
|
+
off(type: "tooltipopen" | "tooltipclose", fn?: TooltipEventHandlerFn, context?: any): this;
|
|
895
|
+
off(type: "locationerror", fn?: ErrorEventHandlerFn, context?: any): this;
|
|
896
|
+
off(type: "locationfound", fn?: LocationEventHandlerFn, context?: any): this;
|
|
897
|
+
off(
|
|
898
|
+
type:
|
|
899
|
+
| "click"
|
|
900
|
+
| "dblclick"
|
|
901
|
+
| "mousedown"
|
|
902
|
+
| "mouseup"
|
|
903
|
+
| "mouseover"
|
|
904
|
+
| "mouseout"
|
|
905
|
+
| "mousemove"
|
|
906
|
+
| "contextmenu"
|
|
907
|
+
| "preclick",
|
|
908
|
+
fn?: LeafletMouseEventHandlerFn,
|
|
909
|
+
context?: any,
|
|
910
|
+
): this;
|
|
911
|
+
off(type: "keypress" | "keydown" | "keyup", fn?: LeafletKeyboardEventHandlerFn, context?: any): this;
|
|
912
|
+
off(type: "zoomanim", fn?: ZoomAnimEventHandlerFn, context?: any): this;
|
|
913
|
+
off(type: "dragend", fn?: DragEndEventHandlerFn, context?: any): this;
|
|
914
|
+
off(type: "tileunload" | "tileloadstart" | "tileload" | "tileabort", fn?: TileEventHandlerFn, context?: any): this;
|
|
915
|
+
off(type: "tileerror", fn?: TileErrorEventHandlerFn, context?: any): this;
|
|
916
|
+
off(type: string, fn?: LeafletEventHandlerFn, context?: any): this;
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Removes a set of type/listener pairs.
|
|
920
|
+
*/
|
|
921
|
+
// With an eventMap there are no additional arguments allowed
|
|
922
|
+
off(eventMap: LeafletEventHandlerFnMap): this;
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Removes all listeners to all events on the object.
|
|
926
|
+
*/
|
|
927
|
+
off(): this;
|
|
928
|
+
// tslint:enable:unified-signatures
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* Fires an event of the specified type. You can optionally provide a data
|
|
932
|
+
* object — the first argument of the listener function will contain its properties.
|
|
933
|
+
* The event might can optionally be propagated to event parents.
|
|
934
|
+
*/
|
|
935
|
+
fire(type: string, data?: any, propagate?: boolean): this;
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* Returns true if a particular event type has any listeners attached to it.
|
|
939
|
+
*/
|
|
940
|
+
// tslint:disable:unified-signatures
|
|
941
|
+
listens(
|
|
942
|
+
type:
|
|
943
|
+
| "baselayerchange"
|
|
944
|
+
| "overlayadd"
|
|
945
|
+
| "overlayremove"
|
|
946
|
+
| "layeradd"
|
|
947
|
+
| "layerremove"
|
|
948
|
+
| "zoomlevelschange"
|
|
949
|
+
| "unload"
|
|
950
|
+
| "viewreset"
|
|
951
|
+
| "load"
|
|
952
|
+
| "zoomstart"
|
|
953
|
+
| "movestart"
|
|
954
|
+
| "zoom"
|
|
955
|
+
| "move"
|
|
956
|
+
| "zoomend"
|
|
957
|
+
| "moveend"
|
|
958
|
+
| "autopanstart"
|
|
959
|
+
| "dragstart"
|
|
960
|
+
| "drag"
|
|
961
|
+
| "add"
|
|
962
|
+
| "remove"
|
|
963
|
+
| "loading"
|
|
964
|
+
| "error"
|
|
965
|
+
| "update"
|
|
966
|
+
| "down"
|
|
967
|
+
| "predrag"
|
|
968
|
+
| "resize"
|
|
969
|
+
| "popupopen"
|
|
970
|
+
| "tooltipopen"
|
|
971
|
+
| "tooltipclose"
|
|
972
|
+
| "locationerror"
|
|
973
|
+
| "locationfound"
|
|
974
|
+
| "click"
|
|
975
|
+
| "dblclick"
|
|
976
|
+
| "mousedown"
|
|
977
|
+
| "mouseup"
|
|
978
|
+
| "mouseover"
|
|
979
|
+
| "mouseout"
|
|
980
|
+
| "mousemove"
|
|
981
|
+
| "contextmenu"
|
|
982
|
+
| "preclick"
|
|
983
|
+
| "keypress"
|
|
984
|
+
| "keydown"
|
|
985
|
+
| "keyup"
|
|
986
|
+
| "zoomanim"
|
|
987
|
+
| "dragend"
|
|
988
|
+
| "tileunload"
|
|
989
|
+
| "tileloadstart"
|
|
990
|
+
| "tileload"
|
|
991
|
+
| "tileabort"
|
|
992
|
+
| "tileerror",
|
|
993
|
+
propagate?: boolean,
|
|
994
|
+
): boolean;
|
|
995
|
+
|
|
996
|
+
listens(
|
|
997
|
+
type: "baselayerchange" | "overlayadd" | "overlayremove",
|
|
998
|
+
fn: LayersControlEventHandlerFn,
|
|
999
|
+
context?: any,
|
|
1000
|
+
propagate?: boolean,
|
|
1001
|
+
): boolean;
|
|
1002
|
+
listens(type: "layeradd" | "layerremove", fn: LayerEventHandlerFn, context?: any, propagate?: boolean): boolean;
|
|
1003
|
+
listens(
|
|
1004
|
+
type:
|
|
1005
|
+
| "zoomlevelschange"
|
|
1006
|
+
| "unload"
|
|
1007
|
+
| "viewreset"
|
|
1008
|
+
| "load"
|
|
1009
|
+
| "zoomstart"
|
|
1010
|
+
| "movestart"
|
|
1011
|
+
| "zoom"
|
|
1012
|
+
| "move"
|
|
1013
|
+
| "zoomend"
|
|
1014
|
+
| "moveend"
|
|
1015
|
+
| "autopanstart"
|
|
1016
|
+
| "dragstart"
|
|
1017
|
+
| "drag"
|
|
1018
|
+
| "add"
|
|
1019
|
+
| "remove"
|
|
1020
|
+
| "loading"
|
|
1021
|
+
| "error"
|
|
1022
|
+
| "update"
|
|
1023
|
+
| "down"
|
|
1024
|
+
| "predrag",
|
|
1025
|
+
fn: LeafletEventHandlerFn,
|
|
1026
|
+
context?: any,
|
|
1027
|
+
propagate?: boolean,
|
|
1028
|
+
): boolean;
|
|
1029
|
+
listens(type: "resize", fn: ResizeEventHandlerFn, context?: any, propagate?: boolean): boolean;
|
|
1030
|
+
listens(type: "popupopen" | "popupclose", fn: PopupEventHandlerFn, context?: any, propagate?: boolean): boolean;
|
|
1031
|
+
listens(
|
|
1032
|
+
type: "tooltipopen" | "tooltipclose",
|
|
1033
|
+
fn: TooltipEventHandlerFn,
|
|
1034
|
+
context?: any,
|
|
1035
|
+
propagate?: boolean,
|
|
1036
|
+
): boolean;
|
|
1037
|
+
listens(type: "locationerror", fn: ErrorEventHandlerFn, context?: any, propagate?: boolean): boolean;
|
|
1038
|
+
listens(type: "locationfound", fn: LocationEventHandlerFn, context?: any, propagate?: boolean): boolean;
|
|
1039
|
+
listens(
|
|
1040
|
+
type:
|
|
1041
|
+
| "click"
|
|
1042
|
+
| "dblclick"
|
|
1043
|
+
| "mousedown"
|
|
1044
|
+
| "mouseup"
|
|
1045
|
+
| "mouseover"
|
|
1046
|
+
| "mouseout"
|
|
1047
|
+
| "mousemove"
|
|
1048
|
+
| "contextmenu"
|
|
1049
|
+
| "preclick",
|
|
1050
|
+
fn: LeafletMouseEventHandlerFn,
|
|
1051
|
+
context?: any,
|
|
1052
|
+
propagate?: boolean,
|
|
1053
|
+
): boolean;
|
|
1054
|
+
listens(
|
|
1055
|
+
type: "keypress" | "keydown" | "keyup",
|
|
1056
|
+
fn: LeafletKeyboardEventHandlerFn,
|
|
1057
|
+
context?: any,
|
|
1058
|
+
propagate?: boolean,
|
|
1059
|
+
): boolean;
|
|
1060
|
+
listens(type: "zoomanim", fn: ZoomAnimEventHandlerFn, context?: any, propagate?: boolean): boolean;
|
|
1061
|
+
listens(type: "dragend", fn: DragEndEventHandlerFn, context?: any, propagate?: boolean): boolean;
|
|
1062
|
+
listens(
|
|
1063
|
+
type: "tileunload" | "tileloadstart" | "tileload" | "tileabort",
|
|
1064
|
+
fn: TileEventHandlerFn,
|
|
1065
|
+
context?: any,
|
|
1066
|
+
propagate?: boolean,
|
|
1067
|
+
): boolean;
|
|
1068
|
+
listens(type: "tileerror", fn: TileEventHandlerFn, context?: any, propagate?: boolean): boolean;
|
|
1069
|
+
listens(type: string, fn: LeafletEventHandlerFn, context?: any, propagate?: boolean): boolean;
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* Behaves as on(...), except the listener will only get fired once and then removed.
|
|
1073
|
+
*/
|
|
1074
|
+
// tslint:disable:unified-signatures
|
|
1075
|
+
once(
|
|
1076
|
+
type: "baselayerchange" | "overlayadd" | "overlayremove",
|
|
1077
|
+
fn: LayersControlEventHandlerFn,
|
|
1078
|
+
context?: any,
|
|
1079
|
+
): this;
|
|
1080
|
+
once(type: "layeradd" | "layerremove", fn: LayerEventHandlerFn, context?: any): this;
|
|
1081
|
+
once(
|
|
1082
|
+
type:
|
|
1083
|
+
| "zoomlevelschange"
|
|
1084
|
+
| "unload"
|
|
1085
|
+
| "viewreset"
|
|
1086
|
+
| "load"
|
|
1087
|
+
| "zoomstart"
|
|
1088
|
+
| "movestart"
|
|
1089
|
+
| "zoom"
|
|
1090
|
+
| "move"
|
|
1091
|
+
| "zoomend"
|
|
1092
|
+
| "moveend"
|
|
1093
|
+
| "autopanstart"
|
|
1094
|
+
| "dragstart"
|
|
1095
|
+
| "drag"
|
|
1096
|
+
| "add"
|
|
1097
|
+
| "remove"
|
|
1098
|
+
| "loading"
|
|
1099
|
+
| "error"
|
|
1100
|
+
| "update"
|
|
1101
|
+
| "down"
|
|
1102
|
+
| "predrag",
|
|
1103
|
+
fn: LeafletEventHandlerFn,
|
|
1104
|
+
context?: any,
|
|
1105
|
+
): this;
|
|
1106
|
+
once(type: "resize", fn: ResizeEventHandlerFn, context?: any): this;
|
|
1107
|
+
once(type: "popupopen" | "popupclose", fn: PopupEventHandlerFn, context?: any): this;
|
|
1108
|
+
once(type: "tooltipopen" | "tooltipclose", fn: TooltipEventHandlerFn, context?: any): this;
|
|
1109
|
+
once(type: "locationerror", fn: ErrorEventHandlerFn, context?: any): this;
|
|
1110
|
+
once(type: "locationfound", fn: LocationEventHandlerFn, context?: any): this;
|
|
1111
|
+
once(
|
|
1112
|
+
type:
|
|
1113
|
+
| "click"
|
|
1114
|
+
| "dblclick"
|
|
1115
|
+
| "mousedown"
|
|
1116
|
+
| "mouseup"
|
|
1117
|
+
| "mouseover"
|
|
1118
|
+
| "mouseout"
|
|
1119
|
+
| "mousemove"
|
|
1120
|
+
| "contextmenu"
|
|
1121
|
+
| "preclick",
|
|
1122
|
+
fn: LeafletMouseEventHandlerFn,
|
|
1123
|
+
context?: any,
|
|
1124
|
+
): this;
|
|
1125
|
+
once(type: "keypress" | "keydown" | "keyup", fn: LeafletKeyboardEventHandlerFn, context?: any): this;
|
|
1126
|
+
once(type: "zoomanim", fn: ZoomAnimEventHandlerFn, context?: any): this;
|
|
1127
|
+
once(type: "dragend", fn: DragEndEventHandlerFn, context?: any): this;
|
|
1128
|
+
once(type: "tileunload" | "tileloadstart" | "tileload" | "tileabort", fn: TileEventHandlerFn, context?: any): this;
|
|
1129
|
+
once(type: "tileerror", fn: TileEventHandlerFn, context?: any): this;
|
|
1130
|
+
once(type: string, fn: LeafletEventHandlerFn, context?: any): this;
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* Behaves as on(...), except the listener will only get fired once and then removed.
|
|
1134
|
+
*/
|
|
1135
|
+
once(eventMap: LeafletEventHandlerFnMap): this;
|
|
1136
|
+
// tslint:enable:unified-signatures
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* Adds an event parent - an Evented that will receive propagated events
|
|
1140
|
+
*/
|
|
1141
|
+
addEventParent(obj: Evented): this;
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* Removes an event parent, so it will stop receiving propagated events
|
|
1145
|
+
*/
|
|
1146
|
+
removeEventParent(obj: Evented): this;
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Alias for on(...)
|
|
1150
|
+
*
|
|
1151
|
+
* Adds a listener function (fn) to a particular event type of the object.
|
|
1152
|
+
* You can optionally specify the context of the listener (object the this
|
|
1153
|
+
* keyword will point to). You can also pass several space-separated types
|
|
1154
|
+
* (e.g. 'click dblclick').
|
|
1155
|
+
*/
|
|
1156
|
+
// tslint:disable:unified-signatures
|
|
1157
|
+
addEventListener(
|
|
1158
|
+
type: "baselayerchange" | "overlayadd" | "overlayremove",
|
|
1159
|
+
fn: LayersControlEventHandlerFn,
|
|
1160
|
+
context?: any,
|
|
1161
|
+
): this;
|
|
1162
|
+
addEventListener(type: "layeradd" | "layerremove", fn: LayerEventHandlerFn, context?: any): this;
|
|
1163
|
+
addEventListener(
|
|
1164
|
+
type:
|
|
1165
|
+
| "zoomlevelschange"
|
|
1166
|
+
| "unload"
|
|
1167
|
+
| "viewreset"
|
|
1168
|
+
| "load"
|
|
1169
|
+
| "zoomstart"
|
|
1170
|
+
| "movestart"
|
|
1171
|
+
| "zoom"
|
|
1172
|
+
| "move"
|
|
1173
|
+
| "zoomend"
|
|
1174
|
+
| "moveend"
|
|
1175
|
+
| "autopanstart"
|
|
1176
|
+
| "dragstart"
|
|
1177
|
+
| "drag"
|
|
1178
|
+
| "add"
|
|
1179
|
+
| "remove"
|
|
1180
|
+
| "loading"
|
|
1181
|
+
| "error"
|
|
1182
|
+
| "update"
|
|
1183
|
+
| "down"
|
|
1184
|
+
| "predrag",
|
|
1185
|
+
fn: LeafletEventHandlerFn,
|
|
1186
|
+
context?: any,
|
|
1187
|
+
): this;
|
|
1188
|
+
addEventListener(type: "resize", fn: ResizeEventHandlerFn, context?: any): this;
|
|
1189
|
+
addEventListener(type: "popupopen" | "popupclose", fn: PopupEventHandlerFn, context?: any): this;
|
|
1190
|
+
addEventListener(type: "tooltipopen" | "tooltipclose", fn: TooltipEventHandlerFn, context?: any): this;
|
|
1191
|
+
addEventListener(type: "locationerror", fn: ErrorEventHandlerFn, context?: any): this;
|
|
1192
|
+
addEventListener(type: "locationfound", fn: LocationEventHandlerFn, context?: any): this;
|
|
1193
|
+
addEventListener(
|
|
1194
|
+
type:
|
|
1195
|
+
| "click"
|
|
1196
|
+
| "dblclick"
|
|
1197
|
+
| "mousedown"
|
|
1198
|
+
| "mouseup"
|
|
1199
|
+
| "mouseover"
|
|
1200
|
+
| "mouseout"
|
|
1201
|
+
| "mousemove"
|
|
1202
|
+
| "contextmenu"
|
|
1203
|
+
| "preclick",
|
|
1204
|
+
fn: LeafletMouseEventHandlerFn,
|
|
1205
|
+
context?: any,
|
|
1206
|
+
): this;
|
|
1207
|
+
addEventListener(type: "keypress" | "keydown" | "keyup", fn: LeafletKeyboardEventHandlerFn, context?: any): this;
|
|
1208
|
+
addEventListener(type: "zoomanim", fn: ZoomAnimEventHandlerFn, context?: any): this;
|
|
1209
|
+
addEventListener(type: "dragend", fn: DragEndEventHandlerFn, context?: any): this;
|
|
1210
|
+
addEventListener(
|
|
1211
|
+
type: "tileunload" | "tileloadstart" | "tileload" | "tileabort",
|
|
1212
|
+
fn: TileEventHandlerFn,
|
|
1213
|
+
context?: any,
|
|
1214
|
+
): this;
|
|
1215
|
+
addEventListener(type: "tileerror", fn: TileErrorEventHandlerFn, context?: any): this;
|
|
1216
|
+
addEventListener(type: string, fn: LeafletEventHandlerFn, context?: any): this;
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Alias for on(...)
|
|
1220
|
+
*
|
|
1221
|
+
* Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}
|
|
1222
|
+
*/
|
|
1223
|
+
addEventListener(eventMap: LeafletEventHandlerFnMap): this;
|
|
1224
|
+
// tslint:enable:unified-signatures
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Alias for off(...)
|
|
1228
|
+
*
|
|
1229
|
+
* Removes a previously added listener function. If no function is specified,
|
|
1230
|
+
* it will remove all the listeners of that particular event from the object.
|
|
1231
|
+
* Note that if you passed a custom context to on, you must pass the same context
|
|
1232
|
+
* to off in order to remove the listener.
|
|
1233
|
+
*/
|
|
1234
|
+
// tslint:disable:unified-signatures
|
|
1235
|
+
removeEventListener(
|
|
1236
|
+
type: "baselayerchange" | "overlayadd" | "overlayremove",
|
|
1237
|
+
fn?: LayersControlEventHandlerFn,
|
|
1238
|
+
context?: any,
|
|
1239
|
+
): this;
|
|
1240
|
+
removeEventListener(type: "layeradd" | "layerremove", fn?: LayerEventHandlerFn, context?: any): this;
|
|
1241
|
+
removeEventListener(
|
|
1242
|
+
type:
|
|
1243
|
+
| "zoomlevelschange"
|
|
1244
|
+
| "unload"
|
|
1245
|
+
| "viewreset"
|
|
1246
|
+
| "load"
|
|
1247
|
+
| "zoomstart"
|
|
1248
|
+
| "movestart"
|
|
1249
|
+
| "zoom"
|
|
1250
|
+
| "move"
|
|
1251
|
+
| "zoomend"
|
|
1252
|
+
| "moveend"
|
|
1253
|
+
| "autopanstart"
|
|
1254
|
+
| "dragstart"
|
|
1255
|
+
| "drag"
|
|
1256
|
+
| "add"
|
|
1257
|
+
| "remove"
|
|
1258
|
+
| "loading"
|
|
1259
|
+
| "error"
|
|
1260
|
+
| "update"
|
|
1261
|
+
| "down"
|
|
1262
|
+
| "predrag",
|
|
1263
|
+
fn?: LeafletEventHandlerFn,
|
|
1264
|
+
context?: any,
|
|
1265
|
+
): this;
|
|
1266
|
+
removeEventListener(type: "resize", fn?: ResizeEventHandlerFn, context?: any): this;
|
|
1267
|
+
removeEventListener(type: "popupopen" | "popupclose", fn?: PopupEventHandlerFn, context?: any): this;
|
|
1268
|
+
removeEventListener(type: "tooltipopen" | "tooltipclose", fn?: TooltipEventHandlerFn, context?: any): this;
|
|
1269
|
+
removeEventListener(type: "locationerror", fn?: ErrorEventHandlerFn, context?: any): this;
|
|
1270
|
+
removeEventListener(type: "locationfound", fn?: LocationEventHandlerFn, context?: any): this;
|
|
1271
|
+
removeEventListener(
|
|
1272
|
+
type:
|
|
1273
|
+
| "click"
|
|
1274
|
+
| "dblclick"
|
|
1275
|
+
| "mousedown"
|
|
1276
|
+
| "mouseup"
|
|
1277
|
+
| "mouseover"
|
|
1278
|
+
| "mouseout"
|
|
1279
|
+
| "mousemove"
|
|
1280
|
+
| "contextmenu"
|
|
1281
|
+
| "preclick",
|
|
1282
|
+
fn?: LeafletMouseEventHandlerFn,
|
|
1283
|
+
context?: any,
|
|
1284
|
+
): this;
|
|
1285
|
+
removeEventListener(
|
|
1286
|
+
type: "keypress" | "keydown" | "keyup",
|
|
1287
|
+
fn?: LeafletKeyboardEventHandlerFn,
|
|
1288
|
+
context?: any,
|
|
1289
|
+
): this;
|
|
1290
|
+
removeEventListener(type: "zoomanim", fn?: ZoomAnimEventHandlerFn, context?: any): this;
|
|
1291
|
+
removeEventListener(type: "dragend", fn?: DragEndEventHandlerFn, context?: any): this;
|
|
1292
|
+
removeEventListener(
|
|
1293
|
+
type: "tileunload" | "tileloadstart" | "tileload" | "tileabort",
|
|
1294
|
+
fn?: TileEventHandlerFn,
|
|
1295
|
+
context?: any,
|
|
1296
|
+
): this;
|
|
1297
|
+
removeEventListener(type: "tileerror", fn?: TileErrorEventHandlerFn, context?: any): this;
|
|
1298
|
+
removeEventListener(type: string, fn?: LeafletEventHandlerFn, context?: any): this;
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* Alias for off(...)
|
|
1302
|
+
*
|
|
1303
|
+
* Removes a set of type/listener pairs.
|
|
1304
|
+
*/
|
|
1305
|
+
removeEventListener(eventMap: LeafletEventHandlerFnMap): this;
|
|
1306
|
+
// tslint:enable:unified-signatures
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* Alias for off()
|
|
1310
|
+
*
|
|
1311
|
+
* Removes all listeners to all events on the object.
|
|
1312
|
+
*/
|
|
1313
|
+
clearAllEventListeners(): this;
|
|
1314
|
+
|
|
1315
|
+
/**
|
|
1316
|
+
* Alias for once(...)
|
|
1317
|
+
*
|
|
1318
|
+
* Behaves as on(...), except the listener will only get fired once and then removed.
|
|
1319
|
+
*/
|
|
1320
|
+
// tslint:disable:unified-signatures
|
|
1321
|
+
addOneTimeEventListener(
|
|
1322
|
+
type: "baselayerchange" | "overlayadd" | "overlayremove",
|
|
1323
|
+
fn: LayersControlEventHandlerFn,
|
|
1324
|
+
context?: any,
|
|
1325
|
+
): this;
|
|
1326
|
+
addOneTimeEventListener(type: "layeradd" | "layerremove", fn: LayerEventHandlerFn, context?: any): this;
|
|
1327
|
+
addOneTimeEventListener(
|
|
1328
|
+
type:
|
|
1329
|
+
| "zoomlevelschange"
|
|
1330
|
+
| "unload"
|
|
1331
|
+
| "viewreset"
|
|
1332
|
+
| "load"
|
|
1333
|
+
| "zoomstart"
|
|
1334
|
+
| "movestart"
|
|
1335
|
+
| "zoom"
|
|
1336
|
+
| "move"
|
|
1337
|
+
| "zoomend"
|
|
1338
|
+
| "moveend"
|
|
1339
|
+
| "autopanstart"
|
|
1340
|
+
| "dragstart"
|
|
1341
|
+
| "drag"
|
|
1342
|
+
| "add"
|
|
1343
|
+
| "remove"
|
|
1344
|
+
| "loading"
|
|
1345
|
+
| "error"
|
|
1346
|
+
| "update"
|
|
1347
|
+
| "down"
|
|
1348
|
+
| "predrag",
|
|
1349
|
+
fn: LeafletEventHandlerFn,
|
|
1350
|
+
context?: any,
|
|
1351
|
+
): this;
|
|
1352
|
+
addOneTimeEventListener(type: "resize", fn: ResizeEventHandlerFn, context?: any): this;
|
|
1353
|
+
addOneTimeEventListener(type: "popupopen" | "popupclose", fn: PopupEventHandlerFn, context?: any): this;
|
|
1354
|
+
addOneTimeEventListener(type: "tooltipopen" | "tooltipclose", fn: TooltipEventHandlerFn, context?: any): this;
|
|
1355
|
+
addOneTimeEventListener(type: "locationerror", fn: ErrorEventHandlerFn, context?: any): this;
|
|
1356
|
+
addOneTimeEventListener(type: "locationfound", fn: LocationEventHandlerFn, context?: any): this;
|
|
1357
|
+
addOneTimeEventListener(
|
|
1358
|
+
type:
|
|
1359
|
+
| "click"
|
|
1360
|
+
| "dblclick"
|
|
1361
|
+
| "mousedown"
|
|
1362
|
+
| "mouseup"
|
|
1363
|
+
| "mouseover"
|
|
1364
|
+
| "mouseout"
|
|
1365
|
+
| "mousemove"
|
|
1366
|
+
| "contextmenu"
|
|
1367
|
+
| "preclick",
|
|
1368
|
+
fn: LeafletMouseEventHandlerFn,
|
|
1369
|
+
context?: any,
|
|
1370
|
+
): this;
|
|
1371
|
+
addOneTimeEventListener(
|
|
1372
|
+
type: "keypress" | "keydown" | "keyup",
|
|
1373
|
+
fn: LeafletKeyboardEventHandlerFn,
|
|
1374
|
+
context?: any,
|
|
1375
|
+
): this;
|
|
1376
|
+
addOneTimeEventListener(type: "zoomanim", fn: ZoomAnimEventHandlerFn, context?: any): this;
|
|
1377
|
+
addOneTimeEventListener(type: "dragend", fn: DragEndEventHandlerFn, context?: any): this;
|
|
1378
|
+
addOneTimeEventListener(
|
|
1379
|
+
type: "tileunload" | "tileloadstart" | "tileload" | "tileabort",
|
|
1380
|
+
fn: TileEventHandlerFn,
|
|
1381
|
+
context?: any,
|
|
1382
|
+
): this;
|
|
1383
|
+
addOneTimeEventListener(type: "tileerror", fn: TileErrorEventHandlerFn, context?: any): this;
|
|
1384
|
+
addOneTimeEventListener(type: string, fn: LeafletEventHandlerFn, context?: any): this;
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* Alias for once(...)
|
|
1388
|
+
*
|
|
1389
|
+
* Behaves as on(...), except the listener will only get fired once and then removed.
|
|
1390
|
+
*/
|
|
1391
|
+
addOneTimeEventListener(eventMap: LeafletEventHandlerFnMap): this;
|
|
1392
|
+
// tslint:enable:unified-signatures
|
|
1393
|
+
|
|
1394
|
+
/**
|
|
1395
|
+
* Alias for fire(...)
|
|
1396
|
+
*
|
|
1397
|
+
* Fires an event of the specified type. You can optionally provide a data
|
|
1398
|
+
* object — the first argument of the listener function will contain its properties.
|
|
1399
|
+
* The event might can optionally be propagated to event parents.
|
|
1400
|
+
*/
|
|
1401
|
+
fireEvent(type: string, data?: any, propagate?: boolean): this;
|
|
1402
|
+
|
|
1403
|
+
/**
|
|
1404
|
+
* Alias for listens(...)
|
|
1405
|
+
*
|
|
1406
|
+
* Returns true if a particular event type has any listeners attached to it.
|
|
1407
|
+
*/
|
|
1408
|
+
hasEventListeners(type: string): boolean;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
interface LayerOptions {
|
|
1412
|
+
pane?: string | undefined;
|
|
1413
|
+
attribution?: string | undefined;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
interface InteractiveLayerOptions extends LayerOptions {
|
|
1417
|
+
interactive?: boolean | undefined;
|
|
1418
|
+
bubblingMouseEvents?: boolean | undefined;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
declare class Layer extends Evented {
|
|
1422
|
+
constructor(options?: LayerOptions);
|
|
1423
|
+
addTo(map: Map | LayerGroup): this;
|
|
1424
|
+
remove(): this;
|
|
1425
|
+
removeFrom(map: Map): this;
|
|
1426
|
+
getPane(name?: string): HTMLElement | undefined;
|
|
1427
|
+
|
|
1428
|
+
addInteractiveTarget(targetEl: HTMLElement): this;
|
|
1429
|
+
removeInteractiveTarget(targetEl: HTMLElement): this;
|
|
1430
|
+
|
|
1431
|
+
// Popup methods
|
|
1432
|
+
bindPopup(content: ((layer: Layer) => Content) | Content | Popup, options?: PopupOptions): this;
|
|
1433
|
+
unbindPopup(): this;
|
|
1434
|
+
openPopup(latlng?: LatLngExpression): this;
|
|
1435
|
+
closePopup(): this;
|
|
1436
|
+
togglePopup(): this;
|
|
1437
|
+
isPopupOpen(): boolean;
|
|
1438
|
+
setPopupContent(content: Content | Popup): this;
|
|
1439
|
+
getPopup(): Popup | undefined;
|
|
1440
|
+
|
|
1441
|
+
// Tooltip methods
|
|
1442
|
+
bindTooltip(content: ((layer: Layer) => Content) | Tooltip | Content, options?: TooltipOptions): this;
|
|
1443
|
+
unbindTooltip(): this;
|
|
1444
|
+
openTooltip(latlng?: LatLngExpression): this;
|
|
1445
|
+
closeTooltip(): this;
|
|
1446
|
+
toggleTooltip(): this;
|
|
1447
|
+
isTooltipOpen(): boolean;
|
|
1448
|
+
setTooltipContent(content: Content | Tooltip): this;
|
|
1449
|
+
getTooltip(): Tooltip | undefined;
|
|
1450
|
+
|
|
1451
|
+
// Extension methods
|
|
1452
|
+
onAdd(map: Map): this;
|
|
1453
|
+
onRemove(map: Map): this;
|
|
1454
|
+
getEvents?(): { [name: string]: LeafletEventHandlerFn };
|
|
1455
|
+
getAttribution?(): string | null;
|
|
1456
|
+
beforeAdd?(map: Map): this;
|
|
1457
|
+
|
|
1458
|
+
protected _map: Map;
|
|
1459
|
+
|
|
1460
|
+
options: LayerOptions;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
type LineCapShape = "butt" | "round" | "square" | "inherit";
|
|
1464
|
+
|
|
1465
|
+
type LineJoinShape = "miter" | "round" | "bevel" | "inherit";
|
|
1466
|
+
|
|
1467
|
+
type FillRule = "nonzero" | "evenodd" | "inherit";
|
|
1468
|
+
|
|
1469
|
+
interface PathOptions extends InteractiveLayerOptions {
|
|
1470
|
+
stroke?: boolean | undefined;
|
|
1471
|
+
color?: string | undefined;
|
|
1472
|
+
weight?: number | undefined;
|
|
1473
|
+
opacity?: number | undefined;
|
|
1474
|
+
lineCap?: LineCapShape | undefined;
|
|
1475
|
+
lineJoin?: LineJoinShape | undefined;
|
|
1476
|
+
dashArray?: string | number[] | undefined;
|
|
1477
|
+
dashOffset?: string | undefined;
|
|
1478
|
+
fill?: boolean | undefined;
|
|
1479
|
+
fillColor?: string | undefined;
|
|
1480
|
+
fillOpacity?: number | undefined;
|
|
1481
|
+
fillRule?: FillRule | undefined;
|
|
1482
|
+
renderer?: Renderer | undefined;
|
|
1483
|
+
className?: string | undefined;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
declare abstract class Path extends Layer {
|
|
1487
|
+
redraw(): this;
|
|
1488
|
+
setStyle(style: PathOptions): this;
|
|
1489
|
+
bringToFront(): this;
|
|
1490
|
+
bringToBack(): this;
|
|
1491
|
+
getElement(): Element | undefined;
|
|
1492
|
+
|
|
1493
|
+
options: PathOptions;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
interface RendererOptions extends LayerOptions {
|
|
1497
|
+
padding?: number | undefined;
|
|
1498
|
+
tolerance?: number | undefined;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
declare class Renderer extends Layer {
|
|
1502
|
+
constructor(options?: RendererOptions);
|
|
1503
|
+
|
|
1504
|
+
options: RendererOptions;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
/**
|
|
1508
|
+
* Used to group several layers and handle them as one.
|
|
1509
|
+
* If you add it to the map, any layers added or removed from the group will be
|
|
1510
|
+
* added/removed on the map as well. Extends Layer.
|
|
1511
|
+
*/
|
|
1512
|
+
declare class LayerGroup<P = any> extends Layer {
|
|
1513
|
+
constructor(layers?: Layer[], options?: LayerOptions);
|
|
1514
|
+
|
|
1515
|
+
toMultiPoint(precision?: number): Feature<MultiPoint, P>;
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
* Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint).
|
|
1519
|
+
*/
|
|
1520
|
+
toGeoJSON(
|
|
1521
|
+
precision?: number | false,
|
|
1522
|
+
):
|
|
1523
|
+
| FeatureCollection<GeometryObject, P>
|
|
1524
|
+
| Feature<MultiPoint, P>
|
|
1525
|
+
| GeometryCollection;
|
|
1526
|
+
|
|
1527
|
+
/**
|
|
1528
|
+
* Adds the given layer to the group.
|
|
1529
|
+
*/
|
|
1530
|
+
addLayer(layer: Layer): this;
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* Removes the layer with the given internal ID or the given layer from the group.
|
|
1534
|
+
*/
|
|
1535
|
+
removeLayer(layer: number | Layer): this;
|
|
1536
|
+
|
|
1537
|
+
/**
|
|
1538
|
+
* Returns true if the given layer is currently added to the group.
|
|
1539
|
+
*/
|
|
1540
|
+
hasLayer(layer: Layer): boolean;
|
|
1541
|
+
|
|
1542
|
+
/**
|
|
1543
|
+
* Removes all the layers from the group.
|
|
1544
|
+
*/
|
|
1545
|
+
clearLayers(): this;
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
* Calls methodName on every layer contained in this group, passing any additional parameters.
|
|
1549
|
+
* Has no effect if the layers contained do not implement methodName.
|
|
1550
|
+
*/
|
|
1551
|
+
invoke(methodName: string, ...params: any[]): this;
|
|
1552
|
+
|
|
1553
|
+
/**
|
|
1554
|
+
* Iterates over the layers of the group,
|
|
1555
|
+
* optionally specifying context of the iterator function.
|
|
1556
|
+
*/
|
|
1557
|
+
eachLayer(fn: (layer: Layer) => void, context?: any): this;
|
|
1558
|
+
|
|
1559
|
+
/**
|
|
1560
|
+
* Returns the layer with the given internal ID.
|
|
1561
|
+
*/
|
|
1562
|
+
getLayer(id: number): Layer | undefined;
|
|
1563
|
+
|
|
1564
|
+
/**
|
|
1565
|
+
* Returns an array of all the layers added to the group.
|
|
1566
|
+
*/
|
|
1567
|
+
getLayers(): Layer[];
|
|
1568
|
+
|
|
1569
|
+
/**
|
|
1570
|
+
* Calls setZIndex on every layer contained in this group, passing the z-index.
|
|
1571
|
+
*/
|
|
1572
|
+
setZIndex(zIndex: number): this;
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* Returns the internal ID for a layer
|
|
1576
|
+
*/
|
|
1577
|
+
getLayerId(layer: Layer): number;
|
|
1578
|
+
|
|
1579
|
+
feature?:
|
|
1580
|
+
| FeatureCollection<GeometryObject, P>
|
|
1581
|
+
| Feature<MultiPoint, P>
|
|
1582
|
+
| GeometryCollection
|
|
1583
|
+
| undefined;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
type Zoom = boolean | "center";
|
|
1587
|
+
|
|
1588
|
+
interface MapOptions {
|
|
1589
|
+
preferCanvas?: boolean | undefined;
|
|
1590
|
+
|
|
1591
|
+
// Control options
|
|
1592
|
+
attributionControl?: boolean | undefined;
|
|
1593
|
+
zoomControl?: boolean | undefined;
|
|
1594
|
+
|
|
1595
|
+
// Interaction options
|
|
1596
|
+
closePopupOnClick?: boolean | undefined;
|
|
1597
|
+
zoomSnap?: number | undefined;
|
|
1598
|
+
zoomDelta?: number | undefined;
|
|
1599
|
+
trackResize?: boolean | undefined;
|
|
1600
|
+
boxZoom?: boolean | undefined;
|
|
1601
|
+
doubleClickZoom?: Zoom | undefined;
|
|
1602
|
+
dragging?: boolean | undefined;
|
|
1603
|
+
|
|
1604
|
+
// Map state options
|
|
1605
|
+
crs?: CRS | undefined;
|
|
1606
|
+
center?: LatLngExpression | undefined;
|
|
1607
|
+
zoom?: number | undefined;
|
|
1608
|
+
minZoom?: number | undefined;
|
|
1609
|
+
maxZoom?: number | undefined;
|
|
1610
|
+
layers?: Layer[] | undefined;
|
|
1611
|
+
maxBounds?: LatLngBoundsExpression | undefined;
|
|
1612
|
+
renderer?: Renderer | undefined;
|
|
1613
|
+
|
|
1614
|
+
// Animation options
|
|
1615
|
+
fadeAnimation?: boolean | undefined;
|
|
1616
|
+
markerZoomAnimation?: boolean | undefined;
|
|
1617
|
+
transform3DLimit?: number | undefined;
|
|
1618
|
+
zoomAnimation?: boolean | undefined;
|
|
1619
|
+
zoomAnimationThreshold?: number | undefined;
|
|
1620
|
+
|
|
1621
|
+
// Panning inertia options
|
|
1622
|
+
inertia?: boolean | undefined;
|
|
1623
|
+
inertiaDeceleration?: number | undefined;
|
|
1624
|
+
inertiaMaxSpeed?: number | undefined;
|
|
1625
|
+
easeLinearity?: number | undefined;
|
|
1626
|
+
worldCopyJump?: boolean | undefined;
|
|
1627
|
+
maxBoundsViscosity?: number | undefined;
|
|
1628
|
+
|
|
1629
|
+
// Keyboard navigation options
|
|
1630
|
+
keyboard?: boolean | undefined;
|
|
1631
|
+
keyboardPanDelta?: number | undefined;
|
|
1632
|
+
|
|
1633
|
+
// Mousewheel options
|
|
1634
|
+
scrollWheelZoom?: Zoom | undefined;
|
|
1635
|
+
wheelDebounceTime?: number | undefined;
|
|
1636
|
+
wheelPxPerZoomLevel?: number | undefined;
|
|
1637
|
+
|
|
1638
|
+
// Touch interaction options
|
|
1639
|
+
tapHold?: boolean | undefined;
|
|
1640
|
+
tapTolerance?: number | undefined;
|
|
1641
|
+
touchZoom?: Zoom | undefined;
|
|
1642
|
+
bounceAtZoomLimits?: boolean | undefined;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
type ControlPosition = "topleft" | "topright" | "bottomleft" | "bottomright";
|
|
1646
|
+
|
|
1647
|
+
interface ControlOptions {
|
|
1648
|
+
position?: ControlPosition | undefined;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
declare class Control<Options extends ControlOptions = ControlOptions> extends Class {
|
|
1652
|
+
static extend<T extends object, Options extends ControlOptions = ControlOptions>(
|
|
1653
|
+
props: T,
|
|
1654
|
+
): { new(...args: any[]): T } & typeof Control<Options>;
|
|
1655
|
+
constructor(options?: Options);
|
|
1656
|
+
getPosition(): ControlPosition;
|
|
1657
|
+
setPosition(position: ControlPosition): this;
|
|
1658
|
+
getContainer(): HTMLElement | undefined;
|
|
1659
|
+
addTo(map: Map): this;
|
|
1660
|
+
remove(): this;
|
|
1661
|
+
|
|
1662
|
+
// Extension methods
|
|
1663
|
+
onAdd?(map: Map): HTMLElement;
|
|
1664
|
+
onRemove?(map: Map): void;
|
|
1665
|
+
|
|
1666
|
+
options: Options;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
declare namespace Control {
|
|
1670
|
+
interface ZoomOptions extends ControlOptions {
|
|
1671
|
+
zoomInText?: string | undefined;
|
|
1672
|
+
zoomInTitle?: string | undefined;
|
|
1673
|
+
zoomOutText?: string | undefined;
|
|
1674
|
+
zoomOutTitle?: string | undefined;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
class Zoom extends Control {
|
|
1678
|
+
constructor(options?: ZoomOptions);
|
|
1679
|
+
options: ZoomOptions;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
interface AttributionOptions extends ControlOptions {
|
|
1683
|
+
prefix?: string | boolean | undefined;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
class Attribution extends Control {
|
|
1687
|
+
constructor(options?: AttributionOptions);
|
|
1688
|
+
setPrefix(prefix: string | false): this;
|
|
1689
|
+
addAttribution(text: string): this;
|
|
1690
|
+
removeAttribution(text: string): this;
|
|
1691
|
+
options: AttributionOptions;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
interface LayersOptions extends ControlOptions {
|
|
1695
|
+
collapsed?: boolean | undefined;
|
|
1696
|
+
autoZIndex?: boolean | undefined;
|
|
1697
|
+
hideSingleBase?: boolean | undefined;
|
|
1698
|
+
/**
|
|
1699
|
+
* Whether to sort the layers. When `false`, layers will keep the order in which they were added to the control.
|
|
1700
|
+
*/
|
|
1701
|
+
sortLayers?: boolean | undefined;
|
|
1702
|
+
/**
|
|
1703
|
+
* A [compare function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)
|
|
1704
|
+
* that will be used for sorting the layers, when `sortLayers` is `true`. The function receives both the
|
|
1705
|
+
* [`L.Layer`](https://leafletjs.com/reference.html#layer) instances and their names, as in
|
|
1706
|
+
* `sortFunction(layerA, layerB, nameA, nameB)`. By default, it sorts layers alphabetically by their name.
|
|
1707
|
+
*/
|
|
1708
|
+
sortFunction?: ((layerA: Layer, layerB: Layer, nameA: string, nameB: string) => number) | undefined;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
interface LayersObject {
|
|
1712
|
+
[name: string]: Layer;
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
class Layers extends Control {
|
|
1716
|
+
constructor(baseLayers?: LayersObject, overlays?: LayersObject, options?: LayersOptions);
|
|
1717
|
+
addBaseLayer(layer: Layer, name: string): this;
|
|
1718
|
+
addOverlay(layer: Layer, name: string): this;
|
|
1719
|
+
removeLayer(layer: Layer): this;
|
|
1720
|
+
expand(): this;
|
|
1721
|
+
collapse(): this;
|
|
1722
|
+
options: LayersOptions;
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
interface ScaleOptions extends ControlOptions {
|
|
1726
|
+
maxWidth?: number | undefined;
|
|
1727
|
+
metric?: boolean | undefined;
|
|
1728
|
+
imperial?: boolean | undefined;
|
|
1729
|
+
updateWhenIdle?: boolean | undefined;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
class Scale extends Control {
|
|
1733
|
+
constructor(options?: ScaleOptions);
|
|
1734
|
+
options: ScaleOptions;
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
interface DivOverlayOptions {
|
|
1739
|
+
offset?: PointExpression | undefined;
|
|
1740
|
+
className?: string | undefined;
|
|
1741
|
+
pane?: string | undefined;
|
|
1742
|
+
interactive?: boolean | undefined;
|
|
1743
|
+
content?: string | HTMLElement | ((layer: Layer) => string) | ((layer: Layer) => HTMLElement);
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
declare abstract class DivOverlay extends Layer {
|
|
1747
|
+
constructor(latlng: LatLngExpression, options?: TooltipOptions);
|
|
1748
|
+
constructor(options?: DivOverlayOptions, source?: Layer);
|
|
1749
|
+
getLatLng(): LatLng | undefined;
|
|
1750
|
+
setLatLng(latlng: LatLngExpression): this;
|
|
1751
|
+
getContent(): Content | ((source: Layer) => Content) | undefined;
|
|
1752
|
+
setContent(htmlContent: ((source: Layer) => Content) | Content): this;
|
|
1753
|
+
getElement(): HTMLElement | undefined;
|
|
1754
|
+
update(): void;
|
|
1755
|
+
isOpen(): boolean;
|
|
1756
|
+
bringToFront(): this;
|
|
1757
|
+
bringToBack(): this;
|
|
1758
|
+
openOn(map: Map): this;
|
|
1759
|
+
toggle(layer?: Layer): this;
|
|
1760
|
+
close(): this;
|
|
1761
|
+
|
|
1762
|
+
options: DivOverlayOptions;
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
interface PopupOptions extends DivOverlayOptions {
|
|
1766
|
+
maxWidth?: number | undefined;
|
|
1767
|
+
minWidth?: number | undefined;
|
|
1768
|
+
maxHeight?: number | undefined;
|
|
1769
|
+
keepInView?: boolean | undefined;
|
|
1770
|
+
closeButton?: boolean | undefined;
|
|
1771
|
+
autoPan?: boolean | undefined;
|
|
1772
|
+
autoPanPaddingTopLeft?: PointExpression | undefined;
|
|
1773
|
+
autoPanPaddingBottomRight?: PointExpression | undefined;
|
|
1774
|
+
autoPanPadding?: PointExpression | undefined;
|
|
1775
|
+
autoClose?: boolean | undefined;
|
|
1776
|
+
closeOnClick?: boolean | undefined;
|
|
1777
|
+
closeOnEscapeKey?: boolean | undefined;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
type Content = string | HTMLElement;
|
|
1781
|
+
|
|
1782
|
+
declare class Popup extends DivOverlay {
|
|
1783
|
+
constructor(latlng: LatLngExpression, options?: TooltipOptions);
|
|
1784
|
+
constructor(options?: PopupOptions, source?: Layer);
|
|
1785
|
+
openOn(map: Map): this;
|
|
1786
|
+
|
|
1787
|
+
options: PopupOptions;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
type Direction = "right" | "left" | "top" | "bottom" | "center" | "auto";
|
|
1791
|
+
|
|
1792
|
+
interface TooltipOptions extends DivOverlayOptions {
|
|
1793
|
+
pane?: string | undefined;
|
|
1794
|
+
offset?: PointExpression | undefined;
|
|
1795
|
+
direction?: Direction | undefined;
|
|
1796
|
+
permanent?: boolean | undefined;
|
|
1797
|
+
sticky?: boolean | undefined;
|
|
1798
|
+
opacity?: number | undefined;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
declare class Tooltip extends DivOverlay {
|
|
1802
|
+
constructor(latlng: LatLngExpression, options?: TooltipOptions);
|
|
1803
|
+
constructor(options?: TooltipOptions, source?: Layer);
|
|
1804
|
+
setOpacity(val: number): void;
|
|
1805
|
+
|
|
1806
|
+
options: TooltipOptions;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
interface ZoomOptions {
|
|
1810
|
+
animate?: boolean | undefined;
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
interface PanOptions {
|
|
1814
|
+
animate?: boolean | undefined;
|
|
1815
|
+
duration?: number | undefined;
|
|
1816
|
+
easeLinearity?: number | undefined;
|
|
1817
|
+
noMoveStart?: boolean | undefined;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
// This is not empty, it extends two interfaces into one...
|
|
1821
|
+
interface ZoomPanOptions extends ZoomOptions, PanOptions {}
|
|
1822
|
+
|
|
1823
|
+
interface InvalidateSizeOptions extends ZoomPanOptions {
|
|
1824
|
+
debounceMoveend?: boolean | undefined;
|
|
1825
|
+
pan?: boolean | undefined;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
interface FitBoundsOptions extends ZoomOptions, PanOptions {
|
|
1829
|
+
paddingTopLeft?: PointExpression | undefined;
|
|
1830
|
+
paddingBottomRight?: PointExpression | undefined;
|
|
1831
|
+
padding?: PointExpression | undefined;
|
|
1832
|
+
maxZoom?: number | undefined;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
interface PanInsideOptions extends PanOptions {
|
|
1836
|
+
paddingTopLeft?: PointExpression | undefined;
|
|
1837
|
+
paddingBottomRight?: PointExpression | undefined;
|
|
1838
|
+
padding?: PointExpression | undefined;
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
interface LocateOptions {
|
|
1842
|
+
watch?: boolean | undefined;
|
|
1843
|
+
setView?: boolean | undefined;
|
|
1844
|
+
maxZoom?: number | undefined;
|
|
1845
|
+
timeout?: number | undefined;
|
|
1846
|
+
maximumAge?: number | undefined;
|
|
1847
|
+
enableHighAccuracy?: boolean | undefined;
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
declare class Handler extends Class {
|
|
1851
|
+
constructor(map: Map);
|
|
1852
|
+
enable(): this;
|
|
1853
|
+
disable(): this;
|
|
1854
|
+
enabled(): boolean;
|
|
1855
|
+
|
|
1856
|
+
// Extension methods
|
|
1857
|
+
addHooks?(): void;
|
|
1858
|
+
removeHooks?(): void;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
interface LeafletEvent {
|
|
1862
|
+
type: string;
|
|
1863
|
+
popup: any;
|
|
1864
|
+
target: any;
|
|
1865
|
+
sourceTarget: any;
|
|
1866
|
+
propagatedFrom: any;
|
|
1867
|
+
/**
|
|
1868
|
+
* @deprecated The same as {@link LeafletEvent.propagatedFrom propagatedFrom}.
|
|
1869
|
+
*/
|
|
1870
|
+
layer: any;
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
interface LeafletMouseEvent extends LeafletEvent {
|
|
1874
|
+
latlng: LatLng;
|
|
1875
|
+
layerPoint: Point;
|
|
1876
|
+
containerPoint: Point;
|
|
1877
|
+
originalEvent: MouseEvent;
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
interface LeafletKeyboardEvent extends LeafletEvent {
|
|
1881
|
+
originalEvent: KeyboardEvent;
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
interface LocationEvent extends LeafletEvent {
|
|
1885
|
+
latlng: LatLng;
|
|
1886
|
+
bounds: LatLngBounds;
|
|
1887
|
+
accuracy: number;
|
|
1888
|
+
altitude: number;
|
|
1889
|
+
altitudeAccuracy: number;
|
|
1890
|
+
heading: number;
|
|
1891
|
+
speed: number;
|
|
1892
|
+
timestamp: number;
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
interface ErrorEvent extends LeafletEvent {
|
|
1896
|
+
message: string;
|
|
1897
|
+
code: number;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
interface LayerEvent extends LeafletEvent {
|
|
1901
|
+
layer: Layer;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
interface LayersControlEvent extends LayerEvent {
|
|
1905
|
+
name: string;
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
interface TileEvent extends LeafletEvent {
|
|
1909
|
+
tile: HTMLImageElement;
|
|
1910
|
+
coords: Coords;
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
interface TileErrorEvent extends TileEvent {
|
|
1914
|
+
error: Error;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
interface ResizeEvent extends LeafletEvent {
|
|
1918
|
+
oldSize: Point;
|
|
1919
|
+
newSize: Point;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
interface PopupEvent extends LeafletEvent {
|
|
1923
|
+
popup: Popup;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
interface TooltipEvent extends LeafletEvent {
|
|
1927
|
+
tooltip: Tooltip;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
interface DragEndEvent extends LeafletEvent {
|
|
1931
|
+
distance: number;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
interface ZoomAnimEvent extends LeafletEvent {
|
|
1935
|
+
center: LatLng;
|
|
1936
|
+
zoom: number;
|
|
1937
|
+
noUpdate: boolean;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
interface DefaultMapPanes {
|
|
1941
|
+
mapPane: HTMLElement;
|
|
1942
|
+
tilePane: HTMLElement;
|
|
1943
|
+
overlayPane: HTMLElement;
|
|
1944
|
+
shadowPane: HTMLElement;
|
|
1945
|
+
markerPane: HTMLElement;
|
|
1946
|
+
tooltipPane: HTMLElement;
|
|
1947
|
+
popupPane: HTMLElement;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
declare class Map extends Evented {
|
|
1951
|
+
constructor(element: string | HTMLElement, options?: MapOptions);
|
|
1952
|
+
getRenderer(layer: Path): Renderer;
|
|
1953
|
+
|
|
1954
|
+
// Methods for layers and controls
|
|
1955
|
+
addControl(control: Control): this;
|
|
1956
|
+
removeControl(control: Control): this;
|
|
1957
|
+
addLayer(layer: Layer): this;
|
|
1958
|
+
removeLayer(layer: Layer): this;
|
|
1959
|
+
hasLayer(layer: Layer): boolean;
|
|
1960
|
+
eachLayer(fn: (layer: Layer) => void, context?: any): this;
|
|
1961
|
+
openPopup(popup: Popup): this;
|
|
1962
|
+
openPopup(content: Content, latlng: LatLngExpression, options?: PopupOptions): this;
|
|
1963
|
+
closePopup(popup?: Popup): this;
|
|
1964
|
+
openTooltip(tooltip: Tooltip): this;
|
|
1965
|
+
openTooltip(content: Content, latlng: LatLngExpression, options?: TooltipOptions): this;
|
|
1966
|
+
closeTooltip(tooltip?: Tooltip): this;
|
|
1967
|
+
|
|
1968
|
+
// Methods for modifying map state
|
|
1969
|
+
setView(center: LatLngExpression, zoom?: number, options?: ZoomPanOptions): this;
|
|
1970
|
+
setZoom(zoom: number, options?: ZoomPanOptions): this;
|
|
1971
|
+
zoomIn(delta?: number, options?: ZoomOptions): this;
|
|
1972
|
+
zoomOut(delta?: number, options?: ZoomOptions): this;
|
|
1973
|
+
setZoomAround(position: Point | LatLngExpression, zoom: number, options?: ZoomOptions): this;
|
|
1974
|
+
fitBounds(bounds: LatLngBoundsExpression, options?: FitBoundsOptions): this;
|
|
1975
|
+
fitWorld(options?: FitBoundsOptions): this;
|
|
1976
|
+
panTo(latlng: LatLngExpression, options?: PanOptions): this;
|
|
1977
|
+
panBy(offset: PointExpression, options?: PanOptions): this;
|
|
1978
|
+
setMaxBounds(bounds?: LatLngBoundsExpression): this;
|
|
1979
|
+
setMinZoom(zoom: number): this;
|
|
1980
|
+
setMaxZoom(zoom: number): this;
|
|
1981
|
+
panInside(latLng: LatLngExpression, options?: PanInsideOptions): this;
|
|
1982
|
+
panInsideBounds(bounds: LatLngBoundsExpression, options?: PanOptions): this;
|
|
1983
|
+
/**
|
|
1984
|
+
* Boolean for animate or advanced ZoomPanOptions
|
|
1985
|
+
*/
|
|
1986
|
+
invalidateSize(options?: boolean | InvalidateSizeOptions): this;
|
|
1987
|
+
stop(): this;
|
|
1988
|
+
flyTo(latlng: LatLngExpression, zoom?: number, options?: ZoomPanOptions): this;
|
|
1989
|
+
flyToBounds(bounds: LatLngBoundsExpression, options?: FitBoundsOptions): this;
|
|
1990
|
+
|
|
1991
|
+
// Other methods
|
|
1992
|
+
addHandler(name: string, HandlerClass: typeof Handler): this; // Alternatively, HandlerClass: new(map: Map) => Handler
|
|
1993
|
+
remove(): this;
|
|
1994
|
+
createPane(name: string, container?: HTMLElement): HTMLElement;
|
|
1995
|
+
/**
|
|
1996
|
+
* Name of the pane or the pane as HTML-Element
|
|
1997
|
+
*/
|
|
1998
|
+
getPane(pane: string | HTMLElement): HTMLElement | undefined;
|
|
1999
|
+
getPanes(): { [name: string]: HTMLElement } & DefaultMapPanes;
|
|
2000
|
+
getContainer(): HTMLElement;
|
|
2001
|
+
whenReady(fn: (event: { target: Map }) => void, context?: any): this;
|
|
2002
|
+
|
|
2003
|
+
// Methods for getting map state
|
|
2004
|
+
getCenter(): LatLng;
|
|
2005
|
+
getZoom(): number;
|
|
2006
|
+
getBounds(): LatLngBounds;
|
|
2007
|
+
getMinZoom(): number;
|
|
2008
|
+
getMaxZoom(): number;
|
|
2009
|
+
getBoundsZoom(bounds: LatLngBoundsExpression, inside?: boolean, padding?: Point): number;
|
|
2010
|
+
getSize(): Point;
|
|
2011
|
+
getPixelBounds(): Bounds;
|
|
2012
|
+
getPixelOrigin(): Point;
|
|
2013
|
+
getPixelWorldBounds(zoom?: number): Bounds;
|
|
2014
|
+
|
|
2015
|
+
// Conversion methods
|
|
2016
|
+
getZoomScale(toZoom: number, fromZoom?: number): number;
|
|
2017
|
+
getScaleZoom(scale: number, fromZoom?: number): number;
|
|
2018
|
+
project(latlng: LatLngExpression, zoom?: number): Point;
|
|
2019
|
+
unproject(point: PointExpression, zoom?: number): LatLng;
|
|
2020
|
+
layerPointToLatLng(point: PointExpression): LatLng;
|
|
2021
|
+
latLngToLayerPoint(latlng: LatLngExpression): Point;
|
|
2022
|
+
wrapLatLng(latlng: LatLngExpression): LatLng;
|
|
2023
|
+
wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds;
|
|
2024
|
+
distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number;
|
|
2025
|
+
containerPointToLayerPoint(point: PointExpression): Point;
|
|
2026
|
+
containerPointToLatLng(point: PointExpression): LatLng;
|
|
2027
|
+
layerPointToContainerPoint(point: PointExpression): Point;
|
|
2028
|
+
latLngToContainerPoint(latlng: LatLngExpression): Point;
|
|
2029
|
+
mouseEventToContainerPoint(ev: MouseEvent): Point;
|
|
2030
|
+
mouseEventToLayerPoint(ev: MouseEvent): Point;
|
|
2031
|
+
mouseEventToLatLng(ev: MouseEvent): LatLng;
|
|
2032
|
+
|
|
2033
|
+
// Geolocation methods
|
|
2034
|
+
locate(options?: LocateOptions): this;
|
|
2035
|
+
stopLocate(): this;
|
|
2036
|
+
|
|
2037
|
+
// Properties
|
|
2038
|
+
attributionControl: L.Control.Attribution;
|
|
2039
|
+
boxZoom: Handler;
|
|
2040
|
+
doubleClickZoom: Handler;
|
|
2041
|
+
dragging: Handler;
|
|
2042
|
+
keyboard: Handler;
|
|
2043
|
+
scrollWheelZoom: Handler;
|
|
2044
|
+
tapHold?: Handler | undefined;
|
|
2045
|
+
touchZoom: Handler;
|
|
2046
|
+
zoomControl: Control.Zoom;
|
|
2047
|
+
|
|
2048
|
+
options: MapOptions;
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
/**
|
|
2052
|
+
* Public API interface for the SEP Map component
|
|
2053
|
+
* Available when using React ref or SDK instance
|
|
2054
|
+
*/
|
|
2055
|
+
interface SEPMapRef {
|
|
2056
|
+
selectAddress: (idOrAddress: number | Address) => Promise<Address | null>;
|
|
2057
|
+
selectPerimeter: (idOrPerimeter: string | Perimeter) => Promise<Perimeter | null>;
|
|
2058
|
+
getSelection: () => SelectionItem[];
|
|
2059
|
+
clearSelection: () => void;
|
|
2060
|
+
addToSelection: (item: Address | Perimeter) => boolean;
|
|
2061
|
+
removeFromSelection: (id: string | number) => void;
|
|
2062
|
+
flyTo: (lat: number, lng: number, zoom?: number, options?: FlyToOptions) => void;
|
|
2063
|
+
fitBounds: (bounds: [[number, number], [number, number]]) => void;
|
|
2064
|
+
startPolygonDraw: () => void;
|
|
2065
|
+
cancelPolygonDraw: () => void;
|
|
2066
|
+
addLayer: (layerConfig: LayerConfig) => void;
|
|
2067
|
+
addWMSLayer: (options: AddWMSLayerOptions) => void;
|
|
2068
|
+
addTileLayer: (options: AddTileLayerOptions) => void;
|
|
2069
|
+
addGeoJSONLayer: (options: AddGeoJSONLayerOptions) => void;
|
|
2070
|
+
removeLayer: (layerId: string) => void;
|
|
2071
|
+
toggleLayer: (layerId: string, visible?: boolean) => void;
|
|
2072
|
+
getLayers: () => LayerConfig[];
|
|
2073
|
+
getLayer: (layerId: string) => LayerConfig | undefined;
|
|
2074
|
+
getLeafletMap: () => Map | null;
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
type SupportedLocale = 'de' | 'fr' | 'it' | 'en';
|
|
2078
|
+
|
|
2079
|
+
interface SearchOptions {
|
|
2080
|
+
districts?: number[];
|
|
2081
|
+
limit?: number;
|
|
2082
|
+
signal?: AbortSignal;
|
|
2083
|
+
}
|
|
2084
|
+
declare class AddressService {
|
|
2085
|
+
private baseUrl;
|
|
2086
|
+
private token;
|
|
2087
|
+
constructor(baseUrl: string, token: string);
|
|
2088
|
+
/**
|
|
2089
|
+
* Search for addresses by query string
|
|
2090
|
+
*/
|
|
2091
|
+
search(query: string, options?: SearchOptions): Promise<Address[]>;
|
|
2092
|
+
/**
|
|
2093
|
+
* Advanced search using searchaddress-advanced endpoint
|
|
2094
|
+
*/
|
|
2095
|
+
searchAdvanced(query: string, options?: SearchOptions): Promise<Address[]>;
|
|
2096
|
+
/**
|
|
2097
|
+
* Get address by ID
|
|
2098
|
+
*/
|
|
2099
|
+
getById(id: number, signal?: AbortSignal): Promise<Address | null>;
|
|
2100
|
+
/**
|
|
2101
|
+
* Get address at coordinates (reverse geocoding)
|
|
2102
|
+
*/
|
|
2103
|
+
getByCoordinates(lat: number, lng: number, signal?: AbortSignal): Promise<Address | null>;
|
|
2104
|
+
/**
|
|
2105
|
+
* Get addresses within a polygon
|
|
2106
|
+
*/
|
|
2107
|
+
getInPolygon(polygon: GeoJSON.Polygon, signal?: AbortSignal): Promise<Address[]>;
|
|
2108
|
+
/**
|
|
2109
|
+
* Transform API response to Address type
|
|
2110
|
+
*/
|
|
2111
|
+
private transformAddress;
|
|
2112
|
+
/**
|
|
2113
|
+
* Build display label from address parts
|
|
2114
|
+
*/
|
|
2115
|
+
private buildLabel;
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
declare class PerimeterService {
|
|
2119
|
+
private baseUrl;
|
|
2120
|
+
private token;
|
|
2121
|
+
constructor(baseUrl: string, token: string);
|
|
2122
|
+
private perimetersCache;
|
|
2123
|
+
private fetchPromise;
|
|
2124
|
+
/**
|
|
2125
|
+
* Get all perimeters (cached)
|
|
2126
|
+
*/
|
|
2127
|
+
getAll(): Promise<Perimeter[]>;
|
|
2128
|
+
/**
|
|
2129
|
+
* Search perimeters locally
|
|
2130
|
+
*/
|
|
2131
|
+
search(query: string): Promise<Perimeter[]>;
|
|
2132
|
+
getById(id: string): Promise<Perimeter | null>;
|
|
2133
|
+
/**
|
|
2134
|
+
* Find closest perimeter to coordinates
|
|
2135
|
+
* @param lat Latitude
|
|
2136
|
+
* @param lng Longitude
|
|
2137
|
+
* @param maxDistanceKm Maximum distance in kilometers (default 0.1km = 100m)
|
|
2138
|
+
*/
|
|
2139
|
+
getClosest(lat: number, lng: number, maxDistanceKm?: number): Promise<Perimeter | null>;
|
|
2140
|
+
private getDistanceFromLatLonInKm;
|
|
2141
|
+
private deg2rad;
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
declare class ConfigService {
|
|
2145
|
+
private clientId;
|
|
2146
|
+
constructor(_baseUrl: string, clientId: string);
|
|
2147
|
+
evaluateDecisionTree(items: SelectionItem[]): Promise<DecisionTreeResult>;
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
declare class I18nManager {
|
|
2151
|
+
private locale;
|
|
2152
|
+
private translations;
|
|
2153
|
+
private fallback;
|
|
2154
|
+
private listeners;
|
|
2155
|
+
private static bundledTranslations;
|
|
2156
|
+
private customTranslations;
|
|
2157
|
+
constructor(locale?: SupportedLocale, customTranslations?: Record<string, any>);
|
|
2158
|
+
private updateTranslations;
|
|
2159
|
+
private deepMerge;
|
|
2160
|
+
private detectLocale;
|
|
2161
|
+
private isSupported;
|
|
2162
|
+
t(key: string, values?: Record<string, string | number>): string;
|
|
2163
|
+
setLocale(locale: SupportedLocale): void;
|
|
2164
|
+
getLocale(): SupportedLocale;
|
|
2165
|
+
onLocaleChange(callback: (locale: SupportedLocale) => void): () => void;
|
|
2166
|
+
getSupportedLocales(): {
|
|
2167
|
+
code: string;
|
|
2168
|
+
name: string;
|
|
2169
|
+
}[];
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
type EventMap = {
|
|
2173
|
+
ready: {
|
|
2174
|
+
map: unknown;
|
|
2175
|
+
};
|
|
2176
|
+
addressSelected: Address;
|
|
2177
|
+
perimeterSelected: Perimeter;
|
|
2178
|
+
selectionChanged: SelectionItem[];
|
|
2179
|
+
polygonDrawn: {
|
|
2180
|
+
polygon: GeoJSON.Polygon;
|
|
2181
|
+
addresses: Address[];
|
|
2182
|
+
};
|
|
2183
|
+
error: {
|
|
2184
|
+
type: string;
|
|
2185
|
+
message: string;
|
|
2186
|
+
error?: Error;
|
|
2187
|
+
};
|
|
2188
|
+
languageChanged: {
|
|
2189
|
+
locale: SupportedLocale;
|
|
2190
|
+
};
|
|
2191
|
+
};
|
|
2192
|
+
type EventCallback<K extends keyof EventMap> = (data: EventMap[K]) => void;
|
|
2193
|
+
declare class SEPMapSDK {
|
|
2194
|
+
private root;
|
|
2195
|
+
private mapRef;
|
|
2196
|
+
private config;
|
|
2197
|
+
private events;
|
|
2198
|
+
private shadowRoot;
|
|
2199
|
+
readonly i18n: I18nManager;
|
|
2200
|
+
readonly services: {
|
|
2201
|
+
address: AddressService;
|
|
2202
|
+
perimeter: PerimeterService;
|
|
2203
|
+
config: ConfigService;
|
|
2204
|
+
};
|
|
2205
|
+
constructor(config: SEPMapConfig);
|
|
2206
|
+
private normalizeConfig;
|
|
2207
|
+
/**
|
|
2208
|
+
* Mount the map to a container element
|
|
2209
|
+
*/
|
|
2210
|
+
mount(container: string | HTMLElement): this;
|
|
2211
|
+
/**
|
|
2212
|
+
* Mount search component to external container
|
|
2213
|
+
*/
|
|
2214
|
+
mountSearch(container: string | HTMLElement): this;
|
|
2215
|
+
private render;
|
|
2216
|
+
/**
|
|
2217
|
+
* Subscribe to an event
|
|
2218
|
+
*/
|
|
2219
|
+
on<K extends keyof EventMap>(event: K, callback: EventCallback<K>): () => void;
|
|
2220
|
+
/**
|
|
2221
|
+
* Unsubscribe from an event
|
|
2222
|
+
*/
|
|
2223
|
+
off<K extends keyof EventMap>(event: K, callback: EventCallback<K>): void;
|
|
2224
|
+
/**
|
|
2225
|
+
* Subscribe to an event (fires only once)
|
|
2226
|
+
*/
|
|
2227
|
+
once<K extends keyof EventMap>(event: K, callback: EventCallback<K>): () => void;
|
|
2228
|
+
private emit;
|
|
2229
|
+
/**
|
|
2230
|
+
* Select an address programmatically
|
|
2231
|
+
*/
|
|
2232
|
+
selectAddress(idOrAddress: number | Address): Promise<Address | null>;
|
|
2233
|
+
/**
|
|
2234
|
+
* Select a perimeter programmatically
|
|
2235
|
+
*/
|
|
2236
|
+
selectPerimeter(idOrPerimeter: string | Perimeter): Promise<Perimeter | null>;
|
|
2237
|
+
/**
|
|
2238
|
+
* Get current selection
|
|
2239
|
+
*/
|
|
2240
|
+
getSelection(): SelectionItem[];
|
|
2241
|
+
/**
|
|
2242
|
+
* Clear all selections
|
|
2243
|
+
*/
|
|
2244
|
+
clearSelection(): void;
|
|
2245
|
+
/**
|
|
2246
|
+
* Add item to selection (for multi-select)
|
|
2247
|
+
*/
|
|
2248
|
+
addToSelection(item: Address | Perimeter): boolean;
|
|
2249
|
+
/**
|
|
2250
|
+
* Remove item from selection
|
|
2251
|
+
*/
|
|
2252
|
+
removeFromSelection(id: string | number): void;
|
|
2253
|
+
/**
|
|
2254
|
+
* Execute decision tree for current/given selection
|
|
2255
|
+
*/
|
|
2256
|
+
getDecisionTree(selection?: SelectionItem[]): Promise<DecisionTreeResult>;
|
|
2257
|
+
/**
|
|
2258
|
+
* Search for addresses
|
|
2259
|
+
*/
|
|
2260
|
+
searchAddress(query: string): Promise<Address[]>;
|
|
2261
|
+
/**
|
|
2262
|
+
* Get addresses within a polygon
|
|
2263
|
+
*/
|
|
2264
|
+
getAddressesInPolygon(polygon: GeoJSON.Polygon): Promise<Address[]>;
|
|
2265
|
+
/**
|
|
2266
|
+
* Pan/zoom to coordinates with optional animation options
|
|
2267
|
+
* @param lat Latitude
|
|
2268
|
+
* @param lng Longitude
|
|
2269
|
+
* @param zoom Optional zoom level
|
|
2270
|
+
* @param options Optional animation options (animate, duration, easeLinearity)
|
|
2271
|
+
*/
|
|
2272
|
+
flyTo(lat: number, lng: number, zoom?: number, options?: FlyToOptions): void;
|
|
2273
|
+
/**
|
|
2274
|
+
* Fit map to bounds
|
|
2275
|
+
*/
|
|
2276
|
+
fitBounds(bounds: [[number, number], [number, number]]): void;
|
|
2277
|
+
/**
|
|
2278
|
+
* Change language at runtime
|
|
2279
|
+
*/
|
|
2280
|
+
setLanguage(locale: SupportedLocale): void;
|
|
2281
|
+
/**
|
|
2282
|
+
* Get current language
|
|
2283
|
+
*/
|
|
2284
|
+
getLanguage(): SupportedLocale;
|
|
2285
|
+
/**
|
|
2286
|
+
* Enable/disable features at runtime
|
|
2287
|
+
*/
|
|
2288
|
+
setFeature(feature: keyof SEPMapConfig['features'], enabled: boolean): void;
|
|
2289
|
+
/**
|
|
2290
|
+
* Start polygon drawing mode
|
|
2291
|
+
*/
|
|
2292
|
+
startPolygonDraw(): void;
|
|
2293
|
+
/**
|
|
2294
|
+
* Cancel polygon drawing mode
|
|
2295
|
+
*/
|
|
2296
|
+
cancelPolygonDraw(): void;
|
|
2297
|
+
/**
|
|
2298
|
+
* Get the underlying Leaflet map instance for advanced usage.
|
|
2299
|
+
*
|
|
2300
|
+
* @returns Leaflet Map instance
|
|
2301
|
+
*
|
|
2302
|
+
* @example
|
|
2303
|
+
* ```typescript
|
|
2304
|
+
* const leafletMap = sdk.getLeafletMap();
|
|
2305
|
+
*
|
|
2306
|
+
* // Add custom Leaflet layer
|
|
2307
|
+
* const customLayer = L.tileLayer('https://{s}.tile.custom.com/{z}/{x}/{y}.png');
|
|
2308
|
+
* customLayer.addTo(leafletMap);
|
|
2309
|
+
*
|
|
2310
|
+
* // Add event listeners
|
|
2311
|
+
* leafletMap.on('click', (e) => {
|
|
2312
|
+
* console.log('Map clicked at', e.latlng);
|
|
2313
|
+
* });
|
|
2314
|
+
* ```
|
|
2315
|
+
*/
|
|
2316
|
+
getLeafletMap(): unknown;
|
|
2317
|
+
/**
|
|
2318
|
+
* Add a custom layer configuration
|
|
2319
|
+
*
|
|
2320
|
+
* @param layerConfig - Complete layer configuration
|
|
2321
|
+
*
|
|
2322
|
+
* @example
|
|
2323
|
+
* ```typescript
|
|
2324
|
+
* sdk.addLayer({
|
|
2325
|
+
* id: 'my-custom-wms',
|
|
2326
|
+
* name: 'Custom WMS Layer',
|
|
2327
|
+
* type: 'wms',
|
|
2328
|
+
* category: 'overlay',
|
|
2329
|
+
* url: 'https://my-service.com/wms',
|
|
2330
|
+
* layers: 'my-layer',
|
|
2331
|
+
* format: 'image/png',
|
|
2332
|
+
* transparent: true
|
|
2333
|
+
* });
|
|
2334
|
+
* ```
|
|
2335
|
+
*/
|
|
2336
|
+
addLayer(layerConfig: LayerConfig): void;
|
|
2337
|
+
/**
|
|
2338
|
+
* Add a WMS layer with simplified configuration
|
|
2339
|
+
*
|
|
2340
|
+
* @param options - WMS layer options
|
|
2341
|
+
*
|
|
2342
|
+
* @example
|
|
2343
|
+
* ```typescript
|
|
2344
|
+
* sdk.addWMSLayer({
|
|
2345
|
+
* id: 'my-wms',
|
|
2346
|
+
* name: 'My WMS Layer',
|
|
2347
|
+
* url: 'https://my-service.com/wms',
|
|
2348
|
+
* layers: 'layer-name',
|
|
2349
|
+
* transparent: true,
|
|
2350
|
+
* params: {
|
|
2351
|
+
* TIME: '2024-01-01',
|
|
2352
|
+
* STYLE: 'default'
|
|
2353
|
+
* }
|
|
2354
|
+
* });
|
|
2355
|
+
* ```
|
|
2356
|
+
*/
|
|
2357
|
+
addWMSLayer(options: AddWMSLayerOptions): void;
|
|
2358
|
+
/**
|
|
2359
|
+
* Add a tile layer with simplified configuration
|
|
2360
|
+
*
|
|
2361
|
+
* @param options - Tile layer options
|
|
2362
|
+
*
|
|
2363
|
+
* @example
|
|
2364
|
+
* ```typescript
|
|
2365
|
+
* sdk.addTileLayer({
|
|
2366
|
+
* id: 'my-tiles',
|
|
2367
|
+
* name: 'My Tile Layer',
|
|
2368
|
+
* url: 'https://{s}.tile.custom.com/{z}/{x}/{y}.png',
|
|
2369
|
+
* maxZoom: 19,
|
|
2370
|
+
* attribution: '© Custom Tiles'
|
|
2371
|
+
* });
|
|
2372
|
+
* ```
|
|
2373
|
+
*/
|
|
2374
|
+
addTileLayer(options: AddTileLayerOptions): void;
|
|
2375
|
+
/**
|
|
2376
|
+
* Add a GeoJSON layer with optional styling and interaction
|
|
2377
|
+
*
|
|
2378
|
+
* @param options - GeoJSON layer options
|
|
2379
|
+
*
|
|
2380
|
+
* @example
|
|
2381
|
+
* ```typescript
|
|
2382
|
+
* sdk.addGeoJSONLayer({
|
|
2383
|
+
* id: 'polygons',
|
|
2384
|
+
* name: 'Custom Polygons',
|
|
2385
|
+
* data: myGeoJSON,
|
|
2386
|
+
* style: {
|
|
2387
|
+
* color: '#ff0000',
|
|
2388
|
+
* weight: 2,
|
|
2389
|
+
* fillOpacity: 0.3
|
|
2390
|
+
* },
|
|
2391
|
+
* onClick: (feature) => {
|
|
2392
|
+
* console.log('Clicked:', feature.properties);
|
|
2393
|
+
* }
|
|
2394
|
+
* });
|
|
2395
|
+
* ```
|
|
2396
|
+
*/
|
|
2397
|
+
addGeoJSONLayer(options: AddGeoJSONLayerOptions): void;
|
|
2398
|
+
/**
|
|
2399
|
+
* Remove a layer by its ID
|
|
2400
|
+
*
|
|
2401
|
+
* @param layerId - Layer ID to remove
|
|
2402
|
+
*
|
|
2403
|
+
* @example
|
|
2404
|
+
* ```typescript
|
|
2405
|
+
* sdk.removeLayer('my-custom-layer');
|
|
2406
|
+
* ```
|
|
2407
|
+
*/
|
|
2408
|
+
removeLayer(layerId: string): void;
|
|
2409
|
+
/**
|
|
2410
|
+
* Toggle layer visibility
|
|
2411
|
+
*
|
|
2412
|
+
* @param layerId - Layer ID to toggle
|
|
2413
|
+
* @param visible - Optional explicit visibility state
|
|
2414
|
+
*
|
|
2415
|
+
* @example
|
|
2416
|
+
* ```typescript
|
|
2417
|
+
* // Toggle visibility
|
|
2418
|
+
* sdk.toggleLayer('my-layer');
|
|
2419
|
+
*
|
|
2420
|
+
* // Set explicit visibility
|
|
2421
|
+
* sdk.toggleLayer('my-layer', true); // Show
|
|
2422
|
+
* sdk.toggleLayer('my-layer', false); // Hide
|
|
2423
|
+
* ```
|
|
2424
|
+
*/
|
|
2425
|
+
toggleLayer(layerId: string, visible?: boolean): void;
|
|
2426
|
+
/**
|
|
2427
|
+
* Get all current layers
|
|
2428
|
+
*
|
|
2429
|
+
* @returns Array of layer configurations
|
|
2430
|
+
*
|
|
2431
|
+
* @example
|
|
2432
|
+
* ```typescript
|
|
2433
|
+
* const layers = sdk.getLayers();
|
|
2434
|
+
* console.log('Active layers:', layers.map(l => l.name));
|
|
2435
|
+
* ```
|
|
2436
|
+
*/
|
|
2437
|
+
getLayers(): LayerConfig[];
|
|
2438
|
+
/**
|
|
2439
|
+
* Get a specific layer by ID
|
|
2440
|
+
*
|
|
2441
|
+
* @param layerId - Layer ID to retrieve
|
|
2442
|
+
* @returns Layer configuration or undefined
|
|
2443
|
+
*
|
|
2444
|
+
* @example
|
|
2445
|
+
* ```typescript
|
|
2446
|
+
* const layer = sdk.getLayer('my-layer');
|
|
2447
|
+
* if (layer) {
|
|
2448
|
+
* console.log('Layer found:', layer.name);
|
|
2449
|
+
* }
|
|
2450
|
+
* ```
|
|
2451
|
+
*/
|
|
2452
|
+
getLayer(layerId: string): LayerConfig | undefined;
|
|
2453
|
+
/**
|
|
2454
|
+
* Destroy the SDK instance and clean up
|
|
2455
|
+
*/
|
|
2456
|
+
destroy(): void;
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
declare class SEPMapElement extends HTMLElement {
|
|
2460
|
+
private sdk;
|
|
2461
|
+
static get observedAttributes(): string[];
|
|
2462
|
+
constructor();
|
|
2463
|
+
connectedCallback(): void;
|
|
2464
|
+
disconnectedCallback(): void;
|
|
2465
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
2466
|
+
private buildConfig;
|
|
2467
|
+
private parseFeatures;
|
|
2468
|
+
private parseMapConfig;
|
|
2469
|
+
private forwardEvents;
|
|
2470
|
+
private toKebabCase;
|
|
2471
|
+
get map(): SEPMapSDK | null;
|
|
2472
|
+
selectAddress(idOrAddress: number | Parameters<SEPMapSDK['selectAddress']>[0]): Promise<Address | null> | undefined;
|
|
2473
|
+
selectPerimeter(idOrPerimeter: string | Parameters<SEPMapSDK['selectPerimeter']>[0]): Promise<Perimeter | null> | undefined;
|
|
2474
|
+
getSelection(): SelectionItem[];
|
|
2475
|
+
clearSelection(): void;
|
|
2476
|
+
setLanguage(locale: SupportedLocale): void;
|
|
2477
|
+
}
|
|
2478
|
+
declare global {
|
|
2479
|
+
interface HTMLElementTagNameMap {
|
|
2480
|
+
'sep-map': SEPMapElement;
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
export { AddressService, I18nManager, PerimeterService, SEPMapSDK, SEPMapSDK as default };
|
|
2485
|
+
export type { Address, DecisionTreeResult, FeatureConfig, MapConfig, Perimeter, SEPMapConfig, SEPMapRef, SelectionItem, SupportedLocale };
|