Sha256: b42093153be124607cdbbfe25946ad079ad385987bbac326e61c752a01bbc18e

Contents?: true

Size: 1.49 KB

Versions: 40

Compression:

Stored size: 1.49 KB

Contents

/*global GeoBlacklight */

// base viewer
GeoBlacklight.Viewer = L.Class.extend({
  options: {},

  initialize: function(el, options) {
    this.element = el;
    this.data = $(el).data();

    L.Util.setOptions(this, options);

    // trigger viewer load functions
    this.load();
  },

  /**
  * Loads leaflet controls from controls directory.
  **/
  loadControls: function() {
    var _this = this;
    var protocol = this.data.protocol.toUpperCase();
    var options = this.data.leafletOptions;

    if (!options.VIEWERS) {
      return;
    }

    var viewer = options.VIEWERS[protocol];
    var controls = viewer && viewer.CONTROLS;

    _this.controlPreload();

    /**
    * Loop though the GeoBlacklight.Controls hash, and for each control,
    * check to see if it is included in the controls list for the current
    * viewer. If it is, then pass in the viewer object and run the function
    * that adds it to the map.
    **/
    $.each(GeoBlacklight.Controls, function(name, func) {
      if (controls && controls.indexOf(name) > -1) {
        func.call(_this);
      }
    });
  },

  /**
  * Work to do before the controls are loaded.
  **/
  controlPreload: function() {
    return;
  },

  /**
  * Gets the value of detect retina from application settings.
  **/
  detectRetina: function() {
    var options = this.data.leafletOptions;
    if (options && options.LAYERS) {
      return options.LAYERS.DETECT_RETINA ? options.LAYERS.DETECT_RETINA : false;
    } else {
      return false;
    }
  }
});

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
geoblacklight-3.8.1 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-3.8.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-3.7.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-3.6.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-3.5.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.0.0.pre.alpha.3 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.0.0.pre.alpha.2 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.0.0.pre.alpha.1 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.0.0.pre.alpha app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-3.4.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-3.3.1 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-3.3.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-3.2.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-3.1.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-3.0.1 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-3.0.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-2.4.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-2.3.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-2.2.1 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-2.2.0 app/assets/javascripts/geoblacklight/viewers/viewer.js