Interactive interface for browsing global, full-resolution satellite imagery
Hover in download list highlights footprint on map
Mike McGann4afdfd44fb8e
diff --git a/src/css/dataDownload.css b/src/css/dataDownload.cssindex e05e960dc..ffd6779d1 100644--- a/src/css/dataDownload.css+++ b/src/css/dataDownload.css@@ -111,6 +111,10 @@color: #000000;}+#DataDownload_DownloadListPanel tr:hover {+ background-color: rgb(55, 58, 62);+}+#DataDownload_Notice {width: 80%;margin: 0 auto;@@ -162,6 +166,7 @@#DataDownload_GranuleList tr:nth-child(even) {background-color: rgb(45, 48, 52);}+#DataDownload #DataDownloadcontent h3 span{font-weight:bold;color:#8f939f;diff --git a/src/js/Worldview/DataDownload/DownloadListPanel.js b/src/js/Worldview/DataDownload/DownloadListPanel.jsindex f684f31d3..db8970f5a 100644--- a/src/js/Worldview/DataDownload/DownloadListPanel.js+++ b/src/js/Worldview/DataDownload/DownloadListPanel.js@@ -39,6 +39,8 @@ Worldview.DataDownload.DownloadListPanel = function(config, model) {$("#DataDownload_DownloadListPanel .remove").off("click", removeGranule);$("#DataDownload_DownloadListPanel a.wget").off("click", showWgetPage);$("#DataDownload_DownloadListPanel a.curl").off("click", showCurlPage);+ $("#DataDownload_DownloadListPanel tr").off("mouseenter", onHoverOver);+ $("#DataDownload_DownloadListPanel tr").off("mouseleave", onHoverOut);selection = reformatSelection();log.debug("selection", selection);@@ -69,6 +71,8 @@ Worldview.DataDownload.DownloadListPanel = function(config, model) {$("#DataDownload_DownloadListPanel a.wget").click(showWgetPage);$("#DataDownload_DownloadListPanel a.curl").click(showCurlPage);$("#DataDownload_DownloadListPanel .remove").click(removeGranule);+ $("#DataDownload_DownloadListPanel tr").on("mouseenter", onHoverOver);+ $("#DataDownload_DownloadListPanel tr").on("mouseleave", onHoverOut);var bulkVisible = isBulkDownloadable() &&Worldview.size(model.selectedGranules) !== 0;@@ -92,11 +96,15 @@ Worldview.DataDownload.DownloadListPanel = function(config, model) {};var dispose = function() {+ $("#DataDownload_DownloadListPanel .remove").off("click", removeGranule);+ $("#DataDownload_DownloadListPanel a.wget").off("click", showWgetPage);+ $("#DataDownload_DownloadListPanel a.curl").off("click", showCurlPage);+ $("#DataDownload_DownloadListPanel tr").off("mouseenter", onHoverOver);+ $("#DataDownload_DownloadListPanel tr").off("mouseleave", onHoverOut);+self.events.trigger("close");panel.destroy();panel = null;- $("#DataDownload_DownloadListPanel a.wget").off("click", showWgetPage);- $("#DataDownload_DownloadListPanel a.curl").off("click", showCurlPage);};var reformatSelection = function() {@@ -221,7 +229,7 @@ Worldview.DataDownload.DownloadListPanel = function(config, model) {var granuleText = function(product, granule) {if ( product.name !== granule.label ) {var elements = [- "<tr>",+ "<tr data-granule='" + granule.id + "'>","<td><input type='button' class='remove' " +"data-granule='" + granule.id + "' " +"value='X'></input></td>",@@ -231,7 +239,7 @@ Worldview.DataDownload.DownloadListPanel = function(config, model) {];} else {var elements = [- "<tr>",+ "<tr data-granule='" + granule.id + "'>","<td><input type='button' class='remove' " +"data-granule='" + granule.id + "' " +"value='X'></input></td>",@@ -308,6 +316,17 @@ Worldview.DataDownload.DownloadListPanel = function(config, model) {var removeGranule = function() {var id = $(this).attr("data-granule");model.unselectGranule(model.selectedGranules[id]);+ onHoverOut.apply(this);+ };++ var onHoverOver = function() {+ model.events.trigger("hoverOver",+ model.selectedGranules[$(this).attr("data-granule")]);+ };++ var onHoverOut = function() {+ model.events.trigger("hoverOut",+ model.selectedGranules[$(this).attr("data-granule")]);};return self;diff --git a/src/js/Worldview/DataDownload/Layers/Hover.js b/src/js/Worldview/DataDownload/Layers/Hover.jsindex 4e6a18103..a4e0ef961 100644--- a/src/js/Worldview/DataDownload/Layers/Hover.js+++ b/src/js/Worldview/DataDownload/Layers/Hover.js@@ -1,27 +1,27 @@/** NASA Worldview- *+ ** This code was originally developed at NASA/Goddard Space Flight Center for- * the Earth Science Data and Information System (ESDIS) project.+ * the Earth Science Data and Information System (ESDIS) project.*- * Copyright (C) 2013 United States Government as represented by the+ * Copyright (C) 2013 United States Government as represented by the* Administrator of the National Aeronautics and Space Administration.* All Rights Reserved.*/Worldview.namespace("DataDownload.Hover");Worldview.DataDownload.Layers.Hover = function(model, maps, config) {-+var log = Logging.getLogger("Worldview.DataDownload");-+var LAYER_NAME = "DataDownload_Hover";-+var STYLE_HOVER_UNSELECTED = {strokeColor: "#fbe26d",fillColor: "#b59e32",fillOpacity: 0.25};-+var STYLE_HOVER_SELECTED = {strokeColor: "#ff0600",fillColor: "#f20c0c",@@ -29,34 +29,40 @@ Worldview.DataDownload.Layers.Hover = function(model, maps, config) {};var self = {};-+var init = function() {model.events.on("granuleSelect", refresh).on("granuleUnselect", refresh);};-- self.hoverOver = function(buttonFeature) {- var hoverFeature = new OpenLayers.Feature.Vector(- buttonFeature.attributes.granule.geometry[model.crs],- buttonFeature.attributes- );- applyStyle(hoverFeature);- getLayer().addFeatures([hoverFeature]);- log.debug(hoverFeature.attributes.granule);++ self.hoverOver = function(granule) {+ var geom = granule.geometry[model.crs];+ var extent =+ config.projections[model.projection].maxExtent.toGeometry();+ if ( geom && extent.intersects(geom) ) {+ var hoverFeature = new OpenLayers.Feature.Vector(+ granule.geometry[model.crs], {+ granule: granule+ }+ );+ applyStyle(hoverFeature);+ getLayer().addFeatures([hoverFeature]);+ log.debug(hoverFeature.attributes.granule);+ }};-+self.hoverOut = function() {self.clear();};-+self.clear = function() {var layer = Worldview.Map.getLayerByName(maps.map, LAYER_NAME);if ( layer ) {layer.removeAllFeatures();}};-+self.dispose = function() {$.each(maps.projections, function(index, map) {var layer = Worldview.Map.getLayerByName(map, LAYER_NAME);@@ -64,8 +70,8 @@ Worldview.DataDownload.Layers.Hover = function(model, maps, config) {map.removeLayer(layer);}});- };-+ };+var refresh = function(granule) {var layer = getLayer();if ( layer.features.length === 0 ) {@@ -76,23 +82,23 @@ Worldview.DataDownload.Layers.Hover = function(model, maps, config) {if ( hoverGranule.id === granule.id ) {applyStyle(feature);layer.drawFeature(feature);- }+ }};-+var applyStyle = function(feature) {var granule = feature.attributes.granule;var selected = model.selectedGranules[granule.id];- var style = ( selected ) ? STYLE_HOVER_SELECTED: STYLE_HOVER_UNSELECTED;- feature.style = style;+ var style = ( selected ) ? STYLE_HOVER_SELECTED: STYLE_HOVER_UNSELECTED;+ feature.style = style;};-+var createLayer = function() {var layer = new OpenLayers.Layer.Vector(LAYER_NAME);layer.div.setAttribute("data-layer-name", LAYER_NAME);maps.map.addLayer(layer);return layer;};-+var getLayer = function(map) {map = map || maps.map;var layer = Worldview.Map.getLayerByName(map, LAYER_NAME);@@ -101,10 +107,10 @@ Worldview.DataDownload.Layers.Hover = function(model, maps, config) {}return layer;};-+init();return self;};-+diff --git a/src/js/Worldview/DataDownload/MapController.js b/src/js/Worldview/DataDownload/MapController.jsindex e6954b47f..b67bb102e 100644--- a/src/js/Worldview/DataDownload/MapController.js+++ b/src/js/Worldview/DataDownload/MapController.js@@ -30,11 +30,15 @@ Worldview.DataDownload.MapController = function(model, maps, config) {.on("queryResults", onQueryResults).on("projectionUpdate", onProjectionUpdate).on("activate", onActivate)- .on("deactivate", onDeactivate);+ .on("deactivate", onDeactivate)+ .on("hoverOver", function(granule) {+ hoverLayers.hoverOver(granule);+ })+ .on("hoverOut", hoverLayers.hoverOut);buttonLayers.events.on("hoverover", function(event) {- hoverLayers.hoverOver(event.feature);+ hoverLayers.hoverOver(event.feature.attributes.granule);}).on("hoverout", function() {hoverLayers.hoverOut();