@angular/google-maps 16.0.0-next.5 → 16.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{esm2020 → esm2022}/google-map/google-map.mjs +3 -3
- package/{esm2020 → esm2022}/google-maps-module.mjs +34 -34
- package/{esm2020 → esm2022}/map-base-layer.mjs +3 -3
- package/{esm2020 → esm2022}/map-bicycling-layer/map-bicycling-layer.mjs +3 -3
- package/{esm2020 → esm2022}/map-circle/map-circle.mjs +3 -3
- package/{esm2020 → esm2022}/map-directions-renderer/map-directions-renderer.mjs +3 -3
- package/{esm2020 → esm2022}/map-directions-renderer/map-directions-service.mjs +3 -3
- package/{esm2020 → esm2022}/map-geocoder/map-geocoder.mjs +3 -3
- package/{esm2020 → esm2022}/map-ground-overlay/map-ground-overlay.mjs +3 -3
- package/{esm2020 → esm2022}/map-heatmap-layer/map-heatmap-layer.mjs +3 -3
- package/{esm2020 → esm2022}/map-info-window/map-info-window.mjs +3 -3
- package/{esm2020 → esm2022}/map-kml-layer/map-kml-layer.mjs +3 -3
- package/{esm2020 → esm2022}/map-marker/map-marker.mjs +3 -3
- package/{esm2020 → esm2022}/map-marker-clusterer/map-marker-clusterer.mjs +3 -3
- package/{esm2020 → esm2022}/map-polygon/map-polygon.mjs +3 -3
- package/{esm2020 → esm2022}/map-polyline/map-polyline.mjs +3 -3
- package/{esm2020 → esm2022}/map-rectangle/map-rectangle.mjs +3 -3
- package/{esm2020 → esm2022}/map-traffic-layer/map-traffic-layer.mjs +3 -3
- package/{esm2020 → esm2022}/map-transit-layer/map-transit-layer.mjs +3 -3
- package/{fesm2020 → fesm2022}/google-maps.mjs +69 -69
- package/{fesm2020 → fesm2022}/google-maps.mjs.map +1 -1
- package/package.json +5 -11
- package/fesm2015/google-maps.mjs +0 -3189
- package/fesm2015/google-maps.mjs.map +0 -1
- /package/{esm2020 → esm2022}/google-maps_public_index.mjs +0 -0
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/map-anchor-point.mjs +0 -0
- /package/{esm2020 → esm2022}/map-event-manager.mjs +0 -0
- /package/{esm2020 → esm2022}/map-marker-clusterer/marker-clusterer-types.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
package/fesm2015/google-maps.mjs
DELETED
|
@@ -1,3189 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, NgZone, EventEmitter, PLATFORM_ID, Component, ChangeDetectionStrategy, ViewEncapsulation, Inject, Input, Output, Directive, ContentChildren, NgModule, Injectable } from '@angular/core';
|
|
3
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
4
|
-
import { BehaviorSubject, Observable, Subject, combineLatest } from 'rxjs';
|
|
5
|
-
import { switchMap, take, map, takeUntil } from 'rxjs/operators';
|
|
6
|
-
|
|
7
|
-
/** Manages event on a Google Maps object, ensuring that events are added only when necessary. */
|
|
8
|
-
class MapEventManager {
|
|
9
|
-
/** Clears all currently-registered event listeners. */
|
|
10
|
-
_clearListeners() {
|
|
11
|
-
for (const listener of this._listeners) {
|
|
12
|
-
listener.remove();
|
|
13
|
-
}
|
|
14
|
-
this._listeners = [];
|
|
15
|
-
}
|
|
16
|
-
constructor(_ngZone) {
|
|
17
|
-
this._ngZone = _ngZone;
|
|
18
|
-
/** Pending listeners that were added before the target was set. */
|
|
19
|
-
this._pending = [];
|
|
20
|
-
this._listeners = [];
|
|
21
|
-
this._targetStream = new BehaviorSubject(undefined);
|
|
22
|
-
}
|
|
23
|
-
/** Gets an observable that adds an event listener to the map when a consumer subscribes to it. */
|
|
24
|
-
getLazyEmitter(name) {
|
|
25
|
-
return this._targetStream.pipe(switchMap(target => {
|
|
26
|
-
const observable = new Observable(observer => {
|
|
27
|
-
// If the target hasn't been initialized yet, cache the observer so it can be added later.
|
|
28
|
-
if (!target) {
|
|
29
|
-
this._pending.push({ observable, observer });
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
const listener = target.addListener(name, (event) => {
|
|
33
|
-
this._ngZone.run(() => observer.next(event));
|
|
34
|
-
});
|
|
35
|
-
// If there's an error when initializing the Maps API (e.g. a wrong API key), it will
|
|
36
|
-
// return a dummy object that returns `undefined` from `addListener` (see #26514).
|
|
37
|
-
if (!listener) {
|
|
38
|
-
observer.complete();
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
this._listeners.push(listener);
|
|
42
|
-
return () => listener.remove();
|
|
43
|
-
});
|
|
44
|
-
return observable;
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
/** Sets the current target that the manager should bind events to. */
|
|
48
|
-
setTarget(target) {
|
|
49
|
-
const currentTarget = this._targetStream.value;
|
|
50
|
-
if (target === currentTarget) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
// Clear the listeners from the pre-existing target.
|
|
54
|
-
if (currentTarget) {
|
|
55
|
-
this._clearListeners();
|
|
56
|
-
this._pending = [];
|
|
57
|
-
}
|
|
58
|
-
this._targetStream.next(target);
|
|
59
|
-
// Add the listeners that were bound before the map was initialized.
|
|
60
|
-
this._pending.forEach(subscriber => subscriber.observable.subscribe(subscriber.observer));
|
|
61
|
-
this._pending = [];
|
|
62
|
-
}
|
|
63
|
-
/** Destroys the manager and clears the event listeners. */
|
|
64
|
-
destroy() {
|
|
65
|
-
this._clearListeners();
|
|
66
|
-
this._pending = [];
|
|
67
|
-
this._targetStream.complete();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/// <reference types="google.maps" />
|
|
72
|
-
/** default options set to the Googleplex */
|
|
73
|
-
const DEFAULT_OPTIONS = {
|
|
74
|
-
center: { lat: 37.421995, lng: -122.084092 },
|
|
75
|
-
zoom: 17,
|
|
76
|
-
// Note: the type conversion here isn't necessary for our CI, but it resolves a g3 failure.
|
|
77
|
-
mapTypeId: 'roadmap',
|
|
78
|
-
};
|
|
79
|
-
/** Arbitrary default height for the map element */
|
|
80
|
-
const DEFAULT_HEIGHT = '500px';
|
|
81
|
-
/** Arbitrary default width for the map element */
|
|
82
|
-
const DEFAULT_WIDTH = '500px';
|
|
83
|
-
/**
|
|
84
|
-
* Angular component that renders a Google Map via the Google Maps JavaScript
|
|
85
|
-
* API.
|
|
86
|
-
* @see https://developers.google.com/maps/documentation/javascript/reference/
|
|
87
|
-
*/
|
|
88
|
-
class GoogleMap {
|
|
89
|
-
set center(center) {
|
|
90
|
-
this._center = center;
|
|
91
|
-
}
|
|
92
|
-
set zoom(zoom) {
|
|
93
|
-
this._zoom = zoom;
|
|
94
|
-
}
|
|
95
|
-
set options(options) {
|
|
96
|
-
this._options = options || DEFAULT_OPTIONS;
|
|
97
|
-
}
|
|
98
|
-
constructor(_elementRef, _ngZone, platformId) {
|
|
99
|
-
this._elementRef = _elementRef;
|
|
100
|
-
this._ngZone = _ngZone;
|
|
101
|
-
this._eventManager = new MapEventManager(inject(NgZone));
|
|
102
|
-
/** Height of the map. Set this to `null` if you'd like to control the height through CSS. */
|
|
103
|
-
this.height = DEFAULT_HEIGHT;
|
|
104
|
-
/** Width of the map. Set this to `null` if you'd like to control the width through CSS. */
|
|
105
|
-
this.width = DEFAULT_WIDTH;
|
|
106
|
-
this._options = DEFAULT_OPTIONS;
|
|
107
|
-
/** Event emitted when the map is initialized. */
|
|
108
|
-
this.mapInitialized = new EventEmitter();
|
|
109
|
-
/**
|
|
110
|
-
* See
|
|
111
|
-
* https://developers.google.com/maps/documentation/javascript/events#auth-errors
|
|
112
|
-
*/
|
|
113
|
-
this.authFailure = new EventEmitter();
|
|
114
|
-
/**
|
|
115
|
-
* See
|
|
116
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.bounds_changed
|
|
117
|
-
*/
|
|
118
|
-
this.boundsChanged = this._eventManager.getLazyEmitter('bounds_changed');
|
|
119
|
-
/**
|
|
120
|
-
* See
|
|
121
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.center_changed
|
|
122
|
-
*/
|
|
123
|
-
this.centerChanged = this._eventManager.getLazyEmitter('center_changed');
|
|
124
|
-
/**
|
|
125
|
-
* See
|
|
126
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.click
|
|
127
|
-
*/
|
|
128
|
-
this.mapClick = this._eventManager.getLazyEmitter('click');
|
|
129
|
-
/**
|
|
130
|
-
* See
|
|
131
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.dblclick
|
|
132
|
-
*/
|
|
133
|
-
this.mapDblclick = this._eventManager.getLazyEmitter('dblclick');
|
|
134
|
-
/**
|
|
135
|
-
* See
|
|
136
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.drag
|
|
137
|
-
*/
|
|
138
|
-
this.mapDrag = this._eventManager.getLazyEmitter('drag');
|
|
139
|
-
/**
|
|
140
|
-
* See
|
|
141
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.dragend
|
|
142
|
-
*/
|
|
143
|
-
this.mapDragend = this._eventManager.getLazyEmitter('dragend');
|
|
144
|
-
/**
|
|
145
|
-
* See
|
|
146
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.dragstart
|
|
147
|
-
*/
|
|
148
|
-
this.mapDragstart = this._eventManager.getLazyEmitter('dragstart');
|
|
149
|
-
/**
|
|
150
|
-
* See
|
|
151
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.heading_changed
|
|
152
|
-
*/
|
|
153
|
-
this.headingChanged = this._eventManager.getLazyEmitter('heading_changed');
|
|
154
|
-
/**
|
|
155
|
-
* See
|
|
156
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.idle
|
|
157
|
-
*/
|
|
158
|
-
this.idle = this._eventManager.getLazyEmitter('idle');
|
|
159
|
-
/**
|
|
160
|
-
* See
|
|
161
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.maptypeid_changed
|
|
162
|
-
*/
|
|
163
|
-
this.maptypeidChanged = this._eventManager.getLazyEmitter('maptypeid_changed');
|
|
164
|
-
/**
|
|
165
|
-
* See
|
|
166
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.mousemove
|
|
167
|
-
*/
|
|
168
|
-
this.mapMousemove = this._eventManager.getLazyEmitter('mousemove');
|
|
169
|
-
/**
|
|
170
|
-
* See
|
|
171
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.mouseout
|
|
172
|
-
*/
|
|
173
|
-
this.mapMouseout = this._eventManager.getLazyEmitter('mouseout');
|
|
174
|
-
/**
|
|
175
|
-
* See
|
|
176
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.mouseover
|
|
177
|
-
*/
|
|
178
|
-
this.mapMouseover = this._eventManager.getLazyEmitter('mouseover');
|
|
179
|
-
/**
|
|
180
|
-
* See
|
|
181
|
-
* developers.google.com/maps/documentation/javascript/reference/map#Map.projection_changed
|
|
182
|
-
*/
|
|
183
|
-
this.projectionChanged = this._eventManager.getLazyEmitter('projection_changed');
|
|
184
|
-
/**
|
|
185
|
-
* See
|
|
186
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.rightclick
|
|
187
|
-
*/
|
|
188
|
-
this.mapRightclick = this._eventManager.getLazyEmitter('rightclick');
|
|
189
|
-
/**
|
|
190
|
-
* See
|
|
191
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.tilesloaded
|
|
192
|
-
*/
|
|
193
|
-
this.tilesloaded = this._eventManager.getLazyEmitter('tilesloaded');
|
|
194
|
-
/**
|
|
195
|
-
* See
|
|
196
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.tilt_changed
|
|
197
|
-
*/
|
|
198
|
-
this.tiltChanged = this._eventManager.getLazyEmitter('tilt_changed');
|
|
199
|
-
/**
|
|
200
|
-
* See
|
|
201
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.zoom_changed
|
|
202
|
-
*/
|
|
203
|
-
this.zoomChanged = this._eventManager.getLazyEmitter('zoom_changed');
|
|
204
|
-
this._isBrowser = isPlatformBrowser(platformId);
|
|
205
|
-
if (this._isBrowser) {
|
|
206
|
-
const googleMapsWindow = window;
|
|
207
|
-
if (!googleMapsWindow.google && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
208
|
-
throw Error('Namespace google not found, cannot construct embedded google ' +
|
|
209
|
-
'map. Please install the Google Maps JavaScript API: ' +
|
|
210
|
-
'https://developers.google.com/maps/documentation/javascript/' +
|
|
211
|
-
'tutorial#Loading_the_Maps_API');
|
|
212
|
-
}
|
|
213
|
-
this._existingAuthFailureCallback = googleMapsWindow.gm_authFailure;
|
|
214
|
-
googleMapsWindow.gm_authFailure = () => {
|
|
215
|
-
if (this._existingAuthFailureCallback) {
|
|
216
|
-
this._existingAuthFailureCallback();
|
|
217
|
-
}
|
|
218
|
-
this.authFailure.emit();
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
ngOnChanges(changes) {
|
|
223
|
-
if (changes['height'] || changes['width']) {
|
|
224
|
-
this._setSize();
|
|
225
|
-
}
|
|
226
|
-
const googleMap = this.googleMap;
|
|
227
|
-
if (googleMap) {
|
|
228
|
-
if (changes['options']) {
|
|
229
|
-
googleMap.setOptions(this._combineOptions());
|
|
230
|
-
}
|
|
231
|
-
if (changes['center'] && this._center) {
|
|
232
|
-
googleMap.setCenter(this._center);
|
|
233
|
-
}
|
|
234
|
-
// Note that the zoom can be zero.
|
|
235
|
-
if (changes['zoom'] && this._zoom != null) {
|
|
236
|
-
googleMap.setZoom(this._zoom);
|
|
237
|
-
}
|
|
238
|
-
if (changes['mapTypeId'] && this.mapTypeId) {
|
|
239
|
-
googleMap.setMapTypeId(this.mapTypeId);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
ngOnInit() {
|
|
244
|
-
// It should be a noop during server-side rendering.
|
|
245
|
-
if (this._isBrowser) {
|
|
246
|
-
this._mapEl = this._elementRef.nativeElement.querySelector('.map-container');
|
|
247
|
-
this._setSize();
|
|
248
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
249
|
-
// We'll bring it back in inside the `MapEventManager` only for the events that the
|
|
250
|
-
// user has subscribed to.
|
|
251
|
-
this._ngZone.runOutsideAngular(() => {
|
|
252
|
-
this.googleMap = new google.maps.Map(this._mapEl, this._combineOptions());
|
|
253
|
-
});
|
|
254
|
-
this._eventManager.setTarget(this.googleMap);
|
|
255
|
-
this.mapInitialized.emit(this.googleMap);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
ngOnDestroy() {
|
|
259
|
-
this._eventManager.destroy();
|
|
260
|
-
if (this._isBrowser) {
|
|
261
|
-
const googleMapsWindow = window;
|
|
262
|
-
googleMapsWindow.gm_authFailure = this._existingAuthFailureCallback;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* See
|
|
267
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.fitBounds
|
|
268
|
-
*/
|
|
269
|
-
fitBounds(bounds, padding) {
|
|
270
|
-
this._assertInitialized();
|
|
271
|
-
this.googleMap.fitBounds(bounds, padding);
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* See
|
|
275
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.panBy
|
|
276
|
-
*/
|
|
277
|
-
panBy(x, y) {
|
|
278
|
-
this._assertInitialized();
|
|
279
|
-
this.googleMap.panBy(x, y);
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* See
|
|
283
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.panTo
|
|
284
|
-
*/
|
|
285
|
-
panTo(latLng) {
|
|
286
|
-
this._assertInitialized();
|
|
287
|
-
this.googleMap.panTo(latLng);
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* See
|
|
291
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.panToBounds
|
|
292
|
-
*/
|
|
293
|
-
panToBounds(latLngBounds, padding) {
|
|
294
|
-
this._assertInitialized();
|
|
295
|
-
this.googleMap.panToBounds(latLngBounds, padding);
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* See
|
|
299
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.getBounds
|
|
300
|
-
*/
|
|
301
|
-
getBounds() {
|
|
302
|
-
this._assertInitialized();
|
|
303
|
-
return this.googleMap.getBounds() || null;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* See
|
|
307
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.getCenter
|
|
308
|
-
*/
|
|
309
|
-
getCenter() {
|
|
310
|
-
this._assertInitialized();
|
|
311
|
-
return this.googleMap.getCenter();
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* See
|
|
315
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.getClickableIcons
|
|
316
|
-
*/
|
|
317
|
-
getClickableIcons() {
|
|
318
|
-
this._assertInitialized();
|
|
319
|
-
return this.googleMap.getClickableIcons();
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* See
|
|
323
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.getHeading
|
|
324
|
-
*/
|
|
325
|
-
getHeading() {
|
|
326
|
-
this._assertInitialized();
|
|
327
|
-
return this.googleMap.getHeading();
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* See
|
|
331
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.getMapTypeId
|
|
332
|
-
*/
|
|
333
|
-
getMapTypeId() {
|
|
334
|
-
this._assertInitialized();
|
|
335
|
-
return this.googleMap.getMapTypeId();
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* See
|
|
339
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.getProjection
|
|
340
|
-
*/
|
|
341
|
-
getProjection() {
|
|
342
|
-
this._assertInitialized();
|
|
343
|
-
return this.googleMap.getProjection() || null;
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* See
|
|
347
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.getStreetView
|
|
348
|
-
*/
|
|
349
|
-
getStreetView() {
|
|
350
|
-
this._assertInitialized();
|
|
351
|
-
return this.googleMap.getStreetView();
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* See
|
|
355
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.getTilt
|
|
356
|
-
*/
|
|
357
|
-
getTilt() {
|
|
358
|
-
this._assertInitialized();
|
|
359
|
-
return this.googleMap.getTilt();
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* See
|
|
363
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.getZoom
|
|
364
|
-
*/
|
|
365
|
-
getZoom() {
|
|
366
|
-
this._assertInitialized();
|
|
367
|
-
return this.googleMap.getZoom();
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* See
|
|
371
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.controls
|
|
372
|
-
*/
|
|
373
|
-
get controls() {
|
|
374
|
-
this._assertInitialized();
|
|
375
|
-
return this.googleMap.controls;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* See
|
|
379
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.data
|
|
380
|
-
*/
|
|
381
|
-
get data() {
|
|
382
|
-
this._assertInitialized();
|
|
383
|
-
return this.googleMap.data;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* See
|
|
387
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.mapTypes
|
|
388
|
-
*/
|
|
389
|
-
get mapTypes() {
|
|
390
|
-
this._assertInitialized();
|
|
391
|
-
return this.googleMap.mapTypes;
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* See
|
|
395
|
-
* https://developers.google.com/maps/documentation/javascript/reference/map#Map.overlayMapTypes
|
|
396
|
-
*/
|
|
397
|
-
get overlayMapTypes() {
|
|
398
|
-
this._assertInitialized();
|
|
399
|
-
return this.googleMap.overlayMapTypes;
|
|
400
|
-
}
|
|
401
|
-
_setSize() {
|
|
402
|
-
if (this._mapEl) {
|
|
403
|
-
const styles = this._mapEl.style;
|
|
404
|
-
styles.height =
|
|
405
|
-
this.height === null ? '' : coerceCssPixelValue(this.height) || DEFAULT_HEIGHT;
|
|
406
|
-
styles.width = this.width === null ? '' : coerceCssPixelValue(this.width) || DEFAULT_WIDTH;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
/** Combines the center and zoom and the other map options into a single object */
|
|
410
|
-
_combineOptions() {
|
|
411
|
-
var _a, _b;
|
|
412
|
-
const options = this._options || {};
|
|
413
|
-
return Object.assign(Object.assign({}, options), {
|
|
414
|
-
// It's important that we set **some** kind of `center` and `zoom`, otherwise
|
|
415
|
-
// Google Maps will render a blank rectangle which looks broken.
|
|
416
|
-
center: this._center || options.center || DEFAULT_OPTIONS.center, zoom: (_b = (_a = this._zoom) !== null && _a !== void 0 ? _a : options.zoom) !== null && _b !== void 0 ? _b : DEFAULT_OPTIONS.zoom,
|
|
417
|
-
// Passing in an undefined `mapTypeId` seems to break tile loading
|
|
418
|
-
// so make sure that we have some kind of default (see #22082).
|
|
419
|
-
mapTypeId: this.mapTypeId || options.mapTypeId || DEFAULT_OPTIONS.mapTypeId });
|
|
420
|
-
}
|
|
421
|
-
/** Asserts that the map has been initialized. */
|
|
422
|
-
_assertInitialized() {
|
|
423
|
-
if (!this.googleMap && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
424
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
425
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
GoogleMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: GoogleMap, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
|
|
430
|
-
GoogleMap.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0-next.7", type: GoogleMap, selector: "google-map", inputs: { height: "height", width: "width", mapTypeId: "mapTypeId", center: "center", zoom: "zoom", options: "options" }, outputs: { mapInitialized: "mapInitialized", authFailure: "authFailure", boundsChanged: "boundsChanged", centerChanged: "centerChanged", mapClick: "mapClick", mapDblclick: "mapDblclick", mapDrag: "mapDrag", mapDragend: "mapDragend", mapDragstart: "mapDragstart", headingChanged: "headingChanged", idle: "idle", maptypeidChanged: "maptypeidChanged", mapMousemove: "mapMousemove", mapMouseout: "mapMouseout", mapMouseover: "mapMouseover", projectionChanged: "projectionChanged", mapRightclick: "mapRightclick", tilesloaded: "tilesloaded", tiltChanged: "tiltChanged", zoomChanged: "zoomChanged" }, exportAs: ["googleMap"], usesOnChanges: true, ngImport: i0, template: '<div class="map-container"></div><ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
431
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: GoogleMap, decorators: [{
|
|
432
|
-
type: Component,
|
|
433
|
-
args: [{
|
|
434
|
-
selector: 'google-map',
|
|
435
|
-
exportAs: 'googleMap',
|
|
436
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
437
|
-
template: '<div class="map-container"></div><ng-content></ng-content>',
|
|
438
|
-
encapsulation: ViewEncapsulation.None,
|
|
439
|
-
}]
|
|
440
|
-
}], ctorParameters: function () {
|
|
441
|
-
return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
442
|
-
type: Inject,
|
|
443
|
-
args: [PLATFORM_ID]
|
|
444
|
-
}] }];
|
|
445
|
-
}, propDecorators: { height: [{
|
|
446
|
-
type: Input
|
|
447
|
-
}], width: [{
|
|
448
|
-
type: Input
|
|
449
|
-
}], mapTypeId: [{
|
|
450
|
-
type: Input
|
|
451
|
-
}], center: [{
|
|
452
|
-
type: Input
|
|
453
|
-
}], zoom: [{
|
|
454
|
-
type: Input
|
|
455
|
-
}], options: [{
|
|
456
|
-
type: Input
|
|
457
|
-
}], mapInitialized: [{
|
|
458
|
-
type: Output
|
|
459
|
-
}], authFailure: [{
|
|
460
|
-
type: Output
|
|
461
|
-
}], boundsChanged: [{
|
|
462
|
-
type: Output
|
|
463
|
-
}], centerChanged: [{
|
|
464
|
-
type: Output
|
|
465
|
-
}], mapClick: [{
|
|
466
|
-
type: Output
|
|
467
|
-
}], mapDblclick: [{
|
|
468
|
-
type: Output
|
|
469
|
-
}], mapDrag: [{
|
|
470
|
-
type: Output
|
|
471
|
-
}], mapDragend: [{
|
|
472
|
-
type: Output
|
|
473
|
-
}], mapDragstart: [{
|
|
474
|
-
type: Output
|
|
475
|
-
}], headingChanged: [{
|
|
476
|
-
type: Output
|
|
477
|
-
}], idle: [{
|
|
478
|
-
type: Output
|
|
479
|
-
}], maptypeidChanged: [{
|
|
480
|
-
type: Output
|
|
481
|
-
}], mapMousemove: [{
|
|
482
|
-
type: Output
|
|
483
|
-
}], mapMouseout: [{
|
|
484
|
-
type: Output
|
|
485
|
-
}], mapMouseover: [{
|
|
486
|
-
type: Output
|
|
487
|
-
}], projectionChanged: [{
|
|
488
|
-
type: Output
|
|
489
|
-
}], mapRightclick: [{
|
|
490
|
-
type: Output
|
|
491
|
-
}], tilesloaded: [{
|
|
492
|
-
type: Output
|
|
493
|
-
}], tiltChanged: [{
|
|
494
|
-
type: Output
|
|
495
|
-
}], zoomChanged: [{
|
|
496
|
-
type: Output
|
|
497
|
-
}] } });
|
|
498
|
-
const cssUnitsPattern = /([A-Za-z%]+)$/;
|
|
499
|
-
/** Coerces a value to a CSS pixel value. */
|
|
500
|
-
function coerceCssPixelValue(value) {
|
|
501
|
-
if (value == null) {
|
|
502
|
-
return '';
|
|
503
|
-
}
|
|
504
|
-
return cssUnitsPattern.test(value) ? value : `${value}px`;
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
/// <reference types="google.maps" />
|
|
508
|
-
class MapBaseLayer {
|
|
509
|
-
constructor(_map, _ngZone) {
|
|
510
|
-
this._map = _map;
|
|
511
|
-
this._ngZone = _ngZone;
|
|
512
|
-
}
|
|
513
|
-
ngOnInit() {
|
|
514
|
-
if (this._map._isBrowser) {
|
|
515
|
-
this._ngZone.runOutsideAngular(() => {
|
|
516
|
-
this._initializeObject();
|
|
517
|
-
});
|
|
518
|
-
this._assertInitialized();
|
|
519
|
-
this._setMap();
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
ngOnDestroy() {
|
|
523
|
-
this._unsetMap();
|
|
524
|
-
}
|
|
525
|
-
_assertInitialized() {
|
|
526
|
-
if (!this._map.googleMap) {
|
|
527
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
528
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
_initializeObject() { }
|
|
532
|
-
_setMap() { }
|
|
533
|
-
_unsetMap() { }
|
|
534
|
-
}
|
|
535
|
-
MapBaseLayer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapBaseLayer, deps: [{ token: GoogleMap }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
536
|
-
MapBaseLayer.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapBaseLayer, selector: "map-base-layer", exportAs: ["mapBaseLayer"], ngImport: i0 });
|
|
537
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapBaseLayer, decorators: [{
|
|
538
|
-
type: Directive,
|
|
539
|
-
args: [{
|
|
540
|
-
selector: 'map-base-layer',
|
|
541
|
-
exportAs: 'mapBaseLayer',
|
|
542
|
-
}]
|
|
543
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.NgZone }]; } });
|
|
544
|
-
|
|
545
|
-
/// <reference types="google.maps" />
|
|
546
|
-
/**
|
|
547
|
-
* Angular component that renders a Google Maps Bicycling Layer via the Google Maps JavaScript API.
|
|
548
|
-
*
|
|
549
|
-
* See developers.google.com/maps/documentation/javascript/reference/map#BicyclingLayer
|
|
550
|
-
*/
|
|
551
|
-
class MapBicyclingLayer extends MapBaseLayer {
|
|
552
|
-
_initializeObject() {
|
|
553
|
-
this.bicyclingLayer = new google.maps.BicyclingLayer();
|
|
554
|
-
}
|
|
555
|
-
_setMap() {
|
|
556
|
-
this._assertLayerInitialized();
|
|
557
|
-
this.bicyclingLayer.setMap(this._map.googleMap);
|
|
558
|
-
}
|
|
559
|
-
_unsetMap() {
|
|
560
|
-
if (this.bicyclingLayer) {
|
|
561
|
-
this.bicyclingLayer.setMap(null);
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
_assertLayerInitialized() {
|
|
565
|
-
if (!this.bicyclingLayer) {
|
|
566
|
-
throw Error('Cannot interact with a Google Map Bicycling Layer before it has been initialized. ' +
|
|
567
|
-
'Please wait for the Transit Layer to load before trying to interact with it.');
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
MapBicyclingLayer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapBicyclingLayer, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
572
|
-
MapBicyclingLayer.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapBicyclingLayer, selector: "map-bicycling-layer", exportAs: ["mapBicyclingLayer"], usesInheritance: true, ngImport: i0 });
|
|
573
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapBicyclingLayer, decorators: [{
|
|
574
|
-
type: Directive,
|
|
575
|
-
args: [{
|
|
576
|
-
selector: 'map-bicycling-layer',
|
|
577
|
-
exportAs: 'mapBicyclingLayer',
|
|
578
|
-
}]
|
|
579
|
-
}] });
|
|
580
|
-
|
|
581
|
-
/// <reference types="google.maps" />
|
|
582
|
-
/**
|
|
583
|
-
* Angular component that renders a Google Maps Circle via the Google Maps JavaScript API.
|
|
584
|
-
* @see developers.google.com/maps/documentation/javascript/reference/polygon#Circle
|
|
585
|
-
*/
|
|
586
|
-
class MapCircle {
|
|
587
|
-
set options(options) {
|
|
588
|
-
this._options.next(options || {});
|
|
589
|
-
}
|
|
590
|
-
set center(center) {
|
|
591
|
-
this._center.next(center);
|
|
592
|
-
}
|
|
593
|
-
set radius(radius) {
|
|
594
|
-
this._radius.next(radius);
|
|
595
|
-
}
|
|
596
|
-
constructor(_map, _ngZone) {
|
|
597
|
-
this._map = _map;
|
|
598
|
-
this._ngZone = _ngZone;
|
|
599
|
-
this._eventManager = new MapEventManager(inject(NgZone));
|
|
600
|
-
this._options = new BehaviorSubject({});
|
|
601
|
-
this._center = new BehaviorSubject(undefined);
|
|
602
|
-
this._radius = new BehaviorSubject(undefined);
|
|
603
|
-
this._destroyed = new Subject();
|
|
604
|
-
/**
|
|
605
|
-
* @see
|
|
606
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.center_changed
|
|
607
|
-
*/
|
|
608
|
-
this.centerChanged = this._eventManager.getLazyEmitter('center_changed');
|
|
609
|
-
/**
|
|
610
|
-
* @see
|
|
611
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.click
|
|
612
|
-
*/
|
|
613
|
-
this.circleClick = this._eventManager.getLazyEmitter('click');
|
|
614
|
-
/**
|
|
615
|
-
* @see
|
|
616
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.dblclick
|
|
617
|
-
*/
|
|
618
|
-
this.circleDblclick = this._eventManager.getLazyEmitter('dblclick');
|
|
619
|
-
/**
|
|
620
|
-
* @see
|
|
621
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.drag
|
|
622
|
-
*/
|
|
623
|
-
this.circleDrag = this._eventManager.getLazyEmitter('drag');
|
|
624
|
-
/**
|
|
625
|
-
* @see
|
|
626
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.dragend
|
|
627
|
-
*/
|
|
628
|
-
this.circleDragend = this._eventManager.getLazyEmitter('dragend');
|
|
629
|
-
/**
|
|
630
|
-
* @see
|
|
631
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.dragstart
|
|
632
|
-
*/
|
|
633
|
-
this.circleDragstart = this._eventManager.getLazyEmitter('dragstart');
|
|
634
|
-
/**
|
|
635
|
-
* @see
|
|
636
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.mousedown
|
|
637
|
-
*/
|
|
638
|
-
this.circleMousedown = this._eventManager.getLazyEmitter('mousedown');
|
|
639
|
-
/**
|
|
640
|
-
* @see
|
|
641
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.mousemove
|
|
642
|
-
*/
|
|
643
|
-
this.circleMousemove = this._eventManager.getLazyEmitter('mousemove');
|
|
644
|
-
/**
|
|
645
|
-
* @see
|
|
646
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.mouseout
|
|
647
|
-
*/
|
|
648
|
-
this.circleMouseout = this._eventManager.getLazyEmitter('mouseout');
|
|
649
|
-
/**
|
|
650
|
-
* @see
|
|
651
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.mouseover
|
|
652
|
-
*/
|
|
653
|
-
this.circleMouseover = this._eventManager.getLazyEmitter('mouseover');
|
|
654
|
-
/**
|
|
655
|
-
* @see
|
|
656
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.mouseup
|
|
657
|
-
*/
|
|
658
|
-
this.circleMouseup = this._eventManager.getLazyEmitter('mouseup');
|
|
659
|
-
/**
|
|
660
|
-
* @see
|
|
661
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.radius_changed
|
|
662
|
-
*/
|
|
663
|
-
this.radiusChanged = this._eventManager.getLazyEmitter('radius_changed');
|
|
664
|
-
/**
|
|
665
|
-
* @see
|
|
666
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.rightclick
|
|
667
|
-
*/
|
|
668
|
-
this.circleRightclick = this._eventManager.getLazyEmitter('rightclick');
|
|
669
|
-
}
|
|
670
|
-
ngOnInit() {
|
|
671
|
-
if (this._map._isBrowser) {
|
|
672
|
-
this._combineOptions()
|
|
673
|
-
.pipe(take(1))
|
|
674
|
-
.subscribe(options => {
|
|
675
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
676
|
-
// We'll bring it back in inside the `MapEventManager` only for the events that the
|
|
677
|
-
// user has subscribed to.
|
|
678
|
-
this._ngZone.runOutsideAngular(() => {
|
|
679
|
-
this.circle = new google.maps.Circle(options);
|
|
680
|
-
});
|
|
681
|
-
this._assertInitialized();
|
|
682
|
-
this.circle.setMap(this._map.googleMap);
|
|
683
|
-
this._eventManager.setTarget(this.circle);
|
|
684
|
-
});
|
|
685
|
-
this._watchForOptionsChanges();
|
|
686
|
-
this._watchForCenterChanges();
|
|
687
|
-
this._watchForRadiusChanges();
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
ngOnDestroy() {
|
|
691
|
-
this._eventManager.destroy();
|
|
692
|
-
this._destroyed.next();
|
|
693
|
-
this._destroyed.complete();
|
|
694
|
-
if (this.circle) {
|
|
695
|
-
this.circle.setMap(null);
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* @see
|
|
700
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.getBounds
|
|
701
|
-
*/
|
|
702
|
-
getBounds() {
|
|
703
|
-
this._assertInitialized();
|
|
704
|
-
return this.circle.getBounds();
|
|
705
|
-
}
|
|
706
|
-
/**
|
|
707
|
-
* @see
|
|
708
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.getCenter
|
|
709
|
-
*/
|
|
710
|
-
getCenter() {
|
|
711
|
-
this._assertInitialized();
|
|
712
|
-
return this.circle.getCenter();
|
|
713
|
-
}
|
|
714
|
-
/**
|
|
715
|
-
* @see
|
|
716
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.getDraggable
|
|
717
|
-
*/
|
|
718
|
-
getDraggable() {
|
|
719
|
-
this._assertInitialized();
|
|
720
|
-
return this.circle.getDraggable();
|
|
721
|
-
}
|
|
722
|
-
/**
|
|
723
|
-
* @see
|
|
724
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.getEditable
|
|
725
|
-
*/
|
|
726
|
-
getEditable() {
|
|
727
|
-
this._assertInitialized();
|
|
728
|
-
return this.circle.getEditable();
|
|
729
|
-
}
|
|
730
|
-
/**
|
|
731
|
-
* @see
|
|
732
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.getRadius
|
|
733
|
-
*/
|
|
734
|
-
getRadius() {
|
|
735
|
-
this._assertInitialized();
|
|
736
|
-
return this.circle.getRadius();
|
|
737
|
-
}
|
|
738
|
-
/**
|
|
739
|
-
* @see
|
|
740
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Circle.getVisible
|
|
741
|
-
*/
|
|
742
|
-
getVisible() {
|
|
743
|
-
this._assertInitialized();
|
|
744
|
-
return this.circle.getVisible();
|
|
745
|
-
}
|
|
746
|
-
_combineOptions() {
|
|
747
|
-
return combineLatest([this._options, this._center, this._radius]).pipe(map(([options, center, radius]) => {
|
|
748
|
-
const combinedOptions = Object.assign(Object.assign({}, options), { center: center || options.center, radius: radius !== undefined ? radius : options.radius });
|
|
749
|
-
return combinedOptions;
|
|
750
|
-
}));
|
|
751
|
-
}
|
|
752
|
-
_watchForOptionsChanges() {
|
|
753
|
-
this._options.pipe(takeUntil(this._destroyed)).subscribe(options => {
|
|
754
|
-
this._assertInitialized();
|
|
755
|
-
this.circle.setOptions(options);
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
_watchForCenterChanges() {
|
|
759
|
-
this._center.pipe(takeUntil(this._destroyed)).subscribe(center => {
|
|
760
|
-
if (center) {
|
|
761
|
-
this._assertInitialized();
|
|
762
|
-
this.circle.setCenter(center);
|
|
763
|
-
}
|
|
764
|
-
});
|
|
765
|
-
}
|
|
766
|
-
_watchForRadiusChanges() {
|
|
767
|
-
this._radius.pipe(takeUntil(this._destroyed)).subscribe(radius => {
|
|
768
|
-
if (radius !== undefined) {
|
|
769
|
-
this._assertInitialized();
|
|
770
|
-
this.circle.setRadius(radius);
|
|
771
|
-
}
|
|
772
|
-
});
|
|
773
|
-
}
|
|
774
|
-
_assertInitialized() {
|
|
775
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
776
|
-
if (!this._map.googleMap) {
|
|
777
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
778
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
779
|
-
}
|
|
780
|
-
if (!this.circle) {
|
|
781
|
-
throw Error('Cannot interact with a Google Map Circle before it has been ' +
|
|
782
|
-
'initialized. Please wait for the Circle to load before trying to interact with it.');
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
MapCircle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapCircle, deps: [{ token: GoogleMap }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
788
|
-
MapCircle.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapCircle, selector: "map-circle", inputs: { options: "options", center: "center", radius: "radius" }, outputs: { centerChanged: "centerChanged", circleClick: "circleClick", circleDblclick: "circleDblclick", circleDrag: "circleDrag", circleDragend: "circleDragend", circleDragstart: "circleDragstart", circleMousedown: "circleMousedown", circleMousemove: "circleMousemove", circleMouseout: "circleMouseout", circleMouseover: "circleMouseover", circleMouseup: "circleMouseup", radiusChanged: "radiusChanged", circleRightclick: "circleRightclick" }, exportAs: ["mapCircle"], ngImport: i0 });
|
|
789
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapCircle, decorators: [{
|
|
790
|
-
type: Directive,
|
|
791
|
-
args: [{
|
|
792
|
-
selector: 'map-circle',
|
|
793
|
-
exportAs: 'mapCircle',
|
|
794
|
-
}]
|
|
795
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.NgZone }]; }, propDecorators: { options: [{
|
|
796
|
-
type: Input
|
|
797
|
-
}], center: [{
|
|
798
|
-
type: Input
|
|
799
|
-
}], radius: [{
|
|
800
|
-
type: Input
|
|
801
|
-
}], centerChanged: [{
|
|
802
|
-
type: Output
|
|
803
|
-
}], circleClick: [{
|
|
804
|
-
type: Output
|
|
805
|
-
}], circleDblclick: [{
|
|
806
|
-
type: Output
|
|
807
|
-
}], circleDrag: [{
|
|
808
|
-
type: Output
|
|
809
|
-
}], circleDragend: [{
|
|
810
|
-
type: Output
|
|
811
|
-
}], circleDragstart: [{
|
|
812
|
-
type: Output
|
|
813
|
-
}], circleMousedown: [{
|
|
814
|
-
type: Output
|
|
815
|
-
}], circleMousemove: [{
|
|
816
|
-
type: Output
|
|
817
|
-
}], circleMouseout: [{
|
|
818
|
-
type: Output
|
|
819
|
-
}], circleMouseover: [{
|
|
820
|
-
type: Output
|
|
821
|
-
}], circleMouseup: [{
|
|
822
|
-
type: Output
|
|
823
|
-
}], radiusChanged: [{
|
|
824
|
-
type: Output
|
|
825
|
-
}], circleRightclick: [{
|
|
826
|
-
type: Output
|
|
827
|
-
}] } });
|
|
828
|
-
|
|
829
|
-
/// <reference types="google.maps" />
|
|
830
|
-
/**
|
|
831
|
-
* Angular component that renders a Google Maps Directions Renderer via the Google Maps
|
|
832
|
-
* JavaScript API.
|
|
833
|
-
*
|
|
834
|
-
* See developers.google.com/maps/documentation/javascript/reference/directions#DirectionsRenderer
|
|
835
|
-
*/
|
|
836
|
-
class MapDirectionsRenderer {
|
|
837
|
-
/**
|
|
838
|
-
* See developers.google.com/maps/documentation/javascript/reference/directions
|
|
839
|
-
* #DirectionsRendererOptions.directions
|
|
840
|
-
*/
|
|
841
|
-
set directions(directions) {
|
|
842
|
-
this._directions = directions;
|
|
843
|
-
}
|
|
844
|
-
/**
|
|
845
|
-
* See developers.google.com/maps/documentation/javascript/reference/directions
|
|
846
|
-
* #DirectionsRendererOptions
|
|
847
|
-
*/
|
|
848
|
-
set options(options) {
|
|
849
|
-
this._options = options;
|
|
850
|
-
}
|
|
851
|
-
constructor(_googleMap, _ngZone) {
|
|
852
|
-
this._googleMap = _googleMap;
|
|
853
|
-
this._ngZone = _ngZone;
|
|
854
|
-
this._eventManager = new MapEventManager(inject(NgZone));
|
|
855
|
-
/**
|
|
856
|
-
* See developers.google.com/maps/documentation/javascript/reference/directions
|
|
857
|
-
* #DirectionsRenderer.directions_changed
|
|
858
|
-
*/
|
|
859
|
-
this.directionsChanged = this._eventManager.getLazyEmitter('directions_changed');
|
|
860
|
-
}
|
|
861
|
-
ngOnInit() {
|
|
862
|
-
if (this._googleMap._isBrowser) {
|
|
863
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
864
|
-
// We'll bring it back in inside the `MapEventManager` only for the events that the
|
|
865
|
-
// user has subscribed to.
|
|
866
|
-
this._ngZone.runOutsideAngular(() => {
|
|
867
|
-
this.directionsRenderer = new google.maps.DirectionsRenderer(this._combineOptions());
|
|
868
|
-
});
|
|
869
|
-
this._assertInitialized();
|
|
870
|
-
this.directionsRenderer.setMap(this._googleMap.googleMap);
|
|
871
|
-
this._eventManager.setTarget(this.directionsRenderer);
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
ngOnChanges(changes) {
|
|
875
|
-
if (this.directionsRenderer) {
|
|
876
|
-
if (changes['options']) {
|
|
877
|
-
this.directionsRenderer.setOptions(this._combineOptions());
|
|
878
|
-
}
|
|
879
|
-
if (changes['directions'] && this._directions !== undefined) {
|
|
880
|
-
this.directionsRenderer.setDirections(this._directions);
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
ngOnDestroy() {
|
|
885
|
-
this._eventManager.destroy();
|
|
886
|
-
if (this.directionsRenderer) {
|
|
887
|
-
this.directionsRenderer.setMap(null);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
/**
|
|
891
|
-
* See developers.google.com/maps/documentation/javascript/reference/directions
|
|
892
|
-
* #DirectionsRenderer.getDirections
|
|
893
|
-
*/
|
|
894
|
-
getDirections() {
|
|
895
|
-
this._assertInitialized();
|
|
896
|
-
return this.directionsRenderer.getDirections();
|
|
897
|
-
}
|
|
898
|
-
/**
|
|
899
|
-
* See developers.google.com/maps/documentation/javascript/reference/directions
|
|
900
|
-
* #DirectionsRenderer.getPanel
|
|
901
|
-
*/
|
|
902
|
-
getPanel() {
|
|
903
|
-
this._assertInitialized();
|
|
904
|
-
return this.directionsRenderer.getPanel();
|
|
905
|
-
}
|
|
906
|
-
/**
|
|
907
|
-
* See developers.google.com/maps/documentation/javascript/reference/directions
|
|
908
|
-
* #DirectionsRenderer.getRouteIndex
|
|
909
|
-
*/
|
|
910
|
-
getRouteIndex() {
|
|
911
|
-
this._assertInitialized();
|
|
912
|
-
return this.directionsRenderer.getRouteIndex();
|
|
913
|
-
}
|
|
914
|
-
_combineOptions() {
|
|
915
|
-
const options = this._options || {};
|
|
916
|
-
return Object.assign(Object.assign({}, options), { directions: this._directions || options.directions, map: this._googleMap.googleMap });
|
|
917
|
-
}
|
|
918
|
-
_assertInitialized() {
|
|
919
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
920
|
-
if (!this._googleMap.googleMap) {
|
|
921
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
922
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
923
|
-
}
|
|
924
|
-
if (!this.directionsRenderer) {
|
|
925
|
-
throw Error('Cannot interact with a Google Map Directions Renderer before it has been ' +
|
|
926
|
-
'initialized. Please wait for the Directions Renderer to load before trying ' +
|
|
927
|
-
'to interact with it.');
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
MapDirectionsRenderer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapDirectionsRenderer, deps: [{ token: GoogleMap }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
933
|
-
MapDirectionsRenderer.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapDirectionsRenderer, selector: "map-directions-renderer", inputs: { directions: "directions", options: "options" }, outputs: { directionsChanged: "directionsChanged" }, exportAs: ["mapDirectionsRenderer"], usesOnChanges: true, ngImport: i0 });
|
|
934
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapDirectionsRenderer, decorators: [{
|
|
935
|
-
type: Directive,
|
|
936
|
-
args: [{
|
|
937
|
-
selector: 'map-directions-renderer',
|
|
938
|
-
exportAs: 'mapDirectionsRenderer',
|
|
939
|
-
}]
|
|
940
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.NgZone }]; }, propDecorators: { directions: [{
|
|
941
|
-
type: Input
|
|
942
|
-
}], options: [{
|
|
943
|
-
type: Input
|
|
944
|
-
}], directionsChanged: [{
|
|
945
|
-
type: Output
|
|
946
|
-
}] } });
|
|
947
|
-
|
|
948
|
-
/// <reference types="google.maps" />
|
|
949
|
-
/**
|
|
950
|
-
* Angular component that renders a Google Maps Ground Overlay via the Google Maps JavaScript API.
|
|
951
|
-
*
|
|
952
|
-
* See developers.google.com/maps/documentation/javascript/reference/image-overlay#GroundOverlay
|
|
953
|
-
*/
|
|
954
|
-
class MapGroundOverlay {
|
|
955
|
-
/** URL of the image that will be shown in the overlay. */
|
|
956
|
-
set url(url) {
|
|
957
|
-
this._url.next(url);
|
|
958
|
-
}
|
|
959
|
-
/** Bounds for the overlay. */
|
|
960
|
-
get bounds() {
|
|
961
|
-
return this._bounds.value;
|
|
962
|
-
}
|
|
963
|
-
set bounds(bounds) {
|
|
964
|
-
this._bounds.next(bounds);
|
|
965
|
-
}
|
|
966
|
-
/** Opacity of the overlay. */
|
|
967
|
-
set opacity(opacity) {
|
|
968
|
-
this._opacity.next(opacity);
|
|
969
|
-
}
|
|
970
|
-
constructor(_map, _ngZone) {
|
|
971
|
-
this._map = _map;
|
|
972
|
-
this._ngZone = _ngZone;
|
|
973
|
-
this._eventManager = new MapEventManager(inject(NgZone));
|
|
974
|
-
this._opacity = new BehaviorSubject(1);
|
|
975
|
-
this._url = new BehaviorSubject('');
|
|
976
|
-
this._bounds = new BehaviorSubject(undefined);
|
|
977
|
-
this._destroyed = new Subject();
|
|
978
|
-
/** Whether the overlay is clickable */
|
|
979
|
-
this.clickable = false;
|
|
980
|
-
/**
|
|
981
|
-
* See
|
|
982
|
-
* developers.google.com/maps/documentation/javascript/reference/image-overlay#GroundOverlay.click
|
|
983
|
-
*/
|
|
984
|
-
this.mapClick = this._eventManager.getLazyEmitter('click');
|
|
985
|
-
/**
|
|
986
|
-
* See
|
|
987
|
-
* developers.google.com/maps/documentation/javascript/reference/image-overlay
|
|
988
|
-
* #GroundOverlay.dblclick
|
|
989
|
-
*/
|
|
990
|
-
this.mapDblclick = this._eventManager.getLazyEmitter('dblclick');
|
|
991
|
-
}
|
|
992
|
-
ngOnInit() {
|
|
993
|
-
if (this._map._isBrowser) {
|
|
994
|
-
// The ground overlay setup is slightly different from the other Google Maps objects in that
|
|
995
|
-
// we have to recreate the `GroundOverlay` object whenever the bounds change, because
|
|
996
|
-
// Google Maps doesn't provide an API to update the bounds of an existing overlay.
|
|
997
|
-
this._bounds.pipe(takeUntil(this._destroyed)).subscribe(bounds => {
|
|
998
|
-
if (this.groundOverlay) {
|
|
999
|
-
this.groundOverlay.setMap(null);
|
|
1000
|
-
this.groundOverlay = undefined;
|
|
1001
|
-
}
|
|
1002
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
1003
|
-
// We'll bring it back in inside the `MapEventManager` only for the events that the
|
|
1004
|
-
// user has subscribed to.
|
|
1005
|
-
if (bounds) {
|
|
1006
|
-
this._ngZone.runOutsideAngular(() => {
|
|
1007
|
-
this.groundOverlay = new google.maps.GroundOverlay(this._url.getValue(), bounds, {
|
|
1008
|
-
clickable: this.clickable,
|
|
1009
|
-
opacity: this._opacity.value,
|
|
1010
|
-
});
|
|
1011
|
-
});
|
|
1012
|
-
this._assertInitialized();
|
|
1013
|
-
this.groundOverlay.setMap(this._map.googleMap);
|
|
1014
|
-
this._eventManager.setTarget(this.groundOverlay);
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
1017
|
-
this._watchForOpacityChanges();
|
|
1018
|
-
this._watchForUrlChanges();
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
ngOnDestroy() {
|
|
1022
|
-
this._eventManager.destroy();
|
|
1023
|
-
this._destroyed.next();
|
|
1024
|
-
this._destroyed.complete();
|
|
1025
|
-
if (this.groundOverlay) {
|
|
1026
|
-
this.groundOverlay.setMap(null);
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
/**
|
|
1030
|
-
* See
|
|
1031
|
-
* developers.google.com/maps/documentation/javascript/reference/image-overlay
|
|
1032
|
-
* #GroundOverlay.getBounds
|
|
1033
|
-
*/
|
|
1034
|
-
getBounds() {
|
|
1035
|
-
this._assertInitialized();
|
|
1036
|
-
return this.groundOverlay.getBounds();
|
|
1037
|
-
}
|
|
1038
|
-
/**
|
|
1039
|
-
* See
|
|
1040
|
-
* developers.google.com/maps/documentation/javascript/reference/image-overlay
|
|
1041
|
-
* #GroundOverlay.getOpacity
|
|
1042
|
-
*/
|
|
1043
|
-
getOpacity() {
|
|
1044
|
-
this._assertInitialized();
|
|
1045
|
-
return this.groundOverlay.getOpacity();
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* See
|
|
1049
|
-
* developers.google.com/maps/documentation/javascript/reference/image-overlay
|
|
1050
|
-
* #GroundOverlay.getUrl
|
|
1051
|
-
*/
|
|
1052
|
-
getUrl() {
|
|
1053
|
-
this._assertInitialized();
|
|
1054
|
-
return this.groundOverlay.getUrl();
|
|
1055
|
-
}
|
|
1056
|
-
_watchForOpacityChanges() {
|
|
1057
|
-
this._opacity.pipe(takeUntil(this._destroyed)).subscribe(opacity => {
|
|
1058
|
-
if (opacity != null) {
|
|
1059
|
-
this._assertInitialized();
|
|
1060
|
-
this.groundOverlay.setOpacity(opacity);
|
|
1061
|
-
}
|
|
1062
|
-
});
|
|
1063
|
-
}
|
|
1064
|
-
_watchForUrlChanges() {
|
|
1065
|
-
this._url.pipe(takeUntil(this._destroyed)).subscribe(url => {
|
|
1066
|
-
this._assertInitialized();
|
|
1067
|
-
const overlay = this.groundOverlay;
|
|
1068
|
-
overlay.set('url', url);
|
|
1069
|
-
// Google Maps only redraws the overlay if we re-set the map.
|
|
1070
|
-
overlay.setMap(null);
|
|
1071
|
-
overlay.setMap(this._map.googleMap);
|
|
1072
|
-
});
|
|
1073
|
-
}
|
|
1074
|
-
_assertInitialized() {
|
|
1075
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
1076
|
-
if (!this._map.googleMap) {
|
|
1077
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
1078
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
1079
|
-
}
|
|
1080
|
-
if (!this.groundOverlay) {
|
|
1081
|
-
throw Error('Cannot interact with a Google Map GroundOverlay before it has been initialized. ' +
|
|
1082
|
-
'Please wait for the GroundOverlay to load before trying to interact with it.');
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
MapGroundOverlay.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapGroundOverlay, deps: [{ token: GoogleMap }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1088
|
-
MapGroundOverlay.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapGroundOverlay, selector: "map-ground-overlay", inputs: { url: "url", bounds: "bounds", clickable: "clickable", opacity: "opacity" }, outputs: { mapClick: "mapClick", mapDblclick: "mapDblclick" }, exportAs: ["mapGroundOverlay"], ngImport: i0 });
|
|
1089
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapGroundOverlay, decorators: [{
|
|
1090
|
-
type: Directive,
|
|
1091
|
-
args: [{
|
|
1092
|
-
selector: 'map-ground-overlay',
|
|
1093
|
-
exportAs: 'mapGroundOverlay',
|
|
1094
|
-
}]
|
|
1095
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.NgZone }]; }, propDecorators: { url: [{
|
|
1096
|
-
type: Input
|
|
1097
|
-
}], bounds: [{
|
|
1098
|
-
type: Input
|
|
1099
|
-
}], clickable: [{
|
|
1100
|
-
type: Input
|
|
1101
|
-
}], opacity: [{
|
|
1102
|
-
type: Input
|
|
1103
|
-
}], mapClick: [{
|
|
1104
|
-
type: Output
|
|
1105
|
-
}], mapDblclick: [{
|
|
1106
|
-
type: Output
|
|
1107
|
-
}] } });
|
|
1108
|
-
|
|
1109
|
-
/// <reference types="google.maps" />
|
|
1110
|
-
/**
|
|
1111
|
-
* Angular component that renders a Google Maps info window via the Google Maps JavaScript API.
|
|
1112
|
-
*
|
|
1113
|
-
* See developers.google.com/maps/documentation/javascript/reference/info-window
|
|
1114
|
-
*/
|
|
1115
|
-
class MapInfoWindow {
|
|
1116
|
-
set options(options) {
|
|
1117
|
-
this._options.next(options || {});
|
|
1118
|
-
}
|
|
1119
|
-
set position(position) {
|
|
1120
|
-
this._position.next(position);
|
|
1121
|
-
}
|
|
1122
|
-
constructor(_googleMap, _elementRef, _ngZone) {
|
|
1123
|
-
this._googleMap = _googleMap;
|
|
1124
|
-
this._elementRef = _elementRef;
|
|
1125
|
-
this._ngZone = _ngZone;
|
|
1126
|
-
this._eventManager = new MapEventManager(inject(NgZone));
|
|
1127
|
-
this._options = new BehaviorSubject({});
|
|
1128
|
-
this._position = new BehaviorSubject(undefined);
|
|
1129
|
-
this._destroy = new Subject();
|
|
1130
|
-
/**
|
|
1131
|
-
* See
|
|
1132
|
-
* developers.google.com/maps/documentation/javascript/reference/info-window#InfoWindow.closeclick
|
|
1133
|
-
*/
|
|
1134
|
-
this.closeclick = this._eventManager.getLazyEmitter('closeclick');
|
|
1135
|
-
/**
|
|
1136
|
-
* See
|
|
1137
|
-
* developers.google.com/maps/documentation/javascript/reference/info-window
|
|
1138
|
-
* #InfoWindow.content_changed
|
|
1139
|
-
*/
|
|
1140
|
-
this.contentChanged = this._eventManager.getLazyEmitter('content_changed');
|
|
1141
|
-
/**
|
|
1142
|
-
* See
|
|
1143
|
-
* developers.google.com/maps/documentation/javascript/reference/info-window#InfoWindow.domready
|
|
1144
|
-
*/
|
|
1145
|
-
this.domready = this._eventManager.getLazyEmitter('domready');
|
|
1146
|
-
/**
|
|
1147
|
-
* See
|
|
1148
|
-
* developers.google.com/maps/documentation/javascript/reference/info-window
|
|
1149
|
-
* #InfoWindow.position_changed
|
|
1150
|
-
*/
|
|
1151
|
-
this.positionChanged = this._eventManager.getLazyEmitter('position_changed');
|
|
1152
|
-
/**
|
|
1153
|
-
* See
|
|
1154
|
-
* developers.google.com/maps/documentation/javascript/reference/info-window
|
|
1155
|
-
* #InfoWindow.zindex_changed
|
|
1156
|
-
*/
|
|
1157
|
-
this.zindexChanged = this._eventManager.getLazyEmitter('zindex_changed');
|
|
1158
|
-
}
|
|
1159
|
-
ngOnInit() {
|
|
1160
|
-
if (this._googleMap._isBrowser) {
|
|
1161
|
-
const combinedOptionsChanges = this._combineOptions();
|
|
1162
|
-
combinedOptionsChanges.pipe(take(1)).subscribe(options => {
|
|
1163
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
1164
|
-
// We'll bring it back in inside the `MapEventManager` only for the events that the
|
|
1165
|
-
// user has subscribed to.
|
|
1166
|
-
this._ngZone.runOutsideAngular(() => {
|
|
1167
|
-
this.infoWindow = new google.maps.InfoWindow(options);
|
|
1168
|
-
});
|
|
1169
|
-
this._eventManager.setTarget(this.infoWindow);
|
|
1170
|
-
});
|
|
1171
|
-
this._watchForOptionsChanges();
|
|
1172
|
-
this._watchForPositionChanges();
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
ngOnDestroy() {
|
|
1176
|
-
this._eventManager.destroy();
|
|
1177
|
-
this._destroy.next();
|
|
1178
|
-
this._destroy.complete();
|
|
1179
|
-
// If no info window has been created on the server, we do not try closing it.
|
|
1180
|
-
// On the server, an info window cannot be created and this would cause errors.
|
|
1181
|
-
if (this.infoWindow) {
|
|
1182
|
-
this.close();
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
/**
|
|
1186
|
-
* See developers.google.com/maps/documentation/javascript/reference/info-window#InfoWindow.close
|
|
1187
|
-
*/
|
|
1188
|
-
close() {
|
|
1189
|
-
this._assertInitialized();
|
|
1190
|
-
this.infoWindow.close();
|
|
1191
|
-
}
|
|
1192
|
-
/**
|
|
1193
|
-
* See
|
|
1194
|
-
* developers.google.com/maps/documentation/javascript/reference/info-window#InfoWindow.getContent
|
|
1195
|
-
*/
|
|
1196
|
-
getContent() {
|
|
1197
|
-
this._assertInitialized();
|
|
1198
|
-
return this.infoWindow.getContent() || null;
|
|
1199
|
-
}
|
|
1200
|
-
/**
|
|
1201
|
-
* See
|
|
1202
|
-
* developers.google.com/maps/documentation/javascript/reference/info-window
|
|
1203
|
-
* #InfoWindow.getPosition
|
|
1204
|
-
*/
|
|
1205
|
-
getPosition() {
|
|
1206
|
-
this._assertInitialized();
|
|
1207
|
-
return this.infoWindow.getPosition() || null;
|
|
1208
|
-
}
|
|
1209
|
-
/**
|
|
1210
|
-
* See
|
|
1211
|
-
* developers.google.com/maps/documentation/javascript/reference/info-window#InfoWindow.getZIndex
|
|
1212
|
-
*/
|
|
1213
|
-
getZIndex() {
|
|
1214
|
-
this._assertInitialized();
|
|
1215
|
-
return this.infoWindow.getZIndex();
|
|
1216
|
-
}
|
|
1217
|
-
/**
|
|
1218
|
-
* Opens the MapInfoWindow using the provided anchor. If the anchor is not set,
|
|
1219
|
-
* then the position property of the options input is used instead.
|
|
1220
|
-
*/
|
|
1221
|
-
open(anchor, shouldFocus) {
|
|
1222
|
-
this._assertInitialized();
|
|
1223
|
-
const anchorObject = anchor ? anchor.getAnchor() : undefined;
|
|
1224
|
-
// Prevent the info window from initializing when trying to reopen on the same anchor.
|
|
1225
|
-
// Note that when the window is opened for the first time, the anchor will always be
|
|
1226
|
-
// undefined. If that's the case, we have to allow it to open in order to handle the
|
|
1227
|
-
// case where the window doesn't have an anchor, but is placed at a particular position.
|
|
1228
|
-
if (this.infoWindow.get('anchor') !== anchorObject || !anchorObject) {
|
|
1229
|
-
this._elementRef.nativeElement.style.display = '';
|
|
1230
|
-
// The config is cast to `any`, because the internal typings are out of date.
|
|
1231
|
-
this.infoWindow.open({
|
|
1232
|
-
map: this._googleMap.googleMap,
|
|
1233
|
-
anchor: anchorObject,
|
|
1234
|
-
shouldFocus,
|
|
1235
|
-
});
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
_combineOptions() {
|
|
1239
|
-
return combineLatest([this._options, this._position]).pipe(map(([options, position]) => {
|
|
1240
|
-
const combinedOptions = Object.assign(Object.assign({}, options), { position: position || options.position, content: this._elementRef.nativeElement });
|
|
1241
|
-
return combinedOptions;
|
|
1242
|
-
}));
|
|
1243
|
-
}
|
|
1244
|
-
_watchForOptionsChanges() {
|
|
1245
|
-
this._options.pipe(takeUntil(this._destroy)).subscribe(options => {
|
|
1246
|
-
this._assertInitialized();
|
|
1247
|
-
this.infoWindow.setOptions(options);
|
|
1248
|
-
});
|
|
1249
|
-
}
|
|
1250
|
-
_watchForPositionChanges() {
|
|
1251
|
-
this._position.pipe(takeUntil(this._destroy)).subscribe(position => {
|
|
1252
|
-
if (position) {
|
|
1253
|
-
this._assertInitialized();
|
|
1254
|
-
this.infoWindow.setPosition(position);
|
|
1255
|
-
}
|
|
1256
|
-
});
|
|
1257
|
-
}
|
|
1258
|
-
_assertInitialized() {
|
|
1259
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
1260
|
-
if (!this._googleMap.googleMap) {
|
|
1261
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
1262
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
1263
|
-
}
|
|
1264
|
-
if (!this.infoWindow) {
|
|
1265
|
-
throw Error('Cannot interact with a Google Map Info Window before it has been ' +
|
|
1266
|
-
'initialized. Please wait for the Info Window to load before trying to interact with ' +
|
|
1267
|
-
'it.');
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
MapInfoWindow.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapInfoWindow, deps: [{ token: GoogleMap }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1273
|
-
MapInfoWindow.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapInfoWindow, selector: "map-info-window", inputs: { options: "options", position: "position" }, outputs: { closeclick: "closeclick", contentChanged: "contentChanged", domready: "domready", positionChanged: "positionChanged", zindexChanged: "zindexChanged" }, host: { styleAttribute: "display: none" }, exportAs: ["mapInfoWindow"], ngImport: i0 });
|
|
1274
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapInfoWindow, decorators: [{
|
|
1275
|
-
type: Directive,
|
|
1276
|
-
args: [{
|
|
1277
|
-
selector: 'map-info-window',
|
|
1278
|
-
exportAs: 'mapInfoWindow',
|
|
1279
|
-
host: { 'style': 'display: none' },
|
|
1280
|
-
}]
|
|
1281
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { options: [{
|
|
1282
|
-
type: Input
|
|
1283
|
-
}], position: [{
|
|
1284
|
-
type: Input
|
|
1285
|
-
}], closeclick: [{
|
|
1286
|
-
type: Output
|
|
1287
|
-
}], contentChanged: [{
|
|
1288
|
-
type: Output
|
|
1289
|
-
}], domready: [{
|
|
1290
|
-
type: Output
|
|
1291
|
-
}], positionChanged: [{
|
|
1292
|
-
type: Output
|
|
1293
|
-
}], zindexChanged: [{
|
|
1294
|
-
type: Output
|
|
1295
|
-
}] } });
|
|
1296
|
-
|
|
1297
|
-
/// <reference types="google.maps" />
|
|
1298
|
-
/**
|
|
1299
|
-
* Angular component that renders a Google Maps KML Layer via the Google Maps JavaScript API.
|
|
1300
|
-
*
|
|
1301
|
-
* See developers.google.com/maps/documentation/javascript/reference/kml#KmlLayer
|
|
1302
|
-
*/
|
|
1303
|
-
class MapKmlLayer {
|
|
1304
|
-
set options(options) {
|
|
1305
|
-
this._options.next(options || {});
|
|
1306
|
-
}
|
|
1307
|
-
set url(url) {
|
|
1308
|
-
this._url.next(url);
|
|
1309
|
-
}
|
|
1310
|
-
constructor(_map, _ngZone) {
|
|
1311
|
-
this._map = _map;
|
|
1312
|
-
this._ngZone = _ngZone;
|
|
1313
|
-
this._eventManager = new MapEventManager(inject(NgZone));
|
|
1314
|
-
this._options = new BehaviorSubject({});
|
|
1315
|
-
this._url = new BehaviorSubject('');
|
|
1316
|
-
this._destroyed = new Subject();
|
|
1317
|
-
/**
|
|
1318
|
-
* See developers.google.com/maps/documentation/javascript/reference/kml#KmlLayer.click
|
|
1319
|
-
*/
|
|
1320
|
-
this.kmlClick = this._eventManager.getLazyEmitter('click');
|
|
1321
|
-
/**
|
|
1322
|
-
* See
|
|
1323
|
-
* developers.google.com/maps/documentation/javascript/reference/kml
|
|
1324
|
-
* #KmlLayer.defaultviewport_changed
|
|
1325
|
-
*/
|
|
1326
|
-
this.defaultviewportChanged = this._eventManager.getLazyEmitter('defaultviewport_changed');
|
|
1327
|
-
/**
|
|
1328
|
-
* See developers.google.com/maps/documentation/javascript/reference/kml#KmlLayer.status_changed
|
|
1329
|
-
*/
|
|
1330
|
-
this.statusChanged = this._eventManager.getLazyEmitter('status_changed');
|
|
1331
|
-
}
|
|
1332
|
-
ngOnInit() {
|
|
1333
|
-
if (this._map._isBrowser) {
|
|
1334
|
-
this._combineOptions()
|
|
1335
|
-
.pipe(take(1))
|
|
1336
|
-
.subscribe(options => {
|
|
1337
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
1338
|
-
// We'll bring it back in inside the `MapEventManager` only for the events that the
|
|
1339
|
-
// user has subscribed to.
|
|
1340
|
-
this._ngZone.runOutsideAngular(() => (this.kmlLayer = new google.maps.KmlLayer(options)));
|
|
1341
|
-
this._assertInitialized();
|
|
1342
|
-
this.kmlLayer.setMap(this._map.googleMap);
|
|
1343
|
-
this._eventManager.setTarget(this.kmlLayer);
|
|
1344
|
-
});
|
|
1345
|
-
this._watchForOptionsChanges();
|
|
1346
|
-
this._watchForUrlChanges();
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
ngOnDestroy() {
|
|
1350
|
-
this._eventManager.destroy();
|
|
1351
|
-
this._destroyed.next();
|
|
1352
|
-
this._destroyed.complete();
|
|
1353
|
-
if (this.kmlLayer) {
|
|
1354
|
-
this.kmlLayer.setMap(null);
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
/**
|
|
1358
|
-
* See
|
|
1359
|
-
* developers.google.com/maps/documentation/javascript/reference/kml#KmlLayer.getDefaultViewport
|
|
1360
|
-
*/
|
|
1361
|
-
getDefaultViewport() {
|
|
1362
|
-
this._assertInitialized();
|
|
1363
|
-
return this.kmlLayer.getDefaultViewport();
|
|
1364
|
-
}
|
|
1365
|
-
/**
|
|
1366
|
-
* See developers.google.com/maps/documentation/javascript/reference/kml#KmlLayer.getMetadata
|
|
1367
|
-
*/
|
|
1368
|
-
getMetadata() {
|
|
1369
|
-
this._assertInitialized();
|
|
1370
|
-
return this.kmlLayer.getMetadata();
|
|
1371
|
-
}
|
|
1372
|
-
/**
|
|
1373
|
-
* See developers.google.com/maps/documentation/javascript/reference/kml#KmlLayer.getStatus
|
|
1374
|
-
*/
|
|
1375
|
-
getStatus() {
|
|
1376
|
-
this._assertInitialized();
|
|
1377
|
-
return this.kmlLayer.getStatus();
|
|
1378
|
-
}
|
|
1379
|
-
/**
|
|
1380
|
-
* See developers.google.com/maps/documentation/javascript/reference/kml#KmlLayer.getUrl
|
|
1381
|
-
*/
|
|
1382
|
-
getUrl() {
|
|
1383
|
-
this._assertInitialized();
|
|
1384
|
-
return this.kmlLayer.getUrl();
|
|
1385
|
-
}
|
|
1386
|
-
/**
|
|
1387
|
-
* See developers.google.com/maps/documentation/javascript/reference/kml#KmlLayer.getZIndex
|
|
1388
|
-
*/
|
|
1389
|
-
getZIndex() {
|
|
1390
|
-
this._assertInitialized();
|
|
1391
|
-
return this.kmlLayer.getZIndex();
|
|
1392
|
-
}
|
|
1393
|
-
_combineOptions() {
|
|
1394
|
-
return combineLatest([this._options, this._url]).pipe(map(([options, url]) => {
|
|
1395
|
-
const combinedOptions = Object.assign(Object.assign({}, options), { url: url || options.url });
|
|
1396
|
-
return combinedOptions;
|
|
1397
|
-
}));
|
|
1398
|
-
}
|
|
1399
|
-
_watchForOptionsChanges() {
|
|
1400
|
-
this._options.pipe(takeUntil(this._destroyed)).subscribe(options => {
|
|
1401
|
-
if (this.kmlLayer) {
|
|
1402
|
-
this._assertInitialized();
|
|
1403
|
-
this.kmlLayer.setOptions(options);
|
|
1404
|
-
}
|
|
1405
|
-
});
|
|
1406
|
-
}
|
|
1407
|
-
_watchForUrlChanges() {
|
|
1408
|
-
this._url.pipe(takeUntil(this._destroyed)).subscribe(url => {
|
|
1409
|
-
if (url && this.kmlLayer) {
|
|
1410
|
-
this._assertInitialized();
|
|
1411
|
-
this.kmlLayer.setUrl(url);
|
|
1412
|
-
}
|
|
1413
|
-
});
|
|
1414
|
-
}
|
|
1415
|
-
_assertInitialized() {
|
|
1416
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
1417
|
-
if (!this._map.googleMap) {
|
|
1418
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
1419
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
1420
|
-
}
|
|
1421
|
-
if (!this.kmlLayer) {
|
|
1422
|
-
throw Error('Cannot interact with a Google Map KmlLayer before it has been ' +
|
|
1423
|
-
'initialized. Please wait for the KmlLayer to load before trying to interact with it.');
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
MapKmlLayer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapKmlLayer, deps: [{ token: GoogleMap }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1429
|
-
MapKmlLayer.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapKmlLayer, selector: "map-kml-layer", inputs: { options: "options", url: "url" }, outputs: { kmlClick: "kmlClick", defaultviewportChanged: "defaultviewportChanged", statusChanged: "statusChanged" }, exportAs: ["mapKmlLayer"], ngImport: i0 });
|
|
1430
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapKmlLayer, decorators: [{
|
|
1431
|
-
type: Directive,
|
|
1432
|
-
args: [{
|
|
1433
|
-
selector: 'map-kml-layer',
|
|
1434
|
-
exportAs: 'mapKmlLayer',
|
|
1435
|
-
}]
|
|
1436
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.NgZone }]; }, propDecorators: { options: [{
|
|
1437
|
-
type: Input
|
|
1438
|
-
}], url: [{
|
|
1439
|
-
type: Input
|
|
1440
|
-
}], kmlClick: [{
|
|
1441
|
-
type: Output
|
|
1442
|
-
}], defaultviewportChanged: [{
|
|
1443
|
-
type: Output
|
|
1444
|
-
}], statusChanged: [{
|
|
1445
|
-
type: Output
|
|
1446
|
-
}] } });
|
|
1447
|
-
|
|
1448
|
-
/// <reference types="google.maps" />
|
|
1449
|
-
/**
|
|
1450
|
-
* Default options for the Google Maps marker component. Displays a marker
|
|
1451
|
-
* at the Googleplex.
|
|
1452
|
-
*/
|
|
1453
|
-
const DEFAULT_MARKER_OPTIONS = {
|
|
1454
|
-
position: { lat: 37.421995, lng: -122.084092 },
|
|
1455
|
-
};
|
|
1456
|
-
/**
|
|
1457
|
-
* Angular component that renders a Google Maps marker via the Google Maps JavaScript API.
|
|
1458
|
-
*
|
|
1459
|
-
* See developers.google.com/maps/documentation/javascript/reference/marker
|
|
1460
|
-
*/
|
|
1461
|
-
class MapMarker {
|
|
1462
|
-
/**
|
|
1463
|
-
* Title of the marker.
|
|
1464
|
-
* See: developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.title
|
|
1465
|
-
*/
|
|
1466
|
-
set title(title) {
|
|
1467
|
-
this._title = title;
|
|
1468
|
-
}
|
|
1469
|
-
/**
|
|
1470
|
-
* Position of the marker. See:
|
|
1471
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.position
|
|
1472
|
-
*/
|
|
1473
|
-
set position(position) {
|
|
1474
|
-
this._position = position;
|
|
1475
|
-
}
|
|
1476
|
-
/**
|
|
1477
|
-
* Label for the marker.
|
|
1478
|
-
* See: developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.label
|
|
1479
|
-
*/
|
|
1480
|
-
set label(label) {
|
|
1481
|
-
this._label = label;
|
|
1482
|
-
}
|
|
1483
|
-
/**
|
|
1484
|
-
* Whether the marker is clickable. See:
|
|
1485
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.clickable
|
|
1486
|
-
*/
|
|
1487
|
-
set clickable(clickable) {
|
|
1488
|
-
this._clickable = clickable;
|
|
1489
|
-
}
|
|
1490
|
-
/**
|
|
1491
|
-
* Options used to configure the marker.
|
|
1492
|
-
* See: developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions
|
|
1493
|
-
*/
|
|
1494
|
-
set options(options) {
|
|
1495
|
-
this._options = options;
|
|
1496
|
-
}
|
|
1497
|
-
/**
|
|
1498
|
-
* Icon to be used for the marker.
|
|
1499
|
-
* See: https://developers.google.com/maps/documentation/javascript/reference/marker#Icon
|
|
1500
|
-
*/
|
|
1501
|
-
set icon(icon) {
|
|
1502
|
-
this._icon = icon;
|
|
1503
|
-
}
|
|
1504
|
-
/**
|
|
1505
|
-
* Whether the marker is visible.
|
|
1506
|
-
* See: developers.google.com/maps/documentation/javascript/reference/marker#MarkerOptions.visible
|
|
1507
|
-
*/
|
|
1508
|
-
set visible(value) {
|
|
1509
|
-
this._visible = value;
|
|
1510
|
-
}
|
|
1511
|
-
constructor(_googleMap, _ngZone) {
|
|
1512
|
-
this._googleMap = _googleMap;
|
|
1513
|
-
this._ngZone = _ngZone;
|
|
1514
|
-
this._eventManager = new MapEventManager(inject(NgZone));
|
|
1515
|
-
/**
|
|
1516
|
-
* See
|
|
1517
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.animation_changed
|
|
1518
|
-
*/
|
|
1519
|
-
this.animationChanged = this._eventManager.getLazyEmitter('animation_changed');
|
|
1520
|
-
/**
|
|
1521
|
-
* See
|
|
1522
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.click
|
|
1523
|
-
*/
|
|
1524
|
-
this.mapClick = this._eventManager.getLazyEmitter('click');
|
|
1525
|
-
/**
|
|
1526
|
-
* See
|
|
1527
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.clickable_changed
|
|
1528
|
-
*/
|
|
1529
|
-
this.clickableChanged = this._eventManager.getLazyEmitter('clickable_changed');
|
|
1530
|
-
/**
|
|
1531
|
-
* See
|
|
1532
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.cursor_changed
|
|
1533
|
-
*/
|
|
1534
|
-
this.cursorChanged = this._eventManager.getLazyEmitter('cursor_changed');
|
|
1535
|
-
/**
|
|
1536
|
-
* See
|
|
1537
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.dblclick
|
|
1538
|
-
*/
|
|
1539
|
-
this.mapDblclick = this._eventManager.getLazyEmitter('dblclick');
|
|
1540
|
-
/**
|
|
1541
|
-
* See
|
|
1542
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.drag
|
|
1543
|
-
*/
|
|
1544
|
-
this.mapDrag = this._eventManager.getLazyEmitter('drag');
|
|
1545
|
-
/**
|
|
1546
|
-
* See
|
|
1547
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.dragend
|
|
1548
|
-
*/
|
|
1549
|
-
this.mapDragend = this._eventManager.getLazyEmitter('dragend');
|
|
1550
|
-
/**
|
|
1551
|
-
* See
|
|
1552
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.draggable_changed
|
|
1553
|
-
*/
|
|
1554
|
-
this.draggableChanged = this._eventManager.getLazyEmitter('draggable_changed');
|
|
1555
|
-
/**
|
|
1556
|
-
* See
|
|
1557
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.dragstart
|
|
1558
|
-
*/
|
|
1559
|
-
this.mapDragstart = this._eventManager.getLazyEmitter('dragstart');
|
|
1560
|
-
/**
|
|
1561
|
-
* See
|
|
1562
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.flat_changed
|
|
1563
|
-
*/
|
|
1564
|
-
this.flatChanged = this._eventManager.getLazyEmitter('flat_changed');
|
|
1565
|
-
/**
|
|
1566
|
-
* See
|
|
1567
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.icon_changed
|
|
1568
|
-
*/
|
|
1569
|
-
this.iconChanged = this._eventManager.getLazyEmitter('icon_changed');
|
|
1570
|
-
/**
|
|
1571
|
-
* See
|
|
1572
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.mousedown
|
|
1573
|
-
*/
|
|
1574
|
-
this.mapMousedown = this._eventManager.getLazyEmitter('mousedown');
|
|
1575
|
-
/**
|
|
1576
|
-
* See
|
|
1577
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.mouseout
|
|
1578
|
-
*/
|
|
1579
|
-
this.mapMouseout = this._eventManager.getLazyEmitter('mouseout');
|
|
1580
|
-
/**
|
|
1581
|
-
* See
|
|
1582
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.mouseover
|
|
1583
|
-
*/
|
|
1584
|
-
this.mapMouseover = this._eventManager.getLazyEmitter('mouseover');
|
|
1585
|
-
/**
|
|
1586
|
-
* See
|
|
1587
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.mouseup
|
|
1588
|
-
*/
|
|
1589
|
-
this.mapMouseup = this._eventManager.getLazyEmitter('mouseup');
|
|
1590
|
-
/**
|
|
1591
|
-
* See
|
|
1592
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.position_changed
|
|
1593
|
-
*/
|
|
1594
|
-
this.positionChanged = this._eventManager.getLazyEmitter('position_changed');
|
|
1595
|
-
/**
|
|
1596
|
-
* See
|
|
1597
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.rightclick
|
|
1598
|
-
*/
|
|
1599
|
-
this.mapRightclick = this._eventManager.getLazyEmitter('rightclick');
|
|
1600
|
-
/**
|
|
1601
|
-
* See
|
|
1602
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.shape_changed
|
|
1603
|
-
*/
|
|
1604
|
-
this.shapeChanged = this._eventManager.getLazyEmitter('shape_changed');
|
|
1605
|
-
/**
|
|
1606
|
-
* See
|
|
1607
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.title_changed
|
|
1608
|
-
*/
|
|
1609
|
-
this.titleChanged = this._eventManager.getLazyEmitter('title_changed');
|
|
1610
|
-
/**
|
|
1611
|
-
* See
|
|
1612
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.visible_changed
|
|
1613
|
-
*/
|
|
1614
|
-
this.visibleChanged = this._eventManager.getLazyEmitter('visible_changed');
|
|
1615
|
-
/**
|
|
1616
|
-
* See
|
|
1617
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.zindex_changed
|
|
1618
|
-
*/
|
|
1619
|
-
this.zindexChanged = this._eventManager.getLazyEmitter('zindex_changed');
|
|
1620
|
-
}
|
|
1621
|
-
ngOnInit() {
|
|
1622
|
-
if (this._googleMap._isBrowser) {
|
|
1623
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
1624
|
-
// We'll bring it back in inside the `MapEventManager` only for the events that the
|
|
1625
|
-
// user has subscribed to.
|
|
1626
|
-
this._ngZone.runOutsideAngular(() => {
|
|
1627
|
-
this.marker = new google.maps.Marker(this._combineOptions());
|
|
1628
|
-
});
|
|
1629
|
-
this._assertInitialized();
|
|
1630
|
-
this.marker.setMap(this._googleMap.googleMap);
|
|
1631
|
-
this._eventManager.setTarget(this.marker);
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
ngOnChanges(changes) {
|
|
1635
|
-
const { marker, _title, _position, _label, _clickable, _icon, _visible } = this;
|
|
1636
|
-
if (marker) {
|
|
1637
|
-
if (changes['options']) {
|
|
1638
|
-
marker.setOptions(this._combineOptions());
|
|
1639
|
-
}
|
|
1640
|
-
if (changes['title'] && _title !== undefined) {
|
|
1641
|
-
marker.setTitle(_title);
|
|
1642
|
-
}
|
|
1643
|
-
if (changes['position'] && _position) {
|
|
1644
|
-
marker.setPosition(_position);
|
|
1645
|
-
}
|
|
1646
|
-
if (changes['label'] && _label !== undefined) {
|
|
1647
|
-
marker.setLabel(_label);
|
|
1648
|
-
}
|
|
1649
|
-
if (changes['clickable'] && _clickable !== undefined) {
|
|
1650
|
-
marker.setClickable(_clickable);
|
|
1651
|
-
}
|
|
1652
|
-
if (changes['icon'] && _icon) {
|
|
1653
|
-
marker.setIcon(_icon);
|
|
1654
|
-
}
|
|
1655
|
-
if (changes['visible'] && _visible !== undefined) {
|
|
1656
|
-
marker.setVisible(_visible);
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
ngOnDestroy() {
|
|
1661
|
-
this._eventManager.destroy();
|
|
1662
|
-
if (this.marker) {
|
|
1663
|
-
this.marker.setMap(null);
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
/**
|
|
1667
|
-
* See
|
|
1668
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.getAnimation
|
|
1669
|
-
*/
|
|
1670
|
-
getAnimation() {
|
|
1671
|
-
this._assertInitialized();
|
|
1672
|
-
return this.marker.getAnimation() || null;
|
|
1673
|
-
}
|
|
1674
|
-
/**
|
|
1675
|
-
* See
|
|
1676
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.getClickable
|
|
1677
|
-
*/
|
|
1678
|
-
getClickable() {
|
|
1679
|
-
this._assertInitialized();
|
|
1680
|
-
return this.marker.getClickable();
|
|
1681
|
-
}
|
|
1682
|
-
/**
|
|
1683
|
-
* See
|
|
1684
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.getCursor
|
|
1685
|
-
*/
|
|
1686
|
-
getCursor() {
|
|
1687
|
-
this._assertInitialized();
|
|
1688
|
-
return this.marker.getCursor() || null;
|
|
1689
|
-
}
|
|
1690
|
-
/**
|
|
1691
|
-
* See
|
|
1692
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.getDraggable
|
|
1693
|
-
*/
|
|
1694
|
-
getDraggable() {
|
|
1695
|
-
this._assertInitialized();
|
|
1696
|
-
return !!this.marker.getDraggable();
|
|
1697
|
-
}
|
|
1698
|
-
/**
|
|
1699
|
-
* See
|
|
1700
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.getIcon
|
|
1701
|
-
*/
|
|
1702
|
-
getIcon() {
|
|
1703
|
-
this._assertInitialized();
|
|
1704
|
-
return this.marker.getIcon() || null;
|
|
1705
|
-
}
|
|
1706
|
-
/**
|
|
1707
|
-
* See
|
|
1708
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.getLabel
|
|
1709
|
-
*/
|
|
1710
|
-
getLabel() {
|
|
1711
|
-
this._assertInitialized();
|
|
1712
|
-
return this.marker.getLabel() || null;
|
|
1713
|
-
}
|
|
1714
|
-
/**
|
|
1715
|
-
* See
|
|
1716
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.getOpacity
|
|
1717
|
-
*/
|
|
1718
|
-
getOpacity() {
|
|
1719
|
-
this._assertInitialized();
|
|
1720
|
-
return this.marker.getOpacity() || null;
|
|
1721
|
-
}
|
|
1722
|
-
/**
|
|
1723
|
-
* See
|
|
1724
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.getPosition
|
|
1725
|
-
*/
|
|
1726
|
-
getPosition() {
|
|
1727
|
-
this._assertInitialized();
|
|
1728
|
-
return this.marker.getPosition() || null;
|
|
1729
|
-
}
|
|
1730
|
-
/**
|
|
1731
|
-
* See
|
|
1732
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.getShape
|
|
1733
|
-
*/
|
|
1734
|
-
getShape() {
|
|
1735
|
-
this._assertInitialized();
|
|
1736
|
-
return this.marker.getShape() || null;
|
|
1737
|
-
}
|
|
1738
|
-
/**
|
|
1739
|
-
* See
|
|
1740
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.getTitle
|
|
1741
|
-
*/
|
|
1742
|
-
getTitle() {
|
|
1743
|
-
this._assertInitialized();
|
|
1744
|
-
return this.marker.getTitle() || null;
|
|
1745
|
-
}
|
|
1746
|
-
/**
|
|
1747
|
-
* See
|
|
1748
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.getVisible
|
|
1749
|
-
*/
|
|
1750
|
-
getVisible() {
|
|
1751
|
-
this._assertInitialized();
|
|
1752
|
-
return this.marker.getVisible();
|
|
1753
|
-
}
|
|
1754
|
-
/**
|
|
1755
|
-
* See
|
|
1756
|
-
* developers.google.com/maps/documentation/javascript/reference/marker#Marker.getZIndex
|
|
1757
|
-
*/
|
|
1758
|
-
getZIndex() {
|
|
1759
|
-
this._assertInitialized();
|
|
1760
|
-
return this.marker.getZIndex() || null;
|
|
1761
|
-
}
|
|
1762
|
-
/** Gets the anchor point that can be used to attach other Google Maps objects. */
|
|
1763
|
-
getAnchor() {
|
|
1764
|
-
this._assertInitialized();
|
|
1765
|
-
return this.marker;
|
|
1766
|
-
}
|
|
1767
|
-
/** Creates a combined options object using the passed-in options and the individual inputs. */
|
|
1768
|
-
_combineOptions() {
|
|
1769
|
-
var _a, _b;
|
|
1770
|
-
const options = this._options || DEFAULT_MARKER_OPTIONS;
|
|
1771
|
-
return Object.assign(Object.assign({}, options), { title: this._title || options.title, position: this._position || options.position, label: this._label || options.label, clickable: (_a = this._clickable) !== null && _a !== void 0 ? _a : options.clickable, map: this._googleMap.googleMap, icon: this._icon || options.icon, visible: (_b = this._visible) !== null && _b !== void 0 ? _b : options.visible });
|
|
1772
|
-
}
|
|
1773
|
-
_assertInitialized() {
|
|
1774
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
1775
|
-
if (!this._googleMap.googleMap) {
|
|
1776
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
1777
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
1778
|
-
}
|
|
1779
|
-
if (!this.marker) {
|
|
1780
|
-
throw Error('Cannot interact with a Google Map Marker before it has been ' +
|
|
1781
|
-
'initialized. Please wait for the Marker to load before trying to interact with it.');
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
MapMarker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapMarker, deps: [{ token: GoogleMap }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1787
|
-
MapMarker.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapMarker, selector: "map-marker", inputs: { title: "title", position: "position", label: "label", clickable: "clickable", options: "options", icon: "icon", visible: "visible" }, outputs: { animationChanged: "animationChanged", mapClick: "mapClick", clickableChanged: "clickableChanged", cursorChanged: "cursorChanged", mapDblclick: "mapDblclick", mapDrag: "mapDrag", mapDragend: "mapDragend", draggableChanged: "draggableChanged", mapDragstart: "mapDragstart", flatChanged: "flatChanged", iconChanged: "iconChanged", mapMousedown: "mapMousedown", mapMouseout: "mapMouseout", mapMouseover: "mapMouseover", mapMouseup: "mapMouseup", positionChanged: "positionChanged", mapRightclick: "mapRightclick", shapeChanged: "shapeChanged", titleChanged: "titleChanged", visibleChanged: "visibleChanged", zindexChanged: "zindexChanged" }, exportAs: ["mapMarker"], usesOnChanges: true, ngImport: i0 });
|
|
1788
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapMarker, decorators: [{
|
|
1789
|
-
type: Directive,
|
|
1790
|
-
args: [{
|
|
1791
|
-
selector: 'map-marker',
|
|
1792
|
-
exportAs: 'mapMarker',
|
|
1793
|
-
}]
|
|
1794
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.NgZone }]; }, propDecorators: { title: [{
|
|
1795
|
-
type: Input
|
|
1796
|
-
}], position: [{
|
|
1797
|
-
type: Input
|
|
1798
|
-
}], label: [{
|
|
1799
|
-
type: Input
|
|
1800
|
-
}], clickable: [{
|
|
1801
|
-
type: Input
|
|
1802
|
-
}], options: [{
|
|
1803
|
-
type: Input
|
|
1804
|
-
}], icon: [{
|
|
1805
|
-
type: Input
|
|
1806
|
-
}], visible: [{
|
|
1807
|
-
type: Input
|
|
1808
|
-
}], animationChanged: [{
|
|
1809
|
-
type: Output
|
|
1810
|
-
}], mapClick: [{
|
|
1811
|
-
type: Output
|
|
1812
|
-
}], clickableChanged: [{
|
|
1813
|
-
type: Output
|
|
1814
|
-
}], cursorChanged: [{
|
|
1815
|
-
type: Output
|
|
1816
|
-
}], mapDblclick: [{
|
|
1817
|
-
type: Output
|
|
1818
|
-
}], mapDrag: [{
|
|
1819
|
-
type: Output
|
|
1820
|
-
}], mapDragend: [{
|
|
1821
|
-
type: Output
|
|
1822
|
-
}], draggableChanged: [{
|
|
1823
|
-
type: Output
|
|
1824
|
-
}], mapDragstart: [{
|
|
1825
|
-
type: Output
|
|
1826
|
-
}], flatChanged: [{
|
|
1827
|
-
type: Output
|
|
1828
|
-
}], iconChanged: [{
|
|
1829
|
-
type: Output
|
|
1830
|
-
}], mapMousedown: [{
|
|
1831
|
-
type: Output
|
|
1832
|
-
}], mapMouseout: [{
|
|
1833
|
-
type: Output
|
|
1834
|
-
}], mapMouseover: [{
|
|
1835
|
-
type: Output
|
|
1836
|
-
}], mapMouseup: [{
|
|
1837
|
-
type: Output
|
|
1838
|
-
}], positionChanged: [{
|
|
1839
|
-
type: Output
|
|
1840
|
-
}], mapRightclick: [{
|
|
1841
|
-
type: Output
|
|
1842
|
-
}], shapeChanged: [{
|
|
1843
|
-
type: Output
|
|
1844
|
-
}], titleChanged: [{
|
|
1845
|
-
type: Output
|
|
1846
|
-
}], visibleChanged: [{
|
|
1847
|
-
type: Output
|
|
1848
|
-
}], zindexChanged: [{
|
|
1849
|
-
type: Output
|
|
1850
|
-
}] } });
|
|
1851
|
-
|
|
1852
|
-
/// <reference types="google.maps" />
|
|
1853
|
-
/** Default options for a clusterer. */
|
|
1854
|
-
const DEFAULT_CLUSTERER_OPTIONS = {};
|
|
1855
|
-
/**
|
|
1856
|
-
* Angular component for implementing a Google Maps Marker Clusterer.
|
|
1857
|
-
*
|
|
1858
|
-
* See https://developers.google.com/maps/documentation/javascript/marker-clustering
|
|
1859
|
-
*/
|
|
1860
|
-
class MapMarkerClusterer {
|
|
1861
|
-
set averageCenter(averageCenter) {
|
|
1862
|
-
this._averageCenter = averageCenter;
|
|
1863
|
-
}
|
|
1864
|
-
set batchSizeIE(batchSizeIE) {
|
|
1865
|
-
this._batchSizeIE = batchSizeIE;
|
|
1866
|
-
}
|
|
1867
|
-
set calculator(calculator) {
|
|
1868
|
-
this._calculator = calculator;
|
|
1869
|
-
}
|
|
1870
|
-
set clusterClass(clusterClass) {
|
|
1871
|
-
this._clusterClass = clusterClass;
|
|
1872
|
-
}
|
|
1873
|
-
set enableRetinaIcons(enableRetinaIcons) {
|
|
1874
|
-
this._enableRetinaIcons = enableRetinaIcons;
|
|
1875
|
-
}
|
|
1876
|
-
set gridSize(gridSize) {
|
|
1877
|
-
this._gridSize = gridSize;
|
|
1878
|
-
}
|
|
1879
|
-
set ignoreHidden(ignoreHidden) {
|
|
1880
|
-
this._ignoreHidden = ignoreHidden;
|
|
1881
|
-
}
|
|
1882
|
-
set imageExtension(imageExtension) {
|
|
1883
|
-
this._imageExtension = imageExtension;
|
|
1884
|
-
}
|
|
1885
|
-
set imagePath(imagePath) {
|
|
1886
|
-
this._imagePath = imagePath;
|
|
1887
|
-
}
|
|
1888
|
-
set imageSizes(imageSizes) {
|
|
1889
|
-
this._imageSizes = imageSizes;
|
|
1890
|
-
}
|
|
1891
|
-
set maxZoom(maxZoom) {
|
|
1892
|
-
this._maxZoom = maxZoom;
|
|
1893
|
-
}
|
|
1894
|
-
set minimumClusterSize(minimumClusterSize) {
|
|
1895
|
-
this._minimumClusterSize = minimumClusterSize;
|
|
1896
|
-
}
|
|
1897
|
-
set styles(styles) {
|
|
1898
|
-
this._styles = styles;
|
|
1899
|
-
}
|
|
1900
|
-
set title(title) {
|
|
1901
|
-
this._title = title;
|
|
1902
|
-
}
|
|
1903
|
-
set zIndex(zIndex) {
|
|
1904
|
-
this._zIndex = zIndex;
|
|
1905
|
-
}
|
|
1906
|
-
set zoomOnClick(zoomOnClick) {
|
|
1907
|
-
this._zoomOnClick = zoomOnClick;
|
|
1908
|
-
}
|
|
1909
|
-
set options(options) {
|
|
1910
|
-
this._options = options;
|
|
1911
|
-
}
|
|
1912
|
-
constructor(_googleMap, _ngZone) {
|
|
1913
|
-
this._googleMap = _googleMap;
|
|
1914
|
-
this._ngZone = _ngZone;
|
|
1915
|
-
this._currentMarkers = new Set();
|
|
1916
|
-
this._eventManager = new MapEventManager(inject(NgZone));
|
|
1917
|
-
this._destroy = new Subject();
|
|
1918
|
-
this.ariaLabelFn = () => '';
|
|
1919
|
-
/**
|
|
1920
|
-
* See
|
|
1921
|
-
* googlemaps.github.io/v3-utility-library/modules/
|
|
1922
|
-
* _google_markerclustererplus.html#clusteringbegin
|
|
1923
|
-
*/
|
|
1924
|
-
this.clusteringbegin = this._eventManager.getLazyEmitter('clusteringbegin');
|
|
1925
|
-
/**
|
|
1926
|
-
* See
|
|
1927
|
-
* googlemaps.github.io/v3-utility-library/modules/_google_markerclustererplus.html#clusteringend
|
|
1928
|
-
*/
|
|
1929
|
-
this.clusteringend = this._eventManager.getLazyEmitter('clusteringend');
|
|
1930
|
-
/** Emits when a cluster has been clicked. */
|
|
1931
|
-
this.clusterClick = this._eventManager.getLazyEmitter('click');
|
|
1932
|
-
this._canInitialize = this._googleMap._isBrowser;
|
|
1933
|
-
}
|
|
1934
|
-
ngOnInit() {
|
|
1935
|
-
if (this._canInitialize) {
|
|
1936
|
-
if (typeof MarkerClusterer !== 'function' &&
|
|
1937
|
-
(typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
1938
|
-
throw Error('MarkerClusterer class not found, cannot construct a marker cluster. ' +
|
|
1939
|
-
'Please install the MarkerClustererPlus library: ' +
|
|
1940
|
-
'https://github.com/googlemaps/js-markerclustererplus');
|
|
1941
|
-
}
|
|
1942
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
1943
|
-
// We'll bring it back in inside the `MapEventManager` only for the events that the
|
|
1944
|
-
// user has subscribed to.
|
|
1945
|
-
this._ngZone.runOutsideAngular(() => {
|
|
1946
|
-
this.markerClusterer = new MarkerClusterer(this._googleMap.googleMap, [], this._combineOptions());
|
|
1947
|
-
});
|
|
1948
|
-
this._assertInitialized();
|
|
1949
|
-
this._eventManager.setTarget(this.markerClusterer);
|
|
1950
|
-
}
|
|
1951
|
-
}
|
|
1952
|
-
ngAfterContentInit() {
|
|
1953
|
-
if (this._canInitialize) {
|
|
1954
|
-
this._watchForMarkerChanges();
|
|
1955
|
-
}
|
|
1956
|
-
}
|
|
1957
|
-
ngOnChanges(changes) {
|
|
1958
|
-
const { markerClusterer: clusterer, ariaLabelFn, _averageCenter, _batchSizeIE, _calculator, _styles, _clusterClass, _enableRetinaIcons, _gridSize, _ignoreHidden, _imageExtension, _imagePath, _imageSizes, _maxZoom, _minimumClusterSize, _title, _zIndex, _zoomOnClick, } = this;
|
|
1959
|
-
if (clusterer) {
|
|
1960
|
-
if (changes['options']) {
|
|
1961
|
-
clusterer.setOptions(this._combineOptions());
|
|
1962
|
-
}
|
|
1963
|
-
if (changes['ariaLabelFn']) {
|
|
1964
|
-
clusterer.ariaLabelFn = ariaLabelFn;
|
|
1965
|
-
}
|
|
1966
|
-
if (changes['averageCenter'] && _averageCenter !== undefined) {
|
|
1967
|
-
clusterer.setAverageCenter(_averageCenter);
|
|
1968
|
-
}
|
|
1969
|
-
if (changes['batchSizeIE'] && _batchSizeIE !== undefined) {
|
|
1970
|
-
clusterer.setBatchSizeIE(_batchSizeIE);
|
|
1971
|
-
}
|
|
1972
|
-
if (changes['calculator'] && !!_calculator) {
|
|
1973
|
-
clusterer.setCalculator(_calculator);
|
|
1974
|
-
}
|
|
1975
|
-
if (changes['clusterClass'] && _clusterClass !== undefined) {
|
|
1976
|
-
clusterer.setClusterClass(_clusterClass);
|
|
1977
|
-
}
|
|
1978
|
-
if (changes['enableRetinaIcons'] && _enableRetinaIcons !== undefined) {
|
|
1979
|
-
clusterer.setEnableRetinaIcons(_enableRetinaIcons);
|
|
1980
|
-
}
|
|
1981
|
-
if (changes['gridSize'] && _gridSize !== undefined) {
|
|
1982
|
-
clusterer.setGridSize(_gridSize);
|
|
1983
|
-
}
|
|
1984
|
-
if (changes['ignoreHidden'] && _ignoreHidden !== undefined) {
|
|
1985
|
-
clusterer.setIgnoreHidden(_ignoreHidden);
|
|
1986
|
-
}
|
|
1987
|
-
if (changes['imageExtension'] && _imageExtension !== undefined) {
|
|
1988
|
-
clusterer.setImageExtension(_imageExtension);
|
|
1989
|
-
}
|
|
1990
|
-
if (changes['imagePath'] && _imagePath !== undefined) {
|
|
1991
|
-
clusterer.setImagePath(_imagePath);
|
|
1992
|
-
}
|
|
1993
|
-
if (changes['imageSizes'] && _imageSizes) {
|
|
1994
|
-
clusterer.setImageSizes(_imageSizes);
|
|
1995
|
-
}
|
|
1996
|
-
if (changes['maxZoom'] && _maxZoom !== undefined) {
|
|
1997
|
-
clusterer.setMaxZoom(_maxZoom);
|
|
1998
|
-
}
|
|
1999
|
-
if (changes['minimumClusterSize'] && _minimumClusterSize !== undefined) {
|
|
2000
|
-
clusterer.setMinimumClusterSize(_minimumClusterSize);
|
|
2001
|
-
}
|
|
2002
|
-
if (changes['styles'] && _styles) {
|
|
2003
|
-
clusterer.setStyles(_styles);
|
|
2004
|
-
}
|
|
2005
|
-
if (changes['title'] && _title !== undefined) {
|
|
2006
|
-
clusterer.setTitle(_title);
|
|
2007
|
-
}
|
|
2008
|
-
if (changes['zIndex'] && _zIndex !== undefined) {
|
|
2009
|
-
clusterer.setZIndex(_zIndex);
|
|
2010
|
-
}
|
|
2011
|
-
if (changes['zoomOnClick'] && _zoomOnClick !== undefined) {
|
|
2012
|
-
clusterer.setZoomOnClick(_zoomOnClick);
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
ngOnDestroy() {
|
|
2017
|
-
this._destroy.next();
|
|
2018
|
-
this._destroy.complete();
|
|
2019
|
-
this._eventManager.destroy();
|
|
2020
|
-
if (this.markerClusterer) {
|
|
2021
|
-
this.markerClusterer.setMap(null);
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
2024
|
-
fitMapToMarkers(padding) {
|
|
2025
|
-
this._assertInitialized();
|
|
2026
|
-
this.markerClusterer.fitMapToMarkers(padding);
|
|
2027
|
-
}
|
|
2028
|
-
getAverageCenter() {
|
|
2029
|
-
this._assertInitialized();
|
|
2030
|
-
return this.markerClusterer.getAverageCenter();
|
|
2031
|
-
}
|
|
2032
|
-
getBatchSizeIE() {
|
|
2033
|
-
this._assertInitialized();
|
|
2034
|
-
return this.markerClusterer.getBatchSizeIE();
|
|
2035
|
-
}
|
|
2036
|
-
getCalculator() {
|
|
2037
|
-
this._assertInitialized();
|
|
2038
|
-
return this.markerClusterer.getCalculator();
|
|
2039
|
-
}
|
|
2040
|
-
getClusterClass() {
|
|
2041
|
-
this._assertInitialized();
|
|
2042
|
-
return this.markerClusterer.getClusterClass();
|
|
2043
|
-
}
|
|
2044
|
-
getClusters() {
|
|
2045
|
-
this._assertInitialized();
|
|
2046
|
-
return this.markerClusterer.getClusters();
|
|
2047
|
-
}
|
|
2048
|
-
getEnableRetinaIcons() {
|
|
2049
|
-
this._assertInitialized();
|
|
2050
|
-
return this.markerClusterer.getEnableRetinaIcons();
|
|
2051
|
-
}
|
|
2052
|
-
getGridSize() {
|
|
2053
|
-
this._assertInitialized();
|
|
2054
|
-
return this.markerClusterer.getGridSize();
|
|
2055
|
-
}
|
|
2056
|
-
getIgnoreHidden() {
|
|
2057
|
-
this._assertInitialized();
|
|
2058
|
-
return this.markerClusterer.getIgnoreHidden();
|
|
2059
|
-
}
|
|
2060
|
-
getImageExtension() {
|
|
2061
|
-
this._assertInitialized();
|
|
2062
|
-
return this.markerClusterer.getImageExtension();
|
|
2063
|
-
}
|
|
2064
|
-
getImagePath() {
|
|
2065
|
-
this._assertInitialized();
|
|
2066
|
-
return this.markerClusterer.getImagePath();
|
|
2067
|
-
}
|
|
2068
|
-
getImageSizes() {
|
|
2069
|
-
this._assertInitialized();
|
|
2070
|
-
return this.markerClusterer.getImageSizes();
|
|
2071
|
-
}
|
|
2072
|
-
getMaxZoom() {
|
|
2073
|
-
this._assertInitialized();
|
|
2074
|
-
return this.markerClusterer.getMaxZoom();
|
|
2075
|
-
}
|
|
2076
|
-
getMinimumClusterSize() {
|
|
2077
|
-
this._assertInitialized();
|
|
2078
|
-
return this.markerClusterer.getMinimumClusterSize();
|
|
2079
|
-
}
|
|
2080
|
-
getStyles() {
|
|
2081
|
-
this._assertInitialized();
|
|
2082
|
-
return this.markerClusterer.getStyles();
|
|
2083
|
-
}
|
|
2084
|
-
getTitle() {
|
|
2085
|
-
this._assertInitialized();
|
|
2086
|
-
return this.markerClusterer.getTitle();
|
|
2087
|
-
}
|
|
2088
|
-
getTotalClusters() {
|
|
2089
|
-
this._assertInitialized();
|
|
2090
|
-
return this.markerClusterer.getTotalClusters();
|
|
2091
|
-
}
|
|
2092
|
-
getTotalMarkers() {
|
|
2093
|
-
this._assertInitialized();
|
|
2094
|
-
return this.markerClusterer.getTotalMarkers();
|
|
2095
|
-
}
|
|
2096
|
-
getZIndex() {
|
|
2097
|
-
this._assertInitialized();
|
|
2098
|
-
return this.markerClusterer.getZIndex();
|
|
2099
|
-
}
|
|
2100
|
-
getZoomOnClick() {
|
|
2101
|
-
this._assertInitialized();
|
|
2102
|
-
return this.markerClusterer.getZoomOnClick();
|
|
2103
|
-
}
|
|
2104
|
-
_combineOptions() {
|
|
2105
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
2106
|
-
const options = this._options || DEFAULT_CLUSTERER_OPTIONS;
|
|
2107
|
-
return Object.assign(Object.assign({}, options), { ariaLabelFn: (_a = this.ariaLabelFn) !== null && _a !== void 0 ? _a : options.ariaLabelFn, averageCenter: (_b = this._averageCenter) !== null && _b !== void 0 ? _b : options.averageCenter, batchSize: (_c = this.batchSize) !== null && _c !== void 0 ? _c : options.batchSize, batchSizeIE: (_d = this._batchSizeIE) !== null && _d !== void 0 ? _d : options.batchSizeIE, calculator: (_e = this._calculator) !== null && _e !== void 0 ? _e : options.calculator, clusterClass: (_f = this._clusterClass) !== null && _f !== void 0 ? _f : options.clusterClass, enableRetinaIcons: (_g = this._enableRetinaIcons) !== null && _g !== void 0 ? _g : options.enableRetinaIcons, gridSize: (_h = this._gridSize) !== null && _h !== void 0 ? _h : options.gridSize, ignoreHidden: (_j = this._ignoreHidden) !== null && _j !== void 0 ? _j : options.ignoreHidden, imageExtension: (_k = this._imageExtension) !== null && _k !== void 0 ? _k : options.imageExtension, imagePath: (_l = this._imagePath) !== null && _l !== void 0 ? _l : options.imagePath, imageSizes: (_m = this._imageSizes) !== null && _m !== void 0 ? _m : options.imageSizes, maxZoom: (_o = this._maxZoom) !== null && _o !== void 0 ? _o : options.maxZoom, minimumClusterSize: (_p = this._minimumClusterSize) !== null && _p !== void 0 ? _p : options.minimumClusterSize, styles: (_q = this._styles) !== null && _q !== void 0 ? _q : options.styles, title: (_r = this._title) !== null && _r !== void 0 ? _r : options.title, zIndex: (_s = this._zIndex) !== null && _s !== void 0 ? _s : options.zIndex, zoomOnClick: (_t = this._zoomOnClick) !== null && _t !== void 0 ? _t : options.zoomOnClick });
|
|
2108
|
-
}
|
|
2109
|
-
_watchForMarkerChanges() {
|
|
2110
|
-
this._assertInitialized();
|
|
2111
|
-
const initialMarkers = [];
|
|
2112
|
-
for (const marker of this._getInternalMarkers(this._markers.toArray())) {
|
|
2113
|
-
this._currentMarkers.add(marker);
|
|
2114
|
-
initialMarkers.push(marker);
|
|
2115
|
-
}
|
|
2116
|
-
this.markerClusterer.addMarkers(initialMarkers);
|
|
2117
|
-
this._markers.changes
|
|
2118
|
-
.pipe(takeUntil(this._destroy))
|
|
2119
|
-
.subscribe((markerComponents) => {
|
|
2120
|
-
this._assertInitialized();
|
|
2121
|
-
const newMarkers = new Set(this._getInternalMarkers(markerComponents));
|
|
2122
|
-
const markersToAdd = [];
|
|
2123
|
-
const markersToRemove = [];
|
|
2124
|
-
for (const marker of Array.from(newMarkers)) {
|
|
2125
|
-
if (!this._currentMarkers.has(marker)) {
|
|
2126
|
-
this._currentMarkers.add(marker);
|
|
2127
|
-
markersToAdd.push(marker);
|
|
2128
|
-
}
|
|
2129
|
-
}
|
|
2130
|
-
for (const marker of Array.from(this._currentMarkers)) {
|
|
2131
|
-
if (!newMarkers.has(marker)) {
|
|
2132
|
-
markersToRemove.push(marker);
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
this.markerClusterer.addMarkers(markersToAdd, true);
|
|
2136
|
-
this.markerClusterer.removeMarkers(markersToRemove, true);
|
|
2137
|
-
this.markerClusterer.repaint();
|
|
2138
|
-
for (const marker of markersToRemove) {
|
|
2139
|
-
this._currentMarkers.delete(marker);
|
|
2140
|
-
}
|
|
2141
|
-
});
|
|
2142
|
-
}
|
|
2143
|
-
_getInternalMarkers(markers) {
|
|
2144
|
-
return markers
|
|
2145
|
-
.filter(markerComponent => !!markerComponent.marker)
|
|
2146
|
-
.map(markerComponent => markerComponent.marker);
|
|
2147
|
-
}
|
|
2148
|
-
_assertInitialized() {
|
|
2149
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
2150
|
-
if (!this._googleMap.googleMap) {
|
|
2151
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
2152
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
2153
|
-
}
|
|
2154
|
-
if (!this.markerClusterer) {
|
|
2155
|
-
throw Error('Cannot interact with a MarkerClusterer before it has been initialized. ' +
|
|
2156
|
-
'Please wait for the MarkerClusterer to load before trying to interact with it.');
|
|
2157
|
-
}
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
MapMarkerClusterer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapMarkerClusterer, deps: [{ token: GoogleMap }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
2162
|
-
MapMarkerClusterer.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapMarkerClusterer, selector: "map-marker-clusterer", inputs: { ariaLabelFn: "ariaLabelFn", averageCenter: "averageCenter", batchSize: "batchSize", batchSizeIE: "batchSizeIE", calculator: "calculator", clusterClass: "clusterClass", enableRetinaIcons: "enableRetinaIcons", gridSize: "gridSize", ignoreHidden: "ignoreHidden", imageExtension: "imageExtension", imagePath: "imagePath", imageSizes: "imageSizes", maxZoom: "maxZoom", minimumClusterSize: "minimumClusterSize", styles: "styles", title: "title", zIndex: "zIndex", zoomOnClick: "zoomOnClick", options: "options" }, outputs: { clusteringbegin: "clusteringbegin", clusteringend: "clusteringend", clusterClick: "clusterClick" }, queries: [{ propertyName: "_markers", predicate: MapMarker, descendants: true }], exportAs: ["mapMarkerClusterer"], usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2163
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapMarkerClusterer, decorators: [{
|
|
2164
|
-
type: Component,
|
|
2165
|
-
args: [{
|
|
2166
|
-
selector: 'map-marker-clusterer',
|
|
2167
|
-
exportAs: 'mapMarkerClusterer',
|
|
2168
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2169
|
-
template: '<ng-content></ng-content>',
|
|
2170
|
-
encapsulation: ViewEncapsulation.None,
|
|
2171
|
-
}]
|
|
2172
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.NgZone }]; }, propDecorators: { ariaLabelFn: [{
|
|
2173
|
-
type: Input
|
|
2174
|
-
}], averageCenter: [{
|
|
2175
|
-
type: Input
|
|
2176
|
-
}], batchSize: [{
|
|
2177
|
-
type: Input
|
|
2178
|
-
}], batchSizeIE: [{
|
|
2179
|
-
type: Input
|
|
2180
|
-
}], calculator: [{
|
|
2181
|
-
type: Input
|
|
2182
|
-
}], clusterClass: [{
|
|
2183
|
-
type: Input
|
|
2184
|
-
}], enableRetinaIcons: [{
|
|
2185
|
-
type: Input
|
|
2186
|
-
}], gridSize: [{
|
|
2187
|
-
type: Input
|
|
2188
|
-
}], ignoreHidden: [{
|
|
2189
|
-
type: Input
|
|
2190
|
-
}], imageExtension: [{
|
|
2191
|
-
type: Input
|
|
2192
|
-
}], imagePath: [{
|
|
2193
|
-
type: Input
|
|
2194
|
-
}], imageSizes: [{
|
|
2195
|
-
type: Input
|
|
2196
|
-
}], maxZoom: [{
|
|
2197
|
-
type: Input
|
|
2198
|
-
}], minimumClusterSize: [{
|
|
2199
|
-
type: Input
|
|
2200
|
-
}], styles: [{
|
|
2201
|
-
type: Input
|
|
2202
|
-
}], title: [{
|
|
2203
|
-
type: Input
|
|
2204
|
-
}], zIndex: [{
|
|
2205
|
-
type: Input
|
|
2206
|
-
}], zoomOnClick: [{
|
|
2207
|
-
type: Input
|
|
2208
|
-
}], options: [{
|
|
2209
|
-
type: Input
|
|
2210
|
-
}], clusteringbegin: [{
|
|
2211
|
-
type: Output
|
|
2212
|
-
}], clusteringend: [{
|
|
2213
|
-
type: Output
|
|
2214
|
-
}], clusterClick: [{
|
|
2215
|
-
type: Output
|
|
2216
|
-
}], _markers: [{
|
|
2217
|
-
type: ContentChildren,
|
|
2218
|
-
args: [MapMarker, { descendants: true }]
|
|
2219
|
-
}] } });
|
|
2220
|
-
|
|
2221
|
-
/// <reference types="google.maps" />
|
|
2222
|
-
/**
|
|
2223
|
-
* Angular component that renders a Google Maps Polygon via the Google Maps JavaScript API.
|
|
2224
|
-
*
|
|
2225
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon
|
|
2226
|
-
*/
|
|
2227
|
-
class MapPolygon {
|
|
2228
|
-
set options(options) {
|
|
2229
|
-
this._options.next(options || {});
|
|
2230
|
-
}
|
|
2231
|
-
set paths(paths) {
|
|
2232
|
-
this._paths.next(paths);
|
|
2233
|
-
}
|
|
2234
|
-
constructor(_map, _ngZone) {
|
|
2235
|
-
this._map = _map;
|
|
2236
|
-
this._ngZone = _ngZone;
|
|
2237
|
-
this._eventManager = new MapEventManager(inject(NgZone));
|
|
2238
|
-
this._options = new BehaviorSubject({});
|
|
2239
|
-
this._paths = new BehaviorSubject(undefined);
|
|
2240
|
-
this._destroyed = new Subject();
|
|
2241
|
-
/**
|
|
2242
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.click
|
|
2243
|
-
*/
|
|
2244
|
-
this.polygonClick = this._eventManager.getLazyEmitter('click');
|
|
2245
|
-
/**
|
|
2246
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.dblclick
|
|
2247
|
-
*/
|
|
2248
|
-
this.polygonDblclick = this._eventManager.getLazyEmitter('dblclick');
|
|
2249
|
-
/**
|
|
2250
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.drag
|
|
2251
|
-
*/
|
|
2252
|
-
this.polygonDrag = this._eventManager.getLazyEmitter('drag');
|
|
2253
|
-
/**
|
|
2254
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.dragend
|
|
2255
|
-
*/
|
|
2256
|
-
this.polygonDragend = this._eventManager.getLazyEmitter('dragend');
|
|
2257
|
-
/**
|
|
2258
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.dragstart
|
|
2259
|
-
*/
|
|
2260
|
-
this.polygonDragstart = this._eventManager.getLazyEmitter('dragstart');
|
|
2261
|
-
/**
|
|
2262
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.mousedown
|
|
2263
|
-
*/
|
|
2264
|
-
this.polygonMousedown = this._eventManager.getLazyEmitter('mousedown');
|
|
2265
|
-
/**
|
|
2266
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.mousemove
|
|
2267
|
-
*/
|
|
2268
|
-
this.polygonMousemove = this._eventManager.getLazyEmitter('mousemove');
|
|
2269
|
-
/**
|
|
2270
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.mouseout
|
|
2271
|
-
*/
|
|
2272
|
-
this.polygonMouseout = this._eventManager.getLazyEmitter('mouseout');
|
|
2273
|
-
/**
|
|
2274
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.mouseover
|
|
2275
|
-
*/
|
|
2276
|
-
this.polygonMouseover = this._eventManager.getLazyEmitter('mouseover');
|
|
2277
|
-
/**
|
|
2278
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.mouseup
|
|
2279
|
-
*/
|
|
2280
|
-
this.polygonMouseup = this._eventManager.getLazyEmitter('mouseup');
|
|
2281
|
-
/**
|
|
2282
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.rightclick
|
|
2283
|
-
*/
|
|
2284
|
-
this.polygonRightclick = this._eventManager.getLazyEmitter('rightclick');
|
|
2285
|
-
}
|
|
2286
|
-
ngOnInit() {
|
|
2287
|
-
if (this._map._isBrowser) {
|
|
2288
|
-
this._combineOptions()
|
|
2289
|
-
.pipe(take(1))
|
|
2290
|
-
.subscribe(options => {
|
|
2291
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
2292
|
-
// We'll bring it back in inside the `MapEventManager` only for the events that the
|
|
2293
|
-
// user has subscribed to.
|
|
2294
|
-
this._ngZone.runOutsideAngular(() => {
|
|
2295
|
-
this.polygon = new google.maps.Polygon(options);
|
|
2296
|
-
});
|
|
2297
|
-
this._assertInitialized();
|
|
2298
|
-
this.polygon.setMap(this._map.googleMap);
|
|
2299
|
-
this._eventManager.setTarget(this.polygon);
|
|
2300
|
-
});
|
|
2301
|
-
this._watchForOptionsChanges();
|
|
2302
|
-
this._watchForPathChanges();
|
|
2303
|
-
}
|
|
2304
|
-
}
|
|
2305
|
-
ngOnDestroy() {
|
|
2306
|
-
this._eventManager.destroy();
|
|
2307
|
-
this._destroyed.next();
|
|
2308
|
-
this._destroyed.complete();
|
|
2309
|
-
if (this.polygon) {
|
|
2310
|
-
this.polygon.setMap(null);
|
|
2311
|
-
}
|
|
2312
|
-
}
|
|
2313
|
-
/**
|
|
2314
|
-
* See
|
|
2315
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.getDraggable
|
|
2316
|
-
*/
|
|
2317
|
-
getDraggable() {
|
|
2318
|
-
this._assertInitialized();
|
|
2319
|
-
return this.polygon.getDraggable();
|
|
2320
|
-
}
|
|
2321
|
-
/**
|
|
2322
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.getEditable
|
|
2323
|
-
*/
|
|
2324
|
-
getEditable() {
|
|
2325
|
-
this._assertInitialized();
|
|
2326
|
-
return this.polygon.getEditable();
|
|
2327
|
-
}
|
|
2328
|
-
/**
|
|
2329
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.getPath
|
|
2330
|
-
*/
|
|
2331
|
-
getPath() {
|
|
2332
|
-
this._assertInitialized();
|
|
2333
|
-
return this.polygon.getPath();
|
|
2334
|
-
}
|
|
2335
|
-
/**
|
|
2336
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.getPaths
|
|
2337
|
-
*/
|
|
2338
|
-
getPaths() {
|
|
2339
|
-
this._assertInitialized();
|
|
2340
|
-
return this.polygon.getPaths();
|
|
2341
|
-
}
|
|
2342
|
-
/**
|
|
2343
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polygon.getVisible
|
|
2344
|
-
*/
|
|
2345
|
-
getVisible() {
|
|
2346
|
-
this._assertInitialized();
|
|
2347
|
-
return this.polygon.getVisible();
|
|
2348
|
-
}
|
|
2349
|
-
_combineOptions() {
|
|
2350
|
-
return combineLatest([this._options, this._paths]).pipe(map(([options, paths]) => {
|
|
2351
|
-
const combinedOptions = Object.assign(Object.assign({}, options), { paths: paths || options.paths });
|
|
2352
|
-
return combinedOptions;
|
|
2353
|
-
}));
|
|
2354
|
-
}
|
|
2355
|
-
_watchForOptionsChanges() {
|
|
2356
|
-
this._options.pipe(takeUntil(this._destroyed)).subscribe(options => {
|
|
2357
|
-
this._assertInitialized();
|
|
2358
|
-
this.polygon.setOptions(options);
|
|
2359
|
-
});
|
|
2360
|
-
}
|
|
2361
|
-
_watchForPathChanges() {
|
|
2362
|
-
this._paths.pipe(takeUntil(this._destroyed)).subscribe(paths => {
|
|
2363
|
-
if (paths) {
|
|
2364
|
-
this._assertInitialized();
|
|
2365
|
-
this.polygon.setPaths(paths);
|
|
2366
|
-
}
|
|
2367
|
-
});
|
|
2368
|
-
}
|
|
2369
|
-
_assertInitialized() {
|
|
2370
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
2371
|
-
if (!this._map.googleMap) {
|
|
2372
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
2373
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
2374
|
-
}
|
|
2375
|
-
if (!this.polygon) {
|
|
2376
|
-
throw Error('Cannot interact with a Google Map Polygon before it has been ' +
|
|
2377
|
-
'initialized. Please wait for the Polygon to load before trying to interact with it.');
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
MapPolygon.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapPolygon, deps: [{ token: GoogleMap }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2383
|
-
MapPolygon.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapPolygon, selector: "map-polygon", inputs: { options: "options", paths: "paths" }, outputs: { polygonClick: "polygonClick", polygonDblclick: "polygonDblclick", polygonDrag: "polygonDrag", polygonDragend: "polygonDragend", polygonDragstart: "polygonDragstart", polygonMousedown: "polygonMousedown", polygonMousemove: "polygonMousemove", polygonMouseout: "polygonMouseout", polygonMouseover: "polygonMouseover", polygonMouseup: "polygonMouseup", polygonRightclick: "polygonRightclick" }, exportAs: ["mapPolygon"], ngImport: i0 });
|
|
2384
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapPolygon, decorators: [{
|
|
2385
|
-
type: Directive,
|
|
2386
|
-
args: [{
|
|
2387
|
-
selector: 'map-polygon',
|
|
2388
|
-
exportAs: 'mapPolygon',
|
|
2389
|
-
}]
|
|
2390
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.NgZone }]; }, propDecorators: { options: [{
|
|
2391
|
-
type: Input
|
|
2392
|
-
}], paths: [{
|
|
2393
|
-
type: Input
|
|
2394
|
-
}], polygonClick: [{
|
|
2395
|
-
type: Output
|
|
2396
|
-
}], polygonDblclick: [{
|
|
2397
|
-
type: Output
|
|
2398
|
-
}], polygonDrag: [{
|
|
2399
|
-
type: Output
|
|
2400
|
-
}], polygonDragend: [{
|
|
2401
|
-
type: Output
|
|
2402
|
-
}], polygonDragstart: [{
|
|
2403
|
-
type: Output
|
|
2404
|
-
}], polygonMousedown: [{
|
|
2405
|
-
type: Output
|
|
2406
|
-
}], polygonMousemove: [{
|
|
2407
|
-
type: Output
|
|
2408
|
-
}], polygonMouseout: [{
|
|
2409
|
-
type: Output
|
|
2410
|
-
}], polygonMouseover: [{
|
|
2411
|
-
type: Output
|
|
2412
|
-
}], polygonMouseup: [{
|
|
2413
|
-
type: Output
|
|
2414
|
-
}], polygonRightclick: [{
|
|
2415
|
-
type: Output
|
|
2416
|
-
}] } });
|
|
2417
|
-
|
|
2418
|
-
/// <reference types="google.maps" />
|
|
2419
|
-
/**
|
|
2420
|
-
* Angular component that renders a Google Maps Polyline via the Google Maps JavaScript API.
|
|
2421
|
-
*
|
|
2422
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline
|
|
2423
|
-
*/
|
|
2424
|
-
class MapPolyline {
|
|
2425
|
-
set options(options) {
|
|
2426
|
-
this._options.next(options || {});
|
|
2427
|
-
}
|
|
2428
|
-
set path(path) {
|
|
2429
|
-
this._path.next(path);
|
|
2430
|
-
}
|
|
2431
|
-
constructor(_map, _ngZone) {
|
|
2432
|
-
this._map = _map;
|
|
2433
|
-
this._ngZone = _ngZone;
|
|
2434
|
-
this._eventManager = new MapEventManager(inject(NgZone));
|
|
2435
|
-
this._options = new BehaviorSubject({});
|
|
2436
|
-
this._path = new BehaviorSubject(undefined);
|
|
2437
|
-
this._destroyed = new Subject();
|
|
2438
|
-
/**
|
|
2439
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.click
|
|
2440
|
-
*/
|
|
2441
|
-
this.polylineClick = this._eventManager.getLazyEmitter('click');
|
|
2442
|
-
/**
|
|
2443
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.dblclick
|
|
2444
|
-
*/
|
|
2445
|
-
this.polylineDblclick = this._eventManager.getLazyEmitter('dblclick');
|
|
2446
|
-
/**
|
|
2447
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.drag
|
|
2448
|
-
*/
|
|
2449
|
-
this.polylineDrag = this._eventManager.getLazyEmitter('drag');
|
|
2450
|
-
/**
|
|
2451
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.dragend
|
|
2452
|
-
*/
|
|
2453
|
-
this.polylineDragend = this._eventManager.getLazyEmitter('dragend');
|
|
2454
|
-
/**
|
|
2455
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.dragstart
|
|
2456
|
-
*/
|
|
2457
|
-
this.polylineDragstart = this._eventManager.getLazyEmitter('dragstart');
|
|
2458
|
-
/**
|
|
2459
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.mousedown
|
|
2460
|
-
*/
|
|
2461
|
-
this.polylineMousedown = this._eventManager.getLazyEmitter('mousedown');
|
|
2462
|
-
/**
|
|
2463
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.mousemove
|
|
2464
|
-
*/
|
|
2465
|
-
this.polylineMousemove = this._eventManager.getLazyEmitter('mousemove');
|
|
2466
|
-
/**
|
|
2467
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.mouseout
|
|
2468
|
-
*/
|
|
2469
|
-
this.polylineMouseout = this._eventManager.getLazyEmitter('mouseout');
|
|
2470
|
-
/**
|
|
2471
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.mouseover
|
|
2472
|
-
*/
|
|
2473
|
-
this.polylineMouseover = this._eventManager.getLazyEmitter('mouseover');
|
|
2474
|
-
/**
|
|
2475
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.mouseup
|
|
2476
|
-
*/
|
|
2477
|
-
this.polylineMouseup = this._eventManager.getLazyEmitter('mouseup');
|
|
2478
|
-
/**
|
|
2479
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.rightclick
|
|
2480
|
-
*/
|
|
2481
|
-
this.polylineRightclick = this._eventManager.getLazyEmitter('rightclick');
|
|
2482
|
-
}
|
|
2483
|
-
ngOnInit() {
|
|
2484
|
-
if (this._map._isBrowser) {
|
|
2485
|
-
this._combineOptions()
|
|
2486
|
-
.pipe(take(1))
|
|
2487
|
-
.subscribe(options => {
|
|
2488
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
2489
|
-
// We'll bring it back in inside the `MapEventManager` only for the events that the
|
|
2490
|
-
// user has subscribed to.
|
|
2491
|
-
this._ngZone.runOutsideAngular(() => (this.polyline = new google.maps.Polyline(options)));
|
|
2492
|
-
this._assertInitialized();
|
|
2493
|
-
this.polyline.setMap(this._map.googleMap);
|
|
2494
|
-
this._eventManager.setTarget(this.polyline);
|
|
2495
|
-
});
|
|
2496
|
-
this._watchForOptionsChanges();
|
|
2497
|
-
this._watchForPathChanges();
|
|
2498
|
-
}
|
|
2499
|
-
}
|
|
2500
|
-
ngOnDestroy() {
|
|
2501
|
-
this._eventManager.destroy();
|
|
2502
|
-
this._destroyed.next();
|
|
2503
|
-
this._destroyed.complete();
|
|
2504
|
-
if (this.polyline) {
|
|
2505
|
-
this.polyline.setMap(null);
|
|
2506
|
-
}
|
|
2507
|
-
}
|
|
2508
|
-
/**
|
|
2509
|
-
* See
|
|
2510
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.getDraggable
|
|
2511
|
-
*/
|
|
2512
|
-
getDraggable() {
|
|
2513
|
-
this._assertInitialized();
|
|
2514
|
-
return this.polyline.getDraggable();
|
|
2515
|
-
}
|
|
2516
|
-
/**
|
|
2517
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.getEditable
|
|
2518
|
-
*/
|
|
2519
|
-
getEditable() {
|
|
2520
|
-
this._assertInitialized();
|
|
2521
|
-
return this.polyline.getEditable();
|
|
2522
|
-
}
|
|
2523
|
-
/**
|
|
2524
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.getPath
|
|
2525
|
-
*/
|
|
2526
|
-
getPath() {
|
|
2527
|
-
this._assertInitialized();
|
|
2528
|
-
return this.polyline.getPath();
|
|
2529
|
-
}
|
|
2530
|
-
/**
|
|
2531
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Polyline.getVisible
|
|
2532
|
-
*/
|
|
2533
|
-
getVisible() {
|
|
2534
|
-
this._assertInitialized();
|
|
2535
|
-
return this.polyline.getVisible();
|
|
2536
|
-
}
|
|
2537
|
-
_combineOptions() {
|
|
2538
|
-
return combineLatest([this._options, this._path]).pipe(map(([options, path]) => {
|
|
2539
|
-
const combinedOptions = Object.assign(Object.assign({}, options), { path: path || options.path });
|
|
2540
|
-
return combinedOptions;
|
|
2541
|
-
}));
|
|
2542
|
-
}
|
|
2543
|
-
_watchForOptionsChanges() {
|
|
2544
|
-
this._options.pipe(takeUntil(this._destroyed)).subscribe(options => {
|
|
2545
|
-
this._assertInitialized();
|
|
2546
|
-
this.polyline.setOptions(options);
|
|
2547
|
-
});
|
|
2548
|
-
}
|
|
2549
|
-
_watchForPathChanges() {
|
|
2550
|
-
this._path.pipe(takeUntil(this._destroyed)).subscribe(path => {
|
|
2551
|
-
if (path) {
|
|
2552
|
-
this._assertInitialized();
|
|
2553
|
-
this.polyline.setPath(path);
|
|
2554
|
-
}
|
|
2555
|
-
});
|
|
2556
|
-
}
|
|
2557
|
-
_assertInitialized() {
|
|
2558
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
2559
|
-
if (!this._map.googleMap) {
|
|
2560
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
2561
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
2562
|
-
}
|
|
2563
|
-
if (!this.polyline) {
|
|
2564
|
-
throw Error('Cannot interact with a Google Map Polyline before it has been ' +
|
|
2565
|
-
'initialized. Please wait for the Polyline to load before trying to interact with it.');
|
|
2566
|
-
}
|
|
2567
|
-
}
|
|
2568
|
-
}
|
|
2569
|
-
}
|
|
2570
|
-
MapPolyline.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapPolyline, deps: [{ token: GoogleMap }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2571
|
-
MapPolyline.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapPolyline, selector: "map-polyline", inputs: { options: "options", path: "path" }, outputs: { polylineClick: "polylineClick", polylineDblclick: "polylineDblclick", polylineDrag: "polylineDrag", polylineDragend: "polylineDragend", polylineDragstart: "polylineDragstart", polylineMousedown: "polylineMousedown", polylineMousemove: "polylineMousemove", polylineMouseout: "polylineMouseout", polylineMouseover: "polylineMouseover", polylineMouseup: "polylineMouseup", polylineRightclick: "polylineRightclick" }, exportAs: ["mapPolyline"], ngImport: i0 });
|
|
2572
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapPolyline, decorators: [{
|
|
2573
|
-
type: Directive,
|
|
2574
|
-
args: [{
|
|
2575
|
-
selector: 'map-polyline',
|
|
2576
|
-
exportAs: 'mapPolyline',
|
|
2577
|
-
}]
|
|
2578
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.NgZone }]; }, propDecorators: { options: [{
|
|
2579
|
-
type: Input
|
|
2580
|
-
}], path: [{
|
|
2581
|
-
type: Input
|
|
2582
|
-
}], polylineClick: [{
|
|
2583
|
-
type: Output
|
|
2584
|
-
}], polylineDblclick: [{
|
|
2585
|
-
type: Output
|
|
2586
|
-
}], polylineDrag: [{
|
|
2587
|
-
type: Output
|
|
2588
|
-
}], polylineDragend: [{
|
|
2589
|
-
type: Output
|
|
2590
|
-
}], polylineDragstart: [{
|
|
2591
|
-
type: Output
|
|
2592
|
-
}], polylineMousedown: [{
|
|
2593
|
-
type: Output
|
|
2594
|
-
}], polylineMousemove: [{
|
|
2595
|
-
type: Output
|
|
2596
|
-
}], polylineMouseout: [{
|
|
2597
|
-
type: Output
|
|
2598
|
-
}], polylineMouseover: [{
|
|
2599
|
-
type: Output
|
|
2600
|
-
}], polylineMouseup: [{
|
|
2601
|
-
type: Output
|
|
2602
|
-
}], polylineRightclick: [{
|
|
2603
|
-
type: Output
|
|
2604
|
-
}] } });
|
|
2605
|
-
|
|
2606
|
-
/// <reference types="google.maps" />
|
|
2607
|
-
/**
|
|
2608
|
-
* Angular component that renders a Google Maps Rectangle via the Google Maps JavaScript API.
|
|
2609
|
-
*
|
|
2610
|
-
* See developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle
|
|
2611
|
-
*/
|
|
2612
|
-
class MapRectangle {
|
|
2613
|
-
set options(options) {
|
|
2614
|
-
this._options.next(options || {});
|
|
2615
|
-
}
|
|
2616
|
-
set bounds(bounds) {
|
|
2617
|
-
this._bounds.next(bounds);
|
|
2618
|
-
}
|
|
2619
|
-
constructor(_map, _ngZone) {
|
|
2620
|
-
this._map = _map;
|
|
2621
|
-
this._ngZone = _ngZone;
|
|
2622
|
-
this._eventManager = new MapEventManager(inject(NgZone));
|
|
2623
|
-
this._options = new BehaviorSubject({});
|
|
2624
|
-
this._bounds = new BehaviorSubject(undefined);
|
|
2625
|
-
this._destroyed = new Subject();
|
|
2626
|
-
/**
|
|
2627
|
-
* See
|
|
2628
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.boundsChanged
|
|
2629
|
-
*/ this.boundsChanged = this._eventManager.getLazyEmitter('bounds_changed');
|
|
2630
|
-
/**
|
|
2631
|
-
* See
|
|
2632
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.click
|
|
2633
|
-
*/
|
|
2634
|
-
this.rectangleClick = this._eventManager.getLazyEmitter('click');
|
|
2635
|
-
/**
|
|
2636
|
-
* See
|
|
2637
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.dblclick
|
|
2638
|
-
*/
|
|
2639
|
-
this.rectangleDblclick = this._eventManager.getLazyEmitter('dblclick');
|
|
2640
|
-
/**
|
|
2641
|
-
* See
|
|
2642
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.drag
|
|
2643
|
-
*/
|
|
2644
|
-
this.rectangleDrag = this._eventManager.getLazyEmitter('drag');
|
|
2645
|
-
/**
|
|
2646
|
-
* See
|
|
2647
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.dragend
|
|
2648
|
-
*/
|
|
2649
|
-
this.rectangleDragend = this._eventManager.getLazyEmitter('dragend');
|
|
2650
|
-
/**
|
|
2651
|
-
* See
|
|
2652
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.dragstart
|
|
2653
|
-
*/
|
|
2654
|
-
this.rectangleDragstart = this._eventManager.getLazyEmitter('dragstart');
|
|
2655
|
-
/**
|
|
2656
|
-
* See
|
|
2657
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.mousedown
|
|
2658
|
-
*/
|
|
2659
|
-
this.rectangleMousedown = this._eventManager.getLazyEmitter('mousedown');
|
|
2660
|
-
/**
|
|
2661
|
-
* See
|
|
2662
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.mousemove
|
|
2663
|
-
*/
|
|
2664
|
-
this.rectangleMousemove = this._eventManager.getLazyEmitter('mousemove');
|
|
2665
|
-
/**
|
|
2666
|
-
* See
|
|
2667
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.mouseout
|
|
2668
|
-
*/
|
|
2669
|
-
this.rectangleMouseout = this._eventManager.getLazyEmitter('mouseout');
|
|
2670
|
-
/**
|
|
2671
|
-
* See
|
|
2672
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.mouseover
|
|
2673
|
-
*/
|
|
2674
|
-
this.rectangleMouseover = this._eventManager.getLazyEmitter('mouseover');
|
|
2675
|
-
/**
|
|
2676
|
-
* See
|
|
2677
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.mouseup
|
|
2678
|
-
*/
|
|
2679
|
-
this.rectangleMouseup = this._eventManager.getLazyEmitter('mouseup');
|
|
2680
|
-
/**
|
|
2681
|
-
* See
|
|
2682
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.rightclick
|
|
2683
|
-
*/
|
|
2684
|
-
this.rectangleRightclick = this._eventManager.getLazyEmitter('rightclick');
|
|
2685
|
-
}
|
|
2686
|
-
ngOnInit() {
|
|
2687
|
-
if (this._map._isBrowser) {
|
|
2688
|
-
this._combineOptions()
|
|
2689
|
-
.pipe(take(1))
|
|
2690
|
-
.subscribe(options => {
|
|
2691
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
2692
|
-
// We'll bring it back in inside the `MapEventManager` only for the events that the
|
|
2693
|
-
// user has subscribed to.
|
|
2694
|
-
this._ngZone.runOutsideAngular(() => {
|
|
2695
|
-
this.rectangle = new google.maps.Rectangle(options);
|
|
2696
|
-
});
|
|
2697
|
-
this._assertInitialized();
|
|
2698
|
-
this.rectangle.setMap(this._map.googleMap);
|
|
2699
|
-
this._eventManager.setTarget(this.rectangle);
|
|
2700
|
-
});
|
|
2701
|
-
this._watchForOptionsChanges();
|
|
2702
|
-
this._watchForBoundsChanges();
|
|
2703
|
-
}
|
|
2704
|
-
}
|
|
2705
|
-
ngOnDestroy() {
|
|
2706
|
-
this._eventManager.destroy();
|
|
2707
|
-
this._destroyed.next();
|
|
2708
|
-
this._destroyed.complete();
|
|
2709
|
-
if (this.rectangle) {
|
|
2710
|
-
this.rectangle.setMap(null);
|
|
2711
|
-
}
|
|
2712
|
-
}
|
|
2713
|
-
/**
|
|
2714
|
-
* See
|
|
2715
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.getBounds
|
|
2716
|
-
*/
|
|
2717
|
-
getBounds() {
|
|
2718
|
-
this._assertInitialized();
|
|
2719
|
-
return this.rectangle.getBounds();
|
|
2720
|
-
}
|
|
2721
|
-
/**
|
|
2722
|
-
* See
|
|
2723
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.getDraggable
|
|
2724
|
-
*/
|
|
2725
|
-
getDraggable() {
|
|
2726
|
-
this._assertInitialized();
|
|
2727
|
-
return this.rectangle.getDraggable();
|
|
2728
|
-
}
|
|
2729
|
-
/**
|
|
2730
|
-
* See
|
|
2731
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.getEditable
|
|
2732
|
-
*/
|
|
2733
|
-
getEditable() {
|
|
2734
|
-
this._assertInitialized();
|
|
2735
|
-
return this.rectangle.getEditable();
|
|
2736
|
-
}
|
|
2737
|
-
/**
|
|
2738
|
-
* See
|
|
2739
|
-
* developers.google.com/maps/documentation/javascript/reference/polygon#Rectangle.getVisible
|
|
2740
|
-
*/
|
|
2741
|
-
getVisible() {
|
|
2742
|
-
this._assertInitialized();
|
|
2743
|
-
return this.rectangle.getVisible();
|
|
2744
|
-
}
|
|
2745
|
-
_combineOptions() {
|
|
2746
|
-
return combineLatest([this._options, this._bounds]).pipe(map(([options, bounds]) => {
|
|
2747
|
-
const combinedOptions = Object.assign(Object.assign({}, options), { bounds: bounds || options.bounds });
|
|
2748
|
-
return combinedOptions;
|
|
2749
|
-
}));
|
|
2750
|
-
}
|
|
2751
|
-
_watchForOptionsChanges() {
|
|
2752
|
-
this._options.pipe(takeUntil(this._destroyed)).subscribe(options => {
|
|
2753
|
-
this._assertInitialized();
|
|
2754
|
-
this.rectangle.setOptions(options);
|
|
2755
|
-
});
|
|
2756
|
-
}
|
|
2757
|
-
_watchForBoundsChanges() {
|
|
2758
|
-
this._bounds.pipe(takeUntil(this._destroyed)).subscribe(bounds => {
|
|
2759
|
-
if (bounds) {
|
|
2760
|
-
this._assertInitialized();
|
|
2761
|
-
this.rectangle.setBounds(bounds);
|
|
2762
|
-
}
|
|
2763
|
-
});
|
|
2764
|
-
}
|
|
2765
|
-
_assertInitialized() {
|
|
2766
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
2767
|
-
if (!this._map.googleMap) {
|
|
2768
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
2769
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
2770
|
-
}
|
|
2771
|
-
if (!this.rectangle) {
|
|
2772
|
-
throw Error('Cannot interact with a Google Map Rectangle before it has been initialized. ' +
|
|
2773
|
-
'Please wait for the Rectangle to load before trying to interact with it.');
|
|
2774
|
-
}
|
|
2775
|
-
}
|
|
2776
|
-
}
|
|
2777
|
-
}
|
|
2778
|
-
MapRectangle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapRectangle, deps: [{ token: GoogleMap }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2779
|
-
MapRectangle.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapRectangle, selector: "map-rectangle", inputs: { options: "options", bounds: "bounds" }, outputs: { boundsChanged: "boundsChanged", rectangleClick: "rectangleClick", rectangleDblclick: "rectangleDblclick", rectangleDrag: "rectangleDrag", rectangleDragend: "rectangleDragend", rectangleDragstart: "rectangleDragstart", rectangleMousedown: "rectangleMousedown", rectangleMousemove: "rectangleMousemove", rectangleMouseout: "rectangleMouseout", rectangleMouseover: "rectangleMouseover", rectangleMouseup: "rectangleMouseup", rectangleRightclick: "rectangleRightclick" }, exportAs: ["mapRectangle"], ngImport: i0 });
|
|
2780
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapRectangle, decorators: [{
|
|
2781
|
-
type: Directive,
|
|
2782
|
-
args: [{
|
|
2783
|
-
selector: 'map-rectangle',
|
|
2784
|
-
exportAs: 'mapRectangle',
|
|
2785
|
-
}]
|
|
2786
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.NgZone }]; }, propDecorators: { options: [{
|
|
2787
|
-
type: Input
|
|
2788
|
-
}], bounds: [{
|
|
2789
|
-
type: Input
|
|
2790
|
-
}], boundsChanged: [{
|
|
2791
|
-
type: Output
|
|
2792
|
-
}], rectangleClick: [{
|
|
2793
|
-
type: Output
|
|
2794
|
-
}], rectangleDblclick: [{
|
|
2795
|
-
type: Output
|
|
2796
|
-
}], rectangleDrag: [{
|
|
2797
|
-
type: Output
|
|
2798
|
-
}], rectangleDragend: [{
|
|
2799
|
-
type: Output
|
|
2800
|
-
}], rectangleDragstart: [{
|
|
2801
|
-
type: Output
|
|
2802
|
-
}], rectangleMousedown: [{
|
|
2803
|
-
type: Output
|
|
2804
|
-
}], rectangleMousemove: [{
|
|
2805
|
-
type: Output
|
|
2806
|
-
}], rectangleMouseout: [{
|
|
2807
|
-
type: Output
|
|
2808
|
-
}], rectangleMouseover: [{
|
|
2809
|
-
type: Output
|
|
2810
|
-
}], rectangleMouseup: [{
|
|
2811
|
-
type: Output
|
|
2812
|
-
}], rectangleRightclick: [{
|
|
2813
|
-
type: Output
|
|
2814
|
-
}] } });
|
|
2815
|
-
|
|
2816
|
-
/// <reference types="google.maps" />
|
|
2817
|
-
/**
|
|
2818
|
-
* Angular component that renders a Google Maps Traffic Layer via the Google Maps JavaScript API.
|
|
2819
|
-
*
|
|
2820
|
-
* See developers.google.com/maps/documentation/javascript/reference/map#TrafficLayer
|
|
2821
|
-
*/
|
|
2822
|
-
class MapTrafficLayer {
|
|
2823
|
-
/**
|
|
2824
|
-
* Whether the traffic layer refreshes with updated information automatically.
|
|
2825
|
-
*/
|
|
2826
|
-
set autoRefresh(autoRefresh) {
|
|
2827
|
-
this._autoRefresh.next(autoRefresh);
|
|
2828
|
-
}
|
|
2829
|
-
constructor(_map, _ngZone) {
|
|
2830
|
-
this._map = _map;
|
|
2831
|
-
this._ngZone = _ngZone;
|
|
2832
|
-
this._autoRefresh = new BehaviorSubject(true);
|
|
2833
|
-
this._destroyed = new Subject();
|
|
2834
|
-
}
|
|
2835
|
-
ngOnInit() {
|
|
2836
|
-
if (this._map._isBrowser) {
|
|
2837
|
-
this._combineOptions()
|
|
2838
|
-
.pipe(take(1))
|
|
2839
|
-
.subscribe(options => {
|
|
2840
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
2841
|
-
this._ngZone.runOutsideAngular(() => {
|
|
2842
|
-
this.trafficLayer = new google.maps.TrafficLayer(options);
|
|
2843
|
-
});
|
|
2844
|
-
this._assertInitialized();
|
|
2845
|
-
this.trafficLayer.setMap(this._map.googleMap);
|
|
2846
|
-
});
|
|
2847
|
-
this._watchForAutoRefreshChanges();
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
ngOnDestroy() {
|
|
2851
|
-
this._destroyed.next();
|
|
2852
|
-
this._destroyed.complete();
|
|
2853
|
-
if (this.trafficLayer) {
|
|
2854
|
-
this.trafficLayer.setMap(null);
|
|
2855
|
-
}
|
|
2856
|
-
}
|
|
2857
|
-
_combineOptions() {
|
|
2858
|
-
return this._autoRefresh.pipe(map(autoRefresh => {
|
|
2859
|
-
const combinedOptions = { autoRefresh };
|
|
2860
|
-
return combinedOptions;
|
|
2861
|
-
}));
|
|
2862
|
-
}
|
|
2863
|
-
_watchForAutoRefreshChanges() {
|
|
2864
|
-
this._combineOptions()
|
|
2865
|
-
.pipe(takeUntil(this._destroyed))
|
|
2866
|
-
.subscribe(options => {
|
|
2867
|
-
this._assertInitialized();
|
|
2868
|
-
this.trafficLayer.setOptions(options);
|
|
2869
|
-
});
|
|
2870
|
-
}
|
|
2871
|
-
_assertInitialized() {
|
|
2872
|
-
if (!this._map.googleMap) {
|
|
2873
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
2874
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
2875
|
-
}
|
|
2876
|
-
if (!this.trafficLayer) {
|
|
2877
|
-
throw Error('Cannot interact with a Google Map Traffic Layer before it has been initialized. ' +
|
|
2878
|
-
'Please wait for the Traffic Layer to load before trying to interact with it.');
|
|
2879
|
-
}
|
|
2880
|
-
}
|
|
2881
|
-
}
|
|
2882
|
-
MapTrafficLayer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapTrafficLayer, deps: [{ token: GoogleMap }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2883
|
-
MapTrafficLayer.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapTrafficLayer, selector: "map-traffic-layer", inputs: { autoRefresh: "autoRefresh" }, exportAs: ["mapTrafficLayer"], ngImport: i0 });
|
|
2884
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapTrafficLayer, decorators: [{
|
|
2885
|
-
type: Directive,
|
|
2886
|
-
args: [{
|
|
2887
|
-
selector: 'map-traffic-layer',
|
|
2888
|
-
exportAs: 'mapTrafficLayer',
|
|
2889
|
-
}]
|
|
2890
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.NgZone }]; }, propDecorators: { autoRefresh: [{
|
|
2891
|
-
type: Input
|
|
2892
|
-
}] } });
|
|
2893
|
-
|
|
2894
|
-
/// <reference types="google.maps" />
|
|
2895
|
-
/**
|
|
2896
|
-
* Angular component that renders a Google Maps Transit Layer via the Google Maps JavaScript API.
|
|
2897
|
-
*
|
|
2898
|
-
* See developers.google.com/maps/documentation/javascript/reference/map#TransitLayer
|
|
2899
|
-
*/
|
|
2900
|
-
class MapTransitLayer extends MapBaseLayer {
|
|
2901
|
-
_initializeObject() {
|
|
2902
|
-
this.transitLayer = new google.maps.TransitLayer();
|
|
2903
|
-
}
|
|
2904
|
-
_setMap() {
|
|
2905
|
-
this._assertLayerInitialized();
|
|
2906
|
-
this.transitLayer.setMap(this._map.googleMap);
|
|
2907
|
-
}
|
|
2908
|
-
_unsetMap() {
|
|
2909
|
-
if (this.transitLayer) {
|
|
2910
|
-
this.transitLayer.setMap(null);
|
|
2911
|
-
}
|
|
2912
|
-
}
|
|
2913
|
-
_assertLayerInitialized() {
|
|
2914
|
-
if (!this.transitLayer) {
|
|
2915
|
-
throw Error('Cannot interact with a Google Map Transit Layer before it has been initialized. ' +
|
|
2916
|
-
'Please wait for the Transit Layer to load before trying to interact with it.');
|
|
2917
|
-
}
|
|
2918
|
-
}
|
|
2919
|
-
}
|
|
2920
|
-
MapTransitLayer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapTransitLayer, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
2921
|
-
MapTransitLayer.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapTransitLayer, selector: "map-transit-layer", exportAs: ["mapTransitLayer"], usesInheritance: true, ngImport: i0 });
|
|
2922
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapTransitLayer, decorators: [{
|
|
2923
|
-
type: Directive,
|
|
2924
|
-
args: [{
|
|
2925
|
-
selector: 'map-transit-layer',
|
|
2926
|
-
exportAs: 'mapTransitLayer',
|
|
2927
|
-
}]
|
|
2928
|
-
}] });
|
|
2929
|
-
|
|
2930
|
-
/// <reference types="google.maps" />
|
|
2931
|
-
/**
|
|
2932
|
-
* Angular directive that renders a Google Maps heatmap via the Google Maps JavaScript API.
|
|
2933
|
-
*
|
|
2934
|
-
* See: https://developers.google.com/maps/documentation/javascript/reference/visualization
|
|
2935
|
-
*/
|
|
2936
|
-
class MapHeatmapLayer {
|
|
2937
|
-
/**
|
|
2938
|
-
* Data shown on the heatmap.
|
|
2939
|
-
* See: https://developers.google.com/maps/documentation/javascript/reference/visualization
|
|
2940
|
-
*/
|
|
2941
|
-
set data(data) {
|
|
2942
|
-
this._data = data;
|
|
2943
|
-
}
|
|
2944
|
-
/**
|
|
2945
|
-
* Options used to configure the heatmap. See:
|
|
2946
|
-
* developers.google.com/maps/documentation/javascript/reference/visualization#HeatmapLayerOptions
|
|
2947
|
-
*/
|
|
2948
|
-
set options(options) {
|
|
2949
|
-
this._options = options;
|
|
2950
|
-
}
|
|
2951
|
-
constructor(_googleMap, _ngZone) {
|
|
2952
|
-
this._googleMap = _googleMap;
|
|
2953
|
-
this._ngZone = _ngZone;
|
|
2954
|
-
}
|
|
2955
|
-
ngOnInit() {
|
|
2956
|
-
var _a, _b;
|
|
2957
|
-
if (this._googleMap._isBrowser) {
|
|
2958
|
-
if (!((_b = (_a = window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.visualization) && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
2959
|
-
throw Error('Namespace `google.maps.visualization` not found, cannot construct heatmap. ' +
|
|
2960
|
-
'Please install the Google Maps JavaScript API with the "visualization" library: ' +
|
|
2961
|
-
'https://developers.google.com/maps/documentation/javascript/visualization');
|
|
2962
|
-
}
|
|
2963
|
-
// Create the object outside the zone so its events don't trigger change detection.
|
|
2964
|
-
// We'll bring it back in inside the `MapEventManager` only for the events that the
|
|
2965
|
-
// user has subscribed to.
|
|
2966
|
-
this._ngZone.runOutsideAngular(() => {
|
|
2967
|
-
this.heatmap = new google.maps.visualization.HeatmapLayer(this._combineOptions());
|
|
2968
|
-
});
|
|
2969
|
-
this._assertInitialized();
|
|
2970
|
-
this.heatmap.setMap(this._googleMap.googleMap);
|
|
2971
|
-
}
|
|
2972
|
-
}
|
|
2973
|
-
ngOnChanges(changes) {
|
|
2974
|
-
const { _data, heatmap } = this;
|
|
2975
|
-
if (heatmap) {
|
|
2976
|
-
if (changes['options']) {
|
|
2977
|
-
heatmap.setOptions(this._combineOptions());
|
|
2978
|
-
}
|
|
2979
|
-
if (changes['data'] && _data !== undefined) {
|
|
2980
|
-
heatmap.setData(this._normalizeData(_data));
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2983
|
-
}
|
|
2984
|
-
ngOnDestroy() {
|
|
2985
|
-
if (this.heatmap) {
|
|
2986
|
-
this.heatmap.setMap(null);
|
|
2987
|
-
}
|
|
2988
|
-
}
|
|
2989
|
-
/**
|
|
2990
|
-
* Gets the data that is currently shown on the heatmap.
|
|
2991
|
-
* See: developers.google.com/maps/documentation/javascript/reference/visualization#HeatmapLayer
|
|
2992
|
-
*/
|
|
2993
|
-
getData() {
|
|
2994
|
-
this._assertInitialized();
|
|
2995
|
-
return this.heatmap.getData();
|
|
2996
|
-
}
|
|
2997
|
-
/** Creates a combined options object using the passed-in options and the individual inputs. */
|
|
2998
|
-
_combineOptions() {
|
|
2999
|
-
const options = this._options || {};
|
|
3000
|
-
return Object.assign(Object.assign({}, options), { data: this._normalizeData(this._data || options.data || []), map: this._googleMap.googleMap });
|
|
3001
|
-
}
|
|
3002
|
-
/**
|
|
3003
|
-
* Most Google Maps APIs support both `LatLng` objects and `LatLngLiteral`. The latter is more
|
|
3004
|
-
* convenient to write out, because the Google Maps API doesn't have to have been loaded in order
|
|
3005
|
-
* to construct them. The `HeatmapLayer` appears to be an exception that only allows a `LatLng`
|
|
3006
|
-
* object, or it throws a runtime error. Since it's more convenient and we expect that Angular
|
|
3007
|
-
* users will load the API asynchronously, we allow them to pass in a `LatLngLiteral` and we
|
|
3008
|
-
* convert it to a `LatLng` object before passing it off to Google Maps.
|
|
3009
|
-
*/
|
|
3010
|
-
_normalizeData(data) {
|
|
3011
|
-
const result = [];
|
|
3012
|
-
data.forEach(item => {
|
|
3013
|
-
result.push(isLatLngLiteral(item) ? new google.maps.LatLng(item.lat, item.lng) : item);
|
|
3014
|
-
});
|
|
3015
|
-
return result;
|
|
3016
|
-
}
|
|
3017
|
-
/** Asserts that the heatmap object has been initialized. */
|
|
3018
|
-
_assertInitialized() {
|
|
3019
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
3020
|
-
if (!this._googleMap.googleMap) {
|
|
3021
|
-
throw Error('Cannot access Google Map information before the API has been initialized. ' +
|
|
3022
|
-
'Please wait for the API to load before trying to interact with it.');
|
|
3023
|
-
}
|
|
3024
|
-
if (!this.heatmap) {
|
|
3025
|
-
throw Error('Cannot interact with a Google Map HeatmapLayer before it has been ' +
|
|
3026
|
-
'initialized. Please wait for the heatmap to load before trying to interact with it.');
|
|
3027
|
-
}
|
|
3028
|
-
}
|
|
3029
|
-
}
|
|
3030
|
-
}
|
|
3031
|
-
MapHeatmapLayer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapHeatmapLayer, deps: [{ token: GoogleMap }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3032
|
-
MapHeatmapLayer.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0-next.7", type: MapHeatmapLayer, selector: "map-heatmap-layer", inputs: { data: "data", options: "options" }, exportAs: ["mapHeatmapLayer"], usesOnChanges: true, ngImport: i0 });
|
|
3033
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapHeatmapLayer, decorators: [{
|
|
3034
|
-
type: Directive,
|
|
3035
|
-
args: [{
|
|
3036
|
-
selector: 'map-heatmap-layer',
|
|
3037
|
-
exportAs: 'mapHeatmapLayer',
|
|
3038
|
-
}]
|
|
3039
|
-
}], ctorParameters: function () { return [{ type: GoogleMap }, { type: i0.NgZone }]; }, propDecorators: { data: [{
|
|
3040
|
-
type: Input
|
|
3041
|
-
}], options: [{
|
|
3042
|
-
type: Input
|
|
3043
|
-
}] } });
|
|
3044
|
-
/** Asserts that an object is a `LatLngLiteral`. */
|
|
3045
|
-
function isLatLngLiteral(value) {
|
|
3046
|
-
return value && typeof value.lat === 'number' && typeof value.lng === 'number';
|
|
3047
|
-
}
|
|
3048
|
-
|
|
3049
|
-
const COMPONENTS = [
|
|
3050
|
-
GoogleMap,
|
|
3051
|
-
MapBaseLayer,
|
|
3052
|
-
MapBicyclingLayer,
|
|
3053
|
-
MapCircle,
|
|
3054
|
-
MapDirectionsRenderer,
|
|
3055
|
-
MapGroundOverlay,
|
|
3056
|
-
MapInfoWindow,
|
|
3057
|
-
MapKmlLayer,
|
|
3058
|
-
MapMarker,
|
|
3059
|
-
MapMarkerClusterer,
|
|
3060
|
-
MapPolygon,
|
|
3061
|
-
MapPolyline,
|
|
3062
|
-
MapRectangle,
|
|
3063
|
-
MapTrafficLayer,
|
|
3064
|
-
MapTransitLayer,
|
|
3065
|
-
MapHeatmapLayer,
|
|
3066
|
-
];
|
|
3067
|
-
class GoogleMapsModule {
|
|
3068
|
-
}
|
|
3069
|
-
GoogleMapsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: GoogleMapsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3070
|
-
GoogleMapsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.7", ngImport: i0, type: GoogleMapsModule, declarations: [GoogleMap,
|
|
3071
|
-
MapBaseLayer,
|
|
3072
|
-
MapBicyclingLayer,
|
|
3073
|
-
MapCircle,
|
|
3074
|
-
MapDirectionsRenderer,
|
|
3075
|
-
MapGroundOverlay,
|
|
3076
|
-
MapInfoWindow,
|
|
3077
|
-
MapKmlLayer,
|
|
3078
|
-
MapMarker,
|
|
3079
|
-
MapMarkerClusterer,
|
|
3080
|
-
MapPolygon,
|
|
3081
|
-
MapPolyline,
|
|
3082
|
-
MapRectangle,
|
|
3083
|
-
MapTrafficLayer,
|
|
3084
|
-
MapTransitLayer,
|
|
3085
|
-
MapHeatmapLayer], exports: [GoogleMap,
|
|
3086
|
-
MapBaseLayer,
|
|
3087
|
-
MapBicyclingLayer,
|
|
3088
|
-
MapCircle,
|
|
3089
|
-
MapDirectionsRenderer,
|
|
3090
|
-
MapGroundOverlay,
|
|
3091
|
-
MapInfoWindow,
|
|
3092
|
-
MapKmlLayer,
|
|
3093
|
-
MapMarker,
|
|
3094
|
-
MapMarkerClusterer,
|
|
3095
|
-
MapPolygon,
|
|
3096
|
-
MapPolyline,
|
|
3097
|
-
MapRectangle,
|
|
3098
|
-
MapTrafficLayer,
|
|
3099
|
-
MapTransitLayer,
|
|
3100
|
-
MapHeatmapLayer] });
|
|
3101
|
-
GoogleMapsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: GoogleMapsModule });
|
|
3102
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: GoogleMapsModule, decorators: [{
|
|
3103
|
-
type: NgModule,
|
|
3104
|
-
args: [{
|
|
3105
|
-
declarations: COMPONENTS,
|
|
3106
|
-
exports: COMPONENTS,
|
|
3107
|
-
}]
|
|
3108
|
-
}] });
|
|
3109
|
-
|
|
3110
|
-
/// <reference types="google.maps" />
|
|
3111
|
-
/**
|
|
3112
|
-
* Angular service that wraps the Google Maps DirectionsService from the Google Maps JavaScript
|
|
3113
|
-
* API.
|
|
3114
|
-
*
|
|
3115
|
-
* See developers.google.com/maps/documentation/javascript/reference/directions#DirectionsService
|
|
3116
|
-
*/
|
|
3117
|
-
class MapDirectionsService {
|
|
3118
|
-
constructor(_ngZone) {
|
|
3119
|
-
this._ngZone = _ngZone;
|
|
3120
|
-
}
|
|
3121
|
-
/**
|
|
3122
|
-
* See
|
|
3123
|
-
* developers.google.com/maps/documentation/javascript/reference/directions
|
|
3124
|
-
* #DirectionsService.route
|
|
3125
|
-
*/
|
|
3126
|
-
route(request) {
|
|
3127
|
-
return new Observable(observer => {
|
|
3128
|
-
// Initialize the `DirectionsService` lazily since the Google Maps API may
|
|
3129
|
-
// not have been loaded when the provider is instantiated.
|
|
3130
|
-
if (!this._directionsService) {
|
|
3131
|
-
this._directionsService = new google.maps.DirectionsService();
|
|
3132
|
-
}
|
|
3133
|
-
this._directionsService.route(request, (result, status) => {
|
|
3134
|
-
this._ngZone.run(() => {
|
|
3135
|
-
observer.next({ result: result || undefined, status });
|
|
3136
|
-
observer.complete();
|
|
3137
|
-
});
|
|
3138
|
-
});
|
|
3139
|
-
});
|
|
3140
|
-
}
|
|
3141
|
-
}
|
|
3142
|
-
MapDirectionsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapDirectionsService, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3143
|
-
MapDirectionsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapDirectionsService, providedIn: 'root' });
|
|
3144
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapDirectionsService, decorators: [{
|
|
3145
|
-
type: Injectable,
|
|
3146
|
-
args: [{ providedIn: 'root' }]
|
|
3147
|
-
}], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
|
|
3148
|
-
|
|
3149
|
-
/// <reference types="google.maps" />
|
|
3150
|
-
/**
|
|
3151
|
-
* Angular service that wraps the Google Maps Geocoder from the Google Maps JavaScript API.
|
|
3152
|
-
* See developers.google.com/maps/documentation/javascript/reference/geocoder#Geocoder
|
|
3153
|
-
*/
|
|
3154
|
-
class MapGeocoder {
|
|
3155
|
-
constructor(_ngZone) {
|
|
3156
|
-
this._ngZone = _ngZone;
|
|
3157
|
-
}
|
|
3158
|
-
/**
|
|
3159
|
-
* See developers.google.com/maps/documentation/javascript/reference/geocoder#Geocoder.geocode
|
|
3160
|
-
*/
|
|
3161
|
-
geocode(request) {
|
|
3162
|
-
return new Observable(observer => {
|
|
3163
|
-
// Initialize the `Geocoder` lazily since the Google Maps API may
|
|
3164
|
-
// not have been loaded when the provider is instantiated.
|
|
3165
|
-
if (!this._geocoder) {
|
|
3166
|
-
this._geocoder = new google.maps.Geocoder();
|
|
3167
|
-
}
|
|
3168
|
-
this._geocoder.geocode(request, (results, status) => {
|
|
3169
|
-
this._ngZone.run(() => {
|
|
3170
|
-
observer.next({ results: results || [], status });
|
|
3171
|
-
observer.complete();
|
|
3172
|
-
});
|
|
3173
|
-
});
|
|
3174
|
-
});
|
|
3175
|
-
}
|
|
3176
|
-
}
|
|
3177
|
-
MapGeocoder.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapGeocoder, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3178
|
-
MapGeocoder.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapGeocoder, providedIn: 'root' });
|
|
3179
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.7", ngImport: i0, type: MapGeocoder, decorators: [{
|
|
3180
|
-
type: Injectable,
|
|
3181
|
-
args: [{ providedIn: 'root' }]
|
|
3182
|
-
}], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
|
|
3183
|
-
|
|
3184
|
-
/**
|
|
3185
|
-
* Generated bundle index. Do not edit.
|
|
3186
|
-
*/
|
|
3187
|
-
|
|
3188
|
-
export { GoogleMap, GoogleMapsModule, MapBaseLayer, MapBicyclingLayer, MapCircle, MapDirectionsRenderer, MapDirectionsService, MapEventManager, MapGeocoder, MapGroundOverlay, MapHeatmapLayer, MapInfoWindow, MapKmlLayer, MapMarker, MapMarkerClusterer, MapPolygon, MapPolyline, MapRectangle, MapTrafficLayer, MapTransitLayer };
|
|
3189
|
-
//# sourceMappingURL=google-maps.mjs.map
|