UNPKG

6.3 kBTypeScriptView Raw
1/// <reference types="googlemaps" />
2import { AfterContentInit, EventEmitter, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
3import { PolygonManager } from '../services/managers/polygon-manager';
4import { MVCEvent } from '../utils/mvcarray-utils';
5/**
6 * AgmPolygon renders a polygon on a {@link AgmMap}
7 *
8 * ### Example
9 * ```typescript
10 * import { Component } from '@angular/core';
11 *
12 * @Component({
13 * selector: 'my-map-cmp',
14 * styles: [`
15 * agm-map {
16 * height: 300px;
17 * }
18 * `],
19 * template: `
20 * <agm-map [latitude]="lat" [longitude]="lng" [zoom]="zoom">
21 * <agm-polygon [paths]="paths">
22 * </agm-polygon>
23 * </agm-map>
24 * `
25 * })
26 * export class MyMapCmp {
27 * lat: number = 0;
28 * lng: number = 0;
29 * zoom: number = 10;
30 * paths: LatLngLiteral[] = [
31 * { lat: 0, lng: 10 },
32 * { lat: 0, lng: 20 },
33 * { lat: 10, lng: 20 },
34 * { lat: 10, lng: 10 },
35 * { lat: 0, lng: 10 }
36 * ]
37 * // Nesting paths will create a hole where they overlap;
38 * nestedPaths: LatLngLiteral[][] = [[
39 * { lat: 0, lng: 10 },
40 * { lat: 0, lng: 20 },
41 * { lat: 10, lng: 20 },
42 * { lat: 10, lng: 10 },
43 * { lat: 0, lng: 10 }
44 * ], [
45 * { lat: 0, lng: 15 },
46 * { lat: 0, lng: 20 },
47 * { lat: 5, lng: 20 },
48 * { lat: 5, lng: 15 },
49 * { lat: 0, lng: 15 }
50 * ]]
51 * }
52 * ```
53 */
54export declare class AgmPolygon implements OnDestroy, OnChanges, AfterContentInit {
55 private _polygonManager;
56 /**
57 * Indicates whether this Polygon handles mouse events. Defaults to true.
58 */
59 clickable: boolean;
60 /**
61 * If set to true, the user can drag this shape over the map. The geodesic
62 * property defines the mode of dragging. Defaults to false.
63 */
64 draggable: boolean;
65 /**
66 * If set to true, the user can edit this shape by dragging the control
67 * points shown at the vertices and on each segment. Defaults to false.
68 */
69 editable: boolean;
70 /**
71 * The fill color. All CSS3 colors are supported except for extended
72 * named colors.
73 */
74 fillColor: string;
75 /**
76 * The fill opacity between 0.0 and 1.0
77 */
78 fillOpacity: number;
79 /**
80 * When true, edges of the polygon are interpreted as geodesic and will
81 * follow the curvature of the Earth. When false, edges of the polygon are
82 * rendered as straight lines in screen space. Note that the shape of a
83 * geodesic polygon may appear to change when dragged, as the dimensions
84 * are maintained relative to the surface of the earth. Defaults to false.
85 */
86 geodesic: boolean;
87 /**
88 * The ordered sequence of coordinates that designates a closed loop.
89 * Unlike polylines, a polygon may consist of one or more paths.
90 * As a result, the paths property may specify one or more arrays of
91 * LatLng coordinates. Paths are closed automatically; do not repeat the
92 * first vertex of the path as the last vertex. Simple polygons may be
93 * defined using a single array of LatLngs. More complex polygons may
94 * specify an array of arrays. Any simple arrays are converted into Arrays.
95 * Inserting or removing LatLngs from the Array will automatically update
96 * the polygon on the map.
97 */
98 paths: google.maps.LatLng[] | google.maps.LatLng[][] | google.maps.MVCArray<google.maps.LatLng> | google.maps.MVCArray<google.maps.MVCArray<google.maps.LatLng>> | google.maps.LatLngLiteral[] | google.maps.LatLngLiteral[][];
99 /**
100 * The stroke color. All CSS3 colors are supported except for extended
101 * named colors.
102 */
103 strokeColor: string;
104 /**
105 * The stroke opacity between 0.0 and 1.0
106 */
107 strokeOpacity: number;
108 /**
109 * The stroke width in pixels.
110 */
111 strokeWeight: number;
112 /**
113 * Whether this polygon is visible on the map. Defaults to true.
114 */
115 visible: boolean;
116 /**
117 * The zIndex compared to other polys.
118 */
119 zIndex: number;
120 /**
121 * This event is fired when the DOM click event is fired on the Polygon.
122 */
123 polyClick: EventEmitter<google.maps.PolyMouseEvent>;
124 /**
125 * This event is fired when the DOM dblclick event is fired on the Polygon.
126 */
127 polyDblClick: EventEmitter<google.maps.PolyMouseEvent>;
128 /**
129 * This event is repeatedly fired while the user drags the polygon.
130 */
131 polyDrag: EventEmitter<google.maps.MouseEvent>;
132 /**
133 * This event is fired when the user stops dragging the polygon.
134 */
135 polyDragEnd: EventEmitter<google.maps.MouseEvent>;
136 /**
137 * This event is fired when the user starts dragging the polygon.
138 */
139 polyDragStart: EventEmitter<google.maps.MouseEvent>;
140 /**
141 * This event is fired when the DOM mousedown event is fired on the Polygon.
142 */
143 polyMouseDown: EventEmitter<google.maps.PolyMouseEvent>;
144 /**
145 * This event is fired when the DOM mousemove event is fired on the Polygon.
146 */
147 polyMouseMove: EventEmitter<google.maps.PolyMouseEvent>;
148 /**
149 * This event is fired on Polygon mouseout.
150 */
151 polyMouseOut: EventEmitter<google.maps.PolyMouseEvent>;
152 /**
153 * This event is fired on Polygon mouseover.
154 */
155 polyMouseOver: EventEmitter<google.maps.PolyMouseEvent>;
156 /**
157 * This event is fired whe the DOM mouseup event is fired on the Polygon
158 */
159 polyMouseUp: EventEmitter<google.maps.PolyMouseEvent>;
160 /**
161 * This event is fired when the Polygon is right-clicked on.
162 */
163 polyRightClick: EventEmitter<google.maps.PolyMouseEvent>;
164 /**
165 * This event is fired after Polygon first path changes.
166 */
167 polyPathsChange: EventEmitter<MVCEvent<google.maps.LatLng[] | google.maps.LatLngLiteral[]>>;
168 private static _polygonOptionsAttributes;
169 private _id;
170 private _polygonAddedToManager;
171 private _subscriptions;
172 constructor(_polygonManager: PolygonManager);
173 /** @internal */
174 ngAfterContentInit(): void;
175 ngOnChanges(changes: SimpleChanges): any;
176 private _init;
177 private _addEventListeners;
178 private _updatePolygonOptions;
179 /** @internal */
180 id(): string;
181 /** @internal */
182 ngOnDestroy(): void;
183 getPath(): Promise<google.maps.LatLng[]>;
184 getPaths(): Promise<google.maps.LatLng[][]>;
185}