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

    /**
     * BeNomad BeMap JavaScript API - Popup
     */

    /**
     * @classdesc
     * Base class for popup.
     * @public
     * @constructor
     * @param {Object} options See below the available values.
     * @param {String} options.name Name of popup.
     * @param {Object} options.properties custom object.
     */
    bemap.Popup = function(options) {
      var opts = options || {};

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

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

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

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

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

      /**
       * @type {Boolean}
       * @protected
       */
      this.visible = opts.visible !== undefined ? opts.visible : true;

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

      /**
       * @type {bemap.Coordinate}
       * @protected
       */
      this.coordinate = opts.coordinate ? opts.coordinate : undefined;

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

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

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

    /**
     * Return the content of the popup.
     * @return {String} this.infomation;
     */
    bemap.Popup.prototype.getInformation = function() {
      return this.information;
    };

    /**
     * Return the position of the popup.
     * @return {bemap.Coordinate} this.coordinate;
     */
    bemap.Popup.prototype.getCoordinate = function() {
      return this.coordinate;
    };

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

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

    /**
     * Return the visibility of the popup.
     * @return {Boolean} visible the visibility of the popup (true is visible and false is hidden).
     */
    bemap.Popup.prototype.isVisible = function() {
      return this.visible;
    };

    /**
     * Set the visibility of the popup.
     * @param {boolean} Set to true to show the popup, otherwise false to hide it.
     * @return {bemap.Popup} this.
     */
    bemap.Popup.prototype.setVisible = function(visible) {
      this.map.setVisiblePopup(this, visible);
      return this;
    };

    /**
     * Hide the popup.
     * @return {bemap.Popup} this.
     */
    bemap.Popup.prototype.hide = function() {
      this.map.setVisiblePopup(this, false);
      return this;
    };

    /**
     * Show the popup.
     * @return {bemap.Popup} this.
     */
    bemap.Popup.prototype.show = function() {
      this.map.setVisiblePopup(this, true);
      return this;
    };

    /**
     * Change the current content of the popup to a new one.
     * @param {String} information the new content to set.
     * @return {bemap.Popup} this;
     */
    bemap.Popup.prototype.setInformation = function(information) {
      this.information = information;
      if (this.content_) {
        this.content_.innerHTML = information;
      }
      return this;
    };

    /**
     * Return the id of the popup.
     * @param {String} id the new id to set.
     * @return {bemap.Popup} this;
     */
    bemap.Popup.prototype.setId = function(id) {
      this.id = id;
      return this;
    };

    /**
     * Return the name of the popup.
     * @param {String} name the new name to set.
     * @return {bemap.Popup} this;
     */
    bemap.Popup.prototype.setName = function(name) {
      this.name = name;
      return this;
    };

    /**
     * Set the position of the popup.
     * @param {bemap.Coordinate} coordinate the new coordinate to set.
     * @param {object} options Options.
     * @param {bemap.Layer} options.panningMap enable the map panning animation. move map from the current position to the popup anchor at the center of map.
     * @return {bemap.Popup} this;
     */
    bemap.Popup.prototype.setCoordinate = function(coordinate, options) {
      this.map.setCoordinatePopup(this, coordinate, options);
      return this;
    };

    /**
     * Add the new content at the end of the current one.
     * @param {String} information the new content to add.
     * @return {bemap.Popup} this;
     */
    bemap.Popup.prototype.addInformation = function(information) {
      this.information += information;
      if (this.content_) {
        this.content_.innerHTML = this.information;
      }
      return this;
    };

    /**
     * Remove the popup from his map.
     * @return {bemap.Popup} this;
     */
    bemap.Popup.prototype.remove = function() {
      if (this.map && this.native) {
        this.map.removePopup(this);
      }
      return this;
    };