Sha256: c2a7523bd9f2580f333c5ba235ba3e018014d7376eabec03480eab173b803412
Contents?: true
Size: 1.88 KB
Versions: 20
Compression:
Stored size: 1.88 KB
Contents
//= require geoblacklight/viewers/esri GeoBlacklight.Viewer.FeatureLayer = GeoBlacklight.Viewer.Esri.extend({ // default feature styles defaultStyles: { 'esriGeometryPoint': '', 'esriGeometryMultipoint': '', 'esriGeometryPolyline': {color: 'blue', weight: 3 }, 'esriGeometryPolygon': {color: 'blue', weight: 2 } }, getPreviewLayer: function() { // set layer url this.options.url = this.data.url; // set default style this.options.style = this.getFeatureStyle(); // define feature layer this.esriFeatureLayer = L.esri.featureLayer(this.options); //setup feature inspection and opacity this.setupInspection(this.esriFeatureLayer); this.setupInitialOpacity(this.esriFeatureLayer); return this.esriFeatureLayer; }, controlPreload: function() { // define setOpacity function that works for svg elements this.esriFeatureLayer.setOpacity = function(opacity) { $('.leaflet-clickable').css({ opacity: opacity }); }; }, getFeatureStyle: function() { var _this = this; // lookup style hash based on layer geometry type and return function return function(feature) { return _this.defaultStyles[_this.layerInfo.geometryType]; }; }, setupInitialOpacity: function(featureLayer) { featureLayer.on('load', function(e) { featureLayer.setOpacity(this.options); }); }, setupInspection: function(featureLayer) { var _this = this; // inspect on click featureLayer.on('click', function(e) { _this.appendLoadingMessage(); // query layer at click location featureLayer.query() .returnGeometry(false) .intersects(e.latlng) .run(function(error, featureCollection, response) { if (error) { _this.appendErrorMessage(); } else { _this.populateAttributeTable(featureCollection.features[0]); } }); }); } });
Version data entries
20 entries across 20 versions & 1 rubygems