Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Removed WMS palette options from sidebar modal. - Removed WMS palette options from sidebar modal. - Reverted WMS lookup class to use standard tile class.

ZachTRicea66e0a9406df
diff --git a/web/js/layers/wv.layers.options.js b/web/js/layers/wv.layers.options.js
index d235eb54d..6b169b2bd 100644
--- a/web/js/layers/wv.layers.options.js
+++ b/web/js/layers/wv.layers.options.js
@@ -55,10 +55,14 @@ wv.layers.options = wv.layers.options || function(config, models, layer) {
if ((legend.type === "continuous") ||
(legend.type === "discrete")) {
renderRange($dialog);
- renderPaletteSelector($dialog);
+ if (config.layers[layer.id].type !== "wms") {
+ renderPaletteSelector($dialog);
+ }
} else if (models.palettes.getDefaultLegend(layer.id, index)
.colors.length === 1) {
- renderPaletteSelector($dialog);
+ if (config.layers[layer.id].type !== "wms") {
+ renderPaletteSelector($dialog);
+ }
}
}
}
diff --git a/web/js/map/wv.map.layerbuilder.js b/web/js/map/wv.map.layerbuilder.js
index dc9e2fe6e..323eadb06 100644
--- a/web/js/map/wv.map.layerbuilder.js
+++ b/web/js/map/wv.map.layerbuilder.js
@@ -295,7 +295,7 @@ wv.map.layerbuilder = wv.map.layerbuilder || function(models, config, cache, Par
if (models.palettes.isActive(def.id)) {
var lookup = models.palettes.getLookup(def.id);
- sourceOptions.tileClass = ol.wv.LookupWMS.factory(lookup);
+ sourceOptions.tileClass = ol.wv.LookupImageTile.factory(lookup);
}
var layer = new ol.layer.Tile({extent: extent, source: new ol.source.TileWMS(sourceOptions)});
return layer;
diff --git a/web/js/ol.wv/ol.wv.lookupimagetile.js b/web/js/ol.wv/ol.wv.lookupimagetile.js
index de7abd574..f45be38cb 100644
--- a/web/js/ol.wv/ol.wv.lookupimagetile.js
+++ b/web/js/ol.wv/ol.wv.lookupimagetile.js
@@ -86,92 +86,3 @@ ol.wv.LookupImageTile.factory = function(lookup) {
crossOrigin, tileLoadFunction);
};
};
-
-/**
- * @constructor
- * @extends {ol.ImageTile}
- */
-ol.wv.LookupWMS = function(lookup, tileCoord, state, src, crossOrigin, tileLoadFunction) {
-
- goog.base(this, tileCoord, state, src, "anonymous", tileLoadFunction);
-
- /**
- * @private
- */
- this.lookup_ = lookup;
-
- /**
- * @private
- */
- this.canvas_ = null;
-};
-goog.inherits(ol.wv.LookupWMS, ol.ImageTile);
-
-/**
- * @return (HTMLCanvasElement|HTMLImageElement|HTMLVideoElement|null)
- */
-ol.wv.LookupWMS.prototype.getImage = function(opt_context) {
- return this.canvas_;
-};
-
-ol.wv.LookupWMS.prototype.load = function() {
-
- if (this.state === ol.TileState.IDLE) {
- this.state = ol.TileState.LOADING;
- var that = this;
-
- //default color
- var defaultRGBA = Object.keys(that.lookup_)[0];
- var defaultRGBAArray = JSON.parse("[" + defaultRGBA + "]");
- var defaultLookupHex = wv.util.rgbaToHex(defaultRGBAArray[0],defaultRGBAArray[1],defaultRGBAArray[2]);
-
- // var onImageLoad - On WMS / WMTS image load, convert the requested images into canvas
- var onImageLoad = function(e) {
- var newLookup = that.lookup_[defaultRGBA];
-
- // Create the canvas elements to copy source wms / wmts image from
- that.canvas_ = document.createElement("canvas");
- that.canvas_.width = that.image_.width;
- that.canvas_.height = that.image_.height;
- // Account for a RGBA value for each pixel.
- var octets = that.canvas_.width * that.canvas_.height * 4;
- // Set the type of canvas to draw
- var g = that.canvas_.getContext("2d");
-
- // Draw the wms/wmts image at x,y
- g.drawImage(that.image_, 0, 0);
- var imageData = g.getImageData(0, 0, that.canvas_.width, that.canvas_.height);
-
- var pixels = imageData.data;
-
- for (var i = 0; i < octets; i += 4) {
- var hexSource = wv.util.rgbaToHex(pixels[i + 0], pixels[i + 1], pixels[i + 2]);
-
- if (wv.util.hexColorDelta(hexSource, defaultLookupHex) < 125) { // If the two colors are close
- if (newLookup) {
- pixels[i + 0] = newLookup.r;
- pixels[i + 1] = newLookup.g;
- pixels[i + 2] = newLookup.b;
- pixels[i + 3] = newLookup.a;
- }
- }
- }
- g.putImageData(imageData, 0, 0);
- that.state = ol.TileState.LOADED;
- that.changed();
- that.image_.removeEventListener("load", onImageLoad);
- };
- this.image_.src = this.src_;
- this.image_.addEventListener("load", onImageLoad);
- }
-
-};
-
-/**
- * @api
- */
-ol.wv.LookupWMS.factory = function(lookup) {
- return function(tileCoord, state, src, crossOrigin, tileLoadFunction) {
- return new ol.wv.LookupWMS(lookup, tileCoord, state, src, crossOrigin, tileLoadFunction);
- };
-};