Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Changed descriptions to be added on reset, which is called on init

ZachTRiceb2a8137ca468
diff --git a/web/js/layers/wv.layers.model.js b/web/js/layers/wv.layers.model.js
index dc851e8aa..4af7fe343 100644
--- a/web/js/layers/wv.layers.model.js
+++ b/web/js/layers/wv.layers.model.js
@@ -29,11 +29,11 @@ wv.layers.model = wv.layers.model || function(models, config) {
var init = function() {
self.reset();
- self.addDescriptions();
};
self.reset = function() {
self.clear();
+ self.addDescriptions();
if ( config.defaults && config.defaults.startingLayers ) {
_.each(config.defaults.startingLayers, function(start) {
self.add(start.id, start);
@@ -41,6 +41,24 @@ wv.layers.model = wv.layers.model || function(models, config) {
}
};
+ self.addDescriptions = function() {
+ var thisSetting;
+ var description;
+ _.each(config.measurements, function( measurement, measurementKey ) {
+ _.each(measurement.sources, function( source, sourceKey ) {
+ _.each(source.settings, function( setting, settingKey ) {
+ thisSetting = setting;
+ description = source.description;
+ _.each(config.layers, function (layer, layerKey) {
+ if(layer.id == thisSetting) {
+ layer.description = description || "";
+ }
+ });
+ });
+ });
+ });
+ };
+
self.get = function(spec) {
spec = spec || {};
var baselayers = forGroup("baselayers", spec);
@@ -76,24 +94,6 @@ wv.layers.model = wv.layers.model || function(models, config) {
return { title: title, subtitle: subtitle, tags: tags };
};
- self.addDescriptions = function() {
- var thisSetting;
- var description;
- _.each(config.measurements, function( measurement, measurementKey ) {
- _.each(measurement.sources, function( source, sourceKey ) {
- _.each(source.settings, function( setting, settingKey ) {
- thisSetting = setting;
- description = source.description;
- _.each(config.layers, function (layer, layerKey) {
- if(layer.id == thisSetting) {
- layer.description = description || "";
- }
- });
- });
- });
- });
- };
-
self.available = function(id) {
var range = self.dateRange({layer: id});
var date = models.date.selected;