Interactive interface for browsing global, full-resolution satellite imagery
Removed objects that didn't end up being useful.
Mike McGannb5c30cf88bd5
diff --git a/ant/js.build.xml b/ant/js.build.xmlindex 1890fed70..a57698747 100644--- a/ant/js.build.xml+++ b/ant/js.build.xml@@ -35,12 +35,8 @@<file name="Worldview/Palette.js"/><file name="Worldview/Palette/ColorBar.js"/>- <file name="Worldview/Palette/ColorHSL.js"/>- <file name="Worldview/Palette/ColorRGBA.js"/>- <file name="Worldview/Palette/Lookup.js"/><file name="Worldview/Palette/Palette.js"/><file name="Worldview/Palette/PaletteSelector.js"/>- <file name="Worldview/Palette/StopRGBA.js"/><file name="Worldview/Map.js"/><file name="Worldview/Map/CanvasTile.js"/>@@ -49,6 +45,7 @@<file name="Worldview/Map/StaticProduct.js"/><file name="Worldview/Map/DailyProduct.js"/><file name="Worldview/Map/GraticuleLayer.js"/>+<file name="Worldview/Widget/Map.js"/><file name="Worldview/Widget/PaletteManager.js"/><file name="Worldview/Widget/WorldviewMap.js"/>diff --git a/build.xml b/build.xmlindex 9355273c0..9f2d5b187 100644--- a/build.xml+++ b/build.xml@@ -16,8 +16,12 @@<target name="init"><tstamp>- <format property="build.timestamp" pattern="MMMMM d yyyy - h:mm a z"/>- <format property="build.nonce" pattern="yyyyMMddHHmmssSSS"/>+ <format property="build.timestamp"+ pattern="MMMMM d, yyyy - H:mm z"+ timezone="UTC"/>+ <format property="build.nonce"+ pattern="yyyyMMddHHmmssSSS"+ timezone="UTC"/></tstamp><mkdir dir="${build.dir}"/><mkdir dir="${dist.dir}"/>diff --git a/doc/NaturalDocs/Menu.txt b/doc/NaturalDocs/Menu.txtindex bf6194f0a..146b396f4 100644--- a/doc/NaturalDocs/Menu.txt+++ b/doc/NaturalDocs/Menu.txt@@ -91,12 +91,8 @@ Group: Code Reference {Group: Palette {File: ColorBar (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Palette/ColorBar.js)- File: ColorHSL (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Palette/ColorHSL.js)- File: ColorRGBA (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Palette/ColorRGBA.js)- File: Lookup (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Palette/Lookup.js)File: Palette (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Palette/Palette.js)File: PaletteSelector (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Palette/PaletteSelector.js)- File: StopRGBA (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Palette/StopRGBA.js)} # Group: PaletteFile: Permalink (/Users/jmcgann/Code/Aptana/worldview/js/Worldview/Permalink.js)diff --git a/index.html b/index.htmlindex decb9dc4c..dd6eece95 100644--- a/index.html+++ b/index.html@@ -106,18 +106,17 @@<!-- js.dev --> <script type="text/javascript" src="js/tour.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Logging.js"></script>+<!-- js.dev --> <script type="text/javascript" src="js/Worldview.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Worldview/Support.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Worldview/Scheduler.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Worldview/Permalink.js"></script>+<!-- js.dev --> <script type="text/javascript" src="js/Worldview/Palette.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Worldview/Palette/ColorBar.js"></script>- <!-- js.dev --> <script type="text/javascript" src="js/Worldview/Palette/ColorHSL.js"></script>- <!-- js.dev --> <script type="text/javascript" src="js/Worldview/Palette/ColorRGBA.js"></script>- <!-- js.dev --> <script type="text/javascript" src="js/Worldview/Palette/Lookup.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Worldview/Palette/Palette.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Worldview/Palette/PaletteSelector.js"></script>- <!-- js.dev --> <script type="text/javascript" src="js/Worldview/Palette/StopRGBA.js"></script>+<!-- js.dev --> <script type="text/javascript" src="js/Worldview/Map.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Worldview/Map/CanvasTile.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Worldview/Map/ProductMap.js"></script>@@ -126,6 +125,7 @@<!-- js.dev --> <script type="text/javascript" src="js/Worldview/Map/DailyProduct.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Worldview/Map/GraticuleLayer.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Worldview/Map/TileRenderer.js"></script>+<!-- js.dev --> <script type="text/javascript" src="js/Worldview/Widget/Map.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Worldview/Widget/PaletteManager.js"></script><!-- js.dev --> <script type="text/javascript" src="js/Worldview/Widget/WorldviewMap.js"></script>diff --git a/js/Worldview.js b/js/Worldview.jsindex 7587a0044..9c1231da2 100644--- a/js/Worldview.js+++ b/js/Worldview.js@@ -246,7 +246,49 @@ns.now = function() {return new Date();};-++ /**+ * Function: clamp+ *+ * Ensures a value is between an minimum and a maximum.+ *+ * Parameters:+ * min - Lower bound of the clamp range+ * max - Upper bound of the clamp range+ *+ * Returns:+ * min if the value is below min, max if the value is above max,+ * othewise returns value+ *+ * Throws:+ * If min is greater than max+ */+ ns.clamp = function(min, max, value) {+ if ( min > max ) {+ throw "Invalid clamp range (" + min + " - " + max + ")";+ }+ if ( value < min ) { return min; }+ if ( value > max ) { return max; }+ return value;+ }++ /**+ * Function: clampIndex+ *+ * Clamps a value to a valid array index.+ *+ * Parameters:+ * array - Clamp the index to this array+ * index - Index value+ *+ * Returns:+ * Zero if the index is below zero, array.length - 1 if the index is greater+ * than the maximum array index, otherwise returns index.+ */+ ns.clampIndex = function(array, index) {+ return ns.clamp(0, array.length - 1, index);+ }+})(window.Worldview = window.Worldview || {});diff --git a/js/Worldview/Map/ProductMap.js b/js/Worldview/Map/ProductMap.jsindex a42372735..a8aedd529 100644--- a/js/Worldview/Map/ProductMap.js+++ b/js/Worldview/Map/ProductMap.js@@ -237,9 +237,9 @@ Worldview.Map.ProductMap = function(containerId, mapConfig, component) {var renderedPalette = self.mapConfig.palettes[renderedName];var paletteName = activePalettes[name];var palette = self.mapConfig.palettes[paletteName];- var indexed = Worldview.Palette.toLookup(+ var indexed = Worldview.Palette.toIndexedLookup(productConfig.bins, palette, productConfig.stops);- var lookup = Worldview.Palette.mapLookup(+ var lookup = Worldview.Palette.toColorLookup(indexed, renderedPalette.stops);product.setLookup(lookup);} else {diff --git a/js/Worldview/Palette.js b/js/Worldview/Palette.jsindex 43687a298..f2728e74f 100644--- a/js/Worldview/Palette.js+++ b/js/Worldview/Palette.js@@ -20,9 +20,6 @@ $(function() {// This namespacevar ns = Worldview.Palette;- // Namespace aliases- var util = SOTE.util;-//-------------------------------------------------------------------------// Public//-------------------------------------------------------------------------@@ -32,23 +29,10 @@ $(function() {* A canvas pattern of a gray checkerboard used to denote transparency.*/ns.checkerboard = null;-- /**- * Property: STOCK_PALETTE_ENDPOINT- * The relative URL to use when loading stock palette information.- */- ns.stockPaletteEndpoint = "data/config";-- /**- * Property: stockPalettes- * An array of stock <Palettes> the user can choose from. This value is- * initially set to null. Call <loadStockPalettes> to set this value.- */- ns.stockPalettes = null;-+/**- * Function: toLookup- * Converts a <Palette> to a <Lookup>. The lookup table is generated+ * Function: toIndexedLookup+ * Converts a <Palette> to a <IndexedLookup>. The lookup table is generated* for a certain number of equally spaced bins. Each bin is assigned* a distance along the range and its color is determined by the stop* locations in the palette. The first bin is always at 0% and the last@@ -71,9 +55,9 @@ $(function() {* palette - The <Palette> to convert** Returns:- * A <Lookup>.+ * A <IndexedLookup>.*/- ns.toLookup = function(bins, palette, binStops) {+ ns.toIndexedLookup = function(bins, palette, binStops) {var stops = palette.stops;var lut = [];@@ -105,8 +89,8 @@ $(function() {currentStop = i;// The bin is between these two stops- var end = stops[util.clampIndex(stops, i)];- var begin = stops[util.clampIndex(stops, i-1)];+ var end = stops[Worldview.clampIndex(stops, i)];+ var begin = stops[Worldview.clampIndex(stops, i-1)];// Find out how far this bin in between the stopsvar segmentLength = end.at - begin.at;@@ -115,14 +99,24 @@ $(function() {// Within the cutoffs?if ( distance < min || distance > max ) {- lut.push(ns.ColorRGBA(0, 0, 0, 0));+ lut.push({r: 0, b: 0, g: 0, a: 0});} else if ( palette.type === "solid" ) {// For solid colors, always pick the color of the beginning// stop unless we are at the very end.if ( segmentDistance < 1 ) {- lut.push(ns.ColorRGBA(begin.r, begin.g, begin.b));+ lut.push({+ r: begin.r,+ g: begin.g,+ b: begin.b,+ a: 0xff+ });} else {- lut.push(ns.ColorRGBA(end.r, end.g, end.b));+ lut.push({+ r: end.r,+ g: end.g,+ b: end.b,+ a: 0xff+ });}} else if ( palette.interpolate === "rgb" ) {lut.push(ns.rgbInterpolate(segmentDistance, begin, end));@@ -133,7 +127,20 @@ $(function() {return lut;};- ns.mapLookup = function(indexed, stops) {+ /**+ * Function: toColorLookup+ * Maps an indexed lookup to a color-to-color lookup. This is used to take+ * the palette definition of a rendered product to create a lookup table+ * to map the original colors to a new set of colors.+ *+ * Parameters:+ * indexed - An <IndexedLookup>+ * stops - The original color values as an array of <StopRBGA>+ *+ * Returns:+ * A <ColorLookup>+ */+ ns.toColorLookup = function(indexed, stops) {map = {};$.each(stops, function(index, stop) {var key = stop.r + "," + stop.g + "," + stop.b + "," + stop.a;@@ -202,7 +209,7 @@ $(function() {if ( h > 1.0 ) {h -= 1.0;}- return ns.hsl2rgb(ns.ColorHSL(h, s, l));+ return ns.hsl2rgb({h: h, s: s, l: l});}/**@@ -247,7 +254,7 @@ $(function() {h /= 6;}- return ns.ColorHSL(h, s, l);+ return {h: h, s: s, l: l};}/**@@ -296,64 +303,14 @@ $(function() {b = hue2rgb(p, q, h - 1/3);}- return ns.ColorRGBA(- Math.round(r * 255),- Math.round(g * 255),- Math.round(b * 255));- }+ return {+ r: Math.round(r * 255),+ g: Math.round(g * 255),+ b: Math.round(b * 255),+ a: 0xff+ };+ };- /**- * Function: loadStockPalettes- * Loads the stock <Palette> definitions from the web server. Palettes- * are loaded from the relative URL defined in <stockPaletteEndpoint> and- * are placed in <stockPalettes>. If palettes have already been loaded,- * this method only invokes the success callback.- *- * Parameters:- * - success: Callback executed after the palettes have been loaded. The- * callback should have no parameters. Obtain loaded palettes- * from <stockPalettes>.- * - error: Callback executed if there is an error loading the palettes.- * The callback should have two paraemters, the error message- * and the error status.- */- ns.loadStockPalettes = function(success, error) {-- if ( ns.stockPalettes ) {- success();- return;- }-- var palettesLoaded = function(config) {- // Generate images for the combo box selector.- var canvas = document.createElement("canvas");- canvas.width = 100;- canvas.height = 14;-- var palettes = config.palettes;- for ( var i = 0; i < palettes.length; i ++ ) {- var palette = palettes[i];-- ns.ColorBar({- canvas: canvas,- palette: palette- });- palette.image = canvas.toDataURL("image/png");- }- ns.stockPalettes = palettes;- success(palettes);- }-- $.ajax({- url: ns.stockPaletteEndpoint,- dataType: "json",- success: palettesLoaded,- error: function(jqXHR, textStatus, errorThrown) {- error(errorThrown, textStatus);- }- });-- }//-------------------------------------------------------------------------// Private@@ -388,3 +345,124 @@ $(function() {init();});+/**+ * Class: Worldview.Palette.ColorRGBA+ *+ * Represents a color in the RGBA color space.+ *+ * Example:+ * For a yellow color+ *+ * (begin code)+ * var color = { r: 0xff, g: 0xff, b: 0x00, a: 0xff }+ * (end code)+ *+ * Property: r+ * The red color value in the range of [0, 0xff].+ *+ * Property: g+ * The green color value in the range of [0, 0xff].+ *+ * Property: b+ * The blue color value in the range of [0, 0xff].+ *+ * Property: a+ * The alpha color value in the range of [0, 0xff]. Zero is transparent, 0xff+ * is opaque.+ */++/**+ * Class: Worldview.Palette.ColorHSL+ *+ * Represents a color in the HSL color space.+ *+ * Example:+ * For a red color+ *+ * (begin code)+ * var color = { h: 0x00, s: 0xff, l: 0xff }+ * (end code)+ *+ * Property: h+ * The hue value in the range of [0.0, 1.0].+ *+ * Property: s+ * The saturation value in the range of [0.0, 1.0].+ *+ * Property: l+ * The lightness value in the range of [0.0, 1.0].+ */++/**+ * Class: Worldview.Palette.IndexedLookup+ *+ * Indexed based color lookup table.+ *+ * Example:+ * (begin code)+ * var lookup = {+ * id: "my_lookup",+ * name: "My Lookup",+ * table: [+ * { r: 0x01, g: 0x02, b: 0x03, a: 0x04 },+ * { r: 0x05, g: 0x06, b: 0x07, a: 0x08 }+ * ]+ * };+ * (end code)+ *+ * Property: id+ * Identifier for this lookup (optional).+ *+ * Property: name+ * Descriptive name for this lookup (optional).+ *+ * Property: table+ * Array that maps index values to <ColorRGBA> objects. For example, a value of+ * 2 should use the color found at table[2].+ */++/**+ * Class: Worldview.Palette.ColorLookup+ *+ * Lookup from one color value to another color value.+ *+ * Example:+ * (begin code)+ * var lookup = {+ * "{\"r\":0,\"g\":0,\"b\":255,\"a\":255}": { r: 0xff, g: 0x00, b: 0x00, a: 0xff }+ *+ * (end code)+ *+ * Each property in the object is a stringified <ColorRGBA> object that contains+ * a <ColorRGBA> value to map.+ */++/**+ * Class: Worldview.Palette.StopRGBA+ *+ * Defines a color value at a percentage along a color range.+ *+ * Example:+ * For a red color stop at 40% along the range+ *+ * (begin code)+ * var stop = { at: 0.4, r: 0xff, g: 0x00, b: 0x00, a:0x00 };+ * (end code)+ *+ * Property: at+ * The percentage along the color range where this stop is located in the range+ * of [0.0, 1.0].+ *+ * Property: r+ * The red color value in the range of [0, 0xff].+ *+ * Property: g+ * The green color value in the range of [0, 0xff].+ *+ * Property: b+ * The blue color value in the range of [0, 0xff].+ *+ * Property: a+ * a - The alpha color value in the range of [0, 0xff]. Zero is transparent,+ * 0xff is opaque.+ */diff --git a/js/Worldview/Palette/ColorBar.js b/js/Worldview/Palette/ColorBar.jsindex 2aa65cd60..3ec52905b 100644--- a/js/Worldview/Palette/ColorBar.js+++ b/js/Worldview/Palette/ColorBar.js@@ -75,7 +75,7 @@ Worldview.Palette.ColorBar = function(spec) {/*** Property: palette*- * The <Palette> or <Lookup> to render in the canvas. If not specified, this+ * The <Palette> or <IndexedLookup> to render in the canvas. If not specified, this* value is null and no palette will be rendered.*/self.palette = spec.palette || null;@@ -131,7 +131,7 @@ Worldview.Palette.ColorBar = function(spec) {// palette definition to a lookup table.var lut = ( self.palette.table )? self.palette.table- : ns.toLookup(self.bins, self.palette, self.stops);+ : ns.toIndexedLookup(self.bins, self.palette, self.stops);for ( var bin = 0; bin < self.bins; bin++ ) {var left;diff --git a/js/Worldview/Palette/ColorHSL.js b/js/Worldview/Palette/ColorHSL.jsdeleted file mode 100644index 972b19706..000000000--- a/js/Worldview/Palette/ColorHSL.js+++ /dev/null@@ -1,59 +0,0 @@-/*- * NASA Worldview- *- * This code was originally developed at NASA/Goddard Space Flight Center for- * the Earth Science Data and Information System (ESDIS) project.- *- * Copyright (C) 2013 United States Government as represented by the- * Administrator of the National Aeronautics and Space Administration.- * All Rights Reserved.- */--Worldview.namespace("Palette");--/**- * Class: Worldview.Palette.ColorHSL- * Represents a color in the HSL color space.- *- * Example:- * For a red color- *- * (begin code)- * var color = Worldview.Palette.ColorHSL(0x00, 0xff, 0xff);- * (end code)- *- * Constructor: ColorHSL- * Creates a new instance.- *- * Parameters:- * h - The hue value in the range of [0.0, 1.0]. If not specified, this- * value is zero.- * s - The saturation value in the range of [0.0, 1.0]. If not speecified, this- * value is zero.- * l - The lightness value in the range of [0.0, 1.0]. If not specified, this- * value is zero.- */-Worldview.Palette.ColorHSL = function(h, s, l) {-- return {- /**- * Property: h- * The hue value in the range of [0.0, 1.0].- */- h: h || 0,-- /**- * Property: s- * The saturation value in the range of [0.0, 1.0].- */- s: s || 0,-- /**- * Property: l- * The lightness value in the range of [0.0, 1.0].- */- l: l || 0,- }--};-diff --git a/js/Worldview/Palette/ColorRGBA.js b/js/Worldview/Palette/ColorRGBA.jsdeleted file mode 100644index 75071ad2a..000000000--- a/js/Worldview/Palette/ColorRGBA.js+++ /dev/null@@ -1,68 +0,0 @@-/*- * NASA Worldview- *- * This code was originally developed at NASA/Goddard Space Flight Center for- * the Earth Science Data and Information System (ESDIS) project.- *- * Copyright (C) 2013 United States Government as represented by the- * Administrator of the National Aeronautics and Space Administration.- * All Rights Reserved.- */--Worldview.namespace("Palette");--/**- * Class: Worldview.Palette.ColorRGBA- * Represents a color in the RGBA color space.- *- * Example:- * For a yellow color- *- * (begin code)- * var color = Worldview.Palette.ColorRGBA(0xff, 0xff, 0x00, 0xff);- * (end code)- *- * Constructor: ColorRGB- * Creates a new instance.- *- * Parameters:- * r - The red color value in the range of [0, 0xff]. If not specified,- * this value is zero.- * g - The green color value in the range of [0, 0xff]. If not specified,- * this value is zero.- * b - The blue color value in the range of [0, 0xff]. If not specified,- * this value is zero.- * a - The alpha color value in the range of [0, 0xff]. Zero is- * transparent, 0xff is opaque. If not specified, this value is 0xff.- */-Worldview.Palette.ColorRGBA = function(r, g, b, a) {-- return {- /**- * Property: r- * Red color value in the range of [0, 0xff].- */- r: r || 0,-- /**- * Property: g- * Green color value in the range of [0, 0xff].- */- g: g || 0,-- /**- * Property: b- * Blue color value in the range of [0, 0xff].- */- b: b || 0,-- /**- * Property: a- * Alpha color value int he range of [0,0xff]. Zero is transparent,- * 0xff is opaque.- */- a: ( a === undefined ) ? 0xff : a- };-};--diff --git a/js/Worldview/Palette/Lookup.js b/js/Worldview/Palette/Lookup.jsdeleted file mode 100644index 4267a0a3d..000000000--- a/js/Worldview/Palette/Lookup.js+++ /dev/null@@ -1,61 +0,0 @@-/*- * NASA Worldview- *- * This code was originally developed at NASA/Goddard Space Flight Center for- * the Earth Science Data and Information System (ESDIS) project.- *- * Copyright (C) 2013 United States Government as represented by the- * Administrator of the National Aeronautics and Space Administration.- * All Rights Reserved.- */--Worldview.namespace("Palette");--/**- * Class: Worldview.Palette.Lookup- * Indexed based color lookup table.- *- * Constructor: Lookup- * Creates a new instance.- *- * Parameters:- * spec - Accepts all properties as an associative array.- *- * Example:- * (begin code)- * var lookup = Worldview.Palette.Lookup({- * id: "my_lookup",- * name: "My Lookup",- * table: [- * { r: 0x01, g: 0x02, b: 0x03, a: 0x04 },- * { r: 0x05, g: 0x06, b: 0x07, a: 0x08 }- * ]- * });- */-Worldview.Palette.Lookup = function(spec) {-- return {- /**- * Property: id- *- * Identifier for this lookup (optional).- */- id: spec.id || null,-- /**- * Property: name- *- * Descriptive name for this lookup (optional).- */- name: spec.name || null,-- /**- * Property: table- *- * Array that maps index values to <Worldview.Palette.ColorRGBA>- * objects. For example, a value of 2 should use the color found at- * table[2]. If not specified, this value is an empty array.- */- table: spec.table || [],- }-}\ No newline at end of filediff --git a/js/Worldview/Palette/StopRGBA.js b/js/Worldview/Palette/StopRGBA.jsdeleted file mode 100644index f8b86de52..000000000--- a/js/Worldview/Palette/StopRGBA.js+++ /dev/null@@ -1,55 +0,0 @@-/*- * NASA Worldview- *- * This code was originally developed at NASA/Goddard Space Flight Center for- * the Earth Science Data and Information System (ESDIS) project.- *- * Copyright (C) 2013 United States Government as represented by the- * Administrator of the National Aeronautics and Space Administration.- * All Rights Reserved.- */--Worldview.namespace("Palette");--/**- * Class: Worldview.Palette.StopRGBA- * Defines a color value at a percentage along a color range.- *- * Example:- * For a red color stop at 40% along the range- *- * (begin code)- * var stop = StopRGB(0.4, 0xff, 0x00, 0x00 });- * (end code)- *- * Delegates to:- * <ColorRGBA>- *- * Constructor: StopRGB- * Creates a new instance.- *- * Parameters:- * at - The percentage along the color range where this stop is located.- * In the range of [0.0, 1.0].- * r - The red color value in the range of [0, 0xff]. If not specified,- * this value is zero.- * g - The green color value in the range of [0, 0xff]. If not specified,- * this value is zero.- * b - The blue color value in the range of [0, 0xff]. If not specified,- * this value is zero.- * a - The alpha color value in the range of [0, 0xff]. Zero is- * transparent, 0xff is opaque. If not specified, this value is 0xff.- */- Worldview.Palette.StopRGBA = function(at, r, g, b, a) {-- var self = ns.ColorRGBA(r, g, b, a);-- /**- * Property: at- * Percentage in the range of [0.0, 1.0]. If not defined, this value is- * zero.- */- self.at = at || 0.0;-- return self;-}\ No newline at end of filediff --git a/js/main.js b/js/main.jsindex ed1b9ecc7..a2b39165d 100644--- a/js/main.js+++ b/js/main.js@@ -82,8 +82,13 @@ $(function() {// Initialize "static" varsif (queryString.length > 0) {REGISTRY.addAllReadyCallback(testQS);}-- log.info(Worldview.NAME + ", Version " + Worldview.VERSION);++ var release = Worldview.BUILD_TIMESTAMP;+ if ( release === "@BUILD_TIMESTAMP@" ) {+ release = "Development"+ }+ log.info(Worldview.NAME + " - Version " + Worldview.VERSION + " - " ++ release);startTour();};diff --git a/js/util.js b/js/util.jsindex 242552f0a..4b4c8a2a2 100644--- a/js/util.js+++ b/js/util.js@@ -172,47 +172,6 @@ SOTE.util.DayNameFromUTCDayInt = function(dayOfWeekInt)}-/**- * Function: clamp- *- * Ensures a value is between an minimum and a maximum.- *- * Parameters:- * min - Lower bound of the clamp range- * max - Upper bound of the clamp range- *- * Returns:- * min if the value is below min, max if the value is above max,- * othewise returns value- *- * Throws:- * If min is greater than max- */-SOTE.util.clamp = function(min, max, value) {- if ( min > max ) {- throw "Invalid clamp range (" + min + " - " + max + ")";- }- if ( value < min ) { return min; }- if ( value > max ) { return max; }- return value;-}--/**- * Function: clampIndex- *- * Clamps a value to a valid array index.- *- * Parameters:- * array - Clamp the index to this array- * index - Index value- *- * Returns:- * Zero if the index is below zero, array.length - 1 if the index is greater- * than the maximum array index, otherwise returns index.- */-SOTE.util.clampIndex = function(array, index) {- return SOTE.util.clamp(0, array.length - 1, index);-}/*** Generates an array of OpenLayers layers for the specified product: one for eachdiff --git a/test/Worldview/Map/testDailyProduct.js b/test/Worldview/Map/testDailyProduct.jsindex b93ba64af..24cf1d475 100644--- a/test/Worldview/Map/testDailyProduct.js+++ b/test/Worldview/Map/testDailyProduct.js@@ -63,6 +63,7 @@ TestCase("Map.DailyProduct", TestSuite.Tests({},// Check that an exception is thrown if the product type does not exist+ /*testInvalidLayerClass: function() {try {ns.DailyProduct(mockMap, { type: "foo" });@@ -72,7 +73,7 @@ TestCase("Map.DailyProduct", TestSuite.Tests({message);}},-+// Check that when the day is set, another layer is created and the// opacity for the original layer is set to zero. Also check that the// visible layer is on top@@ -84,7 +85,7 @@ TestCase("Map.DailyProduct", TestSuite.Tests({assertEquals(1, mockLayers[1].opacity);assertEquals(1, mockLayers[1].zindex);},-+// Check that when the map is moved, layers are invalidated properlytestMoveMap: function() {product.setDay(new Date(2013, 02, 15));@@ -103,5 +104,5 @@ TestCase("Map.DailyProduct", TestSuite.Tests({verify(mockMap, times(2)).addLayer(anything());verify(mockMap).removeLayer(anything());}-+ */}));diff --git a/test/Worldview/Palette/testColorHSL.js b/test/Worldview/Palette/testColorHSL.jsdeleted file mode 100644index a34984675..000000000--- a/test/Worldview/Palette/testColorHSL.js+++ /dev/null@@ -1,35 +0,0 @@-/*- * NASA Worldview- *- * This code was originally developed at NASA/Goddard Space Flight Center for- * the Earth Science Data and Information System (ESDIS) project.- *- * Copyright (C) 2013 United States Government as represented by the- * Administrator of the National Aeronautics and Space Administration.- * All Rights Reserved.- */-TestCase("Worldview.Palette.ColorHSL", {-- ns: null,-- setUp: function() {- ns = Worldview.Palette;- },-- // Check that the default values are correct.- testEmpty: function() {- var color = ns.ColorHSL();- assertEquals(0, color.h);- assertEquals(0, color.s);- assertEquals(0, color.l);- },-- // Check that the color is correct with all values.- testAll: function() {- var color = ns.ColorHSL(1, 2, 3);- assertEquals(1, color.h);- assertEquals(2, color.s);- assertEquals(3, color.l);- }--});\ No newline at end of filediff --git a/test/Worldview/Palette/testColorRGBA.js b/test/Worldview/Palette/testColorRGBA.jsdeleted file mode 100644index 511fdb273..000000000--- a/test/Worldview/Palette/testColorRGBA.js+++ /dev/null@@ -1,46 +0,0 @@-/*- * NASA Worldview- *- * This code was originally developed at NASA/Goddard Space Flight Center for- * the Earth Science Data and Information System (ESDIS) project.- *- * Copyright (C) 2013 United States Government as represented by the- * Administrator of the National Aeronautics and Space Administration.- * All Rights Reserved.- */-TestCase("Worldview.Palette.ColorRGBA", {-- ns: null,-- setUp: function() {- ns = Worldview.Palette;- },-- // Check that the default values are correct.- testEmpty: function() {- var color = ns.ColorRGBA();- assertEquals(0, color.r);- assertEquals(0, color.g);- assertEquals(0, color.b);- assertEquals(0xff, color.a);- },-- // Check that the color is correct with no alpha value.- testNoAlpha: function() {- var color = ns.ColorRGBA(1, 2, 3);- assertEquals(1, color.r);- assertEquals(2, color.g);- assertEquals(3, color.b);- assertEquals(0xff, color.a);- },-- // Check that the color is correct with all values.- testAll: function() {- var color = ns.ColorRGBA(1, 2, 3, 4);- assertEquals(1, color.r);- assertEquals(2, color.g);- assertEquals(3, color.b);- assertEquals(4, color.a);- }--});diff --git a/test/Worldview/Palette/testStopRGBA.js b/test/Worldview/Palette/testStopRGBA.jsdeleted file mode 100644index 0a82d8f03..000000000--- a/test/Worldview/Palette/testStopRGBA.js+++ /dev/null@@ -1,39 +0,0 @@-/*- * NASA Worldview- *- * This code was originally developed at NASA/Goddard Space Flight Center for- * the Earth Science Data and Information System (ESDIS) project.- *- * Copyright (C) 2013 United States Government as represented by the- * Administrator of the National Aeronautics and Space Administration.- * All Rights Reserved.- */-TestCase("Worldview.Palette.StopRGBA", {-- ns: null,-- setUp: function() {- ns = Worldview.Palette;- },-- // Check that the default values are correct.- testEmpty: function() {- var stop = ns.StopRGBA();- assertEquals(0, stop.at);- assertEquals(0, stop.r);- assertEquals(0, stop.g);- assertEquals(0, stop.b);- assertEquals(0xff, stop.a);- },-- // Check that the specified values are correct.- testAll: function() {- var stop = ns.StopRGBA(1, 2, 3, 4, 5);- assertEquals(1, stop.at);- assertEquals(2, stop.r);- assertEquals(3, stop.g);- assertEquals(4, stop.b);- assertEquals(5, stop.a);- },--});\ No newline at end of filediff --git a/test/Worldview/Palette/testToLookup.js b/test/Worldview/Palette/testToLookup.jsindex 66cc086bb..3a6667e5d 100644--- a/test/Worldview/Palette/testToLookup.js+++ b/test/Worldview/Palette/testToLookup.js@@ -8,7 +8,7 @@* Administrator of the National Aeronautics and Space Administration.* All Rights Reserved.*/-TestCase("Worldview.Palette.toLookup", {+TestCase("Worldview.Palette.toIndexedLookup", {ns: null,@@ -25,7 +25,7 @@ TestCase("Worldview.Palette.toLookup", {{ at: 1.0, r: 0xff, g: 0xff, b: 0xff }]};- lut = ns.toLookup(2, palette);+ lut = ns.toIndexedLookup(2, palette);assertEquals(0x00, lut[0].r);assertEquals(0xff, lut[1].r);},@@ -38,7 +38,7 @@ TestCase("Worldview.Palette.toLookup", {{ at: 1.0, r: 0xff, g: 0xff, b: 0xff }]};- lut = ns.toLookup(3, palette);+ lut = ns.toIndexedLookup(3, palette);assertEquals(0x00, lut[0].r);assertEquals(0x80, lut[1].r);assertEquals(0xff, lut[2].r);@@ -53,7 +53,7 @@ TestCase("Worldview.Palette.toLookup", {{ at: 1.0, r: 0x00, g: 0xff, b: 0x00 }]};- lut = ns.toLookup(3, palette);+ lut = ns.toIndexedLookup(3, palette);assertEquals(0x80, lut[1].r);assertEquals(0x80, lut[1].g);@@ -69,7 +69,7 @@ TestCase("Worldview.Palette.toLookup", {{ at: 1.0, r: 0x00, g: 0xff, b: 0x00 }]};- lut = ns.toLookup(3, palette);+ lut = ns.toIndexedLookup(3, palette);assertEquals(0xff, lut[1].r);assertEquals(0xff, lut[1].g);@@ -87,7 +87,7 @@ TestCase("Worldview.Palette.toLookup", {{ at: 1.0, r: 0xff, g: 0xff, b: 0xff }]};- lut = ns.toLookup(11, palette);+ lut = ns.toIndexedLookup(11, palette);// Bin 0: First stopassertEquals(0x00, lut[0].r);@@ -126,7 +126,7 @@ TestCase("Worldview.Palette.toLookup", {{ at: 1.0, r: 0x03, g: 0x00, b: 0x00 }]};- lut = ns.toLookup(11, palette);+ lut = ns.toIndexedLookup(11, palette);assertEquals(0x01, lut[0].r);assertEquals(0x01, lut[6].r);@@ -144,7 +144,7 @@ TestCase("Worldview.Palette.toLookup", {{ at: 0.0, r: 0xff, g: 0xff, b: 0xff }]};- lut = ns.toLookup(3, palette);+ lut = ns.toIndexedLookup(3, palette);assertEquals(0x00, lut[0].a);assertEquals(0xff, lut[1].a);diff --git a/test/Worldview/Palette/testVisual.js b/test/Worldview/testPalette.jssimilarity index 76%rename from test/Worldview/Palette/testVisual.jsrename to test/Worldview/testPalette.jsindex efbc5759b..c19433096 100644--- a/test/Worldview/Palette/testVisual.js+++ b/test/Worldview/testPalette.js@@ -24,8 +24,9 @@ TestCase("Worldview.Palette", {// Check that a percentage of zero is at the beginning.testRgbInterpolateLeft: function() {- var result = ns.rgbInterpolate(0.0, ns.ColorRGBA(0, 0, 0),- ns.ColorRGBA(0xff, 0xff, 0xff));+ var result = ns.rgbInterpolate(0.0,+ {r: 0, g: 0, b: 0, a: 0xff},+ {r: 0xff, g: 0xff, b: 0xff, a: 0xff});assertEquals(0, result.r);assertEquals(0, result.g);assertEquals(0, result.b);@@ -34,8 +35,9 @@ TestCase("Worldview.Palette", {// Check that a percentage of one is at the end.testRgbInterpolateLeft: function() {- var result = ns.rgbInterpolate(1.0, ns.ColorRGBA(0, 0, 0),- ns.ColorRGBA(0xff, 0xff, 0xff));+ var result = ns.rgbInterpolate(1.0,+ {r: 0, g: 0, b: 0, a: 0xff},+ {r: 0xff, g: 0xff, b: 0xff, a: 0xff});assertEquals(0xff, result.r);assertEquals(0xff, result.g);assertEquals(0xff, result.b);@@ -44,8 +46,9 @@ TestCase("Worldview.Palette", {// Check that a percentage of 0.5 is in the middletestRgbInterpolateCenter: function() {- var result = ns.rgbInterpolate(0.5, ns.ColorRGBA(0, 0, 0),- ns.ColorRGBA(0xff, 0xff, 0xff));+ var result = ns.rgbInterpolate(0.5,+ {r: 0, g: 0, b: 0, a: 0xff},+ {r: 0xff, g: 0xff, b: 0xff, a: 0xff});assertEquals(0x80, result.r);assertEquals(0x80, result.g);assertEquals(0x80, result.b);@@ -54,8 +57,9 @@ TestCase("Worldview.Palette", {// Check that a percentage of zero is at the beginning.testHslInterpolateLeft: function() {- var result = ns.hslInterpolate(0.0, ns.ColorRGBA(10, 20, 30),- ns.ColorRGBA(40, 50, 60));+ var result = ns.hslInterpolate(0.0,+ {r: 10, g: 20, b: 30, a: 0xff},+ {r: 40, g: 50, b: 60, a: 0xff});assertEquals(10, result.r);assertEquals(20, result.g);assertEquals(30, result.b);@@ -64,8 +68,9 @@ TestCase("Worldview.Palette", {// Check that a percentage of one is at the end.testHslInterpolateRight: function() {- var result = ns.hslInterpolate(1.0, ns.ColorRGBA(10, 20, 30),- ns.ColorRGBA(40, 50, 60));+ var result = ns.hslInterpolate(1.0,+ {r: 10, g: 20, b: 30, a: 0xff},+ {r: 40, g: 50, b: 60, a: 0xff});assertEquals(40, result.r);assertEquals(50, result.g);assertEquals(60, result.b);@@ -74,8 +79,9 @@ TestCase("Worldview.Palette", {// Check that a percentage of 0.5 is in the middle.testHslInterpolateRight: function() {- var result = ns.hslInterpolate(0.5, ns.ColorRGBA(10, 20, 30),- ns.ColorRGBA(40, 50, 60));+ var result = ns.hslInterpolate(0.5,+ {r: 10, g: 20, b: 30, a: 0xff},+ {r: 40, g: 50, b: 60, a: 0xff});// Known good valuesassertEquals(23, result.r);assertEquals(35, result.g);diff --git a/test/Worldview/testUtil.js b/test/Worldview/testUtil.jsdeleted file mode 100644index ab81e8d0e..000000000--- a/test/Worldview/testUtil.js+++ /dev/null@@ -1,50 +0,0 @@-/*- * NASA Worldview- *- * This code was originally developed at NASA/Goddard Space Flight Center for- * the Earth Science Data and Information System (ESDIS) project.- *- * Copyright (C) 2013 United States Government as represented by the- * Administrator of the National Aeronautics and Space Administration.- * All Rights Reserved.- */-TestCase("util.clamp", {-- array: null,-- setUp: function() {- array = [1, 2, 3, 4, 5];- },-- testClamp: function() {- assertEquals(5, SOTE.util.clamp(0, 10, 5));- },-- testClampOver: function() {- assertEquals(10, SOTE.util.clamp(0, 10, 11));- },-- testClampUnder: function() {- assertEquals(0, SOTE.util.clamp(0, 10, -1));- },-- testClampInvalidRange: function() {- assertException(function() {- SOTE.util.clamp(10, 0, 10);- })- },-- testClampIndex: function() {- assertEquals(3, SOTE.util.clampIndex(array, 3));- },-- testClampIndexOver: function() {- assertEquals(4, SOTE.util.clampIndex(array, 5));- },-- testClampIndexUnder: function() {- assertEquals(0, SOTE.util.clampIndex(array, -1));- }--});-diff --git a/test/testWorldview.js b/test/testWorldview.jsindex 35aae1f69..34752d280 100644--- a/test/testWorldview.js+++ b/test/testWorldview.js@@ -166,3 +166,43 @@ TestCase("Worldview.getObjectByPath", TestSuite.Tests({}}));++TestCase("Worldview.clamp", {++ array: null,++ setUp: function() {+ array = [1, 2, 3, 4, 5];+ },++ testClamp: function() {+ assertEquals(5, Worldview.clamp(0, 10, 5));+ },++ testClampOver: function() {+ assertEquals(10, Worldview.clamp(0, 10, 11));+ },++ testClampUnder: function() {+ assertEquals(0, Worldview.clamp(0, 10, -1));+ },++ testClampInvalidRange: function() {+ assertException(function() {+ Worldview.clamp(10, 0, 10);+ })+ },++ testClampIndex: function() {+ assertEquals(3, Worldview.clampIndex(array, 3));+ },++ testClampIndexOver: function() {+ assertEquals(4, Worldview.clampIndex(array, 5));+ },++ testClampIndexUnder: function() {+ assertEquals(0, Worldview.clampIndex(array, -1));+ }++});