UNPKG

angular-leaflet

Version:

Collection of angular components to build map views faster and with minimal configuration using the most popular library **LeafletJS**.

1,175 lines (1,145 loc) 39.7 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('uuid'), require('@angular/common'), require('leaflet')) : typeof define === 'function' && define.amd ? define('angular-leaflet', ['exports', '@angular/core', 'uuid', '@angular/common', 'leaflet'], factory) : (global = global || self, factory(global['angular-leaflet'] = {}, global.ng.core, global.uuid, global.ng.common, global.leaflet)); }(this, function (exports, core, uuid, common, leaflet) { 'use strict'; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @template T */ var /** * @template T */ LayerHandler = /** @class */ (function () { function LayerHandler() { this.id = uuid.v4(); } /** * @param {?} mapRef * @param {?} layerRef * @return {?} */ LayerHandler.prototype.initialize = /** * @param {?} mapRef * @param {?} layerRef * @return {?} */ function (mapRef, layerRef) { this.mapRef = mapRef; this.layerRef = layerRef; }; return LayerHandler; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @template T */ var BaseLayer = /** @class */ (function () { function BaseLayer() { this.handlerIds = []; this.id = uuid.v4(); } /** * @param {?} map * @return {?} */ BaseLayer.prototype.addTo = /** * @param {?} map * @return {?} */ function (map) { this.mapRef = map; }; /** * @return {?} */ BaseLayer.prototype.removeFrom = /** * @return {?} */ function () { if (this.layerRef) { ((/** @type {?} */ (this.mapRef))).removeLayer(this.layerRef); } }; /** * @return {?} */ BaseLayer.prototype.ngAfterContentInit = /** * @return {?} */ function () { this.initHandlers(); this.handlerSubscription = this.handlers.changes.subscribe(this.initHandlers.bind(this)); }; /** * @return {?} */ BaseLayer.prototype.initHandlers = /** * @return {?} */ function () { var _this = this; this.handlers.filter((/** * @param {?} handler * @return {?} */ function (handler) { return !_this.handlerIds.includes(handler.id); })).forEach(this.initHandler.bind(this)); }; /** * @param {?} handler * @return {?} */ BaseLayer.prototype.initHandler = /** * @param {?} handler * @return {?} */ function (handler) { handler.initialize(this.layerRef['_map'], this.layerRef); this.handlerIds = __spread(this.handlerIds, [handler.id]); }; /** * @return {?} */ BaseLayer.prototype.ngOnDestroy = /** * @return {?} */ function () { this.handlerSubscription.unsubscribe(); this.removeFrom(); }; BaseLayer.propDecorators = { handlers: [{ type: core.ContentChildren, args: [LayerHandler,] }] }; return BaseLayer; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MapHandler = /** @class */ (function () { function MapHandler() { this.id = uuid.v4(); } /** * @param {?} mapRef * @return {?} */ MapHandler.prototype.initialize = /** * @param {?} mapRef * @return {?} */ function (mapRef) { this.mapRef = mapRef; }; return MapHandler; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var LeafletComponent = /** @class */ (function () { function LeafletComponent(elementRef) { this.elementRef = elementRef; this.layerIds = []; this.handlerIds = []; } /** * @return {?} */ LeafletComponent.prototype.ngOnInit = /** * @return {?} */ function () { this.map = leaflet.map(this.elementRef.nativeElement, __assign({}, this.options)); }; /** * @return {?} */ LeafletComponent.prototype.ngAfterContentInit = /** * @return {?} */ function () { this.addLayers(); this.layers.changes.subscribe(this.addLayers.bind(this)); this.addHandlers(); this.handlers.changes.subscribe(this.addHandlers.bind(this)); }; /** * @private * @return {?} */ LeafletComponent.prototype.addLayers = /** * @private * @return {?} */ function () { var _this = this; this.layers.filter((/** * @param {?} layer * @return {?} */ function (layer) { return !_this.layerIds.includes(layer.id); })).forEach(this.addLayer.bind(this)); }; /** * @private * @param {?} layer * @return {?} */ LeafletComponent.prototype.addLayer = /** * @private * @param {?} layer * @return {?} */ function (layer) { layer.addTo(this.map); this.layerIds = __spread(this.layerIds, [layer.id]); }; /** * @private * @return {?} */ LeafletComponent.prototype.addHandlers = /** * @private * @return {?} */ function () { var _this = this; this.handlers.filter((/** * @param {?} handler * @return {?} */ function (handler) { return !_this.handlerIds.includes(handler.id); })).forEach(this.addHandler.bind(this)); }; /** * @private * @param {?} handler * @return {?} */ LeafletComponent.prototype.addHandler = /** * @private * @param {?} handler * @return {?} */ function (handler) { handler.initialize(this.map); this.handlerIds = __spread(this.handlerIds, [handler.id]); }; LeafletComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngl-leaflet', template: '<ng-content></ng-content>', styles: ["\n :host {\n display: flex;\n flex: 1 1 auto;\n }\n "] }] } ]; /** @nocollapse */ LeafletComponent.ctorParameters = function () { return [ { type: core.ElementRef } ]; }; LeafletComponent.propDecorators = { options: [{ type: core.Input }], layers: [{ type: core.ContentChildren, args: [BaseLayer,] }], handlers: [{ type: core.ContentChildren, args: [MapHandler, { descendants: true },] }] }; return LeafletComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NglCoreModule = /** @class */ (function () { function NglCoreModule() { } NglCoreModule.decorators = [ { type: core.NgModule, args: [{ imports: [ common.CommonModule ], declarations: [ LeafletComponent ], exports: [ LeafletComponent ] },] } ]; return NglCoreModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var FeatureGroupComponent = /** @class */ (function (_super) { __extends(FeatureGroupComponent, _super); function FeatureGroupComponent() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.layerIds = []; return _this; } /** * @param {?} map * @return {?} */ FeatureGroupComponent.prototype.addTo = /** * @param {?} map * @return {?} */ function (map) { _super.prototype.addTo.call(this, map); this.layerRef = new leaflet.FeatureGroup(); this.mapRef.addLayer(this.layerRef); this.addLayers(); this.initHandlers(); this.layers.changes.subscribe(this.addLayers.bind(this)); }; /** * @private * @return {?} */ FeatureGroupComponent.prototype.addLayers = /** * @private * @return {?} */ function () { var _this = this; this.layers .filter((/** * @param {?} layer * @return {?} */ function (layer) { return layer.id !== _this.id; })) .filter((/** * @param {?} layer * @return {?} */ function (layer) { return !_this.layerIds.includes(layer.id); })) .forEach(this.addLayer.bind(this)); }; /** * @private * @param {?} layer * @return {?} */ FeatureGroupComponent.prototype.addLayer = /** * @private * @param {?} layer * @return {?} */ function (layer) { layer.addTo(this.layerRef); this.layerIds = __spread(this.layerIds, [layer.id]); }; FeatureGroupComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngl-feature-group', template: '', providers: [{ provide: BaseLayer, useExisting: core.forwardRef((/** * @return {?} */ function () { return FeatureGroupComponent; })) }] }] } ]; FeatureGroupComponent.propDecorators = { layers: [{ type: core.ContentChildren, args: [BaseLayer,] }] }; return FeatureGroupComponent; }(BaseLayer)); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NglGroupsModule = /** @class */ (function () { function NglGroupsModule() { } NglGroupsModule.decorators = [ { type: core.NgModule, args: [{ imports: [ common.CommonModule ], declarations: [ FeatureGroupComponent ], exports: [ FeatureGroupComponent ] },] } ]; return NglGroupsModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ImageOverlayComponent = /** @class */ (function (_super) { __extends(ImageOverlayComponent, _super); function ImageOverlayComponent() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(ImageOverlayComponent.prototype, "src", { set: /** * @param {?} value * @return {?} */ function (value) { this._url = value; if (this.layerRef) { this.layerRef.setUrl(value); } else { this.prepareLayer(); } }, enumerable: true, configurable: true }); Object.defineProperty(ImageOverlayComponent.prototype, "width", { set: /** * @param {?} value * @return {?} */ function (value) { this._width = value; if (this.layerRef) { this.layerRef.setBounds(this.prepareBounds(this._width, this._height)); } else { this.prepareLayer(); } }, enumerable: true, configurable: true }); Object.defineProperty(ImageOverlayComponent.prototype, "height", { set: /** * @param {?} value * @return {?} */ function (value) { this._height = value; if (this.layerRef) { this.layerRef.setBounds(this.prepareBounds(this._width, this._height)); } else { this.prepareLayer(); } }, enumerable: true, configurable: true }); /** * @param {?} map * @return {?} */ ImageOverlayComponent.prototype.addTo = /** * @param {?} map * @return {?} */ function (map) { _super.prototype.addTo.call(this, map); this.prepareLayer(); }; /** * @return {?} */ ImageOverlayComponent.prototype.prepareLayer = /** * @return {?} */ function () { if (this.mapRef && this._url && this._height && this._width) { this.layerRef = leaflet.imageOverlay(this._url, this.prepareBounds(this._width, this._height)); this.mapRef.addLayer(this.layerRef); this.initHandlers(); } }; /** * @private * @param {?} width * @param {?} height * @return {?} */ ImageOverlayComponent.prototype.prepareBounds = /** * @private * @param {?} width * @param {?} height * @return {?} */ function (width, height) { /** @type {?} */ var southWest = ((/** @type {?} */ (this.mapRef))).unproject([0, height * 2], 1); /** @type {?} */ var northEast = ((/** @type {?} */ (this.mapRef))).unproject([width * 2, 0], 1); return leaflet.latLngBounds(southWest, northEast); }; ImageOverlayComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngl-image-overlay', template: '', providers: [{ provide: BaseLayer, useExisting: core.forwardRef((/** * @return {?} */ function () { return ImageOverlayComponent; })) }] }] } ]; ImageOverlayComponent.propDecorators = { src: [{ type: core.Input }], width: [{ type: core.Input }], height: [{ type: core.Input }] }; return ImageOverlayComponent; }(BaseLayer)); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NglImageOverlayModule = /** @class */ (function () { function NglImageOverlayModule() { } NglImageOverlayModule.decorators = [ { type: core.NgModule, args: [{ imports: [ common.CommonModule ], declarations: [ ImageOverlayComponent ], exports: [ ImageOverlayComponent ] },] } ]; return NglImageOverlayModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var MarkerComponent = /** @class */ (function (_super) { __extends(MarkerComponent, _super); function MarkerComponent() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(MarkerComponent.prototype, "latLng", { set: /** * @param {?} value * @return {?} */ function (value) { this._latLng = value; this.prepareLayer(); }, enumerable: true, configurable: true }); /** * @private * @return {?} */ MarkerComponent.prototype.prepareLayer = /** * @private * @return {?} */ function () { if (this.mapRef && this._latLng) { if (this.layerRef) { this.layerRef.setLatLng(this._latLng); } else { this.createLayer(); } } }; /** * @private * @return {?} */ MarkerComponent.prototype.createLayer = /** * @private * @return {?} */ function () { this.layerRef = leaflet.marker(this._latLng, { icon: leaflet.divIcon() }); this.mapRef.addLayer(this.layerRef); this.initHandlers(); }; /** * @param {?} map * @return {?} */ MarkerComponent.prototype.addTo = /** * @param {?} map * @return {?} */ function (map) { _super.prototype.addTo.call(this, map); this.prepareLayer(); }; MarkerComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngl-marker', template: '', providers: [{ provide: BaseLayer, useExisting: core.forwardRef((/** * @return {?} */ function () { return MarkerComponent; })) }] }] } ]; MarkerComponent.propDecorators = { latLng: [{ type: core.Input }] }; return MarkerComponent; }(BaseLayer)); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NglMarkerModule = /** @class */ (function () { function NglMarkerModule() { } NglMarkerModule.decorators = [ { type: core.NgModule, args: [{ imports: [ common.CommonModule ], declarations: [ MarkerComponent ], exports: [ MarkerComponent ] },] } ]; return NglMarkerModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var TileLayerComponent = /** @class */ (function (_super) { __extends(TileLayerComponent, _super); function TileLayerComponent() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} map * @return {?} */ TileLayerComponent.prototype.addTo = /** * @param {?} map * @return {?} */ function (map) { _super.prototype.addTo.call(this, map); if (!this.layerRef) { this.layerRef = leaflet.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'); this.mapRef.addLayer(this.layerRef); this.initHandlers(); } }; TileLayerComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngl-tile-layer', template: '', providers: [{ provide: BaseLayer, useExisting: core.forwardRef((/** * @return {?} */ function () { return TileLayerComponent; })) }] }] } ]; return TileLayerComponent; }(BaseLayer)); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NglTileLayerModule = /** @class */ (function () { function NglTileLayerModule() { } NglTileLayerModule.decorators = [ { type: core.NgModule, args: [{ imports: [ common.CommonModule ], declarations: [ TileLayerComponent ], exports: [ TileLayerComponent ] },] } ]; return NglTileLayerModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var PolygonComponent = /** @class */ (function (_super) { __extends(PolygonComponent, _super); function PolygonComponent() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(PolygonComponent.prototype, "coordinates", { set: /** * @param {?} value * @return {?} */ function (value) { this._coordinates = value; if (this.layerRef) { this.layerRef.setLatLngs(value); } else { this.createLayer(); } }, enumerable: true, configurable: true }); Object.defineProperty(PolygonComponent.prototype, "options", { set: /** * @param {?} value * @return {?} */ function (value) { this._options = value; if (this.layerRef) { this.layerRef.setStyle(value); } else { this.createLayer(); } }, enumerable: true, configurable: true }); /** * @return {?} */ PolygonComponent.prototype.createLayer = /** * @return {?} */ function () { if (this.mapRef && this._coordinates) { this.layerRef = leaflet.polygon(this._coordinates, __assign({}, this._options)); this.mapRef.addLayer(this.layerRef); this.initHandlers(); } }; /** * @param {?} map * @return {?} */ PolygonComponent.prototype.addTo = /** * @param {?} map * @return {?} */ function (map) { _super.prototype.addTo.call(this, map); if (!this.layerRef) { this.createLayer(); } }; PolygonComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngl-polygon', template: '', providers: [{ provide: BaseLayer, useExisting: core.forwardRef((/** * @return {?} */ function () { return PolygonComponent; })) }] }] } ]; PolygonComponent.propDecorators = { coordinates: [{ type: core.Input }], options: [{ type: core.Input }] }; return PolygonComponent; }(BaseLayer)); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var PolylineComponent = /** @class */ (function (_super) { __extends(PolylineComponent, _super); function PolylineComponent() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(PolylineComponent.prototype, "coordinates", { set: /** * @param {?} value * @return {?} */ function (value) { this._coordinates = value; if (this.layerRef) { this.layerRef.setLatLngs(value); } else { this.createLayer(); } }, enumerable: true, configurable: true }); Object.defineProperty(PolylineComponent.prototype, "options", { set: /** * @param {?} value * @return {?} */ function (value) { this._options = value; if (this.layerRef) { this.layerRef.setStyle(value); } else { this.createLayer(); } }, enumerable: true, configurable: true }); /** * @param {?} map * @return {?} */ PolylineComponent.prototype.addTo = /** * @param {?} map * @return {?} */ function (map) { _super.prototype.addTo.call(this, map); if (!this.layerRef && this._coordinates) { this.createLayer(); } }; /** * @private * @return {?} */ PolylineComponent.prototype.createLayer = /** * @private * @return {?} */ function () { if (this.mapRef && this._coordinates) { this.layerRef = leaflet.polyline(this._coordinates, __assign({}, this._options)); this.mapRef.addLayer(this.layerRef); this.initHandlers(); } }; PolylineComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngl-polyline', template: '', providers: [{ provide: BaseLayer, useExisting: core.forwardRef((/** * @return {?} */ function () { return PolylineComponent; })) }] }] } ]; PolylineComponent.propDecorators = { coordinates: [{ type: core.Input }], options: [{ type: core.Input }] }; return PolylineComponent; }(BaseLayer)); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var RectangleComponent = /** @class */ (function (_super) { __extends(RectangleComponent, _super); function RectangleComponent() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(RectangleComponent.prototype, "bounds", { set: /** * @param {?} value * @return {?} */ function (value) { this._bounds = value; if (this.layerRef) { this.layerRef.setBounds(value); } else { this.createLayer(); } }, enumerable: true, configurable: true }); Object.defineProperty(RectangleComponent.prototype, "options", { set: /** * @param {?} value * @return {?} */ function (value) { this._options = value; if (this.layerRef) { this.layerRef.setStyle(value); } else { this.createLayer(); } }, enumerable: true, configurable: true }); /** * @return {?} */ RectangleComponent.prototype.createLayer = /** * @return {?} */ function () { if (this.mapRef && this._bounds) { this.layerRef = leaflet.rectangle(this._bounds, __assign({}, this._options)); this.mapRef.addLayer(this.layerRef); this.initHandlers(); } }; /** * @param {?} map * @return {?} */ RectangleComponent.prototype.addTo = /** * @param {?} map * @return {?} */ function (map) { _super.prototype.addTo.call(this, map); if (!this.layerRef) { this.createLayer(); } }; RectangleComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngl-rectangle', template: '', providers: [{ provide: BaseLayer, useExisting: core.forwardRef((/** * @return {?} */ function () { return RectangleComponent; })) }] }] } ]; RectangleComponent.propDecorators = { bounds: [{ type: core.Input }], options: [{ type: core.Input }] }; return RectangleComponent; }(BaseLayer)); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CircleComponent = /** @class */ (function (_super) { __extends(CircleComponent, _super); function CircleComponent() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(CircleComponent.prototype, "center", { set: /** * @param {?} value * @return {?} */ function (value) { this._center = value; if (this.layerRef) { this.layerRef.setLatLng(value); } else { this.createLayer(); } }, enumerable: true, configurable: true }); Object.defineProperty(CircleComponent.prototype, "radius", { set: /** * @param {?} value * @return {?} */ function (value) { this._radius = value; if (this.layerRef) { this.layerRef.setRadius(value); } else { this.createLayer(); } }, enumerable: true, configurable: true }); Object.defineProperty(CircleComponent.prototype, "options", { set: /** * @param {?} value * @return {?} */ function (value) { this._options = value; if (this.layerRef) { this.layerRef.setStyle(value); } }, enumerable: true, configurable: true }); /** * @param {?} map * @return {?} */ CircleComponent.prototype.addTo = /** * @param {?} map * @return {?} */ function (map) { _super.prototype.addTo.call(this, map); if (!this.layerRef) { this.createLayer(); } }; /** * @private * @return {?} */ CircleComponent.prototype.createLayer = /** * @private * @return {?} */ function () { if (this.mapRef && this._center && this._radius) { this.layerRef = leaflet.circle(this._center, __assign({}, this._options, { radius: this._radius })); this.mapRef.addLayer(this.layerRef); this.initHandlers(); } }; CircleComponent.decorators = [ { type: core.Component, args: [{ selector: 'ngl-circle', template: '', providers: [{ provide: BaseLayer, useExisting: core.forwardRef((/** * @return {?} */ function () { return CircleComponent; })) }] }] } ]; CircleComponent.propDecorators = { center: [{ type: core.Input }], radius: [{ type: core.Input }], options: [{ type: core.Input }] }; return CircleComponent; }(BaseLayer)); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NglVectorsModule = /** @class */ (function () { function NglVectorsModule() { } NglVectorsModule.decorators = [ { type: core.NgModule, args: [{ imports: [ common.CommonModule ], declarations: [ PolygonComponent, PolylineComponent, RectangleComponent, CircleComponent ], exports: [ PolygonComponent, PolylineComponent, RectangleComponent, CircleComponent ] },] } ]; return NglVectorsModule; }()); exports.BaseLayer = BaseLayer; exports.CircleComponent = CircleComponent; exports.FeatureGroupComponent = FeatureGroupComponent; exports.ImageOverlayComponent = ImageOverlayComponent; exports.LayerHandler = LayerHandler; exports.LeafletComponent = LeafletComponent; exports.MapHandler = MapHandler; exports.MarkerComponent = MarkerComponent; exports.NglCoreModule = NglCoreModule; exports.NglGroupsModule = NglGroupsModule; exports.NglImageOverlayModule = NglImageOverlayModule; exports.NglMarkerModule = NglMarkerModule; exports.NglTileLayerModule = NglTileLayerModule; exports.NglVectorsModule = NglVectorsModule; exports.PolygonComponent = PolygonComponent; exports.PolylineComponent = PolylineComponent; exports.RectangleComponent = RectangleComponent; exports.TileLayerComponent = TileLayerComponent; Object.defineProperty(exports, '__esModule', { value: true }); })); //# sourceMappingURL=angular-leaflet.umd.js.map