1 line
388 KiB
JSON
1 line
388 KiB
JSON
|
{"ast":null,"code":"import { __awaiter } from 'tslib';\nimport { Injectable, NgZone, ɵɵdefineInjectable, ɵɵinject, InjectionToken, Optional, Inject, LOCALE_ID, Directive, Input, EventEmitter, Output, Self, Component, ElementRef, PLATFORM_ID, ContentChildren, QueryList, forwardRef, NgModule } from '@angular/core';\nimport { Observable, BehaviorSubject, from, timer, ReplaySubject, bindCallback, of, throwError, fromEventPattern, merge, Subject } from 'rxjs';\nimport { flatMap, sample, switchMap, map, shareReplay, multicast, startWith, skip, distinctUntilChanged, takeUntil } from 'rxjs/operators';\nimport { isPlatformServer } from '@angular/common';\nclass MapsAPILoader {}\nMapsAPILoader.decorators = [{\n type: Injectable\n}];\n\n/**\n * Wrapper class that handles the communication with the Google Maps Javascript\n * API v3\n */\nclass GoogleMapsAPIWrapper {\n constructor(_loader, _zone) {\n this._loader = _loader;\n this._zone = _zone;\n this._map = new Promise(resolve => {\n this._mapResolver = resolve;\n });\n }\n createMap(el, mapOptions) {\n return this._zone.runOutsideAngular(() => {\n return this._loader.load().then(() => {\n const map = new google.maps.Map(el, mapOptions);\n this._mapResolver(map);\n return;\n });\n });\n }\n setMapOptions(options) {\n return this._zone.runOutsideAngular(() => {\n this._map.then(m => {\n m.setOptions(options);\n });\n });\n }\n /**\n * Creates a google map marker with the map context\n */\n createMarker(options = {}, addToMap = true) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => {\n if (addToMap) {\n options.map = map;\n }\n return new google.maps.Marker(options);\n });\n });\n }\n createInfoWindow(options) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(() => new google.maps.InfoWindow(options));\n });\n }\n /**\n * Creates a google.map.Circle for the current map.\n */\n createCircle(options) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => {\n options.map = map;\n return new google.maps.Circle(options);\n });\n });\n }\n /**\n * Creates a google.map.Rectangle for the current map.\n */\n createRectangle(options) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => {\n options.map = map;\n return new google.maps.Rectangle(options);\n });\n });\n }\n createPolyline(options) {\n return this._zone.runOutsideAngular(() => {\n return this.getNativeMap().then(map => {\n const line = new google.maps.Polyline(options);\n line.setMap(map);\n return line;\n });\n });\n }\n createPolygon(options) {\n return this._zone.runOutsideAngular(() => {\n return this.getNativeMap().then(map => {\n const polygon = new google.maps.Polygon(options);\n polygon.setMap(map);\n return polygon;\n });\n });\n }\n /**\n * Creates a new google.map.Data layer for the current map\n */\n createDataLayer(options) {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(m => {\n const data = new google.maps.Data(options);\n data.setMap(m);\n return data;\n });\n });\n }\n /**\n * Creates a TransitLayer instance for a map\n * @returns a new transit layer object\n */\n createTransitLayer() {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => {\n const newLayer = new google.maps.TransitLayer();\n newLayer.setMap(map);\n return newLayer;\n });\n });\n }\n /**\n * Creates a BicyclingLayer instance for a map\n * @returns a new bicycling layer object\n */\n createBicyclingLayer() {\n return this._zone.runOutsideAngular(() => {\n return this._map.then(map => {\n const newLayer = new google.maps.BicyclingLayer();\n newLayer.setMap(map);\n return newLay
|