forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
google.maps.d.ts
2124 lines (1905 loc) · 66.8 KB
/
google.maps.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 Google Maps JavaScript API 3.20
// Project: https://developers.google.com/maps/
// Definitions by: Folia A/S <http://www.folia.dk>, Chris Wrench <https://github.com/cgwrench>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/*
The MIT License
Copyright (c) 2012 Folia A/S. http://www.folia.dk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
declare module google.maps {
/***** Map *****/
export class Map extends MVCObject {
constructor(mapDiv: Element, opts?: MapOptions);fitBounds(bounds: LatLngBounds): void;
getBounds(): LatLngBounds;
getCenter(): LatLng;
getDiv(): Element;
getHeading(): number;
getMapTypeId(): MapTypeId|string;
getProjection(): Projection;
getStreetView(): StreetViewPanorama;
getTilt(): number;
getZoom(): number;
panBy(x: number, y: number): void;
panTo(latLng: LatLng|LatLngLiteral): void;
panToBounds(latLngBounds: LatLngBounds): void;
setCenter(latlng: LatLng|LatLngLiteral): void;
setHeading(heading: number): void;
setMapTypeId(mapTypeId: MapTypeId|string): void;
setOptions(options: MapOptions): void;
setStreetView(panorama: StreetViewPanorama): void;
setTilt(tilt: number): void;
setZoom(zoom: number): void;
controls: MVCArray[]; //Array<MVCArray<Node>>
data: Data;
mapTypes: MapTypeRegistry;
overlayMapTypes: MVCArray; // MVCArray<MapType>
}
export interface MapOptions {
backgroundColor?: string;
center?: LatLng;
disableDefaultUI?: boolean;
disableDoubleClickZoom?: boolean;
draggable?: boolean;
draggableCursor?: string;
draggingCursor?: string;
heading?: number;
keyboardShortcuts?: boolean;
mapMaker?: boolean;
mapTypeControl?: boolean;
mapTypeControlOptions?: MapTypeControlOptions;
mapTypeId?: MapTypeId;
maxZoom?: number;
minZoom?: number;
noClear?: boolean;
overviewMapControl?: boolean;
overviewMapControlOptions?: OverviewMapControlOptions;
panControl?: boolean;
panControlOptions?: PanControlOptions;
rotateControl?: boolean;
rotateControlOptions?: RotateControlOptions;
scaleControl?: boolean;
scaleControlOptions?: ScaleControlOptions;
scrollwheel?: boolean;
streetView?: StreetViewPanorama;
streetViewControl?: boolean;
streetViewControlOptions?: StreetViewControlOptions;
styles?: MapTypeStyle[];
tilt?: number;
zoom?: number;
zoomControl?: boolean;
zoomControlOptions?: ZoomControlOptions;
}
export enum MapTypeId {
HYBRID,
ROADMAP,
SATELLITE,
TERRAIN
}
/***** Controls *****/
export interface MapTypeControlOptions {
mapTypeIds?: (MapTypeId|string)[];
position?: ControlPosition;
style?: MapTypeControlStyle;
}
export enum MapTypeControlStyle {
DEFAULT,
DROPDOWN_MENU,
HORIZONTAL_BAR
}
export interface OverviewMapControlOptions {
opened?: boolean;
}
export interface PanControlOptions {
position?: ControlPosition;
}
export interface RotateControlOptions {
position?: ControlPosition;
}
export interface ScaleControlOptions {
style?: ScaleControlStyle;
}
export enum ScaleControlStyle {
DEFAULT
}
export interface StreetViewControlOptions {
position?: ControlPosition;
}
export interface ZoomControlOptions {
position?: ControlPosition;
style?: ZoomControlStyle;
}
export enum ZoomControlStyle {
DEFAULT,
LARGE,
SMALL
}
export enum ControlPosition {
BOTTOM_CENTER,
BOTTOM_LEFT,
BOTTOM_RIGHT,
LEFT_BOTTOM,
LEFT_CENTER,
LEFT_TOP,
RIGHT_BOTTOM,
RIGHT_CENTER,
RIGHT_TOP,
TOP_CENTER,
TOP_LEFT,
TOP_RIGHT
}
/***** Data *****/
export class Data extends MVCObject {
constructor(options?: Data.DataOptions);
add(feature: Data.Feature|Data.FeatureOptions): Data.Feature;
addGeoJson(geoJson: Object, options?: Data.GeoJsonOptions): Data.Feature[];
contains(feature: Data.Feature): boolean;
forEach(callback: (feature: Data.Feature) => void): void;
getControlPosition(): ControlPosition;
getControls(): string[];
getDrawingMode(): string;
getFeatureById(id: number|string): Data.Feature;
getMap(): Map;
getStyle(): Data.StylingFunction|Data.StyleOptions;
loadGeoJson(url: string, options?: Data.GeoJsonOptions, callback?: (features: Data.Feature[]) => void): void;
overrideStyle(feature: Data.Feature, style: Data.StyleOptions): void;
remove(feature: Data.Feature): void;
revertStyle(feature?: Data.Feature): void;
setControlPosition(controlPosition: ControlPosition): void;
setControls(controls: string[]): void;
setDrawingMode(drawingMode: string): void;
setMap(map: Map): void;
setStyle(style: Data.StylingFunction|Data.StyleOptions): void;
toGeoJson(callback: (feature: Object) => void): void;
}
export module Data {
export interface DataOptions {
controlPosition?: ControlPosition;
controls?: string[];
drawingMode?: string;
featureFactory?: (geometry: Data.Geometry) => Data.Feature;
map?: Map;
style?: Data.StylingFunction|Data.StyleOptions;
}
export interface GeoJsonOptions {
idPropertyName?: string;
}
export interface StyleOptions {
clickable?: boolean;
cursor?: string;
draggable?: boolean;
editable?: boolean;
fillColor?: string;
fillOpacity?: number;
icon?: string|Icon|Symbol;
shape?: MarkerShape;
strokeColor?: string;
strokeOpacity?: number;
strokeWeight?: number;
title?: string;
visible?: boolean;
zIndex?: number;
}
export type StylingFunction = (feature: Data.Feature) => Data.StyleOptions;
export class Feature {
constructor(options?: Data.FeatureOptions);
forEachProperty(callback: (value: any, name: string) => void): void;
getGeometry(): Data.Geometry;
getId(): number|string;
getProperty(name: string): any;
removeProperty(name: string): void;
setGeometry(newGeometry: Data.Geometry|LatLng|LatLngLiteral): void;
setProperty(name: string, newValue: any): void;
toGeoJson(callback: (feature: Object) => void): void;
}
export interface FeatureOptions {
geometry?: Data.Geometry|LatLng|LatLngLiteral;
id?: number|string;
properties?: Object;
}
export class Geometry {
getType(): string;
}
export class Point extends Data.Geometry {
constructor(latLng: LatLng|LatLngLiteral);
get(): LatLng;
}
export class MultiPoint extends Data.Geometry {
constructor(elements: (LatLng|LatLngLiteral)[]);
getArray(): LatLng[];
getAt(n: number): LatLng;
getLength(): number;
}
export class LineString extends Data.Geometry {
constructor(elements: (LatLng|LatLngLiteral)[]);
getArray(): LatLng[];
getAt(n: number): LatLng;
getLength(): number;
}
export class MultiLineString extends Data.Geometry {
constructor(elements: (Data.LineString|(LatLng|LatLngLiteral)[])[]);
getArray(): Data.LineString[];
getAt(n: number): Data.LineString;
getLength(): number;
}
export class LinearRing extends Data.Geometry {
constructor(elements: (LatLng|LatLngLiteral)[]);
getArray(): LatLng[];
getAt(n: number): LatLng;
getLength(): number;
}
export class Polygon extends Data.Geometry {
constructor(elements: (Data.LinearRing|(LatLng|LatLngLiteral)[])[]);
getArray(): Data.LinearRing[];
getAt(n: number): Data.LinearRing;
getLength(): number;
}
export class MultiPolygon extends Data.Geometry {
constructor(elements: (Data.Polygon|(LinearRing|(LatLng|LatLngLiteral)[])[])[]);
getArray(): Data.Polygon[];
getAt(n: number): Data.Polygon;
getLength(): number;
}
export class GeometryCollection extends Data.Geometry {
constructor(elements: (Data.Geometry[]|LatLng[]|LatLngLiteral)[]);
getArray(): Data.Geometry[];
getAt(n: number): Data.Geometry;
getLength(): number;
}
export interface MouseEvent extends google.maps.MouseEvent {
feature: Data.Feature;
}
export interface AddFeatureEvent {
feature: Data.Feature;
}
export interface RemoveFeatureEvent {
feature: Data.Feature;
}
export interface SetGeometryEvent {
feature: Data.Feature;
newGeometry: Data.Geometry;
oldGeometry: Data.Geometry;
}
export interface SetPropertyEvent {
feature: Data.Feature;
name: string;
newValue: any;
oldValue: any;
}
export interface RemovePropertyEvent {
feature: Data.Feature;
name: string;
oldValue: any;
}
}
/***** Overlays *****/
export class Marker extends MVCObject {
static MAX_ZINDEX: number;
constructor(opts?: MarkerOptions);
getAnimation(): Animation;
getAttribution(): Attribution;
getClickable(): boolean;
getCursor(): string;
getDraggable(): boolean;
getIcon(): string|Icon|Symbol;
getMap(): Map|StreetViewPanorama;
getOpacity(): number;
getPlace(): Place;
getPosition(): LatLng;
getShape(): MarkerShape;
getTitle(): string;
getVisible(): boolean;
getZIndex(): number;
setAnimation(animation: Animation): void;
setAttribution(attribution: Attribution): void;
setClickable(flag: boolean): void;
setCursor(cursor: string): void;
setDraggable(flag: boolean): void;
setIcon(icon: string|Icon|Symbol): void;
setMap(map: Map|StreetViewPanorama): void;
getOpacity(opacity: number): void;
setOptions(options: MarkerOptions): void;
setPlace(place: Place): void;
setPosition(latlng: LatLng|LatLngLiteral): void;
setShape(shape: MarkerShape): void;
setTitle(title: string): void;
setVisible(visible: boolean): void;
setZIndex(zIndex: number): void;
}
export interface MarkerOptions {
/**
* The offset from the marker's position to the tip of an InfoWindow
* that has been opened with the marker as anchor.
*/
anchorPoint?: Point;
/** Which animation to play when marker is added to a map. */
animation?: Animation;
/**
* If true, the marker receives mouse and touch events.
* @default true
*/
clickable?: boolean;
/** Mouse cursor to show on hover. */
cursor?: string;
/**
* If true, the marker can be dragged.
* @default false
*/
draggable?: boolean;
/**
* Icon for the foreground.
* If a string is provided, it is treated as though it were an Icon with the string as url.
* @type {(string|Icon|Symbol)}
*/
icon?: string|Icon|Symbol;
/**
* Map on which to display Marker.
* @type {(Map|StreetViewPanorama)}
*
*/
map?: Map|StreetViewPanorama;
/** The marker's opacity between 0.0 and 1.0. */
opacity?: number;
/**
* Optimization renders many markers as a single static element.
* Optimized rendering is enabled by default.
* Disable optimized rendering for animated GIFs or PNGs, or when each
* marker must be rendered as a separate DOM element (advanced usage
* only).
*/
optimized?: boolean;
/**
* Place information, used to identify and describe the place
* associated with this Marker. In this context, 'place' means a
* business, point of interest or geographic location. To allow a user
* to save this place, open an info window anchored on this marker.
* The info window will contain information about the place and an
* option for the user to save it. Only one of position or place can
* be specified.
*/
place?: Place;
/**
* Marker position. Required.
*/
position: LatLng;
/** Image map region definition used for drag/click. */
shape?: MarkerShape;
/** Rollover text. */
title?: string;
/** If true, the marker is visible. */
visible?: boolean;
/**
* All markers are displayed on the map in order of their zIndex,
* with higher values displaying in front of markers with lower values.
* By default, markers are displayed according to their vertical position on screen,
* with lower markers appearing in front of markers further up the screen.
*/
zIndex?: number;
}
export interface Icon {
/**
* The position at which to anchor an image in correspondence to the
* location of the marker on the map. By default, the anchor is
* located along the center point of the bottom of the image.
*/
anchor?: Point;
/**
* The origin of the label relative to the top-left corner of the icon
* image, if a label is supplied by the marker. By default, the origin
* is located in the center point of the image.
*/
labelOrigin?: Point;
/**
* The position of the image within a sprite, if any. By default, the
* origin is located at the top left corner of the image (0, 0).
*/
origin?: Point;
/**
* The size of the entire image after scaling, if any. Use this
* property to stretch/ shrink an image or a sprite.
*/
scaledSize?: Size;
/**
* The display size of the sprite or image. When using sprites, you
* must specify the sprite size. If the size is not provided, it will
* be set when the image loads.
*/
size?: Size;
/** The URL of the image or sprite sheet. */
url?: string;
}
export interface MarkerShape {
coords?: number[];
type?: string;
}
export interface Symbol {
/**
* The position of the symbol relative to the marker or polyline.
* The coordinates of the symbol's path are translated left and up by the anchor's x and y coordinates respectively.
* By default, a symbol is anchored at (0, 0).
* The position is expressed in the same coordinate system as the symbol's path.
*/
anchor?: Point;
/**
* The symbol's fill color.
* All CSS3 colors are supported except for extended named colors. For symbol markers, this defaults to 'black'.
* For symbols on polylines, this defaults to the stroke color of the corresponding polyline.
*/
fillColor?: string;
/**
* The symbol's fill opacity.
* @default 0
*/
fillOpacity?: number;
/**
* The symbol's path, which is a built-in symbol path, or a custom path expressed using SVG path notation. Required.
* @type {(SymbolPath|string)}
*/
path?: SymbolPath|string;
/**
* The angle by which to rotate the symbol, expressed clockwise in degrees.
* Defaults to 0.
* A symbol in an IconSequence where fixedRotation is false is rotated relative to the angle of the edge on which it lies.
*/
rotation?: number;
/**
* The amount by which the symbol is scaled in size.
* For symbol markers, this defaults to 1; after scaling, the symbol may be of any size.
* For symbols on a polyline, this defaults to the stroke weight of the polyline;
* after scaling, the symbol must lie inside a square 22 pixels in size centered at the symbol's anchor.
*/
scale?: number;
/**
* The symbol's stroke color. All CSS3 colors are supported except for extended named colors.
* For symbol markers, this defaults to 'black'.
* For symbols on a polyline, this defaults to the stroke color of the polyline.
*/
strokeColor?: string;
/**
* The symbol's stroke opacity. For symbol markers, this defaults to 1.
* For symbols on a polyline, this defaults to the stroke opacity of the polyline.
*/
strokeOpacity?: number;
/** The symbol's stroke weight. Defaults to the scale of the symbol.v*/
strokeWeight?: number;
}
/** Built-in symbol paths. */
export enum SymbolPath {
/** A backward-pointing closed arrow. */
BACKWARD_CLOSED_ARROW,
/** A backward-pointing open arrow. */
BACKWARD_OPEN_ARROW,
/** A circle. */
CIRCLE,
/** A forward-pointing closed arrow. */
FORWARD_CLOSED_ARROW,
/** A forward-pointing open arrow. */
FORWARD_OPEN_ARROW
}
export enum Animation {
BOUNCE,
DROP
}
/**
* An overlay that looks like a bubble and is often connected to a marker.
* This class extends MVCObject.
*/
export class InfoWindow extends MVCObject {
/**
* Creates an info window with the given options. An InfoWindow can be
* placed on a map at a particular position or above a marker,
* depending on what is specified in the options. Unless auto-pan is
* disabled, an InfoWindow will pan the map to make itself visible
* when it is opened. After constructing an InfoWindow, you must call
* open to display it on the map. The user can click the close button
* on the InfoWindow to remove it from the map, or the developer can
* call close() for the same effect.
*/
constructor(opts?: InfoWindowOptions);
/** Closes this InfoWindow by removing it from the DOM structure. */
close(): void;
getContent(): string|Element;
getPosition(): LatLng;
getZIndex(): number;
/**
* Opens this InfoWindow on the given map. Optionally, an InfoWindow can be associated with an anchor.
* In the core API, the only anchor is the Marker class.
* However, an anchor can be any MVCObject that exposes a LatLng position property and optionally
* a Point anchorPoint property for calculating the pixelOffset (see InfoWindowOptions).
* The anchorPoint is the offset from the anchor's position to the tip of the InfoWindow.
*/
open(map?: Map|StreetViewPanorama, anchor?: MVCObject): void;
setContent(content: string|Node): void;
setOptions(options: InfoWindowOptions): void;
setPosition(position: LatLng): void;
setZIndex(zIndex: number): void;
}
export interface InfoWindowOptions {
/**
* Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML.
* The InfoWindow will be sized according to the content.
* To set an explicit size for the content, set content to be a HTML element with that size.
* @type {(string|Node)}
*/
content?: string|Node;
/**
* Disable auto-pan on open. By default, the info window will pan the map so that it is fully visible when it opens.
*/
disableAutoPan?: boolean;
/**
* Maximum width of the infowindow, regardless of content's width.
* This value is only considered if it is set before a call to open.
* To change the maximum width when changing content, call close, setOptions, and then open.
*/
maxWidth?: number;
/**
* The offset, in pixels, of the tip of the info window from the point on the map
* at whose geographical coordinates the info window is anchored.
* If an InfoWindow is opened with an anchor, the pixelOffset will be calculated from the anchor's anchorPoint property.
*/
pixelOffset?: Size;
/**
* The LatLng at which to display this InfoWindow. If the InfoWindow is opened with an anchor, the anchor's position will be used instead.
*/
position?: LatLng|LatLngLiteral;
/**
* All InfoWindows are displayed on the map in order of their zIndex,
* with higher values displaying in front of InfoWindows with lower values.
* By default, InfoWindows are displayed according to their latitude,
* with InfoWindows of lower latitudes appearing in front of InfoWindows at higher latitudes.
* InfoWindows are always displayed in front of markers.
*/
zIndex?: number;
}
export class Polyline extends MVCObject {
constructor(opts?: PolylineOptions);
getDraggable(): boolean;
getEditable(): boolean;
getMap(): Map;
getPath(): MVCArray; // MVCArray<LatLng>
getVisible(): boolean;
setDraggable(draggable: boolean): void;
setEditable(editable: boolean): void;
setMap(map: Map): void;
setOptions(options: PolylineOptions): void;
setPath(path: MVCArray|LatLng[]|LatLngLiteral[]): void; // MVCArray<LatLng>|Array<LatLng|LatLngLiteral>
setVisible(visible: boolean): void;
}
export interface PolylineOptions {
clickable?: boolean;
draggable?: boolean;
editable?: boolean;
geodesic?: boolean;
icons?: IconSequence[];
map?: Map;
path?: MVCArray|LatLng[]|LatLngLiteral[]; // MVCArray<LatLng>|Array<LatLng|LatLngLiteral>
strokeColor?: string;
strokeOpacity?: number;
strokeWeight?: number;
visible?: boolean;
zIndex?: number;
}
export interface IconSequence {
fixedRotation?: boolean;
icon?: Symbol;
offset?: string;
repeat?: string;
}
export class Polygon extends MVCObject {
constructor(opts?: PolygonOptions);
getDraggable(): boolean;
getEditable(): boolean;
getMap(): Map;
getPath(): MVCArray; // MVCArray<LatLng>
getPaths(): MVCArray; // MVCArray<MVCArray<LatLng>>
getVisible(): boolean;
setDraggable(draggable: boolean): void;
setEditable(editable: boolean): void;
setMap(map: Map): void;
setOptions(options: PolygonOptions): void;
setPath(path: MVCArray|LatLng[]|LatLngLiteral[]): void;
setPaths(paths: MVCArray): void;
setPaths(paths: MVCArray[]): void;
setPaths(path: LatLng[]): void;
setPaths(path: LatLng[][]): void;
setPaths(path: LatLngLiteral[]): void;
setPaths(path: LatLngLiteral[][]): void;
setVisible(visible: boolean): void;
}
export interface PolygonOptions {
clickable?: boolean;
draggable?: boolean;
editable?: boolean;
fillColor?: string;
fillOpacity?: number;
geodesic?: boolean;
map?: Map;
paths?: any[]; // MVCArray<MVCArray<LatLng>>|MVCArray<LatLng>|Array<Array<LatLng|LatLngLiteral>>|Array<LatLng|LatLngLiteral>
strokeColor?: string;
strokeOpacity?: number;
strokePosition?: StrokePosition;
strokeWeight?: number;
visible?: boolean;
zIndex?: number;
}
export interface PolyMouseEvent {
edge?: number;
path?: number;
vertex?: number;
}
export class Rectangle extends MVCObject {
constructor(opts?: RectangleOptions);
getBounds(): LatLngBounds;
getDraggable(): boolean;
getEditable(): boolean;
getMap(): Map;
getVisible(): boolean;
setBounds(bounds: LatLngBounds): void;
setDraggable(draggable: boolean): void;
setEditable(editable: boolean): void;
setMap(map: Map): void;
setOptions(options: RectangleOptions): void;
setVisible(visible: boolean): void;
}
export interface RectangleOptions {
bounds?: LatLngBounds;
clickable?: boolean;
draggable?: boolean;
editable?: boolean;
fillColor?: string;
fillOpacity?: number;
map?: Map;
strokeColor?: string;
strokeOpacity?: number;
strokePosition?: StrokePosition;
strokeWeight?: number;
visible?: boolean;
zIndex?: number;
}
export class Circle extends MVCObject {
constructor(opts?: CircleOptions);
getBounds(): LatLngBounds;
getCenter(): LatLng;
getDraggable(): boolean;
getEditable(): boolean;
getMap(): Map;
getRadius(): number;
getVisible(): boolean;
setCenter(center: LatLng|LatLngLiteral): void;
setDraggable(draggable: boolean): void;
setEditable(editable: boolean): void;
setMap(map: Map): void;
setOptions(options: CircleOptions): void;
setRadius(radius: number): void;
setVisible(visible: boolean): void;
}
export interface CircleOptions {
center?: LatLng;
clickable?: boolean;
draggable?: boolean;
editable?: boolean;
fillColor?: string;
fillOpacity?: number;
map?: Map;
radius?: number;
strokeColor?: string;
strokeOpacity?: number;
strokePosition?: StrokePosition;
strokeWeight?: number;
visible?: boolean;
zIndex?: number;
}
export enum StrokePosition {
CENTER,
INSIDE,
OUTSIDE
}
export class GroundOverlay extends MVCObject {
constructor(url: string, bounds: LatLngBounds, opts?: GroundOverlayOptions);
getBounds(): LatLngBounds;
getMap(): Map;
getOpacity(): number;
getUrl(): string;
setMap(map: Map): void;
setOpacity(opacity: number): void;
}
export interface GroundOverlayOptions {
clickable?: boolean;
map?: Map;
opacity?: number;
}
export class OverlayView extends MVCObject {
draw(): void;
getMap(): Map|StreetViewPanorama;
getPanes(): MapPanes;
getProjection(): MapCanvasProjection;
onAdd(): void;
onRemove(): void;
setMap(map: Map|StreetViewPanorama): void;
}
export interface MapPanes {
floatPane: Element;
mapPane: Element;
markerLayer: Element;
overlayLayer: Element;
overlayMouseTarget: Element;
}
export class MapCanvasProjection extends MVCObject {
fromContainerPixelToLatLng(pixel: Point, nowrap?: boolean): LatLng;
fromDivPixelToLatLng(pixel: Point, nowrap?: boolean): LatLng;
fromLatLngToContainerPixel(latLng: LatLng): Point;
fromLatLngToDivPixel(latLng: LatLng): Point;
getWorldWidth(): number;
}
/***** Services *****/
export class Geocoder {
geocode(request: GeocoderRequest, callback: (results: GeocoderResult[], status: GeocoderStatus) => void ): void;
}
export interface GeocoderRequest {
address?: string;
bounds?: LatLngBounds;
componentRestrictions?: GeocoderComponentRestrictions;
location?: LatLng|LatLngLiteral;
placeId?: string;
region?: string;
}
export interface GeocoderComponentRestrictions {
administrativeArea?: string;
country?: string;
locality?: string;
postalCode?: string;
route?: string;
}
export enum GeocoderStatus {
ERROR,
INVALID_REQUEST,
OK,
OVER_QUERY_LIMIT,
REQUEST_DENIED,
UNKNOWN_ERROR,
ZERO_RESULTS
}
export interface GeocoderResult {
address_components: GeocoderAddressComponent[];
formatted_address: string;
geometry: GeocoderGeometry;
partial_match: boolean;
postcode_localities: string[];
types: string[];
}
export interface GeocoderAddressComponent {
long_name: string;
short_name: string;
types: string[];
}
export interface GeocoderGeometry {
bounds: LatLngBounds;
location: LatLng;
location_type: GeocoderLocationType;
viewport: LatLngBounds;
}
export enum GeocoderLocationType {
APPROXIMATE,
GEOMETRIC_CENTER,
RANGE_INTERPOLATED,
ROOFTOP
}
export class DirectionsRenderer extends MVCObject {
constructor(opts?: DirectionsRendererOptions);
getDirections(): DirectionsResult;
getMap(): Map;
getPanel(): Element;
getRouteIndex(): number;
setDirections(directions: DirectionsResult): void;
setMap(map: Map): void;
setOptions(options: DirectionsRendererOptions): void;
setPanel(panel: Element): void;
setRouteIndex(routeIndex: number): void;
}
export interface DirectionsRendererOptions {
directions?: DirectionsResult;
draggable?: boolean;
hideRouteList?: boolean;
infoWindow?: InfoWindow;
map?: Map;
markerOptions?: MarkerOptions;
panel?: Element;
polylineOptions?: PolylineOptions;
preserveViewport?: boolean;
routeIndex?: number;
suppressBicyclingLayer?: boolean;
suppressInfoWindows?: boolean;
suppressMarkers?: boolean;
suppressPolylines?: boolean;
}
export class DirectionsService {
route(request: DirectionsRequest, callback: (result: DirectionsResult, status: DirectionsStatus) => void ): void;
}
export interface DirectionsRequest {
avoidFerries?: boolean;
avoidHighways?: boolean;
avoidTolls?: boolean;
destination?: LatLng|string;
durationInTraffic?: boolean;
optimizeWaypoints?: boolean;
origin?: LatLng|string;
provideRouteAlternatives?: boolean;
region?: string;
transitOptions?: TransitOptions;
travelMode?: TravelMode;
unitSystem?: UnitSystem;
waypoints?: DirectionsWaypoint[];
}
export enum TravelMode {
BICYCLING,
DRIVING,
TRANSIT,
WALKING
}
export enum UnitSystem {
IMPERIAL,
METRIC
}
export interface TransitOptions {
arrivalTime?: Date;
departureTime?: Date;
modes: TransitMode[];
routingPreference: TransitRoutePreference;
}
export enum TransitMode {
BUS,
RAIL,
SUBWAY,
TRAIN,
TRAM
}
export enum TransitRoutePreference
{
FEWER_TRANSFERS,
LESS_WALKING
}
export interface TransitFare { }
export interface DirectionsWaypoint {
location: LatLng|string;
stopover: boolean;
}
export enum DirectionsStatus {
INVALID_REQUEST,
MAX_WAYPOINTS_EXCEEDED,
NOT_FOUND,
OK,
OVER_QUERY_LIMIT,
REQUEST_DENIED,
UNKNOWN_ERROR,
ZERO_RESULTS
}
export interface DirectionsResult {
routes: DirectionsRoute[];
}
export interface DirectionsRoute {
bounds: LatLngBounds;
copyrights: string;
fare: TransitFare;
legs: DirectionsLeg[];
overview_path: LatLng[];
overview_polyline: string;
warnings: string[];
waypoint_order: number[];
}
export interface DirectionsLeg {
arrival_time: Time;
departure_time: Time;
distance: Distance;
duration: Duration;
duration_in_traffic: Duration;
end_address: string;
end_location: LatLng;
start_address: string;