UNPKG

angular2-google-maps

Version:

Angular 2 components for Google Maps

1 lines 155 kB
{"version":3,"file":"core.umd.js","sources":["../esm/core/services/maps-api-loader/maps-api-loader.js","../esm/core/services/google-maps-api-wrapper.js","../esm/core/services/managers/circle-manager.js","../esm/core/services/managers/marker-manager.js","../esm/core/services/managers/info-window-manager.js","../esm/core/services/managers/polygon-manager.js","../esm/core/services/managers/polyline-manager.js","../esm/core/services/managers/kml-layer-manager.js","../esm/core/directives/google-map.js","../esm/core/directives/google-map-circle.js","../esm/core/directives/google-map-info-window.js","../esm/core/directives/google-map-kml-layer.js","../esm/core/directives/google-map-marker.js","../esm/core/directives/google-map-polygon.js","../esm/core/directives/google-map-polyline-point.js","../esm/core/directives/google-map-polyline.js","../esm/core/utils/browser-globals.js","../esm/core/services/maps-api-loader/lazy-maps-api-loader.js","../esm/core/services/maps-api-loader/noop-maps-api-loader.js","../esm/core/map-types.js","../esm/core/core-module.js","../esm/core/index.js"],"sourcesContent":["import { Injectable } from '@angular/core';\nexport var MapsAPILoader = (function () {\n function MapsAPILoader() {\n }\n MapsAPILoader.decorators = [\n { type: Injectable },\n ];\n /** @nocollapse */\n MapsAPILoader.ctorParameters = function () { return []; };\n return MapsAPILoader;\n}());\n//# sourceMappingURL=maps-api-loader.js.map","import { Injectable, NgZone } from '@angular/core';\nimport { Observable } from 'rxjs/Observable';\nimport { MapsAPILoader } from './maps-api-loader/maps-api-loader';\n/**\n * Wrapper class that handles the communication with the Google Maps Javascript\n * API v3\n */\nexport var GoogleMapsAPIWrapper = (function () {\n function GoogleMapsAPIWrapper(_loader, _zone) {\n var _this = this;\n this._loader = _loader;\n this._zone = _zone;\n this._map =\n new Promise(function (resolve) { _this._mapResolver = resolve; });\n }\n GoogleMapsAPIWrapper.prototype.createMap = function (el, mapOptions) {\n var _this = this;\n return this._loader.load().then(function () {\n var map = new google.maps.Map(el, mapOptions);\n _this._mapResolver(map);\n return;\n });\n };\n GoogleMapsAPIWrapper.prototype.setMapOptions = function (options) {\n this._map.then(function (m) { m.setOptions(options); });\n };\n /**\n * Creates a google map marker with the map context\n */\n GoogleMapsAPIWrapper.prototype.createMarker = function (options) {\n if (options === void 0) { options = {}; }\n return this._map.then(function (map) {\n options.map = map;\n return new google.maps.Marker(options);\n });\n };\n GoogleMapsAPIWrapper.prototype.createInfoWindow = function (options) {\n return this._map.then(function () { return new google.maps.InfoWindow(options); });\n };\n /**\n * Creates a google.map.Circle for the current map.\n */\n GoogleMapsAPIWrapper.prototype.createCircle = function (options) {\n return this._map.then(function (map) {\n options.map = map;\n return new google.maps.Circle(options);\n });\n };\n GoogleMapsAPIWrapper.prototype.createPolyline = function (options) {\n return this.getNativeMap().then(function (map) {\n var line = new google.maps.Polyline(options);\n line.setMap(map);\n return line;\n });\n };\n GoogleMapsAPIWrapper.prototype.createPolygon = function (options) {\n return this.getNativeMap().then(function (map) {\n var polygon = new google.maps.Polygon(options);\n polygon.setMap(map);\n return polygon;\n });\n };\n /**\n * Determines if given coordinates are insite a Polygon path.\n */\n GoogleMapsAPIWrapper.prototype.containsLocation = function (latLng, polygon) {\n return google.maps.geometry.poly.containsLocation(latLng, polygon);\n };\n GoogleMapsAPIWrapper.prototype.subscribeToMapEvent = function (eventName) {\n var _this = this;\n return Observable.create(function (observer) {\n _this._map.then(function (m) {\n m.addListener(eventName, function (arg) { _this._zone.run(function () { return observer.next(arg); }); });\n });\n });\n };\n GoogleMapsAPIWrapper.prototype.setCenter = function (latLng) {\n return this._map.then(function (map) { return map.setCenter(latLng); });\n };\n GoogleMapsAPIWrapper.prototype.getZoom = function () { return this._map.then(function (map) { return map.getZoom(); }); };\n GoogleMapsAPIWrapper.prototype.getBounds = function () {\n return this._map.then(function (map) { return map.getBounds(); });\n };\n GoogleMapsAPIWrapper.prototype.setZoom = function (zoom) {\n return this._map.then(function (map) { return map.setZoom(zoom); });\n };\n GoogleMapsAPIWrapper.prototype.getCenter = function () {\n return this._map.then(function (map) { return map.getCenter(); });\n };\n GoogleMapsAPIWrapper.prototype.panTo = function (latLng) {\n return this._map.then(function (map) { return map.panTo(latLng); });\n };\n GoogleMapsAPIWrapper.prototype.fitBounds = function (latLng) {\n return this._map.then(function (map) { return map.fitBounds(latLng); });\n };\n GoogleMapsAPIWrapper.prototype.panToBounds = function (latLng) {\n return this._map.then(function (map) { return map.panToBounds(latLng); });\n };\n /**\n * Returns the native Google Maps Map instance. Be careful when using this instance directly.\n */\n GoogleMapsAPIWrapper.prototype.getNativeMap = function () { return this._map; };\n /**\n * Triggers the given event name on the map instance.\n */\n GoogleMapsAPIWrapper.prototype.triggerMapEvent = function (eventName) {\n return this._map.then(function (m) { return google.maps.event.trigger(m, eventName); });\n };\n GoogleMapsAPIWrapper.decorators = [\n { type: Injectable },\n ];\n /** @nocollapse */\n GoogleMapsAPIWrapper.ctorParameters = function () { return [\n { type: MapsAPILoader, },\n { type: NgZone, },\n ]; };\n return GoogleMapsAPIWrapper;\n}());\n//# sourceMappingURL=google-maps-api-wrapper.js.map","import { Injectable, NgZone } from '@angular/core';\nimport { Observable } from 'rxjs/Observable';\nimport { GoogleMapsAPIWrapper } from '../google-maps-api-wrapper';\nexport var CircleManager = (function () {\n function CircleManager(_apiWrapper, _zone) {\n this._apiWrapper = _apiWrapper;\n this._zone = _zone;\n this._circles = new Map();\n }\n CircleManager.prototype.addCircle = function (circle) {\n this._circles.set(circle, this._apiWrapper.createCircle({\n center: { lat: circle.latitude, lng: circle.longitude },\n clickable: circle.clickable,\n draggable: circle.draggable,\n editable: circle.editable,\n fillColor: circle.fillColor,\n fillOpacity: circle.fillOpacity,\n radius: circle.radius,\n strokeColor: circle.strokeColor,\n strokeOpacity: circle.strokeOpacity,\n strokePosition: circle.strokePosition,\n strokeWeight: circle.strokeWeight,\n visible: circle.visible,\n zIndex: circle.zIndex\n }));\n };\n ;\n /**\n * Removes the given circle from the map.\n */\n CircleManager.prototype.removeCircle = function (circle) {\n var _this = this;\n return this._circles.get(circle).then(function (c) {\n c.setMap(null);\n _this._circles.delete(circle);\n });\n };\n CircleManager.prototype.setOptions = function (circle, options) {\n return this._circles.get(circle).then(function (c) { return c.setOptions(options); });\n };\n ;\n CircleManager.prototype.getBounds = function (circle) {\n return this._circles.get(circle).then(function (c) { return c.getBounds(); });\n };\n ;\n CircleManager.prototype.getCenter = function (circle) {\n return this._circles.get(circle).then(function (c) { return c.getCenter(); });\n };\n ;\n CircleManager.prototype.getRadius = function (circle) {\n return this._circles.get(circle).then(function (c) { return c.getRadius(); });\n };\n CircleManager.prototype.setCenter = function (circle) {\n return this._circles.get(circle).then(function (c) { return c.setCenter({ lat: circle.latitude, lng: circle.longitude }); });\n };\n ;\n CircleManager.prototype.setEditable = function (circle) {\n return this._circles.get(circle).then(function (c) { return c.setEditable(circle.editable); });\n };\n ;\n CircleManager.prototype.setDraggable = function (circle) {\n return this._circles.get(circle).then(function (c) { return c.setDraggable(circle.draggable); });\n };\n ;\n CircleManager.prototype.setVisible = function (circle) {\n return this._circles.get(circle).then(function (c) { return c.setVisible(circle.visible); });\n };\n ;\n CircleManager.prototype.setRadius = function (circle) {\n return this._circles.get(circle).then(function (c) { return c.setRadius(circle.radius); });\n };\n ;\n CircleManager.prototype.createEventObservable = function (eventName, circle) {\n var _this = this;\n return Observable.create(function (observer) {\n var listener = null;\n _this._circles.get(circle).then(function (c) {\n listener = c.addListener(eventName, function (e) { return _this._zone.run(function () { return observer.next(e); }); });\n });\n return function () {\n if (listener !== null) {\n listener.remove();\n }\n };\n });\n };\n CircleManager.decorators = [\n { type: Injectable },\n ];\n /** @nocollapse */\n CircleManager.ctorParameters = function () { return [\n { type: GoogleMapsAPIWrapper, },\n { type: NgZone, },\n ]; };\n return CircleManager;\n}());\n//# sourceMappingURL=circle-manager.js.map","import { Injectable, NgZone } from '@angular/core';\nimport { Observable } from 'rxjs/Observable';\nimport { GoogleMapsAPIWrapper } from './../google-maps-api-wrapper';\nexport var MarkerManager = (function () {\n function MarkerManager(_mapsWrapper, _zone) {\n this._mapsWrapper = _mapsWrapper;\n this._zone = _zone;\n this._markers = new Map();\n }\n MarkerManager.prototype.deleteMarker = function (marker) {\n var _this = this;\n var m = this._markers.get(marker);\n if (m == null) {\n // marker already deleted\n return Promise.resolve();\n }\n return m.then(function (m) {\n return _this._zone.run(function () {\n m.setMap(null);\n _this._markers.delete(marker);\n });\n });\n };\n MarkerManager.prototype.updateMarkerPosition = function (marker) {\n return this._markers.get(marker).then(function (m) { return m.setPosition({ lat: marker.latitude, lng: marker.longitude }); });\n };\n MarkerManager.prototype.updateTitle = function (marker) {\n return this._markers.get(marker).then(function (m) { return m.setTitle(marker.title); });\n };\n MarkerManager.prototype.updateLabel = function (marker) {\n return this._markers.get(marker).then(function (m) { m.setLabel(marker.label); });\n };\n MarkerManager.prototype.updateDraggable = function (marker) {\n return this._markers.get(marker).then(function (m) { return m.setDraggable(marker.draggable); });\n };\n MarkerManager.prototype.updateIcon = function (marker) {\n return this._markers.get(marker).then(function (m) { return m.setIcon(marker.iconUrl); });\n };\n MarkerManager.prototype.updateOpacity = function (marker) {\n return this._markers.get(marker).then(function (m) { return m.setOpacity(marker.opacity); });\n };\n MarkerManager.prototype.updateVisible = function (marker) {\n return this._markers.get(marker).then(function (m) { return m.setVisible(marker.visible); });\n };\n MarkerManager.prototype.updateZIndex = function (marker) {\n return this._markers.get(marker).then(function (m) { return m.setZIndex(marker.zIndex); });\n };\n MarkerManager.prototype.addMarker = function (marker) {\n var markerPromise = this._mapsWrapper.createMarker({\n position: { lat: marker.latitude, lng: marker.longitude },\n label: marker.label,\n draggable: marker.draggable,\n icon: marker.iconUrl,\n opacity: marker.opacity,\n visible: marker.visible,\n zIndex: marker.zIndex,\n title: marker.title\n });\n this._markers.set(marker, markerPromise);\n };\n MarkerManager.prototype.getNativeMarker = function (marker) {\n return this._markers.get(marker);\n };\n MarkerManager.prototype.createEventObservable = function (eventName, marker) {\n var _this = this;\n return Observable.create(function (observer) {\n _this._markers.get(marker).then(function (m) {\n m.addListener(eventName, function (e) { return _this._zone.run(function () { return observer.next(e); }); });\n });\n });\n };\n MarkerManager.decorators = [\n { type: Injectable },\n ];\n /** @nocollapse */\n MarkerManager.ctorParameters = function () { return [\n { type: GoogleMapsAPIWrapper, },\n { type: NgZone, },\n ]; };\n return MarkerManager;\n}());\n//# sourceMappingURL=marker-manager.js.map","import { Observable } from 'rxjs/Observable';\nimport { Injectable, NgZone } from '@angular/core';\nimport { GoogleMapsAPIWrapper } from '../google-maps-api-wrapper';\nimport { MarkerManager } from './marker-manager';\nexport var InfoWindowManager = (function () {\n function InfoWindowManager(_mapsWrapper, _zone, _markerManager) {\n this._mapsWrapper = _mapsWrapper;\n this._zone = _zone;\n this._markerManager = _markerManager;\n this._infoWindows = new Map();\n }\n InfoWindowManager.prototype.deleteInfoWindow = function (infoWindow) {\n var _this = this;\n var iWindow = this._infoWindows.get(infoWindow);\n if (iWindow == null) {\n // info window already deleted\n return Promise.resolve();\n }\n return iWindow.then(function (i) {\n return _this._zone.run(function () {\n i.close();\n _this._infoWindows.delete(infoWindow);\n });\n });\n };\n InfoWindowManager.prototype.setPosition = function (infoWindow) {\n return this._infoWindows.get(infoWindow).then(function (i) { return i.setPosition({\n lat: infoWindow.latitude,\n lng: infoWindow.longitude\n }); });\n };\n InfoWindowManager.prototype.setZIndex = function (infoWindow) {\n return this._infoWindows.get(infoWindow)\n .then(function (i) { return i.setZIndex(infoWindow.zIndex); });\n };\n InfoWindowManager.prototype.open = function (infoWindow) {\n var _this = this;\n return this._infoWindows.get(infoWindow).then(function (w) {\n if (infoWindow.hostMarker != null) {\n return _this._markerManager.getNativeMarker(infoWindow.hostMarker).then(function (marker) {\n return _this._mapsWrapper.getNativeMap().then(function (map) { return w.open(map, marker); });\n });\n }\n return _this._mapsWrapper.getNativeMap().then(function (map) { return w.open(map); });\n });\n };\n InfoWindowManager.prototype.close = function (infoWindow) {\n return this._infoWindows.get(infoWindow).then(function (w) { return w.close(); });\n };\n InfoWindowManager.prototype.setOptions = function (infoWindow, options) {\n return this._infoWindows.get(infoWindow).then(function (i) { return i.setOptions(options); });\n };\n InfoWindowManager.prototype.addInfoWindow = function (infoWindow) {\n var options = {\n content: infoWindow.content,\n maxWidth: infoWindow.maxWidth,\n zIndex: infoWindow.zIndex,\n };\n if (typeof infoWindow.latitude === 'number' && typeof infoWindow.longitude === 'number') {\n options.position = { lat: infoWindow.latitude, lng: infoWindow.longitude };\n }\n var infoWindowPromise = this._mapsWrapper.createInfoWindow(options);\n this._infoWindows.set(infoWindow, infoWindowPromise);\n };\n /**\n * Creates a Google Maps event listener for the given InfoWindow as an Observable\n */\n InfoWindowManager.prototype.createEventObservable = function (eventName, infoWindow) {\n var _this = this;\n return Observable.create(function (observer) {\n _this._infoWindows.get(infoWindow).then(function (i) {\n i.addListener(eventName, function (e) { return _this._zone.run(function () { return observer.next(e); }); });\n });\n });\n };\n InfoWindowManager.decorators = [\n { type: Injectable },\n ];\n /** @nocollapse */\n InfoWindowManager.ctorParameters = function () { return [\n { type: GoogleMapsAPIWrapper, },\n { type: NgZone, },\n { type: MarkerManager, },\n ]; };\n return InfoWindowManager;\n}());\n//# sourceMappingURL=info-window-manager.js.map","import { Injectable, NgZone } from '@angular/core';\nimport { Observable } from 'rxjs/Observable';\nimport { GoogleMapsAPIWrapper } from '../google-maps-api-wrapper';\nexport var PolygonManager = (function () {\n function PolygonManager(_mapsWrapper, _zone) {\n this._mapsWrapper = _mapsWrapper;\n this._zone = _zone;\n this._polygons = new Map();\n }\n PolygonManager.prototype.addPolygon = function (path) {\n var polygonPromise = this._mapsWrapper.createPolygon({\n clickable: path.clickable,\n draggable: path.draggable,\n editable: path.editable,\n fillColor: path.fillColor,\n fillOpacity: path.fillOpacity,\n geodesic: path.geodesic,\n paths: path.paths,\n strokeColor: path.strokeColor,\n strokeOpacity: path.strokeOpacity,\n strokeWeight: path.strokeWeight,\n visible: path.visible,\n zIndex: path.zIndex,\n });\n this._polygons.set(path, polygonPromise);\n };\n PolygonManager.prototype.updatePolygon = function (polygon) {\n var _this = this;\n var m = this._polygons.get(polygon);\n if (m == null) {\n return Promise.resolve();\n }\n return m.then(function (l) { return _this._zone.run(function () { l.setPaths(polygon.paths); }); });\n };\n PolygonManager.prototype.setPolygonOptions = function (path, options) {\n return this._polygons.get(path).then(function (l) { l.setOptions(options); });\n };\n PolygonManager.prototype.deletePolygon = function (paths) {\n var _this = this;\n var m = this._polygons.get(paths);\n if (m == null) {\n return Promise.resolve();\n }\n return m.then(function (l) {\n return _this._zone.run(function () {\n l.setMap(null);\n _this._polygons.delete(paths);\n });\n });\n };\n PolygonManager.prototype.createEventObservable = function (eventName, path) {\n var _this = this;\n return Observable.create(function (observer) {\n _this._polygons.get(path).then(function (l) {\n l.addListener(eventName, function (e) { return _this._zone.run(function () { return observer.next(e); }); });\n });\n });\n };\n PolygonManager.decorators = [\n { type: Injectable },\n ];\n /** @nocollapse */\n PolygonManager.ctorParameters = function () { return [\n { type: GoogleMapsAPIWrapper, },\n { type: NgZone, },\n ]; };\n return PolygonManager;\n}());\n//# sourceMappingURL=polygon-manager.js.map","import { Injectable, NgZone } from '@angular/core';\nimport { Observable } from 'rxjs/Observable';\nimport { GoogleMapsAPIWrapper } from '../google-maps-api-wrapper';\nexport var PolylineManager = (function () {\n function PolylineManager(_mapsWrapper, _zone) {\n this._mapsWrapper = _mapsWrapper;\n this._zone = _zone;\n this._polylines = new Map();\n }\n PolylineManager._convertPoints = function (line) {\n var path = line._getPoints().map(function (point) {\n return { lat: point.latitude, lng: point.longitude };\n });\n return path;\n };\n PolylineManager.prototype.addPolyline = function (line) {\n var path = PolylineManager._convertPoints(line);\n var polylinePromise = this._mapsWrapper.createPolyline({\n clickable: line.clickable,\n draggable: line.draggable,\n editable: line.editable,\n geodesic: line.geodesic,\n strokeColor: line.strokeColor,\n strokeOpacity: line.strokeOpacity,\n strokeWeight: line.strokeWeight,\n visible: line.visible,\n zIndex: line.zIndex,\n path: path\n });\n this._polylines.set(line, polylinePromise);\n };\n PolylineManager.prototype.updatePolylinePoints = function (line) {\n var _this = this;\n var path = PolylineManager._convertPoints(line);\n var m = this._polylines.get(line);\n if (m == null) {\n return Promise.resolve();\n }\n return m.then(function (l) { return _this._zone.run(function () { l.setPath(path); }); });\n };\n PolylineManager.prototype.setPolylineOptions = function (line, options) {\n return this._polylines.get(line).then(function (l) { l.setOptions(options); });\n };\n PolylineManager.prototype.deletePolyline = function (line) {\n var _this = this;\n var m = this._polylines.get(line);\n if (m == null) {\n return Promise.resolve();\n }\n return m.then(function (l) {\n return _this._zone.run(function () {\n l.setMap(null);\n _this._polylines.delete(line);\n });\n });\n };\n PolylineManager.prototype.createEventObservable = function (eventName, line) {\n var _this = this;\n return Observable.create(function (observer) {\n _this._polylines.get(line).then(function (l) {\n l.addListener(eventName, function (e) { return _this._zone.run(function () { return observer.next(e); }); });\n });\n });\n };\n PolylineManager.decorators = [\n { type: Injectable },\n ];\n /** @nocollapse */\n PolylineManager.ctorParameters = function () { return [\n { type: GoogleMapsAPIWrapper, },\n { type: NgZone, },\n ]; };\n return PolylineManager;\n}());\n//# sourceMappingURL=polyline-manager.js.map","import { Injectable, NgZone } from '@angular/core';\nimport { Observable } from 'rxjs/Observable';\nimport { GoogleMapsAPIWrapper } from './../google-maps-api-wrapper';\n/**\n * Manages all KML Layers for a Google Map instance.\n */\nexport var KmlLayerManager = (function () {\n function KmlLayerManager(_wrapper, _zone) {\n this._wrapper = _wrapper;\n this._zone = _zone;\n this._layers = new Map();\n }\n /**\n * Adds a new KML Layer to the map.\n */\n KmlLayerManager.prototype.addKmlLayer = function (layer) {\n var newLayer = this._wrapper.getNativeMap().then(function (m) {\n return new google.maps.KmlLayer({\n clickable: layer.clickable,\n map: m,\n preserveViewport: layer.preserveViewport,\n screenOverlays: layer.screenOverlays,\n suppressInfoWindows: layer.suppressInfoWindows,\n url: layer.url,\n zIndex: layer.zIndex\n });\n });\n this._layers.set(layer, newLayer);\n };\n KmlLayerManager.prototype.setOptions = function (layer, options) {\n this._layers.get(layer).then(function (l) { return l.setOptions(options); });\n };\n KmlLayerManager.prototype.deleteKmlLayer = function (layer) {\n var _this = this;\n this._layers.get(layer).then(function (l) {\n l.setMap(null);\n _this._layers.delete(layer);\n });\n };\n /**\n * Creates a Google Maps event listener for the given KmlLayer as an Observable\n */\n KmlLayerManager.prototype.createEventObservable = function (eventName, layer) {\n var _this = this;\n return Observable.create(function (observer) {\n _this._layers.get(layer).then(function (m) {\n m.addListener(eventName, function (e) { return _this._zone.run(function () { return observer.next(e); }); });\n });\n });\n };\n KmlLayerManager.decorators = [\n { type: Injectable },\n ];\n /** @nocollapse */\n KmlLayerManager.ctorParameters = function () { return [\n { type: GoogleMapsAPIWrapper, },\n { type: NgZone, },\n ]; };\n return KmlLayerManager;\n}());\n//# sourceMappingURL=kml-layer-manager.js.map","import { Component, ElementRef, EventEmitter } from '@angular/core';\nimport { GoogleMapsAPIWrapper } from '../services/google-maps-api-wrapper';\nimport { CircleManager } from '../services/managers/circle-manager';\nimport { InfoWindowManager } from '../services/managers/info-window-manager';\nimport { MarkerManager } from '../services/managers/marker-manager';\nimport { PolygonManager } from '../services/managers/polygon-manager';\nimport { PolylineManager } from '../services/managers/polyline-manager';\nimport { KmlLayerManager } from './../services/managers/kml-layer-manager';\n/**\n * SebMGoogleMap renders a Google Map.\n * **Important note**: To be able see a map in the browser, you have to define a height for the CSS\n * class `sebm-google-map-container`.\n *\n * ### Example\n * ```typescript\n * import { Component } from '@angular/core';\n * import { SebmGoogleMap } from 'angular2-google-maps/core';\n *\n * @Component({\n * selector: 'my-map-cmp',\n * directives: [SebmGoogleMap],\n * styles: [`\n * .sebm-google-map-container {\n * height: 300px;\n * }\n * `],\n * template: `\n * <sebm-google-map [latitude]=\"lat\" [longitude]=\"lng\" [zoom]=\"zoom\">\n * </sebm-google-map>\n * `\n * })\n * ```\n */\nexport var SebmGoogleMap = (function () {\n function SebmGoogleMap(_elem, _mapsWrapper) {\n this._elem = _elem;\n this._mapsWrapper = _mapsWrapper;\n /**\n * The longitude that defines the center of the map.\n */\n this.longitude = 0;\n /**\n * The latitude that defines the center of the map.\n */\n this.latitude = 0;\n /**\n * The zoom level of the map. The default zoom level is 8.\n */\n this.zoom = 8;\n /**\n * Enables/disables if map is draggable.\n */\n this.draggable = true;\n /**\n * Enables/disables zoom and center on double click. Enabled by default.\n */\n this.disableDoubleClickZoom = false;\n /**\n * Enables/disables all default UI of the Google map. Please note: When the map is created, this\n * value cannot get updated.\n */\n this.disableDefaultUI = false;\n /**\n * If false, disables scrollwheel zooming on the map. The scrollwheel is enabled by default.\n */\n this.scrollwheel = true;\n /**\n * If false, prevents the map from being controlled by the keyboard. Keyboard shortcuts are\n * enabled by default.\n */\n this.keyboardShortcuts = true;\n /**\n * The enabled/disabled state of the Zoom control.\n */\n this.zoomControl = true;\n /**\n * Styles to apply to each of the default map types. Note that for Satellite/Hybrid and Terrain\n * modes, these styles will only apply to labels and geometry.\n */\n this.styles = [];\n /**\n * When true and the latitude and/or longitude values changes, the Google Maps panTo method is\n * used to\n * center the map. See: https://developers.google.com/maps/documentation/javascript/reference#Map\n */\n this.usePanning = false;\n /**\n * The initial enabled/disabled state of the Street View Pegman control.\n * This control is part of the default UI, and should be set to false when displaying a map type\n * on which the Street View road overlay should not appear (e.g. a non-Earth map type).\n */\n this.streetViewControl = true;\n /**\n * Sets the viewport to contain the given bounds.\n */\n this.fitBounds = null;\n /**\n * The initial enabled/disabled state of the Scale control. This is disabled by default.\n */\n this.scaleControl = false;\n /**\n * The initial enabled/disabled state of the Map type control.\n */\n this.mapTypeControl = false;\n this._observableSubscriptions = [];\n /**\n * This event emitter gets emitted when the user clicks on the map (but not when they click on a\n * marker or infoWindow).\n */\n this.mapClick = new EventEmitter();\n /**\n * This event emitter gets emitted when the user right-clicks on the map (but not when they click\n * on a marker or infoWindow).\n */\n this.mapRightClick = new EventEmitter();\n /**\n * This event emitter gets emitted when the user double-clicks on the map (but not when they click\n * on a marker or infoWindow).\n */\n this.mapDblClick = new EventEmitter();\n /**\n * This event emitter is fired when the map center changes.\n */\n this.centerChange = new EventEmitter();\n /**\n * This event is fired when the viewport bounds have changed.\n */\n this.boundsChange = new EventEmitter();\n /**\n * This event is fired when the map becomes idle after panning or zooming.\n */\n this.idle = new EventEmitter();\n /**\n * This event is fired when the zoom level has changed.\n */\n this.zoomChange = new EventEmitter();\n }\n /** @internal */\n SebmGoogleMap.prototype.ngOnInit = function () {\n // todo: this should be solved with a new component and a viewChild decorator\n var container = this._elem.nativeElement.querySelector('.sebm-google-map-container-inner');\n this._initMapInstance(container);\n };\n SebmGoogleMap.prototype._initMapInstance = function (el) {\n this._mapsWrapper.createMap(el, {\n center: { lat: this.latitude || 0, lng: this.longitude || 0 },\n zoom: this.zoom,\n minZoom: this.minZoom,\n maxZoom: this.maxZoom,\n disableDefaultUI: this.disableDefaultUI,\n backgroundColor: this.backgroundColor,\n draggable: this.draggable,\n draggableCursor: this.draggableCursor,\n draggingCursor: this.draggingCursor,\n keyboardShortcuts: this.keyboardShortcuts,\n zoomControl: this.zoomControl,\n styles: this.styles,\n streetViewControl: this.streetViewControl,\n scaleControl: this.scaleControl,\n mapTypeControl: this.mapTypeControl\n });\n // register event listeners\n this._handleMapCenterChange();\n this._handleMapZoomChange();\n this._handleMapMouseEvents();\n this._handleBoundsChange();\n this._handleIdleEvent();\n };\n /** @internal */\n SebmGoogleMap.prototype.ngOnDestroy = function () {\n // unsubscribe all registered observable subscriptions\n this._observableSubscriptions.forEach(function (s) { return s.unsubscribe(); });\n };\n /* @internal */\n SebmGoogleMap.prototype.ngOnChanges = function (changes) {\n this._updateMapOptionsChanges(changes);\n this._updatePosition(changes);\n };\n SebmGoogleMap.prototype._updateMapOptionsChanges = function (changes) {\n var options = {};\n var optionKeys = Object.keys(changes).filter(function (k) { return SebmGoogleMap._mapOptionsAttributes.indexOf(k) !== -1; });\n optionKeys.forEach(function (k) { options[k] = changes[k].currentValue; });\n this._mapsWrapper.setMapOptions(options);\n };\n /**\n * Triggers a resize event on the google map instance.\n * Returns a promise that gets resolved after the event was triggered.\n */\n SebmGoogleMap.prototype.triggerResize = function () {\n var _this = this;\n // Note: When we would trigger the resize event and show the map in the same turn (which is a\n // common case for triggering a resize event), then the resize event would not\n // work (to show the map), so we trigger the event in a timeout.\n return new Promise(function (resolve) {\n setTimeout(function () { return _this._mapsWrapper.triggerMapEvent('resize').then(function () { return resolve(); }); });\n });\n };\n SebmGoogleMap.prototype._updatePosition = function (changes) {\n if (changes['latitude'] == null && changes['longitude'] == null &&\n changes['fitBounds'] == null) {\n // no position update needed\n return;\n }\n // we prefer fitBounds in changes\n if (changes['fitBounds'] && this.fitBounds != null) {\n this._fitBounds();\n return;\n }\n if (typeof this.latitude !== 'number' || typeof this.longitude !== 'number') {\n return;\n }\n var newCenter = {\n lat: this.latitude,\n lng: this.longitude,\n };\n if (this.usePanning) {\n this._mapsWrapper.panTo(newCenter);\n }\n else {\n this._mapsWrapper.setCenter(newCenter);\n }\n };\n SebmGoogleMap.prototype._fitBounds = function () {\n if (this.usePanning) {\n this._mapsWrapper.panToBounds(this.fitBounds);\n return;\n }\n this._mapsWrapper.fitBounds(this.fitBounds);\n };\n SebmGoogleMap.prototype._handleMapCenterChange = function () {\n var _this = this;\n var s = this._mapsWrapper.subscribeToMapEvent('center_changed').subscribe(function () {\n _this._mapsWrapper.getCenter().then(function (center) {\n _this.latitude = center.lat();\n _this.longitude = center.lng();\n _this.centerChange.emit({ lat: _this.latitude, lng: _this.longitude });\n });\n });\n this._observableSubscriptions.push(s);\n };\n SebmGoogleMap.prototype._handleBoundsChange = function () {\n var _this = this;\n var s = this._mapsWrapper.subscribeToMapEvent('bounds_changed').subscribe(function () {\n _this._mapsWrapper.getBounds().then(function (bounds) { _this.boundsChange.emit(bounds); });\n });\n this._observableSubscriptions.push(s);\n };\n SebmGoogleMap.prototype._handleMapZoomChange = function () {\n var _this = this;\n var s = this._mapsWrapper.subscribeToMapEvent('zoom_changed').subscribe(function () {\n _this._mapsWrapper.getZoom().then(function (z) {\n _this.zoom = z;\n _this.zoomChange.emit(z);\n });\n });\n this._observableSubscriptions.push(s);\n };\n SebmGoogleMap.prototype._handleIdleEvent = function () {\n var _this = this;\n var s = this._mapsWrapper.subscribeToMapEvent('idle').subscribe(function () { _this.idle.emit(void 0); });\n this._observableSubscriptions.push(s);\n };\n SebmGoogleMap.prototype._handleMapMouseEvents = function () {\n var _this = this;\n var events = [\n { name: 'click', emitter: this.mapClick },\n { name: 'rightclick', emitter: this.mapRightClick },\n ];\n events.forEach(function (e) {\n var s = _this._mapsWrapper.subscribeToMapEvent(e.name).subscribe(function (event) {\n var value = { coords: { lat: event.latLng.lat(), lng: event.latLng.lng() } };\n e.emitter.emit(value);\n });\n _this._observableSubscriptions.push(s);\n });\n };\n /**\n * Map option attributes that can change over time\n */\n SebmGoogleMap._mapOptionsAttributes = [\n 'disableDoubleClickZoom', 'scrollwheel', 'draggable', 'draggableCursor', 'draggingCursor',\n 'keyboardShortcuts', 'zoomControl', 'styles', 'streetViewControl', 'zoom', 'mapTypeControl',\n 'minZoom', 'maxZoom'\n ];\n SebmGoogleMap.decorators = [\n { type: Component, args: [{\n selector: 'sebm-google-map',\n providers: [\n GoogleMapsAPIWrapper, MarkerManager, InfoWindowManager, CircleManager, PolylineManager,\n PolygonManager, KmlLayerManager\n ],\n inputs: [\n 'longitude', 'latitude', 'zoom', 'minZoom', 'maxZoom', 'draggable: mapDraggable',\n 'disableDoubleClickZoom', 'disableDefaultUI', 'scrollwheel', 'backgroundColor', 'draggableCursor',\n 'draggingCursor', 'keyboardShortcuts', 'zoomControl', 'styles', 'usePanning', 'streetViewControl',\n 'fitBounds', 'scaleControl', 'mapTypeControl'\n ],\n outputs: [\n 'mapClick', 'mapRightClick', 'mapDblClick', 'centerChange', 'idle', 'boundsChange', 'zoomChange'\n ],\n host: { '[class.sebm-google-map-container]': 'true' },\n styles: [\"\\n .sebm-google-map-container-inner {\\n width: inherit;\\n height: inherit;\\n }\\n .sebm-google-map-content {\\n display:none;\\n }\\n \"],\n template: \"\\n <div class='sebm-google-map-container-inner'></div>\\n <div class='sebm-google-map-content'>\\n <ng-content></ng-content>\\n </div>\\n \"\n },] },\n ];\n /** @nocollapse */\n SebmGoogleMap.ctorParameters = function () { return [\n { type: ElementRef, },\n { type: GoogleMapsAPIWrapper, },\n ]; };\n return SebmGoogleMap;\n}());\n//# sourceMappingURL=google-map.js.map","import { Directive, EventEmitter } from '@angular/core';\nimport { CircleManager } from '../services/managers/circle-manager';\nexport var SebmGoogleMapCircle = (function () {\n function SebmGoogleMapCircle(_manager) {\n this._manager = _manager;\n /**\n * Indicates whether this Circle handles mouse events. Defaults to true.\n */\n this.clickable = true;\n /**\n * If set to true, the user can drag this circle over the map. Defaults to false.\n */\n this.draggable = false;\n /**\n * If set to true, the user can edit this circle by dragging the control points shown at\n * the center and around the circumference of the circle. Defaults to false.\n */\n this.editable = false;\n /**\n * The radius in meters on the Earth's surface.\n */\n this.radius = 0;\n /**\n * The stroke position. Defaults to CENTER.\n * This property is not supported on Internet Explorer 8 and earlier.\n */\n this.strokePosition = 'CENTER';\n /**\n * The stroke width in pixels.\n */\n this.strokeWeight = 0;\n /**\n * Whether this circle is visible on the map. Defaults to true.\n */\n this.visible = true;\n /**\n * This event is fired when the circle's center is changed.\n */\n this.centerChange = new EventEmitter();\n /**\n * This event emitter gets emitted when the user clicks on the circle.\n */\n this.circleClick = new EventEmitter();\n /**\n * This event emitter gets emitted when the user clicks on the circle.\n */\n this.circleDblClick = new EventEmitter();\n /**\n * This event is repeatedly fired while the user drags the circle.\n */\n this.drag = new EventEmitter();\n /**\n * This event is fired when the user stops dragging the circle.\n */\n this.dragEnd = new EventEmitter();\n /**\n * This event is fired when the user starts dragging the circle.\n */\n this.dragStart = new EventEmitter();\n /**\n * This event is fired when the DOM mousedown event is fired on the circle.\n */\n this.mouseDown = new EventEmitter();\n /**\n * This event is fired when the DOM mousemove event is fired on the circle.\n */\n this.mouseMove = new EventEmitter();\n /**\n * This event is fired on circle mouseout.\n */\n this.mouseOut = new EventEmitter();\n /**\n * This event is fired on circle mouseover.\n */\n this.mouseOver = new EventEmitter();\n /**\n * This event is fired when the DOM mouseup event is fired on the circle.\n */\n this.mouseUp = new EventEmitter();\n /**\n * This event is fired when the circle's radius is changed.\n */\n this.radiusChange = new EventEmitter();\n /**\n * This event is fired when the circle is right-clicked on.\n */\n this.rightClick = new EventEmitter();\n this._circleAddedToManager = false;\n this._eventSubscriptions = [];\n }\n /** @internal */\n SebmGoogleMapCircle.prototype.ngOnInit = function () {\n this._manager.addCircle(this);\n this._circleAddedToManager = true;\n this._registerEventListeners();\n };\n /** @internal */\n SebmGoogleMapCircle.prototype.ngOnChanges = function (changes) {\n if (!this._circleAddedToManager) {\n return;\n }\n if (changes['latitude'] || changes['longitude']) {\n this._manager.setCenter(this);\n }\n if (changes['editable']) {\n this._manager.setEditable(this);\n }\n if (changes['draggable']) {\n this._manager.setDraggable(this);\n }\n if (changes['visible']) {\n this._manager.setVisible(this);\n }\n if (changes['radius']) {\n this._manager.setRadius(this);\n }\n this._updateCircleOptionsChanges(changes);\n };\n SebmGoogleMapCircle.prototype._updateCircleOptionsChanges = function (changes) {\n var options = {};\n var optionKeys = Object.keys(changes).filter(function (k) { return SebmGoogleMapCircle._mapOptions.indexOf(k) !== -1; });\n optionKeys.forEach(function (k) { options[k] = changes[k].currentValue; });\n if (optionKeys.length > 0) {\n this._manager.setOptions(this, options);\n }\n };\n SebmGoogleMapCircle.prototype._registerEventListeners = function () {\n var _this = this;\n var events = new Map();\n events.set('center_changed', this.centerChange);\n events.set('click', this.circleClick);\n events.set('dblclick', this.circleDblClick);\n events.set('drag', this.drag);\n events.set('dragend', this.dragEnd);\n events.set('dragStart', this.dragStart);\n events.set('mousedown', this.mouseDown);\n events.set('mousemove', this.mouseMove);\n events.set('mouseout', this.mouseOut);\n events.set('mouseover', this.mouseOver);\n events.set('mouseup', this.mouseUp);\n events.set('radius_changed', this.radiusChange);\n events.set('rightclick', this.rightClick);\n events.forEach(function (eventEmitter, eventName) {\n _this._eventSubscriptions.push(_this._manager.createEventObservable(eventName, _this).subscribe(function (value) {\n switch (eventName) {\n case 'radius_changed':\n _this._manager.getRadius(_this).then(function (radius) { return eventEmitter.emit(radius); });\n break;\n case 'center_changed':\n _this._manager.getCenter(_this).then(function (center) {\n return eventEmitter.emit({ lat: center.lat(), lng: center.lng() });\n });\n break;\n default:\n eventEmitter.emit({ coords: { lat: value.latLng.lat(), lng: value.latLng.lng() } });\n }\n }));\n });\n };\n /** @internal */\n SebmGoogleMapCircle.prototype.ngOnDestroy = function () {\n this._eventSubscriptions.forEach(function (s) { s.unsubscribe(); });\n this._eventSubscriptions = null;\n this._manager.removeCircle(this);\n };\n /**\n * Gets the LatLngBounds of this Circle.\n */\n SebmGoogleMapCircle.prototype.getBounds = function () { return this._manager.getBounds(this); };\n SebmGoogleMapCircle.prototype.getCenter = function () { return this._manager.getCenter(this); };\n SebmGoogleMapCircle._mapOptions = [\n 'fillColor', 'fillOpacity', 'strokeColor', 'strokeOpacity', 'strokePosition', 'strokeWeight',\n 'visible', 'zIndex'\n ];\n SebmGoogleMapCircle.decorators = [\n { type: Directive, args: [{\n selector: 'sebm-google-map-circle',\n inputs: [\n 'latitude', 'longitude', 'clickable', 'draggable: circleDraggable', 'editable', 'fillColor',\n 'fillOpacity', 'radius', 'strokeColor', 'strokeOpacity', 'strokePosition', 'strokeWeight',\n 'visible', 'zIndex'\n ],\n outputs: [\n 'centerChange', 'circleClick', 'circleDblClick', 'drag', 'dragEnd', 'dragStart', 'mouseDown',\n 'mouseMove', 'mouseOut', 'mouseOver', 'mouseUp', 'radiusChange', 'rightClick'\n ]\n },] },\n ];\n /** @nocollapse */\n SebmGoogleMapCircle.ctorParameters = function () { return [\n { type: CircleManager, },\n ]; };\n return SebmGoogleMapCircle;\n}());\n//# sourceMappingURL=google-map-circle.js.map","import { Component, ElementRef, EventEmitter } from '@angular/core';\nimport { InfoWindowManager } from '../services/managers/info-window-manager';\nvar infoWindowId = 0;\n/**\n * SebmGoogleMapInfoWindow renders a info window inside a {@link SebmGoogleMapMarker} or standalone.\n *\n * ### Example\n * ```typescript\n * import { Component } from 'angular2/core';\n * import { SebmGoogleMap, SebmGoogleMapMarker, SebmGoogleMapInfoWindow } from\n * 'angular2-google-maps/core';\n *\n * @Component({\n * selector: 'my-map-cmp',\n * directives: [SebmGoogleMap, SebmGoogleMapMarker, SebmGoogleMapInfoWindow],\n * styles: [`\n * .sebm-google-map-container {\n * height: 300px;\n * }\n * `],\n * template: `\n * <sebm-google-map [latitude]=\"lat\" [longitude]=\"lng\" [zoom]=\"zoom\">\n * <sebm-google-map-marker [latitude]=\"lat\" [longitude]=\"lng\" [label]=\"'M'\">\n * <sebm-google-map-info-window [disableAutoPan]=\"true\">\n * Hi, this is the content of the <strong>info window</strong>\n * </sebm-google-map-info-window>\n * </sebm-google-map-marker>\n * </sebm-google-map>\n * `\n * })\n * ```\n */\nexport var SebmGoogleMapInfoWindow = (function () {\n function SebmGoogleMapInfoWindow(_infoWindowManager, _el) {\n this._infoWindowManager = _infoWindowManager;\n this._el = _el;\n /**\n * Sets the open state for the InfoWindow. You can also call the open() and close() methods.\n */\n this.isOpen = false;\n /**\n * Emits an event when the info window is closed.\n */\n this.infoWindowClose = new EventEmitter();\n this._infoWindowAddedToManager = false;\n this._id = (infoWindowId++).toString();\n }\n SebmGoogleMapInfoWindow.prototype.ngOnInit = function () {\n this.content = this._el.nativeElement.querySelector('.sebm-google-map-info-window-content');\n this._infoWindowManager.addInfoWindow(this);\n this._infoWindowAddedToManager = true;\n this._updateOpenState();\n this._registerEventListeners();\n };\n /** @internal */\n SebmGoogleMapInfoWindow.prototype.ngOnChanges = function (changes) {\n if (!this._infoWindowAddedToManager) {\n return;\n }\n if ((changes['latitude'] || changes['longitude']) && typeof this.latitude === 'number' &&\n typeof this.longitude === 'number') {\n this._infoWindowManager.setPosition(this);\n