Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

* Permalink Capability * Style tweaks for Accordion and DateSpan * Made base class an object for optimization by passing by reference

Tilak Joshi566738d2ad28
diff --git a/css/dateSpan.css b/css/dateSpan.css
index 2afcca931..a540f2839 100644
--- a/css/dateSpan.css
+++ b/css/dateSpan.css
@@ -3,11 +3,12 @@
.spanContainerLabelDay{font-size:.16em;}
.spanContainer { float:right; min-height:100%; width:97%; margin-top:10px; margin-bottom:10px;}
.dateSpan {width:100%;}
-.datespan div.olMap {width:11.78%; height:100px;
+.datespan div.olMap {width:11.6%; height:100px;
float:left;
--moz-box-shadow: 0 0 5px 5px #111;
+/*-moz-box-shadow: 0 0 5px 5px #111;
-webkit-box-shadow: 0 0 5px 5px #111;
-box-shadow: 0 0 5px 5px #111;
+box-shadow: 0 0 5px 5px #111;*/
+border:#fff 1px solid;
margin:20px 0 0 2.5% !important;
position:relative; left:-1.25%;
display:block;
@@ -18,7 +19,7 @@ a.expand {background-image: url("../images/expandUp.png");}
.dateSpanSlider {visibility:hidden;}
div.ui-slider{height:0px; width:85.5%; border:red 0px solid; z-index:1002; float:left; margin:0 0 0 1.25%;}
div.ui-slider-switch {display:none}
-a.ui-slider-handle{height:130px; display:block; width:14%; background:rgba(228,108,10,.4); border:#E46C0A 2px solid; z-index:1004; position:relative; top:-142px; margin: 10px 0 0 0 !important; padding: 5px 0 5px 0; }
+a.ui-slider-handle{height:130px; display:block; width:14%; background:rgba(228,108,10,.2); border:#E46C0A 2px solid; z-index:1004; position:relative; top:-142px; margin: 10px 0 0 0 !important; padding: 5px 0 5px 0; }
span.sliderText {font: 14px/14px "Gill Sans", sans-serif, serif; font-weight:500; color:#fff; text-shadow:none; z-index:1005;}
a.ui-btn {margin:0;}
a.ui-shadow {box-shadow:none;}
diff --git a/css/map.css b/css/map.css
index 195be916d..572fa3702 100644
--- a/css/map.css
+++ b/css/map.css
@@ -73,13 +73,13 @@ div.olControlZoomPanelCustom .olControlZoomOutCustomItemInactive {
position: absolute;
}
div.olControlZoomPanelCustom .olControlZoomInCustomItemInactive {
- background-color:rgba(38,38,38,0.7);
+ background-color:rgba(0,0,0,0.83);
top: 0;
background-position: 0 0;
border-radius: 5px 5px 0 0;
}
div.olControlZoomPanelCustom .olControlZoomOutCustomItemInactive {
- background-color:rgba(38,38,38,0.7);
+ background-color:rgba(0,0,0,0.83);
top: 72px;
background-position: 0 -72px;
border-radius: 0 0 5px 5px ;
diff --git a/css/sote.css b/css/sote.css
index b0dbc07cc..a09aa9349 100644
--- a/css/sote.css
+++ b/css/sote.css
@@ -11,12 +11,14 @@ div {display:block;}
#permpanel h3 {color:#FFFFFF; font: 12px "Gill Sans", sans-serif; font-weight:100; text-decoration:none;}
#permpanel input[type='text']{width:280px;}
-div.horizontalContainer {width:100%; display:block; float:left; min-height:40px; background-color:rgba(0,0,0,0.93); position:absolute; overflow:hidden; bottom:0; z-index:1002; }
+div.horizontalContainer {width:100%; display:block; float:left; min-height:40px; background-color:rgba(0,0,0,0.8); position:absolute; overflow:hidden; bottom:0; z-index:1002; }
#aboutus,#permalink {float:right; margin-top:5px; position:relative; z-index:1002;display:block; width:50px; }
#aboutus,#permalink img {width:50px; height:44.5px; border:none;}
#aboutus,#permalink a{text-decoration:none; border:none;}
-.hidden {display:none;}
+#permalink_content {margin-top:10px;}
+
+.hidden {display:none;}
#products { z-index:1006; display:block; float:left; position:absolute; left:0; top:15%;}
diff --git a/data/ap.json b/data/ap.json
index e75a0253f..2716cf8e8 100644
--- a/data/ap.json
+++ b/data/ap.json
@@ -1,7 +1,7 @@
{
"expanded":"Dust Storms",
- "selected": "MODIS_Terra_CorrectedReflectance_TrueColor.cartographic:national-boundaries",
+ "selected": "MODIS_Terra_CorrectedReflectance_TrueColor",
"Dust Storms": [
{
"label": "Corrected Reflectance (True Color)",
diff --git a/index.html b/index.html
index b66f7e0ea..97b8fa5dd 100644
--- a/index.html
+++ b/index.html
@@ -50,8 +50,8 @@
<!-- External Javascript includes -->
- <script type="text/javascript" src="js/ext/openlayers-2.11/OpenLayers.js?mobile"></script>
-<!-- <script type="text/javascript" src="js/ext/openlayers-2.11/OpenLayers-unminified.js?mobile"></script> -->
+ <!--<script type="text/javascript" src="js/ext/openlayers-2.11/OpenLayers.js?mobile"></script>-->
+ <script type="text/javascript" src="js/ext/openlayers-2.11/OpenLayers-unmin.js?mobile"></script>
<script type="text/javascript" src="js/ext/datejs/date.js"></script>
<script type="text/javascript" src="js/ext/colorbox/jquery.colorbox-min.js"></script>
@@ -75,13 +75,14 @@
<div data-role="content">
<div id="banner"><img src='images/worldview.png' usemap="#bannermap" /></div>
<div id="aboutus"><a id='aboutus_link' class='aboutus_link' href='javascript:showOverlay();'><img src='images/aboutIcon.png' /></a></div>
+ <div id="permalink"><a id='perma_link' class='aboutus_link' href='javascript:showPermalink();'><img src='images/permalinkIcon.png' /></a></div>
<div id="hazard"></div>
<div id="products"></div>
<div id="map"></div>
<div class="horizontalContainer">
- <div id="time" ></div>
+ <div id="time"></div>
</div>
-
+
<!-- <map name="bannermap">
<area shape="rect" alt="http://lance.nasa.gov" coords="253,42,370,53" href="http://lance.nasa.gov" target="_blank" />
@@ -98,19 +99,21 @@
REGISTRY.addEventListener("products","map","time");
//REGISTRY.addEventListener("hazard","products");
-/* function testQS(){
- var comps = REGISTRY.getUIComponents();
+ function testQS(){
+ var comps = REGISTRY.getComponents();
for (var i=0; i < comps.length; i++) {
- comps[i].loadFromQuery(queryString);
+ if(typeof comps[i].obj.loadFromQuery == 'function'){
+ comps[i].obj.loadFromQuery(queryString);
+ }
}
}
- var queryString = window.location.hash.substring(1);
+ var queryString = window.location.search.substring(1);
if (queryString.length > 0) {
REGISTRY.addAllReadyCallback(testQS);
}
-*/
+
</script>
diff --git a/js/component.js b/js/component.js
index f5fa082b1..0247e0573 100644
--- a/js/component.js
+++ b/js/component.js
@@ -6,7 +6,7 @@ if (typeof SOTE=="undefined") {
* @description Takes out all SOTE components, widgets, and utilities out of the global namespace.
*
*/
- var SOTE = {};
+ var SOTE = new Object();
}
// Creates namespace(s) under SOTE
diff --git a/js/dateSpan.js b/js/dateSpan.js
index 990f9ac27..652cddec6 100644
--- a/js/dateSpan.js
+++ b/js/dateSpan.js
@@ -235,8 +235,12 @@ SOTE.widget.DateSpan.handleSlide = function(e,ui){
$('#'+self.id+'slider').slider("value",value);*/
var x = (self.range - (24*60*60*1000)) * (100-value)/100;
var time = new Date(self.endDate.getTime() - x);
- self.setValue(time.toUTCString());
- self.setVisualDate();
+ if(self.value.getTime() !== time.getTime()){
+ self.value = time.clone();
+ self.setVisualDate();
+ self.fire();
+ }
+
};
@@ -281,8 +285,19 @@ SOTE.widget.DateSpan.prototype.showMaps = function(){
*
*/
SOTE.widget.DateSpan.prototype.setValue = function(value){
- this.value = new Date(value);
- this.fire();
+ var d = SOTE.util.UTCDateFromISO8601String(value);
+ var startDate = this.endDate.getTime() - (this.range -24*60*60*1000);
+ if(d.getTime() <= this.endDate.getTime() && d.getTime() >= startDate)
+ {
+ this.value = d.clone();
+ var visualPositionDifference = ((this.endDate.getTime() - this.value.getTime())/(this.range - 24*60*60*1000))*100;
+ $('#'+this.id+'slider').val(100-visualPositionDifference).slider("refresh");
+ this.setVisualDate();
+ this.fire();
+ }
+ else{
+ SOTE.util.throwError("The date in your permalink has expired. As of right now, Worldview only retains the past 7 days of data. The date has been adjusted to today's date.");
+ }
};
SOTE.widget.DateSpan.prototype.setVisualDate = function(){
@@ -293,8 +308,8 @@ SOTE.widget.DateSpan.prototype.setVisualDate = function(){
this.spanDay.innerHTML = SOTE.util.DayNameFromUTCDayInt(this.value.getUTCDay());
*/
- var dateString = this.value.getUTCFullYear() + "-" + SOTE.util.zeroPad(eval(this.value.getUTCMonth()+1),2) + "-" +
- SOTE.util.zeroPad(this.value.getUTCDate(),2);
+ var dateString = this.value.getFullYear() + "-" + SOTE.util.zeroPad(eval(this.value.getMonth()+1),2) + "-" +
+ SOTE.util.zeroPad(this.value.getDate(),2);
$("a.ui-slider-handle").html("<span class='sliderText'>"+dateString+"</span>");
};
@@ -307,10 +322,7 @@ SOTE.widget.DateSpan.prototype.setVisualDate = function(){
*
*/
SOTE.widget.DateSpan.prototype.getValue = function(){
- var timeString = this.value.getUTCFullYear() + "-" + SOTE.util.zeroPad(eval(this.value.getUTCMonth()+1),2) + "-" +
- SOTE.util.zeroPad(this.value.getUTCDate(),2) + "T" + SOTE.util.zeroPad(this.value.getUTCHours(),2) + ":" +
- SOTE.util.zeroPad(this.value.getUTCMinutes(),2) + ":" + SOTE.util.zeroPad(this.value.getUTCSeconds(),2);
- return ""+this.id +"="+timeString+"&transition=standard";
+ return ""+this.id +"="+SOTE.util.ISO8601StringFromDate(this.value)+"&transition=standard";
};
/**
@@ -324,7 +336,11 @@ SOTE.widget.DateSpan.prototype.getValue = function(){
SOTE.widget.DateSpan.prototype.updateComponent = function(qs){
var bbox = SOTE.util.extractFromQuery('map',qs);
var products = SOTE.util.extractFromQuery('products',qs);
- var activeProducts = products.split(".");
+ var a = products.split(".");
+ var activeProducts = new Array();
+ for(var i=1; i < a.length; ++i){
+ activeProducts.push(a[i])
+ }
if(this.isCollapsed === false){
var numOfDays = this.range/24/60/60/1000;
var startDate = new Date(this.endDate.getTime() - this.range);
@@ -352,7 +368,7 @@ SOTE.widget.DateSpan.prototype.updateComponent = function(qs){
*
*/
SOTE.widget.DateSpan.prototype.loadFromQuery = function(qs){
- // Content
+ return this.setValue(SOTE.util.extractFromQuery(this.id,qs));
};
/**
diff --git a/js/map.js b/js/map.js
index e62f40208..82fbfe71b 100644
--- a/js/map.js
+++ b/js/map.js
@@ -137,6 +137,9 @@ SOTE.widget.Map = function(containerId, config){
// Set up callback for when pan/zoom ends to auto-call the "fire" function
this.map.events.register("moveend", this, this.handleMapMoveEnd);
+ if(REGISTRY){
+ REGISTRY.markComponentReady(this.id);
+ }
};
@@ -315,15 +318,15 @@ SOTE.widget.Map.prototype.init = function(){
fontOpacity: 1.0
}
);
- this.graticule = new OpenLayers.Control.Graticule({
+ /* this.graticule = new OpenLayers.Control.Graticule({
layerName: 'ol_graticule',
numPoints: 2,
labelled: true,
lineSymbolizer: graticuleLineStyle,
labelSymbolizer: graticuleLabelStyle
});
-
- this.map.addControl(this.graticule);
+ */
+ // this.map.addControl(this.graticule);
// Set mousewheel sensitivity
var navControl = this.map.getControlsByClass("OpenLayers.Control.Navigation")[0];
diff --git a/js/mapSote.js b/js/mapSote.js
index a88b4fb5d..ac05ae682 100644
--- a/js/mapSote.js
+++ b/js/mapSote.js
@@ -253,14 +253,18 @@ SOTE.widget.MapSote.prototype.updateComponent = function(querystring)
// Apply querystring request to map
// Extract the baselayer and overlays
- var activeLayerNames = null;
+ var activeLayerNames = new Array();
if (activeLayers != ""){
- activeLayerNames = activeLayers.split(".");
+ var a = activeLayers.split(".");
+ for(var i=1; i<a.length; ++i){
+ activeLayerNames.push(a[i]);
+ }
+
}
if ((activeLayerNames == null) || (activeLayerNames.length < 1))
{
- alert("No products provided in querystring to soteMap class");
- return;
+ //alert("No products provided in querystring to soteMap class");
+ return;
}
// Determine appropriate layer opacities based on currently-selected time
diff --git a/js/registry.js b/js/registry.js
index 0acf64b56..a6fa2f247 100644
--- a/js/registry.js
+++ b/js/registry.js
@@ -271,7 +271,7 @@ SOTE.util.Registry = function () {
found = true;
}
}
-
+
if (!found) {
allReady = false;
break;
diff --git a/js/sote.js b/js/sote.js
index e5dd21d56..0732a106c 100644
--- a/js/sote.js
+++ b/js/sote.js
@@ -17,7 +17,6 @@ window.onload = function(){// Initialize "static" vars
ieWarningOverlay.show();
ieWarningOverlay.center();
}
-
// Create map
var m = new SOTE.widget.MapSote("map",{baseLayer:"MODIS_Terra_CorrectedReflectance_TrueColor"});
@@ -56,3 +55,45 @@ function showOverlay(){
}
+function showPermalink(){
+ if(this.permOverlay === undefined){
+ this.permOverlay = new YAHOO.widget.Panel("panel_perm", {width:"300px", zIndex:1020, visible:false } );
+ var item = "<div id='permpanel' >"+
+ "<!-- <h3>Permalink:</h3> -->"+
+ "<span style='font-weight:400; font-size:12px; line-spacing:24px; '><i>Copy and paste the following link to share this view:</i></span>" +
+ "<input type='text' value='' name='permalink_content' id='permalink_content' />" +
+ "<p><br />Note: Worldview contains only the most recent 7 days of data, this link will expire after the currently selected time is older than 7 days.</p>" +
+ "</div>";
+ this.permOverlay.setHeader('&nbsp;&nbsp;&nbsp;&nbsp;Permalink');
+ this.permOverlay.setBody(item);
+ this.permOverlay.render(document.body);
+ }
+ var qs = "?";
+ var comps = REGISTRY.getComponents();
+ for (var i=0; i < comps.length; i++) {
+ if(typeof comps[i].obj.getValue == 'function'){
+ qs+= comps[i].obj.getValue() + "&";
+ }
+ }
+
+ var map = SOTE.util.extractFromQuery("map",qs);
+ var products = SOTE.util.extractFromQuery("products",qs);
+ var time = SOTE.util.extractFromQuery("time",qs);
+
+ qs = "?map="+map+"&products="+products+"&time="+time;
+
+ var url = window.location.href;
+ var prefix = url.split("?")[0];
+ //alert(prefix);
+ prefix = (prefix !== null && prefix !== undefined)? prefix: url;
+
+ $('#permalink_content').val(prefix+qs);
+
+ this.permOverlay.show();
+ this.permOverlay.center();
+
+ document.getElementById('permalink_content').focus();
+ document.getElementById('permalink_content').select();
+
+}
+
diff --git a/js/util.js b/js/util.js
index 01abbc9ab..4c45a53a3 100644
--- a/js/util.js
+++ b/js/util.js
@@ -19,6 +19,19 @@ SOTE.util.extractFromQuery = function(key,qs){
return val[1];
};
+SOTE.util.throwError = function(errorTextHTML){
+ o = new YAHOO.widget.Panel("WVerror", {width:"300px", zIndex:1020, visible:false } );
+ o.setHeader('&nbsp;&nbsp;&nbsp;&nbsp;Warning');
+ o.setBody(errorTextHTML);
+ o.render(document.body);
+ o.show();
+ o.center();
+ o.hideEvent.subscribe(function(i) {
+ setTimeout(function() {o.destroy();}, 25);
+ });
+
+};
+
/**
* Generates a request to the server and forwards the response to the success/failure callback
* Usage: SOTE.util.getJSON(<url>,<args to pass through>,<success callback>,<failure callback>);