Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Ignoring/warning on configuration problems rather than erroring

Ryan Boller49ec49615226
diff --git a/web/js/layers/wv.layers.modal.js b/web/js/layers/wv.layers.modal.js
index 3344aa211..a0b994cdf 100644
--- a/web/js/layers/wv.layers.modal.js
+++ b/web/js/layers/wv.layers.modal.js
@@ -65,7 +65,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
//Create container for 'by interest' filters buttons
var $nav = $('<nav></nav>')
.attr( 'id', 'categories-nav' );
-
+
//Create container for breadcrumb
var $breadcrumb = $('<nav></nav>')
.attr( 'id', 'category-breadcrumb' );
@@ -89,7 +89,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
height: modalHeight,
width: gridItemWidth * sizeMultiplier + 10,
});
-
+
$( '#layer-modal-main' ).css( 'height', modalHeight - 40 )
.perfectScrollbar('update');
@@ -248,11 +248,16 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
var layer = config.layers[setting];
+ if (typeof layer === 'undefined') {
+ console.log("Warning: skipping undefined layer: ", setting);
+ return;
+ }
+
var $wrapper = $('<li></li>')
.attr('data-layer', encodeURIComponent(layer.id) )
.attr( 'value', encodeURIComponent( layer.id ) )
.addClass('measurement-settings-item');
-
+
var $setting = $( '<input></input>' )
.attr( 'type', 'checkbox' )
.addClass( 'settings-check')
@@ -315,7 +320,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
//$sourceContent.append( $addButton, $removeButton );
$measurementContent.append( $sourceContent );
-
+
});
//End source level
@@ -326,10 +331,10 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
$categoryList.append( $measurementHeader );
$categoryList.append( $measurementContent );
-
+
});
//End measurement level
-
+
$categoryList.accordion({
collapsible: true,
@@ -367,7 +372,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
redoScrollbar();
$selectedCategory.iCheck({checkboxClass: 'icheckbox_square-red'});
$breadcrumb.show();
-
+
};
var drawAllLayers = function() {
@@ -544,7 +549,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
.click( function( e ) {
drawMeasurements( category );
});
-
+
$categoryTitle.append( $categoryLink );
$categoryOpaque.append( $categoryTitle );
@@ -581,7 +586,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
});
$categoryOpaque.append( $measurements );
-
+
$categories.append( $category );
});
@@ -615,7 +620,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
$nav.buttonset();
$nav.show();
});
-
+
$categories.isotope( {
itemSelector: '.layer-category',
//stamp: '.stamp',
@@ -634,7 +639,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
$('#layer-modal-main').prepend( $nav );
$('label[for=button-filter-legacy]').addClass('nav-selected');
-
+
};
var addLayer = function(event) {
event.stopPropagation();
@@ -651,7 +656,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
wv.util.jqueryEscape(layer.id) + "']");
$element.iCheck("check");
};
-
+
var onLayerRemoved = function(layer) {
var $element = $( self.selector + " [data-layer='" +
wv.util.jqueryEscape(layer.id) + "']");
@@ -727,8 +732,8 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
$( ".ui-widget-overlay" ).unbind( "click" );
}
});
-
-
+
+
$search.append( $searchBtn )
.append( $searchInput );
@@ -740,7 +745,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
$( self.selector ).dialog( "close" );
})
.append('<i></i>');
-
+
$header.append ( $closeButton );
//$(self.selector + "select").on('change', filter);
@@ -784,7 +789,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
!names.subtitle.toLowerCase().contains(term) &&
!names.tags.toLowerCase().contains(term) &&
!config.layers[layer.id].id.toLowerCase().contains(term);
-
+
if ( filtered ) {
return false;
}
@@ -794,7 +799,7 @@ wv.layers.modal = wv.layers.modal || function(models, ui, config) {
var runSearch = _.throttle( function() {
var search = searchTerms();
- $.each(config.layers, function(layerId, layer) {
+ $.each(config.layers, function(layerId, layer) {
var fproj = filterProjections(layer);
var fterms = filterSearch(layer, search);
diff --git a/web/js/map/wv.map.ui.js b/web/js/map/wv.map.ui.js
index 4574593c2..5163b5a92 100644
--- a/web/js/map/wv.map.ui.js
+++ b/web/js/map/wv.map.ui.js
@@ -62,7 +62,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
var map = createMap(proj);
self.proj[proj.id] = map;
});
-
+
models.proj.events.on("select", function() {
updateProjection();
});
@@ -261,7 +261,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
*
* @param {object} def - layer Specs
*
- * @param {number} value - number value
+ * @param {number} value - number value
*
* @returns {void}
*/
@@ -414,15 +414,15 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
};
/*
- * Checks a layer's properties to deterimine if
+ * Checks a layer's properties to deterimine if
* it is a graticule
- *
+ *
*
* @method isGraticule
* @static
*
* @param def {object} Layer Specs
- *
+ *
*
* @returns {boolean}
*/
@@ -435,11 +435,11 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
/*
* Adds a graticule to the OpenLayers Map
* if a graticule does not already exist
- *
+ *
*
* @method addGraticule
* @static
- *
+ *
*
* @returns {void}
*/
@@ -460,7 +460,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
/*
* Adds a graticule to the OpenLayers Map
* if a graticule does not already exist
- *
+ *
*
* @method removeGraticule
* @static
@@ -480,13 +480,13 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
/*
* Updates the extents of OpenLayers map
- *
+ *
*
* @method updateExtent
* @static
*
* @returns {void}
- */
+ */
var updateExtent = function() {
var map = self.selected;
models.map.update(map.getView().calculateExtent(map.getSize()));
@@ -494,7 +494,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
};
/*
* Updates the extents of OpenLayers map
- *
+ *
*
* @method updateExtent
* @static
@@ -613,7 +613,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
};
/*
* Creates map zoom buttons
- *
+ *
*
* @method createZoomButtons
* @static
@@ -658,8 +658,8 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
/*
* Sets zoom buttons as active or inactive based
- * on the zoom level
- *
+ * on the zoom level
+ *
* @funct onZoomChange
* @static
*
@@ -693,7 +693,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
};
/*
* Creates map events based on mouse position
- *
+ *
*
* @method createMousePosSel
* @static
@@ -722,7 +722,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
// var timer = null;
// var isIntervalSet = false;
-
+
$map = $("#" + map.getTarget());
map = map || self.selected;
mapId = 'coords-' + proj.id;
@@ -839,7 +839,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
if( self.mapIsbeingDragged || wv.util.browser.small) {
return;
}
- if(models.naturalEvents.active || models.data.active) {
+ if(typeof models.naturalEvents == 'undefined' || models.naturalEvents.active || models.data.active) {
return;
}
if( models.anim ) {
@@ -870,7 +870,7 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
};
/*
- * Setting a zoom action
+ * Setting a zoom action
*
* @function zoomAction
* @static
@@ -896,4 +896,3 @@ wv.map.ui = wv.map.ui || function(models, config, components) {
return self;
};
-