UNPKG

12 kBTypeScriptView Raw
1declare namespace google.maps {
2 class Polyline extends MVCObject {
3 constructor(opts?: PolylineOptions);
4 getDraggable(): boolean;
5 getEditable(): boolean;
6 getMap(): Map;
7 getPath(): MVCArray<LatLng>;
8 getVisible(): boolean;
9 setDraggable(draggable: boolean): void;
10 setEditable(editable: boolean): void;
11 setMap(map: Map | null): void;
12 setOptions(options: PolylineOptions): void;
13 setPath(path: MVCArray<LatLng> | LatLng[] | LatLngLiteral[]): void;
14 setVisible(visible: boolean): void;
15 }
16
17 interface PolylineOptions {
18 /**
19 * Indicates whether this Polyline handles mouse events. Defaults to true.
20 */
21 clickable?: boolean;
22 /**
23 * If set to true, the user can drag this shape over the map.
24 * The geodesic property defines the mode of dragging. Defaults to false.
25 */
26 draggable?: boolean;
27 /**
28 * If set to true, the user can edit this shape by dragging the control
29 * points shown at the vertices and on each segment. Defaults to false.
30 */
31 editable?: boolean;
32 /**
33 * When true, edges of the polygon are interpreted as geodesic and will
34 * follow the curvature of the Earth. When false, edges of the polygon are
35 * rendered as straight lines in screen space. Note that the shape of a
36 * geodesic polygon may appear to change when dragged, as the dimensions are
37 * maintained relative to the surface of the earth. Defaults to false.
38 */
39 geodesic?: boolean;
40 /** The icons to be rendered along the polyline. */
41 icons?: IconSequence[];
42 /** Map on which to display Polyline. */
43 map?: Map;
44 /**
45 * The ordered sequence of coordinates of the Polyline.
46 * This path may be specified using either a simple array of LatLngs, or an
47 * MVCArray of LatLngs. Note that if you pass a simple array, it will be
48 * converted to an MVCArray Inserting or removing LatLngs in the MVCArray
49 * will automatically update the polyline on the map.
50 */
51 path?: MVCArray<LatLng> | LatLng[] | LatLngLiteral[];
52 /**
53 * The stroke color. All CSS3 colors are supported except for extended
54 * named colors.
55 */
56 strokeColor?: string;
57 /** The stroke opacity between 0.0 and 1.0. */
58 strokeOpacity?: number;
59 /** The stroke width in pixels. */
60 strokeWeight?: number;
61 /** Whether this polyline is visible on the map. Defaults to true. */
62 visible?: boolean;
63 /** The zIndex compared to other polys. */
64 zIndex?: number;
65 }
66
67 interface IconSequence {
68 fixedRotation?: boolean;
69 // tslint:disable-next-line:no-unnecessary-qualifier
70 icon?: google.maps.Symbol;
71 offset?: string;
72 repeat?: string;
73 }
74
75 class Polygon extends MVCObject {
76 constructor(opts?: PolygonOptions);
77 getDraggable(): boolean;
78 getEditable(): boolean;
79 getMap(): Map;
80 /** Retrieves the first path. */
81 getPath(): MVCArray<LatLng>;
82 /** Retrieves the paths for this polygon. */
83 getPaths(): MVCArray<MVCArray<LatLng>>;
84 getVisible(): boolean;
85 setDraggable(draggable: boolean): void;
86 setEditable(editable: boolean): void;
87 setMap(map: Map | null): void;
88 setOptions(options: PolygonOptions): void;
89 setPath(path: MVCArray<LatLng> | LatLng[] | LatLngLiteral[]): void;
90 setPaths(
91 paths:
92 | MVCArray<MVCArray<LatLng>>
93 | MVCArray<LatLng>
94 | LatLng[][]
95 | LatLngLiteral[][]
96 | LatLng[]
97 | LatLngLiteral[],
98 ): void;
99 setVisible(visible: boolean): void;
100 }
101
102 interface PolygonOptions {
103 /**
104 * Indicates whether this Polygon handles mouse events. Defaults to true.
105 */
106 clickable?: boolean;
107 /**
108 * If set to true, the user can drag this shape over the map.
109 * The geodesic property defines the mode of dragging. Defaults to false.
110 */
111 draggable?: boolean;
112 /**
113 * If set to true, the user can edit this shape by dragging the control
114 * points shown at the vertices and on each segment. Defaults to false.
115 */
116 editable?: boolean;
117 /**
118 * The fill color. All CSS3 colors are supported except for extended named
119 * colors.
120 */
121 fillColor?: string;
122 /** The fill opacity between 0.0 and 1.0 */
123 fillOpacity?: number;
124 /**
125 * When true, edges of the polygon are interpreted as geodesic and will
126 * follow the curvature of the Earth. When false, edges of the polygon are
127 * rendered as straight lines in screen space. Note that the shape of a
128 * geodesic polygon may appear to change when dragged, as the dimensions are
129 * maintained relative to the surface of the earth. Defaults to false.
130 */
131 geodesic?: boolean;
132 /** Map on which to display Polygon. */
133 map?: Map;
134 /**
135 * The ordered sequence of coordinates that designates a closed loop. Unlike
136 * polylines, a polygon may consist of one or more paths. As a result, the
137 * paths property may specify one or more arrays of LatLng coordinates.
138 * Paths are closed automatically; do not repeat the first vertex of the
139 * path as the last vertex. Simple polygons may be defined using a single
140 * array of LatLngs. More complex polygons may specify an array of arrays.
141 * Any simple arrays are converted into MVCArrays. Inserting or removing
142 * LatLngs from the MVCArray will automatically update the polygon on the
143 * map.
144 */
145 paths?:
146 | MVCArray<MVCArray<LatLng>>
147 | MVCArray<LatLng>
148 | LatLng[][]
149 | LatLngLiteral[][]
150 | LatLng[]
151 | LatLngLiteral[];
152 /**
153 * The stroke color.
154 * All CSS3 colors are supported except for extended named colors.
155 */
156 strokeColor?: string;
157 /** The stroke opacity between 0.0 and 1.0 */
158 strokeOpacity?: number;
159 /**
160 * The stroke position. Defaults to CENTER.
161 * This property is not supported on Internet Explorer 8 and earlier.
162 */
163 strokePosition?: StrokePosition;
164 /** The stroke width in pixels. */
165 strokeWeight?: number;
166 /** Whether this polygon is visible on the map. Defaults to true. */
167 visible?: boolean;
168 /** The zIndex compared to other polys. */
169 zIndex?: number;
170 }
171
172 interface PolyMouseEvent extends MouseEvent {
173 edge?: number;
174 path?: number;
175 vertex?: number;
176 }
177
178 class Rectangle extends MVCObject {
179 constructor(opts?: RectangleOptions);
180 getBounds(): LatLngBounds;
181 getDraggable(): boolean;
182 getEditable(): boolean;
183 getMap(): Map;
184 getVisible(): boolean;
185 setBounds(bounds: LatLngBounds | LatLngBoundsLiteral): void;
186 setDraggable(draggable: boolean): void;
187 setEditable(editable: boolean): void;
188 setMap(map: Map | null): void;
189 setOptions(options: RectangleOptions): void;
190 setVisible(visible: boolean): void;
191 }
192
193 interface RectangleOptions {
194 bounds?: LatLngBounds | LatLngBoundsLiteral;
195 clickable?: boolean;
196 draggable?: boolean;
197 editable?: boolean;
198 fillColor?: string;
199 fillOpacity?: number;
200 map?: Map;
201 strokeColor?: string;
202 strokeOpacity?: number;
203 strokePosition?: StrokePosition;
204 strokeWeight?: number;
205 visible?: boolean;
206 zIndex?: number;
207 }
208
209 /** A circle on the Earth's surface; also known as a "spherical cap". */
210 class Circle extends MVCObject {
211 /**
212 * Create a circle using the passed CircleOptions, which specify the
213 * center, radius, and style.
214 */
215 constructor(opts?: CircleOptions);
216 /** Gets the LatLngBounds of this Circle. */
217 getBounds(): LatLngBounds;
218 /** Returns the center of this circle. */
219 getCenter(): LatLng;
220 /** Returns whether this circle can be dragged by the user. */
221 getDraggable(): boolean;
222 /** Returns whether this circle can be edited by the user. */
223 getEditable(): boolean;
224 /** Returns the map on which this circle is displayed. */
225 getMap(): Map;
226 /** Returns the radius of this circle (in meters). */
227 getRadius(): number;
228 /** Returns whether this circle is visible on the map. */
229 getVisible(): boolean;
230 /** Sets the center of this circle. */
231 setCenter(center: LatLng | LatLngLiteral): void;
232 /** If set to true, the user can drag this circle over the map. */
233 setDraggable(draggable: boolean): void;
234 /**
235 * If set to true, the user can edit this circle by dragging the control
236 * points shown at the center and around the circumference of the circle.
237 */
238 setEditable(editable: boolean): void;
239 /**
240 * Renders the circle on the specified map. If map is set to null, the
241 * circle will be removed.
242 */
243 setMap(map: Map | null): void;
244 setOptions(options: CircleOptions): void;
245 /** Sets the radius of this circle (in meters). */
246 setRadius(radius: number): void;
247 /** Hides this circle if set to false. */
248 setVisible(visible: boolean): void;
249 }
250
251 interface CircleOptions {
252 /** The center */
253 center?: LatLng | LatLngLiteral;
254 /** Indicates whether this Circle handles mouse events. Defaults to true. */
255 clickable?: boolean;
256 /**
257 * If set to true, the user can drag this circle over the map. Defaults to
258 * false.
259 */
260 draggable?: boolean;
261 /**
262 * If set to true, the user can edit this circle by dragging the control
263 * points shown at the center and around the circumference of the circle.
264 * Defaults to false.
265 */
266 editable?: boolean;
267 /**
268 * The fill color. All CSS3 colors are supported except for extended named
269 * colors.
270 */
271 fillColor?: string;
272 /** The fill opacity between 0.0 and 1.0 */
273 fillOpacity?: number;
274 /** Map on which to display Circle. */
275 map?: Map;
276 /** The radius in meters on the Earth's surface */
277 radius?: number;
278 /**
279 * The stroke color. All CSS3 colors are supported except for extended
280 * named colors.
281 */
282 strokeColor?: string;
283 /** The stroke opacity between 0.0 and 1.0 */
284 strokeOpacity?: number;
285 /**
286 * The stroke position. Defaults to CENTER. This property is not supported
287 * on Internet Explorer 8 and earlier.
288 */
289 strokePosition?: StrokePosition;
290 /** The stroke width in pixels. */
291 strokeWeight?: number;
292 /** Whether this circle is visible on the map. Defaults to true. */
293 visible?: boolean;
294 /** The zIndex compared to other polys. */
295 zIndex?: number;
296 }
297
298 /**
299 * The possible positions of the stroke on a polygon.
300 */
301 enum StrokePosition {
302 /**
303 * The stroke is centered on the polygon's path, with half the stroke inside
304 * the polygon and half the stroke outside the polygon.
305 */
306 CENTER = 0,
307 /** The stroke lies inside the polygon. */
308 INSIDE = 1,
309 /** The stroke lies outside the polygon. */
310 OUTSIDE = 2,
311 }
312}