Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Inital data download button

Mike McGannf7f0d9a61baf
diff --git a/etc/ant/css.build.xml b/etc/ant/css.build.xml
index 9cee978ce..f8c6eb985 100644
--- a/etc/ant/css.build.xml
+++ b/etc/ant/css.build.xml
@@ -39,6 +39,7 @@
<file name="css/about.css"/>
<file name="css/indicator.css"/>
<file name="css/events.css"/>
+ <file name="css/dataDownload.css"/>
</filelist>
diff --git a/src/css/dataDownload.css b/src/css/dataDownload.css
new file mode 100644
index 000000000..6edcd39e1
--- /dev/null
+++ b/src/css/dataDownload.css
@@ -0,0 +1,15 @@
+#dataDownload {
+ padding-top: 10px;
+ display: inline-block;
+ float: left;
+ width: 100%;
+ height: 100%;
+ font-size: 1em;
+ color: #222;
+ text-shadow: none;
+}
+
+#dataDownload div.ui-button {
+ margin-left: 20px;
+ margin-right: 20px;
+}
diff --git a/src/css/products.css b/src/css/products.css
index d564358a9..dcc2d055a 100644
--- a/src/css/products.css
+++ b/src/css/products.css
@@ -3,11 +3,21 @@ background: rgba(38,43,49,0.65); border-radius:0 10px 10px 0; top:20px;
}
.ui-tabs-nav {clear:both; display:inline-block; overflow:hidden; width:90%; border-radius:0; border-bottom: 3px #00457b solid; float:left;}
-.ui-tabs-nav li.layerPicker {height:100%; display:inline-block; float:left; width:25%;}
-.ui-tabs-nav li.layerPicker.ui-state-active { width: 50%; }
+.ui-tabs-nav li.layerPicker {height:100%; display:inline-block; float:left; width:20%;}
+.ui-tabs-nav li.layerPicker.ui-state-active { width: 60%; }
-.ui-tabs-nav li a {/*border-radius: 10px 10px 0 0;*/ color: #fff; font-size:1.1em; font-weight: 400; display:block; border:none; padding:0.5em 0; width:100%;
-text-align:center; text-decoration:none; text-shadow:none;
+.ui-tabs-nav li a {
+ /*border-radius: 10px 10px 0 0;*/
+ color: #fff;
+ font-size: 1.1em;
+ font-weight: 400;
+ border: none;
+ padding: 0.5em 0;
+ width: 100%;
+ text-align: center;
+ text-decoration: none;
+ text-shadow: none;
+ display: block;
}
.ui-tabs-nav li.first.ui-state-active a { background: -moz-linear-gradient(top, rgba(255,255,255,0.7) 0%, rgba(11,95,160,0.7) 23%, rgba(0,88,156,0.7) 24%, rgba(0,81,144,0.7) 99%, rgba(0,81,144,0.7) 100%); /* FF3.6+ */
@@ -64,6 +74,16 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b3ffffff', e
}
+.productsIcon {
+ width: 20px;
+ height: 20px;
+ vertical-align: middle;
+}
+
+.productsIcon.selected {
+ margin-right: 10px;
+}
+
@media screen and (max-device-height: 720px) and (orientation: landscape){
div.olControlMousePosition, div.olControlScaleLineCustom {display:none !important;}
}
diff --git a/src/images/missing-icon.svg b/src/images/missing-icon.svg
new file mode 100644
index 000000000..e628f49f9
--- /dev/null
+++ b/src/images/missing-icon.svg
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 48 48" width="4pc" height="4pc"><metadata xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:date>2013-08-25 20:04Z</dc:date><!-- Produced by OmniGraffle Professional 5.4.3 --></metadata><defs></defs><g stroke="none" stroke-opacity="1" stroke-dasharray="none" fill="none" fill-opacity="1"><title>Canvas 1</title><g><title>Layer 1</title><rect x="0" y="0" width="24" height="24" fill="#666"/><rect x="24" y="24" width="24" height="24" fill="#666"/><rect x="0" y="24" width="24" height="24" fill="#999"/><rect x="24" y="0" width="24" height="24" fill="#999"/></g></g></svg>
diff --git a/src/index.html b/src/index.html
index 659d148f4..66990d7d0 100644
--- a/src/index.html
+++ b/src/index.html
@@ -59,6 +59,7 @@
<!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/about.css" />
<!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/indicator.css" />
<!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/events.css" />
+ <!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/dataDownload.css" />
<!-- JavaScript resources ============================================= -->
<!-- link.prod --> <!-- <script type="text/javascript" src="js/worldview-min.js?v=@BUILD_NONCE@&mobile"></script> -->
@@ -220,7 +221,6 @@
<li class='toolbar-icon'><div id='camera'></div></li>
<li class='toolbar-icon'><div id="switch"></div></li>
<li class='toolbar-icon'><a id='perma_link' class='toolbar-link' title='Permalink' href='javascript:Worldview.Permalink.show();'><img src='images/permalink.png' /></a></li>
- <li class='toolbar-icon'><div class='dataDownload-modeButton'></div></li>
</ul>
</div>
diff --git a/src/js/Worldview/Widget/DataDownload.js b/src/js/Worldview/Widget/DataDownload.js
index c98a1af75..afbf56997 100644
--- a/src/js/Worldview/Widget/DataDownload.js
+++ b/src/js/Worldview/Widget/DataDownload.js
@@ -39,7 +39,8 @@ Worldview.Widget.DataDownload = function(config, spec) {
var self = {};
self.containerId = "dataDownload";
-
+ self.startPressed = false;
+
var init = function() {
model.events
.on("activate", onActivate)
@@ -51,8 +52,8 @@ Worldview.Widget.DataDownload = function(config, spec) {
.on("queryError", onQueryError)
.on("queryTimeout", onQueryTimeout);
- $(spec.selector).on("click", toggleMode);
- $(spec.selector).html(HTML_WIDGET_INACTIVE);
+ //$(spec.selector).on("click", toggleMode);
+ //$(spec.selector).html(HTML_WIDGET_INACTIVE);
REGISTRY.register(self.containerId, self);
REGISTRY.markComponentReady(self.containerId);
@@ -86,13 +87,25 @@ Worldview.Widget.DataDownload = function(config, spec) {
}
};
+ self.render = function() {
+ var tabsHeight = $(".ui-tabs-nav").outerHeight(true);
+ $(spec.selector)
+ .height($(spec.selector).parent().outerHeight() - tabsHeight)
+ .html(
+ "<input type='button' value='Start'>"
+ ).trigger("create");
+ $(spec.selector + " input[type='button']").click(function() {
+ self.startPressed = true;
+ model.activate();
+ });
+ };
+
var toggleMode = function() {
model.toggleMode();
};
var onActivate = function() {
log.debug("activate");
- $(spec.selector).html(HTML_WIDGET_ACTIVE);
if ( !controlDialog ) {
controlDialog = Worldview.DataDownload.ControlDialog(model);
@@ -107,11 +120,13 @@ Worldview.Widget.DataDownload = function(config, spec) {
Worldview.DataDownload.MapController(model, spec.maps, config);
}
+ $(spec.selector + " input[type='button']").button("disable");
+ $(spec.selector + " .ui-btn .ui-btn-text").html("Download (0)");
+
};
var onDeactivate = function() {
log.debug("deactivate");
- $(spec.selector).html(HTML_WIDGET_INACTIVE);
controlDialog.hide();
Worldview.Indicator.hide();
};
diff --git a/src/js/main.js b/src/js/main.js
index 1f45465ca..76e967817 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -122,11 +122,24 @@ $(function() {// Initialize "static" vars
wvEPSG: crs
});
var dataDownload = Worldview.Widget.DataDownload(config, {
- selector: ".dataDownload-modeButton",
+ selector: "#dataDownload",
model: dataDownloadModel,
maps: map.maps
});
-
+ dataDownload.render();
+
+ // Wirings
+ products.events
+ .on("dataDownloadSelect", function() {
+ if ( dataDownload.startPressed ) {
+ dataDownloadModel.activate();
+ }
+ })
+ .on("dataDownloadUnselect", function() {
+ dataDownloadModel.deactivate();
+ });
+
+
// Register event listeners
REGISTRY.addEventListener("time",
"map", "imagedownload", apcn.containerId, crs.containerId,
diff --git a/src/js/products.js b/src/js/products.js
index eba31d4ec..6b024fd31 100644
--- a/src/js/products.js
+++ b/src/js/products.js
@@ -63,10 +63,33 @@ SOTE.widget.Products = function(containerId, config){
this.initRenderComplete = false;
this.paletteWidget = config.paletteWidget;
this.config = config.config;
+ this.events = Worldview.Events();
+
this.init();
}
+SOTE.widget.Products.HTML_TAB_ACTIVE_SELECTED =
+ "<img class='productsIcon selected' src='images/missing-icon.svg'>" +
+ "Active"
+
+SOTE.widget.Products.HTML_TAB_ACTIVE_UNSELECTED =
+ "<img class='productsIcon' src='images/missing-icon.svg' title='Activce Layers'>";
+
+SOTE.widget.Products.HTML_TAB_ADD_SELECTED =
+ "<img class='productsIcon selected' src='images/missing-icon.svg'>" +
+ "Add Layers"
+
+SOTE.widget.Products.HTML_TAB_ADD_UNSELECTED =
+ "<img class='productsIcon' src='images/missing-icon.svg' title='Add Layers'>";
+
+SOTE.widget.Products.HTML_TAB_DOWNLOAD_SELECTED =
+ "<img class='productsIcon selected' src='images/missing-icon.svg'>" +
+ "Download"
+
+SOTE.widget.Products.HTML_TAB_DOWNLOAD_UNSELECTED =
+ "<img class='productsIcon' src='images/missing-icon.svg' title='Download'>";
+
/**
* Displays all options in HTML in an Accordion format (see JQuery UI Accordion) with the selected states being indicated
* by radio button and checkbox selection. All callbacks should be set. The component UI should be rendered
@@ -107,15 +130,17 @@ SOTE.widget.Products.prototype.render = function(){
tabs.setAttribute("id",this.id+"tabs");
tabs.innerHTML =
"<li class='layerPicker first'>" +
- "<a href='#products' class='activetab tab'>Act</a>" +
+ "<a href='#products' class='activetab tab'></a>" +
"</li>" +
"<li class='layerPicker second'>" +
- "<a class='addlayerstab tab' href='#selectorbox'>Add</a>" +
+ "<a class='addlayerstab tab' href='#selectorbox'></a>" +
"</li>" +
"<li class='layerPicker third'>" +
- "<a class='addlayerstab tab' href='#selectorbox'>DL</a>" +
+ "<a class='tab' href='#dataDownload'></a>" +
"</li>";
this.container.appendChild(tabs);
+ SOTE.widget.Products.change({data: {self: this}}, {index: 0});
+
//$('#'+this.id).addClass('products');
var toggleButtonHolder = document.createElement("div");
toggleButtonHolder.setAttribute("id",this.id+"toggleButtonHolder");
@@ -135,10 +160,16 @@ SOTE.widget.Products.prototype.render = function(){
selectorbox.setAttribute("id","selectorbox");
this.container.appendChild(selectorbox);
-
+ var downloadBox = document.createElement("div");
+ downloadBox.setAttribute("id", "dataDownload");
+ this.container.appendChild(downloadBox);
//this.container.appendChild(productContainer);
- $('#'+this.id).tabs({show: SOTE.widget.Products.change});
+ var self = this;
+ $('#'+this.id).tabs({show: function(e, ui) {
+ e.data = { self: self };
+ SOTE.widget.Products.change(e, ui)
+ }});
this.b = new SOTE.widget.Bank("products", {
paletteWidget: this.paletteWidget,
dataSourceUrl: "ap_products.php",
@@ -214,6 +245,7 @@ SOTE.widget.Products.stopLink = function(e){
};
SOTE.widget.Products.change = function(e,ui) {
+ var self = e.data.self;
if ( ui.index === 0 ) {
$('.ui-tabs-nav')
.addClass('firstselected')
@@ -234,9 +266,21 @@ SOTE.widget.Products.change = function(e,ui) {
throw new Error("Invalid tab index: " + ui.index);
}
- var tab1 = ( ui.index === 0 ) ? "Active" : "Act";
- var tab2 = ( ui.index === 1 ) ? "Add Layers +" : "Add";
- var tab3 = ( ui.index === 2 ) ? "Download" : "DL";
+ var tab1 = ( ui.index === 0 )
+ ? SOTE.widget.Products.HTML_TAB_ACTIVE_SELECTED
+ : SOTE.widget.Products.HTML_TAB_ACTIVE_UNSELECTED;
+ var tab2 = ( ui.index === 1 )
+ ? SOTE.widget.Products.HTML_TAB_ADD_SELECTED
+ : SOTE.widget.Products.HTML_TAB_ADD_UNSELECTED;
+ var tab3 = ( ui.index === 2 )
+ ? SOTE.widget.Products.HTML_TAB_DOWNLOAD_SELECTED
+ : SOTE.widget.Products.HTML_TAB_DOWNLOAD_UNSELECTED;
+
+ if ( ui.index === 2 ) {
+ self.events.trigger("dataDownloadSelect");
+ } else {
+ self.events.trigger("dataDownloadUnselect");
+ }
$('.ui-tabs-nav li.first a').html(tab1);
$('.ui-tabs-nav li.second a').html(tab2);