UNPKG

ngx-amap

Version:

[![npm](https://img.shields.io/npm/v/ngx-amap.svg)][npm-badge-url] [![npm](https://img.shields.io/npm/dm/ngx-amap.svg)][npm-badge-url] [![Build Status](https://travis-ci.org/xieziyu/ngx-amap.svg?branch=master)][ci-url]

1,819 lines (1,801 loc) 289 kB
import { InjectionToken, Injectable, Inject, NgZone, EventEmitter, Component, ElementRef, Input, Output, ɵɵdefineInjectable, ɵɵinject, QueryList, Directive, ContentChildren, NgModule } from '@angular/core'; import { __spread, __read, __extends } from 'tslib'; import { ReplaySubject, Observable, of, EMPTY, zip, combineLatest } from 'rxjs'; import { map, switchMap, switchMapTo } from 'rxjs/operators'; /** * @fileoverview added by tsickle * Generated from: shared/ngx-amap-config.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function NgxAmapConfig() { } if (false) { /** @type {?|undefined} */ NgxAmapConfig.prototype.apiKey; /** @type {?|undefined} */ NgxAmapConfig.prototype.apiVersion; /** @type {?|undefined} */ NgxAmapConfig.prototype.uiVersion; /** @type {?|undefined} */ NgxAmapConfig.prototype.protocol; /** @type {?|undefined} */ NgxAmapConfig.prototype.debug; /** @type {?|undefined} */ NgxAmapConfig.prototype.debugTags; } /** @type {?} */ var NGX_AMAP_CONFIG = new InjectionToken('NGX_AMAP_CONFIG'); /** * @fileoverview added by tsickle * Generated from: shared/logger/logger.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var LoggerService = /** @class */ (function () { function LoggerService() { } /** * @param {...?} args * @return {?} */ LoggerService.prototype.i = /** * @param {...?} args * @return {?} */ function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } console.log.apply(console, __spread(args)); }; /** * @param {...?} args * @return {?} */ LoggerService.prototype.e = /** * @param {...?} args * @return {?} */ function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } console.error.apply(console, __spread(args)); }; /** * @param {...?} args * @return {?} */ LoggerService.prototype.w = /** * @param {...?} args * @return {?} */ function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } console.warn.apply(console, __spread(args)); }; /** * @param {...?} args * @return {?} */ LoggerService.prototype.d = /** * @param {...?} args * @return {?} */ function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } // only stub; }; LoggerService.decorators = [ { type: Injectable } ]; /** @nocollapse */ LoggerService.ctorParameters = function () { return []; }; return LoggerService; }()); /** * @fileoverview added by tsickle * Generated from: shared/logger/debug-logger.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var DebugLoggerService = /** @class */ (function () { function DebugLoggerService(config) { if (config === void 0) { config = {}; } this.config = config; this.debugTags = []; this.debugAll = true; if (config.debugTags) { if (config.debugTags === '*') { this.debugAll = true; } else { this.debugAll = false; this.debugTags = config.debugTags.split(','); } } } /** * @param {...?} args * @return {?} */ DebugLoggerService.prototype.i = /** * @param {...?} args * @return {?} */ function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } console.log.apply(console, __spread(args)); }; /** * @param {...?} args * @return {?} */ DebugLoggerService.prototype.e = /** * @param {...?} args * @return {?} */ function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } console.error.apply(console, __spread(args)); }; /** * @param {...?} args * @return {?} */ DebugLoggerService.prototype.w = /** * @param {...?} args * @return {?} */ function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } console.warn.apply(console, __spread(args)); }; /** * @param {?} tag * @param {...?} args * @return {?} */ DebugLoggerService.prototype.d = /** * @param {?} tag * @param {...?} args * @return {?} */ function (tag) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } if (this.debugAll || this.debugTags.includes(tag)) { console.log.apply(console, __spread(["[" + tag + "]"], args)); } }; DebugLoggerService.decorators = [ { type: Injectable } ]; /** @nocollapse */ DebugLoggerService.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: Inject, args: [NGX_AMAP_CONFIG,] }] } ]; }; return DebugLoggerService; }()); if (false) { /** @type {?} */ DebugLoggerService.prototype.debugTags; /** @type {?} */ DebugLoggerService.prototype.debugAll; /** * @type {?} * @private */ DebugLoggerService.prototype.config; } /** * @fileoverview added by tsickle * Generated from: shared/amap-loader.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var TAG = 'AMapLoader'; var AMapLoaderService = /** @class */ (function () { function AMapLoaderService(config, logger) { if (config === void 0) { config = {}; } this.config = config; this.logger = logger; this.defaultProtocol = 'https'; this.defaultVersion = '1.4.15'; this.defaultUIVersion = '1.0.11'; this.config = config || {}; } /** * @return {?} */ AMapLoaderService.prototype.load = /** * @return {?} */ function () { var _this = this; if (this.loading$) { return this.loading$.asObservable(); } this.logger.d(TAG, 'loading AMap API ...'); this.loading$ = new ReplaySubject(); /** @type {?} */ var callbackName = '_NgxAmapAPILoader'; /** @type {?} */ var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.defer = true; script.src = this.getSrcFromConfig(callbackName); script.onerror = (/** * @param {?} err * @return {?} */ function (err) { _this.logger.e('failed to load AMap API.'); _this.loading$.error(err); }); window[callbackName] = (/** * @return {?} */ function () { _this.logger.d(TAG, 'loading AMap API COMPLETE'); _this.loading$.next(); _this.loading$.complete(); }); document.body.appendChild(script); return this.loading$.asObservable(); }; /** * @return {?} */ AMapLoaderService.prototype.loadUI = /** * @return {?} */ function () { var _this = this; if (this.uiLoading$) { return this.uiLoading$.asObservable(); } this.logger.d(TAG, 'loading AMap UI ...'); this.uiLoading$ = new ReplaySubject(); /** @type {?} */ var uiScript = document.createElement('script'); uiScript.type = 'text/javascript'; uiScript.async = true; uiScript.defer = true; uiScript.src = this.getUISrcFromConfig(); uiScript.onerror = (/** * @param {?} err * @return {?} */ function (err) { _this.logger.e('failed to load AMap API.'); }); uiScript.onload = (/** * @return {?} */ function () { // tslint:disable-next-line: no-string-literal window['initAMapUI'](); _this.logger.d(TAG, 'loading AMap UI COMPLETE'); _this.uiLoading$.next(); _this.uiLoading$.complete(); }); document.body.appendChild(uiScript); return this.uiLoading$.asObservable(); }; /** * @private * @param {?} callbackName * @return {?} */ AMapLoaderService.prototype.getSrcFromConfig = /** * @private * @param {?} callbackName * @return {?} */ function (callbackName) { /** @type {?} */ var urlBase = (this.config.protocol || this.defaultProtocol) + "://webapi.amap.com/maps"; /** @type {?} */ var queryParams = { v: this.config.apiVersion || this.defaultVersion, callback: callbackName, key: this.config.apiKey, }; /** @type {?} */ var params = Object.keys(queryParams) .filter((/** * @param {?} k * @return {?} */ function (k) { return queryParams[k] != null; })) .filter((/** * @param {?} k * @return {?} */ function (k) { // remove empty arrays return (!Array.isArray(queryParams[k]) || (Array.isArray(queryParams[k]) && queryParams[k].length > 0)); })) .map((/** * @param {?} k * @return {?} */ function (k) { // join arrays as comma seperated strings /** @type {?} */ var i = queryParams[k]; if (Array.isArray(i)) { return { key: k, value: i.join(',') }; } return { key: k, value: queryParams[k] }; })) .map((/** * @param {?} entry * @return {?} */ function (entry) { return entry.key + "=" + entry.value; })) .join('&'); return urlBase + "?" + params; }; /** * @private * @return {?} */ AMapLoaderService.prototype.getUISrcFromConfig = /** * @private * @return {?} */ function () { // tslint:disable-next-line: max-line-length /** @type {?} */ var urlBase = (this.config.protocol || this.defaultProtocol) + "://webapi.amap.com/ui/1.0/main-async.js?v=" + (this.config.uiVersion || this.defaultUIVersion); return urlBase; }; AMapLoaderService.decorators = [ { type: Injectable } ]; /** @nocollapse */ AMapLoaderService.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: Inject, args: [NGX_AMAP_CONFIG,] }] }, { type: LoggerService } ]; }; return AMapLoaderService; }()); if (false) { /** * @type {?} * @private */ AMapLoaderService.prototype.defaultProtocol; /** * @type {?} * @private */ AMapLoaderService.prototype.defaultVersion; /** * @type {?} * @private */ AMapLoaderService.prototype.defaultUIVersion; /** * @type {?} * @private */ AMapLoaderService.prototype.loading$; /** * @type {?} * @private */ AMapLoaderService.prototype.uiLoading$; /** * @type {?} * @private */ AMapLoaderService.prototype.config; /** * @type {?} * @private */ AMapLoaderService.prototype.logger; } /** * @fileoverview added by tsickle * Generated from: shared/amap.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var TAG$1 = 'AMap'; var AMapService = /** @class */ (function () { function AMapService(loader, logger, ngZone) { this.loader = loader; this.logger = logger; this.ngZone = ngZone; this.map$ = new ReplaySubject(); } /** * 获取地图对象 AMap.Map */ /** * 获取地图对象 AMap.Map * @return {?} */ AMapService.prototype.get = /** * 获取地图对象 AMap.Map * @return {?} */ function () { return this.map$.asObservable(); }; /** * 创建地图对象 AMap.Map * @param container 地图容器的DOM元素 * @param options 选项 */ /** * 创建地图对象 AMap.Map * @param {?} container 地图容器的DOM元素 * @param {?} options 选项 * @return {?} */ AMapService.prototype.create = /** * 创建地图对象 AMap.Map * @param {?} container 地图容器的DOM元素 * @param {?} options 选项 * @return {?} */ function (container, options) { var _this = this; return this.loader.load().pipe(map((/** * @return {?} */ function () { _this.map = _this.ngZone.runOutsideAngular((/** * @return {?} */ function () { return new AMap.Map(container, options); })); _this.logger.d(TAG$1, 'new map created.'); _this.map$.next(_this.map); _this.map$.complete(); return _this.map; }))); }; /** * 销毁地图对象 */ /** * 销毁地图对象 * @return {?} */ AMapService.prototype.destroy = /** * 销毁地图对象 * @return {?} */ function () { var _this = this; this.get().subscribe((/** * @param {?} m * @return {?} */ function (m) { m.destroy(); _this.logger.d(TAG$1, 'map destroyed.'); _this.map = null; })); }; AMapService.decorators = [ { type: Injectable } ]; /** @nocollapse */ AMapService.ctorParameters = function () { return [ { type: AMapLoaderService }, { type: LoggerService }, { type: NgZone } ]; }; return AMapService; }()); if (false) { /** * @type {?} * @private */ AMapService.prototype.map; /** * @type {?} * @private */ AMapService.prototype.map$; /** * @type {?} * @private */ AMapService.prototype.loader; /** * @type {?} * @private */ AMapService.prototype.logger; /** * @type {?} * @private */ AMapService.prototype.ngZone; } /** * @fileoverview added by tsickle * Generated from: shared/event-binder.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var TAG$2 = 'EventBinder'; var EventBinderService = /** @class */ (function () { function EventBinderService(logger, ngZone) { this.logger = logger; this.ngZone = ngZone; } /** * 注册事件 * @param eventName 事件名 */ /** * 注册事件 * @template T * @param {?} target * @param {?} eventName 事件名 * @return {?} */ EventBinderService.prototype.bindEvent = /** * 注册事件 * @template T * @param {?} target * @param {?} eventName 事件名 * @return {?} */ function (target, eventName) { var _this = this; return (/** @type {?} */ (target.pipe(switchMap((/** * @param {?} t * @return {?} */ function (t) { return new Observable((/** * @param {?} observer * @return {?} */ function (observer) { /** @type {?} */ var handler = AMap.event.addListener(t, eventName, (/** * @param {?} e * @return {?} */ function (e) { _this.ngZone.run((/** * @return {?} */ function () { return observer.next(e); })); }), _this); _this.logger.d(TAG$2, "subscribed event: " + eventName); return (/** * @return {?} */ function () { AMap.event.removeListener(handler); _this.logger.d(TAG$2, "unsubscribed event: " + eventName); eventName = null; handler = null; }); })); }))))); }; EventBinderService.decorators = [ { type: Injectable } ]; /** @nocollapse */ EventBinderService.ctorParameters = function () { return [ { type: LoggerService }, { type: NgZone } ]; }; return EventBinderService; }()); if (false) { /** * @type {?} * @private */ EventBinderService.prototype.logger; /** * @type {?} * @private */ EventBinderService.prototype.ngZone; } /** * @fileoverview added by tsickle * Generated from: shared/plugin-loader.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var TAG$3 = 'PluginLoader'; var PluginLoaderService = /** @class */ (function () { function PluginLoaderService(amap, logger) { this.amap = amap; this.logger = logger; this.state = new Map(); } /** * @param {?} name * @return {?} */ PluginLoaderService.prototype.load = /** * @param {?} name * @return {?} */ function (name) { var _this = this; /** @type {?} */ var pKey = ''; if (Array.isArray(name)) { pKey = name.join(','); } else { pKey = name; } if (this.state.has(pKey)) { return this.state.get(pKey).asObservable(); } this.logger.d(TAG$3, 'loading plugin:', pKey, '...'); return this.amap.get().pipe(switchMap((/** * @param {?} m * @return {?} */ function (m) { /** @type {?} */ var loading$ = new ReplaySubject(1); m.plugin(name, (/** * @return {?} */ function () { _this.logger.d(TAG$3, 'loading plugin:', pKey, 'COMPLETE'); loading$.next(); loading$.complete(); })); _this.state.set(pKey, loading$); return loading$.asObservable(); }))); }; PluginLoaderService.decorators = [ { type: Injectable } ]; /** @nocollapse */ PluginLoaderService.ctorParameters = function () { return [ { type: AMapService }, { type: LoggerService } ]; }; return PluginLoaderService; }()); if (false) { /** * @type {?} * @private */ PluginLoaderService.prototype.state; /** * @type {?} * @private */ PluginLoaderService.prototype.amap; /** * @type {?} * @private */ PluginLoaderService.prototype.logger; } /** * @fileoverview added by tsickle * Generated from: utils/change-filter.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ChangeFilter = /** @class */ (function () { function ChangeFilter(changes) { this.changes = changes; } /** * @param {?} changes * @return {?} */ ChangeFilter.of = /** * @param {?} changes * @return {?} */ function (changes) { return new ChangeFilter(changes); }; /** * @template T * @param {?} key * @return {?} */ ChangeFilter.prototype.notEmpty = /** * @template T * @param {?} key * @return {?} */ function (key) { if (this.changes[key]) { /** @type {?} */ var value = this.changes[key].currentValue; if (value !== undefined && value !== null) { return of(value); } } return EMPTY; }; /** * @template T * @param {?} key * @return {?} */ ChangeFilter.prototype.has = /** * @template T * @param {?} key * @return {?} */ function (key) { if (this.changes[key]) { /** @type {?} */ var value = this.changes[key].currentValue; return of(value); } return EMPTY; }; return ChangeFilter; }()); if (false) { /** * @type {?} * @private */ ChangeFilter.prototype.changes; } /** * @fileoverview added by tsickle * Generated from: utils/get-options.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @template T * @param {?} component * @param {?} keys * @return {?} */ function getOptions(component, keys) { /** @type {?} */ var options = {}; keys.forEach((/** * @param {?} key * @return {?} */ function (key) { if (component[key] !== undefined && component[key] !== null) { options[key] = component[key]; } })); return options; } /** * @fileoverview added by tsickle * Generated from: utils/index.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * Generated from: components/ngx-amap/ngx-amap.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var TAG$4 = 'ngx-amap'; /** @type {?} */ var ALL_OPTIONS = [ 'view', 'layers', 'zoom', 'center', 'labelzIndex', 'zooms', 'lang', 'defaultCursor', 'crs', 'animateEnable', 'isHotspot', 'defaultLayer', 'rotateEnable', 'resizeEnable', 'showIndoorMap', 'indoorMap', 'expandZoomRange', 'dragEnable', 'zoomEnable', 'doubleClickZoom', 'keyboardEnable', 'jogEnable', 'scrollWheel', 'touchZoom', 'touchZoomCenter', 'mapStyle', 'features', 'showBuildingBlock', 'viewMode', 'pitch', 'pitchEnable', 'buildingAnimation', 'skyColor', 'preloadMode', 'mask', 'maxPitch', 'rotation', 'forceVector', 'gridMapForeign', 'vectorMapForeign', ]; var NgxAmapComponent = /** @class */ (function () { function NgxAmapComponent(el, amap, pluginLoader, logger, binder, ngZone) { this.el = el; this.amap = amap; this.pluginLoader = pluginLoader; this.logger = logger; this.binder = binder; this.ngZone = ngZone; // ---- Map Events ---- this.naReady = new EventEmitter(); this.naPluginsLoaded = new EventEmitter(); this.inited = false; /** @type {?} */ var m = this.amap.get(); this.naComplete = this.binder.bindEvent(m, 'complete'); this.naClick = this.binder.bindEvent(m, 'click'); this.naDblClick = this.binder.bindEvent(m, 'dblclick'); this.naRightClick = this.binder.bindEvent(m, 'rightclick'); this.naMouseMove = this.binder.bindEvent(m, 'mousemove'); this.naMouseOver = this.binder.bindEvent(m, 'mouseover'); this.naMouseWheel = this.binder.bindEvent(m, 'mousewheel'); this.naMouseUp = this.binder.bindEvent(m, 'mouseup'); this.naMouseOut = this.binder.bindEvent(m, 'mouseout'); this.naMouseDown = this.binder.bindEvent(m, 'mousedown'); this.naTouchStart = this.binder.bindEvent(m, 'touchstart'); this.naTouchMove = this.binder.bindEvent(m, 'touchmove'); this.naTouchEnd = this.binder.bindEvent(m, 'touchend'); this.naHotspotClick = this.binder.bindEvent(m, 'hotspotclick'); this.naHotspotOver = this.binder.bindEvent(m, 'hotspotover'); this.naHotspotOut = this.binder.bindEvent(m, 'hotspotout'); this.naDragStart = this.binder.bindEvent(m, 'dragstart'); this.naDragging = this.binder.bindEvent(m, 'dragging'); this.naDragEnd = this.binder.bindEvent(m, 'dragend'); this.naResize = this.binder.bindEvent(m, 'resize'); this.naZoomStart = this.binder.bindEvent(m, 'zoomstart'); this.naZoomEnd = this.binder.bindEvent(m, 'zoomend'); this.naZoomChange = this.binder.bindEvent(m, 'zoomchange'); this.naMoveStart = this.binder.bindEvent(m, 'movestart'); this.naMoveEnd = this.binder.bindEvent(m, 'moveend'); this.naMove = this.binder.bindEvent(m, 'mapmove'); } /** * @return {?} */ NgxAmapComponent.prototype.ngOnInit = /** * @return {?} */ function () { var _this = this; this.logger.d(TAG$4, 'initializing ...'); /** @type {?} */ var container = this.el.nativeElement.querySelector('div.ngx-amap-container-inner'); /** @type {?} */ var options = getOptions(this, ALL_OPTIONS); this.logger.d(TAG$4, 'options:', options); this.amap.create(container, options).subscribe((/** * @param {?} amap * @return {?} */ function (amap) { _this.logger.d(TAG$4, 'map is ready.'); _this.ngZone.run((/** * @return {?} */ function () { return _this.naReady.emit(amap); })); })); this.inited = true; }; /** * @return {?} */ NgxAmapComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { this.amap.destroy(); }; /** * @param {?} changes * @return {?} */ NgxAmapComponent.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { var _this = this; /** @type {?} */ var filter = ChangeFilter.of(changes); /** @type {?} */ var amap = this.get(); if (this.inited) { zip(filter.has('zoom'), amap).subscribe((/** * @param {?} __0 * @return {?} */ function (_a) { var _b = __read(_a, 2), v = _b[0], m = _b[1]; _this.logger.d(TAG$4, 'setZoom:', v); m.setZoom(v); })); zip(filter.has('center'), amap).subscribe((/** * @param {?} __0 * @return {?} */ function (_a) { var _b = __read(_a, 2), v = _b[0], m = _b[1]; _this.logger.d(TAG$4, 'setCenter:', v); m.setCenter(v); })); } // Not included in OPTIONS zip(filter.has('city'), amap).subscribe((/** * @param {?} __0 * @return {?} */ function (_a) { var _b = __read(_a, 2), v = _b[0], m = _b[1]; m.setCity(v, (/** * @return {?} */ function () { _this.logger.d(TAG$4, 'setCity:', v); })); })); zip(filter.notEmpty('plugins'), amap).subscribe((/** * @param {?} __0 * @return {?} */ function (_a) { var _b = __read(_a, 2), v = _b[0], m = _b[1]; _this.pluginLoader.load(v).subscribe((/** * @return {?} */ function () { _this.logger.d(TAG$4, 'plugins loaded.'); _this.ngZone.run((/** * @return {?} */ function () { return _this.naPluginsLoaded.emit(m); })); })); })); }; /** * 获取已创建的 AMap.Map 对象 */ /** * 获取已创建的 AMap.Map 对象 * @return {?} */ NgxAmapComponent.prototype.get = /** * 获取已创建的 AMap.Map 对象 * @return {?} */ function () { return this.amap.get(); }; NgxAmapComponent.decorators = [ { type: Component, args: [{ selector: 'ngx-amap', exportAs: 'amap', template: "<div class='ngx-amap-container-inner'></div>\n<div class='ngx-amap-content'>\n <ng-content></ng-content>\n</div>", providers: [AMapService, PluginLoaderService], styles: [".ngx-amap-container-inner{width:inherit;height:inherit}.ngx-amap-content{display:none}"] }] } ]; /** @nocollapse */ NgxAmapComponent.ctorParameters = function () { return [ { type: ElementRef }, { type: AMapService }, { type: PluginLoaderService }, { type: LoggerService }, { type: EventBinderService }, { type: NgZone } ]; }; NgxAmapComponent.propDecorators = { view: [{ type: Input }], layers: [{ type: Input }], zoom: [{ type: Input }], center: [{ type: Input }], labelzIndex: [{ type: Input }], zooms: [{ type: Input }], lang: [{ type: Input }], defaultCursor: [{ type: Input }], crs: [{ type: Input }], animateEnable: [{ type: Input }], isHotspot: [{ type: Input }], defaultLayer: [{ type: Input }], rotateEnable: [{ type: Input }], resizeEnable: [{ type: Input }], showIndoorMap: [{ type: Input }], indoorMap: [{ type: Input }], expandZoomRange: [{ type: Input }], dragEnable: [{ type: Input }], zoomEnable: [{ type: Input }], doubleClickZoom: [{ type: Input }], keyboardEnable: [{ type: Input }], jogEnable: [{ type: Input }], scrollWheel: [{ type: Input }], touchZoom: [{ type: Input }], touchZoomCenter: [{ type: Input }], mapStyle: [{ type: Input }], features: [{ type: Input }], showBuildingBlock: [{ type: Input }], viewMode: [{ type: Input }], pitch: [{ type: Input }], pitchEnable: [{ type: Input }], buildingAnimation: [{ type: Input }], skyColor: [{ type: Input }], preloadMode: [{ type: Input }], mask: [{ type: Input }], maxPitch: [{ type: Input }], rotation: [{ type: Input }], forceVector: [{ type: Input }], gridMapForeign: [{ type: Input }], vectorMapForeign: [{ type: Input }], city: [{ type: Input }], name: [{ type: Input }], plugins: [{ type: Input }], naReady: [{ type: Output }], naComplete: [{ type: Output }], naClick: [{ type: Output }], naDblClick: [{ type: Output }], naRightClick: [{ type: Output }], naMouseMove: [{ type: Output }], naMouseOver: [{ type: Output }], naMouseWheel: [{ type: Output }], naMouseUp: [{ type: Output }], naMouseOut: [{ type: Output }], naMouseDown: [{ type: Output }], naTouchStart: [{ type: Output }], naTouchMove: [{ type: Output }], naTouchEnd: [{ type: Output }], naHotspotClick: [{ type: Output }], naHotspotOver: [{ type: Output }], naHotspotOut: [{ type: Output }], naDragStart: [{ type: Output }], naDragging: [{ type: Output }], naDragEnd: [{ type: Output }], naResize: [{ type: Output }], naZoomStart: [{ type: Output }], naZoomEnd: [{ type: Output }], naZoomChange: [{ type: Output }], naMoveStart: [{ type: Output }], naMoveEnd: [{ type: Output }], naMove: [{ type: Output }], naPluginsLoaded: [{ type: Output }] }; return NgxAmapComponent; }()); if (false) { /** * 地图视口,用于控制影响地图静态显示的属性 * @type {?} */ NgxAmapComponent.prototype.view; /** * 地图图层数组,数组可以是图层 中的一个或多个,默认为普通二维地图 * @type {?} */ NgxAmapComponent.prototype.layers; /** * 地图显示的缩放级别 * @type {?} */ NgxAmapComponent.prototype.zoom; /** * 地图中心点坐标值 * @type {?} */ NgxAmapComponent.prototype.center; /** * 地图标注显示顺序 * @type {?} */ NgxAmapComponent.prototype.labelzIndex; /** * 地图显示的缩放级别范围 * @type {?} */ NgxAmapComponent.prototype.zooms; /** * 地图语言类型 * @type {?} */ NgxAmapComponent.prototype.lang; /** * 地图默认鼠标样式 * @type {?} */ NgxAmapComponent.prototype.defaultCursor; /** * 地图显示的参考坐标系 * @type {?} */ NgxAmapComponent.prototype.crs; /** * 地图平移过程中是否使用动画 * @type {?} */ NgxAmapComponent.prototype.animateEnable; /** * 是否开启地图热点和标注的hover效果 * @type {?} */ NgxAmapComponent.prototype.isHotspot; /** * 当前地图中默认显示的图层 * @type {?} */ NgxAmapComponent.prototype.defaultLayer; /** * 地图是否可旋转 * @type {?} */ NgxAmapComponent.prototype.rotateEnable; /** * 是否监控地图容器尺寸变化 * @type {?} */ NgxAmapComponent.prototype.resizeEnable; /** * 是否在有矢量底图的时候自动展示室内地图 * @type {?} */ NgxAmapComponent.prototype.showIndoorMap; /** * 在展示矢量图的时候自动展示室内地图图层 * @type {?} */ NgxAmapComponent.prototype.indoorMap; /** * 是否支持可以扩展最大缩放级别 * @type {?} */ NgxAmapComponent.prototype.expandZoomRange; /** * 地图是否可通过鼠标拖拽平移 * @type {?} */ NgxAmapComponent.prototype.dragEnable; /** * 地图是否可缩放 * @type {?} */ NgxAmapComponent.prototype.zoomEnable; /** * 地图是否可通过双击鼠标放大地图 * @type {?} */ NgxAmapComponent.prototype.doubleClickZoom; /** * 地图是否可通过键盘控制 * @type {?} */ NgxAmapComponent.prototype.keyboardEnable; /** * 地图是否使用缓动效果 * @type {?} */ NgxAmapComponent.prototype.jogEnable; /** * 地图是否可通过鼠标滚轮缩放浏览 * @type {?} */ NgxAmapComponent.prototype.scrollWheel; /** * 地图在移动终端上是否可通过多点触控缩放浏览地图 * @type {?} */ NgxAmapComponent.prototype.touchZoom; /** * 当touchZoomCenter=1的时候,手机端双指缩放的以地图中心为中心,否则默认以双指中间点为中心 * @type {?} */ NgxAmapComponent.prototype.touchZoomCenter; /** * 设置地图的显示样式 * @type {?} */ NgxAmapComponent.prototype.mapStyle; /** * 设置地图上显示的元素种类 * @type {?} */ NgxAmapComponent.prototype.features; /** * 设置地图显示3D楼块效果 * @type {?} */ NgxAmapComponent.prototype.showBuildingBlock; /** * 视图模式 * @type {?} */ NgxAmapComponent.prototype.viewMode; /** * 俯仰角度 * @type {?} */ NgxAmapComponent.prototype.pitch; /** * 是否允许设置俯仰角度 * @type {?} */ NgxAmapComponent.prototype.pitchEnable; /** * 楼块出现和消失的时候是否显示动画过程 * @type {?} */ NgxAmapComponent.prototype.buildingAnimation; /** * 调整天空颜色 * @type {?} */ NgxAmapComponent.prototype.skyColor; /** * 设置地图的预加载模式 * @type {?} */ NgxAmapComponent.prototype.preloadMode; /** * 为 Map 实例指定掩模的路径,各图层将只显示路径范围内图像 * @type {?} */ NgxAmapComponent.prototype.mask; /** @type {?} */ NgxAmapComponent.prototype.maxPitch; /** @type {?} */ NgxAmapComponent.prototype.rotation; /** @type {?} */ NgxAmapComponent.prototype.forceVector; /** @type {?} */ NgxAmapComponent.prototype.gridMapForeign; /** * 额外: 海外⽮量地图样式 * @type {?} */ NgxAmapComponent.prototype.vectorMapForeign; /** * 额外: 设置城市 * @type {?} */ NgxAmapComponent.prototype.city; /** * 额外: 设置地图名 * @type {?} */ NgxAmapComponent.prototype.name; /** * 额外:加载插件 * @type {?} */ NgxAmapComponent.prototype.plugins; /** @type {?} */ NgxAmapComponent.prototype.naReady; /** @type {?} */ NgxAmapComponent.prototype.naComplete; /** @type {?} */ NgxAmapComponent.prototype.naClick; /** @type {?} */ NgxAmapComponent.prototype.naDblClick; /** @type {?} */ NgxAmapComponent.prototype.naRightClick; /** @type {?} */ NgxAmapComponent.prototype.naMouseMove; /** @type {?} */ NgxAmapComponent.prototype.naMouseOver; /** @type {?} */ NgxAmapComponent.prototype.naMouseWheel; /** @type {?} */ NgxAmapComponent.prototype.naMouseUp; /** @type {?} */ NgxAmapComponent.prototype.naMouseOut; /** @type {?} */ NgxAmapComponent.prototype.naMouseDown; /** @type {?} */ NgxAmapComponent.prototype.naTouchStart; /** @type {?} */ NgxAmapComponent.prototype.naTouchMove; /** @type {?} */ NgxAmapComponent.prototype.naTouchEnd; /** @type {?} */ NgxAmapComponent.prototype.naHotspotClick; /** @type {?} */ NgxAmapComponent.prototype.naHotspotOver; /** @type {?} */ NgxAmapComponent.prototype.naHotspotOut; /** @type {?} */ NgxAmapComponent.prototype.naDragStart; /** @type {?} */ NgxAmapComponent.prototype.naDragging; /** @type {?} */ NgxAmapComponent.prototype.naDragEnd; /** @type {?} */ NgxAmapComponent.prototype.naResize; /** @type {?} */ NgxAmapComponent.prototype.naZoomStart; /** @type {?} */ NgxAmapComponent.prototype.naZoomEnd; /** @type {?} */ NgxAmapComponent.prototype.naZoomChange; /** @type {?} */ NgxAmapComponent.prototype.naMoveStart; /** @type {?} */ NgxAmapComponent.prototype.naMoveEnd; /** @type {?} */ NgxAmapComponent.prototype.naMove; /** @type {?} */ NgxAmapComponent.prototype.naPluginsLoaded; /** * @type {?} * @private */ NgxAmapComponent.prototype.inited; /** * @type {?} * @private */ NgxAmapComponent.prototype.el; /** * @type {?} * @private */ NgxAmapComponent.prototype.amap; /** * @type {?} * @private */ NgxAmapComponent.prototype.pluginLoader; /** * @type {?} * @private */ NgxAmapComponent.prototype.logger; /** * @type {?} * @private */ NgxAmapComponent.prototype.binder; /** * @type {?} * @private */ NgxAmapComponent.prototype.ngZone; } /** * @fileoverview added by tsickle * Generated from: directives/amap-marker/amap-marker.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var TAG$5 = 'AmapMarker'; var AmapMarkerService = /** @class */ (function () { function AmapMarkerService(amaps, logger, ngZone) { this.amaps = amaps; this.logger = logger; this.ngZone = ngZone; this.marker$ = new ReplaySubject(1); } /** * 获取点标记 */ /** * 获取点标记 * @return {?} */ AmapMarkerService.prototype.get = /** * 获取点标记 * @return {?} */ function () { return this.marker$.asObservable(); }; /** * 创建点标记 AMap.Marker * @param options 选项 * @param addToMap 是否直接加进地图 */ /** * 创建点标记 AMap.Marker * @param {?} options 选项 * @param {?=} addToMap 是否直接加进地图 * @return {?} */ AmapMarkerService.prototype.create = /** * 创建点标记 AMap.Marker * @param {?} options 选项 * @param {?=} addToMap 是否直接加进地图 * @return {?} */ function (options, addToMap) { var _this = this; if (addToMap === void 0) { addToMap = true; } return this.amaps.get().pipe(map((/** * @param {?} m * @return {?} */ function (m) { if (addToMap) { options.map = m; } _this.marker = _this.ngZone.runOutsideAngular((/** * @return {?} */ function () { return new AMap.Marker(options); })); _this.logger.d(TAG$5, 'new marker created.'); _this.marker$.next(_this.marker); _this.marker$.complete(); return _this.marker; }))); }; /** * 销毁点标记 */ /** * 销毁点标记 * @return {?} */ AmapMarkerService.prototype.destroy = /** * 销毁点标记 * @return {?} */ function () { var _this = this; this.get().subscribe((/** * @param {?} m * @return {?} */ function (m) { m.setMap(null); _this.logger.d(TAG$5, 'marker destroyed.'); _this.marker = null; })); }; AmapMarkerService.decorators = [ { type: Injectable } ]; /** @nocollapse */ AmapMarkerService.ctorParameters = function () { return [ { type: AMapService }, { type: LoggerService }, { type: NgZone } ]; }; return AmapMarkerService; }()); if (false) { /** * @type {?} * @private */ AmapMarkerService.prototype.marker; /** * @type {?} * @private */ AmapMarkerService.prototype.marker$; /** * @type {?} * @private */ AmapMarkerService.prototype.amaps; /** * @type {?} * @private */ AmapMarkerService.prototype.logger; /** * @type {?} * @private */ AmapMarkerService.prototype.ngZone; } /** * @fileoverview added by tsickle * Generated from: base/amap-overlay.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var OverlayOptions = ['cursor', 'extData', 'bubble', 'clickable', 'draggable']; /** * @template T */ var AMapOverlay = /** @class */ (function () { function AMapOverlay(os, binder) { this.os = os; this.binder = binder; /** @type {?} */ var target = os.get(); this.naTouchStart = this.binder.bindEvent(target, 'touchstart'); this.naTouchMove = this.binder.bindEvent(target, 'touchmove'); this.naTouchEnd = this.binder.bindEvent(target, 'touchend'); this.naClick = this.binder.bindEvent(target, 'click'); this.naDblClick = this.binder.bindEvent(target, 'dblclick'); this.naRightClick = this.binder.bindEvent(target, 'rightclick'); this.naMouseOver = this.binder.bindEvent(target, 'mouseover'); this.naMouseUp = this.binder.bindEvent(target, 'mouseup'); this.naMouseOut = this.binder.bindEvent(target, 'mouseout'); this.naMouseDown = this.binder.bindEvent(target, 'mousedown'); } AMapOverlay.propDecorators = { cursor: [{ type: Input }], extData: [{ type: Input }], bubble: [{ type: Input }], clickable: [{ type: Input }], draggable: [{ type: Input }], naTouchStart: [{ type: Output }], naTouchMove: [{ type: Output }], naTouchEnd: [{ type: Output }], naClick: [{ type: Output }], naDblClick: [{ type: Output }], naRightClick: [{ type: Output }], naMouseOver: [{ type: Output }], naMouseUp: [{ type: Output }], naMouseOut: [{ type: Output }], naMouseDown: [{ type: Output }] }; return AMapOverlay; }()); if (false) { /** * 鼠标悬停时的鼠标样式 * @type {?} */ AMapOverlay.prototype.cursor; /** * 自定义数据 * @type {?} */ AMapOverlay.prototype.extData; /** * 事件是否穿透到地图 * @type {?} */ AMapOverlay.prototype.bubble; /** * 是否支持点击 * @type {?} */ AMapOverlay.prototype.clickable; /** * 是否支持拖拽 * @type {?} */ AMapOverlay.prototype.draggable; /** @type {?} */ AMapOverlay.prototype.naTouchStart; /** @type {?} */ AMapOverlay.prototype.naTouchMove; /** @type {?} */ AMapOverlay.prototype.naTouchEnd; /** @type {?} */ AMapOverlay.prototype.naClick; /** @type {?} */ AMapOverlay.prototype.naDblClick; /** @type {?} */ AMapOverlay.prototype.naRightClick; /** @type {?} */ AMapOverlay.prototype.naMouseOver; /** @type {?} */ AMapOverlay.prototype.naMouseUp; /** @type {?} */ AMapOverlay.prototype.naMouseOut; /** @type {?} */ AMapOverlay.prototype.naMouseDown; /** * @type {?} * @protected */ AMapOverlay.prototype.os; /** * @type {?} * @protected */ AMapOverlay.prototype.binder; } /** * @fileoverview added by tsickle * Generated from: shared/pixel.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var PixelService = /** @class */ (function () { function PixelService() { } /** * @param {?} options * @return {?} */ PixelService.prototype.create = /** * @param {?} options * @return {?} */ function (options) { if (!options) { return null; } if (options instanceof AMap.Pixel) { return options; } if (Array.isArray(options)) { return new AMap.Pixel(options[0], options[1]); } return new AMap.Pixel(options.x || 0, options.y || 0, options.round); }; PixelService.decorators = [ { type: Injectable, args: [{ providedIn: 'root', },] } ]; /** @nocollapse */ PixelService.ctorParameters = function () { return []; }; /** @nocollapse */ PixelService.ngInjectableDef = ɵɵdefineInjectable({ factory: function PixelService_Factory() { return new PixelService(); }, token: PixelService, providedIn: "root" }); return PixelService; }()); /** * @fileoverview added by tsickle * Generated from: shared/size.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var SizeService = /** @class */ (function () { function SizeService() { } /** * @param {?} options * @return {?} */ SizeService.prototype.create = /** * @param {?} options * @return {?} */ function (options) { if (!options) { return null; } if (options instanceof AMap.Size || Array.isArray(options)) { return options; } if (options.width !== undefined && options.height !== undefined) { return new AMap.Size(options.width, options.height); } if (options.w !== undefined && options.h !== undefined) { return new AMap.Size(options.w, options.h); } return null; }; SizeService.decorators = [ { type: Injectable, args: [{ providedIn: 'root', },] } ]; /** @nocollapse */ SizeService.ctorParameters = function () { return []; }; /** @nocollapse */ SizeService.ngInjectableDef = ɵɵdefineInjectable({ factory: function SizeService_Factory() { return new SizeService(); }, token: SizeService, providedIn: "root" }); return SizeService; }()); /** * @fileoverview added by tsickle * Generated from: shared/icon.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var IconService = /** @class */ (function () { function IconService(pixels, sizes) { this.pixels = pixels; this.sizes = sizes; } /** * @param {?} options * @return {?} */ IconService.prototype.create = /** * @param {?} options * @return {?} */ function (options) { if (!options) { return null; } if (typeof options === 'string') { return options; } if (options instanceof AMap.Icon) { return options; } /** @type {?} */ var iconOption = {}; var size = options.size, image = options.image, imageOffset = options.imageOffset, imageSize = options.imageSize; if (size !== undefined) { iconOption.size = this.sizes.create(size); } if (image !== undefined) { iconOption.image = image; } if (imageOffset !== undefined) { iconOption.imageOffset = this.pixels.create(imageOffset); } if (imageSize !== undefined) { iconOption.imageSize = this.sizes.create(imageSize); } return new AMap.Icon(iconOption); }; IconService.decorators = [ { type: Injectable, args: [{ providedIn: 'root', },] } ]; /** @nocollapse */ IconService.ctorParameters = function () { return [ { type: PixelService }, { type: SizeService } ]; }; /** @nocollapse */ IconService.ngInjectableDef = ɵɵdefineInjectable({ factory: function IconService_Factory() { return new IconService(ɵɵinject(PixelService), ɵɵinject(SizeService)); }, token: IconService, providedIn: "root" }); return IconService; }()); if (false) { /** * @type {?} * @private */ IconService.prototype.pixels; /** * @type {?} * @private */ IconService.prototype.sizes; } /** * @fileoverview added by tsickle * Generated from: shared/marker-label.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MarkerLabelService = /** @class */ (function () { function MarkerLabelService(pixel) { this.pixel = pixel; } /** * @param {?} options * @return {?} */ MarkerLabelService.prototype.create = /**