From 9e2a862ba38b69d4019426bc5074a54fad933f25 Mon Sep 17 00:00:00 2001 From: Maarten Terpstra Date: Tue, 30 Jan 2018 13:47:56 +0100 Subject: [PATCH] Unlink the reference_time dimension by default --- webmapjs/WMJSLayer.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/webmapjs/WMJSLayer.js b/webmapjs/WMJSLayer.js index 5c11a68..be68837 100644 --- a/webmapjs/WMJSLayer.js +++ b/webmapjs/WMJSLayer.js @@ -186,10 +186,14 @@ function WMJSLayer (options) { var extents = toArray(jsonlayer.Extent); layer.dimensions = []; for (var j = 0; j < dimensions.length; j++) { - var dim = new WMJSDimension(); + var dim; + if (dimensions[j].attr.name.toLowerCase() === 'reference_time') { + dim = new WMJSDimension({ linked: false }); + } else { + dim = new WMJSDimension(); + } dim.name = dimensions[j].attr.name.toLowerCase(); dim.units = dimensions[j].attr.units; - // WMS 1.1.1 Mode: for (var i = 0; i < extents.length; i++) { if (extents[i].attr.name.toLowerCase() == dim.name) { @@ -222,7 +226,7 @@ function WMJSLayer (options) { if (layer.parentMaps.length > 0) { var mapDim = layer.parentMaps[0].getDimension(dim.name); - if (isDefined(mapDim)) { + if (isDefined(mapDim) && mapDim.linked) { if (isDefined(mapDim.currentValue)) { defaultValue = dim.getClosestValue(mapDim.currentValue); debug('WMJSLayer::configureDimensions Dimension ' + dim.name + ' default value [' + defaultValue + '] is based on map value [' + mapDim.currentValue + ']');