Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-549: Layer now properly disabled when coming in via polar permalink

Mike McGann59c4ac8ab672
diff --git a/src/js/Worldview/Map/DailyLayerSet.js b/src/js/Worldview/Map/DailyLayerSet.js
index 1b041d29d..2c5cc20a0 100644
--- a/src/js/Worldview/Map/DailyLayerSet.js
+++ b/src/js/Worldview/Map/DailyLayerSet.js
@@ -1,10 +1,10 @@
/*
* NASA Worldview
- *
+ *
* This code was originally developed at NASA/Goddard Space Flight Center for
- * the Earth Science Data and Information System (ESDIS) project.
+ * the Earth Science Data and Information System (ESDIS) project.
*
- * Copyright (C) 2013 United States Government as represented by the
+ * Copyright (C) 2013 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*/
@@ -14,72 +14,72 @@ Worldview.namespace("Map");
/**
* Class: Worldview.Map.DailyProduct
* Product that updates on a daily basis.
- *
+ *
* A requirement in Worldview is to be able to slide between several dates
- * and quickly see the changes per day without redrawing the map. This trick is
- * performed by adding a new layer for each day selected and setting the
- * opacity for the other layers to zero. Once the map moves, the "cached"
+ * and quickly see the changes per day without redrawing the map. This trick is
+ * performed by adding a new layer for each day selected and setting the
+ * opacity for the other layers to zero. Once the map moves, the "cached"
* layers are invalidated and eligbile for removal the next time the map
* needs to be redrawn.
- *
+ *
* Delegates to:
* <Worldview.Map.Product>
- *
+ *
* Constructor: DailyProduct
* Creates a new instance.
- *
+ *
* Parameters:
* map - The map object that layers will be added and removed from.
* config - Configuration for this layer as a <Worldview.JSON.MapConfig.Product>
* object.
*/
Worldview.Map.DailyLayerSet = function(map, config) {
-
+
var self = Worldview.Map.LayerSet(config);
-
+
// The current z-index for all layers.
var zIndex = 0;
-
+
// Layers from previous days are cached for quick display when moving
// the time slider
var cachedLayers = {};
-
+
// Layers that are no longer valid because the map has moved. These
- // are removed using a timeout to prevent map flickering.
+ // are removed using a timeout to prevent map flickering.
var staleLayers = [];
-
+
// The layer that is currently visible and seen by the user
var currentLayer = null;
-
+
// The day of the data displayed on the map
var currentDay;
-
+
// Active lookup table for all layers in the product, null if no table
// is active
var lookupTable = null;
-
+
// Timeout identifier for the reaper that cleans out stale layers.
var reaperId = null;
-
+
// Time, in milliseconds, to wait before reaping stale layers.
var reapDelay = 500;
-
+
//-------------------------------------------------------------------------
// Public
//-------------------------------------------------------------------------
-
+
var init = function() {
self.setDay(Worldview.today());
-
+
map.events.register("movestart", self, invalidate);
map.events.register("zoomend", self, invalidate);
$(window).resize(invalidate);
};
-
+
/**
* Method: setDay
* Changes the map to display the product for the given day.
- *
+ *
* Parameters:
* d - The day to display.
*/
@@ -93,13 +93,13 @@ Worldview.Map.DailyLayerSet = function(map, config) {
if ( ds === currentDay ) {
return;
}
-
+
// If there is a current layer, cache it
if ( currentLayer ) {
cachedLayers[currentDay] = currentLayer;
}
currentDay = ds;
-
+
// If the layer is hidden, don't fetch anything
if ( self.visible ) {
fetchLayer();
@@ -108,16 +108,16 @@ Worldview.Map.DailyLayerSet = function(map, config) {
}
};
- self.setOpacity = function(opacity) {
+ self.setOpacity = function(opacity) {
if ( self.opacity === opacity ) {
return;
- }
+ }
self.opacity = opacity;
if ( currentLayer ) {
Worldview.Map.setVisiblity(currentLayer, self.visible, self.opacity);
}
};
-
+
self.setVisibility = function(visible) {
if ( self.visible === visible ) {
return;
@@ -127,17 +127,17 @@ Worldview.Map.DailyLayerSet = function(map, config) {
fetchLayer();
}
if ( currentLayer ) {
- Worldview.Map.setVisibility(currentLayer, self.visible,
- self.opacity);
- }
+ Worldview.Map.setVisibility(currentLayer, self.visible,
+ self.opacity);
+ }
};
-
+
/**
* Method: setLookup
* Applies a lookup table to this product. If this product doesn't have
* a lookup table already, all layers are discarded and a new layer is
- * created using <Worldview.Map.CanvasTile>.
- *
+ * created using <Worldview.Map.CanvasTile>.
+ *
* Parameters:
* lookup - The <ColorLookup> to apply.
*/
@@ -145,17 +145,17 @@ Worldview.Map.DailyLayerSet = function(map, config) {
var resetRequired = (lookupTable === null);
lookupTable = lookup;
if ( currentLayer ) {
- if ( resetRequired ) {
+ if ( resetRequired ) {
reset();
fetchLayer();
} else {
invalidate();
currentLayer.lookupTable = lookup;
- applyLookup(currentLayer);
+ applyLookup(currentLayer);
}
}
};
-
+
/**
* Method: clearLookup
* Removes a lookup table from this product. If the product has a lookup
@@ -168,14 +168,14 @@ Worldview.Map.DailyLayerSet = function(map, config) {
if ( currentLayer ) {
reset();
fetchLayer();
- }
+ }
}
};
-
+
/**
* Method: setZIndex
* Sets the z-index for all layers in this product.
- *
+ *
* Parameters:
* index - The z-index to set. All layers are set with this z-index
* except for the visible layer which is set to index + 1.
@@ -184,7 +184,7 @@ Worldview.Map.DailyLayerSet = function(map, config) {
zIndex = index;
refreshZOrder();
};
-
+
/**
* Method: dispose
* Remove all layers from the map.
@@ -196,19 +196,19 @@ Worldview.Map.DailyLayerSet = function(map, config) {
}
map.events.unregister("movestart", self, invalidate);
map.events.unregister("zoomend", self, invalidate);
- $(window).unbind("resize", invalidate);
+ $(window).unbind("resize", invalidate);
};
-
+
//-------------------------------------------------------------------------
// Private
//-------------------------------------------------------------------------
-
+
var fetchLayer = function() {
var previousLayer = currentLayer;
-
+
if ( currentDay in cachedLayers ) {
currentLayer = cachedLayers[currentDay];
- Worldview.Map.setVisibility(currentLayer, self.visible,
+ Worldview.Map.setVisibility(currentLayer, self.visible,
self.opacity);
delete cachedLayers[currentDay];
} else {
@@ -221,47 +221,47 @@ Worldview.Map.DailyLayerSet = function(map, config) {
});
if ( lookupTable !== null ) {
currentLayer.lookupTable = lookupTable;
- }
- map.addLayer(currentLayer);
+ }
+ map.addLayer(currentLayer);
}
if ( previousLayer ) {
previousLayer.setZIndex(zIndex);
- }
+ }
currentLayer.setZIndex(zIndex + 1);
Worldview.Map.setVisibility(currentLayer, self.visible, self.opacity);
-
+
if ( previousLayer ) {
Worldview.Map.setVisibility(previousLayer, false, 0);
- }
+ }
};
-
+
/*
* Iterates through each tile in the layer and applies the lookup.
- */
+ */
var applyLookup = function(layer) {
$.each(layer.grid, function(index, row) {
$.each(row, function(index, tile) {
- tile.applyLookup();
- });
- });
+ tile.applyLookup();
+ });
+ });
};
-
+
/*
* Sets the z-index on all layers.
*/
var refreshZOrder = function() {
$.each(cachedLayers, function(i, layer) {
layer.setZIndex(zIndex);
- });
+ });
if ( currentLayer ) {
- currentLayer.setZIndex(zIndex + 1);
+ currentLayer.setZIndex(zIndex + 1);
}
};
-
+
/*
* Clears the cache and removes the current layer. Called when switching
- * between a lookup and non-lookup based layer.
+ * between a lookup and non-lookup based layer.
*/
var reset = function() {
invalidate();
@@ -269,8 +269,8 @@ Worldview.Map.DailyLayerSet = function(map, config) {
map.removeLayer(currentLayer);
}
currentLayer = null;
- }
-
+ };
+
/*
* Hide all layers that are not currently being displayed and move them
* to the stale set. Restart the reaper to remove those layers.
@@ -287,7 +287,7 @@ Worldview.Map.DailyLayerSet = function(map, config) {
}
$.each(cachedLayers, function(day, layer) {
layer.setVisibility(false);
- staleLayers.push(layer);
+ staleLayers.push(layer);
});
cachedLayers = {};
@@ -296,22 +296,22 @@ Worldview.Map.DailyLayerSet = function(map, config) {
}
reaperId = setTimeout(function() { reaper(); }, reapDelay);
};
-
-
+
+
/*
* Remove all layers in the invalid set from the map.
*/
- var reaper = function(all) {
+ var reaper = function(all) {
$.each(staleLayers, function(index, layer) {
if ( map.getLayerIndex(layer) >= 0 ) {
map.removeLayer(layer);
}
- });
+ });
staleLayers = [];
refreshZOrder();
reaperId = null;
};
-
+
init();
return self;
-}
+};
diff --git a/src/js/Worldview/Map/LayerSet.js b/src/js/Worldview/Map/LayerSet.js
index fbc93c1a7..d72aff702 100644
--- a/src/js/Worldview/Map/LayerSet.js
+++ b/src/js/Worldview/Map/LayerSet.js
@@ -1,10 +1,10 @@
/*
* NASA Worldview
- *
+ *
* This code was originally developed at NASA/Goddard Space Flight Center for
- * the Earth Science Data and Information System (ESDIS) project.
+ * the Earth Science Data and Information System (ESDIS) project.
*
- * Copyright (C) 2013 United States Government as represented by the
+ * Copyright (C) 2013 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*/
@@ -14,83 +14,83 @@ Worldview.namespace("Map");
/**
* Class: Worldview.Map.Product
* Provides common methods for all products.
- *
+ *
* Constructor: Worldview.Map.Product
* Creates a new instance.
- *
+ *
* Parameters:
* c - Configuration for this layer as a <Worldview.JSON.MapConfig.Product>
* object.
*/
Worldview.Map.LayerSet = function(c) {
-
+
var self = {};
self.opacity = 1;
self.visible = false;
var config;
-
+
var init = function() {
config = $.extend(true, {}, c);
-
- var prop = config.properties || {};
+
+ var prop = config.properties || {};
if ( prop.style === undefined ) { prop.style = ""; }
if ( prop.tileSize ) {
- prop.tileSize = new OpenLayers.Size(prop.tileSize[0],
+ prop.tileSize = new OpenLayers.Size(prop.tileSize[0],
prop.tileSize[1]);
}
if ( prop.transitionEffect === undefined ) {
prop.transitionEffect = "resize";
}
-
- // HACK: For the moment, some projections use TWMS and others use
+
+ // HACK: For the moment, some projections use TWMS and others use
// WMTS. Copy the type attribute to the correct location if required
if ( config.properties.type ) {
config.type = config.properties.type;
delete config.properties.type;
- }
+ }
// If this is a WMS layer, the urls are passed in directly and not
// part of the parameters or properties
if ( config.type === "wms" && config.properties.url ) {
config.url = config.properties.url;
delete config.properties.url;
- }
+ }
// TWMS does not like the projection parameter, remove it
if ( config.type === "wms" && config.parameters ) {
delete config.parameters.projection;
}
};
-
+
/**
* Function: createLayer
- * Creates a new layer based on the configuration provided.
- *
+ * Creates a new layer based on the configuration provided.
+ *
* Parameters:
* additionalProperties - If specified, these properites are merged into
* the product configuration to create the layer.
- *
+ *
* Return:
* An OpenLayers Layer.
*/
self.createLayer = function(additionalProperties, additionalParameters) {
var properties = config.properties;
if ( additionalProperties ) {
- properties = $.extend(true, {}, config.properties,
+ properties = $.extend(true, {}, config.properties,
additionalProperties);
}
var parameters = config.parameters;
if ( additionalParameters ) {
- parameters = $.extend(true, {}, config.parameters,
+ parameters = $.extend(true, {}, config.parameters,
additionalParameters);
- }
+ }
var layer;
if ( properties.opacity ) {
self.opacity = properties.opacity;
- } else {
+ } else {
properties.opacity = self.opacity;
}
- properties.visiblity = false;
+ //properties.visiblity = false;
if ( config.type === "wms" ) {
- layer = new Worldview.Map.TWMSLayer(config.name, config.url,
+ layer = new Worldview.Map.TWMSLayer(config.name, config.url,
parameters, properties);
} else if ( config.type === "wmts" ) {
layer = new OpenLayers.Layer.WMTS(properties);
@@ -98,15 +98,15 @@ Worldview.Map.LayerSet = function(c) {
layer.mergeNewParams({"time": parameters.time});
}
} else if ( config.type === "graticule" ) {
- layer = new Worldview.Map.GraticuleLayer(config.name,
+ layer = new Worldview.Map.GraticuleLayer(config.name,
properties);
} else {
throw new Error("Unsupported layer type: " + config.type);
}
-
+ layer.setVisibility(false);
return layer;
};
-
+
init();
return self;
};
diff --git a/src/js/Worldview/Widget/Map.js b/src/js/Worldview/Widget/Map.js
index d780fae53..6279786fc 100644
--- a/src/js/Worldview/Widget/Map.js
+++ b/src/js/Worldview/Widget/Map.js
@@ -1,10 +1,10 @@
/*
* NASA Worldview
- *
+ *
* This code was originally developed at NASA/Goddard Space Flight Center for
- * the Earth Science Data and Information System (ESDIS) project.
+ * the Earth Science Data and Information System (ESDIS) project.
*
- * Copyright (C) 2013 United States Government as represented by the
+ * Copyright (C) 2013 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*/
@@ -14,101 +14,101 @@ Worldview.namespace("Widget");
/**
* Class: Worldview.Widget.Map
* Widget that provides the map for displaying data layers.
- *
+ *
* Constructor: Worldview.Widget.Map
* Creates a new instance.
- *
+ *
* Parameters:
* containerId - The id of the div element to place the map into
* spec.dataSourceUrl - The endpoint where configuration information should
* be obtained from.
- * spec.onReady - function to be invoked once the map has read in the
- * configuration and is ready to be used.
+ * spec.onReady - function to be invoked once the map has read in the
+ * configuration and is ready to be used.
*/
-Worldview.Widget.Map = function(containerId, config) {
+Worldview.Widget.Map = function(containerId, config) {
var log = Logging.getLogger("Worldview.Map");
//Logging.debug("Worldview.Map");
-
+
var self = {};
-
+
/**
* Property: maps
- * The <Worldview.Map.maps> that contains the map objects, one for
+ * The <Worldview.Map.maps> that contains the map objects, one for
* each projection.
*/
self.maps = null;
-
+
/**
* Property: config
- * The <Worldview.JSON.MapConfig> object retrieved from the server that
- * defines the available projections and data products.
+ * The <Worldview.JSON.MapConfig> object retrieved from the server that
+ * defines the available projections and data products.
*/
self.config = config;
-
+
var init = function() {
self.config = validateConfig(self.config);
- self.maps = Worldview.Map.MapSet(containerId,
+ self.maps = Worldview.Map.MapSet(containerId,
self.config, self);
-
+
$.each(self.config.layers, function(name, config) {
if ( config.defaultLayer === "true" ) {
self.maps.append(name);
}
});
- };
+ };
/**
* Method: setValue
* Zooms to the specified extent.
- *
+ *
* Parameters:
* value - String in the form of L_B_R_U where L is the left X value,
* B is the bottom Y value, R is the right X value, and U is the upper
- * Y value. Commas instead of underscores are also accepted.
+ * Y value. Commas instead of underscores are also accepted.
*/
self.setValue = function(value) {
if ( value === undefined ) {
return;
}
-
+
log.debug("setValue: " + value);
var extent = OpenLayers.Bounds.fromString(value);
var map = self.maps.map;
-
+
// Verify that the viewport extent overlaps the valid extent, if
// invalid, just zoom out the max extent
- if ( !Worldview.Map.isExtentValid(extent) ||
+ if ( !Worldview.Map.isExtentValid(extent) ||
!extent.intersectsBounds(map.getMaxExtent()) ) {
- log.warn("Extent is invalid: " + extent + "; using " +
+ log.warn("Extent is invalid: " + extent + "; using " +
map.getExtent());
log.info("Max extent: " + map.getMaxExtent());
extent = map.getExtent();
}
self.maps.map.zoomToExtent(extent, true);
};
-
+
/**
* Method: getValue
* Returns the current extent as a query string.
- *
+ *
* Returns:
* The value in the form of I=L_B_R_U where I is the container id, L is the
- * left X value, B is the bottom Y value, R is the right X value,
+ * left X value, B is the bottom Y value, R is the right X value,
* and U is the upper Y value.
*/
self.getValue = function() {
- var queryString = containerId + "=" +
+ var queryString = containerId + "=" +
self.maps.map.getExtent().toBBOX();
log.debug("getValue: " + queryString);
return queryString;
};
-
+
/**
* Method: loadFromQuery
* Sets the projection and zooms to the extent given values in a query
- * string.
- *
+ * string.
+ *
* Parameters:
* queryString: If switch=X appears in the string, the projection is
* set to X. If containerId=Y where containerId is the id that was used
@@ -129,11 +129,11 @@ Worldview.Widget.Map = function(containerId, config) {
self.maps.map.setCenter(center, parseInt(query.zoom));
} catch ( error ) {
log.warn("Unable to set center and zoom: " + error);
- }
+ }
}
self.updateComponent(queryString);
};
-
+
/**
* Method: validate
* Always returns true.
@@ -141,7 +141,7 @@ Worldview.Widget.Map = function(containerId, config) {
self.validate = function() {
return true;
};
-
+
/**
* Method: setDataSourceUrl
* Throws an unsupported exception.
@@ -149,27 +149,27 @@ Worldview.Widget.Map = function(containerId, config) {
self.setDataSourceUrl = function(url) {
throw new Error("setDataSourceUrl: unsupported");
};
-
+
/**
* Method: getDataSourceUrl
* Gets the URL endpoint where configuration data is obtained.
- *
+ *
* Returns:
* The URL to the configuration endpoint.
*/
self.getDataSourceUrl = function() {
return spec.dataSourceUrl;
};
-
+
/**
* Method: setStatus
* Throws an unsupported exception as it seems this method is never
* invoked.
*/
self.setStatus = function(status) {
- throw new Error("setStatus: unsupported");
+ throw new Error("setStatus: unsupported");
};
-
+
/**
* Method: getStatus
* Throws an unsupported exception as it seems this method is never
@@ -178,7 +178,7 @@ Worldview.Widget.Map = function(containerId, config) {
self.getStatus = function() {
throw new Error("getStatus: unsupported");
};
-
+
/*
* Make sure that all the required parameters exist in the map
* configuration.
@@ -193,7 +193,7 @@ Worldview.Widget.Map = function(containerId, config) {
var _config = ["projection"];
$.each(_config, function(index, key) {
if ( !(key in config.defaults ) ) {
- throw new Error("defaults." + key + " is required for the " +
+ throw new Error("defaults." + key + " is required for the " +
"map configuraiton");
}
});
diff --git a/src/js/Worldview/Widget/WorldviewMap.js b/src/js/Worldview/Widget/WorldviewMap.js
index 6ddf62dd0..28d5b97fe 100644
--- a/src/js/Worldview/Widget/WorldviewMap.js
+++ b/src/js/Worldview/Widget/WorldviewMap.js
@@ -1,10 +1,10 @@
/*
* NASA Worldview
- *
+ *
* This code was originally developed at NASA/Goddard Space Flight Center for
- * the Earth Science Data and Information System (ESDIS) project.
+ * the Earth Science Data and Information System (ESDIS) project.
*
- * Copyright (C) 2013 United States Government as represented by the
+ * Copyright (C) 2013 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*/
@@ -14,30 +14,30 @@ Worldview.namespace("Widget");
/**
* Class: Worldview.Widget.WorldviewMap
* Map features that are specific to Worldview.
- *
+ *
* Delegates to:
* <Worldview.Widget.Map>
- *
+ *
* Constructor: Worldview.Widget.WorldviewMap
* Creates a new instance.
- *
+ *
* Parameters:
* containerId - The id of the div element to place the map into
* spec.dataSourceUrl - The endpoint where configuration information should
* be obtained from.
- * spec.onReady - function to be invoked once the map has read in the
- * configuration and is ready to be used.
+ * spec.onReady - function to be invoked once the map has read in the
+ * configuration and is ready to be used.
*/
-Worldview.Widget.WorldviewMap = function(containerId, config) {
+Worldview.Widget.WorldviewMap = function(containerId, config) {
var ns = Worldview.Widget;
-
+
var self = ns.Map(containerId, config);
-
+
var log = Logging.getLogger("Worldview.Map");
var lastState = {};
var last = null;
-
+
var init = function() {
//Logging.debug("Worldview.Map");
if ( REGISTRY ) {
@@ -45,48 +45,48 @@ Worldview.Widget.WorldviewMap = function(containerId, config) {
} else {
throw new Error("Cannot register Map, REGISTRY not found");
}
-
+
REGISTRY.markComponentReady(containerId);
log.debug("Map is ready");
-
+
setExtentToLeading();
self.updateComponent(Worldview.Permalink.fromRegistry());
};
-
+
/**
* Method: updateComponent
* Updates the map when the state of the application changes.
- *
+ *
* Parameters:
- * queryString - If products=X is defined, ensure that only the layers for
+ * queryString - If products=X is defined, ensure that only the layers for
* X are visible. If switch=Y is defined, changes the projection of the
- * map to Y if necessary.
- */
- self.updateComponent = function(queryString) {
+ * map to Y if necessary.
+ */
+ self.updateComponent = function(queryString) {
try {
if ( !(self.maps.projection in lastState) ) {
lastState[self.maps.projection] = {};
}
last = lastState[self.maps.projection];
-
+
if ( last.queryString === queryString ) {
return;
}
log.debug("WorldviewMap: updateComponent", queryString);
-
- var state = REGISTRY.getState();
- log.debug("State", state);
+ var state = REGISTRY.getState();
+
+ log.debug("State", state);
log.debug("Last State", last);
-
- if ( state.projection !== undefined &&
+
+ if ( state.projection !== undefined &&
state.projection !== last.projection ) {
var projection = state.projection;
if ( !(projection in self.maps.mapConfig.projections) ) {
- var defaultProjection =
+ var defaultProjection =
self.maps.mapConfig.defaults.projection;
- log.warn("Invalid projection: " + projection + ", using: " +
+ log.warn("Invalid projection: " + projection + ", using: " +
defaultProjection);
projection = defaultProjection;
}
@@ -98,29 +98,29 @@ Worldview.Widget.WorldviewMap = function(containerId, config) {
self.maps.set(state.layers, state.hiddenLayers);
// If the layers changed, force setting the palettes
// again
- if ( !Worldview.arrayEquals(state.layers, last.layers) ) {
+ if ( !Worldview.arrayEquals(state.layers, last.layers) ) {
last.palettesString = "";
}
var topLayerSelected = false;
$.each(state.baselayers, function(index, layer) {
- var alreadyHidden =
+ var alreadyHidden =
$.inArray(layer, state.hiddenLayers) >= 0;
var visible = !topLayerSelected && !alreadyHidden;
if ( visible && !topLayerSelected ) {
topLayerSelected = true;
}
- self.maps.setVisibility(layer, visible);
+ self.maps.setVisibility(layer, visible);
});
}
if ( state.time !== last.time ) {
self.maps.setDay(state.time);
- }
+ }
if ( state.palettesString !== last.palettesString ) {
self.maps.setPalettes(state.palettes);
}
if ( state.opacityString !== last.opacityString) {
$.each(state.opacity, function(layerName, opacity) {
- self.maps.setOpacity(layerName, opacity);
+ self.maps.setOpacity(layerName, opacity);
});
}
last = state;
@@ -130,12 +130,12 @@ Worldview.Widget.WorldviewMap = function(containerId, config) {
Worldview.error("Unable to update map", cause);
}
};
-
+
self.parse = function(queryString, object) {
- parseProducts(queryString, object);
+ parseProducts(queryString, object);
return object;
};
-
+
// TODO: This should be moved to the product picker
var parseProducts = function(queryString, object) {
object.layers = [];
@@ -143,7 +143,7 @@ Worldview.Widget.WorldviewMap = function(containerId, config) {
object.hiddenLayers = [];
object.baselayers = [];
object.overlays = [];
-
+
var products = Worldview.extractFromQuery("products", queryString);
object.layersString = products;
if ( !products ) {
@@ -167,15 +167,15 @@ Worldview.Widget.WorldviewMap = function(containerId, config) {
values.push(name);
object[type].push(name);
}
- // Products are listed in the "opposite" order from what is
- // expected--the first layer is the layer to be drawn last.
+ // Products are listed in the "opposite" order from what is
+ // expected--the first layer is the layer to be drawn last.
// Flip them.
values.reverse();
object.layers = object.layers.concat(values);
}
return object;
};
-
+
var setExtentToLeading = function() {
// Polar projections don't need to be positioned
if ( self.maps.projection !== "geographic" ) {
@@ -183,8 +183,8 @@ Worldview.Widget.WorldviewMap = function(containerId, config) {
}
var map = self.maps.map;
-
- // Set default extent according to time of day:
+
+ // Set default extent according to time of day:
// at 00:00 UTC, start at far eastern edge of map: "20.6015625,-46.546875,179.9296875,53.015625"
// at 23:00 UTC, start at far western edge of map: "-179.9296875,-46.546875,-20.6015625,53.015625"
var curHour = Worldview.now().getUTCHours();
@@ -200,18 +200,17 @@ Worldview.Widget.WorldviewMap = function(containerId, config) {
// Compute east/west bounds
var minLon = 20.6015625 + curHour * (-200.53125/23.0);
var maxLon = minLon + 159.328125;
-
+
var minLat = -46.546875;
var maxLat = 53.015625;
-
+
var lat = minLat + (Math.abs(maxLat - minLat) / 2.0);
var lon = minLon + (Math.abs(maxLon - minLon) / 2.0);
var zoomLevel = 2;
-
+
map.setCenter(new OpenLayers.LonLat(lon, lat), zoomLevel);
- };
-
+ };
+
init();
return self;
};
-
\ No newline at end of file