UNPKG

10.1 kBTypeScriptView Raw
1export declare var google: any;
2export interface GoogleMap extends MVCObject {
3 constructor(el: HTMLElement, opts?: MapOptions): void;
4 panTo(latLng: LatLng | LatLngLiteral): void;
5 setZoom(zoom: number): void;
6 getCenter(): LatLng;
7 setCenter(latLng: LatLng | LatLngLiteral): void;
8 getBounds(): LatLngBounds;
9 getZoom(): number;
10 setOptions(options: MapOptions): void;
11 panToBounds(latLngBounds: LatLngBounds | LatLngBoundsLiteral): void;
12 fitBounds(bounds: LatLngBounds | LatLngBoundsLiteral): void;
13}
14export interface LatLng {
15 constructor(lat: number, lng: number): void;
16 lat(): number;
17 lng(): number;
18}
19export interface Marker extends MVCObject {
20 constructor(options?: MarkerOptions): void;
21 setMap(map: GoogleMap): void;
22 setPosition(latLng: LatLng | LatLngLiteral): void;
23 setTitle(title: string): void;
24 setLabel(label: string | MarkerLabel): void;
25 setDraggable(draggable: boolean): void;
26 setIcon(icon: string): void;
27 setOpacity(opacity: number): void;
28 setVisible(visible: boolean): void;
29 setZIndex(zIndex: number): void;
30 getLabel(): MarkerLabel;
31}
32export interface MarkerOptions {
33 position: LatLng | LatLngLiteral;
34 title?: string;
35 map?: GoogleMap;
36 label?: string | MarkerLabel;
37 draggable?: boolean;
38 icon?: string;
39 opacity?: number;
40 visible?: boolean;
41 zIndex?: number;
42}
43export interface MarkerLabel {
44 color: string;
45 fontFamily: string;
46 fontSize: string;
47 fontWeight: string;
48 text: string;
49}
50export interface Circle extends MVCObject {
51 getBounds(): LatLngBounds;
52 getCenter(): LatLng;
53 getDraggable(): boolean;
54 getEditable(): boolean;
55 getMap(): GoogleMap;
56 getRadius(): number;
57 getVisible(): boolean;
58 setCenter(center: LatLng | LatLngLiteral): void;
59 setDraggable(draggable: boolean): void;
60 setEditable(editable: boolean): void;
61 setMap(map: GoogleMap): void;
62 setOptions(options: CircleOptions): void;
63 setRadius(radius: number): void;
64 setVisible(visible: boolean): void;
65}
66export interface CircleOptions {
67 center?: LatLng | LatLngLiteral;
68 clickable?: boolean;
69 draggable?: boolean;
70 editable?: boolean;
71 fillColor?: string;
72 fillOpacity?: number;
73 map?: GoogleMap;
74 radius?: number;
75 strokeColor?: string;
76 strokeOpacity?: number;
77 strokePosition?: 'CENTER' | 'INSIDE' | 'OUTSIDE';
78 strokeWeight?: number;
79 visible?: boolean;
80 zIndex?: number;
81}
82export interface LatLngBounds {
83 contains(latLng: LatLng): boolean;
84 equals(other: LatLngBounds | LatLngBoundsLiteral): boolean;
85 extend(point: LatLng): void;
86 getCenter(): LatLng;
87 getNorthEast(): LatLng;
88 getSouthWest(): LatLng;
89 intersects(other: LatLngBounds | LatLngBoundsLiteral): boolean;
90 isEmpty(): boolean;
91 toJSON(): LatLngBoundsLiteral;
92 toSpan(): LatLng;
93 toString(): string;
94 toUrlValue(precision?: number): string;
95 union(other: LatLngBounds | LatLngBoundsLiteral): LatLngBounds;
96}
97export interface LatLngBoundsLiteral {
98 east: number;
99 north: number;
100 south: number;
101 west: number;
102}
103export interface LatLngLiteral {
104 lat: number;
105 lng: number;
106}
107export interface MouseEvent {
108 latLng: LatLng;
109}
110export interface MapOptions {
111 center?: LatLng | LatLngLiteral;
112 zoom?: number;
113 minZoom?: number;
114 maxZoom?: number;
115 disableDoubleClickZoom?: boolean;
116 disableDefaultUI?: boolean;
117 backgroundColor?: string;
118 draggable?: boolean;
119 draggableCursor?: string;
120 draggingCursor?: string;
121 keyboardShortcuts?: boolean;
122 zoomControl?: boolean;
123 styles?: MapTypeStyle[];
124 streetViewControl?: boolean;
125 scaleControl?: boolean;
126 mapTypeControl?: boolean;
127}
128export interface MapTypeStyle {
129 elementType?: 'all' | 'geometry' | 'geometry.fill' | 'geometry.stroke' | 'labels' | 'labels.icon' | 'labels.text' | 'labels.text.fill' | 'labels.text.stroke';
130 featureType?: 'administrative' | 'administrative.country' | 'administrative.land_parcel' | 'administrative.locality' | 'administrative.neighborhood' | 'administrative.province' | 'all' | 'landscape' | 'landscape.man_made' | 'landscape.natural' | 'landscape.natural.landcover' | 'landscape.natural.terrain' | 'poi' | 'poi.attraction' | 'poi.business' | 'poi.government' | 'poi.medical' | 'poi.park' | 'poi.place_of_worship' | 'poi.school' | 'poi.sports_complex' | 'road' | 'road.arterial' | 'road.highway' | 'road.highway.controlled_access' | 'road.local' | 'transit' | 'transit.line' | 'transit.station' | 'transit.station.airport' | 'transit.station.bus' | 'transit.station.rail' | 'water';
131 stylers: MapTypeStyler[];
132}
133/**
134 * If more than one key is specified in a single MapTypeStyler, all but one will be ignored.
135 */
136export interface MapTypeStyler {
137 color?: string;
138 gamma?: number;
139 hue?: string;
140 invert_lightness?: boolean;
141 lightness?: number;
142 saturation?: number;
143 visibility?: string;
144 weight?: number;
145}
146export interface InfoWindow extends MVCObject {
147 constructor(opts?: InfoWindowOptions): void;
148 close(): void;
149 getContent(): string | Node;
150 getPosition(): LatLng;
151 getZIndex(): number;
152 open(map?: GoogleMap, anchor?: MVCObject): void;
153 setContent(content: string | Node): void;
154 setOptions(options: InfoWindowOptions): void;
155 setPosition(position: LatLng | LatLngLiteral): void;
156 setZIndex(zIndex: number): void;
157}
158export interface MVCObject {
159 addListener(eventName: string, handler: Function): MapsEventListener;
160}
161export interface MapsEventListener {
162 remove(): void;
163}
164export interface Size {
165 height: number;
166 width: number;
167 constructor(width: number, height: number, widthUnit?: string, heightUnit?: string): void;
168 equals(other: Size): boolean;
169 toString(): string;
170}
171export interface InfoWindowOptions {
172 content?: string | Node;
173 disableAutoPan?: boolean;
174 maxWidth?: number;
175 pixelOffset?: Size;
176 position?: LatLng | LatLngLiteral;
177 zIndex?: number;
178}
179export interface Point {
180 x: number;
181 y: number;
182 equals(other: Point): boolean;
183 toString(): string;
184}
185export interface GoogleSymbol {
186 anchor?: Point;
187 fillColor?: string;
188 fillOpacity?: string;
189 labelOrigin?: Point;
190 path?: string;
191 rotation?: number;
192 scale?: number;
193 strokeColor?: string;
194 strokeOpacity?: number;
195 strokeWeight?: number;
196}
197export interface IconSequence {
198 fixedRotation?: boolean;
199 icon?: GoogleSymbol;
200 offset?: string;
201 repeat?: string;
202}
203export interface PolylineOptions {
204 clickable?: boolean;
205 draggable?: boolean;
206 editable?: boolean;
207 geodesic?: boolean;
208 icon?: Array<IconSequence>;
209 map?: GoogleMap;
210 path?: Array<LatLng> | Array<LatLng | LatLngLiteral>;
211 strokeColor?: string;
212 strokeOpacity?: number;
213 strokeWeight?: number;
214 visible?: boolean;
215 zIndex?: number;
216}
217export interface Polyline extends MVCObject {
218 getDraggable(): boolean;
219 getEditable(): boolean;
220 getMap(): GoogleMap;
221 getPath(): Array<LatLng>;
222 getVisible(): boolean;
223 setDraggable(draggable: boolean): void;
224 setEditable(editable: boolean): void;
225 setMap(map: GoogleMap): void;
226 setOptions(options: PolylineOptions): void;
227 setPath(path: Array<LatLng | LatLngLiteral>): void;
228 setVisible(visible: boolean): void;
229}
230/**
231 * PolyMouseEvent gets emitted when the user triggers mouse events on a polyline.
232 */
233export interface PolyMouseEvent extends MouseEvent {
234 edge: number;
235 path: number;
236 vertex: number;
237}
238export interface PolygonOptions {
239 clickable?: boolean;
240 draggable?: boolean;
241 editable?: boolean;
242 fillColor?: string;
243 fillOpacity?: number;
244 geodesic?: boolean;
245 icon?: Array<IconSequence>;
246 map?: GoogleMap;
247 paths?: Array<LatLng | LatLngLiteral> | Array<Array<LatLng | LatLngLiteral>>;
248 strokeColor?: string;
249 strokeOpacity?: number;
250 strokeWeight?: number;
251 visible?: boolean;
252 zIndex?: number;
253}
254export interface Polygon extends MVCObject {
255 getDraggable(): boolean;
256 getEditable(): boolean;
257 getMap(): GoogleMap;
258 getPath(): Array<LatLng>;
259 getPaths(): Array<Array<LatLng>>;
260 getVisible(): boolean;
261 setDraggable(draggable: boolean): void;
262 setEditable(editable: boolean): void;
263 setMap(map: GoogleMap): void;
264 setPath(path: Array<LatLng> | Array<LatLng | LatLngLiteral>): void;
265 setOptions(options: PolygonOptions): void;
266 setPaths(paths: Array<Array<LatLng | LatLngLiteral>> | Array<LatLng | LatLngLiteral>): void;
267 setVisible(visible: boolean): void;
268}
269export interface KmlLayer extends MVCObject {
270 getDefaultViewport(): LatLngBounds;
271 getMap(): GoogleMap;
272 getMetadata(): KmlLayerMetadata;
273 getStatus(): KmlLayerStatus;
274 getUrl(): string;
275 getZIndex(): number;
276 setMap(map: GoogleMap): void;
277 setOptions(options: KmlLayerOptions): void;
278 setUrl(url: string): void;
279 setZIndex(zIndex: number): void;
280}
281/**
282 * See: https://developers.google.com/maps/documentation/javascript/reference?hl=de#KmlLayerStatus
283 */
284export declare type KmlLayerStatus = 'DOCUMENT_NOT_FOUND' | 'DOCUMENT_TOO_LARGE' | 'FETCH_ERROR' | 'INVALID_DOCUMENT' | 'INVALID_REQUEST' | 'LIMITS_EXCEEDED' | 'OK' | 'TIMED_OUT' | 'UNKNOWN';
285/**
286 * See: https://developers.google.com/maps/documentation/javascript/reference?hl=de#KmlLayerMetadata
287 */
288export interface KmlLayerMetadata {
289 author: KmlAuthor;
290 description: string;
291 hasScreenOverlays: boolean;
292 name: string;
293 snippet: string;
294}
295export interface KmlAuthor {
296 email: string;
297 name: string;
298 uri: string;
299}
300export interface KmlLayerOptions {
301 clickable?: boolean;
302 map?: GoogleMap;
303 preserveViewport?: boolean;
304 screenOverlays?: boolean;
305 suppressInfoWindows?: boolean;
306 url?: string;
307 zIndex?: number;
308}
309export interface KmlFeatureData {
310 author: KmlAuthor;
311 description: string;
312 id: string;
313 infoWindowHtml: string;
314 name: string;
315 snippet: string;
316}
317export interface KmlMouseEvent extends MouseEvent {
318 featureData: KmlFeatureData;
319 pixelOffset: Size;
320}