Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Added the ability for the image download box to keep its previous settings.

Shriram Ilavajhala2c4db692dca7
diff --git a/js/imageDownload.js b/js/imageDownload.js
index 65565382a..8d3e7b689 100644
--- a/js/imageDownload.js
+++ b/js/imageDownload.js
@@ -161,16 +161,22 @@ SOTE.widget.ImageDownload.prototype.updateComponent = function(qs){
//Reverse the order of overlays to get the correct layer ordering.
if (products != ""){
var a = products.split("~");
- var base = a[0].split(",");
+ var base = a[0].split(",");
+ base.reverse(); base.pop();
+ for(var i=0; i<base.length; i++){
+ if(base[i].charAt(0)!="!") {
+ dlURL += base[i]+",";
+ }
+ }
var overlays = a[1].split(/[\.,]/);
overlays.reverse(); overlays.pop();
- for(var i=1; i<base.length; ++i){
- dlURL += base[i]+",";
- }
+
for(var i=0; i<overlays.length; i++){
- dlURL+= overlays[i]+",";
+ if(overlays[i].charAt(0)!="!") {
+ dlURL+= overlays[i]+",";
+ }
}
//remove the extra ","
diff --git a/js/rubberBand.js b/js/rubberBand.js
index 2d031c17c..371a4f097 100644
--- a/js/rubberBand.js
+++ b/js/rubberBand.js
@@ -21,6 +21,8 @@ SOTE.widget.RubberBand = function (containerId, config){
this.container=document.getElementById(containerId);
this.coords = null;
+ this.previousCoords = null;
+
if (this.container==null){
this.setStatus("Error: element '"+containerId+"' not found!",true);
return;
@@ -131,9 +133,9 @@ SOTE.widget.RubberBand.toggle = function(o){
*
*/
SOTE.widget.RubberBand.prototype.setValue = function(c) {
-
+ this.previousCoords = this.coords;
this.coords = c;
- this.fire();
+ this.fire();
};
/**
@@ -245,16 +247,21 @@ SOTE.widget.RubberBand.prototype.draw = function() {
$("#"+this.cropee).Jcrop({
bgColor: 'black',
bgOpacity: 0.3,
- onSelect: function(c){SOTE.widget.RubberBand.handleChange(c, self);},
+ onSelect: function(c){self.previousCoords=self.coords;SOTE.widget.RubberBand.handleChange(c, self);},
onChange: function(c){SOTE.widget.RubberBand.handleChange(c, self);},
- onRelease: function(c){SOTE.widget.RubberBand.toggle({data: {self:self} }); },
+ onRelease: function(c){ self.coords=self.previousCoords; SOTE.widget.RubberBand.toggle({data: {self:self} }); },
fullScreen: true
});
this.jcropAPI = $('#'+this.cropee).data('Jcrop');
-
- this.jcropAPI.setSelect([($(window).width()/2)-100,($(window).height()/2)-100,($(window).width()/2)+100,($(window).height()/2)+100]);
-
+
+ if(this.coords) {
+ this.jcropAPI.setSelect([this.coords.x, this.coords.y,this.coords.x2,this.coords.y2]);
+ }
+ else {
+ this.jcropAPI.setSelect([($(window).width()/2)-100,($(window).height()/2)-100,($(window).width()/2)+100,($(window).height()/2)+100]);
+ }
+
};