# Source: bemap-model/bemap-marker.js

    /**
     * BeNomad BeMap JavaScript API - Marker
     */

    /**
     * @classdesc
     * Base class for marker.
     * @public
     * @constructor
     * @param {bemap.Coordinate} coordinates in bemap.Coordinate.
     * @param {Object} options See below the available values.
     * @param {bemap.Icon} options.icon Style of marker used by the renderer.
     * @param {String} options.name Name of marker.
     * @param {Object} options.properties custom object.
     */
    bemap.Marker = function(coordinate, options) {
      var opts = options || {};

      /**
       * @type {Object}
       * @protected
       */
      this.native = null;

      /**
       * @type {Object}
       * @protected
       */
      this.map = null;

      /**
       * @type {Object}
       * @protected
       */
      this.layer = null;

      /**
       * @type {bemap.Coordinate}
       * @protected
       */
      this.coordinate = coordinate ? coordinate : new bemap.Coordinate();

      /**
       * @type {bemap.Icon}
       * @protected
       */
      this.icon = opts.icon ? opts.icon : null;

      /**
       * @type {String}
       * @protected
       */
      this.id = opts.id ? opts.id : null;

      /**
       * @type {String}
       * @protected
       */
      this.name = opts.name ? opts.name : null;

      /**
       * @type {String}
       * @protected
       */
      this.textStyle = opts.textStyle ? opts.textStyle : null;

      /**
       * @type {Array}
       * @protected
       */
      this.events = [];

      /**
       * @type {Function}
       * @protected
       */
      this.callback = [];

      /**
       * @type {Object}
       * @protected
       */
      this.properties = opts.properties ? opts.properties : null;
    };

    /**
     * Return the bemap.Icon that define the style of the marker.
     * @public
     * @return {bemap.Icon} Return the bemap.Icon that define the style of the marker.
     */
    bemap.Marker.prototype.getIcon = function() {
      return this.icon;
    };

    /**
     * Set the icon style of the marker.
     * @public
     * @param {bemap.Icon} icon the new icon style to set.
     * @return {bemap.Marker} this
     */
    bemap.Marker.prototype.setIcon = function(icon) {
      this.icon = icon;
      return this;
    };

    /**
     * Return the id of the marker.
     * @public
     * @return {String} Return the id of the marker.
     */
    bemap.Marker.prototype.getId = function() {
      return this.id;
    };

    /**
     * Define the id of marker
     * @public
     * @param {String} id the new id to set.
     * @return {bemap.Marker} this
     */
    bemap.Marker.prototype.setId = function(id) {
      this.id = id;
      return this;
    };

    /**
     * Return the properties of the marker.
     * @public
     * @return {String} Return the properties of the marker.
     */
    bemap.Marker.prototype.getProperties = function() {
      return this.properties;
    };

    /**
     * Define the properties of marker
     * @public
     * @param {String} properties the new properties to set.
     * @return {bemap.Marker} this
     */
    bemap.Marker.prototype.setProperties = function(properties) {
      this.properties = properties;
      return this;
    };

    /**
     * Return the name of the marker.
     * @public
     * @return {String} Return the name of the marker.
     */
    bemap.Marker.prototype.getName = function() {
      return this.name;
    };

    /**
     * Define the name of polyline
     * @public
     * @param {String} name the new name to set.
     * @return {bemap.Marker} this
     */
    bemap.Marker.prototype.setName = function(name) {
      this.name = name;
      return this;
    };

    /**
     * Return the bemap.TextStyle that define the style of text.
     * @public
     * @return {bemap.TextStyle} Return the bemap.TextStyle that define the style of text.
     */
    bemap.Marker.prototype.getTextStyle = function() {
      return this.textStyle;
    };

    /**
     * Set the text style of the marker.
     * @public
     * @param {bemap.TextStyle} icon the new text style to set.
     * @return {bemap.Marker} this
     */
    bemap.Marker.prototype.setTextStyle = function(textStyle) {
      this.textStyle = textStyle;
      return this;
    };

    /**
     * Return the bemap.Coordinate. See bemap.Coordinate.
     * @public
     * @return {bemap.Coordinate} Return the bemap.Coordinate. See bemap.Coordinate.
     */
    bemap.Marker.prototype.getCoordinate = function() {
      return this.coordinate;
    };

    /**
     * Set the coordinates of the marker.
     * @public
     * @param {bemap.Coordinate} coordinate the new coordinates to set.
     * @return {bemap.Marker} this
     */
    bemap.Marker.prototype.setCoordinate = function(coordinate) {
      this.coordinate = coordinate;
      if (this.native && this.map) {
        this.map.setCoordinateMarker(this);
      }
      return this;
    };

    /**
     * Remove the Marker from the layer.
     * @public
     * @return {bemap.Marker} this
     */
    bemap.Marker.prototype.remove = function() {
      if (this.map !== null && bemap.inheritsof(this.map, bemap.Map)) {
        this.map.removeMarker(this);
      }
      return this;
    };

    /**
     * Set the listner when an specified eventType occur on bemap.Marker.
     * @public
     * @param {bemap.Map.EventType} eventType Event type.
     * @param {function} callback Function will be called when the specified eventType is occur.
     * @param {object} options options.
     * @return {bemap.Marker} this.
     */
    bemap.Marker.prototype.on = function(eventType, callback, options) {
      if (this.map !== null && bemap.inheritsof(this.map, bemap.Map)) {
        this.map.onMarker(this, eventType, callback, options);
      }
      return this;
    };

    /**
     * Define the draggable capability for bemap.Marker.
     * @protected
     * @param {function} callback Function will be called when the specified eventType is occur.
     * @param {object} options Options.
     * @param {bemap.Layer} options.layerFilter set the bemap layer used as filter.
     * @return {bemap.Listener} bemap.listener.
     */
    bemap.Marker.prototype.draggable = function(callback, options) {
      if (this.map !== null && bemap.inheritsof(this.map, bemap.Map)) {
        return this.map.draggableMarker(this, callback, options);
      }
      return new bemap.listener();
    };