Interactive interface for browsing global, full-resolution satellite imagery
- Initial work with the ColorBar object. Examples in dev/palette. - Switched document generator to NaturalDocs. - Added some basic documentation for generating the docs and running tests. - Moved test driver config to test directory - Changed test-devel target to test
Mike McGannef99fb83f6cc
diff --git a/.gitignore b/.gitignoreindex 6dd05da7d..564b233b5 100644--- a/.gitignore+++ b/.gitignore@@ -1,6 +1,8 @@builddistlib+doc/NaturalDocs/Data+doc/NaturalDocs/LastCrash.txt# Ignore the Eclipse files for now.projectdiff --git a/ant/depend.properties b/ant/depend.propertiesindex 45d1bac03..d5cdc11d5 100644--- a/ant/depend.properties+++ b/ant/depend.properties@@ -1,9 +1,9 @@build.depends=\- jsdoc/jsdoc.build.xml \- jsdoc-ant/jsdoc-ant.build.xml \yui-compressor/yui-compressor.build.xml \yui-compressor-ant/yui-compressor-ant.build.xml \- js-test-driver/js-test-driver.build.xml+ js-test-driver/js-test-driver.build.xml \+ natural-docs/natural-docs.build.xml+diff --git a/ant/depend/jsdoc-ant/jsdoc-ant.build.xml b/ant/depend/jsdoc-ant/jsdoc-ant.build.xmldeleted file mode 100644index 9e1c980f8..000000000--- a/ant/depend/jsdoc-ant/jsdoc-ant.build.xml+++ /dev/null@@ -1,32 +0,0 @@-<?xml version="1.0"?>-<project name="jsdoc-ant" basedir="." default="resolve">-- <dirname property="jsdoc-ant.basedir" file="${ant.file.jsdoc-ant}"/>- <property file="${jsdoc-ant.basedir}/build.properties"/>-- <target name="resolve" depends="build"/>-- <target name="check-package">- <available file="${jsdoc-ant.jar.path}" property="jsdoc-ant.available"/>- </target>-- <target name="build" depends="check-package" unless="jsdoc-ant.available">- <delete dir="${jsdoc-ant.repository}"/>-- <!-- Don't pull history, just get the latest -->- <exec executable="git" dir="${lib.artifacts.dir}">- <arg value="clone"/>- <arg value="--depth"/>- <arg value="1"/>- <arg value="${jsdoc-ant.url}"/>- </exec>-- <exec executable="ant" dir="${jsdoc-ant.repository}">- <arg value="package"/>- </exec>-- <copy file="${jsdoc-ant.repository}/build/jar/${jsdoc-ant.jar}"- todir="${lib.packages.dir}"/>- </target>--</project>diff --git a/ant/depend/jsdoc-ant/register-task.build.xml b/ant/depend/jsdoc-ant/register-task.build.xmldeleted file mode 100644index fbce5b377..000000000--- a/ant/depend/jsdoc-ant/register-task.build.xml+++ /dev/null@@ -1,11 +0,0 @@-<?xml version="1.0"?>-<project name="jsdoc-ant" basedir="." default="resolve">-- <dirname property="jsdoc-ant.basedir" file="${ant.file.jsdoc-ant}"/>- <property file="${jsdoc-ant.basedir}/build.properties"/>-- <taskdef name="jsdoc"- classname="uk.co.darrenhurley.ant.tasks.JsDocToolkit"- classpath="${jsdoc-ant.jar.path}:${jsdoc.home.dir}/java/classes/js.jar"/>--</project>\ No newline at end of filediff --git a/ant/depend/jsdoc/jsdoc.build.xml b/ant/depend/jsdoc/jsdoc.build.xmldeleted file mode 100644index 036e0fae2..000000000--- a/ant/depend/jsdoc/jsdoc.build.xml+++ /dev/null@@ -1,33 +0,0 @@-<?xml version="1.0"?>-<project name="jsdoc" basedir="." default="resolve">-- <dirname property="jsdoc.basedir" file="${ant.file.jsdoc}"/>- <property file="${jsdoc.basedir}/build.properties"/>-- <target name="resolve" depends="download,unpack"/>-- <target name="download">- <get src="${jsdoc.url}" dest="${lib.artifacts.dir}"- skipexisting="true"/>- </target>-- <target name="check-package">- <available file="${jsdoc.package.dir}" property="jsdoc.available"/>- </target>-- <target name="unpack" depends="check-package" unless="jsdoc.available">- <unzip src="${lib.artifacts.dir}/${jsdoc.artifact}"- dest="${lib.packages.dir}"/>-- <!-- Ant task assumes different directory locations than what exists- in the distribution at the moment. Simply copy the directories- to where the task needs them -->- <copy todir="${jsdoc.home.dir}/../jsdoc-toolkitapp">- <fileset dir="${jsdoc.home.dir}/app"/>- </copy>- <copy todir="${jsdoc.home.dir}/../jsdoc-toolkittemplates">- <fileset dir="${jsdoc.home.dir}/templates"/>- </copy>- </target>--</project>\ No newline at end of filediff --git a/ant/depend/natural-docs/natural-docs.build.xml b/ant/depend/natural-docs/natural-docs.build.xmlnew file mode 100644index 000000000..9e33fe945--- /dev/null+++ b/ant/depend/natural-docs/natural-docs.build.xml@@ -0,0 +1,24 @@+<?xml version="1.0"?>+<project name="natural-docs" basedir="." default="resolve">++ <dirname property="natural-docs.basedir" file="${ant.file.natural-docs}"/>+ <property file="${natural-docs.basedir}/build.properties"/>++ <target name="resolve" depends="download,unpack"/>++ <target name="download">+ <get src="${natural-docs.url}" dest="${lib.artifacts.dir}"+ skipexisting="true"/>+ </target>++ <target name="check-package">+ <available file="${natural-docs.package.dir}" property="natural-docs.available"/>+ </target>++ <target name="unpack" depends="check-package" unless="natural-docs.available">+ <mkdir dir="${natural-docs.package.dir}"/>+ <unzip src="${lib.artifacts.dir}/${natural-docs.artifact}"+ dest="${natural-docs.package.dir}"/>+ </target>++</project>\ No newline at end of filediff --git a/build.xml b/build.xmlindex 1cf453569..6a03e9ad6 100644--- a/build.xml+++ b/build.xml@@ -36,11 +36,7 @@<fileset dir="${src.depend.dir}" includes="${build.depends}"/><property name="basedir" value="${basedir}"/></subant>-- <taskdef name="jsdoc"- classname="uk.co.darrenhurley.ant.tasks.JsDocToolkit"- classpath="${jsdoc-ant.jar.path}:${jsdoc.home.dir}/java/classes/js.jar"/>-+<taskdef name="yui-compressor"classname="net.noha.tools.ant.yuicompressor.tasks.YuiCompressorTask"classpath="${yui-compressor.jar.path}:${yui-compressor-ant.jar.path}"/>@@ -50,15 +46,26 @@<target name="doc" depends="deps"description="Generates documentation in the build directory">- <!-- Don't document the external libraries -->- <jsdoc jsdochome="${jsdoc.home.dir}" template="jsdoc"- outputdir="${build.doc.dir}" includeprivate="false"- includeundocumented="true">- <fileset dir="${src.web.js.dir}">- <include name="*.js"/>- <include name="OpenLayers/**/*.js"/>- </fileset>- </jsdoc>+ <mkdir dir="${build.doc.dir}"/>++ <exec executable="perl">+ <arg value="${natural-docs.bin}"/>+ <arg value="-i"/>+ <arg value="${src.web.js.dir}"/>+ <arg value="-i"/>+ <arg value="doc/Topics"/>+ <arg value="-o"/>+ <arg value="HTML"/>+ <arg value="${build.doc.dir}"/>+ <arg value="-p"/>+ <arg value="doc/NaturalDocs"/>+ <arg value="-xi"/>+ <arg value="${src.web.js.dir}/ext"/>+ <arg value="-s"/>+ <arg value="Default"/>+ <arg value="Worldview"/>+ </exec>+</target><target name="web" depends="init,deps" description="Builds minified web site">@@ -161,49 +168,27 @@</move></target>-- <target name="test-prod" depends="web" description="Test minified js files">- <delete dir="${build.test.dir}/min"/>- <mkdir dir="${build.test.dir}/min"/>- <exec executable="java">- <arg value="-jar"/>- <arg value="${js-test-driver.jar.path}"/>- <arg value="--port"/>- <arg value="${js-test-driver.port}"/>- <arg value="--browser"/>- <arg value="${js-test-driver.macosx.browsers}"/>- <arg value="--tests"/>- <arg value="all"/>- <arg value="--testOutput"/>- <arg value="${build.test.dir}"/>- <arg value="--config"/>- <arg value="jsTestDriver-prod.conf"/>- </exec>- </target>-- <target name="start-test-server">++ <target name="start-test-server" depends="deps"><exec executable="java" spawn="true"><arg value="-jar"/><arg value="${js-test-driver.jar.path}"/><arg value="--port"/><arg value="${js-test-driver.port}"/></exec>- <echo message="Capture browser at http://localhost:${js-test-driver.port}"/>+ <echo message="Capture browser at http://localhost:${js-test-driver.port}/capture"/></target>- <target name="test-devel">+ <target name="test"><exec executable="java"><arg value="-jar"/><arg value="${js-test-driver.jar.path}"/><arg value="--tests"/><arg value="all"/><arg value="--config"/>- <arg value="jsTestDriver-devel.conf"/>+ <arg value="test/jsTestDriver.conf"/></exec></target>-- <target name="test" depends="test-prod,test-devel"- description="Run test suite on production and development files"/><target name="dist" depends="clean,web,doc"description="Generates distribution artifacts">diff --git a/css/palette.css b/css/palette.cssnew file mode 100644index 000000000..032b10b0f--- /dev/null+++ b/css/palette.css@@ -0,0 +1,5 @@+.palette {+ width: 100px;+ height: 14px;+ border: 1px solid #aaaaaa;+}diff --git a/dev/palette/dev.css b/dev/palette/dev.cssnew file mode 100644index 000000000..f1684f3da--- /dev/null+++ b/dev/palette/dev.css@@ -0,0 +1,21 @@+body {+ padding: 20px;+ background: #eeeeee;+}++.layer {+ padding: 10px;+ margin: 5px;+ width: 200px;+ background: white;+ border: 1px solid black;+ text-align: center;+}++.layer .name {+ text-align: center;+}++.palette {+ margin: 5px;+}diff --git a/dev/palette/dev.js b/dev/palette/dev.jsnew file mode 100644index 000000000..bc0946fa3--- /dev/null+++ b/dev/palette/dev.js@@ -0,0 +1,151 @@+$(function() {+ var ColorBar = SOTE.widget.palette.ColorBar;++ b2w = {+ stops: [+ { at: 0.0, r: 0x00, g: 0x00, b: 0x00 },+ { at: 1.0, r: 0xff, g: 0xff, b: 0xff }+ ]+ };++ r2g = {+ stops: [+ { at: 0.0, r: 0xff, g: 0x00, b: 0x00 },+ { at: 1.0, r: 0x00, g: 0xff, b: 0x00 }+ ]+ };++ g2r = {+ stops: [+ { at: 0.0, r: 0x00, g: 0xff, b: 0x00 },+ { at: 1.0, r: 0xff, g: 0x00, b: 0x00 }+ ]+ };++ b2y2r = {+ stops: [+ { at: 0.0, r: 0x00, g: 0x00, b: 0xff },+ { at: 0.5, r: 0xff, g: 0xff, b: 0x00 },+ { at: 1.0, r: 0xff, g: 0x00, b: 0x00 }+ ]+ };++ b2y2r_right = {+ stops: [+ { at: 0.0, r: 0x00, g: 0x00, b: 0xff },+ { at: 0.8, r: 0xff, g: 0xff, b: 0x00 },+ { at: 1.0, r: 0xff, g: 0x00, b: 0x00 }+ ]+ };++ /* Black to White */+ new ColorBar({+ selector: "#b2w-2",+ bins: 2,+ palette: b2w+ });+ new ColorBar({+ selector: "#b2w-3",+ bins: 3,+ palette: b2w+ });+ new ColorBar({+ selector: "#b2w-10",+ bins: 10,+ palette: b2w+ });+ new ColorBar({+ selector: "#b2w-100",+ bins: 100,+ palette: b2w+ });++ /** Red to Green */+ new ColorBar({+ selector: "#r2g-2",+ bins: 2,+ palette: r2g+ });+ new ColorBar({+ selector: "#r2g-3",+ bins: 3,+ palette: r2g+ });+ new ColorBar({+ selector: "#r2g-10",+ bins: 10,+ palette: r2g+ });+ new ColorBar({+ selector: "#r2g-100",+ bins: 100,+ palette: r2g+ });++ /** Green to Red */+ new ColorBar({+ selector: "#g2r-2",+ bins: 2,+ palette: g2r+ });+ new ColorBar({+ selector: "#g2r-3",+ bins: 3,+ palette: g2r+ });+ new ColorBar({+ selector: "#g2r-10",+ bins: 10,+ palette: g2r+ });+ new ColorBar({+ selector: "#g2r-100",+ bins: 100,+ palette: g2r+ });++ /* Blue to Yellow to Red */+ new ColorBar({+ selector: "#b2y2r-2",+ bins: 2,+ palette: b2y2r+ });+ new ColorBar({+ selector: "#b2y2r-3",+ bins: 3,+ palette: b2y2r+ });+ new ColorBar({+ selector: "#b2y2r-10",+ bins: 10,+ palette: b2y2r+ });+ new ColorBar({+ selector: "#b2y2r-100",+ bins: 100,+ palette: b2y2r+ });++ /* Blue to Yellow to Red - Mid to Right */+ new ColorBar({+ selector: "#b2y2r-right-2",+ bins: 2,+ palette: b2y2r_right+ });+ new ColorBar({+ selector: "#b2y2r-right-3",+ bins: 3,+ palette: b2y2r_right+ });+ new ColorBar({+ selector: "#b2y2r-right-10",+ bins: 10,+ palette: b2y2r_right+ });+ new ColorBar({+ selector: "#b2y2r-right-100",+ bins: 100,+ palette: b2y2r_right+ });++});diff --git a/dev/palette/index.html b/dev/palette/index.htmlnew file mode 100644index 000000000..46ee8e832--- /dev/null+++ b/dev/palette/index.html@@ -0,0 +1,194 @@+<?doctype html>+<html>+ <head>+ <title>Palette</title>+ <link rel="stylesheet" type="text/css" href="../../css/palette.css"/>+ <link rel="stylesheet" type="text/css" href="dev.css"/>++ <script type="text/javascript" src="../../js/ext/jquery/jquery-1.6.4.js"></script>+ <script type="text/javascript" src="../../js/component.js"></script>+ <script type="text/javascript" src="../../js/util.js"></script>+ <script type="text/javascript" src="../../js/palette.js"></script>+ <script type="text/javascript" src="dev.js"></script>+ </head>+ <body>+ <h1>Palette Demo</h1>+ <table>+ <tr>+ <td>+ <div class="layer">+ <span class="name">Black to White: 2 Bins</span>+ <div>+ <canvas class="palette" id="b2w-2"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">Black to White: 3 Bins</span>+ <div>+ <canvas class="palette" id="b2w-3"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">Black to White: 10 Bins</span>+ <div>+ <canvas class="palette" id="b2w-10"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">Black to White: 100 Bins</span>+ <div>+ <canvas class="palette" id="b2w-100"></canavs>+ </div>+ </div>+ </td>+ </tr>++ <tr>+ <td>+ <div class="layer">+ <span class="name">Red to Green: 2 Bins</span>+ <div>+ <canvas class="palette" id="r2g-2"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">Red to Green: 3 Bins</span>+ <div>+ <canvas class="palette" id="r2g-3"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">Red to Green: 10 Bins</span>+ <div>+ <canvas class="palette" id="r2g-10"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">Red to Green: 100 Bins</span>+ <div>+ <canvas class="palette" id="r2g-100"></canavs>+ </div>+ </div>+ </td>+ </tr>++ <tr>+ <td>+ <div class="layer">+ <span class="name">Green to Red: 2 Bins</span>+ <div>+ <canvas class="palette" id="g2r-2"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">Green to Red: 3 Bins</span>+ <div>+ <canvas class="palette" id="g2r-3"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">Green to Red: 10 Bins</span>+ <div>+ <canvas class="palette" id="g2r-10"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">Green to Red: 100 Bins</span>+ <div>+ <canvas class="palette" id="g2r-100"></canavs>+ </div>+ </div>+ </td>+ </tr>++ <tr>+ <td>+ <div class="layer">+ <span class="name">B-Y-R: 2 Bins</span>+ <div>+ <canvas class="palette" id="b2y2r-2"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">B-Y-R: 3 Bins</span>+ <div>+ <canvas class="palette" id="b2y2r-3"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">B-Y-R: 10 Bins</span>+ <div>+ <canvas class="palette" id="b2y2r-10"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">B-Y-R: 100 Bins</span>+ <div>+ <canvas class="palette" id="b2y2r-100"></canavs>+ </div>+ </div>+ </td>+ </tr>++ <tr>+ <td>+ <div class="layer">+ <span class="name">B-Y-R: 2 Bins, Weighted</span>+ <div>+ <canvas class="palette" id="b2y2r-right-2"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">B-Y-R: 3 Bins, Weighted</span>+ <div>+ <canvas class="palette" id="b2y2r-right-3"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">B-Y-R: 10 Bins, Weighted</span>+ <div>+ <canvas class="palette" id="b2y2r-right-10"></canavs>+ </div>+ </div>+ </td>+ <td>+ <div class="layer">+ <span class="name">B-Y-R: 100 Bins, Weighted</span>+ <div>+ <canvas class="palette" id="b2y2r-right-100"></canavs>+ </div>+ </div>+ </td>+ </tr>++ </table>+ </body>+</html>\ No newline at end of filediff --git a/doc/NaturalDocs/Languages.txt b/doc/NaturalDocs/Languages.txtnew file mode 100644index 000000000..42b197c21--- /dev/null+++ b/doc/NaturalDocs/Languages.txt@@ -0,0 +1,113 @@+Format: 1.52++# This is the Natural Docs languages file for this project. If you change+# anything here, it will apply to THIS PROJECT ONLY. If you'd like to change+# something for all your projects, edit the Languages.txt in Natural Docs'+# Config directory instead.+++# You can prevent certain file extensions from being scanned like this:+# Ignore Extensions: [extension] [extension] ...+++#-------------------------------------------------------------------------------+# SYNTAX:+#+# Unlike other Natural Docs configuration files, in this file all comments+# MUST be alone on a line. Some languages deal with the # character, so you+# cannot put comments on the same line as content.+#+# Also, all lists are separated with spaces, not commas, again because some+# languages may need to use them.+#+# Language: [name]+# Alter Language: [name]+# Defines a new language or alters an existing one. Its name can use any+# characters. If any of the properties below have an add/replace form, you+# must use that when using Alter Language.+#+# The language Shebang Script is special. It's entry is only used for+# extensions, and files with those extensions have their shebang (#!) lines+# read to determine the real language of the file. Extensionless files are+# always treated this way.+#+# The language Text File is also special. It's treated as one big comment+# so you can put Natural Docs content in them without special symbols. Also,+# if you don't specify a package separator, ignored prefixes, or enum value+# behavior, it will copy those settings from the language that is used most+# in the source tree.+#+# Extensions: [extension] [extension] ...+# [Add/Replace] Extensions: [extension] [extension] ...+# Defines the file extensions of the language's source files. You can+# redefine extensions found in the main languages file. You can use * to+# mean any undefined extension.+#+# Shebang Strings: [string] [string] ...+# [Add/Replace] Shebang Strings: [string] [string] ...+# Defines a list of strings that can appear in the shebang (#!) line to+# designate that it's part of the language. You can redefine strings found+# in the main languages file.+#+# Ignore Prefixes in Index: [prefix] [prefix] ...+# [Add/Replace] Ignored Prefixes in Index: [prefix] [prefix] ...+#+# Ignore [Topic Type] Prefixes in Index: [prefix] [prefix] ...+# [Add/Replace] Ignored [Topic Type] Prefixes in Index: [prefix] [prefix] ...+# Specifies prefixes that should be ignored when sorting symbols in an+# index. Can be specified in general or for a specific topic type.+#+#------------------------------------------------------------------------------+# For basic language support only:+#+# Line Comments: [symbol] [symbol] ...+# Defines a space-separated list of symbols that are used for line comments,+# if any.+#+# Block Comments: [opening sym] [closing sym] [opening sym] [closing sym] ...+# Defines a space-separated list of symbol pairs that are used for block+# comments, if any.+#+# Package Separator: [symbol]+# Defines the default package separator symbol. The default is a dot.+#+# [Topic Type] Prototype Enders: [symbol] [symbol] ...+# When defined, Natural Docs will attempt to get a prototype from the code+# immediately following the topic type. It stops when it reaches one of+# these symbols. Use \n for line breaks.+#+# Line Extender: [symbol]+# Defines the symbol that allows a prototype to span multiple lines if+# normally a line break would end it.+#+# Enum Values: [global|under type|under parent]+# Defines how enum values are referenced. The default is global.+# global - Values are always global, referenced as 'value'.+# under type - Values are under the enum type, referenced as+# 'package.enum.value'.+# under parent - Values are under the enum's parent, referenced as+# 'package.value'.+#+# Perl Package: [perl package]+# Specifies the Perl package used to fine-tune the language behavior in ways+# too complex to do in this file.+#+#------------------------------------------------------------------------------+# For full language support only:+#+# Full Language Support: [perl package]+# Specifies the Perl package that has the parsing routines necessary for full+# language support.+#+#-------------------------------------------------------------------------------++# The following languages are defined in the main file, if you'd like to alter+# them:+#+# Text File, Shebang Script, C/C++, C#, Java, JavaScript, Perl, Python,+# PHP, SQL, Visual Basic, Pascal, Assembly, Ada, Tcl, Ruby, Makefile,+# ActionScript, ColdFusion, R, Fortran++# If you add a language that you think would be useful to other developers+# and should be included in Natural Docs by default, please e-mail it to+# languages [at] naturaldocs [dot] org.diff --git a/doc/NaturalDocs/Menu.txt b/doc/NaturalDocs/Menu.txtnew file mode 100644index 000000000..f9754c430--- /dev/null+++ b/doc/NaturalDocs/Menu.txt@@ -0,0 +1,74 @@+Format: 1.52+++Title: Worldview++# You can also add a sub-title to your menu like this:+# SubTitle: [subtitle]++# You can add a footer to your documentation like this:+# Footer: [text]+# If you want to add a copyright notice, this would be the place to do it.+Timestamp: Updated mm/dd/yyyy+# m - One or two digit month. January is "1"+# mm - Always two digit month. January is "01"+# mon - Short month word. January is "Jan"+# month - Long month word. January is "January"+# d - One or two digit day. 1 is "1"+# dd - Always two digit day. 1 is "01"+# day - Day with letter extension. 1 is "1st"+# yy - Two digit year. 2006 is "06"+# yyyy - Four digit year. 2006 is "2006"+# year - Four digit year. 2006 is "2006"+++# --------------------------------------------------------------------------+#+# Cut and paste the lines below to change the order in which your files+# appear on the menu. Don't worry about adding or removing files, Natural+# Docs will take care of that.+#+# You can further organize the menu by grouping the entries. Add a+# "Group: [name] {" line to start a group, and add a "}" to end it.+#+# You can add text and web links to the menu by adding "Text: [text]" and+# "Link: [name] ([URL])" lines, respectively.+#+# The formatting and comments are auto-generated, so don't worry about+# neatness when editing the file. Natural Docs will clean it up the next+# time it is run. When working with groups, just deal with the braces and+# forget about the indentation and comments.+#+# You can use this file on other computers even if they use different+# directories. As long as the command line points to the same source files,+# Natural Docs will be able to correct the locations automatically.+#+# --------------------------------------------------------------------------+++Group: Development Notes {++ File: Documentation (/Users/jmcgann/Code/Aptana/worldview/doc/Topics/Documentation.txt)+ File: Testing (/Users/jmcgann/Code/Aptana/worldview/doc/Topics/Testing.txt)+ } # Group: Development Notes++Group: Code Reference {++ File: OpenLayers.Tile.Canvas (/Users/jmcgann/Code/Aptana/worldview/js/OpenLayers/Tile/Canvas.js)+ File: SOTE.util (/Users/jmcgann/Code/Aptana/worldview/js/util.js)+ File: SOTE.widget.palette (/Users/jmcgann/Code/Aptana/worldview/js/palette.js)+ } # Group: Code Reference++Group: Index {++ Index: Everything+ Class Index: Classes+ Constant Index: Constants+ Function Index: Functions+ } # Group: Index++++##### Do not change or remove these lines. #####+Data: 1(D3333a6GH63lE9`p\\30ufG3KItp\p37uHof/8G73l6)+Data: 1(h3333a6GH63lE9`p\\30ufG3KItp\p37uHof/8G73fu93LuI896)diff --git a/doc/NaturalDocs/Topics.txt b/doc/NaturalDocs/Topics.txtnew file mode 100644index 000000000..905270f0e--- /dev/null+++ b/doc/NaturalDocs/Topics.txt@@ -0,0 +1,81 @@+Format: 1.52++# This is the Natural Docs topics file for this project. If you change anything+# here, it will apply to THIS PROJECT ONLY. If you'd like to change something+# for all your projects, edit the Topics.txt in Natural Docs' Config directory+# instead.+++# If you'd like to prevent keywords from being recognized by Natural Docs, you+# can do it like this:+# Ignore Keywords: [keyword], [keyword], ...+#+# Or you can use the list syntax like how they are defined:+# Ignore Keywords:+# [keyword]+# [keyword], [plural keyword]+# ...+++#-------------------------------------------------------------------------------+# SYNTAX:+#+# Topic Type: [name]+# Alter Topic Type: [name]+# Creates a new topic type or alters one from the main file. Each type gets+# its own index and behavior settings. Its name can have letters, numbers,+# spaces, and these charaters: - / . '+#+# Plural: [name]+# Sets the plural name of the topic type, if different.+#+# Keywords:+# [keyword]+# [keyword], [plural keyword]+# ...+# Defines or adds to the list of keywords for the topic type. They may only+# contain letters, numbers, and spaces and are not case sensitive. Plural+# keywords are used for list topics. You can redefine keywords found in the+# main topics file.+#+# Index: [yes|no]+# Whether the topics get their own index. Defaults to yes. Everything is+# included in the general index regardless of this setting.+#+# Scope: [normal|start|end|always global]+# How the topics affects scope. Defaults to normal.+# normal - Topics stay within the current scope.+# start - Topics start a new scope for all the topics beneath it,+# like class topics.+# end - Topics reset the scope back to global for all the topics+# beneath it.+# always global - Topics are defined as global, but do not change the scope+# for any other topics.+#+# Class Hierarchy: [yes|no]+# Whether the topics are part of the class hierarchy. Defaults to no.+#+# Page Title If First: [yes|no]+# Whether the topic's title becomes the page title if it's the first one in+# a file. Defaults to no.+#+# Break Lists: [yes|no]+# Whether list topics should be broken into individual topics in the output.+# Defaults to no.+#+# Can Group With: [type], [type], ...+# Defines a list of topic types that this one can possibly be grouped with.+# Defaults to none.+#-------------------------------------------------------------------------------++# The following topics are defined in the main file, if you'd like to alter+# their behavior or add keywords:+#+# Generic, Class, Interface, Section, File, Group, Function, Variable,+# Property, Type, Constant, Enumeration, Event, Delegate, Macro,+# Database, Database Table, Database View, Database Index, Database+# Cursor, Database Trigger, Cookie, Build Target++# If you add something that you think would be useful to other developers+# and should be included in Natural Docs by default, please e-mail it to+# topics [at] naturaldocs [dot] org.diff --git a/doc/NaturalDocs/worldview.css b/doc/NaturalDocs/worldview.cssnew file mode 100644index 000000000..98eb2908b--- /dev/null+++ b/doc/NaturalDocs/worldview.css@@ -0,0 +1,5 @@+p {+ text-indent: 0;+ margin-bottom: 1em;+}+diff --git a/doc/Topics/Documentation.txt b/doc/Topics/Documentation.txtnew file mode 100644index 000000000..4452ac9c1--- /dev/null+++ b/doc/Topics/Documentation.txt@@ -0,0 +1,22 @@+Title: Documentation++Group: About++Worldview Documentation.++NaturalDocs is used to automatically generate this documentation.++See Also: http://www.naturaldocs.org/++Group: Building++Generating the documentation from source.++In the project root directory, type in the following command++> ant doc++Generated HTML files can be found in build/doc.+++diff --git a/doc/Topics/Testing.txt b/doc/Topics/Testing.txtnew file mode 100644index 000000000..68ad5f028--- /dev/null+++ b/doc/Topics/Testing.txt@@ -0,0 +1,40 @@+Title: Testing++Group: About++Worldview Test Suites.++- <JsTestDriver at http://code.google.com/p/js-test-driver> is used for unit tests.+- <JsMockito at http://jsmockito.org/> is used for mocking.++The JsTestDriver configuration is found at test/jsTestDriver.conf.++Anytime a new JavaScript source file is added, it must be added to the+configuration file in the load section. Files must be listed in the+correct order.++Anytime a new JavaScript test file is added to a new directory, it+must be added to the configuration file in the test section.++Group: Running++Running the test suites.++JsTestDriver uses actual web browsers to execute all of the test+code. A small test server is used to register each web browser and to+dispatch test cases. To start the test server, execute the following+command from the project root directory.++> ant start-test-server++Now open each browser to test in and navigate to this url to register+the browser:++http://localhost:8811/capture++Now run the test entire unit test suite with the following++> ant test+++diff --git a/js/OpenLayers/Tile/Canvas.js b/js/OpenLayers/Tile/Canvas.jsindex 4c913bbab..058a9d2d6 100644--- a/js/OpenLayers/Tile/Canvas.js+++ b/js/OpenLayers/Tile/Canvas.js@@ -9,85 +9,54 @@* All Rights Reserved.*/-OpenLayers.Tile.Canvas = OpenLayers.Class(OpenLayers.Tile.Image,-/** @lends OpenLayers.Tile.Canvas# */-{+/**+ * Class: OpenLayers.Tile.Canvas+ *+ * Cavas based tile generator. The default tile generator,+ * OpenLayers.Tile.Image renders each tile in an image element. This generator+ * is simiar except that it uses canvas elements instead. This can be used in a+ * layer by providing an instance at instantiation:+ *+ * (start code)+ * var myLayer = new OpenLayers.Layer.WMTS({+ * name: "My Layer",+ * tileClass: OpenLayers.Tile.Canvas,+ * ...+ * });+ * (end code)+ *+ * To apply a lookup table to dynamically change the colors of the tile,+ * set a lookupTable property in OpenLayers.Layer with a mapping of RGBA+ * integer values to RGBA integer values. Example:+ *+ * (start code)+ * var grn = { r: 0x00, g: 0xff, b: 0xff, a: 0xff };+ * var red = { r: 0xff, g: 0x00, b: 0x00, a: 0xff };+ *+ * var grnInt = ( grn.a << 24 | grn.b << 16 | grn.g << 8 | grn.r );+ * var redInt = ( red.a << 24 | grn.b << 16 | grn.g << 8 | grn.r );+ *+ * // Map green to blue+ * myLayer.lookupTable = {+ * grnInt: redInt+ * };+ * (end code)+ */+OpenLayers.Tile.Canvas = OpenLayers.Class(OpenLayers.Tile.Image, {- /**+ /** Element that contains the canvas to draw the tile. Initially set to* null and created after the tile has been loaded. Set back to null* when clear() is invoked.- *- * @private*/canvas: null,-- /**- * FIXME- */- canvasContext: null,-- /**- * Canvas tile generator.- *- * <p>- * The default tile generator, <code>OpenLayers.Tile.Image</code> renders- * each tile in an image element. This generator is simiar except that it- * uses canvas elements instead. This can be used in a layer by providing- * an instance at instantiation:- * </p>- *- * <pre>- * var myLayer = new OpenLayers.Layer.WMTS({- * name: "My Layer",- * tileClass: OpenLayers.Tile.Canvas,- * ...- * });- * </pre>- *- * <p>- * To apply a lookup table to dynamically change the colors of the tile,- * set the <code>lookupTable</code> property in <code>OpenLayers.Layer</code>- * with a mapping of RGBA integer values to RGBA integer values. Example:- * </p>- *- * <pre>- * var grn = { r: 0x00, g: 0xff, b: 0xff, a: 0xff };- * var red = { r: 0xff, g: 0x00, b: 0x00, a: 0xff };- *- * var grnInt = ( grn.a << 24 | grn.b << 16 | grn.g << 8 | grn.r );- * var redInt = ( red.a << 24 | grn.b << 16 | grn.g << 8 | grn.r );- *- * // Map green to blue- * myLayer.lookupTable = {- * grnInt: redInt- * };- * </pre>- *- * <p>- * Parameter information copied directly from- * <code>OpenLayers.Tile.Image</code>.- * </p>- *- * @class- * @constructs- * @param {OpenLayers.Layer} layer layer that the tile will go in.- * @param {OpenLayers.Pixel} position- * @param {OpenLayers.Bounds} bounds- * @param {String} url Deprecated. Remove me in 3.0.- * @param {OpenLayers.Size} size- * @param {Object} options- */+initialize: function(layer, position, bounds, url, size, options) {OpenLayers.Tile.Image.prototype.initialize.apply(this, arguments);},- /**- * See <code>OpenLayers.Tile.Image</code>.- *- * <p>- * Also sets the canvas element to null- * </p>+ /*+ * Discards the canvas.*/destroy: function() {OpenLayers.Tile.Image.prototype.destroy.apply(this, arguments);@@ -96,13 +65,9 @@ OpenLayers.Tile.Canvas = OpenLayers.Class(OpenLayers.Tile.Image,}},- /**- * See <code>OpenLayers.Tile.Image</code>.- *- * <p>- * Also hides the canvas element and clears the image load error class if+ /*+ * Hides the canvas element and clears the image load error class if* set.- * </p>*/clear: function() {OpenLayers.Tile.Image.prototype.clear(this, arguments);@@ -112,12 +77,10 @@ OpenLayers.Tile.Canvas = OpenLayers.Class(OpenLayers.Tile.Image,}},- /**+ /** Returns the canvas element by creating one if necessary. Copy over the* style elements that OpenLayers.Tile.Image object applies to the image* element to the canvas element.- *- * @private*/getCanvas: function() {var image = this.getImage();@@ -146,22 +109,16 @@ OpenLayers.Tile.Canvas = OpenLayers.Class(OpenLayers.Tile.Image,return this.canvas;},- /**+ /** Returns the element that contains the canvas.- *- * @return {element} if contained in the frame div, returns the frame div,- * otherwise returns the canvas element.*/getTile: function() {var canvas = this.getCanvas();return this.frame ? this.frame : canvas;},- /**+ /** Draws the loaded image to the canvas and applies a lookup table if- * provided by the layer.- *- * @private*/onImageLoad: function() {var graphics = this.canvas.getContext("2d");@@ -204,16 +161,14 @@ OpenLayers.Tile.Canvas = OpenLayers.Class(OpenLayers.Tile.Image,this.events.triggerEvent("loadend");},- /**+ /** FIXME- *- * @private*/onImageError: function() {},- /**+ /** Name of this class per OpenLayers convention.*/CLASS_NAME: "OpenLayers.Tile.Canvas"diff --git a/js/palette.js b/js/palette.jsnew file mode 100644index 000000000..f9eb2f4b8--- /dev/null+++ b/js/palette.js@@ -0,0 +1,167 @@+/*+ * 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.+ */++/**+ * Namespace: SOTE.widget.palette+ *+ * Client side adjusting of data display palettes.+ */+SOTE.namespace("SOTE.widget.palette");++$(function() {+ var ns = SOTE.widget.palette;+ var util = SOTE.util;++ /**+ * Constant: CHECKERBOARD+ *+ * A canvas pattern of a gray based checkerboard used to denote+ * transparency.+ */+ ns.CHECKERBOARD = null;++ /**+ * Function: toLookup+ */+ ns.toLookup = function(bins, palette) {+ var stops = palette.stops;+ var lut = [];+ var currentStop = 0;+ for ( var bin = 0; bin < bins; bin++ ) {+ var distance = bin / (bins - 1);+ for ( var i = currentStop; i < stops.length; i++ ) {+ if ( distance <= stops[i].at ) {+ break;+ }+ }+ currentStop = i;+ var end = stops[util.clampIndex(stops, i)];+ var begin = stops[util.clampIndex(stops, i-1)];++ var segmentLength = end.at - begin.at;+ var segmentDistance = (segmentLength !== 0) ?+ (distance - begin.at) / segmentLength : 0;++ var hsvEnd = util.rgbToHsv(end.r, end.g, end.b);+ var hsvBegin = util.rgbToHsv(begin.r, begin.g, begin.b);++ var h = hsvBegin.h + (segmentDistance * (hsvEnd.h - hsvBegin.h));+ var s = hsvBegin.s + (segmentDistance * (hsvEnd.s - hsvBegin.s));+ var v = hsvBegin.v + (segmentDistance * (hsvEnd.v - hsvBegin.v));++ var rgb = util.hsvToRgb(h, s, v);++ lut.push(rgb);++ /*+ lut.push({+ r: Math.floor(begin.r + (segmentDistance * (end.r - begin.r))),+ g: Math.floor(begin.g + (segmentDistance * (end.g - begin.g))),+ b: Math.floor(begin.b + (segmentDistance * (end.b - begin.b))),+ });+ */+ }+ return lut;+ }++ var init = function() {+ drawCheckerboard();+ }++ var drawCheckerboard = function() {+ var size = 7;++ var canvas = document.createElement("canvas");+ canvas.width = size * 2;+ canvas.height = size * 2;++ var g = canvas.getContext("2d");++ g.fillStyle = "rgb(102, 102, 102)";+ g.fillRect(0, 0, size, size);+ g.fillRect(size, size, size, size);++ g.fillStyle = "rgb(153, 153, 153)";+ g.fillRect(0, size, size, size);+ g.fillRect(size, 0, size, size);++ ns.CHECKERBOARD = g.createPattern(canvas, "repeat");+ }++ init();++});++/**+ * Class: SOTE.widget.palette.ColorBar+ *+ * ColorBar class.+ */+SOTE.widget.palette.ColorBar = function(spec) {++ var self = {};+ var ns = SOTE.widget.palette;+ var $canvas;+ var canvas;+ var g;++ self.checkerboard = ns.CHECKERBOARD;+ self.bins = 255;+ self.palette = null;++ /**+ * Constructor: ColorBar+ */+ var init = function() {+ $canvas = $(spec.selector);+ if ( $canvas.length === 0 ) {+ throw "No such element: " + spec.selector;+ }+ canvas = $canvas.get(0);+ canvas.width = $canvas.width();+ canvas.height = $canvas.height();++ g = canvas.getContext("2d");++ self.count = spec.count || 255;+ self.checkerboard = spec.checkerboard || self.checkerboard;+ self.palette = spec.palette || self.palette;+ self.bins = spec.bins || self.bins;+ $canvas.css("background", "#ff0000");+ self.redraw();+ }++ /**+ * Method: redraw+ */+ self.redraw = function() {+ drawBackground();+ if ( !self.palette ) {+ return;+ }+ var lut = ns.toLookup(self.bins, self.palette);+ var binWidth = canvas.width / self.bins;+ var stripeWidth = ( binWidth < 1 ) ? 1 : binWidth;+ for ( var bin = 0; bin < self.bins; bin++ ) {+ g.fillStyle = "rgb(" ++ [lut[bin].r, lut[bin].g, lut[bin].b].join() + ")";+ g.fillRect(bin * binWidth, 0, stripeWidth, canvas.height);+ }+ }++ var drawBackground = function() {+ g.fillStyle = self.checkerboard;+ g.fillRect(0, 0, canvas.width, canvas.height);+ }++ init();+ return self;+}diff --git a/js/util.js b/js/util.jsindex a5a60ccc2..6d4954405 100644--- a/js/util.js+++ b/js/util.js@@ -1,13 +1,23 @@SOTE.namespace("SOTE.util");/**- * Given a key and a querystring, it extracts the value of the given key from the querystring- * Usage: SOTE.util.extractFromQuery(<key>,<qs>);- *- * @param {String,String} key is the item to be extracted, qs is the query string to extract from- * @returns value associated with the given key in the querystring- *-*/+ * Namespace: SOTE.util+ *+ * Utility functions.+ */++/**+ * Function: extractFromQuery+ *+ * Extracts the value of the given key from the querystring.+ *+ * Parameters:+ * key - Item to be extracted+ * qa - Query string to extract from+ *+ * Returns:+ * The value associated with the given key in the querystring+ */SOTE.util.extractFromQuery = function(key,qs){//if (default_==null) default_="";//key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");@@ -147,6 +157,147 @@ 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);+}++/**+ * Function: rgbToHsv+ *+ * Converts an RGB color value to HSV. Conversion formula+ * adapted from http://en.wikipedia.org/wiki/HSV_color_space.+ * Assumes r, g, and b are contained in the set [0, 255] and+ * returns h, s, and v in the set [0, 1].+ *+ * See Also:+ * http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript+ *+ * Parameters:+ * r - The red color value+ * g - The green color value+ * b - The blue color value+ *+ * Returns:+ * The HSV representation as an object with h, s, and v attributes.+ *+ * Example:+ *+ * (begin code)+ * >>> SOTE.util.rgbToHsv(20, 40, 60);+ * Object { h=0.5833333333333334, s=0.6666666666666666, v=0.23529411764705882}+ * (end code)+ */+SOTE.util.rgbToHsv = function(r, g, b){+ r = r/255, g = g/255, b = b/255;+ var max = Math.max(r, g, b), min = Math.min(r, g, b);+ var h, s, v = max;++ var d = max - min;+ s = max == 0 ? 0 : d / max;++ if(max == min){+ h = 0; // achromatic+ }else{+ switch(max){+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;+ case g: h = (b - r) / d + 2; break;+ case b: h = (r - g) / d + 4; break;+ }+ h /= 6;+ }++ return {h: h, s: s, v: v};+}++/**+ * Function: hsvToRgb+ *+ * Converts an HSV color value to RGB. Conversion formula+ * adapted from http://en.wikipedia.org/wiki/HSV_color_space.+ * Assumes h, s, and v are contained in the set [0, 1] and+ * returns r, g, and b in the set [0, 255].+ *+ * See Also:+ * http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript+ *+ * Parameters:+ * h - The hue+ * s - The saturation+ * v - The value+ *+ * Returns:+ * The RGB representation as an object with r, g, and b attributes.+ *+ * Example:+ *+ * (begin code)+ * >>> SOTE.util.hsvToRgb(0.5833333333333334, 0.6666666666666666, 0.23529411764705882)+ * Object { r=20, g=40, b=60}+ * (end code)+ */+SOTE.util.hsvToRgb = function(h, s, v){+ var r, g, b;++ var i = Math.floor(h * 6);+ var f = h * 6 - i;+ var p = v * (1 - s);+ var q = v * (1 - f * s);+ var t = v * (1 - (1 - f) * s);++ switch(i % 6){+ case 0: r = v, g = t, b = p; break;+ case 1: r = q, g = v, b = p; break;+ case 2: r = p, g = v, b = t; break;+ case 3: r = p, g = q, b = v; break;+ case 4: r = t, g = p, b = v; break;+ case 5: r = v, g = p, b = q; break;+ }++ return {+ r: Math.round(r * 255),+ g: Math.round(g * 255),+ b: Math.round(b * 255)+ };+}+/*** Generates an array of OpenLayers layers for the specified product: one for each* day starting from the current day, working backwards for a total of numDays.diff --git a/jsTestDriver-devel.conf b/jsTestDriver-devel.confdeleted file mode 100644index 91f544e92..000000000--- a/jsTestDriver-devel.conf+++ /dev/null@@ -1,36 +0,0 @@-server: http://localhost:8811--load:- - js/ext/yui/yahoo-min.js- - js/ext/yui/event-min.js- - js/ext/jquery/jquery-1.6.4.js- - js/ext/jqueryui-1.8.16/jquery-ui.min.js- - js/ext/jquery/jquery.mobile-1.0rc2.js- - js/ext/yui/combo-event-dragdrop-container-min.js- - js/ext/openlayers-2.12/OpenLayers.debug.js- - js/ext/datejs/date.js- - js/ext/jcrop/jcrop.js- - js/OpenLayers/Tile/Canvas.js- - js/component.js- - js/registry.js- - js/util.js- - js/map.js- - js/mapSote.js- - js/dateSpan.js- - js/rubberBand.js- - js/imageDownload.js- - js/menuPicker.js- - js/accordionPicker.js- - js/bank.js- - js/switch.js- - js/selector.js- - js/sote.js- - test/jshamcrest.js- - test/jsmockito-1.0.4.js- - test/harness.js--test:- - test/OpenLayers/Tile/*.js--timeout: 30-\ No newline at end of filediff --git a/jsTestDriver-prod.conf b/jsTestDriver-prod.confdeleted file mode 100644index 5c1f57c23..000000000--- a/jsTestDriver-prod.conf+++ /dev/null@@ -1,10 +0,0 @@-server: http://localhost:8811--load:- - build/worldview/js/worldview-min.js- - test/jsmockito-1.0.4.js--test:- - test/OpenLayers/Tile/*.js--timeout: 30diff --git a/test/Worldview/palette/testToLookup.js b/test/Worldview/palette/testToLookup.jsnew file mode 100644index 000000000..60088c478--- /dev/null+++ b/test/Worldview/palette/testToLookup.js@@ -0,0 +1,43 @@+/*+ * 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("palette.toLookup", {++ ns: null,++ setUp: function() {+ ns = SOTE.widget.palette;+ },++ testGradientBins2: function() {+ palette = {+ stops: [+ { at: 0.0, r: 0, g: 0, b: 0 },+ { at: 1.0, r: 100, g: 100, b: 100 }+ ]+ };+ lut = ns.toLookup(2, palette);+ assertEquals(0, lut[0].r);+ assertEquals(100, lut[1].r);+ },++ testGradientBins3: function() {+ palette = {+ stops: [+ { at: 0.0, r: 0, g: 0, b: 0 },+ { at: 1.0, r: 100, g: 100, b: 100 }+ ]+ };+ lut = ns.toLookup(3, palette);+ assertEquals(0, lut[0].r);+ assertEquals(50, lut[1].r);+ assertEquals(100, lut[2].r);+ }+});\ No newline at end of filediff --git a/test/Worldview/testUtil.js b/test/Worldview/testUtil.jsnew file mode 100644index 000000000..ab81e8d0e--- /dev/null+++ b/test/Worldview/testUtil.js@@ -0,0 +1,50 @@+/*+ * 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/jsTestDriver.conf b/test/jsTestDriver.confnew file mode 100644index 000000000..e5c09413c--- /dev/null+++ b/test/jsTestDriver.conf@@ -0,0 +1,39 @@+server: http://localhost:8811++load:+ - ../js/ext/yui/yahoo-min.js+ - ../js/ext/yui/event-min.js+ - ../js/ext/jquery/jquery-1.6.4.js+ - ../js/ext/jqueryui-1.8.16/jquery-ui.min.js+ - ../js/ext/jquery/jquery.mobile-1.0rc2.js+ - ../js/ext/yui/combo-event-dragdrop-container-min.js+ - ../js/ext/openlayers-2.12/OpenLayers.debug.js+ - ../js/ext/datejs/date.js+ - ../js/ext/jcrop/jcrop.js+ - ../js/OpenLayers/Tile/Canvas.js+ - ../js/component.js+ - ../js/registry.js+ - ../js/util.js+ - ../js/map.js+ - ../js/mapSote.js+ - ../js/dateSpan.js+ - ../js/rubberBand.js+ - ../js/imageDownload.js+ - ../js/menuPicker.js+ - ../js/accordionPicker.js+ - ../js/bank.js+ - ../js/switch.js+ - ../js/selector.js+ - ../js/sote.js+ - ../js/palette.js+ - jshamcrest.js+ - jsmockito-1.0.4.js+ - harness.js++test:+ - OpenLayers/Tile/*.js+ - Worldview/*.js+ - Worldview/palette/*.js++timeout: 30+\ No newline at end of file