text: var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
      return c > 3 && r && Object.defineProperty(target, key, r), r;
  };
  var __metadata = (this && this.__metadata) || function (k, v) {
      if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  };
  import { Injectable, NgZone } from '@angular/core';
  import { Observable } from 'rxjs';
  import { GoogleMapsAPIWrapper } from './../google-maps-api-wrapper';
  var MarkerManager = /** @class */ (function () {
      function MarkerManager(_mapsWrapper, _zone) {
          this._mapsWrapper = _mapsWrapper;
          this._zone = _zone;
          this._markers = new Map();
      }
      MarkerManager.prototype.deleteMarker = function (marker) {
          var _this = this;
          var m = this._markers.get(marker);
          if (m == null) {
              // marker already deleted
              return Promise.resolve();
          }
          return m.then(function (m) {
              return _this._zone.run(function () {
                  m.setMap(null);
                  _this._markers.delete(marker);
              });
          });
      };
      MarkerManager.prototype.updateMarkerPosition = function (marker) {
          return this._markers.get(marker).then(function (m) { return m.setPosition({ lat: marker.latitude, lng: marker.longitude }); });
      };
      MarkerManager.prototype.updateTitle = function (marker) {
          return this._markers.get(marker).then(function (m) { return m.setTitle(marker.title); });
      };
      MarkerManager.prototype.updateLabel = function (marker) {
          return this._markers.get(marker).then(function (m) { m.setLabel(marker.label); });
      };
      MarkerManager.prototype.updateDraggable = function (marker) {
          return this._markers.get(marker).then(function (m) { return m.setDraggable(marker.draggable); });
      };
      MarkerManager.prototype.updateIcon = function (marker) {
          return this._markers.get(marker).then(function (m) { return m.setIcon(marker.iconUrl); });
      };
      MarkerManager.prototype.updateOpacity = function (marker) {
          return this._markers.get(marker).then(function (m) { return m.setOpacity(marker.opacity); });
      };
      MarkerManager.prototype.updateVisible = function (marker) {
          return this._markers.get(marker).then(function (m) { return m.setVisible(marker.visible); });
      };
      MarkerManager.prototype.updateZIndex = function (marker) {
          return this._markers.get(marker).then(function (m) { return m.setZIndex(marker.zIndex); });
      };
      MarkerManager.prototype.updateClickable = function (marker) {
          return this._markers.get(marker).then(function (m) { return m.setClickable(marker.clickable); });
      };
      MarkerManager.prototype.updateAnimation = function (marker) {
          return this._markers.get(marker).then(function (m) {
              if (typeof marker.animation === 'string') {
                  m.setAnimation(google.maps.Animation[marker.animation]);
              }
              else {
                  m.setAnimation(marker.animation);
              }
          });
      };
      MarkerManager.prototype.addMarker = function (marker) {
          var markerPromise = this._mapsWrapper.createMarker({
              position: { lat: marker.latitude, lng: marker.longitude },
              label: marker.label,
              draggable: marker.draggable,
              icon: marker.iconUrl,
              opacity: marker.opacity,
              visible: marker.visible,
              zIndex: marker.zIndex,
              title: marker.title,
              clickable: marker.clickable,
              animation: (typeof marker.animation === 'string') ? google.maps.Animation[marker.animation] : marker.animation
          });
          this._markers.set(marker, markerPromise);
      };
      MarkerManager.prototype.getNativeMarker = function (marker) {
          return this._markers.get(marker);
      };
      MarkerManager.prototype.createEventObservable = function (eventName, marker) {
          var _this = this;
          return new Observable(function (observer) {
              _this._markers.get(marker).then(function (m) {
                  m.addListener(eventName, function (e) { return _this._zone.run(function () { return observer.next(e); }); });
              });
          });
      };
      MarkerManager = __decorate([
          Injectable(),
          __metadata("design:paramtypes", [GoogleMapsAPIWrapper, NgZone])
      ], MarkerManager);
      return MarkerManager;
  }());
  export { MarkerManager };
  //# sourceMappingURL=marker-manager.js.map