Sha256: 79e1a9e84ec46fa09081e891524c7aa684c146ecb01a93a533b49d3bdab39968
Contents?: true
Size: 1.38 KB
Versions: 5
Compression:
Stored size: 1.38 KB
Contents
//= require geoblacklight/viewers/viewer GeoBlacklight.Viewer.Map = GeoBlacklight.Viewer.extend({ options: { /** * Initial bounds of map * @type {L.LatLngBounds} */ bbox: [[-80, -195], [80, 185]] }, overlay: L.layerGroup(), load: function() { if (this.data.mapBbox) { this.options.bbox = L.bboxToBounds(this.data.mapBbox); } this.map = L.map(this.element).fitBounds(this.options.bbox); this.map.addLayer(this.selectBasemap()); this.map.addLayer(this.overlay); if (this.data.map !== 'index') { this.addBoundsOverlay(this.options.bbox); } }, /** * Add a bounding box overlay to map. * @param {L.LatLngBounds} bounds Leaflet LatLngBounds */ addBoundsOverlay: function(bounds) { if (bounds instanceof L.LatLngBounds) { this.overlay.addLayer(L.polygon([ bounds.getSouthWest(), bounds.getSouthEast(), bounds.getNorthEast(), bounds.getNorthWest() ])); } }, /** * Remove bounding box overlay from map. */ removeBoundsOverlay: function() { this.overlay.clearLayers(); }, /** * Selects basemap if specified in data options, if not return mapquest */ selectBasemap: function() { var _this = this; if (_this.data.basemap) { return GeoBlacklight.Basemaps[_this.data.basemap]; } else { return _this.basemap.mapquest; } } });
Version data entries
5 entries across 5 versions & 1 rubygems