Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-179: Removed validation for layer names to get this to work properly. Inconsistent state changes on startup was removing layers since they were invalid in one event even though they are correct in the next event.

Mike McGann08e5aec8c76b
diff --git a/js/Worldview/Widget/Palette.js b/js/Worldview/Widget/Palette.js
index 35878e28c..d67291ad3 100644
--- a/js/Worldview/Widget/Palette.js
+++ b/js/Worldview/Widget/Palette.js
@@ -18,14 +18,14 @@ Worldview.Widget.Palette = function(containerId, config, spec) {
var value = "";
var dialog = null;
var dialogForProduct = null;
-
+
self.config = config;
self.active = {};
+ self.inactive = {};
self.alignTo = spec.alignTo;
var init = function() {
- //Logging.debug("Worldview.Widget.Palette");
- log.debug("paletteWidget.init");
+ Logging.debug("Worldview.Widget.Palette");
if ( REGISTRY ) {
REGISTRY.register(containerId, self);
} else {
@@ -56,6 +56,7 @@ Worldview.Widget.Palette = function(containerId, config, spec) {
$.each(parts, function(index, part) {
var segments = part.split(",");
self.active[segments[0]] = segments[1];
+ self.inactive[segments[0]] = segments[1];
});
REGISTRY.fire(self);
};
@@ -95,7 +96,14 @@ Worldview.Widget.Palette = function(containerId, config, spec) {
changed = true;
}
});
-
+ $.each(self.inactive, function(product, palette) {
+ if ( $.inArray(product, state.products) >= 0 &&
+ !self.active[product] ) {
+ log.debug("Restoring palette for " + product);
+ self.active[product] = self.inactive[product];
+ changed = true;
+ }
+ });
if ( dialogForProduct &&
$.inArray(dialogForProduct, state.products) < 0 ) {
dialog.hide();
@@ -240,9 +248,11 @@ Worldview.Widget.Palette = function(containerId, config, spec) {
var log = Logging.getLogger("Worldview.PaletteSelection");
if ( palette.source === "rendered" ) {
delete self.active[product];
+ delete self.inactive[product];
log.debug("Palette: default");
} else {
self.active[product] = palette.id;
+ self.inactive[product] = palette.id;
log.debug("Palette: " + palette.id);
}
REGISTRY.fire(self);
diff --git a/js/bank.js b/js/bank.js
index ca7381d2f..d255c6beb 100644
--- a/js/bank.js
+++ b/js/bank.js
@@ -81,6 +81,7 @@ SOTE.widget.Bank = function(containerId, config){
}
SOTE.widget.Bank.prototype.buildMeta = function(cb,val){
+ this.buildMetaDone = false;
SOTE.util.getJSON(
"data/" + this.state + "_" + this.dataSourceUrl,
{self:this,callback:cb,val:val},
@@ -388,28 +389,6 @@ SOTE.widget.Bank.prototype.setValue = function(valString){
var valid = true;
var self = this;
- $.each(this.categories, function(index, name) {
- var category = name.replace(/\s/g, "").toLowerCase();
- if ( !(category in self.values) ) {
- self.log.warn("Invalid category: " + category + ", using defaults");
- self.values = self.unserialize(self.selected[self.state]);
- valid = false;
- }
- });
-
- if ( valid ) {
- for ( category in this.values ) {
- var validProducts = [];
- $.each(this.values[category], function(index, product) {
- if ( !(product.value in self.meta) ) {
- self.log.warn("Invalid product: " + product.value);
- } else {
- validProducts.push(product);
- }
- });
- this.values[category] = validProducts;
- }
- }
this.render();
this.fire();