Interactive interface for browsing global, full-resolution satellite imagery
WV-1694 Update colormaps to support Colormap Schema 1.3
Taylor Gunnoee54a303dcf3a
diff --git a/bin/wv-options-colormap b/bin/wv-options-colormapindex ffe000a76..6ec9b6d00 100755--- a/bin/wv-options-colormap+++ b/bin/wv-options-colormap@@ -62,6 +62,7 @@ def process_entries(colormap):colors = []labels = []values = []+ tooltips = []color_format = "{0:02x}{1:02x}{2:02x}{3:02x}"for entry in entries:@@ -70,6 +71,7 @@ def process_entries(colormap):if a == 0:continuecolors += [color_format.format(int(r), int(g), int(b), a)]+ tooltips += entry["@tooltip"]if "Legend" in colormap:legend = match_legend(entry, legends)if "@label" in legend:@@ -102,6 +104,7 @@ def process_entries(colormap):},"legend": {"labels": labels,+ "tooltips": tooltips,"colors": colors,"type": map_type}@@ -132,16 +135,13 @@ def process_file(file):result["title"] = colormap["@title"]result["entries"]["title"] = colormap["@title"]result["legend"]["title"] = colormap["@title"]- if ("Legend" in colormap) and ("@minLabel" in colormap["Legend"]):- result["legend"]["minLabel"] = colormap["Legend"]["@minLabel"]- result["entries"]["minLabel"] = colormap["Legend"]["@minLabel"]- elif "@minLabel" in colormap["Entries"]:- result["legend"]["minLabel"] = colormap["Entries"]["@minLabel"]- if ("Legend" in colormap) and ("@maxLabel" in colormap["Legend"]):- result["legend"]["maxLabel"] = colormap["Legend"]["@maxLabel"]- result["entries"]["maxLabel"] = colormap["Legend"]["@maxLabel"]- elif "@maxLabel" in colormap["Entries"]:- result["legend"]["maxLabel"] = colormap["Entries"]["@maxLabel"]+ if "Legend" in colormap:+ if "@minLabel" in colormap["Legend"]):+ result["legend"]["minLabel"] = colormap["Legend"]["@minLabel"]+ result["entries"]["minLabel"] = colormap["Legend"]["@minLabel"]+ if "@maxLabel" in colormap["Legend"]:+ result["legend"]["maxLabel"] = colormap["Legend"]["@maxLabel"]+ result["entries"]["maxLabel"] = colormap["Legend"]["@maxLabel"]if "@units" in colormap:result["legend"]["units"] = colormap["@units"]maps += [result]diff --git a/web/js/layers/wv.layers.options.js b/web/js/layers/wv.layers.options.jsindex 550b48005..77f730311 100644--- a/web/js/layers/wv.layers.options.js+++ b/web/js/layers/wv.layers.options.js@@ -264,8 +264,8 @@ wv.layers.options = wv.layers.options || function(config, models, layer) {min = min || palette.min || 0;max = max || palette.max || legend.labels.length - 1;- var minLabel = legend.labels[min];- var maxLabel = legend.labels[max];+ var minLabel = legend.labels[min] + " " + legend.units;+ var maxLabel = legend.labels[max] + " " + legend.units;$("#wv-layers-options-dialog .wv-label-range-min").html(minLabel);$("#wv-layers-options-dialog .wv-label-range-max").html(maxLabel);};diff --git a/web/js/palettes/wv.palettes.legend.js b/web/js/palettes/wv.palettes.legend.jsindex 605f6e85f..7c897a264 100644--- a/web/js/palettes/wv.palettes.legend.js+++ b/web/js/palettes/wv.palettes.legend.js@@ -149,7 +149,7 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {.addClass("wv-palettes-class-label").attr("data-index", index).attr("data-class-index", classIndex)- .html(legend.labels[classIndex]));+ .html(legend.labels[classIndex] + " " + legend.units));$detailPanel.append($row);});$panel.tooltip("option", "content", $detailPanel.html());@@ -179,10 +179,13 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {var legends = model.getLegends(layer.id, index);var entries = model.get(layer.id, index).entries;_.each(legends, function(legend, index) {- var min = legend.minLabel || _.first(entries.labels);- var max = legend.maxLabel || _.last(entries.labels);- $(selector + " [data-index='" + index + "'] .wv-palettes-min").html(min);- $(selector + " [data-index='" + index + "'] .wv-palettes-max").html(max);+ var min = legend.minLabel || _.first(legend.labels);+ var max = legend.maxLabel || _.last(legend.labels);+ var units = legend.units;+ $(selector + " [data-index='" + index + "'] .wv-palettes-min")+ .html(min + " " + unit);+ $(selector + " [data-index='" + index + "'] .wv-palettes-max")+ .html(max + " " + unit);var title = legend.title || " ";if (legends.length === 1 ){@@ -212,10 +215,12 @@ wv.palettes.legend = wv.palettes.legend || function(spec) {}var color = legend.colors[colorIndex];- var label = legend.labels[colorIndex] || entry.labels[colorIndex];+ var label = legend.tooltips[colorIndex];+ var unit = legend.units;+$colorbar.tooltip("option", "content","<span class='wv-palettes-color-box' style='background: " +- wv.util.hexToRGBA(color) + "'>" + "</span>" + label);+ wv.util.hexToRGBA(color) + "'>" + "</span>" + label + " " + units);};var highlightClass = function() {