@opengeoweb/webmap 4.17.0 → 4.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { debounce, throttle } from 'throttle-debounce';
2
2
  import { compact } from 'lodash';
3
+ import { dateUtils } from '@opengeoweb/shared';
3
4
  import moment from 'moment';
4
5
  import proj4 from 'proj4';
5
6
 
@@ -248,7 +249,9 @@ var debug = function debug(type, message) {
248
249
  */
249
250
 
250
251
  var isDefined = function isDefined(variable) {
251
- if (variable === null) return false;
252
+ if (variable === null) {
253
+ return false;
254
+ }
252
255
 
253
256
  if (typeof variable === 'undefined') {
254
257
  return false;
@@ -263,7 +266,9 @@ var isDefined = function isDefined(variable) {
263
266
  */
264
267
 
265
268
  var toArray = function toArray(array) {
266
- if (array === null || typeof array === 'undefined') return [];
269
+ if (array === null || typeof array === 'undefined') {
270
+ return [];
271
+ }
267
272
 
268
273
  if (array instanceof Array) {
269
274
  return array;
@@ -281,7 +286,10 @@ var toArray = function toArray(array) {
281
286
  */
282
287
 
283
288
  var WMJScheckURL = function WMJScheckURL(url) {
284
- if (!isDefined(url)) return '?';
289
+ if (!isDefined(url)) {
290
+ return '?';
291
+ }
292
+
285
293
  var trimmedUrl = url.trim();
286
294
 
287
295
  if (trimmedUrl.indexOf('?') === -1) {
@@ -308,14 +316,26 @@ var getMouseYCoordinate = function getMouseYCoordinate(event) {
308
316
  return event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
309
317
  };
310
318
  var URLDecode = function URLDecode(encodedURL) {
311
- if (!isDefined(encodedURL)) return '';
319
+ if (!isDefined(encodedURL)) {
320
+ return '';
321
+ }
322
+
312
323
  return encodedURL.replace('+', ' ').replace('%2B', '+').replace('%20', ' ').replace('%5E', '^').replace('%26', '&').replace('%3F', '?').replace('%3E', '>').replace('%3C', '<').replace('%5C', '\\').replace('%2F', '/').replace('%25', '%').replace('%3A', ':').replace('%27', "'").replace('%24', '$');
313
324
  }; // Encodes plain text to URL encoding
314
325
 
315
326
  var URLEncode = function URLEncode(plaintext) {
316
- if (!plaintext) return plaintext;
317
- if (plaintext === undefined) return plaintext;
318
- if (plaintext === '') return plaintext;
327
+ if (!plaintext) {
328
+ return plaintext;
329
+ }
330
+
331
+ if (plaintext === undefined) {
332
+ return plaintext;
333
+ }
334
+
335
+ if (plaintext === '') {
336
+ return plaintext;
337
+ }
338
+
319
339
  var SAFECHARS = '0123456789' + // Numeric
320
340
  'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + // Alphabetic
321
341
  'abcdefghijklmnopqrstuvwxyz' + "%-_.!~*'()"; // RFC2396 Mark characters
@@ -354,8 +374,15 @@ var URLEncode = function URLEncode(plaintext) {
354
374
  var getCorrectWMSDimName = function getCorrectWMSDimName(origDimName) {
355
375
  /* Adds DIM_ for dimensions other than height or time */
356
376
  var upperCaseDimName = origDimName.toUpperCase();
357
- if (upperCaseDimName === 'TIME') return upperCaseDimName;
358
- if (upperCaseDimName === 'ELEVATION') return upperCaseDimName;
377
+
378
+ if (upperCaseDimName === 'TIME') {
379
+ return upperCaseDimName;
380
+ }
381
+
382
+ if (upperCaseDimName === 'ELEVATION') {
383
+ return upperCaseDimName;
384
+ }
385
+
359
386
  return "DIM_".concat(upperCaseDimName);
360
387
  };
361
388
  /* Returns all dimensions with its current values as URL */
@@ -465,7 +492,10 @@ var dateToISO8601 = function dateToISO8601(date) {
465
492
 
466
493
  var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS) {
467
494
  /* Get the Style object */
468
- if (!layerObjectFromWMS.Style) return [];
495
+ if (!layerObjectFromWMS.Style) {
496
+ return [];
497
+ }
498
+
469
499
  var layerStyles = toArray(layerObjectFromWMS.Style);
470
500
  /* Loop through the list of styles from the document, create a default object and try to fill in the object with the props from the WMS GetCapabilities document */
471
501
 
@@ -505,7 +535,10 @@ var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS) {
505
535
  });
506
536
  };
507
537
  var addDimensionsForLayer = function addDimensionsForLayer(layerObjectFromWMS) {
508
- if (!layerObjectFromWMS.Dimension) return [];
538
+ if (!layerObjectFromWMS.Dimension) {
539
+ return [];
540
+ }
541
+
509
542
  var layerDimensions = toArray(layerObjectFromWMS.Dimension);
510
543
  var layerDimensionsExtents = toArray(layerObjectFromWMS.Extent);
511
544
  var dimensionList = layerDimensions.map(function (layerDimension) {
@@ -566,10 +599,19 @@ function sortArrayOfObjectsByKey(array, key) {
566
599
  var spreadArray = _toConsumableArray(array);
567
600
 
568
601
  return spreadArray.sort(function (a, b) {
569
- var x = a[key];
602
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
603
+ var x = a[key]; // eslint-disable-next-line @typescript-eslint/no-explicit-any
604
+
570
605
  var y = b[key];
571
- if (x < y) return -1;
572
- if (x > y) return 1;
606
+
607
+ if (x < y) {
608
+ return -1;
609
+ }
610
+
611
+ if (x > y) {
612
+ return 1;
613
+ }
614
+
573
615
  return 0;
574
616
  });
575
617
  }
@@ -784,7 +826,10 @@ var WMImage = /*#__PURE__*/function () {
784
826
  }, {
785
827
  key: "isLoaded",
786
828
  value: function isLoaded() {
787
- if (this._isLoading) return false;
829
+ if (this._isLoading) {
830
+ return false;
831
+ }
832
+
788
833
  return this._isLoaded;
789
834
  }
790
835
  /**
@@ -887,7 +932,8 @@ var WMImage = /*#__PURE__*/function () {
887
932
  this._srcLoaded = undefined;
888
933
 
889
934
  this._load();
890
- }
935
+ } // eslint-disable-next-line @typescript-eslint/no-explicit-any
936
+
891
937
  }, {
892
938
  key: "_getImageWithHeaders",
893
939
  value: function _getImageWithHeaders(url, headers) {
@@ -1314,7 +1360,10 @@ var WMBBOX = /*#__PURE__*/function () {
1314
1360
  try {
1315
1361
  var _a = left.split(',');
1316
1362
 
1317
- if (_a.length !== 4) return;
1363
+ if (_a.length !== 4) {
1364
+ return;
1365
+ }
1366
+
1318
1367
  this.left = parseFloat(_a[0]);
1319
1368
  this.bottom = parseFloat(_a[1]);
1320
1369
  this.right = parseFloat(_a[2]);
@@ -1327,10 +1376,21 @@ var WMBBOX = /*#__PURE__*/function () {
1327
1376
  /* Apply defaults to invalid values */
1328
1377
 
1329
1378
 
1330
- if (this.left == null) this.left = -180;
1331
- if (this.right == null) this.right = 180;
1332
- if (this.bottom == null) this.bottom = -90;
1333
- if (this.top == null) this.top = 90;
1379
+ if (this.left == null) {
1380
+ this.left = -180;
1381
+ }
1382
+
1383
+ if (this.right == null) {
1384
+ this.right = 180;
1385
+ }
1386
+
1387
+ if (this.bottom == null) {
1388
+ this.bottom = -90;
1389
+ }
1390
+
1391
+ if (this.top == null) {
1392
+ this.top = 90;
1393
+ }
1334
1394
  }
1335
1395
  /*
1336
1396
  * Compares two boundingboxes and returns true if they are equal
@@ -1451,11 +1511,13 @@ var WMListener = /*#__PURE__*/function () {
1451
1511
  }, {
1452
1512
  key: "suspendEvent",
1453
1513
  value: function suspendEvent(name) {
1514
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1454
1515
  this._suspendedEvents[name] = true;
1455
1516
  }
1456
1517
  }, {
1457
1518
  key: "resumeEvent",
1458
1519
  value: function resumeEvent(name) {
1520
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1459
1521
  this._suspendedEvents[name] = false;
1460
1522
  }
1461
1523
  }, {
@@ -1472,7 +1534,8 @@ var WMListener = /*#__PURE__*/function () {
1472
1534
  }, {
1473
1535
  key: "triggerEvent",
1474
1536
  value: function triggerEvent(name, param) {
1475
- if (this._allEventsSuspended === true || this._suspendedEvents[name] === true) {
1537
+ if (this._allEventsSuspended === true || // eslint-disable-next-line @typescript-eslint/no-explicit-any
1538
+ this._suspendedEvents[name] === true) {
1476
1539
  return [];
1477
1540
  }
1478
1541
 
@@ -1655,7 +1718,10 @@ _bbox) {
1655
1718
  var cachedImage = imageStore.getImageForSrc(altImage.imageSource);
1656
1719
  return cachedImage && cachedImage.isLoaded() && !cachedImage.isLoading() && !cachedImage.hasError();
1657
1720
  });
1658
- if (index !== -1) return sortedImagesForUrl[index];
1721
+
1722
+ if (index !== -1) {
1723
+ return sortedImagesForUrl[index];
1724
+ }
1659
1725
  }
1660
1726
 
1661
1727
  return null;
@@ -1875,7 +1941,10 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
1875
1941
  }, {
1876
1942
  key: "finishedLoading",
1877
1943
  value: function finishedLoading() {
1878
- if (this.ready) return;
1944
+ if (this.ready) {
1945
+ return;
1946
+ }
1947
+
1879
1948
  this.ready = true;
1880
1949
 
1881
1950
  for (var j = 0; j < this.layers.length; j += 1) {
@@ -1899,7 +1968,11 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
1899
1968
  value: function resize(w, h) {
1900
1969
  var width = parseInt(w, 10);
1901
1970
  var height = parseInt(h, 10);
1902
- if (this._width === width && this._height === height) return;
1971
+
1972
+ if (this._width === width && this._height === height) {
1973
+ return;
1974
+ }
1975
+
1903
1976
  this._width = width;
1904
1977
  this._height = height;
1905
1978
  this.canvas.width = width;
@@ -2028,7 +2101,10 @@ var WMJSAnimate = /*#__PURE__*/function () {
2028
2101
  _map.isAnimating = false;
2029
2102
 
2030
2103
  _map.setAnimationDelay = function (delay) {
2031
- if (delay < 1) delay = 1;
2104
+ if (delay < 1) {
2105
+ delay = 1;
2106
+ }
2107
+
2032
2108
  _map.animationDelay = delay;
2033
2109
  };
2034
2110
 
@@ -2058,8 +2134,8 @@ var WMJSAnimate = /*#__PURE__*/function () {
2058
2134
  }
2059
2135
 
2060
2136
  _createClass(WMJSAnimate, [{
2061
- key: "_isCurrentAnimationTimeCloseToWallClockTime",
2062
- value: function _isCurrentAnimationTimeCloseToWallClockTime() {
2137
+ key: "isCurrentAnimationTimeCloseToWallClockTime",
2138
+ value: function isCurrentAnimationTimeCloseToWallClockTime() {
2063
2139
  if (this.isNextTimeCloseToWallClockTime) {
2064
2140
  this.isNextTimeCloseToWallClockTime = false;
2065
2141
  return true;
@@ -2067,13 +2143,13 @@ var WMJSAnimate = /*#__PURE__*/function () {
2067
2143
 
2068
2144
  var currentAnimationStep = this._map.animationList[this._map.currentAnimationStep];
2069
2145
  var nextAnimationStep = this._map.animationList[this._map.currentAnimationStep + 1 >= this._map.animationList.length ? 0 : this._map.currentAnimationStep + 1];
2070
- var wallClockTime = moment.utc();
2071
- var currentAnimationTime = moment.utc(currentAnimationStep.value);
2072
- var nextAnimationTime = moment.utc(nextAnimationStep.value);
2146
+ var wallClockTime = new Date();
2147
+ var currentAnimationTime = new Date(currentAnimationStep.value);
2148
+ var nextAnimationTime = new Date(nextAnimationStep.value);
2073
2149
 
2074
- if (wallClockTime.isBetween(currentAnimationTime, nextAnimationTime, undefined, '[)')) {
2075
- var timeDiff1 = moment.duration(currentAnimationTime.clone().diff(wallClockTime)).asMinutes();
2076
- var timeDiff2 = moment.duration(nextAnimationTime.clone().diff(wallClockTime)).asMinutes();
2150
+ if (dateUtils.isBetween(wallClockTime, currentAnimationTime, nextAnimationTime)) {
2151
+ var timeDiff1 = dateUtils.differenceInMinutes(currentAnimationTime, wallClockTime);
2152
+ var timeDiff2 = dateUtils.differenceInMinutes(nextAnimationTime, wallClockTime);
2077
2153
 
2078
2154
  if (Math.abs(timeDiff1) < Math.abs(timeDiff2)) {
2079
2155
  // Wall clock time is closer to current animation step time than to the next animation step time
@@ -2090,8 +2166,14 @@ var WMJSAnimate = /*#__PURE__*/function () {
2090
2166
  }, {
2091
2167
  key: "_animate",
2092
2168
  value: function _animate() {
2093
- if (this._map.isAnimating === false) return;
2094
- if (this._map.animateBusy === true) return;
2169
+ if (this._map.isAnimating === false) {
2170
+ return;
2171
+ }
2172
+
2173
+ if (this._map.animateBusy === true) {
2174
+ return;
2175
+ }
2176
+
2095
2177
  var animationStep = this._map.animationList[this._map.currentAnimationStep];
2096
2178
 
2097
2179
  if (!animationStep) {
@@ -2123,7 +2205,7 @@ var WMJSAnimate = /*#__PURE__*/function () {
2123
2205
  animationDelay *= 3;
2124
2206
  } else if (this._map.currentAnimationStep === this._map.animationList.length - 1) {
2125
2207
  animationDelay *= 5;
2126
- } else if (this._isCurrentAnimationTimeCloseToWallClockTime()) {
2208
+ } else if (this.isCurrentAnimationTimeCloseToWallClockTime()) {
2127
2209
  animationDelay *= 5;
2128
2210
  }
2129
2211
 
@@ -2212,7 +2294,9 @@ var WMJSAnimate = /*#__PURE__*/function () {
2212
2294
  index -= this._map.animationList.length;
2213
2295
  }
2214
2296
 
2215
- if (index < 0) index = 0;
2297
+ if (index < 0) {
2298
+ index = 0;
2299
+ }
2216
2300
 
2217
2301
  if (index >= 0) {
2218
2302
  var animationStep = this._map.animationList[index];
@@ -2245,7 +2329,10 @@ var WMJSAnimate = /*#__PURE__*/function () {
2245
2329
  }, {
2246
2330
  key: "stopAnimating",
2247
2331
  value: function stopAnimating() {
2248
- if (this._map.isAnimating === false) return;
2332
+ if (this._map.isAnimating === false) {
2333
+ return;
2334
+ }
2335
+
2249
2336
  this._map._animationList = undefined;
2250
2337
  this._divAnimationInfo.style.display = 'none';
2251
2338
  this._map.isAnimating = false;
@@ -2279,9 +2366,18 @@ var WMTileRenderer = /*#__PURE__*/function () {
2279
2366
  /* Temporal mappings from bgmaps.cgi service names to names defined here */
2280
2367
 
2281
2368
 
2282
- if (layerName === 'streetmap') layerName = 'OSM';
2283
- if (layerName === 'pdok') layerName = 'OSM';
2284
- if (layerName === 'naturalearth2') layerName = 'NaturalEarth2';
2369
+ if (layerName === 'streetmap') {
2370
+ layerName = 'OSM';
2371
+ }
2372
+
2373
+ if (layerName === 'pdok') {
2374
+ layerName = 'OSM';
2375
+ }
2376
+
2377
+ if (layerName === 'naturalearth2') {
2378
+ layerName = 'NaturalEarth2';
2379
+ }
2380
+
2285
2381
  var tileLayer = tileOptions[layerName];
2286
2382
 
2287
2383
  if (!tileLayer) {
@@ -2315,10 +2411,23 @@ var WMTileRenderer = /*#__PURE__*/function () {
2315
2411
  var initialResolution = 2 * pi * 6378137 / tileSize;
2316
2412
  var originShiftX = -2 * pi * 6378137 / 2.0;
2317
2413
  var originShiftY = 2 * pi * 6378137 / 2.0;
2318
- if (tileSettings.tileSize) tileSize = tileSettings.tileSize;
2319
- if (tileSettings.resolution) initialResolution = tileSettings.resolution;
2320
- if (tileSettings.origX) originShiftX = tileSettings.origX;
2321
- if (tileSettings.origY) originShiftY = tileSettings.origY;
2414
+
2415
+ if (tileSettings.tileSize) {
2416
+ tileSize = tileSettings.tileSize;
2417
+ }
2418
+
2419
+ if (tileSettings.resolution) {
2420
+ initialResolution = tileSettings.resolution;
2421
+ }
2422
+
2423
+ if (tileSettings.origX) {
2424
+ originShiftX = tileSettings.origX;
2425
+ }
2426
+
2427
+ if (tileSettings.origY) {
2428
+ originShiftY = tileSettings.origY;
2429
+ }
2430
+
2322
2431
  var screenWidth = width;
2323
2432
  var bboxw = currentBBOX.right - currentBBOX.left;
2324
2433
  var originShiftX2 = initialResolution * tileSize + originShiftX;
@@ -2345,8 +2454,14 @@ var WMTileRenderer = /*#__PURE__*/function () {
2345
2454
  var tileServerFormat = tileSettings.tileServerFormat || 'png';
2346
2455
  var tmsEnabled = tileSettings.tms || false; // 'osm' or 'argisonline'
2347
2456
 
2348
- if (level < tileSettings.minLevel) level = tileSettings.minLevel;
2349
- if (level > tileSettings.maxLevel) level = tileSettings.maxLevel;
2457
+ if (level < tileSettings.minLevel) {
2458
+ level = tileSettings.minLevel;
2459
+ }
2460
+
2461
+ if (level > tileSettings.maxLevel) {
2462
+ level = tileSettings.maxLevel;
2463
+ }
2464
+
2350
2465
  var numTilesAtLevel = Math.pow(2, level);
2351
2466
  var numTilesAtLevelX = tileSetWidth / (initialResolution / numTilesAtLevel * tileSize);
2352
2467
  var numTilesAtLevelY = tileSetHeight / (initialResolution / numTilesAtLevel * tileSize);
@@ -2395,7 +2510,7 @@ var WMTileRenderer = /*#__PURE__*/function () {
2395
2510
  x: bounds.right,
2396
2511
  y: bounds.top
2397
2512
  }, newBBOX, width, height);
2398
- var imageURL;
2513
+ var imageURL = '';
2399
2514
 
2400
2515
  if (tileServerType === 'osm') {
2401
2516
  if (tmsEnabled) {
@@ -2458,14 +2573,37 @@ var WMTileRenderer = /*#__PURE__*/function () {
2458
2573
  numTilesAtLevelX *= 2;
2459
2574
  }
2460
2575
 
2461
- if (tilenbottom < 1) tilenbottom = 1;
2462
- if (tilenbottom > numTilesAtLevelY) tilenbottom = numTilesAtLevelY;
2463
- if (tilenleft < 1) tilenleft = 1;
2464
- if (tilenleft > numTilesAtLevelX) tilenleft = numTilesAtLevelX;
2465
- if (tilentop < 1) tilentop = 1;
2466
- if (tilentop > numTilesAtLevelY) tilentop = numTilesAtLevelY;
2467
- if (tilenright < 1) tilenright = 1;
2468
- if (tilenright > numTilesAtLevelX) tilenright = numTilesAtLevelX;
2576
+ if (tilenbottom < 1) {
2577
+ tilenbottom = 1;
2578
+ }
2579
+
2580
+ if (tilenbottom > numTilesAtLevelY) {
2581
+ tilenbottom = numTilesAtLevelY;
2582
+ }
2583
+
2584
+ if (tilenleft < 1) {
2585
+ tilenleft = 1;
2586
+ }
2587
+
2588
+ if (tilenleft > numTilesAtLevelX) {
2589
+ tilenleft = numTilesAtLevelX;
2590
+ }
2591
+
2592
+ if (tilentop < 1) {
2593
+ tilentop = 1;
2594
+ }
2595
+
2596
+ if (tilentop > numTilesAtLevelY) {
2597
+ tilentop = numTilesAtLevelY;
2598
+ }
2599
+
2600
+ if (tilenright < 1) {
2601
+ tilenright = 1;
2602
+ }
2603
+
2604
+ if (tilenright > numTilesAtLevelX) {
2605
+ tilenright = numTilesAtLevelX;
2606
+ }
2469
2607
 
2470
2608
  if (tilentop - tilenbottom > 20) {
2471
2609
  debug(DebugType.Error);
@@ -2486,8 +2624,14 @@ var WMTileRenderer = /*#__PURE__*/function () {
2486
2624
 
2487
2625
  drawBGTiles(level);
2488
2626
  imagesToRender.sort(function (imageA, imageB) {
2489
- if (imageA.level < imageB.level) return -1;
2490
- if (imageA.level > imageB.level) return 1;
2627
+ if (imageA.level < imageB.level) {
2628
+ return -1;
2629
+ }
2630
+
2631
+ if (imageA.level > imageB.level) {
2632
+ return 1;
2633
+ }
2634
+
2491
2635
  return 0;
2492
2636
  });
2493
2637
 
@@ -2537,7 +2681,11 @@ var getLegendGraphicURLForLayer = function getLegendGraphicURLForLayer(layer) {
2537
2681
 
2538
2682
  if (layer) {
2539
2683
  var legendURL = layer.legendGraphic;
2540
- if (!legendURL) return undefined; // For THREDDS WMS we need to add layers=
2684
+
2685
+ if (!legendURL) {
2686
+ return undefined;
2687
+ } // For THREDDS WMS we need to add layers=
2688
+
2541
2689
 
2542
2690
  if (!legendURL.includes('&layers=')) {
2543
2691
  legendURL += "&layers=".concat(URLEncode(layer.name), "&");
@@ -2634,7 +2782,11 @@ var DateInterval = /*#__PURE__*/function () {
2634
2782
  this.minute = parseInt(minute, 10);
2635
2783
  this.second = parseInt(second, 10);
2636
2784
  this.isRegularInterval = false;
2637
- if (this.month === 0 && this.year === 0) this.isRegularInterval = true;
2785
+
2786
+ if (this.month === 0 && this.year === 0) {
2787
+ this.isRegularInterval = true;
2788
+ }
2789
+
2638
2790
  this.getTime = this.getTime.bind(this);
2639
2791
  this.toISO8601 = this.toISO8601.bind(this);
2640
2792
  }
@@ -2646,8 +2798,14 @@ var DateInterval = /*#__PURE__*/function () {
2646
2798
  /* Months and years are unequally distributed in time
2647
2799
  So get time is not possible */
2648
2800
 
2649
- if (this.month !== 0) throw new Error('month !== 0');
2650
- if (this.year !== 0) throw new Error('year !== 0');
2801
+ if (this.month !== 0) {
2802
+ throw new Error('month !== 0');
2803
+ }
2804
+
2805
+ if (this.year !== 0) {
2806
+ throw new Error('year !== 0');
2807
+ }
2808
+
2651
2809
  timeres += this.day * 60 * 60 * 24;
2652
2810
  timeres += this.hour * 60 * 60;
2653
2811
  timeres += this.minute * 60;
@@ -2659,17 +2817,35 @@ var DateInterval = /*#__PURE__*/function () {
2659
2817
  key: "toISO8601",
2660
2818
  value: function toISO8601() {
2661
2819
  var isoTime = 'P';
2662
- if (this.year !== 0) isoTime += "".concat(this.year, "Y");
2663
- if (this.month !== 0) isoTime += "".concat(this.month, "M");
2664
- if (this.day !== 0) isoTime += "".concat(this.day, "D");
2820
+
2821
+ if (this.year !== 0) {
2822
+ isoTime += "".concat(this.year, "Y");
2823
+ }
2824
+
2825
+ if (this.month !== 0) {
2826
+ isoTime += "".concat(this.month, "M");
2827
+ }
2828
+
2829
+ if (this.day !== 0) {
2830
+ isoTime += "".concat(this.day, "D");
2831
+ }
2665
2832
 
2666
2833
  if (this.hour !== 0 && this.minute !== 0 && this.second !== 0) {
2667
2834
  isoTime += 'T';
2668
2835
  }
2669
2836
 
2670
- if (this.hour !== 0) isoTime += "".concat(this.hour, "H");
2671
- if (this.minute !== 0) isoTime += "".concat(this.minute, "M");
2672
- if (this.second !== 0) isoTime += "".concat(this.second, "S");
2837
+ if (this.hour !== 0) {
2838
+ isoTime += "".concat(this.hour, "H");
2839
+ }
2840
+
2841
+ if (this.minute !== 0) {
2842
+ isoTime += "".concat(this.minute, "M");
2843
+ }
2844
+
2845
+ if (this.second !== 0) {
2846
+ isoTime += "".concat(this.second, "S");
2847
+ }
2848
+
2673
2849
  return isoTime;
2674
2850
  }
2675
2851
  }]);
@@ -2721,16 +2897,29 @@ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime)
2721
2897
  */
2722
2898
  var makeISO8601StringFromFlexibleWMSDateString = function makeISO8601StringFromFlexibleWMSDateString(isoString) {
2723
2899
  // Datestring starting with a - token are not supported.
2724
- if (!isoString || isoString.startsWith('-')) return isoString;
2725
- if (isoString.length === 4) return "".concat(isoString, "-01-01T00:00:00Z"); // YYYY
2900
+ if (!isoString || isoString.startsWith('-')) {
2901
+ return isoString;
2902
+ }
2903
+
2904
+ var trimmed = isoString.trim();
2726
2905
 
2727
- if (isoString.length === 7) return "".concat(isoString, "-01T00:00:00Z"); // YYYY-MM
2906
+ if (trimmed.length === 4) {
2907
+ return "".concat(trimmed, "-01-01T00:00:00Z"); // YYYY
2908
+ }
2909
+
2910
+ if (trimmed.length === 7) {
2911
+ return "".concat(trimmed, "-01T00:00:00Z"); // YYYY-MM
2912
+ }
2728
2913
 
2729
- if (isoString.length === 10) return "".concat(isoString, "T00:00:00Z"); // YYYY-MM-DD
2914
+ if (trimmed.length === 10) {
2915
+ return "".concat(trimmed, "T00:00:00Z"); // YYYY-MM-DD
2916
+ }
2730
2917
 
2731
- if (isoString.length === 14) return "".concat(isoString.slice(0, -1), ":00:00Z"); // YYYY-MM-DDTHHZ
2918
+ if (trimmed.length === 14) {
2919
+ return "".concat(trimmed.slice(0, -1), ":00:00Z"); // YYYY-MM-DDTHHZ
2920
+ }
2732
2921
 
2733
- return isoString;
2922
+ return trimmed;
2734
2923
  };
2735
2924
 
2736
2925
  var isotime = makeISO8601StringFromFlexibleWMSDateString(unvalidatedIsotime);
@@ -2752,7 +2941,9 @@ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime)
2752
2941
  var date = new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds));
2753
2942
 
2754
2943
  date.add = function (dateInterval) {
2755
- if (!dateInterval) return;
2944
+ if (!dateInterval) {
2945
+ return;
2946
+ }
2756
2947
 
2757
2948
  if (dateInterval.isRegularInterval === false) {
2758
2949
  if (dateInterval.year !== 0) {
@@ -2784,7 +2975,9 @@ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime)
2784
2975
  };
2785
2976
 
2786
2977
  date.substract = function (dateInterval) {
2787
- if (!dateInterval) return;
2978
+ if (!dateInterval) {
2979
+ return;
2980
+ }
2788
2981
 
2789
2982
  if (dateInterval.isRegularInterval === false) {
2790
2983
  if (dateInterval.year !== 0) {
@@ -2816,7 +3009,9 @@ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime)
2816
3009
  };
2817
3010
 
2818
3011
  date.addMultipleTimes = function (dateInterval, numberOfSteps) {
2819
- if (!dateInterval) return;
3012
+ if (!dateInterval) {
3013
+ return;
3014
+ }
2820
3015
 
2821
3016
  if (dateInterval.isRegularInterval === false) {
2822
3017
  if (dateInterval.year !== 0) {
@@ -2848,7 +3043,9 @@ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime)
2848
3043
  };
2849
3044
 
2850
3045
  date.substractMultipleTimes = function (dateInterval, numberOfSteps) {
2851
- if (!dateInterval) return;
3046
+ if (!dateInterval) {
3047
+ return;
3048
+ }
2852
3049
 
2853
3050
  if (dateInterval.isRegularInterval === false) {
2854
3051
  if (dateInterval.year !== 0) {
@@ -2911,8 +3108,17 @@ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime)
2911
3108
 
2912
3109
  /** ****************************************************** */
2913
3110
 
2914
- var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInterval(isotime) {
2915
- if (!isotime || isotime.charAt(0) !== 'P') return undefined;
3111
+ var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInterval(_isotime) {
3112
+ if (!_isotime) {
3113
+ return undefined;
3114
+ }
3115
+
3116
+ var isotime = _isotime.trim();
3117
+
3118
+ if (isotime.charAt(0) !== 'P') {
3119
+ return undefined;
3120
+ }
3121
+
2916
3122
  var splittedOnT = isotime.split('T');
2917
3123
  var years = '0';
2918
3124
  var months = '0';
@@ -2937,7 +3143,11 @@ var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInte
2937
3143
 
2938
3144
  if (dayIndex !== -1) {
2939
3145
  var start = yearIndex;
2940
- if (monthIndex !== -1) start = monthIndex;
3146
+
3147
+ if (monthIndex !== -1) {
3148
+ start = monthIndex;
3149
+ }
3150
+
2941
3151
  days = YYYYMMDDPart.substring(start + 1, dayIndex);
2942
3152
  }
2943
3153
  } // parse the right part
@@ -2962,7 +3172,11 @@ var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInte
2962
3172
 
2963
3173
  if (secondIndex !== -1) {
2964
3174
  var _start = hourIndex;
2965
- if (minuteIndex !== -1) _start = minuteIndex;
3175
+
3176
+ if (minuteIndex !== -1) {
3177
+ _start = minuteIndex;
3178
+ }
3179
+
2966
3180
  seconds = HHMMSSPart.substring(_start + 1, secondIndex);
2967
3181
  }
2968
3182
  }
@@ -2980,7 +3194,10 @@ var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInte
2980
3194
  /** ******************************************************* */
2981
3195
 
2982
3196
  function getNumberOfTimeSteps(starttime, stoptime, interval) {
2983
- if (!starttime || !stoptime || !interval) return undefined;
3197
+ if (!starttime || !stoptime || !interval) {
3198
+ return undefined;
3199
+ }
3200
+
2984
3201
  var steps = 0;
2985
3202
 
2986
3203
  if (interval.month !== 0 || interval.year !== 0) {
@@ -3011,7 +3228,9 @@ var ParseISOTimeRangeDuration = /*#__PURE__*/function () {
3011
3228
  this.initialized = false;
3012
3229
  var times = isoTimeRangeDuration.split('/'); // Some safety checks
3013
3230
 
3014
- if (times[2] === undefined) times[2] = 'PT1M';
3231
+ if (times[2] === undefined) {
3232
+ times[2] = 'PT1M';
3233
+ }
3015
3234
 
3016
3235
  if (times[1] === undefined) {
3017
3236
  // eslint-disable-next-line prefer-destructuring
@@ -3122,7 +3341,10 @@ var ParseISOTimeRangeDuration = /*#__PURE__*/function () {
3122
3341
  return this.timeSteps - 1;
3123
3342
  }
3124
3343
 
3125
- if (currentDateTime > this.stopTime.getTime()) return this.timeSteps - 1;
3344
+ if (currentDateTime > this.stopTime.getTime()) {
3345
+ return this.timeSteps - 1;
3346
+ }
3347
+
3126
3348
  var timeStep = 0;
3127
3349
 
3128
3350
  if (this.timeInterval.isRegularInterval === false) {
@@ -3305,28 +3527,32 @@ var WMJSDimension = /*#__PURE__*/function () {
3305
3527
  /* 1. Get the last value in the list of the referencetime */
3306
3528
 
3307
3529
 
3308
- var lastRefTimeAsMoment = moment.utc(referenceTimeDim.getLastValue());
3530
+ var lastRefTime = new Date(referenceTimeDim.getLastValue());
3309
3531
  /* 2. Get the original last value of the time dimension, we cannot use this.getLastValue(), as we are changing this. */
3310
3532
 
3311
- var timeLastValueAsMoment = moment.utc(this.values.split('/')[1]);
3533
+ var orgLastDimTime = new Date(this.values.split('/')[1]);
3312
3534
  /* 3. Now calculate the run length */
3313
3535
 
3314
- var runLengthAsHour = moment.duration(timeLastValueAsMoment.clone().diff(lastRefTimeAsMoment)).asHours();
3315
- var newStartValueTimeAsMoment = moment.utc(referenceTimeValueToSet);
3316
- var newEndValueTimeAsMoment = newStartValueTimeAsMoment.clone().add(runLengthAsHour, 'h');
3536
+ var runLengthAsHour = dateUtils.differenceInHours(orgLastDimTime, lastRefTime);
3537
+ var newStartValueTime = new Date(referenceTimeValueToSet);
3538
+ var newEndValueTime = dateUtils.add(new Date(newStartValueTime.getTime()), {
3539
+ hours: runLengthAsHour
3540
+ });
3317
3541
 
3318
3542
  if (this._type === 'timestartstopres') {
3319
3543
  /* Compose a new dataString interval and re-initialize the time dimension */
3320
- var dateStringItems = this.values.split('/');
3544
+ var dateStringItems = this.values.split('/').map(function (value) {
3545
+ return value.trim();
3546
+ });
3321
3547
  var dateStringInterval = dateStringItems[2];
3322
- var newValue = "".concat(newStartValueTimeAsMoment.toISOString(), "/").concat(newEndValueTimeAsMoment.toISOString(), "/").concat(dateStringInterval);
3323
- this.defaultValue = newEndValueTimeAsMoment.toISOString();
3548
+ var newValue = "".concat(newStartValueTime.toISOString(), "/").concat(newEndValueTime.toISOString(), "/").concat(dateStringInterval);
3549
+ this.defaultValue = newEndValueTime.toISOString();
3324
3550
  this.reInitializeValues(newValue, true);
3325
3551
  } else if (this._type === 'timevalues') {
3326
3552
  /* Filter all dates from the array which are lower than given start value */
3327
3553
 
3328
3554
  /* TODO: Maarten Plieger 2020-06-10: Make this also work for WMS times advertised as a comma separated list */
3329
- var _newValue2 = parseISO8601DateToDate(newStartValueTimeAsMoment.toISOString());
3555
+ var _newValue2 = parseISO8601DateToDate(newStartValueTime.toISOString());
3330
3556
 
3331
3557
  var newArray = this._allDates.filter(function (x) {
3332
3558
  return x >= _newValue2;
@@ -3335,7 +3561,10 @@ var WMJSDimension = /*#__PURE__*/function () {
3335
3561
  var newValues = '';
3336
3562
 
3337
3563
  for (var j = 0; j < newArray.length; j += 1) {
3338
- if (j > 0) newValues += ',';
3564
+ if (j > 0) {
3565
+ newValues += ',';
3566
+ }
3567
+
3339
3568
  newValues += newArray[j].toISO8601();
3340
3569
  }
3341
3570
 
@@ -3355,14 +3584,21 @@ var WMJSDimension = /*#__PURE__*/function () {
3355
3584
  value: function initialize() {
3356
3585
  var forceothervalues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
3357
3586
  var forceReferenceTimeValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3358
- if (this._initialized === true) return;
3587
+
3588
+ if (this._initialized === true) {
3589
+ return;
3590
+ }
3591
+
3359
3592
  var ogcdimvalues = this.values;
3360
3593
 
3361
3594
  if (forceothervalues) {
3362
3595
  ogcdimvalues = forceothervalues;
3363
3596
  }
3364
3597
 
3365
- if (!isDefined(ogcdimvalues)) return;
3598
+ if (!isDefined(ogcdimvalues)) {
3599
+ return;
3600
+ }
3601
+
3366
3602
  this._allValues = [];
3367
3603
  this._initialized = true;
3368
3604
 
@@ -3383,10 +3619,14 @@ var WMJSDimension = /*#__PURE__*/function () {
3383
3619
  var values = ogcdimvalues.split(',');
3384
3620
 
3385
3621
  for (var j = 0; j < values.length; j += 1) {
3386
- var valuesRanged = values[j].split('/');
3622
+ var valuesRangedNoTrim = values[j].split('/');
3387
3623
 
3388
- if (valuesRanged.length === 3) {
3624
+ if (valuesRangedNoTrim.length === 3) {
3625
+ var valuesRanged = valuesRangedNoTrim.map(function (value) {
3626
+ return value.trim();
3627
+ });
3389
3628
  /* Can be either time like '2021-03-17T06:00:00Z/2021-03-21T00:00:00Z/PT6H' or something else, like '0/24/2' */
3629
+
3390
3630
  if (valuesRanged[2].charAt(0) === 'P') {
3391
3631
  var partTimeRanges = new ParseISOTimeRangeDuration(values[j]);
3392
3632
 
@@ -3404,8 +3644,14 @@ var WMJSDimension = /*#__PURE__*/function () {
3404
3644
  var stop = parseFloat(valuesRanged[1]);
3405
3645
  var res = parseFloat(valuesRanged[2]);
3406
3646
  stop += res;
3407
- if (start > stop) stop = start;
3408
- if (res <= 0) res = 1;
3647
+
3648
+ if (start > stop) {
3649
+ stop = start;
3650
+ }
3651
+
3652
+ if (res <= 0) {
3653
+ res = 1;
3654
+ }
3409
3655
 
3410
3656
  for (var j2 = start; j2 < stop; j2 += res) {
3411
3657
  this._allValues.push(String(j2));
@@ -3424,26 +3670,39 @@ var WMJSDimension = /*#__PURE__*/function () {
3424
3670
  }
3425
3671
  }
3426
3672
  }
3673
+ /* If no default value is given, take the last / most recent one */
3674
+
3427
3675
 
3428
- if (!isDefined(this.defaultValue)) {
3429
- this.defaultValue = this.getValueForIndex(0);
3676
+ if (!isDefined(this.defaultValue) || this.defaultValue === '') {
3677
+ this.defaultValue = this.getLastValue();
3678
+ }
3679
+ /* Check if the string 'current' is given, and find the closest value inside the dimension */
3680
+
3681
+
3682
+ if (this.defaultValue === 'current') {
3683
+ this.defaultValue = this.getClosestValue(moment().utc().format('YYYY-MM-DDTHH:mm:ss[Z]'), true);
3430
3684
  }
3431
3685
  /* If no currentvalue is set, set the default */
3432
3686
 
3433
3687
 
3434
- if (!isDefined(this.currentValue)) {
3435
- this.currentValue = this.getFirstValue();
3688
+ if (!this.currentValue || this.currentValue.length === 0) {
3689
+ this.currentValue = this.defaultValue;
3436
3690
  }
3437
3691
  /* Check for out of range values and adjust accordingly to a valid range */
3438
3692
 
3439
3693
 
3440
3694
  var index = this.getIndexForValue(this.currentValue);
3441
- if (index === -2) this.currentValue = this.getLastValue(); // Date is past the latest (-2), so set it to the last value
3442
3695
 
3443
- if (index === -1) this.currentValue = this.getFirstValue(); // Date is past the first (-1), so set it to the first value
3696
+ if (index === -2) {
3697
+ this.currentValue = this.getLastValue(); // Date is past the latest (-2), so set it to the last value
3698
+ }
3444
3699
 
3700
+ if (index === -1) {
3701
+ this.currentValue = this.getFirstValue(); // Date is past the first (-1), so set it to the first value
3702
+ }
3445
3703
  /* In case of reference time, the time dimension range is changed, check if the current time still fits in that range */
3446
3704
 
3705
+
3447
3706
  if (forceReferenceTimeValue) {
3448
3707
  if (this.getIndexForValue(this.currentValue, true) < 0) {
3449
3708
  this.currentValue = this.getClosestValue(this.currentValue);
@@ -3590,7 +3849,11 @@ var WMJSDimension = /*#__PURE__*/function () {
3590
3849
 
3591
3850
  if (newValue === 'middle') {
3592
3851
  var middleIndex = Math.ceil(this.size() / 2) - 1;
3593
- if (middleIndex < 0) middleIndex = 0;
3852
+
3853
+ if (middleIndex < 0) {
3854
+ middleIndex = 0;
3855
+ }
3856
+
3594
3857
  return this.getValueForIndex(middleIndex);
3595
3858
  }
3596
3859
 
@@ -3610,7 +3873,11 @@ var WMJSDimension = /*#__PURE__*/function () {
3610
3873
  value = this.getValueForIndex(index);
3611
3874
  } catch (e) {
3612
3875
  if (typeof e.message === 'number') {
3613
- if (e.message === 0) value = WMDateTooEarlyString;else value = WMDateTooLateString;
3876
+ if (e.message === 0) {
3877
+ value = WMDateTooEarlyString;
3878
+ } else {
3879
+ value = WMDateTooLateString;
3880
+ }
3614
3881
  }
3615
3882
  }
3616
3883
 
@@ -3652,8 +3919,14 @@ var WMJSDimension = /*#__PURE__*/function () {
3652
3919
  return this._timeRangeDurationDate.getDateAtTimeStep(index);
3653
3920
  }
3654
3921
 
3655
- if (this._type === 'timevalues') return this._allValues[index];
3656
- if (this._type === 'anyvalue') return this._allValues[index];
3922
+ if (this._type === 'timevalues') {
3923
+ return this._allValues[index];
3924
+ }
3925
+
3926
+ if (this._type === 'anyvalue') {
3927
+ return this._allValues[index];
3928
+ }
3929
+
3657
3930
  return null;
3658
3931
  }
3659
3932
  /**
@@ -3665,7 +3938,11 @@ var WMJSDimension = /*#__PURE__*/function () {
3665
3938
  key: "getDimInterval",
3666
3939
  value: function getDimInterval() {
3667
3940
  this.initialize();
3668
- if (!this.dimTimeInterval) return undefined;
3941
+
3942
+ if (!this.dimTimeInterval) {
3943
+ return undefined;
3944
+ }
3945
+
3669
3946
  var _this$dimTimeInterval = this.dimTimeInterval,
3670
3947
  year = _this$dimTimeInterval.year,
3671
3948
  month = _this$dimTimeInterval.month,
@@ -3739,7 +4016,10 @@ var WMJSDimension = /*#__PURE__*/function () {
3739
4016
 
3740
4017
  return this._timeRangeDurationDate.getTimeStepFromDate(value, outSideOfRangeFlag);
3741
4018
  } catch (e) {
3742
- if (parseInt(e.message, 10) === 0) return -1;
4019
+ if (parseInt(e.message, 10) === 0) {
4020
+ return -1;
4021
+ }
4022
+
3743
4023
  return -2;
3744
4024
  }
3745
4025
  }
@@ -3747,7 +4027,7 @@ var WMJSDimension = /*#__PURE__*/function () {
3747
4027
  if (this._type === 'timevalues') {
3748
4028
  try {
3749
4029
  var dateToFind = parseISO8601DateToDate(value).getTime();
3750
- var minDistance;
4030
+ var minDistance = null;
3751
4031
  var foundIndex = 0;
3752
4032
  var minTime = null;
3753
4033
  var maxTime = null;
@@ -3755,11 +4035,23 @@ var WMJSDimension = /*#__PURE__*/function () {
3755
4035
  for (var j = 0; j < this._allValues.length; j += 1) {
3756
4036
  var time = this._allDates[j].getTime();
3757
4037
 
3758
- if (time < minTime || minTime === null) minTime = time;
3759
- if (time > maxTime || maxTime === null) maxTime = time;
4038
+ if (time < minTime || minTime === null) {
4039
+ minTime = time;
4040
+ }
4041
+
4042
+ if (time > maxTime || maxTime === null) {
4043
+ maxTime = time;
4044
+ }
4045
+
3760
4046
  var distance = time - dateToFind;
3761
- if (distance < 0) distance = -distance;
3762
- if (j === 0) minDistance = distance;
4047
+
4048
+ if (distance < 0) {
4049
+ distance = -distance;
4050
+ }
4051
+
4052
+ if (j === 0) {
4053
+ minDistance = distance;
4054
+ }
3763
4055
 
3764
4056
  if (distance < minDistance) {
3765
4057
  minDistance = distance;
@@ -3768,8 +4060,13 @@ var WMJSDimension = /*#__PURE__*/function () {
3768
4060
  }
3769
4061
 
3770
4062
  if (outSideOfRangeFlag) {
3771
- if (minTime > dateToFind) return -1;
3772
- if (maxTime < dateToFind) return -2;
4063
+ if (minTime > dateToFind) {
4064
+ return -1;
4065
+ }
4066
+
4067
+ if (maxTime < dateToFind) {
4068
+ return -2;
4069
+ }
3773
4070
  }
3774
4071
 
3775
4072
  return foundIndex;
@@ -3781,7 +4078,9 @@ var WMJSDimension = /*#__PURE__*/function () {
3781
4078
 
3782
4079
  if (this._type === 'anyvalue') {
3783
4080
  for (var _j2 = 0; _j2 < this._allValues.length; _j2 += 1) {
3784
- if (this._allValues[_j2] === value) return _j2;
4081
+ if (this._allValues[_j2] === value) {
4082
+ return _j2;
4083
+ }
3785
4084
  }
3786
4085
  }
3787
4086
 
@@ -3892,7 +4191,9 @@ var MapPin = /*#__PURE__*/function () {
3892
4191
  };
3893
4192
 
3894
4193
  this.repositionMapPin = function (_bbox) {
3895
- if (!_bbox) return;
4194
+ if (!_bbox) {
4195
+ return;
4196
+ }
3896
4197
 
3897
4198
  var newpos = _this._map.getPixelCoordFromGeoCoord({
3898
4199
  x: _this.geoPosX,
@@ -3905,8 +4206,14 @@ var MapPin = /*#__PURE__*/function () {
3905
4206
  this.setMapPin = function (_x, _y, _bbox) {
3906
4207
  var x = _x;
3907
4208
  var y = _y;
3908
- if (!x || !y) return;
3909
- if (_this.disableMapPin && !_bbox) return; // we still want to update the pin position when the bbox changes.
4209
+
4210
+ if (!x || !y) {
4211
+ return;
4212
+ }
4213
+
4214
+ if (_this.disableMapPin && !_bbox) {
4215
+ return; // we still want to update the pin position when the bbox changes.
4216
+ }
3910
4217
 
3911
4218
  _this.x = parseInt(x, 10);
3912
4219
  _this.y = parseInt(y, 10);
@@ -4021,10 +4328,12 @@ var getBBOXandProjString = function getBBOXandProjString(map, layer) {
4021
4328
  }; // Build a valid WMS request for a certain layer
4022
4329
 
4023
4330
  var buildWMSGetMapRequest = function buildWMSGetMapRequest(map, layer) {
4024
- if (!isDefined(layer.name)) return {
4025
- url: undefined,
4026
- headers: null
4027
- };
4331
+ if (!isDefined(layer.name)) {
4332
+ return {
4333
+ url: undefined,
4334
+ headers: null
4335
+ };
4336
+ }
4028
4337
 
4029
4338
  var _map$getProjection2 = map.getProjection(),
4030
4339
  srs = _map$getProjection2.srs;
@@ -4039,10 +4348,13 @@ var buildWMSGetMapRequest = function buildWMSGetMapRequest(map, layer) {
4039
4348
  layer.format = 'image/png';
4040
4349
  }
4041
4350
 
4042
- if (layer.name.length < 1) return {
4043
- url: undefined,
4044
- headers: null
4045
- }; // GetFeatureInfo timeseries in the mapview
4351
+ if (layer.name.length < 1) {
4352
+ return {
4353
+ url: undefined,
4354
+ headers: null
4355
+ };
4356
+ } // GetFeatureInfo timeseries in the mapview
4357
+
4046
4358
 
4047
4359
  if (srs === 'GFI:TIME_ELEVATION') {
4048
4360
  var x = 707;
@@ -4136,8 +4448,10 @@ var buildWMSGetMapRequest = function buildWMSGetMapRequest(map, layer) {
4136
4448
 
4137
4449
  var SCALE_DELAY = 10;
4138
4450
  var ZOOMED_CALLBACK_DELAY = 500;
4451
+ var THROTTLE_OPTIONS = {
4452
+ noTrailing: true
4453
+ };
4139
4454
  var THROTTLE_WAIT_TIME = 300;
4140
- var THROTTLE_NO_TRAILING = true;
4141
4455
 
4142
4456
  var WMFlyToBBox = function WMFlyToBBox(wmMap) {
4143
4457
  var _this = this;
@@ -4146,7 +4460,6 @@ var WMFlyToBBox = function WMFlyToBBox(wmMap) {
4146
4460
 
4147
4461
  this.flyZoomToBBOXTimerStart = 1;
4148
4462
  this.flyZoomToBBOXTimerSteps = 5;
4149
- this.flyZoomToBBOXDebounced = debounce;
4150
4463
  this.flyZoomToBBOXScaler = 0;
4151
4464
  this.flyZoomToBBOXCurrent = new WMBBOX();
4152
4465
  this.flyZoomToBBOXFly = new WMBBOX();
@@ -4239,9 +4552,9 @@ var WMFlyToBBox = function WMFlyToBBox(wmMap) {
4239
4552
  }
4240
4553
  };
4241
4554
 
4242
- this.startZoomThrottled = throttle(THROTTLE_WAIT_TIME, THROTTLE_NO_TRAILING, function (currentbox, newbox) {
4243
- return _this.flyZoomToBBOXStartZoom(currentbox, newbox);
4244
- });
4555
+ this.startZoomThrottled = throttle(THROTTLE_WAIT_TIME, function (currentbox, newbox) {
4556
+ _this.flyZoomToBBOXStartZoom(currentbox, newbox);
4557
+ }, THROTTLE_OPTIONS);
4245
4558
 
4246
4559
  this.flyZoomToBBOXStartZoomThrottled = function (currentbox, newbox) {
4247
4560
  _this.startZoomThrottled(currentbox, newbox);
@@ -4263,7 +4576,6 @@ var WebMapJSMapNo = 0;
4263
4576
  var bgMapImageStore = new WMImageStore(bgImageStoreLength, {
4264
4577
  id: 'bgMapImageStore'
4265
4578
  });
4266
-
4267
4579
  var detectLeftButton = function detectLeftButton(evt) {
4268
4580
  if (evt.buttons) {
4269
4581
  return evt.buttons === 1;
@@ -4425,7 +4737,6 @@ var WMJSMap = /*#__PURE__*/function () {
4425
4737
  /* pan,zoom,zoomout,info */
4426
4738
 
4427
4739
  this.numGetFeatureInfoRequests = 0;
4428
- this.getFeatureInfoResult = [];
4429
4740
  this.oldMapMode = undefined;
4430
4741
  this.InValidMouseAction = 0;
4431
4742
  this.resizingBBOXCursor = '';
@@ -4441,7 +4752,11 @@ var WMJSMap = /*#__PURE__*/function () {
4441
4752
  this.proj4.srs = 'empty';
4442
4753
  this.proj4.projection = undefined;
4443
4754
  this.longlat = 'EPSG:4326';
4444
- if (proj4) proj4.defs(WMProj4Defs);
4755
+
4756
+ if (proj4) {
4757
+ proj4.defs(WMProj4Defs);
4758
+ }
4759
+
4445
4760
  this.previousMouseButtonState = 'up';
4446
4761
  /* Binds */
4447
4762
 
@@ -4480,7 +4795,6 @@ var WMJSMap = /*#__PURE__*/function () {
4480
4795
  this.setSize = this.setSize.bind(this);
4481
4796
  this._setSize = this._setSize.bind(this);
4482
4797
  this.abort = this.abort.bind(this);
4483
- this.isBusy = this.isBusy.bind(this);
4484
4798
  this._makeInfoHTML = this._makeInfoHTML.bind(this);
4485
4799
  this.showScaleBar = this.showScaleBar.bind(this);
4486
4800
  this.hideScaleBar = this.hideScaleBar.bind(this);
@@ -4782,30 +5096,52 @@ var WMJSMap = /*#__PURE__*/function () {
4782
5096
  do {
4783
5097
  numMapUnits *= 10.0;
4784
5098
  divFactor = a / numMapUnits;
4785
- if (divFactor === 0) return undefined;
5099
+
5100
+ if (divFactor === 0) {
5101
+ return undefined;
5102
+ }
5103
+
4786
5104
  realWidth = desiredWidth / divFactor;
4787
5105
  } while (realWidth < desiredWidth);
4788
5106
 
4789
5107
  do {
4790
5108
  numMapUnits /= 2.0;
4791
5109
  divFactor = a / numMapUnits;
4792
- if (divFactor === 0) return undefined;
5110
+
5111
+ if (divFactor === 0) {
5112
+ return undefined;
5113
+ }
5114
+
4793
5115
  realWidth = desiredWidth / divFactor;
4794
5116
  } while (realWidth > desiredWidth);
4795
5117
 
4796
5118
  do {
4797
5119
  numMapUnits *= 1.2;
4798
5120
  divFactor = a / numMapUnits;
4799
- if (divFactor === 0) return undefined;
5121
+
5122
+ if (divFactor === 0) {
5123
+ return undefined;
5124
+ }
5125
+
4800
5126
  realWidth = desiredWidth / divFactor;
4801
5127
  } while (realWidth < desiredWidth);
4802
5128
 
4803
5129
  var roundedMapUnits = numMapUnits;
4804
5130
  var d = Math.pow(10, Math.round(Math.log10(numMapUnits) + 0.5) - 1);
4805
5131
  roundedMapUnits = Math.round(roundedMapUnits / d);
4806
- if (roundedMapUnits < 2.5) roundedMapUnits = 2.5;
4807
- if (roundedMapUnits > 2.5 && roundedMapUnits < 7.5) roundedMapUnits = 5;
4808
- if (roundedMapUnits > 7.5) roundedMapUnits = 10;
5132
+
5133
+ if (roundedMapUnits < 2.5) {
5134
+ roundedMapUnits = 2.5;
5135
+ }
5136
+
5137
+ if (roundedMapUnits > 2.5 && roundedMapUnits < 7.5) {
5138
+ roundedMapUnits = 5;
5139
+ }
5140
+
5141
+ if (roundedMapUnits > 7.5) {
5142
+ roundedMapUnits = 10;
5143
+ }
5144
+
4809
5145
  roundedMapUnits *= d;
4810
5146
  divFactor = desiredWidth / pixelsPerUnit / roundedMapUnits;
4811
5147
  realWidth = desiredWidth / divFactor;
@@ -4850,15 +5186,42 @@ var WMJSMap = /*#__PURE__*/function () {
4850
5186
  ctx.moveTo(offsetX + scaleBarProps.width * 2 + 1, scaleBarHeight - 2 + offsetY);
4851
5187
  ctx.lineTo(offsetX + scaleBarProps.width * 2 + 1, scaleBarHeight - 2 - 7 + offsetY);
4852
5188
  var units = '';
4853
- if (this.srs === 'EPSG:3411') units = 'meter';
4854
- if (this.srs === 'EPSG:3412') units = 'meter';
4855
- if (this.srs === 'EPSG:3575') units = 'meter';
4856
- if (this.srs === 'EPSG:4326') units = 'degrees';
4857
- if (this.srs === 'EPSG:28992') units = 'meter';
4858
- if (this.srs === 'EPSG:32661') units = 'meter';
4859
- if (this.srs === 'EPSG:3857') units = 'meter';
4860
- if (this.srs === 'EPSG:900913') units = 'meter';
4861
- if (this.srs === 'EPSG:102100') units = 'meter';
5189
+
5190
+ if (this.srs === 'EPSG:3411') {
5191
+ units = 'meter';
5192
+ }
5193
+
5194
+ if (this.srs === 'EPSG:3412') {
5195
+ units = 'meter';
5196
+ }
5197
+
5198
+ if (this.srs === 'EPSG:3575') {
5199
+ units = 'meter';
5200
+ }
5201
+
5202
+ if (this.srs === 'EPSG:4326') {
5203
+ units = 'degrees';
5204
+ }
5205
+
5206
+ if (this.srs === 'EPSG:28992') {
5207
+ units = 'meter';
5208
+ }
5209
+
5210
+ if (this.srs === 'EPSG:32661') {
5211
+ units = 'meter';
5212
+ }
5213
+
5214
+ if (this.srs === 'EPSG:3857') {
5215
+ units = 'meter';
5216
+ }
5217
+
5218
+ if (this.srs === 'EPSG:900913') {
5219
+ units = 'meter';
5220
+ }
5221
+
5222
+ if (this.srs === 'EPSG:102100') {
5223
+ units = 'meter';
5224
+ }
4862
5225
 
4863
5226
  if (units === 'meter') {
4864
5227
  if (scaleBarProps.mapunits > 1000) {
@@ -4884,7 +5247,11 @@ var WMJSMap = /*#__PURE__*/function () {
4884
5247
 
4885
5248
  if (isDefined(this.mouseGeoCoordXY)) {
4886
5249
  var roundingFactor = 1.0 / Math.pow(10, parseInt(Math.log((this.bbox.right - this.bbox.left) / this.width) / Math.log(10), 10) - 2);
4887
- if (roundingFactor < 1) roundingFactor = 1;
5250
+
5251
+ if (roundingFactor < 1) {
5252
+ roundingFactor = 1;
5253
+ }
5254
+
4888
5255
  ctx.fillStyle = '#000000';
4889
5256
  var xText = Math.round(this.mouseGeoCoordXY.x * roundingFactor) / roundingFactor;
4890
5257
  var yText = Math.round(this.mouseGeoCoordXY.y * roundingFactor) / roundingFactor;
@@ -5084,32 +5451,18 @@ var WMJSMap = /*#__PURE__*/function () {
5084
5451
  }, {
5085
5452
  key: "rebuildMapDimensions",
5086
5453
  value: function rebuildMapDimensions() {
5087
- for (var j = 0; j < this.mapdimensions.length; j += 1) {
5088
- this.mapdimensions[j].used = false;
5089
- }
5090
-
5091
5454
  for (var i = 0; i < this.layers.length; i += 1) {
5092
- for (var _j4 = 0; _j4 < this.layers[i].dimensions.length; _j4 += 1) {
5093
- var dim = this.layers[i].dimensions[_j4];
5455
+ for (var j = 0; j < this.layers[i].dimensions.length; j += 1) {
5456
+ var dim = this.layers[i].dimensions[j];
5094
5457
  var mapdim = this.getDimension(dim.name);
5095
5458
 
5096
- if (isDefined(mapdim)) {
5097
- mapdim.used = true;
5098
- } else {
5459
+ if (!isDefined(mapdim)) {
5099
5460
  var newdim = dim.clone();
5100
- newdim.used = true;
5101
5461
  this.mapdimensions.push(newdim);
5102
5462
  }
5103
5463
  }
5104
5464
  }
5105
5465
 
5106
- for (var _j5 = 0; _j5 < this.mapdimensions.length; _j5 += 1) {
5107
- if (this.mapdimensions[_j5].used === false) {
5108
- this.mapdimensions.splice(_j5, 1);
5109
- _j5 -= 1;
5110
- }
5111
- }
5112
-
5113
5466
  this.callBack.triggerEvent('onmapdimupdate');
5114
5467
  }
5115
5468
  }, {
@@ -5200,7 +5553,9 @@ var WMJSMap = /*#__PURE__*/function () {
5200
5553
  value: function toggleLayer(layer) {
5201
5554
  if (layer.enabled === true) {
5202
5555
  layer.enabled = false;
5203
- } else layer.enabled = true;
5556
+ } else {
5557
+ layer.enabled = true;
5558
+ }
5204
5559
 
5205
5560
  this.calculateNumBaseLayers();
5206
5561
  this.rebuildMapDimensions();
@@ -5215,7 +5570,9 @@ var WMJSMap = /*#__PURE__*/function () {
5215
5570
  }, {
5216
5571
  key: "_getLayerIndex",
5217
5572
  value: function _getLayerIndex(layer) {
5218
- if (!layer) return undefined;
5573
+ if (!layer) {
5574
+ return undefined;
5575
+ }
5219
5576
 
5220
5577
  for (var j = 0; j < this.layers.length; j += 1) {
5221
5578
  if (this.layers[j] === layer) {
@@ -5239,7 +5596,10 @@ var WMJSMap = /*#__PURE__*/function () {
5239
5596
  }, {
5240
5597
  key: "deleteLayer",
5241
5598
  value: function deleteLayer(layerToDelete) {
5242
- if (this.layers.length <= 0) return;
5599
+ if (this.layers.length <= 0) {
5600
+ return;
5601
+ }
5602
+
5243
5603
  layerToDelete.setAutoUpdate(false);
5244
5604
 
5245
5605
  var layerIndex = this._getLayerIndex(layerToDelete);
@@ -5397,14 +5757,18 @@ var WMJSMap = /*#__PURE__*/function () {
5397
5757
  }, {
5398
5758
  key: "setProjection",
5399
5759
  value: function setProjection(_srs, _bbox) {
5400
- if (!_srs) _srs = 'EPSG:4326';
5760
+ if (!_srs) {
5761
+ _srs = 'EPSG:4326';
5762
+ }
5401
5763
 
5402
5764
  if (_typeof(_srs) === 'object') {
5403
5765
  _bbox = _srs.bbox;
5404
5766
  _srs = _srs.srs;
5405
5767
  }
5406
5768
 
5407
- if (!_srs) _srs = 'EPSG:4326';
5769
+ if (!_srs) {
5770
+ _srs = 'EPSG:4326';
5771
+ }
5408
5772
 
5409
5773
  if (this.srs !== _srs) {
5410
5774
  this.defaultBBOX.setBBOX(_bbox);
@@ -5506,7 +5870,9 @@ var WMJSMap = /*#__PURE__*/function () {
5506
5870
  }, {
5507
5871
  key: "_setSize",
5508
5872
  value: function _setSize(w, h) {
5509
- if (!w || !h) return;
5873
+ if (!w || !h) {
5874
+ return;
5875
+ }
5510
5876
 
5511
5877
  if (w < 4 || h < 4) {
5512
5878
  return;
@@ -5516,8 +5882,14 @@ var WMJSMap = /*#__PURE__*/function () {
5516
5882
  var projinfo = this.getProjection();
5517
5883
  this.width = w;
5518
5884
  this.height = h;
5519
- if (this.width < 4 || isNaN(this.width)) this.width = 4;
5520
- if (this.height < 4 || isNaN(this.height)) this.height = 4;
5885
+
5886
+ if (this.width < 4 || isNaN(this.width)) {
5887
+ this.width = 4;
5888
+ }
5889
+
5890
+ if (this.height < 4 || isNaN(this.height)) {
5891
+ this.height = 4;
5892
+ }
5521
5893
 
5522
5894
  if (!projinfo.srs || !projinfo.bbox) {
5523
5895
  debug(DebugType.Error);
@@ -5529,12 +5901,19 @@ var WMJSMap = /*#__PURE__*/function () {
5529
5901
  this.setProjection(projinfo.srs, projinfo.bbox);
5530
5902
  }
5531
5903
 
5532
- if (!this.baseDiv || !this.baseDiv.style) return;
5904
+ if (!this.baseDiv || !this.baseDiv.style) {
5905
+ return;
5906
+ }
5907
+
5533
5908
  Object.assign(this.baseDiv.style, {
5534
5909
  width: this.width,
5535
5910
  height: this.height
5536
5911
  });
5537
- if (!this.mainElement || !this.mainElement.style) return;
5912
+
5913
+ if (!this.mainElement || !this.mainElement.style) {
5914
+ return;
5915
+ }
5916
+
5538
5917
  this.mainElement.style.width = "".concat(this.width, "px");
5539
5918
  this.mainElement.style.height = "".concat(this.height, "px");
5540
5919
  this.setBBOX(this.resizeBBOX);
@@ -5554,19 +5933,6 @@ var WMJSMap = /*#__PURE__*/function () {
5554
5933
  this.layersBusy = false;
5555
5934
  this.callBack.triggerEvent('onloadingcomplete');
5556
5935
  }
5557
- }, {
5558
- key: "isBusy",
5559
- value: function isBusy() {
5560
- if (this.suspendDrawing === true || this.mapBusy || this.layersBusy === 1) {
5561
- return true;
5562
- }
5563
-
5564
- if (this.divBuffer[0].ready === false || this.divBuffer[1].ready === false) {
5565
- return true;
5566
- }
5567
-
5568
- return false;
5569
- }
5570
5936
  }, {
5571
5937
  key: "_makeInfoHTML",
5572
5938
  value: function _makeInfoHTML() {
@@ -5618,7 +5984,9 @@ var WMJSMap = /*#__PURE__*/function () {
5618
5984
  }
5619
5985
  }
5620
5986
 
5621
- if (foundDim === false) infoHTML += '<td>-</td>';
5987
+ if (foundDim === false) {
5988
+ infoHTML += '<td>-</td>';
5989
+ }
5622
5990
  }
5623
5991
 
5624
5992
  infoHTML += '</tr>';
@@ -5661,7 +6029,10 @@ var WMJSMap = /*#__PURE__*/function () {
5661
6029
  }, {
5662
6030
  key: "display",
5663
6031
  value: function display() {
5664
- if (!this.divBuffer) return;
6032
+ if (!this.divBuffer) {
6033
+ return;
6034
+ }
6035
+
5665
6036
  this.divBuffer.display();
5666
6037
  this.drawnBBOX.setBBOX(this.bbox);
5667
6038
  }
@@ -5672,9 +6043,7 @@ var WMJSMap = /*#__PURE__*/function () {
5672
6043
  }
5673
6044
  }, {
5674
6045
  key: "draw",
5675
- value: function draw() {
5676
- var animationList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5677
-
6046
+ value: function draw(animationList) {
5678
6047
  if (this.isDestroyed) {
5679
6048
  return;
5680
6049
  }
@@ -5695,7 +6064,6 @@ var WMJSMap = /*#__PURE__*/function () {
5695
6064
  /**
5696
6065
  * API Function called to draw the layers, fires getmap request and shows the layers on the screen
5697
6066
  */
5698
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5699
6067
 
5700
6068
  }, {
5701
6069
  key: "_draw",
@@ -5714,8 +6082,7 @@ var WMJSMap = /*#__PURE__*/function () {
5714
6082
  this.needsRedraw = false;
5715
6083
  this.draw(this._animationList);
5716
6084
  }
5717
- } // eslint-disable-next-line @typescript-eslint/no-explicit-any
5718
-
6085
+ }
5719
6086
  }, {
5720
6087
  key: "_drawAndLoad",
5721
6088
  value: function _drawAndLoad(animationList) {
@@ -5876,9 +6243,17 @@ var WMJSMap = /*#__PURE__*/function () {
5876
6243
  key: "_updateBoundingBox",
5877
6244
  value: function _updateBoundingBox(_mapbbox) {
5878
6245
  var triggerEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
5879
- if (!this.divBuffer) return;
6246
+
6247
+ if (!this.divBuffer) {
6248
+ return;
6249
+ }
6250
+
5880
6251
  var mapbbox = this.bbox;
5881
- if (isDefined(_mapbbox)) mapbbox = _mapbbox;
6252
+
6253
+ if (isDefined(_mapbbox)) {
6254
+ mapbbox = _mapbbox;
6255
+ }
6256
+
5882
6257
  this.updateBBOX.setBBOX(mapbbox);
5883
6258
  this.divBuffer.setBBOX(this.updateBBOX, this.drawnBBOX);
5884
6259
  this.drawnBBOX.setBBOX(mapbbox);
@@ -5911,7 +6286,9 @@ var WMJSMap = /*#__PURE__*/function () {
5911
6286
  }
5912
6287
 
5913
6288
  this.callBack.triggerEvent('onlayeradd');
5914
- } else this.baseLayers = undefined;
6289
+ } else {
6290
+ this.baseLayers = undefined;
6291
+ }
5915
6292
  }
5916
6293
  }, {
5917
6294
  key: "setBaseLayers",
@@ -5929,7 +6306,9 @@ var WMJSMap = /*#__PURE__*/function () {
5929
6306
  }
5930
6307
 
5931
6308
  this.callBack.triggerEvent('onlayerchange');
5932
- } else this.baseLayers = undefined;
6309
+ } else {
6310
+ this.baseLayers = undefined;
6311
+ }
5933
6312
  }
5934
6313
  }, {
5935
6314
  key: "getBaseLayers",
@@ -5950,7 +6329,10 @@ var WMJSMap = /*#__PURE__*/function () {
5950
6329
  key: "mouseWheelEvent",
5951
6330
  value: function mouseWheelEvent(event) {
5952
6331
  preventdefaultEvent(event);
5953
- if (this.mouseWheelBusy === 1) return;
6332
+
6333
+ if (this.mouseWheelBusy === 1) {
6334
+ return;
6335
+ }
5954
6336
 
5955
6337
  var _this$getMouseCoordin = this.getMouseCoordinatesForDocument(event),
5956
6338
  x = _this$getMouseCoordin.x,
@@ -6009,7 +6391,10 @@ var WMJSMap = /*#__PURE__*/function () {
6009
6391
  }, {
6010
6392
  key: "destroy",
6011
6393
  value: function destroy() {
6012
- if (!this.initialized) return;
6394
+ if (!this.initialized) {
6395
+ return;
6396
+ }
6397
+
6013
6398
  this.stopAnimating();
6014
6399
 
6015
6400
  for (var i = this.layers.length - 1; i >= 0; i -= 1) {
@@ -6099,7 +6484,10 @@ var WMJSMap = /*#__PURE__*/function () {
6099
6484
  var format = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'text/html';
6100
6485
 
6101
6486
  /* For invalid layers we cannot build an url */
6102
- if (!layer.name) return '';
6487
+ if (!layer.name) {
6488
+ return '';
6489
+ }
6490
+
6103
6491
  var request = WMJScheckURL(layer.service);
6104
6492
  request += "&SERVICE=WMS&REQUEST=GetFeatureInfo&VERSION=".concat(layer.version);
6105
6493
  request += "&LAYERS=".concat(URLEncode(layer.name));
@@ -6270,7 +6658,10 @@ var WMJSMap = /*#__PURE__*/function () {
6270
6658
  this.oldMapMode = undefined;
6271
6659
  }
6272
6660
  } else {
6273
- if (this.oldMapMode === undefined) this.oldMapMode = this.mapMode;
6661
+ if (this.oldMapMode === undefined) {
6662
+ this.oldMapMode = this.mapMode;
6663
+ }
6664
+
6274
6665
  this.mapMode = 'zoom';
6275
6666
  }
6276
6667
 
@@ -6464,10 +6855,21 @@ var WMJSMap = /*#__PURE__*/function () {
6464
6855
 
6465
6856
  if (foundBBOXRib === true || this.resizingBBOXEnabled !== '' && this.mouseDownPressed === 1) {
6466
6857
  if (this.mouseDownPressed === 1) {
6467
- if (this.resizingBBOXEnabled === 'left') tlpx.x = this.mouseX;
6468
- if (this.resizingBBOXEnabled === 'top') tlpx.y = this.mouseY;
6469
- if (this.resizingBBOXEnabled === 'right') brpx.x = this.mouseX;
6470
- if (this.resizingBBOXEnabled === 'bottom') brpx.y = this.mouseY;
6858
+ if (this.resizingBBOXEnabled === 'left') {
6859
+ tlpx.x = this.mouseX;
6860
+ }
6861
+
6862
+ if (this.resizingBBOXEnabled === 'top') {
6863
+ tlpx.y = this.mouseY;
6864
+ }
6865
+
6866
+ if (this.resizingBBOXEnabled === 'right') {
6867
+ brpx.x = this.mouseX;
6868
+ }
6869
+
6870
+ if (this.resizingBBOXEnabled === 'bottom') {
6871
+ brpx.y = this.mouseY;
6872
+ }
6471
6873
 
6472
6874
  if (this.resizingBBOXEnabled === 'topleft') {
6473
6875
  tlpx.x = this.mouseX;
@@ -6520,10 +6922,15 @@ var WMJSMap = /*#__PURE__*/function () {
6520
6922
 
6521
6923
  this.mouseUpX = this.mouseX;
6522
6924
  this.mouseUpY = this.mouseY;
6523
- if (this.mapPanning === 0) return;
6925
+
6926
+ if (this.mapPanning === 0) {
6927
+ return;
6928
+ }
6524
6929
 
6525
6930
  if (this.mouseDownPressed === 1) {
6526
- if (this.mapMode === 'zoomout') this.zoomOut();
6931
+ if (this.mapMode === 'zoomout') {
6932
+ this.zoomOut();
6933
+ }
6527
6934
  }
6528
6935
 
6529
6936
  this.mouseDownPressed = 0;
@@ -6615,8 +7022,13 @@ var WMJSMap = /*#__PURE__*/function () {
6615
7022
  }, {
6616
7023
  key: "_mouseDragStart",
6617
7024
  value: function _mouseDragStart(x, y) {
6618
- if (this.mapMode === 'pan') this._mapPanStart(x, y);
6619
- if (this.mapMode === 'zoom') this._mapZoomStart();
7025
+ if (this.mapMode === 'pan') {
7026
+ this._mapPanStart(x, y);
7027
+ }
7028
+
7029
+ if (this.mapMode === 'zoom') {
7030
+ this._mapZoomStart();
7031
+ }
6620
7032
  }
6621
7033
  }, {
6622
7034
  key: "mouseDrag",
@@ -6627,16 +7039,31 @@ var WMJSMap = /*#__PURE__*/function () {
6627
7039
  this.mouseDragging = 1;
6628
7040
  }
6629
7041
 
6630
- if (this.mapMode === 'pan') this._mapPan(x, y);
6631
- if (this.mapMode === 'zoom') this._mapZoom();
7042
+ if (this.mapMode === 'pan') {
7043
+ this._mapPan(x, y);
7044
+ }
7045
+
7046
+ if (this.mapMode === 'zoom') {
7047
+ this._mapZoom();
7048
+ }
6632
7049
  }
6633
7050
  }, {
6634
7051
  key: "mouseDragEnd",
6635
7052
  value: function mouseDragEnd(x, y) {
6636
- if (this.mouseDragging === 0) return;
7053
+ if (this.mouseDragging === 0) {
7054
+ return;
7055
+ }
7056
+
6637
7057
  this.mouseDragging = 0;
6638
- if (this.mapMode === 'pan') this._mapPanEnd(x, y);
6639
- if (this.mapMode === 'zoom') this._mapZoomEnd();
7058
+
7059
+ if (this.mapMode === 'pan') {
7060
+ this._mapPanEnd(x, y);
7061
+ }
7062
+
7063
+ if (this.mapMode === 'zoom') {
7064
+ this._mapZoomEnd();
7065
+ }
7066
+
6640
7067
  this.callBack.triggerEvent('mapdragend', {
6641
7068
  map: this,
6642
7069
  x: this.mouseUpX,
@@ -6669,7 +7096,9 @@ var WMJSMap = /*#__PURE__*/function () {
6669
7096
  }, {
6670
7097
  key: "_mapPan",
6671
7098
  value: function _mapPan(x, y) {
6672
- if (this.mapPanning === 0) return;
7099
+ if (this.mapPanning === 0) {
7100
+ return;
7101
+ }
6673
7102
 
6674
7103
  if (this.mouseX < 0 || this.mouseY < 0 || this.mouseX > this.mainElement.clientWidth || this.mouseY > this.mainElement.clientHeight) {
6675
7104
  this._mapPanEnd(x, y);
@@ -6698,7 +7127,11 @@ var WMJSMap = /*#__PURE__*/function () {
6698
7127
  key: "_mapPanEnd",
6699
7128
  value: function _mapPanEnd(x, y) {
6700
7129
  this.baseDiv.style.cursor = 'default';
6701
- if (this.mapPanning === 0) return;
7130
+
7131
+ if (this.mapPanning === 0) {
7132
+ return;
7133
+ }
7134
+
6702
7135
  this.mapPanning = 0;
6703
7136
  var mapPanGeoCoords = this.getGeoCoordFromPixelCoord({
6704
7137
  x: x,
@@ -6756,7 +7189,10 @@ var WMJSMap = /*#__PURE__*/function () {
6756
7189
  }, {
6757
7190
  key: "_mapZoom",
6758
7191
  value: function _mapZoom() {
6759
- if (this.mapZooming === 0) return;
7192
+ if (this.mapZooming === 0) {
7193
+ return;
7194
+ }
7195
+
6760
7196
  var x = this.mouseX - this.mouseDownX;
6761
7197
  var y = this.mouseY - this.mouseDownY;
6762
7198
 
@@ -6773,12 +7209,16 @@ var WMJSMap = /*#__PURE__*/function () {
6773
7209
  if (w < 0) {
6774
7210
  w = -w;
6775
7211
  this.divZoomBox.style.left = "".concat(this.mouseX, "px");
6776
- } else this.divZoomBox.style.left = "".concat(this.mouseDownX, "px");
7212
+ } else {
7213
+ this.divZoomBox.style.left = "".concat(this.mouseDownX, "px");
7214
+ }
6777
7215
 
6778
7216
  if (h < 0) {
6779
7217
  h = -h;
6780
7218
  this.divZoomBox.style.top = "".concat(this.mouseY, "px");
6781
- } else this.divZoomBox.style.top = "".concat(this.mouseDownY, "px");
7219
+ } else {
7220
+ this.divZoomBox.style.top = "".concat(this.mouseDownY, "px");
7221
+ }
6782
7222
 
6783
7223
  this.divZoomBox.style.width = "".concat(w, "px");
6784
7224
  this.divZoomBox.style.height = "".concat(h, "px");
@@ -6789,10 +7229,18 @@ var WMJSMap = /*#__PURE__*/function () {
6789
7229
  var x = this.mouseUpX - this.mouseDownX;
6790
7230
  var y = this.mouseUpY - this.mouseDownY;
6791
7231
  this.baseDiv.style.cursor = 'default';
6792
- if (this.mapZooming === 0) return;
7232
+
7233
+ if (this.mapZooming === 0) {
7234
+ return;
7235
+ }
7236
+
6793
7237
  this.mapZooming = 0;
6794
7238
  this.divZoomBox.style.display = 'none';
6795
- if (x < 0 && y < 0) return;
7239
+
7240
+ if (x < 0 && y < 0) {
7241
+ return;
7242
+ }
7243
+
6796
7244
  var zoomBBOXPixels = new WMBBOX();
6797
7245
 
6798
7246
  if (x < 0) {
@@ -6869,7 +7317,10 @@ var WMJSMap = /*#__PURE__*/function () {
6869
7317
  ratio = 1;
6870
7318
  }
6871
7319
 
6872
- if (ratio < 0) ratio = -ratio;
7320
+ if (ratio < 0) {
7321
+ ratio = -ratio;
7322
+ }
7323
+
6873
7324
  var screenRatio = this.width / this.height; // Is W > H?
6874
7325
 
6875
7326
  if (ratio > screenRatio) {
@@ -6918,8 +7369,14 @@ var WMJSMap = /*#__PURE__*/function () {
6918
7369
  key: "getGeoCoordFromPixelCoord",
6919
7370
  value: function getGeoCoordFromPixelCoord(coordinates, _bbox) {
6920
7371
  var mybbox = this.bbox;
6921
- if (_bbox) mybbox = _bbox;
6922
- if (!isDefined(coordinates)) return undefined;
7372
+
7373
+ if (_bbox) {
7374
+ mybbox = _bbox;
7375
+ }
7376
+
7377
+ if (!isDefined(coordinates)) {
7378
+ return undefined;
7379
+ }
6923
7380
 
6924
7381
  try {
6925
7382
  var lon = coordinates.x / this.width * (mybbox.right - mybbox.left) + mybbox.left;
@@ -7046,9 +7503,19 @@ var WMJSMap = /*#__PURE__*/function () {
7046
7503
  var w = this.width;
7047
7504
  var h = this.height;
7048
7505
  var b = this.updateBBOX;
7049
- if (isDefined(_width)) w = _width;
7050
- if (isDefined(_height)) h = _height;
7051
- if (isDefined(_bbox)) b = _bbox;
7506
+
7507
+ if (isDefined(_width)) {
7508
+ w = _width;
7509
+ }
7510
+
7511
+ if (isDefined(_height)) {
7512
+ h = _height;
7513
+ }
7514
+
7515
+ if (isDefined(_bbox)) {
7516
+ b = _bbox;
7517
+ }
7518
+
7052
7519
  var x = w * (coordinates.x - b.left) / (b.right - b.left);
7053
7520
  var y = h * (coordinates.y - b.top) / (b.bottom - b.top);
7054
7521
  return {
@@ -7066,7 +7533,10 @@ var WMJSMap = /*#__PURE__*/function () {
7066
7533
  }, {
7067
7534
  key: "removeListener",
7068
7535
  value: function removeListener(name, f) {
7069
- if (this.isDestroyed) return;
7536
+ if (this.isDestroyed) {
7537
+ return;
7538
+ }
7539
+
7070
7540
  this.callBack.removeEvents(name, f);
7071
7541
  }
7072
7542
  }, {
@@ -7207,23 +7677,26 @@ var WMJSMap = /*#__PURE__*/function () {
7207
7677
  this.WMProjectionTempUndo[j] = this.WMProjectionUndo[j];
7208
7678
  }
7209
7679
 
7210
- for (var _j6 = 0; _j6 <= this.UndoPointer; _j6 += 1) {
7211
- this.WMProjectionUndo[_j6] = this.WMProjectionTempUndo[this.UndoPointer - _j6];
7680
+ for (var _j4 = 0; _j4 <= this.UndoPointer; _j4 += 1) {
7681
+ this.WMProjectionUndo[_j4] = this.WMProjectionTempUndo[this.UndoPointer - _j4];
7212
7682
  }
7213
7683
 
7214
7684
  this.UndoPointer = 0;
7215
7685
  }
7216
7686
 
7217
- for (var _j7 = this.MaxUndos - 1; _j7 > 0; _j7 -= 1) {
7218
- this.WMProjectionUndo[_j7].bbox.setBBOX(this.WMProjectionUndo[_j7 - 1].bbox);
7687
+ for (var _j5 = this.MaxUndos - 1; _j5 > 0; _j5 -= 1) {
7688
+ this.WMProjectionUndo[_j5].bbox.setBBOX(this.WMProjectionUndo[_j5 - 1].bbox);
7219
7689
 
7220
- this.WMProjectionUndo[_j7].srs = this.WMProjectionUndo[_j7 - 1].srs;
7690
+ this.WMProjectionUndo[_j5].srs = this.WMProjectionUndo[_j5 - 1].srs;
7221
7691
  }
7222
7692
 
7223
7693
  this.WMProjectionUndo[0].bbox.setBBOX(this.bbox);
7224
7694
  this.WMProjectionUndo[0].srs = this.srs;
7225
7695
  this.NrOfUndos += 1;
7226
- if (this.NrOfUndos > this.MaxUndos) this.NrOfUndos = this.MaxUndos;
7696
+
7697
+ if (this.NrOfUndos > this.MaxUndos) {
7698
+ this.NrOfUndos = this.MaxUndos;
7699
+ }
7227
7700
  }
7228
7701
 
7229
7702
  this.DoRedo = 0;
@@ -7250,7 +7723,9 @@ var WMJSMap = /*#__PURE__*/function () {
7250
7723
 
7251
7724
  if (isDefined(ratio) === false) {
7252
7725
  ratio = 1;
7253
- } else if (ratio === 0) return;
7726
+ } else if (ratio === 0) {
7727
+ return;
7728
+ }
7254
7729
 
7255
7730
  a *= ratio;
7256
7731
  this.zoomTo(new WMBBOX(this.resizeBBOX.left - a, this.resizeBBOX.bottom - a, this.resizeBBOX.right + a, this.resizeBBOX.top + a));
@@ -7271,9 +7746,16 @@ var WMJSMap = /*#__PURE__*/function () {
7271
7746
  this.divBoundingBox.displayed = true;
7272
7747
  }
7273
7748
 
7274
- if (this.divBoundingBox.displayed !== true) return;
7749
+ if (this.divBoundingBox.displayed !== true) {
7750
+ return;
7751
+ }
7752
+
7275
7753
  var b = this.bbox;
7276
- if (isDefined(_mapbbox)) b = _mapbbox;
7754
+
7755
+ if (isDefined(_mapbbox)) {
7756
+ b = _mapbbox;
7757
+ }
7758
+
7277
7759
  var coord1 = this.getPixelCoordFromGeoCoord({
7278
7760
  x: this.divBoundingBox.bbox.left,
7279
7761
  y: this.divBoundingBox.bbox.top
@@ -7889,7 +8371,10 @@ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, op
7889
8371
 
7890
8372
  /* Make the getCapabilitiesJSONrequest */
7891
8373
  var headers = [];
7892
- if (options && options.headers) headers = options.headers;
8374
+
8375
+ if (options && options.headers) {
8376
+ headers = options.headers;
8377
+ }
7893
8378
 
7894
8379
  if (!isDefined(service)) {
7895
8380
  fail(I18n.no_service_defined.text);
@@ -7993,7 +8478,10 @@ var WMJSService = /*#__PURE__*/function () {
7993
8478
  value: function checkVersion111(jsonData) {
7994
8479
  try {
7995
8480
  var rootLayer = jsonData.WMT_MS_Capabilities.Capability.Layer;
7996
- if (!rootLayer) throw new Error('No 111 layer');
8481
+
8482
+ if (!rootLayer) {
8483
+ throw new Error('No 111 layer');
8484
+ }
7997
8485
  } catch (e) {
7998
8486
  var message = this.checkException(jsonData);
7999
8487
 
@@ -8015,7 +8503,10 @@ var WMJSService = /*#__PURE__*/function () {
8015
8503
  value: function checkVersion130(jsonData) {
8016
8504
  try {
8017
8505
  var rootLayer = jsonData.WMS_Capabilities.Capability.Layer;
8018
- if (!rootLayer) throw new Error('No 130 layer');
8506
+
8507
+ if (!rootLayer) {
8508
+ throw new Error('No 130 layer');
8509
+ }
8019
8510
  } catch (e) {
8020
8511
  var message = this.checkException(jsonData);
8021
8512
 
@@ -8188,7 +8679,8 @@ var WMJSService = /*#__PURE__*/function () {
8188
8679
  if (WMSCapabilities.Service.OnlineResource.value) {
8189
8680
  _this.onlineresource = WMSCapabilities.Service.OnlineResource.value;
8190
8681
  } else {
8191
- _this.onlineresource = WMSCapabilities.Service.OnlineResource.attr['xlink:href'];
8682
+ _this.onlineresource = // eslint-disable-next-line @typescript-eslint/no-explicit-any
8683
+ WMSCapabilities.Service.OnlineResource.attr['xlink:href'];
8192
8684
  }
8193
8685
  } catch (e) {
8194
8686
  _this.onlineresource = I18n.not_available_message.text;
@@ -8225,7 +8717,9 @@ var WMJSService = /*#__PURE__*/function () {
8225
8717
 
8226
8718
  if (se) {
8227
8719
  try {
8228
- if (se.attr.code) code = se.attr.code;
8720
+ if (se.attr.code) {
8721
+ code = se.attr.code;
8722
+ }
8229
8723
  } catch (e) {// do nothing
8230
8724
  }
8231
8725
 
@@ -8252,8 +8746,6 @@ var WMJSService = /*#__PURE__*/function () {
8252
8746
  value: function getNodes(succes, failure, forceReload, options) {
8253
8747
  var _this2 = this;
8254
8748
 
8255
- this.nodeCache = undefined;
8256
-
8257
8749
  if (!failure) {
8258
8750
  // eslint-disable-next-line no-param-reassign
8259
8751
  failure = function failure(msg) {
@@ -8551,7 +9043,13 @@ var WMLayer = /*#__PURE__*/function () {
8551
9043
  this.getmapURL = options.service;
8552
9044
  this.getfeatureinfoURL = options.service;
8553
9045
  this.getlegendgraphicURL = options.service;
8554
- if (options.active === true) this.active = true;else this.active = false;
9046
+
9047
+ if (options.active === true) {
9048
+ this.active = true;
9049
+ } else {
9050
+ this.active = false;
9051
+ }
9052
+
8555
9053
  this.name = options.name;
8556
9054
 
8557
9055
  if (options.getgraphinfoURL) {
@@ -8574,16 +9072,29 @@ var WMLayer = /*#__PURE__*/function () {
8574
9072
  this.id = options.id;
8575
9073
  }
8576
9074
 
8577
- if (options.format) this.format = options.format;else this.format = 'image/png';
9075
+ if (options.format) {
9076
+ this.format = options.format;
9077
+ } else {
9078
+ this.format = 'image/png';
9079
+ }
8578
9080
 
8579
9081
  if (isDefined(options.opacity)) {
8580
9082
  this.opacity = options.opacity;
8581
9083
  }
8582
9084
 
8583
- if (options.title) this.title = options.title;
9085
+ if (options.title) {
9086
+ this.title = options.title;
9087
+ }
9088
+
8584
9089
  this["abstract"] = I18n.not_available_message.text;
8585
- if (options.enabled === false) this.enabled = false;
8586
- if (options.keepOnTop === true) this.keepOnTop = true;
9090
+
9091
+ if (options.enabled === false) {
9092
+ this.enabled = false;
9093
+ }
9094
+
9095
+ if (options.keepOnTop === true) {
9096
+ this.keepOnTop = true;
9097
+ }
8587
9098
 
8588
9099
  if (options.transparent === false) {
8589
9100
  this.transparent = false;
@@ -8775,11 +9286,19 @@ var WMLayer = /*#__PURE__*/function () {
8775
9286
  key: "setDimension",
8776
9287
  value: function setDimension(name, value) {
8777
9288
  var updateMapDimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
8778
- if (!isDefined(value)) return;
9289
+
9290
+ if (!isDefined(value)) {
9291
+ return;
9292
+ }
9293
+
8779
9294
  var dimIndex = this.dimensions.findIndex(function (dim) {
8780
9295
  return dim.name === name;
8781
9296
  });
8782
- if (dimIndex < 0) return;
9297
+
9298
+ if (dimIndex < 0) {
9299
+ return;
9300
+ }
9301
+
8783
9302
  var dim = this.dimensions[dimIndex];
8784
9303
  dim.setValue(value);
8785
9304
  this.handleReferenceTime(name, value, updateMapDimensions);
@@ -9154,10 +9673,22 @@ var WMLayer = /*#__PURE__*/function () {
9154
9673
 
9155
9674
  for (var j = 0; j < this.styles.length; j += 1) {
9156
9675
  if (this.styles[j].name === styleName) {
9157
- if (nextPrev === -1) j -= 1;
9158
- if (nextPrev === 1) j += 1;
9159
- if (j < 0) j = this.styles.length - 1;
9160
- if (j > this.styles.length - 1) j = 0;
9676
+ if (nextPrev === -1) {
9677
+ j -= 1;
9678
+ }
9679
+
9680
+ if (nextPrev === 1) {
9681
+ j += 1;
9682
+ }
9683
+
9684
+ if (j < 0) {
9685
+ j = this.styles.length - 1;
9686
+ }
9687
+
9688
+ if (j > this.styles.length - 1) {
9689
+ j = 0;
9690
+ }
9691
+
9161
9692
  return this.styles[j];
9162
9693
  }
9163
9694
  }
@@ -9179,7 +9710,11 @@ var WMLayer = /*#__PURE__*/function () {
9179
9710
  var dimIndex = this.dimensions.findIndex(function (dim) {
9180
9711
  return dim.name === name;
9181
9712
  });
9182
- if (dimIndex < 0) return undefined;
9713
+
9714
+ if (dimIndex < 0) {
9715
+ return undefined;
9716
+ }
9717
+
9183
9718
  return this.dimensions[dimIndex];
9184
9719
  }
9185
9720
  /**