Interactive interface for browsing global, full-resolution satellite imagery
Basics working with new colormap structure, but still needs work
Mike McGanncb6c66c0ea07
diff --git a/src/js/layers/wv.layers.options.js b/src/js/layers/wv.layers.options.jsindex 6bf8220c5..ec6f98eb5 100644--- a/src/js/layers/wv.layers.options.js+++ b/src/js/layers/wv.layers.options.js@@ -151,7 +151,7 @@ wv.layers.options = wv.layers.options || function(config, models, layer) {var sourcePalette = config.palettes.rendered[layer.palette.id];var targetPalette = config.palettes.custom[id];var translatedPalette =- wv.palettes.translate(sourcePalette, targetPalette);+ wv.palettes.translate(sourcePalette.scale, targetPalette);return selectorItem(translatedPalette, id, targetPalette.name);};diff --git a/src/js/palettes/wv.palettes.js b/src/js/palettes/wv.palettes.jsindex f6c9af8c3..3db113211 100644--- a/src/js/palettes/wv.palettes.js+++ b/src/js/palettes/wv.palettes.js@@ -40,13 +40,13 @@ wv.palettes = (function(self) {g.fillStyle = checkerboard;g.fillRect(0, 0, canvas.width, canvas.height);- if ( palette ) {- var colors = palette.colors;+ if ( palette && palette.scale ) {+ var colors = palette.scale.colors;var bins = colors.length;var binWidth = canvas.width / bins;var drawWidth = Math.ceil(binWidth);_.each(colors, function(color, i) {- g.fillStyle = "#" + color;+ g.fillStyle = "#" + color.substring(0,6);g.fillRect(Math.floor(binWidth * i), 0, drawWidth,canvas.height);});@@ -113,7 +113,7 @@ wv.palettes = (function(self) {};self.loadCustom = function(config) {- return wv.util.load(config.palettes, "custom", "config/palettes.json");+ return wv.util.load(config.palettes, "custom", "config/palettes-custom.json");};self.loadRendered = function(config, layerId) {diff --git a/src/js/palettes/wv.palettes.legend.js b/src/js/palettes/wv.palettes.legend.jsindex 0c1eccef8..5f40534fe 100644--- a/src/js/palettes/wv.palettes.legend.js+++ b/src/js/palettes/wv.palettes.legend.js@@ -112,13 +112,16 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {return;}var palette = model.forLayer(layer.id);+ if ( !palette.scale ) {+ return;+ }if (layer.palette.single) {$(selector + " .wv-palettes-type").html(palette.values[0]);} else if (layer.palette.classified) {$(selector + " .wv-palettes-center").html("Classes");} else {- var min = palette.values[0];- var max = palette.values[palette.values.length - 1];+ var min = palette.scale.labels[0];+ var max = palette.scale.labels[palette.scale.labels.length - 1];$(selector + " .wv-palettes-min").html(min);$(selector + " .wv-palettes-max").html(max);$(selector + " .wv-palettes-center").html(" ");@@ -130,18 +133,23 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {return;}var palette = model.forLayer(layer.id);+ if ( !palette.scale ) {+ return;+ }var x = event.pageX - $colorbar.offset().left;var width = $colorbar.width();var percent = x / width;- var bins = palette.values.length;+ var bins = palette.scale.labels.length;var index = Math.floor(bins * percent);if (index >= bins) {index = bins - 1;}+ var color = palette.scale.colors[index].substring(0, 6);+ var label = palette.scale.labels[index];$colorbar.tooltip("option", "content","<span class='wv-palettes-color-box' style='background: #" +- palette.colors[index] + "'>" + "</span>" + palette.values[index]);+ color + "'>" + "</span>" + label);};init();