1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | export as namespace L;
|
15 |
|
16 | import * as geojson from 'geojson';
|
17 |
|
18 |
|
19 | export const version: string;
|
20 |
|
21 | export class Class {
|
22 | static extend(props: any): {new(...args: any[]): any} & typeof Class;
|
23 | static include(props: any): any & typeof Class;
|
24 | static mergeOptions(props: any): any & typeof Class;
|
25 |
|
26 | static addInitHook(initHookFn: () => void): any & typeof Class;
|
27 | static addInitHook(methodName: string, ...args: any[]): any & typeof Class;
|
28 | }
|
29 |
|
30 | export class Transformation {
|
31 | constructor(a: number, b: number, c: number, d: number);
|
32 | transform(point: Point, scale?: number): Point;
|
33 | untransform(point: Point, scale?: number): Point;
|
34 | }
|
35 |
|
36 | /** Instantiates a Transformation object with the given coefficients. */
|
37 | export function transformation(a: number, b: number, c: number, d: number): Transformation;
|
38 |
|
39 | /** Expects an coefficients array of the form `[a: Number, b: Number, c: Number, d: Number]`. */
|
40 | export function transformation(coefficients: [number, number, number, number]): Transformation;
|
41 |
|
42 | /**
|
43 | * @see https://github.com/Leaflet/Leaflet/blob/bc918d4bdc2ba189807bc207c77080fb41ecc196/src/geometry/LineUtil.js#L118
|
44 | */
|
45 | export namespace LineUtil {
|
46 | function simplify(points: Point[], tolerance: number): Point[];
|
47 | function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number;
|
48 | function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point;
|
49 | function isFlat(latlngs: LatLngExpression[]): boolean;
|
50 | function clipSegment(
|
51 | a: Point,
|
52 | b: Point,
|
53 | bounds: Bounds,
|
54 | useLastCode?: boolean,
|
55 | round?: boolean,
|
56 | ): [Point, Point] | false;
|
57 | }
|
58 |
|
59 | export namespace PolyUtil {
|
60 | function clipPolygon(points: Point[], bounds: BoundsExpression, round?: boolean): Point[];
|
61 | }
|
62 |
|
63 | export namespace DomUtil {
|
64 | |
65 |
|
66 |
|
67 | function get(element: string | HTMLElement): HTMLElement | null;
|
68 | function getStyle(el: HTMLElement, styleAttrib: string): string | null;
|
69 | |
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 | function create<T extends keyof HTMLElementTagNameMap>(tagName: T, className?: string, container?: HTMLElement): HTMLElementTagNameMap[T];
|
76 | function create(tagName: string, className?: string, container?: HTMLElement): HTMLElement;
|
77 | function remove(el: HTMLElement): void;
|
78 | function empty(el: HTMLElement): void;
|
79 | function toFront(el: HTMLElement): void;
|
80 | function toBack(el: HTMLElement): void;
|
81 | function hasClass(el: HTMLElement, name: string): boolean;
|
82 | function addClass(el: HTMLElement, name: string): void;
|
83 | function removeClass(el: HTMLElement, name: string): void;
|
84 | function setClass(el: HTMLElement, name: string): void;
|
85 | function getClass(el: HTMLElement): string;
|
86 | function setOpacity(el: HTMLElement, opacity: number): void;
|
87 | function testProp(props: string[]): string | false;
|
88 | function setTransform(el: HTMLElement, offset: Point, scale?: number): void;
|
89 | function setPosition(el: HTMLElement, position: Point): void;
|
90 | function getPosition(el: HTMLElement): Point;
|
91 | function disableTextSelection(): void;
|
92 | function enableTextSelection(): void;
|
93 | function disableImageDrag(): void;
|
94 | function enableImageDrag(): void;
|
95 | function preventOutline(el: HTMLElement): void;
|
96 | function restoreOutline(): void;
|
97 |
|
98 | let TRANSFORM: string;
|
99 | let TRANSITION: string;
|
100 | let TRANSITION_END: string;
|
101 | }
|
102 |
|
103 | export interface CRS {
|
104 | latLngToPoint(latlng: LatLngExpression, zoom: number): Point;
|
105 | pointToLatLng(point: PointExpression, zoom: number): LatLng;
|
106 | project(latlng: LatLng | LatLngLiteral): Point;
|
107 | unproject(point: PointExpression): LatLng;
|
108 | scale(zoom: number): number;
|
109 | zoom(scale: number): number;
|
110 | getProjectedBounds(zoom: number): Bounds;
|
111 | distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number;
|
112 | wrapLatLng(latlng: LatLng | LatLngLiteral): LatLng;
|
113 |
|
114 | code?: string | undefined;
|
115 | wrapLng?: [number, number] | undefined;
|
116 | wrapLat?: [number, number] | undefined;
|
117 | infinite: boolean;
|
118 | }
|
119 |
|
120 | export namespace CRS {
|
121 | const EPSG3395: CRS;
|
122 | const EPSG3857: CRS;
|
123 | const EPSG4326: CRS;
|
124 | const EPSG900913: CRS;
|
125 | const Earth: CRS;
|
126 | const Simple: CRS;
|
127 | }
|
128 |
|
129 | export interface Projection {
|
130 | project(latlng: LatLng | LatLngLiteral): Point;
|
131 | unproject(point: PointExpression): LatLng;
|
132 |
|
133 | bounds: Bounds;
|
134 | }
|
135 |
|
136 | export namespace Projection {
|
137 | const LonLat: Projection;
|
138 | const Mercator: Projection;
|
139 | const SphericalMercator: Projection;
|
140 | }
|
141 |
|
142 | export class LatLng {
|
143 | constructor(latitude: number, longitude: number, altitude?: number);
|
144 | equals(otherLatLng: LatLngExpression, maxMargin?: number): boolean;
|
145 | toString(): string;
|
146 | distanceTo(otherLatLng: LatLngExpression): number;
|
147 | wrap(): LatLng;
|
148 | toBounds(sizeInMeters: number): LatLngBounds;
|
149 | clone(): LatLng;
|
150 |
|
151 | lat: number;
|
152 | lng: number;
|
153 | alt?: number | undefined;
|
154 | }
|
155 |
|
156 | export interface LatLngLiteral {
|
157 | lat: number;
|
158 | lng: number;
|
159 | }
|
160 |
|
161 | export type LatLngTuple = [number, number];
|
162 |
|
163 | export type LatLngExpression = LatLng | LatLngLiteral | LatLngTuple;
|
164 |
|
165 | export function latLng(latitude: number, longitude: number, altitude?: number): LatLng;
|
166 |
|
167 | export function latLng(coords: LatLngTuple | [number, number, number] | LatLngLiteral | {lat: number, lng: number, alt?: number | undefined}): LatLng;
|
168 |
|
169 | export class LatLngBounds {
|
170 | constructor(southWest: LatLngExpression, northEast: LatLngExpression);
|
171 | constructor(latlngs: LatLngBoundsLiteral);
|
172 | extend(latlngOrBounds: LatLngExpression | LatLngBoundsExpression): this;
|
173 | pad(bufferRatio: number): LatLngBounds; // does this modify the current instance or does it return a new one?
|
174 | getCenter(): LatLng;
|
175 | getSouthWest(): LatLng;
|
176 | getNorthEast(): LatLng;
|
177 | getNorthWest(): LatLng;
|
178 | getSouthEast(): LatLng;
|
179 | getWest(): number;
|
180 | getSouth(): number;
|
181 | getEast(): number;
|
182 | getNorth(): number;
|
183 | contains(otherBoundsOrLatLng: LatLngBoundsExpression | LatLngExpression): boolean;
|
184 | intersects(otherBounds: LatLngBoundsExpression): boolean;
|
185 | overlaps(otherBounds: LatLngBoundsExpression): boolean;
|
186 | toBBoxString(): string;
|
187 | equals(otherBounds: LatLngBoundsExpression): boolean;
|
188 | isValid(): boolean;
|
189 | }
|
190 |
|
191 | export type LatLngBoundsLiteral = LatLngTuple[]; // Must be [LatLngTuple, LatLngTuple], cant't change because Map.setMaxBounds
|
192 |
|
193 | export type LatLngBoundsExpression = LatLngBounds | LatLngBoundsLiteral;
|
194 |
|
195 | export function latLngBounds(southWest: LatLngExpression, northEast: LatLngExpression): LatLngBounds;
|
196 |
|
197 | export function latLngBounds(latlngs: LatLngExpression[]): LatLngBounds;
|
198 |
|
199 | export type PointTuple = [number, number];
|
200 |
|
201 | export class Point {
|
202 | constructor(x: number, y: number, round?: boolean);
|
203 | clone(): Point;
|
204 | add(otherPoint: PointExpression): Point; // non-destructive, returns a new point
|
205 | subtract(otherPoint: PointExpression): Point;
|
206 | divideBy(num: number): Point;
|
207 | multiplyBy(num: number): Point;
|
208 | scaleBy(scale: PointExpression): Point;
|
209 | unscaleBy(scale: PointExpression): Point;
|
210 | round(): Point;
|
211 | floor(): Point;
|
212 | ceil(): Point;
|
213 | distanceTo(otherPoint: PointExpression): number;
|
214 | equals(otherPoint: PointExpression): boolean;
|
215 | contains(otherPoint: PointExpression): boolean;
|
216 | toString(): string;
|
217 | x: number;
|
218 | y: number;
|
219 | }
|
220 |
|
221 | export interface Coords extends Point {
|
222 | z: number;
|
223 | }
|
224 |
|
225 | export type PointExpression = Point | PointTuple;
|
226 |
|
227 | export function point(x: number, y: number, round?: boolean): Point;
|
228 |
|
229 | export function point(coords: PointTuple | {x: number, y: number}): Point;
|
230 |
|
231 | export type BoundsLiteral = [PointTuple, PointTuple];
|
232 |
|
233 | export class Bounds {
|
234 | constructor(topLeft: PointExpression, bottomRight: PointExpression);
|
235 | constructor(points: Point[] | BoundsLiteral);
|
236 | extend(point: PointExpression): this;
|
237 | getCenter(round?: boolean): Point;
|
238 | getBottomLeft(): Point;
|
239 | getBottomRight(): Point;
|
240 | getTopLeft(): Point;
|
241 | getTopRight(): Point;
|
242 | getSize(): Point;
|
243 | contains(pointOrBounds: BoundsExpression | PointExpression): boolean;
|
244 | intersects(otherBounds: BoundsExpression): boolean;
|
245 | overlaps(otherBounds: BoundsExpression): boolean;
|
246 |
|
247 | min?: Point | undefined;
|
248 | max?: Point | undefined;
|
249 | }
|
250 |
|
251 | export type BoundsExpression = Bounds | BoundsLiteral;
|
252 |
|
253 | export function bounds(topLeft: PointExpression, bottomRight: PointExpression): Bounds;
|
254 |
|
255 | export function bounds(points: Point[] | BoundsLiteral): Bounds;
|
256 |
|
257 | // Event handler types
|
258 |
|
259 | export type LeafletEventHandlerFn = (event: LeafletEvent) => void;
|
260 |
|
261 | export type LayersControlEventHandlerFn = (event: LayersControlEvent) => void;
|
262 |
|
263 | export type LayerEventHandlerFn = (event: LayerEvent) => void;
|
264 |
|
265 | export type ResizeEventHandlerFn = (event: ResizeEvent) => void;
|
266 |
|
267 | export type PopupEventHandlerFn = (event: PopupEvent) => void;
|
268 |
|
269 | export type TooltipEventHandlerFn = (event: TooltipEvent) => void;
|
270 |
|
271 | export type ErrorEventHandlerFn = (event: ErrorEvent) => void;
|
272 |
|
273 | export type LocationEventHandlerFn = (event: LocationEvent) => void;
|
274 |
|
275 | export type LeafletMouseEventHandlerFn = (event: LeafletMouseEvent) => void;
|
276 |
|
277 | export type LeafletKeyboardEventHandlerFn = (event: LeafletKeyboardEvent) => void;
|
278 |
|
279 | export type ZoomAnimEventHandlerFn = (event: ZoomAnimEvent) => void;
|
280 |
|
281 | export type DragEndEventHandlerFn = (event: DragEndEvent) => void;
|
282 |
|
283 | export type TileEventHandlerFn = (event: TileEvent) => void;
|
284 |
|
285 | export type TileErrorEventHandlerFn = (event: TileErrorEvent) => void;
|
286 |
|
287 | export interface LeafletEventHandlerFnMap {
|
288 | baselayerchange?: LayersControlEventHandlerFn | undefined;
|
289 | overlayadd?: LayersControlEventHandlerFn | undefined;
|
290 | overlayremove?: LayersControlEventHandlerFn | undefined;
|
291 |
|
292 | layeradd?: LayerEventHandlerFn | undefined;
|
293 | layerremove?: LayerEventHandlerFn | undefined;
|
294 |
|
295 | zoomlevelschange?: LeafletEventHandlerFn | undefined;
|
296 | unload?: LeafletEventHandlerFn | undefined;
|
297 | viewreset?: LeafletEventHandlerFn | undefined;
|
298 | load?: LeafletEventHandlerFn | undefined;
|
299 | zoomstart?: LeafletEventHandlerFn | undefined;
|
300 | movestart?: LeafletEventHandlerFn | undefined;
|
301 | zoom?: LeafletEventHandlerFn | undefined;
|
302 | move?: LeafletEventHandlerFn | undefined;
|
303 | zoomend?: LeafletEventHandlerFn | undefined;
|
304 | moveend?: LeafletEventHandlerFn | undefined;
|
305 | autopanstart?: LeafletEventHandlerFn | undefined;
|
306 | dragstart?: LeafletEventHandlerFn | undefined;
|
307 | drag?: LeafletEventHandlerFn | undefined;
|
308 | add?: LeafletEventHandlerFn | undefined;
|
309 | remove?: LeafletEventHandlerFn | undefined;
|
310 | loading?: LeafletEventHandlerFn | undefined;
|
311 | error?: LeafletEventHandlerFn | undefined;
|
312 | update?: LeafletEventHandlerFn | undefined;
|
313 | down?: LeafletEventHandlerFn | undefined;
|
314 | predrag?: LeafletEventHandlerFn | undefined;
|
315 |
|
316 | resize?: ResizeEventHandlerFn | undefined;
|
317 |
|
318 | popupopen?: PopupEventHandlerFn | undefined;
|
319 | popupclose?: PopupEventHandlerFn | undefined;
|
320 |
|
321 | tooltipopen?: TooltipEventHandlerFn | undefined;
|
322 | tooltipclose?: TooltipEventHandlerFn | undefined;
|
323 |
|
324 | locationerror?: ErrorEventHandlerFn | undefined;
|
325 |
|
326 | locationfound?: LocationEventHandlerFn | undefined;
|
327 |
|
328 | click?: LeafletMouseEventHandlerFn | undefined;
|
329 | dblclick?: LeafletMouseEventHandlerFn | undefined;
|
330 | mousedown?: LeafletMouseEventHandlerFn | undefined;
|
331 | mouseup?: LeafletMouseEventHandlerFn | undefined;
|
332 | mouseover?: LeafletMouseEventHandlerFn | undefined;
|
333 | mouseout?: LeafletMouseEventHandlerFn | undefined;
|
334 | mousemove?: LeafletMouseEventHandlerFn | undefined;
|
335 | contextmenu?: LeafletMouseEventHandlerFn | undefined;
|
336 | preclick?: LeafletMouseEventHandlerFn | undefined;
|
337 |
|
338 | keypress?: LeafletKeyboardEventHandlerFn | undefined;
|
339 | keydown?: LeafletKeyboardEventHandlerFn | undefined;
|
340 | keyup?: LeafletKeyboardEventHandlerFn | undefined;
|
341 |
|
342 | zoomanim?: ZoomAnimEventHandlerFn | undefined;
|
343 |
|
344 | dragend?: DragEndEventHandlerFn | undefined;
|
345 |
|
346 | tileunload?: TileEventHandlerFn | undefined;
|
347 | tileloadstart?: TileEventHandlerFn | undefined;
|
348 | tileload?: TileEventHandlerFn | undefined;
|
349 |
|
350 | tileerror?: TileErrorEventHandlerFn | undefined;
|
351 |
|
352 | // [name: string]: any;
|
353 | // You are able add additional properties, but it makes this interface unchackable.
|
354 | }
|
355 |
|
356 | /**
|
357 | * A set of methods shared between event-powered classes (like Map and Marker).
|
358 | * Generally, events allow you to execute some function when something happens
|
359 | * with an object (e.g. the user clicks on the map, causing the map to fire
|
360 | * 'click' event).
|
361 | */
|
362 | export abstract class Evented extends Class {
|
363 | |
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 | on(type: string, fn: LeafletEventHandlerFn, context?: any): this;
|
371 | on(type: 'baselayerchange' | 'overlayadd' | 'overlayremove',
|
372 | fn: LayersControlEventHandlerFn, context?: any): this;
|
373 | on(type: 'layeradd' | 'layerremove',
|
374 | fn: LayerEventHandlerFn, context?: any): this;
|
375 | on(type: 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' |
|
376 | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' |
|
377 | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' |
|
378 | 'down' | 'predrag',
|
379 | fn: LeafletEventHandlerFn, context?: any): this;
|
380 | on(type: 'resize',
|
381 | fn: ResizeEventHandlerFn, context?: any): this;
|
382 | on(type: 'popupopen' | 'popupclose',
|
383 | fn: PopupEventHandlerFn, context?: any): this;
|
384 | on(type: 'tooltipopen' | 'tooltipclose',
|
385 | fn: TooltipEventHandlerFn, context?: any): this;
|
386 | on(type: 'locationerror',
|
387 | fn: ErrorEventHandlerFn, context?: any): this;
|
388 | on(type: 'locationfound',
|
389 | fn: LocationEventHandlerFn, context?: any): this;
|
390 | on(type: 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' |
|
391 | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick',
|
392 | fn: LeafletMouseEventHandlerFn, context?: any): this;
|
393 | on(type: 'keypress' | 'keydown' | 'keyup',
|
394 | fn: LeafletKeyboardEventHandlerFn, context?: any): this;
|
395 | on(type: 'zoomanim',
|
396 | fn: ZoomAnimEventHandlerFn, context?: any): this;
|
397 | on(type: 'dragend',
|
398 | fn: DragEndEventHandlerFn, context?: any): this;
|
399 | on(type: 'tileunload' | 'tileloadstart' | 'tileload',
|
400 | fn: TileEventHandlerFn, context?: any): this;
|
401 | on(type: 'tileerror',
|
402 | fn: TileErrorEventHandlerFn, context?: any): this;
|
403 |
|
404 | |
405 |
|
406 |
|
407 | on(eventMap: LeafletEventHandlerFnMap): this;
|
408 |
|
409 |
|
410 | |
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 | off(type: string, fn?: LeafletEventHandlerFn, context?: any): this;
|
418 | off(type: 'baselayerchange' | 'overlayadd' | 'overlayremove',
|
419 | fn?: LayersControlEventHandlerFn, context?: any): this;
|
420 | off(type: 'layeradd' | 'layerremove',
|
421 | fn?: LayerEventHandlerFn, context?: any): this;
|
422 | off(type: 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' |
|
423 | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' |
|
424 | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' |
|
425 | 'down' | 'predrag',
|
426 | fn?: LeafletEventHandlerFn, context?: any): this;
|
427 | off(type: 'resize',
|
428 | fn?: ResizeEventHandlerFn, context?: any): this;
|
429 | off(type: 'popupopen' | 'popupclose',
|
430 | fn?: PopupEventHandlerFn, context?: any): this;
|
431 | off(type: 'tooltipopen' | 'tooltipclose',
|
432 | fn?: TooltipEventHandlerFn, context?: any): this;
|
433 | off(type: 'locationerror',
|
434 | fn?: ErrorEventHandlerFn, context?: any): this;
|
435 | off(type: 'locationfound',
|
436 | fn?: LocationEventHandlerFn, context?: any): this;
|
437 | off(type: 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' |
|
438 | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick',
|
439 | fn?: LeafletMouseEventHandlerFn, context?: any): this;
|
440 | off(type: 'keypress' | 'keydown' | 'keyup',
|
441 | fn?: LeafletKeyboardEventHandlerFn, context?: any): this;
|
442 | off(type: 'zoomanim',
|
443 | fn?: ZoomAnimEventHandlerFn, context?: any): this;
|
444 | off(type: 'dragend',
|
445 | fn?: DragEndEventHandlerFn, context?: any): this;
|
446 | off(type: 'tileunload' | 'tileloadstart' | 'tileload',
|
447 | fn?: TileEventHandlerFn, context?: any): this;
|
448 | off(type: 'tileerror',
|
449 | fn?: TileErrorEventHandlerFn, context?: any): this;
|
450 |
|
451 | |
452 |
|
453 |
|
454 |
|
455 | off(eventMap: LeafletEventHandlerFnMap): this;
|
456 |
|
457 | |
458 |
|
459 |
|
460 | off(): this;
|
461 |
|
462 |
|
463 | |
464 |
|
465 |
|
466 |
|
467 |
|
468 | fire(type: string, data?: any, propagate?: boolean): this;
|
469 |
|
470 | |
471 |
|
472 |
|
473 | listens(type: string): boolean;
|
474 |
|
475 | |
476 |
|
477 |
|
478 |
|
479 | once(type: string, fn: LeafletEventHandlerFn, context?: any): this;
|
480 | once(type: 'baselayerchange' | 'overlayadd' | 'overlayremove',
|
481 | fn: LayersControlEventHandlerFn, context?: any): this;
|
482 | once(type: 'layeradd' | 'layerremove',
|
483 | fn: LayerEventHandlerFn, context?: any): this;
|
484 | once(type: 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' |
|
485 | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' |
|
486 | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' |
|
487 | 'down' | 'predrag',
|
488 | fn: LeafletEventHandlerFn, context?: any): this;
|
489 | once(type: 'resize',
|
490 | fn: ResizeEventHandlerFn, context?: any): this;
|
491 | once(type: 'popupopen' | 'popupclose',
|
492 | fn: PopupEventHandlerFn, context?: any): this;
|
493 | once(type: 'tooltipopen' | 'tooltipclose',
|
494 | fn: TooltipEventHandlerFn, context?: any): this;
|
495 | once(type: 'locationerror',
|
496 | fn: ErrorEventHandlerFn, context?: any): this;
|
497 | once(type: 'locationfound',
|
498 | fn: LocationEventHandlerFn, context?: any): this;
|
499 | once(type: 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' |
|
500 | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick',
|
501 | fn: LeafletMouseEventHandlerFn, context?: any): this;
|
502 | once(type: 'keypress' | 'keydown' | 'keyup',
|
503 | fn: LeafletKeyboardEventHandlerFn, context?: any): this;
|
504 | once(type: 'zoomanim',
|
505 | fn: ZoomAnimEventHandlerFn, context?: any): this;
|
506 | once(type: 'dragend',
|
507 | fn: DragEndEventHandlerFn, context?: any): this;
|
508 | once(type: 'tileunload' | 'tileloadstart' | 'tileload',
|
509 | fn: TileEventHandlerFn, context?: any): this;
|
510 | once(type: 'tileerror',
|
511 | fn: TileEventHandlerFn, context?: any): this;
|
512 |
|
513 | |
514 |
|
515 |
|
516 | once(eventMap: LeafletEventHandlerFnMap): this;
|
517 |
|
518 |
|
519 | |
520 |
|
521 |
|
522 | addEventParent(obj: Evented): this;
|
523 |
|
524 | |
525 |
|
526 |
|
527 | removeEventParent(obj: Evented): this;
|
528 |
|
529 | |
530 |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 | addEventListener(type: string, fn: LeafletEventHandlerFn, context?: any): this;
|
539 | addEventListener(type: 'baselayerchange' | 'overlayadd' | 'overlayremove',
|
540 | fn: LayersControlEventHandlerFn, context?: any): this;
|
541 | addEventListener(type: 'layeradd' | 'layerremove',
|
542 | fn: LayerEventHandlerFn, context?: any): this;
|
543 | addEventListener(type: 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' |
|
544 | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' |
|
545 | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' |
|
546 | 'down' | 'predrag',
|
547 | fn: LeafletEventHandlerFn, context?: any): this;
|
548 | addEventListener(type: 'resize',
|
549 | fn: ResizeEventHandlerFn, context?: any): this;
|
550 | addEventListener(type: 'popupopen' | 'popupclose',
|
551 | fn: PopupEventHandlerFn, context?: any): this;
|
552 | addEventListener(type: 'tooltipopen' | 'tooltipclose',
|
553 | fn: TooltipEventHandlerFn, context?: any): this;
|
554 | addEventListener(type: 'locationerror',
|
555 | fn: ErrorEventHandlerFn, context?: any): this;
|
556 | addEventListener(type: 'locationfound',
|
557 | fn: LocationEventHandlerFn, context?: any): this;
|
558 | addEventListener(type: 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' |
|
559 | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick',
|
560 | fn: LeafletMouseEventHandlerFn, context?: any): this;
|
561 | addEventListener(type: 'keypress' | 'keydown' | 'keyup',
|
562 | fn: LeafletKeyboardEventHandlerFn, context?: any): this;
|
563 | addEventListener(type: 'zoomanim',
|
564 | fn: ZoomAnimEventHandlerFn, context?: any): this;
|
565 | addEventListener(type: 'dragend',
|
566 | fn: DragEndEventHandlerFn, context?: any): this;
|
567 | addEventListener(type: 'tileunload' | 'tileloadstart' | 'tileload',
|
568 | fn: TileEventHandlerFn, context?: any): this;
|
569 | addEventListener(type: 'tileerror',
|
570 | fn: TileErrorEventHandlerFn, context?: any): this;
|
571 |
|
572 | |
573 |
|
574 |
|
575 |
|
576 |
|
577 | addEventListener(eventMap: LeafletEventHandlerFnMap): this;
|
578 |
|
579 |
|
580 | |
581 |
|
582 |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 | removeEventListener(type: string, fn?: LeafletEventHandlerFn, context?: any): this;
|
590 | removeEventListener(type: 'baselayerchange' | 'overlayadd' | 'overlayremove',
|
591 | fn?: LayersControlEventHandlerFn, context?: any): this;
|
592 | removeEventListener(type: 'layeradd' | 'layerremove',
|
593 | fn?: LayerEventHandlerFn, context?: any): this;
|
594 | removeEventListener(type: 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' |
|
595 | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' |
|
596 | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' |
|
597 | 'down' | 'predrag',
|
598 | fn?: LeafletEventHandlerFn, context?: any): this;
|
599 | removeEventListener(type: 'resize',
|
600 | fn?: ResizeEventHandlerFn, context?: any): this;
|
601 | removeEventListener(type: 'popupopen' | 'popupclose',
|
602 | fn?: PopupEventHandlerFn, context?: any): this;
|
603 | removeEventListener(type: 'tooltipopen' | 'tooltipclose',
|
604 | fn?: TooltipEventHandlerFn, context?: any): this;
|
605 | removeEventListener(type: 'locationerror',
|
606 | fn?: ErrorEventHandlerFn, context?: any): this;
|
607 | removeEventListener(type: 'locationfound',
|
608 | fn?: LocationEventHandlerFn, context?: any): this;
|
609 | removeEventListener(type: 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' |
|
610 | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick',
|
611 | fn?: LeafletMouseEventHandlerFn, context?: any): this;
|
612 | removeEventListener(type: 'keypress' | 'keydown' | 'keyup',
|
613 | fn?: LeafletKeyboardEventHandlerFn, context?: any): this;
|
614 | removeEventListener(type: 'zoomanim',
|
615 | fn?: ZoomAnimEventHandlerFn, context?: any): this;
|
616 | removeEventListener(type: 'dragend',
|
617 | fn?: DragEndEventHandlerFn, context?: any): this;
|
618 | removeEventListener(type: 'tileunload' | 'tileloadstart' | 'tileload',
|
619 | fn?: TileEventHandlerFn, context?: any): this;
|
620 | removeEventListener(type: 'tileerror',
|
621 | fn?: TileErrorEventHandlerFn, context?: any): this;
|
622 |
|
623 | |
624 |
|
625 |
|
626 |
|
627 |
|
628 | removeEventListener(eventMap: LeafletEventHandlerFnMap): this;
|
629 |
|
630 |
|
631 | |
632 |
|
633 |
|
634 |
|
635 |
|
636 | clearAllEventListeners(): this;
|
637 |
|
638 | |
639 |
|
640 |
|
641 |
|
642 |
|
643 |
|
644 | addOneTimeEventListener(type: string, fn: LeafletEventHandlerFn, context?: any): this;
|
645 | addOneTimeEventListener(type: 'baselayerchange' | 'overlayadd' | 'overlayremove',
|
646 | fn: LayersControlEventHandlerFn, context?: any): this;
|
647 | addOneTimeEventListener(type: 'layeradd' | 'layerremove',
|
648 | fn: LayerEventHandlerFn, context?: any): this;
|
649 | addOneTimeEventListener(type: 'zoomlevelschange' | 'unload' | 'viewreset' | 'load' | 'zoomstart' |
|
650 | 'movestart' | 'zoom' | 'move' | 'zoomend' | 'moveend' | 'autopanstart' |
|
651 | 'dragstart' | 'drag' | 'add' | 'remove' | 'loading' | 'error' | 'update' |
|
652 | 'down' | 'predrag',
|
653 | fn: LeafletEventHandlerFn, context?: any): this;
|
654 | addOneTimeEventListener(type: 'resize',
|
655 | fn: ResizeEventHandlerFn, context?: any): this;
|
656 | addOneTimeEventListener(type: 'popupopen' | 'popupclose',
|
657 | fn: PopupEventHandlerFn, context?: any): this;
|
658 | addOneTimeEventListener(type: 'tooltipopen' | 'tooltipclose',
|
659 | fn: TooltipEventHandlerFn, context?: any): this;
|
660 | addOneTimeEventListener(type: 'locationerror',
|
661 | fn: ErrorEventHandlerFn, context?: any): this;
|
662 | addOneTimeEventListener(type: 'locationfound',
|
663 | fn: LocationEventHandlerFn, context?: any): this;
|
664 | addOneTimeEventListener(type: 'click' | 'dblclick' | 'mousedown' | 'mouseup' | 'mouseover' |
|
665 | 'mouseout' | 'mousemove' | 'contextmenu' | 'preclick',
|
666 | fn: LeafletMouseEventHandlerFn, context?: any): this;
|
667 | addOneTimeEventListener(type: 'keypress' | 'keydown' | 'keyup',
|
668 | fn: LeafletKeyboardEventHandlerFn, context?: any): this;
|
669 | addOneTimeEventListener(type: 'zoomanim',
|
670 | fn: ZoomAnimEventHandlerFn, context?: any): this;
|
671 | addOneTimeEventListener(type: 'dragend',
|
672 | fn: DragEndEventHandlerFn, context?: any): this;
|
673 | addOneTimeEventListener(type: 'tileunload' | 'tileloadstart' | 'tileload',
|
674 | fn: TileEventHandlerFn, context?: any): this;
|
675 | addOneTimeEventListener(type: 'tileerror',
|
676 | fn: TileErrorEventHandlerFn, context?: any): this;
|
677 |
|
678 | |
679 |
|
680 |
|
681 |
|
682 |
|
683 | addOneTimeEventListener(eventMap: LeafletEventHandlerFnMap): this;
|
684 |
|
685 |
|
686 | |
687 |
|
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 | fireEvent(type: string, data?: any, propagate?: boolean): this;
|
694 |
|
695 | |
696 |
|
697 |
|
698 |
|
699 |
|
700 | hasEventListeners(type: string): boolean;
|
701 | }
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 | export class Draggable extends Evented {
|
709 | constructor(element: HTMLElement, dragStartTarget?: HTMLElement, preventOutline?: boolean);
|
710 |
|
711 | enable(): void;
|
712 |
|
713 | disable(): void;
|
714 |
|
715 | finishDrag(): void;
|
716 | }
|
717 |
|
718 | export interface LayerOptions {
|
719 | pane?: string | undefined;
|
720 | attribution?: string | undefined;
|
721 | }
|
722 |
|
723 | export interface InteractiveLayerOptions extends LayerOptions {
|
724 | interactive?: boolean | undefined;
|
725 | bubblingMouseEvents?: boolean | undefined;
|
726 | }
|
727 |
|
728 | export class Layer extends Evented {
|
729 | constructor(options?: LayerOptions);
|
730 | addTo(map: Map|LayerGroup): this;
|
731 | remove(): this;
|
732 | removeFrom(map: Map): this;
|
733 | getPane(name?: string): HTMLElement | undefined;
|
734 |
|
735 | // Popup methods
|
736 | bindPopup(content: ((layer: Layer) => Content) | Content | Popup, options?: PopupOptions): this;
|
737 | unbindPopup(): this;
|
738 | openPopup(latlng?: LatLngExpression): this;
|
739 | closePopup(): this;
|
740 | togglePopup(): this;
|
741 | isPopupOpen(): boolean;
|
742 | setPopupContent(content: Content | Popup): this;
|
743 | getPopup(): Popup | undefined;
|
744 |
|
745 | // Tooltip methods
|
746 | bindTooltip(content: ((layer: Layer) => Content) | Tooltip | Content, options?: TooltipOptions): this;
|
747 | unbindTooltip(): this;
|
748 | openTooltip(latlng?: LatLngExpression): this;
|
749 | closeTooltip(): this;
|
750 | toggleTooltip(): this;
|
751 | isTooltipOpen(): boolean;
|
752 | setTooltipContent(content: Content | Tooltip): this;
|
753 | getTooltip(): Tooltip | undefined;
|
754 |
|
755 | // Extension methods
|
756 | onAdd(map: Map): this;
|
757 | onRemove(map: Map): this;
|
758 | getEvents?(): {[name: string]: LeafletEventHandlerFn};
|
759 | getAttribution?(): string | null;
|
760 | beforeAdd?(map: Map): this;
|
761 |
|
762 | protected _map: Map;
|
763 | }
|
764 |
|
765 | export interface GridLayerOptions {
|
766 | tileSize?: number | Point | undefined;
|
767 | opacity?: number | undefined;
|
768 | updateWhenIdle?: boolean | undefined;
|
769 | updateWhenZooming?: boolean | undefined;
|
770 | updateInterval?: number | undefined;
|
771 | attribution?: string | undefined;
|
772 | zIndex?: number | undefined;
|
773 | bounds?: LatLngBoundsExpression | undefined;
|
774 | minZoom?: number | undefined;
|
775 | maxZoom?: number | undefined;
|
776 | |
777 |
|
778 |
|
779 |
|
780 | maxNativeZoom?: number | undefined;
|
781 | |
782 |
|
783 |
|
784 |
|
785 | minNativeZoom?: number | undefined;
|
786 | noWrap?: boolean | undefined;
|
787 | pane?: string | undefined;
|
788 | className?: string | undefined;
|
789 | keepBuffer?: number | undefined;
|
790 | }
|
791 |
|
792 | export type DoneCallback = (error?: Error, tile?: HTMLElement) => void;
|
793 |
|
794 | export interface InternalTiles {
|
795 | [key: string]: {
|
796 | active?: boolean | undefined,
|
797 | coords: Coords,
|
798 | current: boolean,
|
799 | el: HTMLElement,
|
800 | loaded?: Date | undefined,
|
801 | retain?: boolean | undefined,
|
802 | };
|
803 | }
|
804 |
|
805 | export class GridLayer extends Layer {
|
806 | constructor(options?: GridLayerOptions);
|
807 | bringToFront(): this;
|
808 | bringToBack(): this;
|
809 | getContainer(): HTMLElement | null;
|
810 | setOpacity(opacity: number): this;
|
811 | setZIndex(zIndex: number): this;
|
812 | isLoading(): boolean;
|
813 | redraw(): this;
|
814 | getTileSize(): Point;
|
815 |
|
816 | protected createTile(coords: Coords, done: DoneCallback): HTMLElement;
|
817 | protected _tileCoordsToKey(coords: Coords): string;
|
818 | protected _wrapCoords(parameter: Coords): Coords;
|
819 |
|
820 | protected _tiles: InternalTiles;
|
821 | protected _tileZoom?: number | undefined;
|
822 | }
|
823 |
|
824 | export function gridLayer(options?: GridLayerOptions): GridLayer;
|
825 |
|
826 | export interface TileLayerOptions extends GridLayerOptions {
|
827 | id?: string | undefined;
|
828 | accessToken?: string | undefined;
|
829 | minZoom?: number | undefined;
|
830 | maxZoom?: number | undefined;
|
831 | maxNativeZoom?: number | undefined;
|
832 | minNativeZoom?: number | undefined;
|
833 | subdomains?: string | string[] | undefined;
|
834 | errorTileUrl?: string | undefined;
|
835 | zoomOffset?: number | undefined;
|
836 | tms?: boolean | undefined;
|
837 | zoomReverse?: boolean | undefined;
|
838 | detectRetina?: boolean | undefined;
|
839 | crossOrigin?: CrossOrigin | undefined;
|
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 | }
|
846 |
|
847 | export class TileLayer extends GridLayer {
|
848 | constructor(urlTemplate: string, options?: TileLayerOptions);
|
849 | setUrl(url: string, noRedraw?: boolean): this;
|
850 | getTileUrl(coords: L.Coords): string;
|
851 |
|
852 | protected _tileOnLoad(done: L.DoneCallback, tile: HTMLElement): void;
|
853 | protected _tileOnError(done: L.DoneCallback, tile: HTMLElement, e: Error): void;
|
854 | protected _abortLoading(): void;
|
855 | protected _getZoomForUrl(): number;
|
856 |
|
857 | options: TileLayerOptions;
|
858 | }
|
859 |
|
860 | export function tileLayer(urlTemplate: string, options?: TileLayerOptions): TileLayer;
|
861 |
|
862 | export namespace TileLayer {
|
863 | class WMS extends TileLayer {
|
864 | constructor(baseUrl: string, options: WMSOptions);
|
865 | setParams(params: WMSParams, noRedraw?: boolean): this;
|
866 |
|
867 | wmsParams: WMSParams;
|
868 | options: WMSOptions;
|
869 | }
|
870 | }
|
871 |
|
872 | export interface WMSOptions extends TileLayerOptions {
|
873 | layers?: string | undefined;
|
874 | styles?: string | undefined;
|
875 | format?: string | undefined;
|
876 | transparent?: boolean | undefined;
|
877 | version?: string | undefined;
|
878 | crs?: CRS | undefined;
|
879 | uppercase?: boolean | undefined;
|
880 | }
|
881 |
|
882 | export interface WMSParams {
|
883 | format?: string | undefined;
|
884 | layers: string;
|
885 | request?: string | undefined;
|
886 | service?: string | undefined;
|
887 | styles?: string | undefined;
|
888 | version?: string | undefined;
|
889 | transparent?: boolean | undefined;
|
890 | width?: number | undefined;
|
891 | height?: number | undefined;
|
892 | }
|
893 |
|
894 | export namespace tileLayer {
|
895 | function wms(baseUrl: string, options?: WMSOptions): TileLayer.WMS;
|
896 | }
|
897 |
|
898 | export type CrossOrigin = boolean | string;
|
899 |
|
900 | export interface ImageOverlayOptions extends InteractiveLayerOptions {
|
901 | opacity?: number | undefined;
|
902 | alt?: string | undefined;
|
903 | interactive?: boolean | undefined;
|
904 | attribution?: string | undefined;
|
905 | crossOrigin?: CrossOrigin | undefined;
|
906 | errorOverlayUrl?: string | undefined;
|
907 | zIndex?: number | undefined;
|
908 | className?: string | undefined;
|
909 | }
|
910 |
|
911 | export class ImageOverlay extends Layer {
|
912 | constructor(imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions);
|
913 | setOpacity(opacity: number): this;
|
914 | bringToFront(): this;
|
915 | bringToBack(): this;
|
916 | setUrl(url: string): this;
|
917 |
|
918 | /** Update the bounds that this ImageOverlay covers */
|
919 | setBounds(bounds: LatLngBounds): this;
|
920 |
|
921 | /** Changes the zIndex of the image overlay */
|
922 | setZIndex(value: number): this;
|
923 |
|
924 | /** Get the bounds that this ImageOverlay covers */
|
925 | getBounds(): LatLngBounds;
|
926 |
|
927 | /** Get the img element that represents the ImageOverlay on the map */
|
928 | getElement(): HTMLImageElement | undefined;
|
929 |
|
930 | options: ImageOverlayOptions;
|
931 | }
|
932 |
|
933 | export function imageOverlay(imageUrl: string, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions): ImageOverlay;
|
934 |
|
935 | export class SVGOverlay extends Layer {
|
936 | constructor(svgImage: string | SVGElement, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions);
|
937 | setOpacity(opacity: number): this;
|
938 | bringToFront(): this;
|
939 | bringToBack(): this;
|
940 | setUrl(url: string): this;
|
941 |
|
942 | /** Update the bounds that this SVGOverlay covers */
|
943 | setBounds(bounds: LatLngBounds): this;
|
944 |
|
945 | /** Changes the zIndex of the image overlay */
|
946 | setZIndex(value: number): this;
|
947 |
|
948 | /** Get the bounds that this SVGOverlay covers */
|
949 | getBounds(): LatLngBounds;
|
950 |
|
951 | /** Get the img element that represents the SVGOverlay on the map */
|
952 | getElement(): SVGElement | undefined;
|
953 |
|
954 | options: ImageOverlayOptions;
|
955 | }
|
956 |
|
957 | export function svgOverlay(svgImage: string | SVGElement, bounds: LatLngBoundsExpression, options?: ImageOverlayOptions): SVGOverlay;
|
958 |
|
959 | export interface VideoOverlayOptions extends ImageOverlayOptions {
|
960 |
|
961 | autoplay?: boolean | undefined;
|
962 |
|
963 | loop?: boolean | undefined;
|
964 | |
965 |
|
966 |
|
967 |
|
968 | keepAspectRatio?: boolean | undefined;
|
969 |
|
970 | muted?: boolean | undefined;
|
971 | }
|
972 |
|
973 | export class VideoOverlay extends Layer {
|
974 | constructor(video: string | string[] | HTMLVideoElement, bounds: LatLngBoundsExpression, options?: VideoOverlayOptions);
|
975 | setOpacity(opacity: number): this;
|
976 | bringToFront(): this;
|
977 | bringToBack(): this;
|
978 | setUrl(url: string): this;
|
979 |
|
980 | /** Update the bounds that this VideoOverlay covers */
|
981 | setBounds(bounds: LatLngBounds): this;
|
982 |
|
983 | /** Get the bounds that this VideoOverlay covers */
|
984 | getBounds(): LatLngBounds;
|
985 |
|
986 | /** Get the video element that represents the VideoOverlay on the map */
|
987 | getElement(): HTMLVideoElement | undefined;
|
988 |
|
989 | options: VideoOverlayOptions;
|
990 | }
|
991 |
|
992 | export function videoOverlay(video: string | string[] | HTMLVideoElement, bounds: LatLngBoundsExpression, options?: VideoOverlayOptions): VideoOverlay;
|
993 |
|
994 | export type LineCapShape = 'butt' | 'round' | 'square' | 'inherit';
|
995 |
|
996 | export type LineJoinShape = 'miter' | 'round' | 'bevel' | 'inherit';
|
997 |
|
998 | export type FillRule = 'nonzero' | 'evenodd' | 'inherit';
|
999 |
|
1000 | export interface PathOptions extends InteractiveLayerOptions {
|
1001 | stroke?: boolean | undefined;
|
1002 | color?: string | undefined;
|
1003 | weight?: number | undefined;
|
1004 | opacity?: number | undefined;
|
1005 | lineCap?: LineCapShape | undefined;
|
1006 | lineJoin?: LineJoinShape | undefined;
|
1007 | dashArray?: string | number[] | undefined;
|
1008 | dashOffset?: string | undefined;
|
1009 | fill?: boolean | undefined;
|
1010 | fillColor?: string | undefined;
|
1011 | fillOpacity?: number | undefined;
|
1012 | fillRule?: FillRule | undefined;
|
1013 | renderer?: Renderer | undefined;
|
1014 | className?: string | undefined;
|
1015 | }
|
1016 |
|
1017 | export abstract class Path extends Layer {
|
1018 | redraw(): this;
|
1019 | setStyle(style: PathOptions): this;
|
1020 | bringToFront(): this;
|
1021 | bringToBack(): this;
|
1022 | getElement(): Element | undefined;
|
1023 |
|
1024 | options: PathOptions;
|
1025 | }
|
1026 |
|
1027 | export interface PolylineOptions extends PathOptions {
|
1028 | smoothFactor?: number | undefined;
|
1029 | noClip?: boolean | undefined;
|
1030 | }
|
1031 |
|
1032 | export class Polyline<T extends geojson.GeometryObject = geojson.LineString | geojson.MultiLineString, P = any> extends Path {
|
1033 | constructor(latlngs: LatLngExpression[] | LatLngExpression[][], options?: PolylineOptions);
|
1034 | toGeoJSON(precision?: number): geojson.Feature<T, P>;
|
1035 | getLatLngs(): LatLng[] | LatLng[][] | LatLng[][][];
|
1036 | setLatLngs(latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][]): this;
|
1037 | isEmpty(): boolean;
|
1038 | getCenter(): LatLng;
|
1039 | getBounds(): LatLngBounds;
|
1040 | addLatLng(latlng: LatLngExpression | LatLngExpression[], latlngs?: LatLng[]): this;
|
1041 | closestLayerPoint(p: Point): Point;
|
1042 |
|
1043 | feature?: geojson.Feature<T, P> | undefined;
|
1044 | options: PolylineOptions;
|
1045 | }
|
1046 |
|
1047 | export function polyline(latlngs: LatLngExpression[] | LatLngExpression[][], options?: PolylineOptions): Polyline;
|
1048 |
|
1049 | export class Polygon<P = any> extends Polyline<geojson.Polygon | geojson.MultiPolygon, P> {
|
1050 | constructor(latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][], options?: PolylineOptions);
|
1051 | }
|
1052 |
|
1053 | export function polygon(latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][], options?: PolylineOptions): Polygon;
|
1054 |
|
1055 | export class Rectangle<P = any> extends Polygon<P> {
|
1056 | constructor(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions);
|
1057 | setBounds(latLngBounds: LatLngBoundsExpression): this;
|
1058 | }
|
1059 |
|
1060 | export function rectangle(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions): Rectangle;
|
1061 |
|
1062 | export interface CircleMarkerOptions extends PathOptions {
|
1063 | radius?: number | undefined;
|
1064 | }
|
1065 |
|
1066 | export class CircleMarker<P = any> extends Path {
|
1067 | constructor(latlng: LatLngExpression, options?: CircleMarkerOptions);
|
1068 | toGeoJSON(precision?: number): geojson.Feature<geojson.Point, P>;
|
1069 | setLatLng(latLng: LatLngExpression): this;
|
1070 | getLatLng(): LatLng;
|
1071 | setRadius(radius: number): this;
|
1072 | getRadius(): number;
|
1073 |
|
1074 | options: CircleMarkerOptions;
|
1075 | feature?: geojson.Feature<geojson.Point, P> | undefined;
|
1076 | }
|
1077 |
|
1078 | export function circleMarker(latlng: LatLngExpression, options?: CircleMarkerOptions): CircleMarker;
|
1079 |
|
1080 | export class Circle<P = any> extends CircleMarker<P> {
|
1081 | constructor(latlng: LatLngExpression, options?: CircleMarkerOptions);
|
1082 | constructor(latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions); // deprecated!
|
1083 | getBounds(): LatLngBounds;
|
1084 | }
|
1085 |
|
1086 | export function circle(latlng: LatLngExpression, options?: CircleMarkerOptions): Circle;
|
1087 | export function circle(latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions): Circle; // deprecated!
|
1088 |
|
1089 | export interface RendererOptions extends LayerOptions {
|
1090 | padding?: number | undefined;
|
1091 | tolerance?: number | undefined;
|
1092 | }
|
1093 |
|
1094 | export class Renderer extends Layer {
|
1095 | constructor(options?: RendererOptions);
|
1096 |
|
1097 | options: RendererOptions;
|
1098 | }
|
1099 |
|
1100 | export class SVG extends Renderer {}
|
1101 |
|
1102 | export namespace SVG {
|
1103 | function create(name: string): SVGElement;
|
1104 |
|
1105 | function pointsToPath(rings: PointExpression[], close: boolean): string;
|
1106 | }
|
1107 |
|
1108 | export function svg(options?: RendererOptions): SVG;
|
1109 |
|
1110 | export class Canvas extends Renderer {}
|
1111 |
|
1112 | export function canvas(options?: RendererOptions): Canvas;
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 |
|
1119 | export class LayerGroup<P = any> extends Layer {
|
1120 | constructor(layers?: Layer[], options?: LayerOptions);
|
1121 |
|
1122 | /**
|
1123 | * Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint).
|
1124 | */
|
1125 | toGeoJSON(precision?: number): geojson.FeatureCollection<geojson.GeometryObject, P> | geojson.Feature<geojson.MultiPoint, P> | geojson.GeometryCollection;
|
1126 |
|
1127 | /**
|
1128 | * Adds the given layer to the group.
|
1129 | */
|
1130 | addLayer(layer: Layer): this;
|
1131 |
|
1132 | /**
|
1133 | * Removes the layer with the given internal ID or the given layer from the group.
|
1134 | */
|
1135 | removeLayer(layer: number | Layer): this;
|
1136 |
|
1137 | /**
|
1138 | * Returns true if the given layer is currently added to the group.
|
1139 | */
|
1140 | hasLayer(layer: Layer): boolean;
|
1141 |
|
1142 | /**
|
1143 | * Removes all the layers from the group.
|
1144 | */
|
1145 | clearLayers(): this;
|
1146 |
|
1147 | /**
|
1148 | * Calls methodName on every layer contained in this group, passing any additional parameters.
|
1149 | * Has no effect if the layers contained do not implement methodName.
|
1150 | */
|
1151 | invoke(methodName: string, ...params: any[]): this;
|
1152 |
|
1153 | /**
|
1154 | * Iterates over the layers of the group,
|
1155 | * optionally specifying context of the iterator function.
|
1156 | */
|
1157 | eachLayer(fn: (layer: Layer) => void, context?: any): this;
|
1158 |
|
1159 | /**
|
1160 | * Returns the layer with the given internal ID.
|
1161 | */
|
1162 | getLayer(id: number): Layer | undefined;
|
1163 |
|
1164 | /**
|
1165 | * Returns an array of all the layers added to the group.
|
1166 | */
|
1167 | getLayers(): Layer[];
|
1168 |
|
1169 | /**
|
1170 | * Calls setZIndex on every layer contained in this group, passing the z-index.
|
1171 | */
|
1172 | setZIndex(zIndex: number): this;
|
1173 |
|
1174 | /**
|
1175 | * Returns the internal ID for a layer
|
1176 | */
|
1177 | getLayerId(layer: Layer): number;
|
1178 |
|
1179 | feature?: geojson.FeatureCollection<geojson.GeometryObject, P> | geojson.Feature<geojson.MultiPoint, P> | geojson.GeometryCollection | undefined;
|
1180 | }
|
1181 |
|
1182 | /**
|
1183 | * Create a layer group, optionally given an initial set of layers and an `options` object.
|
1184 | */
|
1185 | export function layerGroup(layers?: Layer[], options?: LayerOptions): LayerGroup;
|
1186 |
|
1187 | /**
|
1188 | * Extended LayerGroup that also has mouse events (propagated from
|
1189 | * members of the group) and a shared bindPopup method.
|
1190 | */
|
1191 | export class FeatureGroup<P = any> extends LayerGroup<P> {
|
1192 | |
1193 |
|
1194 |
|
1195 | setStyle(style: PathOptions): this;
|
1196 |
|
1197 | |
1198 |
|
1199 |
|
1200 | bringToFront(): this;
|
1201 |
|
1202 | |
1203 |
|
1204 |
|
1205 | bringToBack(): this;
|
1206 |
|
1207 | |
1208 |
|
1209 |
|
1210 |
|
1211 | getBounds(): LatLngBounds;
|
1212 | }
|
1213 |
|
1214 |
|
1215 |
|
1216 |
|
1217 | export function featureGroup(layers?: Layer[], options?: LayerOptions): FeatureGroup;
|
1218 |
|
1219 | export type StyleFunction<P = any> = (feature?: geojson.Feature<geojson.GeometryObject, P>) => PathOptions;
|
1220 |
|
1221 | export interface GeoJSONOptions<P = any> extends InteractiveLayerOptions {
|
1222 | |
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 | pointToLayer?(geoJsonPoint: geojson.Feature<geojson.Point, P>, latlng: LatLng): Layer;
|
1236 |
|
1237 | |
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 | style?: PathOptions | StyleFunction<P> | undefined;
|
1250 |
|
1251 | |
1252 |
|
1253 |
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 | onEachFeature?(feature: geojson.Feature<geojson.GeometryObject, P>, layer: Layer): void;
|
1262 |
|
1263 | |
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 | filter?(geoJsonFeature: geojson.Feature<geojson.GeometryObject, P>): boolean;
|
1275 |
|
1276 | |
1277 |
|
1278 |
|
1279 |
|
1280 | coordsToLatLng?(coords: [number, number] | [number, number, number]): LatLng;
|
1281 |
|
1282 |
|
1283 | markersInheritOptions?: boolean | undefined;
|
1284 | }
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 | export class GeoJSON<P = any> extends FeatureGroup<P> {
|
1291 | |
1292 |
|
1293 |
|
1294 |
|
1295 | static geometryToLayer<P = any>(featureData: geojson.Feature<geojson.GeometryObject, P>, options?: GeoJSONOptions<P>): Layer;
|
1296 |
|
1297 | |
1298 |
|
1299 |
|
1300 |
|
1301 | static coordsToLatLng(coords: [number, number] | [number, number, number]): LatLng;
|
1302 |
|
1303 | |
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 | static coordsToLatLngs(
|
1310 | coords: any[],
|
1311 | levelsDeep?: number,
|
1312 | coordsToLatLng?: (coords: [number, number] | [number, number, number]) => LatLng): any[];
|
1313 |
|
1314 | |
1315 |
|
1316 |
|
1317 | static latLngToCoords(latlng: LatLng): [number, number] | [number, number, number];
|
1318 |
|
1319 | |
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 | static latLngsToCoords(latlngs: any[], levelsDeep?: number, closed?: boolean): any[];
|
1325 |
|
1326 | |
1327 |
|
1328 |
|
1329 | static asFeature<P = any>(geojson: geojson.Feature<geojson.GeometryObject, P> | geojson.GeometryObject): geojson.Feature<geojson.GeometryObject, P>;
|
1330 |
|
1331 | constructor(geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions<P>)
|
1332 | /**
|
1333 | * Adds a GeoJSON object to the layer.
|
1334 | */
|
1335 | addData(data: geojson.GeoJsonObject): this;
|
1336 |
|
1337 | /**
|
1338 | * Resets the given vector layer's style to the original GeoJSON style,
|
1339 | * useful for resetting style after hover events.
|
1340 | */
|
1341 | resetStyle(layer?: Layer): this;
|
1342 |
|
1343 | /**
|
1344 | * Same as FeatureGroup's setStyle method, but style-functions are also
|
1345 | * allowed here to set the style according to the feature.
|
1346 | */
|
1347 | setStyle(style: PathOptions | StyleFunction<P>): this;
|
1348 |
|
1349 | options: GeoJSONOptions<P>;
|
1350 | }
|
1351 |
|
1352 | /**
|
1353 | * Creates a GeoJSON layer.
|
1354 | *
|
1355 | * Optionally accepts an object in GeoJSON format to display on the
|
1356 | * map (you can alternatively add it later with addData method) and
|
1357 | * an options object.
|
1358 | */
|
1359 | export function geoJSON<P = any>(geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions<P>): GeoJSON<P>;
|
1360 |
|
1361 | export type Zoom = boolean | 'center';
|
1362 |
|
1363 | export interface MapOptions {
|
1364 | preferCanvas?: boolean | undefined;
|
1365 |
|
1366 |
|
1367 | attributionControl?: boolean | undefined;
|
1368 | zoomControl?: boolean | undefined;
|
1369 |
|
1370 |
|
1371 | closePopupOnClick?: boolean | undefined;
|
1372 | zoomSnap?: number | undefined;
|
1373 | zoomDelta?: number | undefined;
|
1374 | trackResize?: boolean | undefined;
|
1375 | boxZoom?: boolean | undefined;
|
1376 | doubleClickZoom?: Zoom | undefined;
|
1377 | dragging?: boolean | undefined;
|
1378 |
|
1379 |
|
1380 | crs?: CRS | undefined;
|
1381 | center?: LatLngExpression | undefined;
|
1382 | zoom?: number | undefined;
|
1383 | minZoom?: number | undefined;
|
1384 | maxZoom?: number | undefined;
|
1385 | layers?: Layer[] | undefined;
|
1386 | maxBounds?: LatLngBoundsExpression | undefined;
|
1387 | renderer?: Renderer | undefined;
|
1388 |
|
1389 |
|
1390 | fadeAnimation?: boolean | undefined;
|
1391 | markerZoomAnimation?: boolean | undefined;
|
1392 | transform3DLimit?: number | undefined;
|
1393 | zoomAnimation?: boolean | undefined;
|
1394 | zoomAnimationThreshold?: number | undefined;
|
1395 |
|
1396 |
|
1397 | inertia?: boolean | undefined;
|
1398 | inertiaDeceleration?: number | undefined;
|
1399 | inertiaMaxSpeed?: number | undefined;
|
1400 | easeLinearity?: number | undefined;
|
1401 | worldCopyJump?: boolean | undefined;
|
1402 | maxBoundsViscosity?: number | undefined;
|
1403 |
|
1404 |
|
1405 | keyboard?: boolean | undefined;
|
1406 | keyboardPanDelta?: number | undefined;
|
1407 |
|
1408 |
|
1409 | scrollWheelZoom?: Zoom | undefined;
|
1410 | wheelDebounceTime?: number | undefined;
|
1411 | wheelPxPerZoomLevel?: number | undefined;
|
1412 |
|
1413 |
|
1414 | tap?: boolean | undefined;
|
1415 | tapTolerance?: number | undefined;
|
1416 | touchZoom?: Zoom | undefined;
|
1417 | bounceAtZoomLimits?: boolean | undefined;
|
1418 | }
|
1419 |
|
1420 | export type ControlPosition = 'topleft' | 'topright' | 'bottomleft' | 'bottomright';
|
1421 |
|
1422 | export interface ControlOptions {
|
1423 | position?: ControlPosition | undefined;
|
1424 | }
|
1425 |
|
1426 | export class Control extends Class {
|
1427 | static extend<T extends object>(props: T): {new(...args: any[]): T} & typeof Control;
|
1428 | constructor(options?: ControlOptions);
|
1429 | getPosition(): ControlPosition;
|
1430 | setPosition(position: ControlPosition): this;
|
1431 | getContainer(): HTMLElement | undefined;
|
1432 | addTo(map: Map): this;
|
1433 | remove(): this;
|
1434 |
|
1435 | // Extension methods
|
1436 | onAdd?(map: Map): HTMLElement;
|
1437 | onRemove?(map: Map): void;
|
1438 |
|
1439 | options: ControlOptions;
|
1440 | }
|
1441 |
|
1442 | export namespace Control {
|
1443 | interface ZoomOptions extends ControlOptions {
|
1444 | zoomInText?: string | undefined;
|
1445 | zoomInTitle?: string | undefined;
|
1446 | zoomOutText?: string | undefined;
|
1447 | zoomOutTitle?: string | undefined;
|
1448 | }
|
1449 |
|
1450 | class Zoom extends Control {
|
1451 | constructor(options?: ZoomOptions);
|
1452 | options: ZoomOptions;
|
1453 | }
|
1454 |
|
1455 | interface AttributionOptions extends ControlOptions {
|
1456 | prefix?: string | boolean | undefined;
|
1457 | }
|
1458 |
|
1459 | class Attribution extends Control {
|
1460 | constructor(options?: AttributionOptions);
|
1461 | setPrefix(prefix: string | false): this;
|
1462 | addAttribution(text: string): this;
|
1463 | removeAttribution(text: string): this;
|
1464 | options: AttributionOptions;
|
1465 | }
|
1466 |
|
1467 | interface LayersOptions extends ControlOptions {
|
1468 | collapsed?: boolean | undefined;
|
1469 | autoZIndex?: boolean | undefined;
|
1470 | hideSingleBase?: boolean | undefined;
|
1471 | |
1472 |
|
1473 |
|
1474 | sortLayers?: boolean | undefined;
|
1475 | |
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 | sortFunction?: ((layerA: Layer, layerB: Layer, nameA: string, nameB: string) => number) | undefined;
|
1482 | }
|
1483 |
|
1484 | interface LayersObject {
|
1485 | [name: string]: Layer;
|
1486 | }
|
1487 |
|
1488 | class Layers extends Control {
|
1489 | constructor(baseLayers?: LayersObject, overlays?: LayersObject, options?: LayersOptions);
|
1490 | addBaseLayer(layer: Layer, name: string): this;
|
1491 | addOverlay(layer: Layer, name: string): this;
|
1492 | removeLayer(layer: Layer): this;
|
1493 | expand(): this;
|
1494 | collapse(): this;
|
1495 | options: LayersOptions;
|
1496 | }
|
1497 |
|
1498 | interface ScaleOptions extends ControlOptions {
|
1499 | maxWidth?: number | undefined;
|
1500 | metric?: boolean | undefined;
|
1501 | imperial?: boolean | undefined;
|
1502 | updateWhenIdle?: boolean | undefined;
|
1503 | }
|
1504 |
|
1505 | class Scale extends Control {
|
1506 | constructor(options?: ScaleOptions);
|
1507 | options: ScaleOptions;
|
1508 | }
|
1509 | }
|
1510 |
|
1511 | export namespace control {
|
1512 | function zoom(options?: Control.ZoomOptions): Control.Zoom;
|
1513 |
|
1514 | function attribution(options?: Control.AttributionOptions): Control.Attribution;
|
1515 |
|
1516 | function layers(baseLayers?: Control.LayersObject, overlays?: Control.LayersObject, options?: Control.LayersOptions): Control.Layers;
|
1517 |
|
1518 | function scale(options?: Control.ScaleOptions): Control.Scale;
|
1519 | }
|
1520 |
|
1521 | export interface DivOverlayOptions {
|
1522 | offset?: PointExpression | undefined;
|
1523 | zoomAnimation?: boolean | undefined;
|
1524 | className?: string | undefined;
|
1525 | pane?: string | undefined;
|
1526 | }
|
1527 |
|
1528 | export abstract class DivOverlay extends Layer {
|
1529 | constructor(options?: DivOverlayOptions, source?: Layer);
|
1530 | getLatLng(): LatLng | undefined;
|
1531 | setLatLng(latlng: LatLngExpression): this;
|
1532 | getContent(): Content | ((source: Layer) => Content) | undefined;
|
1533 | setContent(htmlContent: ((source: Layer) => Content) | Content): this;
|
1534 | getElement(): HTMLElement | undefined;
|
1535 | update(): void;
|
1536 | isOpen(): boolean;
|
1537 | bringToFront(): this;
|
1538 | bringToBack(): this;
|
1539 |
|
1540 | options: DivOverlayOptions;
|
1541 | }
|
1542 |
|
1543 | export interface PopupOptions extends DivOverlayOptions {
|
1544 | maxWidth?: number | undefined;
|
1545 | minWidth?: number | undefined;
|
1546 | maxHeight?: number | undefined;
|
1547 | keepInView?: boolean | undefined;
|
1548 | closeButton?: boolean | undefined;
|
1549 | autoPan?: boolean | undefined;
|
1550 | autoPanPaddingTopLeft?: PointExpression | undefined;
|
1551 | autoPanPaddingBottomRight?: PointExpression | undefined;
|
1552 | autoPanPadding?: PointExpression | undefined;
|
1553 | autoClose?: boolean | undefined;
|
1554 | closeOnClick?: boolean | undefined;
|
1555 | closeOnEscapeKey?: boolean | undefined;
|
1556 | }
|
1557 |
|
1558 | export type Content = string | HTMLElement;
|
1559 |
|
1560 | export class Popup extends DivOverlay {
|
1561 | constructor(options?: PopupOptions, source?: Layer);
|
1562 | openOn(map: Map): this;
|
1563 |
|
1564 | options: PopupOptions;
|
1565 | }
|
1566 |
|
1567 | export function popup(options?: PopupOptions, source?: Layer): Popup;
|
1568 |
|
1569 | export type Direction = 'right' | 'left' | 'top' | 'bottom' | 'center' | 'auto';
|
1570 |
|
1571 | export interface TooltipOptions extends DivOverlayOptions {
|
1572 | pane?: string | undefined;
|
1573 | offset?: PointExpression | undefined;
|
1574 | direction?: Direction | undefined;
|
1575 | permanent?: boolean | undefined;
|
1576 | sticky?: boolean | undefined;
|
1577 | interactive?: boolean | undefined;
|
1578 | opacity?: number | undefined;
|
1579 | }
|
1580 |
|
1581 | export class Tooltip extends DivOverlay {
|
1582 | constructor(options?: TooltipOptions, source?: Layer);
|
1583 | setOpacity(val: number): void;
|
1584 |
|
1585 | options: TooltipOptions;
|
1586 | }
|
1587 |
|
1588 | export function tooltip(options?: TooltipOptions, source?: Layer): Tooltip;
|
1589 |
|
1590 | export interface ZoomOptions {
|
1591 | animate?: boolean | undefined;
|
1592 | }
|
1593 |
|
1594 | export interface PanOptions {
|
1595 | animate?: boolean | undefined;
|
1596 | duration?: number | undefined;
|
1597 | easeLinearity?: number | undefined;
|
1598 | noMoveStart?: boolean | undefined;
|
1599 | }
|
1600 |
|
1601 | // This is not empty, it extends two interfaces into one...
|
1602 | export interface ZoomPanOptions extends ZoomOptions, PanOptions {}
|
1603 |
|
1604 | export interface InvalidateSizeOptions extends ZoomPanOptions {
|
1605 | debounceMoveend?: boolean | undefined;
|
1606 | pan?: boolean | undefined;
|
1607 | }
|
1608 |
|
1609 | export interface FitBoundsOptions extends ZoomOptions, PanOptions {
|
1610 | paddingTopLeft?: PointExpression | undefined;
|
1611 | paddingBottomRight?: PointExpression | undefined;
|
1612 | padding?: PointExpression | undefined;
|
1613 | maxZoom?: number | undefined;
|
1614 | }
|
1615 |
|
1616 | export interface PanInsideOptions {
|
1617 | paddingTopLeft?: PointExpression | undefined;
|
1618 | paddingBottomRight?: PointExpression | undefined;
|
1619 | padding?: PointExpression | undefined;
|
1620 | }
|
1621 |
|
1622 | export interface LocateOptions {
|
1623 | watch?: boolean | undefined;
|
1624 | setView?: boolean | undefined;
|
1625 | maxZoom?: number | undefined;
|
1626 | timeout?: number | undefined;
|
1627 | maximumAge?: number | undefined;
|
1628 | enableHighAccuracy?: boolean | undefined;
|
1629 | }
|
1630 |
|
1631 | export class Handler extends Class {
|
1632 | constructor(map: Map);
|
1633 | enable(): this;
|
1634 | disable(): this;
|
1635 | enabled(): boolean;
|
1636 |
|
1637 | // Extension methods
|
1638 | addHooks?(): void;
|
1639 | removeHooks?(): void;
|
1640 | }
|
1641 |
|
1642 | export interface LeafletEvent {
|
1643 | type: string;
|
1644 | target: any;
|
1645 | sourceTarget: any;
|
1646 | propagatedFrom: any;
|
1647 | /**
|
1648 | * @deprecated The same as {@link LeafletEvent.propagatedFrom propagatedFrom}.
|
1649 | */
|
1650 | layer: any;
|
1651 | }
|
1652 |
|
1653 | export interface LeafletMouseEvent extends LeafletEvent {
|
1654 | latlng: LatLng;
|
1655 | layerPoint: Point;
|
1656 | containerPoint: Point;
|
1657 | originalEvent: MouseEvent;
|
1658 | }
|
1659 |
|
1660 | export interface LeafletKeyboardEvent extends LeafletEvent {
|
1661 | originalEvent: KeyboardEvent;
|
1662 | }
|
1663 |
|
1664 | export interface LocationEvent extends LeafletEvent {
|
1665 | latlng: LatLng;
|
1666 | bounds: LatLngBounds;
|
1667 | accuracy: number;
|
1668 | altitude: number;
|
1669 | altitudeAccuracy: number;
|
1670 | heading: number;
|
1671 | speed: number;
|
1672 | timestamp: number;
|
1673 | }
|
1674 |
|
1675 | export interface ErrorEvent extends LeafletEvent {
|
1676 | message: string;
|
1677 | code: number;
|
1678 | }
|
1679 |
|
1680 | export interface LayerEvent extends LeafletEvent {
|
1681 | layer: Layer;
|
1682 | }
|
1683 |
|
1684 | export interface LayersControlEvent extends LayerEvent {
|
1685 | name: string;
|
1686 | }
|
1687 |
|
1688 | export interface TileEvent extends LeafletEvent {
|
1689 | tile: HTMLImageElement;
|
1690 | coords: Coords;
|
1691 | }
|
1692 |
|
1693 | export interface TileErrorEvent extends TileEvent {
|
1694 | error: Error;
|
1695 | }
|
1696 |
|
1697 | export interface ResizeEvent extends LeafletEvent {
|
1698 | oldSize: Point;
|
1699 | newSize: Point;
|
1700 | }
|
1701 |
|
1702 | export interface GeoJSONEvent extends LeafletEvent {
|
1703 | layer: Layer;
|
1704 | properties: any;
|
1705 | geometryType: string;
|
1706 | id: string;
|
1707 | }
|
1708 |
|
1709 | export interface PopupEvent extends LeafletEvent {
|
1710 | popup: Popup;
|
1711 | }
|
1712 |
|
1713 | export interface TooltipEvent extends LeafletEvent {
|
1714 | tooltip: Tooltip;
|
1715 | }
|
1716 |
|
1717 | export interface DragEndEvent extends LeafletEvent {
|
1718 | distance: number;
|
1719 | }
|
1720 |
|
1721 | export interface ZoomAnimEvent extends LeafletEvent {
|
1722 | center: LatLng;
|
1723 | zoom: number;
|
1724 | noUpdate: boolean;
|
1725 | }
|
1726 |
|
1727 | export namespace DomEvent {
|
1728 | type EventHandlerFn = (event: Event) => void;
|
1729 |
|
1730 | type PropagableEvent = LeafletMouseEvent | LeafletKeyboardEvent | LeafletEvent | Event;
|
1731 |
|
1732 | function on(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent;
|
1733 |
|
1734 | function on(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent;
|
1735 |
|
1736 | function off(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent;
|
1737 |
|
1738 | function off(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent;
|
1739 |
|
1740 | function stopPropagation(ev: PropagableEvent): typeof DomEvent;
|
1741 |
|
1742 | function disableScrollPropagation(el: HTMLElement): typeof DomEvent;
|
1743 |
|
1744 | function disableClickPropagation(el: HTMLElement): typeof DomEvent;
|
1745 |
|
1746 | function preventDefault(ev: Event): typeof DomEvent;
|
1747 |
|
1748 | function stop(ev: PropagableEvent): typeof DomEvent;
|
1749 |
|
1750 | function getMousePosition(ev: MouseEvent, container?: HTMLElement): Point;
|
1751 |
|
1752 | function getWheelDelta(ev: Event): number;
|
1753 |
|
1754 | function addListener(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent;
|
1755 |
|
1756 | function addListener(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent;
|
1757 |
|
1758 | function removeListener(el: HTMLElement, types: string, fn: EventHandlerFn, context?: any): typeof DomEvent;
|
1759 |
|
1760 | function removeListener(el: HTMLElement, eventMap: {[eventName: string]: EventHandlerFn}, context?: any): typeof DomEvent;
|
1761 | }
|
1762 |
|
1763 | export interface DefaultMapPanes {
|
1764 | mapPane: HTMLElement;
|
1765 | tilePane: HTMLElement;
|
1766 | overlayPane: HTMLElement;
|
1767 | shadowPane: HTMLElement;
|
1768 | markerPane: HTMLElement;
|
1769 | tooltipPane: HTMLElement;
|
1770 | popupPane: HTMLElement;
|
1771 | }
|
1772 |
|
1773 | export class Map extends Evented {
|
1774 | constructor(element: string | HTMLElement, options?: MapOptions);
|
1775 | getRenderer(layer: Path): Renderer;
|
1776 |
|
1777 | // Methods for layers and controls
|
1778 | addControl(control: Control): this;
|
1779 | removeControl(control: Control): this;
|
1780 | addLayer(layer: Layer): this;
|
1781 | removeLayer(layer: Layer): this;
|
1782 | hasLayer(layer: Layer): boolean;
|
1783 | eachLayer(fn: (layer: Layer) => void, context?: any): this;
|
1784 | openPopup(popup: Popup): this;
|
1785 | openPopup(content: Content, latlng: LatLngExpression, options?: PopupOptions): this;
|
1786 | closePopup(popup?: Popup): this;
|
1787 | openTooltip(tooltip: Tooltip): this;
|
1788 | openTooltip(content: Content, latlng: LatLngExpression, options?: TooltipOptions): this;
|
1789 | closeTooltip(tooltip?: Tooltip): this;
|
1790 |
|
1791 | // Methods for modifying map state
|
1792 | setView(center: LatLngExpression, zoom?: number, options?: ZoomPanOptions): this;
|
1793 | setZoom(zoom: number, options?: ZoomPanOptions): this;
|
1794 | zoomIn(delta?: number, options?: ZoomOptions): this;
|
1795 | zoomOut(delta?: number, options?: ZoomOptions): this;
|
1796 | setZoomAround(position: Point | LatLngExpression, zoom: number, options?: ZoomOptions): this;
|
1797 | fitBounds(bounds: LatLngBoundsExpression, options?: FitBoundsOptions): this;
|
1798 | fitWorld(options?: FitBoundsOptions): this;
|
1799 | panTo(latlng: LatLngExpression, options?: PanOptions): this;
|
1800 | panBy(offset: PointExpression, options?: PanOptions): this;
|
1801 | setMaxBounds(bounds: LatLngBoundsExpression): this;
|
1802 | setMinZoom(zoom: number): this;
|
1803 | setMaxZoom(zoom: number): this;
|
1804 | panInside(latLng: LatLngExpression, options?: PanInsideOptions): this;
|
1805 | panInsideBounds(bounds: LatLngBoundsExpression, options?: PanOptions): this;
|
1806 | /**
|
1807 | * Boolean for animate or advanced ZoomPanOptions
|
1808 | */
|
1809 | invalidateSize(options?: boolean | InvalidateSizeOptions): this;
|
1810 | stop(): this;
|
1811 | flyTo(latlng: LatLngExpression, zoom?: number, options?: ZoomPanOptions): this;
|
1812 | flyToBounds(bounds: LatLngBoundsExpression, options?: FitBoundsOptions): this;
|
1813 |
|
1814 | // Other methods
|
1815 | addHandler(name: string, HandlerClass: typeof Handler): this; // Alternatively, HandlerClass: new(map: Map) => Handler
|
1816 | remove(): this;
|
1817 | createPane(name: string, container?: HTMLElement): HTMLElement;
|
1818 | /**
|
1819 | * Name of the pane or the pane as HTML-Element
|
1820 | */
|
1821 | getPane(pane: string | HTMLElement): HTMLElement | undefined;
|
1822 | getPanes(): {[name: string]: HTMLElement} & DefaultMapPanes;
|
1823 | getContainer(): HTMLElement;
|
1824 | whenReady(fn: () => void, context?: any): this;
|
1825 |
|
1826 |
|
1827 | getCenter(): LatLng;
|
1828 | getZoom(): number;
|
1829 | getBounds(): LatLngBounds;
|
1830 | getMinZoom(): number;
|
1831 | getMaxZoom(): number;
|
1832 | getBoundsZoom(bounds: LatLngBoundsExpression, inside?: boolean, padding?: Point): number;
|
1833 | getSize(): Point;
|
1834 | getPixelBounds(): Bounds;
|
1835 | getPixelOrigin(): Point;
|
1836 | getPixelWorldBounds(zoom?: number): Bounds;
|
1837 |
|
1838 |
|
1839 | getZoomScale(toZoom: number, fromZoom?: number): number;
|
1840 | getScaleZoom(scale: number, fromZoom?: number): number;
|
1841 | project(latlng: LatLngExpression, zoom?: number): Point;
|
1842 | unproject(point: PointExpression, zoom?: number): LatLng;
|
1843 | layerPointToLatLng(point: PointExpression): LatLng;
|
1844 | latLngToLayerPoint(latlng: LatLngExpression): Point;
|
1845 | wrapLatLng(latlng: LatLngExpression): LatLng;
|
1846 | wrapLatLngBounds(bounds: LatLngBounds): LatLngBounds;
|
1847 | distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number;
|
1848 | containerPointToLayerPoint(point: PointExpression): Point;
|
1849 | containerPointToLatLng(point: PointExpression): LatLng;
|
1850 | layerPointToContainerPoint(point: PointExpression): Point;
|
1851 | latLngToContainerPoint(latlng: LatLngExpression): Point;
|
1852 | mouseEventToContainerPoint(ev: MouseEvent): Point;
|
1853 | mouseEventToLayerPoint(ev: MouseEvent): Point;
|
1854 | mouseEventToLatLng(ev: MouseEvent): LatLng;
|
1855 |
|
1856 |
|
1857 | locate(options?: LocateOptions): this;
|
1858 | stopLocate(): this;
|
1859 |
|
1860 |
|
1861 | attributionControl: L.Control.Attribution;
|
1862 | boxZoom: Handler;
|
1863 | doubleClickZoom: Handler;
|
1864 | dragging: Handler;
|
1865 | keyboard: Handler;
|
1866 | scrollWheelZoom: Handler;
|
1867 | tap?: Handler | undefined;
|
1868 | touchZoom: Handler;
|
1869 | zoomControl: Control.Zoom;
|
1870 |
|
1871 | options: MapOptions;
|
1872 | }
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 | export function map(element: string | HTMLElement, options?: MapOptions): Map;
|
1878 |
|
1879 | export interface BaseIconOptions extends LayerOptions {
|
1880 | iconUrl?: string | undefined;
|
1881 | iconRetinaUrl?: string | undefined;
|
1882 | iconSize?: PointExpression | undefined;
|
1883 | iconAnchor?: PointExpression | undefined;
|
1884 | popupAnchor?: PointExpression | undefined;
|
1885 | tooltipAnchor?: PointExpression | undefined;
|
1886 | shadowUrl?: string | undefined;
|
1887 | shadowRetinaUrl?: string | undefined;
|
1888 | shadowSize?: PointExpression | undefined;
|
1889 | shadowAnchor?: PointExpression | undefined;
|
1890 | className?: string | undefined;
|
1891 | }
|
1892 |
|
1893 | export interface IconOptions extends BaseIconOptions {
|
1894 | iconUrl: string;
|
1895 | }
|
1896 |
|
1897 | export class Icon<T extends BaseIconOptions = IconOptions> extends Layer {
|
1898 | constructor(options: T);
|
1899 | createIcon(oldIcon?: HTMLElement): HTMLElement;
|
1900 | createShadow(oldIcon?: HTMLElement): HTMLElement;
|
1901 |
|
1902 | options: T;
|
1903 | }
|
1904 |
|
1905 | export namespace Icon {
|
1906 | interface DefaultIconOptions extends BaseIconOptions {
|
1907 | imagePath?: string | undefined;
|
1908 | }
|
1909 |
|
1910 | class Default extends Icon<DefaultIconOptions> {
|
1911 | static imagePath?: string | undefined;
|
1912 | constructor(options?: DefaultIconOptions);
|
1913 | }
|
1914 | }
|
1915 |
|
1916 | export function icon(options: IconOptions): Icon;
|
1917 |
|
1918 | export interface DivIconOptions extends BaseIconOptions {
|
1919 | html?: string | HTMLElement | false | undefined;
|
1920 | bgPos?: PointExpression | undefined;
|
1921 | iconSize?: PointExpression | undefined;
|
1922 | iconAnchor?: PointExpression | undefined;
|
1923 | popupAnchor?: PointExpression | undefined;
|
1924 | className?: string | undefined;
|
1925 | }
|
1926 |
|
1927 | export class DivIcon extends Icon<DivIconOptions> {
|
1928 | constructor(options?: DivIconOptions);
|
1929 | }
|
1930 |
|
1931 | export function divIcon(options?: DivIconOptions): DivIcon;
|
1932 |
|
1933 | export interface MarkerOptions extends InteractiveLayerOptions {
|
1934 | icon?: Icon | DivIcon | undefined;
|
1935 |
|
1936 | draggable?: boolean | undefined;
|
1937 |
|
1938 | keyboard?: boolean | undefined;
|
1939 |
|
1940 | title?: string | undefined;
|
1941 |
|
1942 | alt?: string | undefined;
|
1943 |
|
1944 | zIndexOffset?: number | undefined;
|
1945 |
|
1946 | opacity?: number | undefined;
|
1947 |
|
1948 | riseOnHover?: boolean | undefined;
|
1949 |
|
1950 | riseOffset?: number | undefined;
|
1951 |
|
1952 | shadowPane?: string | undefined;
|
1953 |
|
1954 | autoPan?: boolean | undefined;
|
1955 |
|
1956 | autoPanPadding?: PointExpression | undefined;
|
1957 |
|
1958 | autoPanSpeed?: number | undefined;
|
1959 | }
|
1960 |
|
1961 | export class Marker<P = any> extends Layer {
|
1962 | constructor(latlng: LatLngExpression, options?: MarkerOptions);
|
1963 | toGeoJSON(precision?: number): geojson.Feature<geojson.Point, P>;
|
1964 | getLatLng(): LatLng;
|
1965 | setLatLng(latlng: LatLngExpression): this;
|
1966 | setZIndexOffset(offset: number): this;
|
1967 | getIcon(): Icon | DivIcon;
|
1968 | setIcon(icon: Icon | DivIcon): this;
|
1969 | setOpacity(opacity: number): this;
|
1970 | getElement(): HTMLElement | undefined;
|
1971 |
|
1972 | // Properties
|
1973 | options: MarkerOptions;
|
1974 | dragging?: Handler | undefined;
|
1975 | feature?: geojson.Feature<geojson.Point, P> | undefined;
|
1976 |
|
1977 | protected _shadow: HTMLElement | undefined;
|
1978 | }
|
1979 |
|
1980 | export function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker;
|
1981 |
|
1982 | export namespace Browser {
|
1983 |
|
1984 | const ie: boolean;
|
1985 | const ielt9: boolean;
|
1986 | const edge: boolean;
|
1987 | const webkit: boolean;
|
1988 | const android: boolean;
|
1989 | const android23: boolean;
|
1990 | const androidStock: boolean;
|
1991 | const opera: boolean;
|
1992 | const chrome: boolean;
|
1993 | const gecko: boolean;
|
1994 | const safari: boolean;
|
1995 | const opera12: boolean;
|
1996 | const win: boolean;
|
1997 | const ie3d: boolean;
|
1998 | const webkit3d: boolean;
|
1999 | const gecko3d: boolean;
|
2000 | const any3d: boolean;
|
2001 | const mobile: boolean;
|
2002 | const mobileWebkit: boolean;
|
2003 | const mobileWebkit3d: boolean;
|
2004 | const msPointer: boolean;
|
2005 | const pointer: boolean;
|
2006 | const touch: boolean;
|
2007 | const mobileOpera: boolean;
|
2008 | const mobileGecko: boolean;
|
2009 | const retina: boolean;
|
2010 | const canvas: boolean;
|
2011 | const svg: boolean;
|
2012 | const vml: boolean;
|
2013 | }
|
2014 |
|
2015 | export namespace Util {
|
2016 | function extend<D extends object, S1 extends object = {}>(dest: D, src?: S1): D & S1;
|
2017 | function extend<D extends object, S1 extends object, S2 extends object>(dest: D, src1: S1, src2: S2): D & S1 & S2;
|
2018 | function extend<D extends object, S1 extends object, S2 extends object, S3 extends object>(dest: D, src1: S1, src2: S2, src3: S3): D & S1 & S2 & S3;
|
2019 | function extend(dest: any, ...src: any[]): any;
|
2020 |
|
2021 | function create(proto: object | null, properties?: PropertyDescriptorMap): any;
|
2022 | function bind(fn: (...args: any[]) => void, ...obj: any[]): () => void;
|
2023 | function stamp(obj: any): number;
|
2024 | function throttle(fn: () => void, time: number, context: any): () => void;
|
2025 | function wrapNum(num: number, range: number[], includeMax?: boolean): number;
|
2026 | function falseFn(): false;
|
2027 | function formatNum(num: number, digits?: number): number;
|
2028 | function trim(str: string): string;
|
2029 | function splitWords(str: string): string[];
|
2030 | function setOptions(obj: any, options: any): any;
|
2031 | function getParamString(obj: any, existingUrl?: string, uppercase?: boolean): string;
|
2032 | function template(str: string, data: any): string;
|
2033 | function isArray(obj: any): boolean;
|
2034 | function indexOf(array: any[], el: any): number;
|
2035 | function requestAnimFrame(fn: (timestamp: number) => void, context?: any, immediate?: boolean): number;
|
2036 | function cancelAnimFrame(id: number): void;
|
2037 |
|
2038 | let lastId: number;
|
2039 | let emptyImageUrl: string;
|
2040 | }
|
2041 |
|
2042 | export const extend: typeof Util['extend'];
|
2043 | export const bind: typeof Util['bind'];
|
2044 | export const stamp: typeof Util['stamp'];
|
2045 | export const setOptions: typeof Util['setOptions'];
|