Sha256: 5b2b7fcc5ad148550f694ba8eac90733f7551b8d388ab4d1809ca1cb5396c51a

Contents?: true

Size: 1.6 KB

Versions: 12

Compression:

Stored size: 1.6 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);

    // Sets leaflet icon paths to ex. /assets/marker-icon-2x-rails-fingerprint
    L.Icon.Default.imagePath = '..';

    // 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

12 entries across 12 versions & 1 rubygems

Version Path
geoblacklight-4.4.2 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.4.1 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.4.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.4.0.rc1 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.3.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.2.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.1.1 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.1.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.0.0 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.0.0.pre.rc3 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.0.0.pre.rc2 app/assets/javascripts/geoblacklight/viewers/viewer.js
geoblacklight-4.0.0.pre.rc1 app/assets/javascripts/geoblacklight/viewers/viewer.js