UNPKG

maptoolkit

Version:

Utilidades para trabajar con el mapa de google web.

83 lines 2.76 kB
var __extends = (this && this.__extends) || (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { MtEventSource } from "./mteventsource"; var MtMarker = (function (_super) { __extends(MtMarker, _super); function MtMarker(position, model, id) { var _this = _super.call(this) || this; _this.model = model; _this.id = id; if (!id) { _this.id = '' + Math.random(); } _this._position = position; return _this; } MtMarker.prototype.show = function (map) { var self = this; this._nativeMarker = new google.maps.Marker({ position: this._position, icon: this._icon, zIndex: this._zIndex, map: map }); this._nativeMarker['model'] = this; google.maps.event.addListener(this._nativeMarker, "click", function (event) { self.event(MtEventSource.EVT_MAP_MARKER_CLICK).emit({ source: self, evt: event }); return true; }); }; MtMarker.prototype.remove = function () { this.removeAllListeners(); this._nativeMarker.setMap(null); this._position = null; }; MtMarker.prototype.getId = function () { return this.id; }; MtMarker.prototype.setZIndex = function (zi) { if (this._nativeMarker) { this._nativeMarker.setZIndex(zi); } return this; }; MtMarker.prototype.getZIndex = function () { return this._zIndex; }; MtMarker.prototype.getNativeMarker = function () { return this._nativeMarker; }; MtMarker.prototype.setIcon = function (icon) { this._icon = icon; if (this._nativeMarker) { this._nativeMarker.setIcon(icon); } return this; }; MtMarker.prototype.setPosition = function (pos) { this._position = pos; if (this._nativeMarker && pos) { this._nativeMarker.setPosition(pos); } }; MtMarker.prototype.setModel = function (model) { this.model = model; if (this._nativeMarker) { this._nativeMarker['model'] = this; } }; MtMarker.prototype.getPosition = function () { return this._position; }; return MtMarker; }(MtEventSource)); export { MtMarker }; //# sourceMappingURL=mtmarker.js.map