forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaflet.d.ts
executable file
·4352 lines (3568 loc) · 133 KB
/
leaflet.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for Leaflet.js 0.7.3
// Project: https://github.com/Leaflet/Leaflet
// Definitions by: Vladimir Zotov <https://github.com/rgripper>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module L {
type LatLngExpression = LatLng | number[] | ({ lat: number; lng: number })
type LatLngBoundsExpression = LatLngBounds | LatLngExpression[];
}
declare module L {
export interface AttributionOptions {
/**
* The position of the control (one of the map corners). See control positions.
* Default value: 'bottomright'.
*/
position?: string;
/**
* The HTML text shown before the attributions. Pass false to disable.
* Default value: 'Powered by Leaflet'.
*/
prefix?: string;
}
}
declare module L {
/**
* Creates a Bounds object from two coordinates (usually top-left and bottom-right
* corners).
*/
export function bounds(topLeft: Point, bottomRight: Point): Bounds;
/**
* Creates a Bounds object defined by the points it contains.
*/
export function bounds(points: Point[]): Bounds;
export interface BoundsStatic extends ClassStatic {
/**
* Creates a Bounds object from two coordinates (usually top-left and bottom-right
* corners).
*/
new(topLeft: Point, bottomRight: Point): Bounds;
/**
* Creates a Bounds object defined by the points it contains.
*/
new(points: Point[]): Bounds;
}
export var Bounds: BoundsStatic;
export interface Bounds {
/**
* Extends the bounds to contain the given point.
*/
extend(point: Point): void;
/**
* Returns the center point of the bounds.
*/
getCenter(): Point;
/**
* Returns true if the rectangle contains the given one.
*/
contains(otherBounds: Bounds): boolean;
/**
* Returns true if the rectangle contains the given point.
*/
contains(point: Point): boolean;
/**
* Returns true if the rectangle intersects the given bounds.
*/
intersects(otherBounds: Bounds): boolean;
/**
* Returns true if the bounds are properly initialized.
*/
isValid(): boolean;
/**
* Returns the size of the given bounds.
*/
getSize(): Point;
/**
* The top left corner of the rectangle.
*/
min: Point;
/**
* The bottom right corner of the rectangle.
*/
max: Point;
}
}
declare module L {
module Browser {
/**
* true for all Internet Explorer versions.
*/
export var ie: boolean;
/**
* true for Internet Explorer 6.
*/
export var ie6: boolean;
/**
* true for Internet Explorer 6.
*/
export var ie7: boolean;
/**
* true for webkit-based browsers like Chrome and Safari (including mobile
* versions).
*/
export var webkit: boolean;
/**
* true for webkit-based browsers that support CSS 3D transformations.
*/
export var webkit3d: boolean;
/**
* true for Android mobile browser.
*/
export var android: boolean;
/**
* true for old Android stock browsers (2 and 3).
*/
export var android23: boolean;
/**
* true for modern mobile browsers (including iOS Safari and different Android
* browsers).
*/
export var mobile: boolean;
/**
* true for mobile webkit-based browsers.
*/
export var mobileWebkit: boolean;
/**
* true for mobile Opera.
*/
export var mobileOpera: boolean;
/**
* true for all browsers on touch devices.
*/
export var touch: boolean;
/**
* true for browsers with Microsoft touch model (e.g. IE10).
*/
export var msTouch: boolean;
/**
* true for devices with Retina screens.
*/
export var retina: boolean;
}
}
declare module L {
/**
* Instantiates a circle object given a geographical point, a radius in meters
* and optionally an options object.
*/
function circle(latlng: LatLngExpression, radius: number, options?: PathOptions): Circle;
export interface CircleStatic extends ClassStatic {
/**
* Instantiates a circle object given a geographical point, a radius in meters
* and optionally an options object.
*/
new(latlng: LatLngExpression, radius: number, options?: PathOptions): Circle;
}
export var Circle: CircleStatic;
export interface Circle extends Path {
/**
* Returns the current geographical position of the circle.
*/
getLatLng(): LatLng;
/**
* Returns the current radius of a circle. Units are in meters.
*/
getRadius(): number;
/**
* Sets the position of a circle to a new location.
*/
setLatLng(latlng: LatLngExpression): Circle;
/**
* Sets the radius of a circle. Units are in meters.
*/
setRadius(radius: number): Circle;
/**
* Returns a GeoJSON representation of the circle (GeoJSON Point Feature).
*/
toGeoJSON(): any;
}
}
declare module L {
/**
* Instantiates a circle marker given a geographical point and optionally
* an options object. The default radius is 10 and can be altered by passing a
* "radius" member in the path options object.
*/
function circleMarker(latlng: LatLngExpression, options?: PathOptions): CircleMarker;
export interface CircleMarkerStatic extends ClassStatic {
/**
* Instantiates a circle marker given a geographical point and optionally
* an options object. The default radius is 10 and can be altered by passing a
* "radius" member in the path options object.
*/
new(latlng: LatLngExpression, options?: PathOptions): CircleMarker;
}
export var CircleMarker: CircleMarkerStatic;
export interface CircleMarker extends Circle {
/**
* Sets the position of a circle marker to a new location.
*/
setLatLng(latlng: LatLngExpression): CircleMarker;
/**
* Sets the radius of a circle marker. Units are in pixels.
*/
setRadius(radius: number): CircleMarker;
/**
* Returns a GeoJSON representation of the circle marker (GeoJSON Point Feature).
*/
toGeoJSON(): any;
}
}
declare module L {
export interface ClassExtendOptions {
/**
* Your class's constructor function, meaning that it gets called when you do 'new MyClass(...)'.
*/
initialize?: Function;
/**
* options is a special property that unlike other objects that you pass
* to extend will be merged with the parent one instead of overriding it
* completely, which makes managing configuration of objects and default
* values convenient.
*/
options?: any;
/**
* includes is a special class property that merges all specified objects
* into the class (such objects are called mixins). A good example of this
* is L.Mixin.Events that event-related methods like on, off and fire
* to the class.
*/
includes?: any;
/**
* statics is just a convenience property that injects specified object
* properties as the static properties of the class, useful for defining
* constants.
*/
static?: any;
[prop: string]: any;
}
export interface ClassStatic {
/**
* You use L.Class.extend to define new classes, but you can use the
* same method on any class to inherit from it.
*/
extend(options: ClassExtendOptions): any;
extend<Options, NewClass>(options: ClassExtendOptions): { new(options?: Options): NewClass };
/**
* You can also use the following shortcut when you just need to make
* one additional method call.
*/
addInitHook(methodName: string, ...args: any[]): void;
}
/**
* L.Class powers the OOP facilities of Leaflet and is used to create
* almost all of the Leaflet classes documented.
*/
module Class {
/**
* You use L.Class.extend to define new classes, but you can use the
* same method on any class to inherit from it.
*/
function extend(options: ClassExtendOptions): any;
}
}
declare module L {
export interface ControlStatic extends ClassStatic {
/**
* Creates a control with the given options.
*/
new(options?: ControlOptions): Control;
Zoom: Control.ZoomStatic;
Attribution: Control.AttributionStatic;
Layers: Control.LayersStatic;
Scale: Control.ScaleStatic;
}
export var Control: ControlStatic;
export interface Control extends IControl {
/**
* Sets the position of the control. See control positions.
*/
setPosition(position: string): Control;
/**
* Returns the current position of the control.
*/
getPosition(): string;
/**
* Adds the control to the map.
*/
addTo(map: Map): Control;
/**
* Removes the control from the map.
*/
removeFrom(map: Map): Control;
/**
* Returns the HTML container of the control.
*/
getContainer(): HTMLElement;
// IControl members
/**
* Should contain code that creates all the neccessary DOM elements for the
* control, adds listeners on relevant map events, and returns the element
* containing the control. Called on map.addControl(control) or control.addTo(map).
*/
onAdd(map: Map): HTMLElement;
/**
* Optional, should contain all clean up code (e.g. removes control's event
* listeners). Called on map.removeControl(control) or control.removeFrom(map).
* The control's DOM container is removed automatically.
*/
onRemove(map: Map): void;
}
namespace Control {
export interface ZoomStatic extends ClassStatic {
/**
* Creates a zoom control.
*/
new (options?: ZoomOptions): Zoom;
}
export interface Zoom extends L.Control {
}
export interface ZoomOptions {
/**
* The position of the control (one of the map corners).
* Can be 'topleft', 'topright', 'bottomleft', or 'bottomright'.
*
* Default value: 'topright'.
*/
position?: string; // 'topleft' | 'topright' | 'bottomleft' | 'bottomright'
/**
* The text set on the zoom in button.
*
* Default value: '+'
*/
zoomInText?: string;
/**
* The text set on the zoom out button.
*
* Default value: '-'
*/
zoomOutText?: string;
/**
* The title set on the zoom in button.
*
* Default value: 'Zoom in'
*/
zoomInTitle?: string;
/**
* The title set on the zoom out button.
*
* Default value: 'Zoom out'
*/
zoomOutTitle?: string;
}
export interface AttributionStatic extends ClassStatic {
/**
* Creates an attribution control.
*/
new(options?: AttributionOptions): Attribution;
}
export interface Attribution extends L.Control {
/**
* Sets the text before the attributions.
*/
setPrefix(prefix: string): Attribution;
/**
* Adds an attribution text (e.g. 'Vector data © CloudMade').
*/
addAttribution(text: string): Attribution;
/**
* Removes an attribution text.
*/
removeAttribution(text: string): Attribution;
}
export interface LayersStatic extends ClassStatic {
/**
* Creates an attribution control with the given layers. Base layers will be
* switched with radio buttons, while overlays will be switched with checkboxes.
*/
new(baseLayers?: any, overlays?: any, options?: LayersOptions): Layers;
}
export interface Layers extends L.Control, IEventPowered<Layers> {
/**
* Adds a base layer (radio button entry) with the given name to the control.
*/
addBaseLayer(layer: ILayer, name: string): Layers;
/**
* Adds an overlay (checkbox entry) with the given name to the control.
*/
addOverlay(layer: ILayer, name: string): Layers;
/**
* Remove the given layer from the control.
*/
removeLayer(layer: ILayer): Layers;
////////////////
////////////////
addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): Layers;
hasEventListeners(type: string): boolean;
fireEvent(type: string, data?: any): Layers;
on(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
once(type: string, fn: (e: LeafletEvent) => void, context?: any): Layers;
off(type: string, fn?: (e: LeafletEvent) => void, context?: any): Layers;
fire(type: string, data?: any): Layers;
addEventListener(eventMap: any, context?: any): Layers;
removeEventListener(eventMap?: any, context?: any): Layers;
clearAllEventListeners(): Layers;
on(eventMap: any, context?: any): Layers;
off(eventMap?: any, context?: any): Layers;
}
export interface ScaleStatic extends ClassStatic {
/**
* Creates an scale control with the given options.
*/
new(options?: ScaleOptions): Scale;
}
export interface Scale extends L.Control {
}
}
export interface control {
/**
* Creates a control with the given options.
*/
function (options?: ControlOptions): Control;
}
namespace control {
/**
* Creates a zoom control.
*/
export function zoom(options?: Control.ZoomOptions): L.Control.Zoom;
/**
* Creates an attribution control.
*/
export function attribution(options?: AttributionOptions): L.Control.Attribution;
/**
* Creates an attribution control with the given layers. Base layers will be
* switched with radio buttons, while overlays will be switched with checkboxes.
*/
export function layers(baseLayers?: any, overlays?: any, options?: LayersOptions): L.Control.Layers;
/**
* Creates an scale control with the given options.
*/
export function scale(options?: ScaleOptions): L.Control.Scale;
}
}
declare namespace L {
export interface ControlOptions {
/**
* The initial position of the control (one of the map corners). See control
* positions.
* Default value: 'topright'.
*/
position?: string;
}
}
declare namespace L {
namespace CRS {
/**
* The most common CRS for online maps, used by almost all free and commercial
* tile providers. Uses Spherical Mercator projection. Set in by default in
* Map's crs option.
*/
export var EPSG3857: ICRS;
/**
* A common CRS among GIS enthusiasts. Uses simple Equirectangular projection.
*/
export var EPSG4326: ICRS;
/**
* Rarely used by some commercial tile providers. Uses Elliptical Mercator
* projection.
*/
export var EPSG3395: ICRS;
/**
* A simple CRS that maps longitude and latitude into x and y directly. May be
* used for maps of flat surfaces (e.g. game maps). Note that the y axis should
* still be inverted (going from bottom to top).
*/
export var Simple: ICRS;
}
}
declare namespace L {
/**
* Creates a div icon instance with the given options.
*/
function divIcon(options: DivIconOptions): DivIcon;
export interface DivIconStatic extends ClassStatic {
/**
* Creates a div icon instance with the given options.
*/
new(options: DivIconOptions): DivIcon;
}
export var DivIcon: DivIconStatic;
export interface DivIcon extends Icon {
}
}
declare namespace L {
export interface DivIconOptions {
/**
* Size of the icon in pixels. Can be also set through CSS.
*/
iconSize?: Point;
/**
* The coordinates of the "tip" of the icon (relative to its top left corner).
* The icon will be aligned so that this point is at the marker's geographical
* location. Centered by default if size is specified, also can be set in CSS
* with negative margins.
*/
iconAnchor?: Point;
/**
* A custom class name to assign to the icon.
*
* Default value: 'leaflet-div-icon'.
*/
className?: string;
/**
* A custom HTML code to put inside the div element.
*
* Default value: ''.
*/
html?: string;
}
}
declare namespace L {
export interface DomEvent {
/**
* Adds a listener fn to the element's DOM event of the specified type. this keyword
* inside the listener will point to context, or to the element if not specified.
*/
addListener(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent;
on(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent;
/**
* Removes an event listener from the element.
*/
removeListener(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent;
off(el: HTMLElement, type: string, fn: (e: Event) => void, context?: any): DomEvent;
/**
* Stop the given event from propagation to parent elements. Used inside the
* listener functions:
* L.DomEvent.addListener(div, 'click', function
* (e) {
* L.DomEvent.stopPropagation(e);
* });
*/
stopPropagation(e: Event): DomEvent;
/**
* Prevents the default action of the event from happening (such as following
* a link in the href of the a element, or doing a POST request with page reload
* when form is submitted). Use it inside listener functions.
*/
preventDefault(e: Event): DomEvent;
/**
* Does stopPropagation and preventDefault at the same time.
*/
stop(e: Event): DomEvent;
/**
* Adds stopPropagation to the element's 'click', 'doubleclick', 'mousedown'
* and 'touchstart' events.
*/
disableClickPropagation(el: HTMLElement): DomEvent;
/**
* Gets normalized mouse position from a DOM event relative to the container
* or to the whole page if not specified.
*/
getMousePosition(e: Event, container?: HTMLElement): Point;
/**
* Gets normalized wheel delta from a mousewheel DOM event.
*/
getWheelDelta(e: Event): number;
}
export var DomEvent: DomEvent;
}
declare namespace L {
namespace DomUtil {
/**
* Returns an element with the given id if a string was passed, or just returns
* the element if it was passed directly.
*/
export function get(id: string): HTMLElement;
/**
* Returns the value for a certain style attribute on an element, including
* computed values or values set through CSS.
*/
export function getStyle(el: HTMLElement, style: string): string;
/**
* Returns the offset to the viewport for the requested element.
*/
export function getViewportOffset(el: HTMLElement): Point;
/**
* Creates an element with tagName, sets the className, and optionally appends
* it to container element.
*/
export function create(tagName: string, className: string, container?: HTMLElement): HTMLElement;
/**
* Makes sure text cannot be selected, for example during dragging.
*/
export function disableTextSelection(): void;
/**
* Makes text selection possible again.
*/
export function enableTextSelection(): void;
/**
* Returns true if the element class attribute contains name.
*/
export function hasClass(el: HTMLElement, name: string): boolean;
/**
* Adds name to the element's class attribute.
*/
export function addClass(el: HTMLElement, name: string): void;
/**
* Removes name from the element's class attribute.
*/
export function removeClass(el: HTMLElement, name: string): void;
/**
* Set the opacity of an element (including old IE support). Value must be from
* 0 to 1.
*/
export function setOpacity(el: HTMLElement, value: number): void;
/**
* Goes through the array of style names and returns the first name that is a valid
* style name for an element. If no such name is found, it returns false. Useful
* for vendor-prefixed styles like transform.
*/
export function testProp(props: string[]): any;
/**
* Returns a CSS transform string to move an element by the offset provided in
* the given point. Uses 3D translate on WebKit for hardware-accelerated transforms
* and 2D on other browsers.
*/
export function getTranslateString(point: Point): string;
/**
* Returns a CSS transform string to scale an element (with the given scale origin).
*/
export function getScaleString(scale: number, origin: Point): string;
/**
* Sets the position of an element to coordinates specified by point, using
* CSS translate or top/left positioning depending on the browser (used by
* Leaflet internally to position its layers). Forces top/left positioning
* if disable3D is true.
*/
export function setPosition(el: HTMLElement, point: Point, disable3D?: boolean): void;
/**
* Returns the coordinates of an element previously positioned with setPosition.
*/
export function getPosition(el: HTMLElement): Point;
/**
* Vendor-prefixed transition style name (e.g. 'webkitTransition' for WebKit).
*/
export var TRANSITION: string;
/**
* Vendor-prefixed transform style name.
*/
export var TRANSFORM: string;
}
}
declare namespace L {
/**
* Creates a Draggable object for moving the given element when you start dragging
* the dragHandle element (equals the element itself by default).
*/
function draggable(element: HTMLElement, dragHandle?: HTMLElement): Draggable;
export interface DraggableStatic extends ClassStatic {
/**
* Creates a Draggable object for moving the given element when you start dragging
* the dragHandle element (equals the element itself by default).
*/
new(element: HTMLElement, dragHandle?: HTMLElement): Draggable;
}
export var Draggable: DraggableStatic;
export interface Draggable extends IEventPowered<Draggable> {
/**
* Enables the dragging ability.
*/
enable(): void;
/**
* Disables the dragging ability.
*/
disable(): void;
////////////////
////////////////
addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable;
addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable;
removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): Draggable;
hasEventListeners(type: string): boolean;
fireEvent(type: string, data?: any): Draggable;
on(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable;
once(type: string, fn: (e: LeafletEvent) => void, context?: any): Draggable;
off(type: string, fn?: (e: LeafletEvent) => void, context?: any): Draggable;
fire(type: string, data?: any): Draggable;
addEventListener(eventMap: any, context?: any): Draggable;
removeEventListener(eventMap?: any, context?: any): Draggable;
clearAllEventListeners(): Draggable;
on(eventMap: any, context?: any): Draggable;
off(eventMap?: any, context?: any): Draggable;
}
}
declare namespace L {
/**
* Create a layer group, optionally given an initial set of layers.
*/
function featureGroup<T extends ILayer>(layers?: T[]): FeatureGroup<T>;
export interface FeatureGroupStatic extends ClassStatic {
/**
* Create a layer group, optionally given an initial set of layers.
*/
new<T extends ILayer>(layers?: T[]): FeatureGroup<T>;
}
export var FeatureGroup: FeatureGroupStatic;
export interface FeatureGroup<T extends ILayer> extends LayerGroup<T>, ILayer, IEventPowered<FeatureGroup<T>> {
/**
* Binds a popup with a particular HTML content to a click on any layer from the
* group that has a bindPopup method.
*/
bindPopup(htmlContent: string, options?: PopupOptions): FeatureGroup<T>;
/**
* Returns the LatLngBounds of the Feature Group (created from bounds and coordinates
* of its children).
*/
getBounds(): LatLngBounds;
/**
* Sets the given path options to each layer of the group that has a setStyle method.
*/
setStyle(style: PathOptions): FeatureGroup<T>;
/**
* Brings the layer group to the top of all other layers.
*/
bringToFront(): FeatureGroup<T>;
/**
* Brings the layer group to the bottom of all other layers.
*/
bringToBack(): FeatureGroup<T>;
////////////
////////////
/**
* Should contain code that creates DOM elements for the overlay, adds them
* to map panes where they should belong and puts listeners on relevant map events.
* Called on map.addLayer(layer).
*/
onAdd(map: Map): void;
/**
* Should contain all clean up code that removes the overlay's elements from
* the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).
*/
onRemove(map: Map): void;
////////////////
////////////////
addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup<T>;
addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup<T>;
removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup<T>;
hasEventListeners(type: string): boolean;
fireEvent(type: string, data?: any): FeatureGroup<T>;
on(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup<T>;
once(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup<T>;
off(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup<T>;
fire(type: string, data?: any): FeatureGroup<T>;
addEventListener(eventMap: any, context?: any): FeatureGroup<T>;
removeEventListener(eventMap?: any, context?: any): FeatureGroup<T>;
clearAllEventListeners(): FeatureGroup<T>;
on(eventMap: any, context?: any): FeatureGroup<T>;
off(eventMap?: any, context?: any): FeatureGroup<T>;
}
}
declare namespace L {
/**
* Creates a GeoJSON layer. Optionally accepts an object in GeoJSON format
* to display on the map (you can alternatively add it later with addData method)
* and an options object.
*/
function geoJson(geojson?: any, options?: GeoJSONOptions): GeoJSON;
export interface GeoJSONStatic extends ClassStatic {
/**
* Creates a GeoJSON layer. Optionally accepts an object in GeoJSON format
* to display on the map (you can alternatively add it later with addData method)
* and an options object.
*/
new(geojson?: any, options?: GeoJSONOptions): GeoJSON;
/**
* Creates a layer from a given GeoJSON feature.
*/
geometryToLayer(featureData: GeoJSON, pointToLayer?: (featureData: any, latlng: LatLng) => ILayer): ILayer;
/**
* Creates a LatLng object from an array of 2 numbers (latitude, longitude)
* used in GeoJSON for points. If reverse is set to true, the numbers will be interpreted
* as (longitude, latitude).
*/
coordsToLatLng(coords: number[], reverse?: boolean): LatLng;
/**
* Creates a multidimensional array of LatLng objects from a GeoJSON coordinates
* array. levelsDeep specifies the nesting level (0 is for an array of points,
* 1 for an array of arrays of points, etc., 0 by default). If reverse is set to
* true, the numbers will be interpreted as (longitude, latitude).
*/
coordsToLatLngs(coords: any[], levelsDeep?: number, reverse?: boolean): any[];
}
export var GeoJSON: GeoJSONStatic;
export interface GeoJSON extends FeatureGroup<ILayer> {
/**
* Adds a GeoJSON object to the layer.
*/
addData(data: any): boolean;
/**
* Changes styles of GeoJSON vector layers with the given style function.
*/
setStyle(style: (featureData: any) => any): GeoJSON;
/**
* Changes styles of GeoJSON vector layers with the given style options.
*/
setStyle(style: PathOptions): GeoJSON;
/**
* Resets the the given vector layer's style to the original GeoJSON style,
* useful for resetting style after hover events.
*/
resetStyle(layer: Path): GeoJSON;
}
}
declare namespace L {
export interface GeoJSONOptions {
/**