Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Merge branch 'rotation' of https://github.com/nasa-gibs/worldview into running-data

Benjamin4a34c6254143
diff --cc web/js/map/wv.map.ui.js
index 0d1f9690f,c9abd5eb4..19374ba41
--- a/web/js/map/wv.map.ui.js
+++ b/web/js/map/wv.map.ui.js
@@@ -11,8 -11,10 +11,11 @@@
var wv = wv || {};
wv.map = wv.map || {};
+
+ /*
+ * @Class
+ */
-wv.map.ui = wv.map.ui || function(models, config, Rotation) {
+wv.map.ui = wv.map.ui || function(models, config, Rotation, DataRunner) {
var id = "wv-map";
var selector = "#" + id;
var cache = new Cache(100); // Save layers from days visited
@@@ -149,10 -206,17 +212,18 @@@
});
updateLayerVisibilities();
};
-
+ /*
+ * Function called when layers need to be updated
+ * e.g: can be the result of new data or another display
+ *
+ * @method updateLayerVisibilities
+ * @static
+ *
+ * @returns {void}
+ */
var updateLayerVisibilities = function() {
- self.selected.getLayers().forEach(function(layer) {
+ var layers = self.selected.getLayers();
+ layers.forEach(function(layer) {
if ( layer.wv ) {
var renderable = models.layers.isRenderable(layer.wv.id);
layer.setVisible(renderable);
@@@ -551,23 -814,28 +828,39 @@@
onZoomChange();
};
+ /*
+ * Creates map events based on mouse position
+ *
+ *
+ * @method createMousePosSel
+ * @static
+ *
+ * @param {object} map - OpenLayers Map Object
+ *
+ * @param {object} proj - Projection properties
+ *
+ *
+ * @returns {void}
+ *
+ * @todo move this component to another Location
+ */
var createMousePosSel = function(map, proj) {
- var $map = $("#" + map.getTarget());
+ var $map;
+ var mapId;
+ var $mousePosition;
+ var $latlonDD;
+ var $latlonDMS;
+ var $coordBtn;
+ var $coordWrapper;
+ var coordinateFormat;
+ // var timer = null;
+ // var isIntervalSet = false;
+
+ $map = $("#" + map.getTarget());
map = map || self.selected;
- var mapId = 'coords-' + proj.id;
+ mapId = 'coords-' + proj.id;
- var $mousePosition = $('<div></div>')
+ $mousePosition = $('<div></div>')
.attr("id", mapId)
.addClass("wv-coords-map wv-coords-map-btn");
@@@ -656,9 -914,28 +960,21 @@@
.mouseout(function(){
$('#' + mapId).hide();
})
- .mousemove(function(e){
- $('#' + mapId).show();
- var coords = map.getCoordinateFromPixel([e.pageX,e.pageY]);
- $('#' + mapId + ' span.map-coord').each(function(){
- var format = $(this).attr('data-format');
- $(this).html(coordinateFormat(coords, format));
- });
- });
+ .mousemove(_.throttle(onMouseMove, 100));
};
+ /*
+ * Setting a zoom action
+ *
+ * @function zoomAction
+ * @static
+ *
+ * @param {Object} map - OpenLayers Map Object
+ * @param {number} amount - Direction and
+ * amount to zoom
+ *
+ * @returns {void}
+ */
var zoomAction = function(map, amount) {
return function() {
var zoom = map.getView().getZoom();