@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.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('throttle-debounce'), require('lodash'), require('moment'), require('proj4')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'throttle-debounce', 'lodash', 'moment', 'proj4'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Webmap = {}, global.throttleDebounce, global.lodash, global.moment, global.proj4));
5
- })(this, (function (exports, throttleDebounce, lodash, moment, proj4) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('throttle-debounce'), require('lodash'), require('@opengeoweb/shared'), require('moment'), require('proj4')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'throttle-debounce', 'lodash', '@opengeoweb/shared', 'moment', 'proj4'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Webmap = {}, global.throttleDebounce, global.lodash, global.shared, global.moment, global.proj4));
5
+ })(this, (function (exports, throttleDebounce, lodash, shared, moment, proj4) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -158,7 +158,9 @@
158
158
  */
159
159
 
160
160
  var isDefined = function isDefined(variable) {
161
- if (variable === null) return false;
161
+ if (variable === null) {
162
+ return false;
163
+ }
162
164
 
163
165
  if (typeof variable === 'undefined') {
164
166
  return false;
@@ -173,7 +175,9 @@
173
175
  */
174
176
 
175
177
  var toArray = function toArray(array) {
176
- if (array === null || typeof array === 'undefined') return [];
178
+ if (array === null || typeof array === 'undefined') {
179
+ return [];
180
+ }
177
181
 
178
182
  if (array instanceof Array) {
179
183
  return array;
@@ -191,7 +195,10 @@
191
195
  */
192
196
 
193
197
  var WMJScheckURL = function WMJScheckURL(url) {
194
- if (!isDefined(url)) return '?';
198
+ if (!isDefined(url)) {
199
+ return '?';
200
+ }
201
+
195
202
  var trimmedUrl = url.trim();
196
203
 
197
204
  if (trimmedUrl.indexOf('?') === -1) {
@@ -218,14 +225,26 @@
218
225
  return event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
219
226
  };
220
227
  var URLDecode = function URLDecode(encodedURL) {
221
- if (!isDefined(encodedURL)) return '';
228
+ if (!isDefined(encodedURL)) {
229
+ return '';
230
+ }
231
+
222
232
  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', '$');
223
233
  }; // Encodes plain text to URL encoding
224
234
 
225
235
  var URLEncode = function URLEncode(plaintext) {
226
- if (!plaintext) return plaintext;
227
- if (plaintext === undefined) return plaintext;
228
- if (plaintext === '') return plaintext;
236
+ if (!plaintext) {
237
+ return plaintext;
238
+ }
239
+
240
+ if (plaintext === undefined) {
241
+ return plaintext;
242
+ }
243
+
244
+ if (plaintext === '') {
245
+ return plaintext;
246
+ }
247
+
229
248
  var SAFECHARS = '0123456789' + // Numeric
230
249
  'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + // Alphabetic
231
250
  'abcdefghijklmnopqrstuvwxyz' + "%-_.!~*'()"; // RFC2396 Mark characters
@@ -264,8 +283,15 @@
264
283
  var getCorrectWMSDimName = function getCorrectWMSDimName(origDimName) {
265
284
  /* Adds DIM_ for dimensions other than height or time */
266
285
  var upperCaseDimName = origDimName.toUpperCase();
267
- if (upperCaseDimName === 'TIME') return upperCaseDimName;
268
- if (upperCaseDimName === 'ELEVATION') return upperCaseDimName;
286
+
287
+ if (upperCaseDimName === 'TIME') {
288
+ return upperCaseDimName;
289
+ }
290
+
291
+ if (upperCaseDimName === 'ELEVATION') {
292
+ return upperCaseDimName;
293
+ }
294
+
269
295
  return "DIM_" + upperCaseDimName;
270
296
  };
271
297
  /* Returns all dimensions with its current values as URL */
@@ -380,7 +406,10 @@
380
406
 
381
407
  var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS) {
382
408
  /* Get the Style object */
383
- if (!layerObjectFromWMS.Style) return [];
409
+ if (!layerObjectFromWMS.Style) {
410
+ return [];
411
+ }
412
+
384
413
  var layerStyles = toArray(layerObjectFromWMS.Style);
385
414
  /* 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 */
386
415
 
@@ -420,7 +449,10 @@
420
449
  });
421
450
  };
422
451
  var addDimensionsForLayer = function addDimensionsForLayer(layerObjectFromWMS) {
423
- if (!layerObjectFromWMS.Dimension) return [];
452
+ if (!layerObjectFromWMS.Dimension) {
453
+ return [];
454
+ }
455
+
424
456
  var layerDimensions = toArray(layerObjectFromWMS.Dimension);
425
457
  var layerDimensionsExtents = toArray(layerObjectFromWMS.Extent);
426
458
  var dimensionList = layerDimensions.map(function (layerDimension) {
@@ -481,10 +513,19 @@
481
513
  var spreadArray = __spreadArray([], __read(array));
482
514
 
483
515
  return spreadArray.sort(function (a, b) {
484
- var x = a[key];
516
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
517
+ var x = a[key]; // eslint-disable-next-line @typescript-eslint/no-explicit-any
518
+
485
519
  var y = b[key];
486
- if (x < y) return -1;
487
- if (x > y) return 1;
520
+
521
+ if (x < y) {
522
+ return -1;
523
+ }
524
+
525
+ if (x > y) {
526
+ return 1;
527
+ }
528
+
488
529
  return 0;
489
530
  });
490
531
  }
@@ -728,7 +769,10 @@
728
769
 
729
770
 
730
771
  WMImage.prototype.isLoaded = function () {
731
- if (this._isLoading) return false;
772
+ if (this._isLoading) {
773
+ return false;
774
+ }
775
+
732
776
  return this._isLoaded;
733
777
  };
734
778
  /**
@@ -822,7 +866,8 @@
822
866
  this._srcLoaded = undefined;
823
867
 
824
868
  this._load();
825
- };
869
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
870
+
826
871
 
827
872
  WMImage.prototype._getImageWithHeaders = function (url, headers) {
828
873
  var _this = this;
@@ -1244,7 +1289,11 @@
1244
1289
  /* A string like "-180,-90,180,90" is given */
1245
1290
  try {
1246
1291
  var a = left.split(',');
1247
- if (a.length !== 4) return;
1292
+
1293
+ if (a.length !== 4) {
1294
+ return;
1295
+ }
1296
+
1248
1297
  this.left = parseFloat(a[0]);
1249
1298
  this.bottom = parseFloat(a[1]);
1250
1299
  this.right = parseFloat(a[2]);
@@ -1257,10 +1306,21 @@
1257
1306
  /* Apply defaults to invalid values */
1258
1307
 
1259
1308
 
1260
- if (this.left == null) this.left = -180;
1261
- if (this.right == null) this.right = 180;
1262
- if (this.bottom == null) this.bottom = -90;
1263
- if (this.top == null) this.top = 90;
1309
+ if (this.left == null) {
1310
+ this.left = -180;
1311
+ }
1312
+
1313
+ if (this.right == null) {
1314
+ this.right = 180;
1315
+ }
1316
+
1317
+ if (this.bottom == null) {
1318
+ this.bottom = -90;
1319
+ }
1320
+
1321
+ if (this.top == null) {
1322
+ this.top = 90;
1323
+ }
1264
1324
  };
1265
1325
  /*
1266
1326
  * Compares two boundingboxes and returns true if they are equal
@@ -1417,10 +1477,12 @@
1417
1477
  };
1418
1478
 
1419
1479
  WMListener.prototype.suspendEvent = function (name) {
1480
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1420
1481
  this._suspendedEvents[name] = true;
1421
1482
  };
1422
1483
 
1423
1484
  WMListener.prototype.resumeEvent = function (name) {
1485
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1424
1486
  this._suspendedEvents[name] = false;
1425
1487
  };
1426
1488
 
@@ -1434,7 +1496,8 @@
1434
1496
 
1435
1497
 
1436
1498
  WMListener.prototype.triggerEvent = function (name, param) {
1437
- if (this._allEventsSuspended === true || this._suspendedEvents[name] === true) {
1499
+ if (this._allEventsSuspended === true || // eslint-disable-next-line @typescript-eslint/no-explicit-any
1500
+ this._suspendedEvents[name] === true) {
1438
1501
  return [];
1439
1502
  }
1440
1503
 
@@ -1628,7 +1691,10 @@
1628
1691
  var cachedImage = imageStore.getImageForSrc(altImage.imageSource);
1629
1692
  return cachedImage && cachedImage.isLoaded() && !cachedImage.isLoading() && !cachedImage.hasError();
1630
1693
  });
1631
- if (index !== -1) return sortedImagesForUrl[index];
1694
+
1695
+ if (index !== -1) {
1696
+ return sortedImagesForUrl[index];
1697
+ }
1632
1698
  }
1633
1699
 
1634
1700
  return null;
@@ -1840,7 +1906,10 @@
1840
1906
  };
1841
1907
 
1842
1908
  WMCanvasBuffer.prototype.finishedLoading = function () {
1843
- if (this.ready) return;
1909
+ if (this.ready) {
1910
+ return;
1911
+ }
1912
+
1844
1913
  this.ready = true;
1845
1914
 
1846
1915
  for (var j = 0; j < this.layers.length; j += 1) {
@@ -1863,7 +1932,11 @@
1863
1932
  WMCanvasBuffer.prototype.resize = function (w, h) {
1864
1933
  var width = parseInt(w, 10);
1865
1934
  var height = parseInt(h, 10);
1866
- if (this._width === width && this._height === height) return;
1935
+
1936
+ if (this._width === width && this._height === height) {
1937
+ return;
1938
+ }
1939
+
1867
1940
  this._width = width;
1868
1941
  this._height = height;
1869
1942
  this.canvas.width = width;
@@ -2003,7 +2076,10 @@
2003
2076
  _map.isAnimating = false;
2004
2077
 
2005
2078
  _map.setAnimationDelay = function (delay) {
2006
- if (delay < 1) delay = 1;
2079
+ if (delay < 1) {
2080
+ delay = 1;
2081
+ }
2082
+
2007
2083
  _map.animationDelay = delay;
2008
2084
  };
2009
2085
 
@@ -2032,7 +2108,7 @@
2032
2108
  _map.checkAnimation = this.checkAnimation;
2033
2109
  }
2034
2110
 
2035
- WMJSAnimate.prototype._isCurrentAnimationTimeCloseToWallClockTime = function () {
2111
+ WMJSAnimate.prototype.isCurrentAnimationTimeCloseToWallClockTime = function () {
2036
2112
  if (this.isNextTimeCloseToWallClockTime) {
2037
2113
  this.isNextTimeCloseToWallClockTime = false;
2038
2114
  return true;
@@ -2040,13 +2116,13 @@
2040
2116
 
2041
2117
  var currentAnimationStep = this._map.animationList[this._map.currentAnimationStep];
2042
2118
  var nextAnimationStep = this._map.animationList[this._map.currentAnimationStep + 1 >= this._map.animationList.length ? 0 : this._map.currentAnimationStep + 1];
2043
- var wallClockTime = moment__default["default"].utc();
2044
- var currentAnimationTime = moment__default["default"].utc(currentAnimationStep.value);
2045
- var nextAnimationTime = moment__default["default"].utc(nextAnimationStep.value);
2119
+ var wallClockTime = new Date();
2120
+ var currentAnimationTime = new Date(currentAnimationStep.value);
2121
+ var nextAnimationTime = new Date(nextAnimationStep.value);
2046
2122
 
2047
- if (wallClockTime.isBetween(currentAnimationTime, nextAnimationTime, undefined, '[)')) {
2048
- var timeDiff1 = moment__default["default"].duration(currentAnimationTime.clone().diff(wallClockTime)).asMinutes();
2049
- var timeDiff2 = moment__default["default"].duration(nextAnimationTime.clone().diff(wallClockTime)).asMinutes();
2123
+ if (shared.dateUtils.isBetween(wallClockTime, currentAnimationTime, nextAnimationTime)) {
2124
+ var timeDiff1 = shared.dateUtils.differenceInMinutes(currentAnimationTime, wallClockTime);
2125
+ var timeDiff2 = shared.dateUtils.differenceInMinutes(nextAnimationTime, wallClockTime);
2050
2126
 
2051
2127
  if (Math.abs(timeDiff1) < Math.abs(timeDiff2)) {
2052
2128
  // Wall clock time is closer to current animation step time than to the next animation step time
@@ -2062,8 +2138,14 @@
2062
2138
  };
2063
2139
 
2064
2140
  WMJSAnimate.prototype._animate = function () {
2065
- if (this._map.isAnimating === false) return;
2066
- if (this._map.animateBusy === true) return;
2141
+ if (this._map.isAnimating === false) {
2142
+ return;
2143
+ }
2144
+
2145
+ if (this._map.animateBusy === true) {
2146
+ return;
2147
+ }
2148
+
2067
2149
  var animationStep = this._map.animationList[this._map.currentAnimationStep];
2068
2150
 
2069
2151
  if (!animationStep) {
@@ -2094,7 +2176,7 @@
2094
2176
  animationDelay *= 3;
2095
2177
  } else if (this._map.currentAnimationStep === this._map.animationList.length - 1) {
2096
2178
  animationDelay *= 5;
2097
- } else if (this._isCurrentAnimationTimeCloseToWallClockTime()) {
2179
+ } else if (this.isCurrentAnimationTimeCloseToWallClockTime()) {
2098
2180
  animationDelay *= 5;
2099
2181
  }
2100
2182
 
@@ -2182,7 +2264,9 @@
2182
2264
  index -= this._map.animationList.length;
2183
2265
  }
2184
2266
 
2185
- if (index < 0) index = 0;
2267
+ if (index < 0) {
2268
+ index = 0;
2269
+ }
2186
2270
 
2187
2271
  if (index >= 0) {
2188
2272
  var animationStep = this._map.animationList[index];
@@ -2214,7 +2298,10 @@
2214
2298
  };
2215
2299
 
2216
2300
  WMJSAnimate.prototype.stopAnimating = function () {
2217
- if (this._map.isAnimating === false) return;
2301
+ if (this._map.isAnimating === false) {
2302
+ return;
2303
+ }
2304
+
2218
2305
  this._map._animationList = undefined;
2219
2306
  this._divAnimationInfo.style.display = 'none';
2220
2307
  this._map.isAnimating = false;
@@ -2262,9 +2349,18 @@
2262
2349
  /* Temporal mappings from bgmaps.cgi service names to names defined here */
2263
2350
 
2264
2351
 
2265
- if (layerName === 'streetmap') layerName = 'OSM';
2266
- if (layerName === 'pdok') layerName = 'OSM';
2267
- if (layerName === 'naturalearth2') layerName = 'NaturalEarth2';
2352
+ if (layerName === 'streetmap') {
2353
+ layerName = 'OSM';
2354
+ }
2355
+
2356
+ if (layerName === 'pdok') {
2357
+ layerName = 'OSM';
2358
+ }
2359
+
2360
+ if (layerName === 'naturalearth2') {
2361
+ layerName = 'NaturalEarth2';
2362
+ }
2363
+
2268
2364
  var tileLayer = tileOptions[layerName];
2269
2365
 
2270
2366
  if (!tileLayer) {
@@ -2298,10 +2394,23 @@
2298
2394
  var initialResolution = 2 * pi * 6378137 / tileSize;
2299
2395
  var originShiftX = -2 * pi * 6378137 / 2.0;
2300
2396
  var originShiftY = 2 * pi * 6378137 / 2.0;
2301
- if (tileSettings.tileSize) tileSize = tileSettings.tileSize;
2302
- if (tileSettings.resolution) initialResolution = tileSettings.resolution;
2303
- if (tileSettings.origX) originShiftX = tileSettings.origX;
2304
- if (tileSettings.origY) originShiftY = tileSettings.origY;
2397
+
2398
+ if (tileSettings.tileSize) {
2399
+ tileSize = tileSettings.tileSize;
2400
+ }
2401
+
2402
+ if (tileSettings.resolution) {
2403
+ initialResolution = tileSettings.resolution;
2404
+ }
2405
+
2406
+ if (tileSettings.origX) {
2407
+ originShiftX = tileSettings.origX;
2408
+ }
2409
+
2410
+ if (tileSettings.origY) {
2411
+ originShiftY = tileSettings.origY;
2412
+ }
2413
+
2305
2414
  var screenWidth = width;
2306
2415
  var bboxw = currentBBOX.right - currentBBOX.left;
2307
2416
  var originShiftX2 = initialResolution * tileSize + originShiftX;
@@ -2326,8 +2435,14 @@
2326
2435
  var tileServerFormat = tileSettings.tileServerFormat || 'png';
2327
2436
  var tmsEnabled = tileSettings.tms || false; // 'osm' or 'argisonline'
2328
2437
 
2329
- if (level < tileSettings.minLevel) level = tileSettings.minLevel;
2330
- if (level > tileSettings.maxLevel) level = tileSettings.maxLevel;
2438
+ if (level < tileSettings.minLevel) {
2439
+ level = tileSettings.minLevel;
2440
+ }
2441
+
2442
+ if (level > tileSettings.maxLevel) {
2443
+ level = tileSettings.maxLevel;
2444
+ }
2445
+
2331
2446
  var numTilesAtLevel = Math.pow(2, level);
2332
2447
  var numTilesAtLevelX = tileSetWidth / (initialResolution / numTilesAtLevel * tileSize);
2333
2448
  var numTilesAtLevelY = tileSetHeight / (initialResolution / numTilesAtLevel * tileSize);
@@ -2379,7 +2494,7 @@
2379
2494
  x: bounds.right,
2380
2495
  y: bounds.top
2381
2496
  }, newBBOX, width, height);
2382
- var imageURL;
2497
+ var imageURL = '';
2383
2498
 
2384
2499
  if (tileServerType === 'osm') {
2385
2500
  if (tmsEnabled) {
@@ -2442,14 +2557,37 @@
2442
2557
  numTilesAtLevelX *= 2;
2443
2558
  }
2444
2559
 
2445
- if (tilenbottom < 1) tilenbottom = 1;
2446
- if (tilenbottom > numTilesAtLevelY) tilenbottom = numTilesAtLevelY;
2447
- if (tilenleft < 1) tilenleft = 1;
2448
- if (tilenleft > numTilesAtLevelX) tilenleft = numTilesAtLevelX;
2449
- if (tilentop < 1) tilentop = 1;
2450
- if (tilentop > numTilesAtLevelY) tilentop = numTilesAtLevelY;
2451
- if (tilenright < 1) tilenright = 1;
2452
- if (tilenright > numTilesAtLevelX) tilenright = numTilesAtLevelX;
2560
+ if (tilenbottom < 1) {
2561
+ tilenbottom = 1;
2562
+ }
2563
+
2564
+ if (tilenbottom > numTilesAtLevelY) {
2565
+ tilenbottom = numTilesAtLevelY;
2566
+ }
2567
+
2568
+ if (tilenleft < 1) {
2569
+ tilenleft = 1;
2570
+ }
2571
+
2572
+ if (tilenleft > numTilesAtLevelX) {
2573
+ tilenleft = numTilesAtLevelX;
2574
+ }
2575
+
2576
+ if (tilentop < 1) {
2577
+ tilentop = 1;
2578
+ }
2579
+
2580
+ if (tilentop > numTilesAtLevelY) {
2581
+ tilentop = numTilesAtLevelY;
2582
+ }
2583
+
2584
+ if (tilenright < 1) {
2585
+ tilenright = 1;
2586
+ }
2587
+
2588
+ if (tilenright > numTilesAtLevelX) {
2589
+ tilenright = numTilesAtLevelX;
2590
+ }
2453
2591
 
2454
2592
  if (tilentop - tilenbottom > 20) {
2455
2593
  debug(exports.DebugType.Error, "Too many tiles in vertical " + (tilentop - tilenbottom));
@@ -2470,8 +2608,14 @@
2470
2608
 
2471
2609
  drawBGTiles(level);
2472
2610
  imagesToRender.sort(function (imageA, imageB) {
2473
- if (imageA.level < imageB.level) return -1;
2474
- if (imageA.level > imageB.level) return 1;
2611
+ if (imageA.level < imageB.level) {
2612
+ return -1;
2613
+ }
2614
+
2615
+ if (imageA.level > imageB.level) {
2616
+ return 1;
2617
+ }
2618
+
2475
2619
  return 0;
2476
2620
  });
2477
2621
 
@@ -2525,7 +2669,11 @@
2525
2669
 
2526
2670
  if (layer) {
2527
2671
  var legendURL = layer.legendGraphic;
2528
- if (!legendURL) return undefined; // For THREDDS WMS we need to add layers=
2672
+
2673
+ if (!legendURL) {
2674
+ return undefined;
2675
+ } // For THREDDS WMS we need to add layers=
2676
+
2529
2677
 
2530
2678
  if (!legendURL.includes('&layers=')) {
2531
2679
  legendURL += "&layers=" + URLEncode(layer.name) + "&";
@@ -2638,7 +2786,11 @@
2638
2786
  this.minute = parseInt(minute, 10);
2639
2787
  this.second = parseInt(second, 10);
2640
2788
  this.isRegularInterval = false;
2641
- if (this.month === 0 && this.year === 0) this.isRegularInterval = true;
2789
+
2790
+ if (this.month === 0 && this.year === 0) {
2791
+ this.isRegularInterval = true;
2792
+ }
2793
+
2642
2794
  this.getTime = this.getTime.bind(this);
2643
2795
  this.toISO8601 = this.toISO8601.bind(this);
2644
2796
  }
@@ -2648,8 +2800,14 @@
2648
2800
  /* Months and years are unequally distributed in time
2649
2801
  So get time is not possible */
2650
2802
 
2651
- if (this.month !== 0) throw new Error('month !== 0');
2652
- if (this.year !== 0) throw new Error('year !== 0');
2803
+ if (this.month !== 0) {
2804
+ throw new Error('month !== 0');
2805
+ }
2806
+
2807
+ if (this.year !== 0) {
2808
+ throw new Error('year !== 0');
2809
+ }
2810
+
2653
2811
  timeres += this.day * 60 * 60 * 24;
2654
2812
  timeres += this.hour * 60 * 60;
2655
2813
  timeres += this.minute * 60;
@@ -2660,17 +2818,35 @@
2660
2818
 
2661
2819
  DateInterval.prototype.toISO8601 = function () {
2662
2820
  var isoTime = 'P';
2663
- if (this.year !== 0) isoTime += this.year + "Y";
2664
- if (this.month !== 0) isoTime += this.month + "M";
2665
- if (this.day !== 0) isoTime += this.day + "D";
2821
+
2822
+ if (this.year !== 0) {
2823
+ isoTime += this.year + "Y";
2824
+ }
2825
+
2826
+ if (this.month !== 0) {
2827
+ isoTime += this.month + "M";
2828
+ }
2829
+
2830
+ if (this.day !== 0) {
2831
+ isoTime += this.day + "D";
2832
+ }
2666
2833
 
2667
2834
  if (this.hour !== 0 && this.minute !== 0 && this.second !== 0) {
2668
2835
  isoTime += 'T';
2669
2836
  }
2670
2837
 
2671
- if (this.hour !== 0) isoTime += this.hour + "H";
2672
- if (this.minute !== 0) isoTime += this.minute + "M";
2673
- if (this.second !== 0) isoTime += this.second + "S";
2838
+ if (this.hour !== 0) {
2839
+ isoTime += this.hour + "H";
2840
+ }
2841
+
2842
+ if (this.minute !== 0) {
2843
+ isoTime += this.minute + "M";
2844
+ }
2845
+
2846
+ if (this.second !== 0) {
2847
+ isoTime += this.second + "S";
2848
+ }
2849
+
2674
2850
  return isoTime;
2675
2851
  };
2676
2852
 
@@ -2720,16 +2896,29 @@
2720
2896
  */
2721
2897
  var makeISO8601StringFromFlexibleWMSDateString = function makeISO8601StringFromFlexibleWMSDateString(isoString) {
2722
2898
  // Datestring starting with a - token are not supported.
2723
- if (!isoString || isoString.startsWith('-')) return isoString;
2724
- if (isoString.length === 4) return isoString + "-01-01T00:00:00Z"; // YYYY
2899
+ if (!isoString || isoString.startsWith('-')) {
2900
+ return isoString;
2901
+ }
2902
+
2903
+ var trimmed = isoString.trim();
2904
+
2905
+ if (trimmed.length === 4) {
2906
+ return trimmed + "-01-01T00:00:00Z"; // YYYY
2907
+ }
2725
2908
 
2726
- if (isoString.length === 7) return isoString + "-01T00:00:00Z"; // YYYY-MM
2909
+ if (trimmed.length === 7) {
2910
+ return trimmed + "-01T00:00:00Z"; // YYYY-MM
2911
+ }
2727
2912
 
2728
- if (isoString.length === 10) return isoString + "T00:00:00Z"; // YYYY-MM-DD
2913
+ if (trimmed.length === 10) {
2914
+ return trimmed + "T00:00:00Z"; // YYYY-MM-DD
2915
+ }
2729
2916
 
2730
- if (isoString.length === 14) return isoString.slice(0, -1) + ":00:00Z"; // YYYY-MM-DDTHHZ
2917
+ if (trimmed.length === 14) {
2918
+ return trimmed.slice(0, -1) + ":00:00Z"; // YYYY-MM-DDTHHZ
2919
+ }
2731
2920
 
2732
- return isoString;
2921
+ return trimmed;
2733
2922
  };
2734
2923
 
2735
2924
  var isotime = makeISO8601StringFromFlexibleWMSDateString(unvalidatedIsotime);
@@ -2750,7 +2939,9 @@
2750
2939
  var date = new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds));
2751
2940
 
2752
2941
  date.add = function (dateInterval) {
2753
- if (!dateInterval) return;
2942
+ if (!dateInterval) {
2943
+ return;
2944
+ }
2754
2945
 
2755
2946
  if (dateInterval.isRegularInterval === false) {
2756
2947
  if (dateInterval.year !== 0) {
@@ -2782,7 +2973,9 @@
2782
2973
  };
2783
2974
 
2784
2975
  date.substract = function (dateInterval) {
2785
- if (!dateInterval) return;
2976
+ if (!dateInterval) {
2977
+ return;
2978
+ }
2786
2979
 
2787
2980
  if (dateInterval.isRegularInterval === false) {
2788
2981
  if (dateInterval.year !== 0) {
@@ -2814,7 +3007,9 @@
2814
3007
  };
2815
3008
 
2816
3009
  date.addMultipleTimes = function (dateInterval, numberOfSteps) {
2817
- if (!dateInterval) return;
3010
+ if (!dateInterval) {
3011
+ return;
3012
+ }
2818
3013
 
2819
3014
  if (dateInterval.isRegularInterval === false) {
2820
3015
  if (dateInterval.year !== 0) {
@@ -2846,7 +3041,9 @@
2846
3041
  };
2847
3042
 
2848
3043
  date.substractMultipleTimes = function (dateInterval, numberOfSteps) {
2849
- if (!dateInterval) return;
3044
+ if (!dateInterval) {
3045
+ return;
3046
+ }
2850
3047
 
2851
3048
  if (dateInterval.isRegularInterval === false) {
2852
3049
  if (dateInterval.year !== 0) {
@@ -2909,8 +3106,17 @@
2909
3106
 
2910
3107
  /** ****************************************************** */
2911
3108
 
2912
- var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInterval(isotime) {
2913
- if (!isotime || isotime.charAt(0) !== 'P') return undefined;
3109
+ var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInterval(_isotime) {
3110
+ if (!_isotime) {
3111
+ return undefined;
3112
+ }
3113
+
3114
+ var isotime = _isotime.trim();
3115
+
3116
+ if (isotime.charAt(0) !== 'P') {
3117
+ return undefined;
3118
+ }
3119
+
2914
3120
  var splittedOnT = isotime.split('T');
2915
3121
  var years = '0';
2916
3122
  var months = '0';
@@ -2935,7 +3141,11 @@
2935
3141
 
2936
3142
  if (dayIndex !== -1) {
2937
3143
  var start = yearIndex;
2938
- if (monthIndex !== -1) start = monthIndex;
3144
+
3145
+ if (monthIndex !== -1) {
3146
+ start = monthIndex;
3147
+ }
3148
+
2939
3149
  days = YYYYMMDDPart.substring(start + 1, dayIndex);
2940
3150
  }
2941
3151
  } // parse the right part
@@ -2960,7 +3170,11 @@
2960
3170
 
2961
3171
  if (secondIndex !== -1) {
2962
3172
  var start = hourIndex;
2963
- if (minuteIndex !== -1) start = minuteIndex;
3173
+
3174
+ if (minuteIndex !== -1) {
3175
+ start = minuteIndex;
3176
+ }
3177
+
2964
3178
  seconds = HHMMSSPart.substring(start + 1, secondIndex);
2965
3179
  }
2966
3180
  }
@@ -2978,7 +3192,10 @@
2978
3192
  /** ******************************************************* */
2979
3193
 
2980
3194
  function getNumberOfTimeSteps(starttime, stoptime, interval) {
2981
- if (!starttime || !stoptime || !interval) return undefined;
3195
+ if (!starttime || !stoptime || !interval) {
3196
+ return undefined;
3197
+ }
3198
+
2982
3199
  var steps = 0;
2983
3200
 
2984
3201
  if (interval.month !== 0 || interval.year !== 0) {
@@ -3009,7 +3226,9 @@
3009
3226
  this.initialized = false;
3010
3227
  var times = isoTimeRangeDuration.split('/'); // Some safety checks
3011
3228
 
3012
- if (times[2] === undefined) times[2] = 'PT1M';
3229
+ if (times[2] === undefined) {
3230
+ times[2] = 'PT1M';
3231
+ }
3013
3232
 
3014
3233
  if (times[1] === undefined) {
3015
3234
  // eslint-disable-next-line prefer-destructuring
@@ -3116,7 +3335,10 @@
3116
3335
  return this.timeSteps - 1;
3117
3336
  }
3118
3337
 
3119
- if (currentDateTime > this.stopTime.getTime()) return this.timeSteps - 1;
3338
+ if (currentDateTime > this.stopTime.getTime()) {
3339
+ return this.timeSteps - 1;
3340
+ }
3341
+
3120
3342
  var timeStep = 0;
3121
3343
 
3122
3344
  if (this.timeInterval.isRegularInterval === false) {
@@ -3309,28 +3531,32 @@
3309
3531
  /* 1. Get the last value in the list of the referencetime */
3310
3532
 
3311
3533
 
3312
- var lastRefTimeAsMoment = moment__default["default"].utc(referenceTimeDim.getLastValue());
3534
+ var lastRefTime = new Date(referenceTimeDim.getLastValue());
3313
3535
  /* 2. Get the original last value of the time dimension, we cannot use this.getLastValue(), as we are changing this. */
3314
3536
 
3315
- var timeLastValueAsMoment = moment__default["default"].utc(this.values.split('/')[1]);
3537
+ var orgLastDimTime = new Date(this.values.split('/')[1]);
3316
3538
  /* 3. Now calculate the run length */
3317
3539
 
3318
- var runLengthAsHour = moment__default["default"].duration(timeLastValueAsMoment.clone().diff(lastRefTimeAsMoment)).asHours();
3319
- var newStartValueTimeAsMoment = moment__default["default"].utc(referenceTimeValueToSet);
3320
- var newEndValueTimeAsMoment = newStartValueTimeAsMoment.clone().add(runLengthAsHour, 'h');
3540
+ var runLengthAsHour = shared.dateUtils.differenceInHours(orgLastDimTime, lastRefTime);
3541
+ var newStartValueTime = new Date(referenceTimeValueToSet);
3542
+ var newEndValueTime = shared.dateUtils.add(new Date(newStartValueTime.getTime()), {
3543
+ hours: runLengthAsHour
3544
+ });
3321
3545
 
3322
3546
  if (this._type === 'timestartstopres') {
3323
3547
  /* Compose a new dataString interval and re-initialize the time dimension */
3324
- var dateStringItems = this.values.split('/');
3548
+ var dateStringItems = this.values.split('/').map(function (value) {
3549
+ return value.trim();
3550
+ });
3325
3551
  var dateStringInterval = dateStringItems[2];
3326
- var newValue = newStartValueTimeAsMoment.toISOString() + "/" + newEndValueTimeAsMoment.toISOString() + "/" + dateStringInterval;
3327
- this.defaultValue = newEndValueTimeAsMoment.toISOString();
3552
+ var newValue = newStartValueTime.toISOString() + "/" + newEndValueTime.toISOString() + "/" + dateStringInterval;
3553
+ this.defaultValue = newEndValueTime.toISOString();
3328
3554
  this.reInitializeValues(newValue, true);
3329
3555
  } else if (this._type === 'timevalues') {
3330
3556
  /* Filter all dates from the array which are lower than given start value */
3331
3557
 
3332
3558
  /* TODO: Maarten Plieger 2020-06-10: Make this also work for WMS times advertised as a comma separated list */
3333
- var newValue_1 = parseISO8601DateToDate(newStartValueTimeAsMoment.toISOString());
3559
+ var newValue_1 = parseISO8601DateToDate(newStartValueTime.toISOString());
3334
3560
 
3335
3561
  var newArray = this._allDates.filter(function (x) {
3336
3562
  return x >= newValue_1;
@@ -3339,7 +3565,10 @@
3339
3565
  var newValues = '';
3340
3566
 
3341
3567
  for (var j = 0; j < newArray.length; j += 1) {
3342
- if (j > 0) newValues += ',';
3568
+ if (j > 0) {
3569
+ newValues += ',';
3570
+ }
3571
+
3343
3572
  newValues += newArray[j].toISO8601();
3344
3573
  }
3345
3574
 
@@ -3366,14 +3595,20 @@
3366
3595
  forceReferenceTimeValue = false;
3367
3596
  }
3368
3597
 
3369
- if (this._initialized === true) return;
3598
+ if (this._initialized === true) {
3599
+ return;
3600
+ }
3601
+
3370
3602
  var ogcdimvalues = this.values;
3371
3603
 
3372
3604
  if (forceothervalues) {
3373
3605
  ogcdimvalues = forceothervalues;
3374
3606
  }
3375
3607
 
3376
- if (!isDefined(ogcdimvalues)) return;
3608
+ if (!isDefined(ogcdimvalues)) {
3609
+ return;
3610
+ }
3611
+
3377
3612
  this._allValues = [];
3378
3613
  this._initialized = true;
3379
3614
 
@@ -3394,10 +3629,14 @@
3394
3629
  var values = ogcdimvalues.split(',');
3395
3630
 
3396
3631
  for (var j = 0; j < values.length; j += 1) {
3397
- var valuesRanged = values[j].split('/');
3632
+ var valuesRangedNoTrim = values[j].split('/');
3398
3633
 
3399
- if (valuesRanged.length === 3) {
3634
+ if (valuesRangedNoTrim.length === 3) {
3635
+ var valuesRanged = valuesRangedNoTrim.map(function (value) {
3636
+ return value.trim();
3637
+ });
3400
3638
  /* Can be either time like '2021-03-17T06:00:00Z/2021-03-21T00:00:00Z/PT6H' or something else, like '0/24/2' */
3639
+
3401
3640
  if (valuesRanged[2].charAt(0) === 'P') {
3402
3641
  var partTimeRanges = new ParseISOTimeRangeDuration(values[j]);
3403
3642
 
@@ -3415,8 +3654,14 @@
3415
3654
  var stop_1 = parseFloat(valuesRanged[1]);
3416
3655
  var res = parseFloat(valuesRanged[2]);
3417
3656
  stop_1 += res;
3418
- if (start > stop_1) stop_1 = start;
3419
- if (res <= 0) res = 1;
3657
+
3658
+ if (start > stop_1) {
3659
+ stop_1 = start;
3660
+ }
3661
+
3662
+ if (res <= 0) {
3663
+ res = 1;
3664
+ }
3420
3665
 
3421
3666
  for (var j2 = start; j2 < stop_1; j2 += res) {
3422
3667
  this._allValues.push(String(j2));
@@ -3435,26 +3680,39 @@
3435
3680
  }
3436
3681
  }
3437
3682
  }
3683
+ /* If no default value is given, take the last / most recent one */
3684
+
3438
3685
 
3439
- if (!isDefined(this.defaultValue)) {
3440
- this.defaultValue = this.getValueForIndex(0);
3686
+ if (!isDefined(this.defaultValue) || this.defaultValue === '') {
3687
+ this.defaultValue = this.getLastValue();
3688
+ }
3689
+ /* Check if the string 'current' is given, and find the closest value inside the dimension */
3690
+
3691
+
3692
+ if (this.defaultValue === 'current') {
3693
+ this.defaultValue = this.getClosestValue(moment__default["default"]().utc().format('YYYY-MM-DDTHH:mm:ss[Z]'), true);
3441
3694
  }
3442
3695
  /* If no currentvalue is set, set the default */
3443
3696
 
3444
3697
 
3445
- if (!isDefined(this.currentValue)) {
3446
- this.currentValue = this.getFirstValue();
3698
+ if (!this.currentValue || this.currentValue.length === 0) {
3699
+ this.currentValue = this.defaultValue;
3447
3700
  }
3448
3701
  /* Check for out of range values and adjust accordingly to a valid range */
3449
3702
 
3450
3703
 
3451
3704
  var index = this.getIndexForValue(this.currentValue);
3452
- if (index === -2) this.currentValue = this.getLastValue(); // Date is past the latest (-2), so set it to the last value
3453
3705
 
3454
- if (index === -1) this.currentValue = this.getFirstValue(); // Date is past the first (-1), so set it to the first value
3706
+ if (index === -2) {
3707
+ this.currentValue = this.getLastValue(); // Date is past the latest (-2), so set it to the last value
3708
+ }
3455
3709
 
3710
+ if (index === -1) {
3711
+ this.currentValue = this.getFirstValue(); // Date is past the first (-1), so set it to the first value
3712
+ }
3456
3713
  /* In case of reference time, the time dimension range is changed, check if the current time still fits in that range */
3457
3714
 
3715
+
3458
3716
  if (forceReferenceTimeValue) {
3459
3717
  if (this.getIndexForValue(this.currentValue, true) < 0) {
3460
3718
  this.currentValue = this.getClosestValue(this.currentValue);
@@ -3605,7 +3863,11 @@
3605
3863
 
3606
3864
  if (newValue === 'middle') {
3607
3865
  var middleIndex = Math.ceil(this.size() / 2) - 1;
3608
- if (middleIndex < 0) middleIndex = 0;
3866
+
3867
+ if (middleIndex < 0) {
3868
+ middleIndex = 0;
3869
+ }
3870
+
3609
3871
  return this.getValueForIndex(middleIndex);
3610
3872
  }
3611
3873
 
@@ -3625,7 +3887,11 @@
3625
3887
  value = this.getValueForIndex(index);
3626
3888
  } catch (e) {
3627
3889
  if (typeof e.message === 'number') {
3628
- if (e.message === 0) value = WMDateTooEarlyString;else value = WMDateTooLateString;
3890
+ if (e.message === 0) {
3891
+ value = WMDateTooEarlyString;
3892
+ } else {
3893
+ value = WMDateTooLateString;
3894
+ }
3629
3895
  }
3630
3896
  }
3631
3897
 
@@ -3666,8 +3932,14 @@
3666
3932
  return this._timeRangeDurationDate.getDateAtTimeStep(index);
3667
3933
  }
3668
3934
 
3669
- if (this._type === 'timevalues') return this._allValues[index];
3670
- if (this._type === 'anyvalue') return this._allValues[index];
3935
+ if (this._type === 'timevalues') {
3936
+ return this._allValues[index];
3937
+ }
3938
+
3939
+ if (this._type === 'anyvalue') {
3940
+ return this._allValues[index];
3941
+ }
3942
+
3671
3943
  return null;
3672
3944
  };
3673
3945
  /**
@@ -3678,7 +3950,11 @@
3678
3950
 
3679
3951
  WMJSDimension.prototype.getDimInterval = function () {
3680
3952
  this.initialize();
3681
- if (!this.dimTimeInterval) return undefined;
3953
+
3954
+ if (!this.dimTimeInterval) {
3955
+ return undefined;
3956
+ }
3957
+
3682
3958
  var _a = this.dimTimeInterval,
3683
3959
  year = _a.year,
3684
3960
  month = _a.month,
@@ -3751,7 +4027,10 @@
3751
4027
 
3752
4028
  return this._timeRangeDurationDate.getTimeStepFromDate(value, outSideOfRangeFlag);
3753
4029
  } catch (e) {
3754
- if (parseInt(e.message, 10) === 0) return -1;
4030
+ if (parseInt(e.message, 10) === 0) {
4031
+ return -1;
4032
+ }
4033
+
3755
4034
  return -2;
3756
4035
  }
3757
4036
  }
@@ -3759,7 +4038,7 @@
3759
4038
  if (this._type === 'timevalues') {
3760
4039
  try {
3761
4040
  var dateToFind = parseISO8601DateToDate(value).getTime();
3762
- var minDistance = void 0;
4041
+ var minDistance = null;
3763
4042
  var foundIndex = 0;
3764
4043
  var minTime = null;
3765
4044
  var maxTime = null;
@@ -3767,11 +4046,23 @@
3767
4046
  for (var j = 0; j < this._allValues.length; j += 1) {
3768
4047
  var time = this._allDates[j].getTime();
3769
4048
 
3770
- if (time < minTime || minTime === null) minTime = time;
3771
- if (time > maxTime || maxTime === null) maxTime = time;
4049
+ if (time < minTime || minTime === null) {
4050
+ minTime = time;
4051
+ }
4052
+
4053
+ if (time > maxTime || maxTime === null) {
4054
+ maxTime = time;
4055
+ }
4056
+
3772
4057
  var distance = time - dateToFind;
3773
- if (distance < 0) distance = -distance;
3774
- if (j === 0) minDistance = distance;
4058
+
4059
+ if (distance < 0) {
4060
+ distance = -distance;
4061
+ }
4062
+
4063
+ if (j === 0) {
4064
+ minDistance = distance;
4065
+ }
3775
4066
 
3776
4067
  if (distance < minDistance) {
3777
4068
  minDistance = distance;
@@ -3780,8 +4071,13 @@
3780
4071
  }
3781
4072
 
3782
4073
  if (outSideOfRangeFlag) {
3783
- if (minTime > dateToFind) return -1;
3784
- if (maxTime < dateToFind) return -2;
4074
+ if (minTime > dateToFind) {
4075
+ return -1;
4076
+ }
4077
+
4078
+ if (maxTime < dateToFind) {
4079
+ return -2;
4080
+ }
3785
4081
  }
3786
4082
 
3787
4083
  return foundIndex;
@@ -3793,7 +4089,9 @@
3793
4089
 
3794
4090
  if (this._type === 'anyvalue') {
3795
4091
  for (var j = 0; j < this._allValues.length; j += 1) {
3796
- if (this._allValues[j] === value) return j;
4092
+ if (this._allValues[j] === value) {
4093
+ return j;
4094
+ }
3797
4095
  }
3798
4096
  }
3799
4097
 
@@ -3921,7 +4219,9 @@
3921
4219
  };
3922
4220
 
3923
4221
  this.repositionMapPin = function (_bbox) {
3924
- if (!_bbox) return;
4222
+ if (!_bbox) {
4223
+ return;
4224
+ }
3925
4225
 
3926
4226
  var newpos = _this._map.getPixelCoordFromGeoCoord({
3927
4227
  x: _this.geoPosX,
@@ -3934,8 +4234,14 @@
3934
4234
  this.setMapPin = function (_x, _y, _bbox) {
3935
4235
  var x = _x;
3936
4236
  var y = _y;
3937
- if (!x || !y) return;
3938
- if (_this.disableMapPin && !_bbox) return; // we still want to update the pin position when the bbox changes.
4237
+
4238
+ if (!x || !y) {
4239
+ return;
4240
+ }
4241
+
4242
+ if (_this.disableMapPin && !_bbox) {
4243
+ return; // we still want to update the pin position when the bbox changes.
4244
+ }
3939
4245
 
3940
4246
  _this.x = parseInt(x, 10);
3941
4247
  _this.y = parseInt(y, 10);
@@ -4044,10 +4350,13 @@
4044
4350
  }; // Build a valid WMS request for a certain layer
4045
4351
 
4046
4352
  var buildWMSGetMapRequest = function buildWMSGetMapRequest(map, layer) {
4047
- if (!isDefined(layer.name)) return {
4048
- url: undefined,
4049
- headers: null
4050
- };
4353
+ if (!isDefined(layer.name)) {
4354
+ return {
4355
+ url: undefined,
4356
+ headers: null
4357
+ };
4358
+ }
4359
+
4051
4360
  var srs = map.getProjection().srs;
4052
4361
  var mapBbox = map.getDrawBBOX();
4053
4362
 
@@ -4059,10 +4368,13 @@
4059
4368
  layer.format = 'image/png';
4060
4369
  }
4061
4370
 
4062
- if (layer.name.length < 1) return {
4063
- url: undefined,
4064
- headers: null
4065
- }; // GetFeatureInfo timeseries in the mapview
4371
+ if (layer.name.length < 1) {
4372
+ return {
4373
+ url: undefined,
4374
+ headers: null
4375
+ };
4376
+ } // GetFeatureInfo timeseries in the mapview
4377
+
4066
4378
 
4067
4379
  if (srs === 'GFI:TIME_ELEVATION') {
4068
4380
  var x = 707;
@@ -4172,8 +4484,10 @@
4172
4484
  * */
4173
4485
  var SCALE_DELAY = 10;
4174
4486
  var ZOOMED_CALLBACK_DELAY = 500;
4487
+ var THROTTLE_OPTIONS = {
4488
+ noTrailing: true
4489
+ };
4175
4490
  var THROTTLE_WAIT_TIME = 300;
4176
- var THROTTLE_NO_TRAILING = true;
4177
4491
 
4178
4492
  var WMFlyToBBox =
4179
4493
  /** @class */
@@ -4183,7 +4497,6 @@
4183
4497
 
4184
4498
  this.flyZoomToBBOXTimerStart = 1;
4185
4499
  this.flyZoomToBBOXTimerSteps = 5;
4186
- this.flyZoomToBBOXDebounced = throttleDebounce.debounce;
4187
4500
  this.flyZoomToBBOXScaler = 0;
4188
4501
  this.flyZoomToBBOXCurrent = new WMBBOX();
4189
4502
  this.flyZoomToBBOXFly = new WMBBOX();
@@ -4276,9 +4589,9 @@
4276
4589
  }
4277
4590
  };
4278
4591
 
4279
- this.startZoomThrottled = throttleDebounce.throttle(THROTTLE_WAIT_TIME, THROTTLE_NO_TRAILING, function (currentbox, newbox) {
4280
- return _this.flyZoomToBBOXStartZoom(currentbox, newbox);
4281
- });
4592
+ this.startZoomThrottled = throttleDebounce.throttle(THROTTLE_WAIT_TIME, function (currentbox, newbox) {
4593
+ _this.flyZoomToBBOXStartZoom(currentbox, newbox);
4594
+ }, THROTTLE_OPTIONS);
4282
4595
 
4283
4596
  this.flyZoomToBBOXStartZoomThrottled = function (currentbox, newbox) {
4284
4597
  _this.startZoomThrottled(currentbox, newbox);
@@ -4303,7 +4616,6 @@
4303
4616
  var bgMapImageStore = new WMImageStore(bgImageStoreLength, {
4304
4617
  id: 'bgMapImageStore'
4305
4618
  });
4306
-
4307
4619
  var detectLeftButton = function detectLeftButton(evt) {
4308
4620
  if (evt.buttons) {
4309
4621
  return evt.buttons === 1;
@@ -4465,7 +4777,6 @@
4465
4777
  /* pan,zoom,zoomout,info */
4466
4778
 
4467
4779
  this.numGetFeatureInfoRequests = 0;
4468
- this.getFeatureInfoResult = [];
4469
4780
  this.oldMapMode = undefined;
4470
4781
  this.InValidMouseAction = 0;
4471
4782
  this.resizingBBOXCursor = '';
@@ -4481,7 +4792,11 @@
4481
4792
  this.proj4.srs = 'empty';
4482
4793
  this.proj4.projection = undefined;
4483
4794
  this.longlat = 'EPSG:4326';
4484
- if (proj4__default["default"]) proj4__default["default"].defs(WMProj4Defs);
4795
+
4796
+ if (proj4__default["default"]) {
4797
+ proj4__default["default"].defs(WMProj4Defs);
4798
+ }
4799
+
4485
4800
  this.previousMouseButtonState = 'up';
4486
4801
  /* Binds */
4487
4802
 
@@ -4520,7 +4835,6 @@
4520
4835
  this.setSize = this.setSize.bind(this);
4521
4836
  this._setSize = this._setSize.bind(this);
4522
4837
  this.abort = this.abort.bind(this);
4523
- this.isBusy = this.isBusy.bind(this);
4524
4838
  this._makeInfoHTML = this._makeInfoHTML.bind(this);
4525
4839
  this.showScaleBar = this.showScaleBar.bind(this);
4526
4840
  this.hideScaleBar = this.hideScaleBar.bind(this);
@@ -4808,30 +5122,52 @@
4808
5122
  do {
4809
5123
  numMapUnits *= 10.0;
4810
5124
  divFactor = a / numMapUnits;
4811
- if (divFactor === 0) return undefined;
5125
+
5126
+ if (divFactor === 0) {
5127
+ return undefined;
5128
+ }
5129
+
4812
5130
  realWidth = desiredWidth / divFactor;
4813
5131
  } while (realWidth < desiredWidth);
4814
5132
 
4815
5133
  do {
4816
5134
  numMapUnits /= 2.0;
4817
5135
  divFactor = a / numMapUnits;
4818
- if (divFactor === 0) return undefined;
5136
+
5137
+ if (divFactor === 0) {
5138
+ return undefined;
5139
+ }
5140
+
4819
5141
  realWidth = desiredWidth / divFactor;
4820
5142
  } while (realWidth > desiredWidth);
4821
5143
 
4822
5144
  do {
4823
5145
  numMapUnits *= 1.2;
4824
5146
  divFactor = a / numMapUnits;
4825
- if (divFactor === 0) return undefined;
5147
+
5148
+ if (divFactor === 0) {
5149
+ return undefined;
5150
+ }
5151
+
4826
5152
  realWidth = desiredWidth / divFactor;
4827
5153
  } while (realWidth < desiredWidth);
4828
5154
 
4829
5155
  var roundedMapUnits = numMapUnits;
4830
5156
  var d = Math.pow(10, Math.round(Math.log10(numMapUnits) + 0.5) - 1);
4831
5157
  roundedMapUnits = Math.round(roundedMapUnits / d);
4832
- if (roundedMapUnits < 2.5) roundedMapUnits = 2.5;
4833
- if (roundedMapUnits > 2.5 && roundedMapUnits < 7.5) roundedMapUnits = 5;
4834
- if (roundedMapUnits > 7.5) roundedMapUnits = 10;
5158
+
5159
+ if (roundedMapUnits < 2.5) {
5160
+ roundedMapUnits = 2.5;
5161
+ }
5162
+
5163
+ if (roundedMapUnits > 2.5 && roundedMapUnits < 7.5) {
5164
+ roundedMapUnits = 5;
5165
+ }
5166
+
5167
+ if (roundedMapUnits > 7.5) {
5168
+ roundedMapUnits = 10;
5169
+ }
5170
+
4835
5171
  roundedMapUnits *= d;
4836
5172
  divFactor = desiredWidth / pixelsPerUnit / roundedMapUnits;
4837
5173
  realWidth = desiredWidth / divFactor;
@@ -4876,15 +5212,42 @@
4876
5212
  ctx.moveTo(offsetX + scaleBarProps.width * 2 + 1, scaleBarHeight - 2 + offsetY);
4877
5213
  ctx.lineTo(offsetX + scaleBarProps.width * 2 + 1, scaleBarHeight - 2 - 7 + offsetY);
4878
5214
  var units = '';
4879
- if (this.srs === 'EPSG:3411') units = 'meter';
4880
- if (this.srs === 'EPSG:3412') units = 'meter';
4881
- if (this.srs === 'EPSG:3575') units = 'meter';
4882
- if (this.srs === 'EPSG:4326') units = 'degrees';
4883
- if (this.srs === 'EPSG:28992') units = 'meter';
4884
- if (this.srs === 'EPSG:32661') units = 'meter';
4885
- if (this.srs === 'EPSG:3857') units = 'meter';
4886
- if (this.srs === 'EPSG:900913') units = 'meter';
4887
- if (this.srs === 'EPSG:102100') units = 'meter';
5215
+
5216
+ if (this.srs === 'EPSG:3411') {
5217
+ units = 'meter';
5218
+ }
5219
+
5220
+ if (this.srs === 'EPSG:3412') {
5221
+ units = 'meter';
5222
+ }
5223
+
5224
+ if (this.srs === 'EPSG:3575') {
5225
+ units = 'meter';
5226
+ }
5227
+
5228
+ if (this.srs === 'EPSG:4326') {
5229
+ units = 'degrees';
5230
+ }
5231
+
5232
+ if (this.srs === 'EPSG:28992') {
5233
+ units = 'meter';
5234
+ }
5235
+
5236
+ if (this.srs === 'EPSG:32661') {
5237
+ units = 'meter';
5238
+ }
5239
+
5240
+ if (this.srs === 'EPSG:3857') {
5241
+ units = 'meter';
5242
+ }
5243
+
5244
+ if (this.srs === 'EPSG:900913') {
5245
+ units = 'meter';
5246
+ }
5247
+
5248
+ if (this.srs === 'EPSG:102100') {
5249
+ units = 'meter';
5250
+ }
4888
5251
 
4889
5252
  if (units === 'meter') {
4890
5253
  if (scaleBarProps.mapunits > 1000) {
@@ -4910,7 +5273,11 @@
4910
5273
 
4911
5274
  if (isDefined(this.mouseGeoCoordXY)) {
4912
5275
  var roundingFactor = 1.0 / Math.pow(10, parseInt(Math.log((this.bbox.right - this.bbox.left) / this.width) / Math.log(10), 10) - 2);
4913
- if (roundingFactor < 1) roundingFactor = 1;
5276
+
5277
+ if (roundingFactor < 1) {
5278
+ roundingFactor = 1;
5279
+ }
5280
+
4914
5281
  ctx.fillStyle = '#000000';
4915
5282
  var xText = Math.round(this.mouseGeoCoordXY.x * roundingFactor) / roundingFactor;
4916
5283
  var yText = Math.round(this.mouseGeoCoordXY.y * roundingFactor) / roundingFactor;
@@ -5105,32 +5472,18 @@
5105
5472
  };
5106
5473
 
5107
5474
  WMJSMap.prototype.rebuildMapDimensions = function () {
5108
- for (var j = 0; j < this.mapdimensions.length; j += 1) {
5109
- this.mapdimensions[j].used = false;
5110
- }
5111
-
5112
5475
  for (var i = 0; i < this.layers.length; i += 1) {
5113
5476
  for (var j = 0; j < this.layers[i].dimensions.length; j += 1) {
5114
5477
  var dim = this.layers[i].dimensions[j];
5115
5478
  var mapdim = this.getDimension(dim.name);
5116
5479
 
5117
- if (isDefined(mapdim)) {
5118
- mapdim.used = true;
5119
- } else {
5480
+ if (!isDefined(mapdim)) {
5120
5481
  var newdim = dim.clone();
5121
- newdim.used = true;
5122
5482
  this.mapdimensions.push(newdim);
5123
5483
  }
5124
5484
  }
5125
5485
  }
5126
5486
 
5127
- for (var j = 0; j < this.mapdimensions.length; j += 1) {
5128
- if (this.mapdimensions[j].used === false) {
5129
- this.mapdimensions.splice(j, 1);
5130
- j -= 1;
5131
- }
5132
- }
5133
-
5134
5487
  this.callBack.triggerEvent('onmapdimupdate');
5135
5488
  };
5136
5489
 
@@ -5212,7 +5565,9 @@
5212
5565
  WMJSMap.prototype.toggleLayer = function (layer) {
5213
5566
  if (layer.enabled === true) {
5214
5567
  layer.enabled = false;
5215
- } else layer.enabled = true;
5568
+ } else {
5569
+ layer.enabled = true;
5570
+ }
5216
5571
 
5217
5572
  this.calculateNumBaseLayers();
5218
5573
  this.rebuildMapDimensions();
@@ -5225,7 +5580,9 @@
5225
5580
  };
5226
5581
 
5227
5582
  WMJSMap.prototype._getLayerIndex = function (layer) {
5228
- if (!layer) return undefined;
5583
+ if (!layer) {
5584
+ return undefined;
5585
+ }
5229
5586
 
5230
5587
  for (var j = 0; j < this.layers.length; j += 1) {
5231
5588
  if (this.layers[j] === layer) {
@@ -5247,7 +5604,10 @@
5247
5604
  };
5248
5605
 
5249
5606
  WMJSMap.prototype.deleteLayer = function (layerToDelete) {
5250
- if (this.layers.length <= 0) return;
5607
+ if (this.layers.length <= 0) {
5608
+ return;
5609
+ }
5610
+
5251
5611
  layerToDelete.setAutoUpdate(false);
5252
5612
 
5253
5613
  var layerIndex = this._getLayerIndex(layerToDelete);
@@ -5398,14 +5758,18 @@
5398
5758
 
5399
5759
 
5400
5760
  WMJSMap.prototype.setProjection = function (_srs, _bbox) {
5401
- if (!_srs) _srs = 'EPSG:4326';
5761
+ if (!_srs) {
5762
+ _srs = 'EPSG:4326';
5763
+ }
5402
5764
 
5403
5765
  if (_typeof(_srs) === 'object') {
5404
5766
  _bbox = _srs.bbox;
5405
5767
  _srs = _srs.srs;
5406
5768
  }
5407
5769
 
5408
- if (!_srs) _srs = 'EPSG:4326';
5770
+ if (!_srs) {
5771
+ _srs = 'EPSG:4326';
5772
+ }
5409
5773
 
5410
5774
  if (this.srs !== _srs) {
5411
5775
  this.defaultBBOX.setBBOX(_bbox);
@@ -5498,7 +5862,9 @@
5498
5862
  };
5499
5863
 
5500
5864
  WMJSMap.prototype._setSize = function (w, h) {
5501
- if (!w || !h) return;
5865
+ if (!w || !h) {
5866
+ return;
5867
+ }
5502
5868
 
5503
5869
  if (w < 4 || h < 4) {
5504
5870
  return;
@@ -5508,8 +5874,14 @@
5508
5874
  var projinfo = this.getProjection();
5509
5875
  this.width = w;
5510
5876
  this.height = h;
5511
- if (this.width < 4 || isNaN(this.width)) this.width = 4;
5512
- if (this.height < 4 || isNaN(this.height)) this.height = 4;
5877
+
5878
+ if (this.width < 4 || isNaN(this.width)) {
5879
+ this.width = 4;
5880
+ }
5881
+
5882
+ if (this.height < 4 || isNaN(this.height)) {
5883
+ this.height = 4;
5884
+ }
5513
5885
 
5514
5886
  if (!projinfo.srs || !projinfo.bbox) {
5515
5887
  debug(exports.DebugType.Error, 'WebMapJS: this.setSize: Setting default projection (EPSG:4326 with (-180,-90,180,90)');
@@ -5521,12 +5893,19 @@
5521
5893
  this.setProjection(projinfo.srs, projinfo.bbox);
5522
5894
  }
5523
5895
 
5524
- if (!this.baseDiv || !this.baseDiv.style) return;
5896
+ if (!this.baseDiv || !this.baseDiv.style) {
5897
+ return;
5898
+ }
5899
+
5525
5900
  Object.assign(this.baseDiv.style, {
5526
5901
  width: this.width,
5527
5902
  height: this.height
5528
5903
  });
5529
- if (!this.mainElement || !this.mainElement.style) return;
5904
+
5905
+ if (!this.mainElement || !this.mainElement.style) {
5906
+ return;
5907
+ }
5908
+
5530
5909
  this.mainElement.style.width = this.width + "px";
5531
5910
  this.mainElement.style.height = this.height + "px";
5532
5911
  this.setBBOX(this.resizeBBOX);
@@ -5546,18 +5925,6 @@
5546
5925
  this.callBack.triggerEvent('onloadingcomplete');
5547
5926
  };
5548
5927
 
5549
- WMJSMap.prototype.isBusy = function () {
5550
- if (this.suspendDrawing === true || this.mapBusy || this.layersBusy === 1) {
5551
- return true;
5552
- }
5553
-
5554
- if (this.divBuffer[0].ready === false || this.divBuffer[1].ready === false) {
5555
- return true;
5556
- }
5557
-
5558
- return false;
5559
- };
5560
-
5561
5928
  WMJSMap.prototype._makeInfoHTML = function () {
5562
5929
  try {
5563
5930
  // Create the layerinformation table
@@ -5607,7 +5974,9 @@
5607
5974
  }
5608
5975
  }
5609
5976
 
5610
- if (foundDim === false) infoHTML += '<td>-</td>';
5977
+ if (foundDim === false) {
5978
+ infoHTML += '<td>-</td>';
5979
+ }
5611
5980
  }
5612
5981
 
5613
5982
  infoHTML += '</tr>';
@@ -5646,7 +6015,10 @@
5646
6015
  };
5647
6016
 
5648
6017
  WMJSMap.prototype.display = function () {
5649
- if (!this.divBuffer) return;
6018
+ if (!this.divBuffer) {
6019
+ return;
6020
+ }
6021
+
5650
6022
  this.divBuffer.display();
5651
6023
  this.drawnBBOX.setBBOX(this.bbox);
5652
6024
  };
@@ -5656,10 +6028,6 @@
5656
6028
  };
5657
6029
 
5658
6030
  WMJSMap.prototype.draw = function (animationList) {
5659
- if (animationList === void 0) {
5660
- animationList = {};
5661
- }
5662
-
5663
6031
  if (this.isDestroyed) {
5664
6032
  return;
5665
6033
  }
@@ -5680,7 +6048,6 @@
5680
6048
  /**
5681
6049
  * API Function called to draw the layers, fires getmap request and shows the layers on the screen
5682
6050
  */
5683
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5684
6051
 
5685
6052
 
5686
6053
  WMJSMap.prototype._draw = function (animationList) {
@@ -5697,8 +6064,7 @@
5697
6064
  this.needsRedraw = false;
5698
6065
  this.draw(this._animationList);
5699
6066
  }
5700
- }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
5701
-
6067
+ };
5702
6068
 
5703
6069
  WMJSMap.prototype._drawAndLoad = function (animationList) {
5704
6070
  if (this.width < 4 || this.height < 4) {
@@ -5855,9 +6221,16 @@
5855
6221
  triggerEvent = true;
5856
6222
  }
5857
6223
 
5858
- if (!this.divBuffer) return;
6224
+ if (!this.divBuffer) {
6225
+ return;
6226
+ }
6227
+
5859
6228
  var mapbbox = this.bbox;
5860
- if (isDefined(_mapbbox)) mapbbox = _mapbbox;
6229
+
6230
+ if (isDefined(_mapbbox)) {
6231
+ mapbbox = _mapbbox;
6232
+ }
6233
+
5861
6234
  this.updateBBOX.setBBOX(mapbbox);
5862
6235
  this.divBuffer.setBBOX(this.updateBBOX, this.drawnBBOX);
5863
6236
  this.drawnBBOX.setBBOX(mapbbox);
@@ -5888,7 +6261,9 @@
5888
6261
  }
5889
6262
 
5890
6263
  this.callBack.triggerEvent('onlayeradd');
5891
- } else this.baseLayers = undefined;
6264
+ } else {
6265
+ this.baseLayers = undefined;
6266
+ }
5892
6267
  };
5893
6268
 
5894
6269
  WMJSMap.prototype.setBaseLayers = function (layer) {
@@ -5905,7 +6280,9 @@
5905
6280
  }
5906
6281
 
5907
6282
  this.callBack.triggerEvent('onlayerchange');
5908
- } else this.baseLayers = undefined;
6283
+ } else {
6284
+ this.baseLayers = undefined;
6285
+ }
5909
6286
  };
5910
6287
 
5911
6288
  WMJSMap.prototype.getBaseLayers = function () {
@@ -5922,7 +6299,10 @@
5922
6299
 
5923
6300
  WMJSMap.prototype.mouseWheelEvent = function (event) {
5924
6301
  preventdefaultEvent(event);
5925
- if (this.mouseWheelBusy === 1) return;
6302
+
6303
+ if (this.mouseWheelBusy === 1) {
6304
+ return;
6305
+ }
5926
6306
 
5927
6307
  var _a = this.getMouseCoordinatesForDocument(event),
5928
6308
  x = _a.x,
@@ -5980,7 +6360,10 @@
5980
6360
  };
5981
6361
 
5982
6362
  WMJSMap.prototype.destroy = function () {
5983
- if (!this.initialized) return;
6363
+ if (!this.initialized) {
6364
+ return;
6365
+ }
6366
+
5984
6367
  this.stopAnimating();
5985
6368
 
5986
6369
  for (var i = this.layers.length - 1; i >= 0; i -= 1) {
@@ -6068,7 +6451,10 @@
6068
6451
  /* For invalid layers we cannot build an url */
6069
6452
 
6070
6453
 
6071
- if (!layer.name) return '';
6454
+ if (!layer.name) {
6455
+ return '';
6456
+ }
6457
+
6072
6458
  var request = WMJScheckURL(layer.service);
6073
6459
  request += "&SERVICE=WMS&REQUEST=GetFeatureInfo&VERSION=" + layer.version;
6074
6460
  request += "&LAYERS=" + URLEncode(layer.name);
@@ -6230,7 +6616,10 @@
6230
6616
  this.oldMapMode = undefined;
6231
6617
  }
6232
6618
  } else {
6233
- if (this.oldMapMode === undefined) this.oldMapMode = this.mapMode;
6619
+ if (this.oldMapMode === undefined) {
6620
+ this.oldMapMode = this.mapMode;
6621
+ }
6622
+
6234
6623
  this.mapMode = 'zoom';
6235
6624
  }
6236
6625
 
@@ -6418,10 +6807,21 @@
6418
6807
 
6419
6808
  if (foundBBOXRib === true || this.resizingBBOXEnabled !== '' && this.mouseDownPressed === 1) {
6420
6809
  if (this.mouseDownPressed === 1) {
6421
- if (this.resizingBBOXEnabled === 'left') tlpx.x = this.mouseX;
6422
- if (this.resizingBBOXEnabled === 'top') tlpx.y = this.mouseY;
6423
- if (this.resizingBBOXEnabled === 'right') brpx.x = this.mouseX;
6424
- if (this.resizingBBOXEnabled === 'bottom') brpx.y = this.mouseY;
6810
+ if (this.resizingBBOXEnabled === 'left') {
6811
+ tlpx.x = this.mouseX;
6812
+ }
6813
+
6814
+ if (this.resizingBBOXEnabled === 'top') {
6815
+ tlpx.y = this.mouseY;
6816
+ }
6817
+
6818
+ if (this.resizingBBOXEnabled === 'right') {
6819
+ brpx.x = this.mouseX;
6820
+ }
6821
+
6822
+ if (this.resizingBBOXEnabled === 'bottom') {
6823
+ brpx.y = this.mouseY;
6824
+ }
6425
6825
 
6426
6826
  if (this.resizingBBOXEnabled === 'topleft') {
6427
6827
  tlpx.x = this.mouseX;
@@ -6474,10 +6874,15 @@
6474
6874
 
6475
6875
  this.mouseUpX = this.mouseX;
6476
6876
  this.mouseUpY = this.mouseY;
6477
- if (this.mapPanning === 0) return;
6877
+
6878
+ if (this.mapPanning === 0) {
6879
+ return;
6880
+ }
6478
6881
 
6479
6882
  if (this.mouseDownPressed === 1) {
6480
- if (this.mapMode === 'zoomout') this.zoomOut();
6883
+ if (this.mapMode === 'zoomout') {
6884
+ this.zoomOut();
6885
+ }
6481
6886
  }
6482
6887
 
6483
6888
  this.mouseDownPressed = 0;
@@ -6567,8 +6972,13 @@
6567
6972
 
6568
6973
 
6569
6974
  WMJSMap.prototype._mouseDragStart = function (x, y) {
6570
- if (this.mapMode === 'pan') this._mapPanStart(x, y);
6571
- if (this.mapMode === 'zoom') this._mapZoomStart();
6975
+ if (this.mapMode === 'pan') {
6976
+ this._mapPanStart(x, y);
6977
+ }
6978
+
6979
+ if (this.mapMode === 'zoom') {
6980
+ this._mapZoomStart();
6981
+ }
6572
6982
  };
6573
6983
 
6574
6984
  WMJSMap.prototype.mouseDrag = function (x, y) {
@@ -6578,15 +6988,30 @@
6578
6988
  this.mouseDragging = 1;
6579
6989
  }
6580
6990
 
6581
- if (this.mapMode === 'pan') this._mapPan(x, y);
6582
- if (this.mapMode === 'zoom') this._mapZoom();
6991
+ if (this.mapMode === 'pan') {
6992
+ this._mapPan(x, y);
6993
+ }
6994
+
6995
+ if (this.mapMode === 'zoom') {
6996
+ this._mapZoom();
6997
+ }
6583
6998
  };
6584
6999
 
6585
7000
  WMJSMap.prototype.mouseDragEnd = function (x, y) {
6586
- if (this.mouseDragging === 0) return;
7001
+ if (this.mouseDragging === 0) {
7002
+ return;
7003
+ }
7004
+
6587
7005
  this.mouseDragging = 0;
6588
- if (this.mapMode === 'pan') this._mapPanEnd(x, y);
6589
- if (this.mapMode === 'zoom') this._mapZoomEnd();
7006
+
7007
+ if (this.mapMode === 'pan') {
7008
+ this._mapPanEnd(x, y);
7009
+ }
7010
+
7011
+ if (this.mapMode === 'zoom') {
7012
+ this._mapZoomEnd();
7013
+ }
7014
+
6590
7015
  this.callBack.triggerEvent('mapdragend', {
6591
7016
  map: this,
6592
7017
  x: this.mouseUpX,
@@ -6617,7 +7042,9 @@
6617
7042
  };
6618
7043
 
6619
7044
  WMJSMap.prototype._mapPan = function (x, y) {
6620
- if (this.mapPanning === 0) return;
7045
+ if (this.mapPanning === 0) {
7046
+ return;
7047
+ }
6621
7048
 
6622
7049
  if (this.mouseX < 0 || this.mouseY < 0 || this.mouseX > this.mainElement.clientWidth || this.mouseY > this.mainElement.clientHeight) {
6623
7050
  this._mapPanEnd(x, y);
@@ -6645,7 +7072,11 @@
6645
7072
 
6646
7073
  WMJSMap.prototype._mapPanEnd = function (x, y) {
6647
7074
  this.baseDiv.style.cursor = 'default';
6648
- if (this.mapPanning === 0) return;
7075
+
7076
+ if (this.mapPanning === 0) {
7077
+ return;
7078
+ }
7079
+
6649
7080
  this.mapPanning = 0;
6650
7081
  var mapPanGeoCoords = this.getGeoCoordFromPixelCoord({
6651
7082
  x: x,
@@ -6699,7 +7130,10 @@
6699
7130
  };
6700
7131
 
6701
7132
  WMJSMap.prototype._mapZoom = function () {
6702
- if (this.mapZooming === 0) return;
7133
+ if (this.mapZooming === 0) {
7134
+ return;
7135
+ }
7136
+
6703
7137
  var x = this.mouseX - this.mouseDownX;
6704
7138
  var y = this.mouseY - this.mouseDownY;
6705
7139
 
@@ -6716,12 +7150,16 @@
6716
7150
  if (w < 0) {
6717
7151
  w = -w;
6718
7152
  this.divZoomBox.style.left = this.mouseX + "px";
6719
- } else this.divZoomBox.style.left = this.mouseDownX + "px";
7153
+ } else {
7154
+ this.divZoomBox.style.left = this.mouseDownX + "px";
7155
+ }
6720
7156
 
6721
7157
  if (h < 0) {
6722
7158
  h = -h;
6723
7159
  this.divZoomBox.style.top = this.mouseY + "px";
6724
- } else this.divZoomBox.style.top = this.mouseDownY + "px";
7160
+ } else {
7161
+ this.divZoomBox.style.top = this.mouseDownY + "px";
7162
+ }
6725
7163
 
6726
7164
  this.divZoomBox.style.width = w + "px";
6727
7165
  this.divZoomBox.style.height = h + "px";
@@ -6731,10 +7169,18 @@
6731
7169
  var x = this.mouseUpX - this.mouseDownX;
6732
7170
  var y = this.mouseUpY - this.mouseDownY;
6733
7171
  this.baseDiv.style.cursor = 'default';
6734
- if (this.mapZooming === 0) return;
7172
+
7173
+ if (this.mapZooming === 0) {
7174
+ return;
7175
+ }
7176
+
6735
7177
  this.mapZooming = 0;
6736
7178
  this.divZoomBox.style.display = 'none';
6737
- if (x < 0 && y < 0) return;
7179
+
7180
+ if (x < 0 && y < 0) {
7181
+ return;
7182
+ }
7183
+
6738
7184
  var zoomBBOXPixels = new WMBBOX();
6739
7185
 
6740
7186
  if (x < 0) {
@@ -6808,7 +7254,10 @@
6808
7254
  ratio = 1;
6809
7255
  }
6810
7256
 
6811
- if (ratio < 0) ratio = -ratio;
7257
+ if (ratio < 0) {
7258
+ ratio = -ratio;
7259
+ }
7260
+
6812
7261
  var screenRatio = this.width / this.height; // Is W > H?
6813
7262
 
6814
7263
  if (ratio > screenRatio) {
@@ -6855,8 +7304,14 @@
6855
7304
 
6856
7305
  WMJSMap.prototype.getGeoCoordFromPixelCoord = function (coordinates, _bbox) {
6857
7306
  var mybbox = this.bbox;
6858
- if (_bbox) mybbox = _bbox;
6859
- if (!isDefined(coordinates)) return undefined;
7307
+
7308
+ if (_bbox) {
7309
+ mybbox = _bbox;
7310
+ }
7311
+
7312
+ if (!isDefined(coordinates)) {
7313
+ return undefined;
7314
+ }
6860
7315
 
6861
7316
  try {
6862
7317
  var lon = coordinates.x / this.width * (mybbox.right - mybbox.left) + mybbox.left;
@@ -6978,9 +7433,19 @@
6978
7433
  var w = this.width;
6979
7434
  var h = this.height;
6980
7435
  var b = this.updateBBOX;
6981
- if (isDefined(_width)) w = _width;
6982
- if (isDefined(_height)) h = _height;
6983
- if (isDefined(_bbox)) b = _bbox;
7436
+
7437
+ if (isDefined(_width)) {
7438
+ w = _width;
7439
+ }
7440
+
7441
+ if (isDefined(_height)) {
7442
+ h = _height;
7443
+ }
7444
+
7445
+ if (isDefined(_bbox)) {
7446
+ b = _bbox;
7447
+ }
7448
+
6984
7449
  var x = w * (coordinates.x - b.left) / (b.right - b.left);
6985
7450
  var y = h * (coordinates.y - b.top) / (b.bottom - b.top);
6986
7451
  return {
@@ -6999,7 +7464,10 @@
6999
7464
  };
7000
7465
 
7001
7466
  WMJSMap.prototype.removeListener = function (name, f) {
7002
- if (this.isDestroyed) return;
7467
+ if (this.isDestroyed) {
7468
+ return;
7469
+ }
7470
+
7003
7471
  this.callBack.removeEvents(name, f);
7004
7472
  };
7005
7473
 
@@ -7153,7 +7621,10 @@
7153
7621
  this.WMProjectionUndo[0].bbox.setBBOX(this.bbox);
7154
7622
  this.WMProjectionUndo[0].srs = this.srs;
7155
7623
  this.NrOfUndos += 1;
7156
- if (this.NrOfUndos > this.MaxUndos) this.NrOfUndos = this.MaxUndos;
7624
+
7625
+ if (this.NrOfUndos > this.MaxUndos) {
7626
+ this.NrOfUndos = this.MaxUndos;
7627
+ }
7157
7628
  }
7158
7629
 
7159
7630
  this.DoRedo = 0;
@@ -7178,7 +7649,9 @@
7178
7649
 
7179
7650
  if (isDefined(ratio) === false) {
7180
7651
  ratio = 1;
7181
- } else if (ratio === 0) return;
7652
+ } else if (ratio === 0) {
7653
+ return;
7654
+ }
7182
7655
 
7183
7656
  a *= ratio;
7184
7657
  this.zoomTo(new WMBBOX(this.resizeBBOX.left - a, this.resizeBBOX.bottom - a, this.resizeBBOX.right + a, this.resizeBBOX.top + a));
@@ -7197,9 +7670,16 @@
7197
7670
  this.divBoundingBox.displayed = true;
7198
7671
  }
7199
7672
 
7200
- if (this.divBoundingBox.displayed !== true) return;
7673
+ if (this.divBoundingBox.displayed !== true) {
7674
+ return;
7675
+ }
7676
+
7201
7677
  var b = this.bbox;
7202
- if (isDefined(_mapbbox)) b = _mapbbox;
7678
+
7679
+ if (isDefined(_mapbbox)) {
7680
+ b = _mapbbox;
7681
+ }
7682
+
7203
7683
  var coord1 = this.getPixelCoordFromGeoCoord({
7204
7684
  x: this.divBoundingBox.bbox.left,
7205
7685
  y: this.divBoundingBox.bbox.top
@@ -7838,7 +8318,10 @@
7838
8318
 
7839
8319
 
7840
8320
  var headers = [];
7841
- if (options && options.headers) headers = options.headers;
8321
+
8322
+ if (options && options.headers) {
8323
+ headers = options.headers;
8324
+ }
7842
8325
 
7843
8326
  if (!isDefined(service)) {
7844
8327
  fail(I18n.no_service_defined.text);
@@ -7940,7 +8423,10 @@
7940
8423
  WMJSService.prototype.checkVersion111 = function (jsonData) {
7941
8424
  try {
7942
8425
  var rootLayer = jsonData.WMT_MS_Capabilities.Capability.Layer;
7943
- if (!rootLayer) throw new Error('No 111 layer');
8426
+
8427
+ if (!rootLayer) {
8428
+ throw new Error('No 111 layer');
8429
+ }
7944
8430
  } catch (e) {
7945
8431
  var message = this.checkException(jsonData);
7946
8432
 
@@ -7961,7 +8447,10 @@
7961
8447
  WMJSService.prototype.checkVersion130 = function (jsonData) {
7962
8448
  try {
7963
8449
  var rootLayer = jsonData.WMS_Capabilities.Capability.Layer;
7964
- if (!rootLayer) throw new Error('No 130 layer');
8450
+
8451
+ if (!rootLayer) {
8452
+ throw new Error('No 130 layer');
8453
+ }
7965
8454
  } catch (e) {
7966
8455
  var message = this.checkException(jsonData);
7967
8456
 
@@ -8131,7 +8620,8 @@
8131
8620
  if (WMSCapabilities.Service.OnlineResource.value) {
8132
8621
  _this.onlineresource = WMSCapabilities.Service.OnlineResource.value;
8133
8622
  } else {
8134
- _this.onlineresource = WMSCapabilities.Service.OnlineResource.attr['xlink:href'];
8623
+ _this.onlineresource = // eslint-disable-next-line @typescript-eslint/no-explicit-any
8624
+ WMSCapabilities.Service.OnlineResource.attr['xlink:href'];
8135
8625
  }
8136
8626
  } catch (e) {
8137
8627
  _this.onlineresource = I18n.not_available_message.text;
@@ -8167,7 +8657,9 @@
8167
8657
 
8168
8658
  if (se) {
8169
8659
  try {
8170
- if (se.attr.code) code = se.attr.code;
8660
+ if (se.attr.code) {
8661
+ code = se.attr.code;
8662
+ }
8171
8663
  } catch (e) {// do nothing
8172
8664
  }
8173
8665
 
@@ -8193,8 +8685,6 @@
8193
8685
  WMJSService.prototype.getNodes = function (succes, failure, forceReload, options) {
8194
8686
  var _this = this;
8195
8687
 
8196
- this.nodeCache = undefined;
8197
-
8198
8688
  if (!failure) {
8199
8689
  // eslint-disable-next-line no-param-reassign
8200
8690
  failure = function failure(msg) {
@@ -8509,7 +8999,13 @@
8509
8999
  this.getmapURL = options.service;
8510
9000
  this.getfeatureinfoURL = options.service;
8511
9001
  this.getlegendgraphicURL = options.service;
8512
- if (options.active === true) this.active = true;else this.active = false;
9002
+
9003
+ if (options.active === true) {
9004
+ this.active = true;
9005
+ } else {
9006
+ this.active = false;
9007
+ }
9008
+
8513
9009
  this.name = options.name;
8514
9010
 
8515
9011
  if (options.getgraphinfoURL) {
@@ -8532,16 +9028,29 @@
8532
9028
  this.id = options.id;
8533
9029
  }
8534
9030
 
8535
- if (options.format) this.format = options.format;else this.format = 'image/png';
9031
+ if (options.format) {
9032
+ this.format = options.format;
9033
+ } else {
9034
+ this.format = 'image/png';
9035
+ }
8536
9036
 
8537
9037
  if (isDefined(options.opacity)) {
8538
9038
  this.opacity = options.opacity;
8539
9039
  }
8540
9040
 
8541
- if (options.title) this.title = options.title;
9041
+ if (options.title) {
9042
+ this.title = options.title;
9043
+ }
9044
+
8542
9045
  this["abstract"] = I18n.not_available_message.text;
8543
- if (options.enabled === false) this.enabled = false;
8544
- if (options.keepOnTop === true) this.keepOnTop = true;
9046
+
9047
+ if (options.enabled === false) {
9048
+ this.enabled = false;
9049
+ }
9050
+
9051
+ if (options.keepOnTop === true) {
9052
+ this.keepOnTop = true;
9053
+ }
8545
9054
 
8546
9055
  if (options.transparent === false) {
8547
9056
  this.transparent = false;
@@ -8723,11 +9232,18 @@
8723
9232
  updateMapDimensions = true;
8724
9233
  }
8725
9234
 
8726
- if (!isDefined(value)) return;
9235
+ if (!isDefined(value)) {
9236
+ return;
9237
+ }
9238
+
8727
9239
  var dimIndex = this.dimensions.findIndex(function (dim) {
8728
9240
  return dim.name === name;
8729
9241
  });
8730
- if (dimIndex < 0) return;
9242
+
9243
+ if (dimIndex < 0) {
9244
+ return;
9245
+ }
9246
+
8731
9247
  var dim = this.dimensions[dimIndex];
8732
9248
  dim.setValue(value);
8733
9249
  this.handleReferenceTime(name, value, updateMapDimensions);
@@ -9097,10 +9613,22 @@
9097
9613
 
9098
9614
  for (var j = 0; j < this.styles.length; j += 1) {
9099
9615
  if (this.styles[j].name === styleName) {
9100
- if (nextPrev === -1) j -= 1;
9101
- if (nextPrev === 1) j += 1;
9102
- if (j < 0) j = this.styles.length - 1;
9103
- if (j > this.styles.length - 1) j = 0;
9616
+ if (nextPrev === -1) {
9617
+ j -= 1;
9618
+ }
9619
+
9620
+ if (nextPrev === 1) {
9621
+ j += 1;
9622
+ }
9623
+
9624
+ if (j < 0) {
9625
+ j = this.styles.length - 1;
9626
+ }
9627
+
9628
+ if (j > this.styles.length - 1) {
9629
+ j = 0;
9630
+ }
9631
+
9104
9632
  return this.styles[j];
9105
9633
  }
9106
9634
  }
@@ -9120,7 +9648,11 @@
9120
9648
  var dimIndex = this.dimensions.findIndex(function (dim) {
9121
9649
  return dim.name === name;
9122
9650
  });
9123
- if (dimIndex < 0) return undefined;
9651
+
9652
+ if (dimIndex < 0) {
9653
+ return undefined;
9654
+ }
9655
+
9124
9656
  return this.dimensions[dimIndex];
9125
9657
  };
9126
9658
  /**