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