Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Partial work on projection change info

Mike McGann1449e8f0c72f
diff --git a/src/index.html b/src/index.html
index f9ab6dbb3..5d6a7991e 100644
--- a/src/index.html
+++ b/src/index.html
@@ -129,6 +129,7 @@
<!-- link.dev --> <script type="text/javascript" src="js/ui/wv.ui.about.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/ui/wv.ui.indicator.js"></script>
+ <!-- link.dev --> <script type="text/javascript" src="js/proj/wv.proj.change.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/proj/wv.proj.model.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/proj/wv.proj.ui.js"></script>
@@ -228,7 +229,6 @@
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/Map.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/Palette.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/WorldviewMap.js"></script>
- <!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/ArcticProjectionChangeNotification.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/CRS.js"></script>
<!-- link.dev --> <script type="text/javascript" src="js/Worldview/Widget/DataDownload.js"></script>
diff --git a/src/js/link/wv.link.model.js b/src/js/link/wv.link.model.js
index 6e3dc535f..3b4386f7b 100644
--- a/src/js/link/wv.link.model.js
+++ b/src/js/link/wv.link.model.js
@@ -28,6 +28,7 @@ wv.link.model = wv.link.model || function(config) {
var DEBUG_SHORTEN_LINK = "https://earthdata.nasa.gov/worldview?a=1&b=2";
var shortenCache = new Cache(10);
var mock = "";
+ var components = [];
/**
* The "permalink" from the registry returns values from components
@@ -56,6 +57,10 @@ wv.link.model = wv.link.model || function(config) {
}
};
+ self.register = function(component) {
+ components.push(component);
+ };
+
/**
* Returns a query string that is the concatenated value of all components.
*
diff --git a/src/js/main.js b/src/js/main.js
index 7332d315f..66861ebbb 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -98,6 +98,7 @@ $(function() {// Initialize "static" vars
});
models.dataDownload = dataDownloadModel;
models.link = wv.link.model(config);
+ models.proj.change = wv.proj.change(models);
wv.models = models;
// These are only convienence handles to important objects used
@@ -139,9 +140,6 @@ $(function() {// Initialize "static" vars
m: map,
config: config
});
- var apcn = new Worldview.Widget.ArcticProjectionChangeNotification(
- config, legacyBank
- );
var crs = new Worldview.Widget.CRS(config);
// collapse events if worldview is being loaded via permalink
@@ -202,14 +200,14 @@ $(function() {// Initialize "static" vars
// Register event listeners
REGISTRY.addEventListener("map", "imagedownload");
REGISTRY.addEventListener("time",
- "map", "imagedownload", apcn.containerId, crs.containerId,
+ "map", "imagedownload", crs.containerId,
dataDownload.containerId);
REGISTRY.addEventListener("switch",
"map", "products", "selectorbox", "imagedownload", "camera",
- apcn.containerId, crs.containerId, dataDownload.containerId);
+ crs.containerId, dataDownload.containerId);
REGISTRY.addEventListener("products",
"map", "selectorbox", "imagedownload", "palettes",
- apcn.containerId, dataDownload.containerId);
+ dataDownload.containerId);
REGISTRY.addEventListener("selectorbox","products");
REGISTRY.addEventListener("camera","imagedownload");
REGISTRY.addEventListener("palettes","map","camera","products");
@@ -223,7 +221,6 @@ $(function() {// Initialize "static" vars
legacyDate,
map,
palettes,
- apcn,
crs,
dataDownload
];
diff --git a/src/js/proj/wv.proj.change.js b/src/js/proj/wv.proj.change.js
index fb4fdd8a2..c8f18e9c6 100644
--- a/src/js/proj/wv.proj.change.js
+++ b/src/js/proj/wv.proj.change.js
@@ -21,6 +21,7 @@ wv.proj = wv.proj || {};
wv.proj.change = wv.proj.change || function(models) {
var PROJECTION_CHANGE_DATE = new Date(Date.UTC(2013, 05, 06));
+ var notified = false;
var self = {};
self.events = wv.util.events();
@@ -40,6 +41,7 @@ wv.proj.change = wv.proj.change || function(models) {
var update = function() {
var proj = models.proj.selected;
+ var previous = self.old;
self.old = false;
self.crs = proj.crs;
self.epsg = proj.epsg;
@@ -55,6 +57,77 @@ wv.proj.change = wv.proj.change || function(models) {
}
}
self.events.trigger("selected", self);
+ if ( previous !== self.old ) {
+ checkNotify();
+ }
+ };
+
+ var checkNotify = function() {
+ // If the flag cannot be stored in local storage, do not notify
+ // the user which will constantly annoy them.
+ if ( !wv.util.browser.localStorage ) {
+ return;
+ }
+ if ( localStorage.getItem("projection_change_no_show") === "true" ) {
+ return;
+ }
+ if ( notified ) {
+ return;
+ }
+ notified = true;
+ notify();
+ };
+
+ var notify = function() {
+ dialog = new YAHOO.widget.Panel("projectionChangeNotification", {
+ width: "400px",
+ zIndex: 1020,
+ visible: false,
+ modal: true,
+ constraintoviewport: true
+ });
+ dialog.setHeader("Notice");
+ var body = [
+ "On " + wv.util.toISOStringDate(PROJECTION_CHANGE_DATE) +
+ " the polar projections changed as follows:" ,
+ "<br/><br/>",
+ "The <b>Arctic projection</b> changed from Arctic Polar ",
+ "Stereographic (EPSG:3995, \"Greenwich down\") to NSIDC Polar ",
+ "Stereographic North (EPSG:3413, \"Greenland down\").",
+ "<br/><br/>" +
+ "The <b>Antarctic projection</b> changed from being projected onto ",
+ "a sphere with radius of 6371007.181 meters to being projected ",
+ "onto the WGS84 ellipsoid. The projection is now the correct ",
+ "Antarctic Polar Stereographic (EPSG:3031). This change results ",
+ "in a shift of the imagery that ranges up to tens of kilometers, ",
+ "depending on the location.",
+ "<br/><br/>",
+
+ "Imagery before this date has not yet been reprocessed to the ",
+ "new projection. In addition, the \"Population Density\" and ",
+ "\"Global Label\" layers can no longer be displayed properly ",
+ "in the older projection.",
+ "<br/><br/>",
+
+ "Thanks for your patience as we improve and expand our ",
+ "imagery archive.",
+ "<br/><br/>",
+
+ "<input id='arcticChangeNoticeDontShowAgain' value='false' ",
+ "type='checkbox'>Do not show again"
+ ].join("");
+ dialog.setBody(body);
+ dialog.render(document.body);
+ dialog.show();
+ dialog.center();
+ dialog.hideEvent.subscribe(function(i) {
+ setTimeout(function() {
+ if ( $("#arcticChangeNoticeDontShowAgain").is(":checked") ) {
+ localStorage.setItem("projection_change_no_show", "true");
+ }
+ dialog.destroy();
+ }, 25);
+ });
};
init();