Interactive interface for browsing global, full-resolution satellite imagery
Fixed some merge conflicts that seem to be related to the restructure
Mike McGannbbdbe532d637
diff --git a/src/js/Worldview/DataDownload/ControlDialog.js b/src/js/Worldview/DataDownload/ControlDialog.jsnew file mode 100644index 000000000..cf63ab048--- /dev/null+++ b/src/js/Worldview/DataDownload/ControlDialog.js@@ -0,0 +1,61 @@+/*+ * NASA Worldview+ *+ * This code was originally developed at NASA/Goddard Space Flight Center for+ * the Earth Science Data and Information System (ESDIS) project.+ *+ * Copyright (C) 2013 United States Government as represented by the+ * Administrator of the National Aeronautics and Space Administration.+ * All Rights Reserved.+ */+Worldview.namespace("DataDownload");++Worldview.DataDownload.ControlDialog = function(model) {++ var WIDTH = 345;+ var HEIGHT = 265;+ var X_OFFSET = 50;+ var Y_OFFSET = 75;+ var dialog;++ var self = {};+ self.events = Worldview.Events();++ var init = function() {+ var properties = {+ width: "" + WIDTH + "px",+ height: "" + HEIGHT + "px",+ visible: false,+ autofillheight: "body",+ contraintoviewport: true,+ x: Math.ceil($(window).width() - WIDTH - X_OFFSET),+ y: Y_OFFSET+ };+ dialog = new YAHOO.widget.Panel("dataDownload_controlDialog",+ properties);+ dialog.setHeader("Select Download Products");+ dialog.setBody([+ "<form>",+ "<div class='productSelector'></div>",+ "</form>"+ ].join("\n"));++ dialog.hideEvent.subscribe(function() {+ setTimeout(function() {+ dialog.destroy();+ self.events.fire("close");+ }, 5)+ });++ dialog.render(document.body);++ Worldview.DataDownload.ProductSelector(model,+ "#dataDownload_controlDialog .productSelector");++ dialog.show();+ }++ init();++ return self;+}diff --git a/src/js/Worldview/DataDownload/ProductSelector.js b/src/js/Worldview/DataDownload/ProductSelector.jsnew file mode 100644index 000000000..291948935--- /dev/null+++ b/src/js/Worldview/DataDownload/ProductSelector.js@@ -0,0 +1,52 @@+/*+ * NASA Worldview+ *+ * This code was originally developed at NASA/Goddard Space Flight Center for+ * the Earth Science Data and Information System (ESDIS) project.+ *+ * Copyright (C) 2013 United States Government as represented by the+ * Administrator of the National Aeronautics and Space Administration.+ * All Rights Reserved.+ */+Worldview.namespace("DataDownload");++Worldview.DataDownload.ProductSelector = function(model, selector) {++ var self = {};++ var init = function() {+ $(selector).html("<select size='1'></select>");+ $(selector + " select").change(function() {+ onSelect();+ });++ model.events.on("layerUpdate", onLayerUpdate)+ model.events.on("layerSelect", onSelectUpdate);++ onLayerUpdate();+ };++ var onLayerUpdate = function() {+ console.log(model.layers);+ var options = [];+ $.each(model.layers, function(index, layer) {+ var option = "<option value='" + layer.id + "'>" + layer.name ++ "; " + layer.description + "</option>";+ options.push(option);+ })+ $(selector + " select").html(options.join("\n"));+ };++ var onSelect = function() {+ var layer = $(selector + " select option:selected").val();+ model.selectLayer(layer);+ };++ var onSelectUpdate = function(selectedLayer) {+ $(selector + " select").val(selectedLayer)+ };++ init();+ return self;++}diff --git a/src/js/Worldview/Map/StaticProduct.js b/src/js/Worldview/Map/StaticProduct.jsnew file mode 100644index 000000000..e6038f258--- /dev/null+++ b/src/js/Worldview/Map/StaticProduct.js@@ -0,0 +1,131 @@+/*+ * NASA Worldview+ *+ * This code was originally developed at NASA/Goddard Space Flight Center for+ * the Earth Science Data and Information System (ESDIS) project.+ *+ * Copyright (C) 2013 United States Government as represented by the+ * Administrator of the National Aeronautics and Space Administration.+ * All Rights Reserved.+ */++Worldview.namespace("Map");++/**+ * Class: Worldview.Map.StaticProduct+ * Product that is not based on the current date or time.+ *+ * Inherits from:+ * <Worldview.Map.Product>+ *+ * Constructor: StaticProduct+ * Creates a new instance.+ *+ * Parameters:+ * map - The map object that layers will be added and removed from.+ * config - Configuration for this layer as a <Worldview.JSON.MapConfig.Product>+ * object.+ */+Worldview.Map.StaticProduct = function(map, config) {++ var self = Worldview.Map.Product(config);++ // There is only one layer and this is it+ var layer = null;++ // Tue current z-index for the layer+ var zIndex = 0;++ //-------------------------------------------------------------------------+ // Public+ //-------------------------------------------------------------------------+ var init = function() {+ layer = self.createLayer();+ map.addLayer(layer);+ layer.setZIndex(zIndex);++ map.events.register("movestart", self, invalidate);+ map.events.register("zoomend", self, invalidate);+ };++ /**+ * Method: setDay+ * Does nothing.+ */+ self.setDay = function(d) {+ };++ self.setOpacity = function(opacity) {+ if ( self.opacity === opacity ) {+ return;+ }+ self.opacity = opacity;+ Worldview.Map.setVisibility(layer, self.visible, self.opacity);+ };++ self.setVisibility = function(visible) {+ if ( self.visible === visible ) {+ return;+ }+ self.visible = visible;+ Worldview.Map.setVisibility(layer, self.visible, self.opacity);+ };++ /**+ * Method: setZIndex+ * Sets the z-index for the product's layer.+ *+ * Parameters:+ * index - The z-index to set.+ */+ self.setZIndex = function(index) {+ zIndex = index;+ setZOrder();+ };++ /**+ * Method: dispose+ * Removes the layer from the map.+ */+ self.dispose = function() {+ map.removeLayer(layer);+ map.events.unregister("movestart", self, invalidate);+ map.events.unregister("zoomend", self, invalidate);+ };++ /**+ * Method: setLookup+ * Does nothing. This can be implemented once there is a static data+ * product that could be adjusted.+ */+ self.setLookup = function(lookup) {+ };++ /**+ * Method: clearLookup+ * Does nothing. This can be implemented once there is a static data+ * product that could be adjusted.+ */+ self.clearLookup = function() {+ };++ //-------------------------------------------------------------------------+ // Private+ //-------------------------------------------------------------------------+ var setZOrder = function() {+ layer.setZIndex(zIndex);+ };++ var invalidate = function() {+ if ( layer ) {+ var opacity = layer.div.style.opacity;+ if ( opacity !== "" && opacity < 0.001 ) {+ layer.setVisibility(false);+ }+ }+ setZOrder();+ };++ init();+ return self;+}\ No newline at end of file