@opengeoweb/webmap 4.16.0 → 4.18.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 +933 -287
- package/index.umd.js +928 -284
- package/lib/components/WMCanvasBuffer.d.ts +1 -1
- package/lib/components/WMFlyToBBox.d.ts +2 -1
- package/lib/components/WMJSDimension.d.ts +2 -1
- package/lib/components/WMJSMap.d.ts +17 -17
- package/lib/components/WMJSService.d.ts +5 -4
- package/lib/components/WMLayer.d.ts +3 -3
- package/lib/components/WMListener.d.ts +11 -2
- package/lib/components/WMTime.d.ts +1 -1
- package/lib/components/types.d.ts +28 -6
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -248,7 +248,9 @@ var debug = function debug(type, message) {
|
|
|
248
248
|
*/
|
|
249
249
|
|
|
250
250
|
var isDefined = function isDefined(variable) {
|
|
251
|
-
if (variable === null)
|
|
251
|
+
if (variable === null) {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
252
254
|
|
|
253
255
|
if (typeof variable === 'undefined') {
|
|
254
256
|
return false;
|
|
@@ -263,7 +265,9 @@ var isDefined = function isDefined(variable) {
|
|
|
263
265
|
*/
|
|
264
266
|
|
|
265
267
|
var toArray = function toArray(array) {
|
|
266
|
-
if (array === null || typeof array === 'undefined')
|
|
268
|
+
if (array === null || typeof array === 'undefined') {
|
|
269
|
+
return [];
|
|
270
|
+
}
|
|
267
271
|
|
|
268
272
|
if (array instanceof Array) {
|
|
269
273
|
return array;
|
|
@@ -281,7 +285,10 @@ var toArray = function toArray(array) {
|
|
|
281
285
|
*/
|
|
282
286
|
|
|
283
287
|
var WMJScheckURL = function WMJScheckURL(url) {
|
|
284
|
-
if (!isDefined(url))
|
|
288
|
+
if (!isDefined(url)) {
|
|
289
|
+
return '?';
|
|
290
|
+
}
|
|
291
|
+
|
|
285
292
|
var trimmedUrl = url.trim();
|
|
286
293
|
|
|
287
294
|
if (trimmedUrl.indexOf('?') === -1) {
|
|
@@ -308,14 +315,26 @@ var getMouseYCoordinate = function getMouseYCoordinate(event) {
|
|
|
308
315
|
return event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
|
|
309
316
|
};
|
|
310
317
|
var URLDecode = function URLDecode(encodedURL) {
|
|
311
|
-
if (!isDefined(encodedURL))
|
|
318
|
+
if (!isDefined(encodedURL)) {
|
|
319
|
+
return '';
|
|
320
|
+
}
|
|
321
|
+
|
|
312
322
|
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
323
|
}; // Encodes plain text to URL encoding
|
|
314
324
|
|
|
315
325
|
var URLEncode = function URLEncode(plaintext) {
|
|
316
|
-
if (!plaintext)
|
|
317
|
-
|
|
318
|
-
|
|
326
|
+
if (!plaintext) {
|
|
327
|
+
return plaintext;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
if (plaintext === undefined) {
|
|
331
|
+
return plaintext;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (plaintext === '') {
|
|
335
|
+
return plaintext;
|
|
336
|
+
}
|
|
337
|
+
|
|
319
338
|
var SAFECHARS = '0123456789' + // Numeric
|
|
320
339
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + // Alphabetic
|
|
321
340
|
'abcdefghijklmnopqrstuvwxyz' + "%-_.!~*'()"; // RFC2396 Mark characters
|
|
@@ -354,8 +373,15 @@ var URLEncode = function URLEncode(plaintext) {
|
|
|
354
373
|
var getCorrectWMSDimName = function getCorrectWMSDimName(origDimName) {
|
|
355
374
|
/* Adds DIM_ for dimensions other than height or time */
|
|
356
375
|
var upperCaseDimName = origDimName.toUpperCase();
|
|
357
|
-
|
|
358
|
-
if (upperCaseDimName === '
|
|
376
|
+
|
|
377
|
+
if (upperCaseDimName === 'TIME') {
|
|
378
|
+
return upperCaseDimName;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
if (upperCaseDimName === 'ELEVATION') {
|
|
382
|
+
return upperCaseDimName;
|
|
383
|
+
}
|
|
384
|
+
|
|
359
385
|
return "DIM_".concat(upperCaseDimName);
|
|
360
386
|
};
|
|
361
387
|
/* Returns all dimensions with its current values as URL */
|
|
@@ -465,7 +491,10 @@ var dateToISO8601 = function dateToISO8601(date) {
|
|
|
465
491
|
|
|
466
492
|
var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS) {
|
|
467
493
|
/* Get the Style object */
|
|
468
|
-
if (!layerObjectFromWMS.Style)
|
|
494
|
+
if (!layerObjectFromWMS.Style) {
|
|
495
|
+
return [];
|
|
496
|
+
}
|
|
497
|
+
|
|
469
498
|
var layerStyles = toArray(layerObjectFromWMS.Style);
|
|
470
499
|
/* 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
500
|
|
|
@@ -505,7 +534,10 @@ var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS) {
|
|
|
505
534
|
});
|
|
506
535
|
};
|
|
507
536
|
var addDimensionsForLayer = function addDimensionsForLayer(layerObjectFromWMS) {
|
|
508
|
-
if (!layerObjectFromWMS.Dimension)
|
|
537
|
+
if (!layerObjectFromWMS.Dimension) {
|
|
538
|
+
return [];
|
|
539
|
+
}
|
|
540
|
+
|
|
509
541
|
var layerDimensions = toArray(layerObjectFromWMS.Dimension);
|
|
510
542
|
var layerDimensionsExtents = toArray(layerObjectFromWMS.Extent);
|
|
511
543
|
var dimensionList = layerDimensions.map(function (layerDimension) {
|
|
@@ -566,10 +598,19 @@ function sortArrayOfObjectsByKey(array, key) {
|
|
|
566
598
|
var spreadArray = _toConsumableArray(array);
|
|
567
599
|
|
|
568
600
|
return spreadArray.sort(function (a, b) {
|
|
569
|
-
|
|
601
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
602
|
+
var x = a[key]; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
603
|
+
|
|
570
604
|
var y = b[key];
|
|
571
|
-
|
|
572
|
-
if (x
|
|
605
|
+
|
|
606
|
+
if (x < y) {
|
|
607
|
+
return -1;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if (x > y) {
|
|
611
|
+
return 1;
|
|
612
|
+
}
|
|
613
|
+
|
|
573
614
|
return 0;
|
|
574
615
|
});
|
|
575
616
|
}
|
|
@@ -784,7 +825,10 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
784
825
|
}, {
|
|
785
826
|
key: "isLoaded",
|
|
786
827
|
value: function isLoaded() {
|
|
787
|
-
if (this._isLoading)
|
|
828
|
+
if (this._isLoading) {
|
|
829
|
+
return false;
|
|
830
|
+
}
|
|
831
|
+
|
|
788
832
|
return this._isLoaded;
|
|
789
833
|
}
|
|
790
834
|
/**
|
|
@@ -887,7 +931,8 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
887
931
|
this._srcLoaded = undefined;
|
|
888
932
|
|
|
889
933
|
this._load();
|
|
890
|
-
}
|
|
934
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
935
|
+
|
|
891
936
|
}, {
|
|
892
937
|
key: "_getImageWithHeaders",
|
|
893
938
|
value: function _getImageWithHeaders(url, headers) {
|
|
@@ -926,7 +971,10 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
926
971
|
});
|
|
927
972
|
})["catch"](function () {
|
|
928
973
|
debug(DebugType.Error, "Unable to fetch image ".concat(url, " with headers [").concat(JSON.stringify(headers), "]"));
|
|
929
|
-
|
|
974
|
+
|
|
975
|
+
if (url.startsWith('http://')) {
|
|
976
|
+
debug(DebugType.Error);
|
|
977
|
+
}
|
|
930
978
|
|
|
931
979
|
_this2._loadEvent(true);
|
|
932
980
|
});
|
|
@@ -1311,7 +1359,10 @@ var WMBBOX = /*#__PURE__*/function () {
|
|
|
1311
1359
|
try {
|
|
1312
1360
|
var _a = left.split(',');
|
|
1313
1361
|
|
|
1314
|
-
if (_a.length !== 4)
|
|
1362
|
+
if (_a.length !== 4) {
|
|
1363
|
+
return;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1315
1366
|
this.left = parseFloat(_a[0]);
|
|
1316
1367
|
this.bottom = parseFloat(_a[1]);
|
|
1317
1368
|
this.right = parseFloat(_a[2]);
|
|
@@ -1324,10 +1375,21 @@ var WMBBOX = /*#__PURE__*/function () {
|
|
|
1324
1375
|
/* Apply defaults to invalid values */
|
|
1325
1376
|
|
|
1326
1377
|
|
|
1327
|
-
if (this.left == null)
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1378
|
+
if (this.left == null) {
|
|
1379
|
+
this.left = -180;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
if (this.right == null) {
|
|
1383
|
+
this.right = 180;
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
if (this.bottom == null) {
|
|
1387
|
+
this.bottom = -90;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
if (this.top == null) {
|
|
1391
|
+
this.top = 90;
|
|
1392
|
+
}
|
|
1331
1393
|
}
|
|
1332
1394
|
/*
|
|
1333
1395
|
* Compares two boundingboxes and returns true if they are equal
|
|
@@ -1448,11 +1510,13 @@ var WMListener = /*#__PURE__*/function () {
|
|
|
1448
1510
|
}, {
|
|
1449
1511
|
key: "suspendEvent",
|
|
1450
1512
|
value: function suspendEvent(name) {
|
|
1513
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1451
1514
|
this._suspendedEvents[name] = true;
|
|
1452
1515
|
}
|
|
1453
1516
|
}, {
|
|
1454
1517
|
key: "resumeEvent",
|
|
1455
1518
|
value: function resumeEvent(name) {
|
|
1519
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1456
1520
|
this._suspendedEvents[name] = false;
|
|
1457
1521
|
}
|
|
1458
1522
|
}, {
|
|
@@ -1469,7 +1533,8 @@ var WMListener = /*#__PURE__*/function () {
|
|
|
1469
1533
|
}, {
|
|
1470
1534
|
key: "triggerEvent",
|
|
1471
1535
|
value: function triggerEvent(name, param) {
|
|
1472
|
-
if (this._allEventsSuspended === true ||
|
|
1536
|
+
if (this._allEventsSuspended === true || // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1537
|
+
this._suspendedEvents[name] === true) {
|
|
1473
1538
|
return [];
|
|
1474
1539
|
}
|
|
1475
1540
|
|
|
@@ -1652,7 +1717,10 @@ _bbox) {
|
|
|
1652
1717
|
var cachedImage = imageStore.getImageForSrc(altImage.imageSource);
|
|
1653
1718
|
return cachedImage && cachedImage.isLoaded() && !cachedImage.isLoading() && !cachedImage.hasError();
|
|
1654
1719
|
});
|
|
1655
|
-
|
|
1720
|
+
|
|
1721
|
+
if (index !== -1) {
|
|
1722
|
+
return sortedImagesForUrl[index];
|
|
1723
|
+
}
|
|
1656
1724
|
}
|
|
1657
1725
|
|
|
1658
1726
|
return null;
|
|
@@ -1872,7 +1940,10 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
1872
1940
|
}, {
|
|
1873
1941
|
key: "finishedLoading",
|
|
1874
1942
|
value: function finishedLoading() {
|
|
1875
|
-
if (this.ready)
|
|
1943
|
+
if (this.ready) {
|
|
1944
|
+
return;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1876
1947
|
this.ready = true;
|
|
1877
1948
|
|
|
1878
1949
|
for (var j = 0; j < this.layers.length; j += 1) {
|
|
@@ -1896,7 +1967,11 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
1896
1967
|
value: function resize(w, h) {
|
|
1897
1968
|
var width = parseInt(w, 10);
|
|
1898
1969
|
var height = parseInt(h, 10);
|
|
1899
|
-
|
|
1970
|
+
|
|
1971
|
+
if (this._width === width && this._height === height) {
|
|
1972
|
+
return;
|
|
1973
|
+
}
|
|
1974
|
+
|
|
1900
1975
|
this._width = width;
|
|
1901
1976
|
this._height = height;
|
|
1902
1977
|
this.canvas.width = width;
|
|
@@ -2025,7 +2100,10 @@ var WMJSAnimate = /*#__PURE__*/function () {
|
|
|
2025
2100
|
_map.isAnimating = false;
|
|
2026
2101
|
|
|
2027
2102
|
_map.setAnimationDelay = function (delay) {
|
|
2028
|
-
if (delay < 1)
|
|
2103
|
+
if (delay < 1) {
|
|
2104
|
+
delay = 1;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2029
2107
|
_map.animationDelay = delay;
|
|
2030
2108
|
};
|
|
2031
2109
|
|
|
@@ -2087,8 +2165,14 @@ var WMJSAnimate = /*#__PURE__*/function () {
|
|
|
2087
2165
|
}, {
|
|
2088
2166
|
key: "_animate",
|
|
2089
2167
|
value: function _animate() {
|
|
2090
|
-
if (this._map.isAnimating === false)
|
|
2091
|
-
|
|
2168
|
+
if (this._map.isAnimating === false) {
|
|
2169
|
+
return;
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
if (this._map.animateBusy === true) {
|
|
2173
|
+
return;
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2092
2176
|
var animationStep = this._map.animationList[this._map.currentAnimationStep];
|
|
2093
2177
|
|
|
2094
2178
|
if (!animationStep) {
|
|
@@ -2209,7 +2293,9 @@ var WMJSAnimate = /*#__PURE__*/function () {
|
|
|
2209
2293
|
index -= this._map.animationList.length;
|
|
2210
2294
|
}
|
|
2211
2295
|
|
|
2212
|
-
if (index < 0)
|
|
2296
|
+
if (index < 0) {
|
|
2297
|
+
index = 0;
|
|
2298
|
+
}
|
|
2213
2299
|
|
|
2214
2300
|
if (index >= 0) {
|
|
2215
2301
|
var animationStep = this._map.animationList[index];
|
|
@@ -2242,7 +2328,10 @@ var WMJSAnimate = /*#__PURE__*/function () {
|
|
|
2242
2328
|
}, {
|
|
2243
2329
|
key: "stopAnimating",
|
|
2244
2330
|
value: function stopAnimating() {
|
|
2245
|
-
if (this._map.isAnimating === false)
|
|
2331
|
+
if (this._map.isAnimating === false) {
|
|
2332
|
+
return;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2246
2335
|
this._map._animationList = undefined;
|
|
2247
2336
|
this._divAnimationInfo.style.display = 'none';
|
|
2248
2337
|
this._map.isAnimating = false;
|
|
@@ -2276,9 +2365,18 @@ var WMTileRenderer = /*#__PURE__*/function () {
|
|
|
2276
2365
|
/* Temporal mappings from bgmaps.cgi service names to names defined here */
|
|
2277
2366
|
|
|
2278
2367
|
|
|
2279
|
-
if (layerName === 'streetmap')
|
|
2280
|
-
|
|
2281
|
-
|
|
2368
|
+
if (layerName === 'streetmap') {
|
|
2369
|
+
layerName = 'OSM';
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
if (layerName === 'pdok') {
|
|
2373
|
+
layerName = 'OSM';
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
if (layerName === 'naturalearth2') {
|
|
2377
|
+
layerName = 'NaturalEarth2';
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2282
2380
|
var tileLayer = tileOptions[layerName];
|
|
2283
2381
|
|
|
2284
2382
|
if (!tileLayer) {
|
|
@@ -2312,10 +2410,23 @@ var WMTileRenderer = /*#__PURE__*/function () {
|
|
|
2312
2410
|
var initialResolution = 2 * pi * 6378137 / tileSize;
|
|
2313
2411
|
var originShiftX = -2 * pi * 6378137 / 2.0;
|
|
2314
2412
|
var originShiftY = 2 * pi * 6378137 / 2.0;
|
|
2315
|
-
|
|
2316
|
-
if (tileSettings.
|
|
2317
|
-
|
|
2318
|
-
|
|
2413
|
+
|
|
2414
|
+
if (tileSettings.tileSize) {
|
|
2415
|
+
tileSize = tileSettings.tileSize;
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
if (tileSettings.resolution) {
|
|
2419
|
+
initialResolution = tileSettings.resolution;
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
if (tileSettings.origX) {
|
|
2423
|
+
originShiftX = tileSettings.origX;
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
if (tileSettings.origY) {
|
|
2427
|
+
originShiftY = tileSettings.origY;
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2319
2430
|
var screenWidth = width;
|
|
2320
2431
|
var bboxw = currentBBOX.right - currentBBOX.left;
|
|
2321
2432
|
var originShiftX2 = initialResolution * tileSize + originShiftX;
|
|
@@ -2326,7 +2437,10 @@ var WMTileRenderer = /*#__PURE__*/function () {
|
|
|
2326
2437
|
var level = Math.trunc(levelF + 0.5);
|
|
2327
2438
|
|
|
2328
2439
|
var getAttribution = function getAttribution(textileLayer) {
|
|
2329
|
-
if (!textileLayer || !srs || !tileLayer[srs] || !tileLayer[srs].copyRight)
|
|
2440
|
+
if (!textileLayer || !srs || !tileLayer[srs] || !tileLayer[srs].copyRight) {
|
|
2441
|
+
return null;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2330
2444
|
return tileLayer[srs].copyRight;
|
|
2331
2445
|
};
|
|
2332
2446
|
|
|
@@ -2339,8 +2453,14 @@ var WMTileRenderer = /*#__PURE__*/function () {
|
|
|
2339
2453
|
var tileServerFormat = tileSettings.tileServerFormat || 'png';
|
|
2340
2454
|
var tmsEnabled = tileSettings.tms || false; // 'osm' or 'argisonline'
|
|
2341
2455
|
|
|
2342
|
-
if (level < tileSettings.minLevel)
|
|
2343
|
-
|
|
2456
|
+
if (level < tileSettings.minLevel) {
|
|
2457
|
+
level = tileSettings.minLevel;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
if (level > tileSettings.maxLevel) {
|
|
2461
|
+
level = tileSettings.maxLevel;
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2344
2464
|
var numTilesAtLevel = Math.pow(2, level);
|
|
2345
2465
|
var numTilesAtLevelX = tileSetWidth / (initialResolution / numTilesAtLevel * tileSize);
|
|
2346
2466
|
var numTilesAtLevelY = tileSetHeight / (initialResolution / numTilesAtLevel * tileSize);
|
|
@@ -2389,7 +2509,7 @@ var WMTileRenderer = /*#__PURE__*/function () {
|
|
|
2389
2509
|
x: bounds.right,
|
|
2390
2510
|
y: bounds.top
|
|
2391
2511
|
}, newBBOX, width, height);
|
|
2392
|
-
var imageURL;
|
|
2512
|
+
var imageURL = '';
|
|
2393
2513
|
|
|
2394
2514
|
if (tileServerType === 'osm') {
|
|
2395
2515
|
if (tmsEnabled) {
|
|
@@ -2452,14 +2572,37 @@ var WMTileRenderer = /*#__PURE__*/function () {
|
|
|
2452
2572
|
numTilesAtLevelX *= 2;
|
|
2453
2573
|
}
|
|
2454
2574
|
|
|
2455
|
-
if (tilenbottom < 1)
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
if (
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2575
|
+
if (tilenbottom < 1) {
|
|
2576
|
+
tilenbottom = 1;
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
if (tilenbottom > numTilesAtLevelY) {
|
|
2580
|
+
tilenbottom = numTilesAtLevelY;
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
if (tilenleft < 1) {
|
|
2584
|
+
tilenleft = 1;
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
if (tilenleft > numTilesAtLevelX) {
|
|
2588
|
+
tilenleft = numTilesAtLevelX;
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
if (tilentop < 1) {
|
|
2592
|
+
tilentop = 1;
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2595
|
+
if (tilentop > numTilesAtLevelY) {
|
|
2596
|
+
tilentop = numTilesAtLevelY;
|
|
2597
|
+
}
|
|
2598
|
+
|
|
2599
|
+
if (tilenright < 1) {
|
|
2600
|
+
tilenright = 1;
|
|
2601
|
+
}
|
|
2602
|
+
|
|
2603
|
+
if (tilenright > numTilesAtLevelX) {
|
|
2604
|
+
tilenright = numTilesAtLevelX;
|
|
2605
|
+
}
|
|
2463
2606
|
|
|
2464
2607
|
if (tilentop - tilenbottom > 20) {
|
|
2465
2608
|
debug(DebugType.Error);
|
|
@@ -2480,8 +2623,14 @@ var WMTileRenderer = /*#__PURE__*/function () {
|
|
|
2480
2623
|
|
|
2481
2624
|
drawBGTiles(level);
|
|
2482
2625
|
imagesToRender.sort(function (imageA, imageB) {
|
|
2483
|
-
if (imageA.level < imageB.level)
|
|
2484
|
-
|
|
2626
|
+
if (imageA.level < imageB.level) {
|
|
2627
|
+
return -1;
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
if (imageA.level > imageB.level) {
|
|
2631
|
+
return 1;
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2485
2634
|
return 0;
|
|
2486
2635
|
});
|
|
2487
2636
|
|
|
@@ -2531,7 +2680,11 @@ var getLegendGraphicURLForLayer = function getLegendGraphicURLForLayer(layer) {
|
|
|
2531
2680
|
|
|
2532
2681
|
if (layer) {
|
|
2533
2682
|
var legendURL = layer.legendGraphic;
|
|
2534
|
-
|
|
2683
|
+
|
|
2684
|
+
if (!legendURL) {
|
|
2685
|
+
return undefined;
|
|
2686
|
+
} // For THREDDS WMS we need to add layers=
|
|
2687
|
+
|
|
2535
2688
|
|
|
2536
2689
|
if (!legendURL.includes('&layers=')) {
|
|
2537
2690
|
legendURL += "&layers=".concat(URLEncode(layer.name), "&");
|
|
@@ -2628,7 +2781,11 @@ var DateInterval = /*#__PURE__*/function () {
|
|
|
2628
2781
|
this.minute = parseInt(minute, 10);
|
|
2629
2782
|
this.second = parseInt(second, 10);
|
|
2630
2783
|
this.isRegularInterval = false;
|
|
2631
|
-
|
|
2784
|
+
|
|
2785
|
+
if (this.month === 0 && this.year === 0) {
|
|
2786
|
+
this.isRegularInterval = true;
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2632
2789
|
this.getTime = this.getTime.bind(this);
|
|
2633
2790
|
this.toISO8601 = this.toISO8601.bind(this);
|
|
2634
2791
|
}
|
|
@@ -2640,8 +2797,14 @@ var DateInterval = /*#__PURE__*/function () {
|
|
|
2640
2797
|
/* Months and years are unequally distributed in time
|
|
2641
2798
|
So get time is not possible */
|
|
2642
2799
|
|
|
2643
|
-
if (this.month !== 0)
|
|
2644
|
-
|
|
2800
|
+
if (this.month !== 0) {
|
|
2801
|
+
throw new Error('month !== 0');
|
|
2802
|
+
}
|
|
2803
|
+
|
|
2804
|
+
if (this.year !== 0) {
|
|
2805
|
+
throw new Error('year !== 0');
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2645
2808
|
timeres += this.day * 60 * 60 * 24;
|
|
2646
2809
|
timeres += this.hour * 60 * 60;
|
|
2647
2810
|
timeres += this.minute * 60;
|
|
@@ -2653,17 +2816,35 @@ var DateInterval = /*#__PURE__*/function () {
|
|
|
2653
2816
|
key: "toISO8601",
|
|
2654
2817
|
value: function toISO8601() {
|
|
2655
2818
|
var isoTime = 'P';
|
|
2656
|
-
|
|
2657
|
-
if (this.
|
|
2658
|
-
|
|
2819
|
+
|
|
2820
|
+
if (this.year !== 0) {
|
|
2821
|
+
isoTime += "".concat(this.year, "Y");
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
if (this.month !== 0) {
|
|
2825
|
+
isoTime += "".concat(this.month, "M");
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
if (this.day !== 0) {
|
|
2829
|
+
isoTime += "".concat(this.day, "D");
|
|
2830
|
+
}
|
|
2659
2831
|
|
|
2660
2832
|
if (this.hour !== 0 && this.minute !== 0 && this.second !== 0) {
|
|
2661
2833
|
isoTime += 'T';
|
|
2662
2834
|
}
|
|
2663
2835
|
|
|
2664
|
-
if (this.hour !== 0)
|
|
2665
|
-
|
|
2666
|
-
|
|
2836
|
+
if (this.hour !== 0) {
|
|
2837
|
+
isoTime += "".concat(this.hour, "H");
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
if (this.minute !== 0) {
|
|
2841
|
+
isoTime += "".concat(this.minute, "M");
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
if (this.second !== 0) {
|
|
2845
|
+
isoTime += "".concat(this.second, "S");
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2667
2848
|
return isoTime;
|
|
2668
2849
|
}
|
|
2669
2850
|
}]);
|
|
@@ -2715,16 +2896,29 @@ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime)
|
|
|
2715
2896
|
*/
|
|
2716
2897
|
var makeISO8601StringFromFlexibleWMSDateString = function makeISO8601StringFromFlexibleWMSDateString(isoString) {
|
|
2717
2898
|
// Datestring starting with a - token are not supported.
|
|
2718
|
-
if (!isoString || isoString.startsWith('-'))
|
|
2719
|
-
|
|
2899
|
+
if (!isoString || isoString.startsWith('-')) {
|
|
2900
|
+
return isoString;
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
var trimmed = isoString.trim();
|
|
2720
2904
|
|
|
2721
|
-
if (
|
|
2905
|
+
if (trimmed.length === 4) {
|
|
2906
|
+
return "".concat(trimmed, "-01-01T00:00:00Z"); // YYYY
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
if (trimmed.length === 7) {
|
|
2910
|
+
return "".concat(trimmed, "-01T00:00:00Z"); // YYYY-MM
|
|
2911
|
+
}
|
|
2722
2912
|
|
|
2723
|
-
if (
|
|
2913
|
+
if (trimmed.length === 10) {
|
|
2914
|
+
return "".concat(trimmed, "T00:00:00Z"); // YYYY-MM-DD
|
|
2915
|
+
}
|
|
2724
2916
|
|
|
2725
|
-
if (
|
|
2917
|
+
if (trimmed.length === 14) {
|
|
2918
|
+
return "".concat(trimmed.slice(0, -1), ":00:00Z"); // YYYY-MM-DDTHHZ
|
|
2919
|
+
}
|
|
2726
2920
|
|
|
2727
|
-
return
|
|
2921
|
+
return trimmed;
|
|
2728
2922
|
};
|
|
2729
2923
|
|
|
2730
2924
|
var isotime = makeISO8601StringFromFlexibleWMSDateString(unvalidatedIsotime);
|
|
@@ -2746,60 +2940,136 @@ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime)
|
|
|
2746
2940
|
var date = new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds));
|
|
2747
2941
|
|
|
2748
2942
|
date.add = function (dateInterval) {
|
|
2749
|
-
if (!dateInterval)
|
|
2943
|
+
if (!dateInterval) {
|
|
2944
|
+
return;
|
|
2945
|
+
}
|
|
2750
2946
|
|
|
2751
2947
|
if (dateInterval.isRegularInterval === false) {
|
|
2752
|
-
if (dateInterval.year !== 0)
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
if (dateInterval.
|
|
2757
|
-
|
|
2948
|
+
if (dateInterval.year !== 0) {
|
|
2949
|
+
date.setUTCFullYear(date.getUTCFullYear() + dateInterval.year);
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2952
|
+
if (dateInterval.month !== 0) {
|
|
2953
|
+
date.setUTCMonth(date.getUTCMonth() + dateInterval.month);
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
if (dateInterval.day !== 0) {
|
|
2957
|
+
date.setUTCDate(date.getUTCDate() + dateInterval.day);
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2960
|
+
if (dateInterval.hour !== 0) {
|
|
2961
|
+
date.setUTCHours(date.getUTCHours() + dateInterval.hour);
|
|
2962
|
+
}
|
|
2963
|
+
|
|
2964
|
+
if (dateInterval.minute !== 0) {
|
|
2965
|
+
date.setUTCMinutes(date.getUTCMinutes() + dateInterval.minute);
|
|
2966
|
+
}
|
|
2967
|
+
|
|
2968
|
+
if (dateInterval.second !== 0) {
|
|
2969
|
+
date.setUTCSeconds(date.getUTCSeconds() + dateInterval.second);
|
|
2970
|
+
}
|
|
2758
2971
|
} else {
|
|
2759
2972
|
date.setTime(date.getTime() + dateInterval.getTime());
|
|
2760
2973
|
}
|
|
2761
2974
|
};
|
|
2762
2975
|
|
|
2763
2976
|
date.substract = function (dateInterval) {
|
|
2764
|
-
if (!dateInterval)
|
|
2977
|
+
if (!dateInterval) {
|
|
2978
|
+
return;
|
|
2979
|
+
}
|
|
2765
2980
|
|
|
2766
2981
|
if (dateInterval.isRegularInterval === false) {
|
|
2767
|
-
if (dateInterval.year !== 0)
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
if (dateInterval.
|
|
2772
|
-
|
|
2982
|
+
if (dateInterval.year !== 0) {
|
|
2983
|
+
date.setUTCFullYear(date.getUTCFullYear() - dateInterval.year);
|
|
2984
|
+
}
|
|
2985
|
+
|
|
2986
|
+
if (dateInterval.month !== 0) {
|
|
2987
|
+
date.setUTCMonth(date.getUTCMonth() - dateInterval.month);
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
if (dateInterval.day !== 0) {
|
|
2991
|
+
date.setUTCDate(date.getUTCDate() - dateInterval.day);
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
if (dateInterval.hour !== 0) {
|
|
2995
|
+
date.setUTCHours(date.getUTCHours() - dateInterval.hour);
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2998
|
+
if (dateInterval.minute !== 0) {
|
|
2999
|
+
date.setUTCMinutes(date.getUTCMinutes() - dateInterval.minute);
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
if (dateInterval.second !== 0) {
|
|
3003
|
+
date.setUTCSeconds(date.getUTCSeconds() - dateInterval.second);
|
|
3004
|
+
}
|
|
2773
3005
|
} else {
|
|
2774
3006
|
date.setTime(date.getTime() - dateInterval.getTime());
|
|
2775
3007
|
}
|
|
2776
3008
|
};
|
|
2777
3009
|
|
|
2778
3010
|
date.addMultipleTimes = function (dateInterval, numberOfSteps) {
|
|
2779
|
-
if (!dateInterval)
|
|
3011
|
+
if (!dateInterval) {
|
|
3012
|
+
return;
|
|
3013
|
+
}
|
|
2780
3014
|
|
|
2781
3015
|
if (dateInterval.isRegularInterval === false) {
|
|
2782
|
-
if (dateInterval.year !== 0)
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
if (dateInterval.
|
|
2787
|
-
|
|
3016
|
+
if (dateInterval.year !== 0) {
|
|
3017
|
+
date.setUTCFullYear(date.getUTCFullYear() + dateInterval.year * numberOfSteps);
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
if (dateInterval.month !== 0) {
|
|
3021
|
+
date.setUTCMonth(date.getUTCMonth() + dateInterval.month * numberOfSteps);
|
|
3022
|
+
}
|
|
3023
|
+
|
|
3024
|
+
if (dateInterval.day !== 0) {
|
|
3025
|
+
date.setUTCDate(date.getUTCDate() + dateInterval.day * numberOfSteps);
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
if (dateInterval.hour !== 0) {
|
|
3029
|
+
date.setUTCHours(date.getUTCHours() + dateInterval.hour * numberOfSteps);
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
if (dateInterval.minute !== 0) {
|
|
3033
|
+
date.setUTCMinutes(date.getUTCMinutes() + dateInterval.minute * numberOfSteps);
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
if (dateInterval.second !== 0) {
|
|
3037
|
+
date.setUTCSeconds(date.getUTCSeconds() + dateInterval.second * numberOfSteps);
|
|
3038
|
+
}
|
|
2788
3039
|
} else {
|
|
2789
3040
|
date.setTime(date.getTime() + dateInterval.getTime() * numberOfSteps);
|
|
2790
3041
|
}
|
|
2791
3042
|
};
|
|
2792
3043
|
|
|
2793
3044
|
date.substractMultipleTimes = function (dateInterval, numberOfSteps) {
|
|
2794
|
-
if (!dateInterval)
|
|
3045
|
+
if (!dateInterval) {
|
|
3046
|
+
return;
|
|
3047
|
+
}
|
|
2795
3048
|
|
|
2796
3049
|
if (dateInterval.isRegularInterval === false) {
|
|
2797
|
-
if (dateInterval.year !== 0)
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
if (dateInterval.
|
|
2802
|
-
|
|
3050
|
+
if (dateInterval.year !== 0) {
|
|
3051
|
+
date.setUTCFullYear(date.getUTCFullYear() - dateInterval.year * numberOfSteps);
|
|
3052
|
+
}
|
|
3053
|
+
|
|
3054
|
+
if (dateInterval.month !== 0) {
|
|
3055
|
+
date.setUTCMonth(date.getUTCMonth() - dateInterval.month * numberOfSteps);
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3058
|
+
if (dateInterval.day !== 0) {
|
|
3059
|
+
date.setUTCDate(date.getUTCDate() - dateInterval.day * numberOfSteps);
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
if (dateInterval.hour !== 0) {
|
|
3063
|
+
date.setUTCHours(date.getUTCHours() - dateInterval.hour * numberOfSteps);
|
|
3064
|
+
}
|
|
3065
|
+
|
|
3066
|
+
if (dateInterval.minute !== 0) {
|
|
3067
|
+
date.setUTCMinutes(date.getUTCMinutes() - dateInterval.minute * numberOfSteps);
|
|
3068
|
+
}
|
|
3069
|
+
|
|
3070
|
+
if (dateInterval.second !== 0) {
|
|
3071
|
+
date.setUTCSeconds(date.getUTCSeconds() - dateInterval.second * numberOfSteps);
|
|
3072
|
+
}
|
|
2803
3073
|
} else {
|
|
2804
3074
|
date.setTime(date.getTime() - dateInterval.getTime() * numberOfSteps);
|
|
2805
3075
|
}
|
|
@@ -2837,8 +3107,17 @@ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime)
|
|
|
2837
3107
|
|
|
2838
3108
|
/** ****************************************************** */
|
|
2839
3109
|
|
|
2840
|
-
var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInterval(
|
|
2841
|
-
if (!
|
|
3110
|
+
var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInterval(_isotime) {
|
|
3111
|
+
if (!_isotime) {
|
|
3112
|
+
return undefined;
|
|
3113
|
+
}
|
|
3114
|
+
|
|
3115
|
+
var isotime = _isotime.trim();
|
|
3116
|
+
|
|
3117
|
+
if (isotime.charAt(0) !== 'P') {
|
|
3118
|
+
return undefined;
|
|
3119
|
+
}
|
|
3120
|
+
|
|
2842
3121
|
var splittedOnT = isotime.split('T');
|
|
2843
3122
|
var years = '0';
|
|
2844
3123
|
var months = '0';
|
|
@@ -2863,7 +3142,11 @@ var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInte
|
|
|
2863
3142
|
|
|
2864
3143
|
if (dayIndex !== -1) {
|
|
2865
3144
|
var start = yearIndex;
|
|
2866
|
-
|
|
3145
|
+
|
|
3146
|
+
if (monthIndex !== -1) {
|
|
3147
|
+
start = monthIndex;
|
|
3148
|
+
}
|
|
3149
|
+
|
|
2867
3150
|
days = YYYYMMDDPart.substring(start + 1, dayIndex);
|
|
2868
3151
|
}
|
|
2869
3152
|
} // parse the right part
|
|
@@ -2888,7 +3171,11 @@ var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInte
|
|
|
2888
3171
|
|
|
2889
3172
|
if (secondIndex !== -1) {
|
|
2890
3173
|
var _start = hourIndex;
|
|
2891
|
-
|
|
3174
|
+
|
|
3175
|
+
if (minuteIndex !== -1) {
|
|
3176
|
+
_start = minuteIndex;
|
|
3177
|
+
}
|
|
3178
|
+
|
|
2892
3179
|
seconds = HHMMSSPart.substring(_start + 1, secondIndex);
|
|
2893
3180
|
}
|
|
2894
3181
|
}
|
|
@@ -2906,7 +3193,10 @@ var parseISO8601IntervalToDateInterval = function parseISO8601IntervalToDateInte
|
|
|
2906
3193
|
/** ******************************************************* */
|
|
2907
3194
|
|
|
2908
3195
|
function getNumberOfTimeSteps(starttime, stoptime, interval) {
|
|
2909
|
-
if (!starttime || !stoptime || !interval)
|
|
3196
|
+
if (!starttime || !stoptime || !interval) {
|
|
3197
|
+
return undefined;
|
|
3198
|
+
}
|
|
3199
|
+
|
|
2910
3200
|
var steps = 0;
|
|
2911
3201
|
|
|
2912
3202
|
if (interval.month !== 0 || interval.year !== 0) {
|
|
@@ -2937,7 +3227,9 @@ var ParseISOTimeRangeDuration = /*#__PURE__*/function () {
|
|
|
2937
3227
|
this.initialized = false;
|
|
2938
3228
|
var times = isoTimeRangeDuration.split('/'); // Some safety checks
|
|
2939
3229
|
|
|
2940
|
-
if (times[2] === undefined)
|
|
3230
|
+
if (times[2] === undefined) {
|
|
3231
|
+
times[2] = 'PT1M';
|
|
3232
|
+
}
|
|
2941
3233
|
|
|
2942
3234
|
if (times[1] === undefined) {
|
|
2943
3235
|
// eslint-disable-next-line prefer-destructuring
|
|
@@ -3048,7 +3340,10 @@ var ParseISOTimeRangeDuration = /*#__PURE__*/function () {
|
|
|
3048
3340
|
return this.timeSteps - 1;
|
|
3049
3341
|
}
|
|
3050
3342
|
|
|
3051
|
-
if (currentDateTime > this.stopTime.getTime())
|
|
3343
|
+
if (currentDateTime > this.stopTime.getTime()) {
|
|
3344
|
+
return this.timeSteps - 1;
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3052
3347
|
var timeStep = 0;
|
|
3053
3348
|
|
|
3054
3349
|
if (this.timeInterval.isRegularInterval === false) {
|
|
@@ -3058,7 +3353,10 @@ var ParseISOTimeRangeDuration = /*#__PURE__*/function () {
|
|
|
3058
3353
|
var temptimeTime = temptime.getTime();
|
|
3059
3354
|
temptime.add(this.timeInterval);
|
|
3060
3355
|
var temptimeTimeIsOneStepFurther = temptime.getTime();
|
|
3061
|
-
|
|
3356
|
+
|
|
3357
|
+
if (currentDateTime >= temptimeTime && currentDateTime < temptimeTimeIsOneStepFurther) {
|
|
3358
|
+
return j;
|
|
3359
|
+
}
|
|
3062
3360
|
}
|
|
3063
3361
|
|
|
3064
3362
|
throw new Error("Date ".concat(currentDate.toISO8601(), " not found!"));
|
|
@@ -3240,7 +3538,9 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3240
3538
|
|
|
3241
3539
|
if (this._type === 'timestartstopres') {
|
|
3242
3540
|
/* Compose a new dataString interval and re-initialize the time dimension */
|
|
3243
|
-
var dateStringItems = this.values.split('/')
|
|
3541
|
+
var dateStringItems = this.values.split('/').map(function (value) {
|
|
3542
|
+
return value.trim();
|
|
3543
|
+
});
|
|
3244
3544
|
var dateStringInterval = dateStringItems[2];
|
|
3245
3545
|
var newValue = "".concat(newStartValueTimeAsMoment.toISOString(), "/").concat(newEndValueTimeAsMoment.toISOString(), "/").concat(dateStringInterval);
|
|
3246
3546
|
this.defaultValue = newEndValueTimeAsMoment.toISOString();
|
|
@@ -3258,7 +3558,10 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3258
3558
|
var newValues = '';
|
|
3259
3559
|
|
|
3260
3560
|
for (var j = 0; j < newArray.length; j += 1) {
|
|
3261
|
-
if (j > 0)
|
|
3561
|
+
if (j > 0) {
|
|
3562
|
+
newValues += ',';
|
|
3563
|
+
}
|
|
3564
|
+
|
|
3262
3565
|
newValues += newArray[j].toISO8601();
|
|
3263
3566
|
}
|
|
3264
3567
|
|
|
@@ -3278,14 +3581,21 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3278
3581
|
value: function initialize() {
|
|
3279
3582
|
var forceothervalues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
3280
3583
|
var forceReferenceTimeValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3281
|
-
|
|
3584
|
+
|
|
3585
|
+
if (this._initialized === true) {
|
|
3586
|
+
return;
|
|
3587
|
+
}
|
|
3588
|
+
|
|
3282
3589
|
var ogcdimvalues = this.values;
|
|
3283
3590
|
|
|
3284
3591
|
if (forceothervalues) {
|
|
3285
3592
|
ogcdimvalues = forceothervalues;
|
|
3286
3593
|
}
|
|
3287
3594
|
|
|
3288
|
-
if (!isDefined(ogcdimvalues))
|
|
3595
|
+
if (!isDefined(ogcdimvalues)) {
|
|
3596
|
+
return;
|
|
3597
|
+
}
|
|
3598
|
+
|
|
3289
3599
|
this._allValues = [];
|
|
3290
3600
|
this._initialized = true;
|
|
3291
3601
|
|
|
@@ -3306,10 +3616,14 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3306
3616
|
var values = ogcdimvalues.split(',');
|
|
3307
3617
|
|
|
3308
3618
|
for (var j = 0; j < values.length; j += 1) {
|
|
3309
|
-
var
|
|
3619
|
+
var valuesRangedNoTrim = values[j].split('/');
|
|
3310
3620
|
|
|
3311
|
-
if (
|
|
3621
|
+
if (valuesRangedNoTrim.length === 3) {
|
|
3622
|
+
var valuesRanged = valuesRangedNoTrim.map(function (value) {
|
|
3623
|
+
return value.trim();
|
|
3624
|
+
});
|
|
3312
3625
|
/* Can be either time like '2021-03-17T06:00:00Z/2021-03-21T00:00:00Z/PT6H' or something else, like '0/24/2' */
|
|
3626
|
+
|
|
3313
3627
|
if (valuesRanged[2].charAt(0) === 'P') {
|
|
3314
3628
|
var partTimeRanges = new ParseISOTimeRangeDuration(values[j]);
|
|
3315
3629
|
|
|
@@ -3327,8 +3641,14 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3327
3641
|
var stop = parseFloat(valuesRanged[1]);
|
|
3328
3642
|
var res = parseFloat(valuesRanged[2]);
|
|
3329
3643
|
stop += res;
|
|
3330
|
-
|
|
3331
|
-
if (
|
|
3644
|
+
|
|
3645
|
+
if (start > stop) {
|
|
3646
|
+
stop = start;
|
|
3647
|
+
}
|
|
3648
|
+
|
|
3649
|
+
if (res <= 0) {
|
|
3650
|
+
res = 1;
|
|
3651
|
+
}
|
|
3332
3652
|
|
|
3333
3653
|
for (var j2 = start; j2 < stop; j2 += res) {
|
|
3334
3654
|
this._allValues.push(String(j2));
|
|
@@ -3347,26 +3667,39 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3347
3667
|
}
|
|
3348
3668
|
}
|
|
3349
3669
|
}
|
|
3670
|
+
/* If no default value is given, take the last / most recent one */
|
|
3350
3671
|
|
|
3351
|
-
|
|
3352
|
-
|
|
3672
|
+
|
|
3673
|
+
if (!isDefined(this.defaultValue) || this.defaultValue === '') {
|
|
3674
|
+
this.defaultValue = this.getLastValue();
|
|
3675
|
+
}
|
|
3676
|
+
/* Check if the string 'current' is given, and find the closest value inside the dimension */
|
|
3677
|
+
|
|
3678
|
+
|
|
3679
|
+
if (this.defaultValue === 'current') {
|
|
3680
|
+
this.defaultValue = this.getClosestValue(moment().utc().format('YYYY-MM-DDTHH:mm:ss[Z]'), true);
|
|
3353
3681
|
}
|
|
3354
3682
|
/* If no currentvalue is set, set the default */
|
|
3355
3683
|
|
|
3356
3684
|
|
|
3357
|
-
if (!
|
|
3358
|
-
this.currentValue = this.
|
|
3685
|
+
if (!this.currentValue || this.currentValue.length === 0) {
|
|
3686
|
+
this.currentValue = this.defaultValue;
|
|
3359
3687
|
}
|
|
3360
3688
|
/* Check for out of range values and adjust accordingly to a valid range */
|
|
3361
3689
|
|
|
3362
3690
|
|
|
3363
3691
|
var index = this.getIndexForValue(this.currentValue);
|
|
3364
|
-
if (index === -2) this.currentValue = this.getLastValue(); // Date is past the latest (-2), so set it to the last value
|
|
3365
3692
|
|
|
3366
|
-
if (index === -
|
|
3693
|
+
if (index === -2) {
|
|
3694
|
+
this.currentValue = this.getLastValue(); // Date is past the latest (-2), so set it to the last value
|
|
3695
|
+
}
|
|
3367
3696
|
|
|
3697
|
+
if (index === -1) {
|
|
3698
|
+
this.currentValue = this.getFirstValue(); // Date is past the first (-1), so set it to the first value
|
|
3699
|
+
}
|
|
3368
3700
|
/* In case of reference time, the time dimension range is changed, check if the current time still fits in that range */
|
|
3369
3701
|
|
|
3702
|
+
|
|
3370
3703
|
if (forceReferenceTimeValue) {
|
|
3371
3704
|
if (this.getIndexForValue(this.currentValue, true) < 0) {
|
|
3372
3705
|
this.currentValue = this.getClosestValue(this.currentValue);
|
|
@@ -3513,7 +3846,11 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3513
3846
|
|
|
3514
3847
|
if (newValue === 'middle') {
|
|
3515
3848
|
var middleIndex = Math.ceil(this.size() / 2) - 1;
|
|
3516
|
-
|
|
3849
|
+
|
|
3850
|
+
if (middleIndex < 0) {
|
|
3851
|
+
middleIndex = 0;
|
|
3852
|
+
}
|
|
3853
|
+
|
|
3517
3854
|
return this.getValueForIndex(middleIndex);
|
|
3518
3855
|
}
|
|
3519
3856
|
|
|
@@ -3533,7 +3870,11 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3533
3870
|
value = this.getValueForIndex(index);
|
|
3534
3871
|
} catch (e) {
|
|
3535
3872
|
if (typeof e.message === 'number') {
|
|
3536
|
-
if (e.message === 0)
|
|
3873
|
+
if (e.message === 0) {
|
|
3874
|
+
value = WMDateTooEarlyString;
|
|
3875
|
+
} else {
|
|
3876
|
+
value = WMDateTooLateString;
|
|
3877
|
+
}
|
|
3537
3878
|
}
|
|
3538
3879
|
}
|
|
3539
3880
|
|
|
@@ -3575,8 +3916,14 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3575
3916
|
return this._timeRangeDurationDate.getDateAtTimeStep(index);
|
|
3576
3917
|
}
|
|
3577
3918
|
|
|
3578
|
-
if (this._type === 'timevalues')
|
|
3579
|
-
|
|
3919
|
+
if (this._type === 'timevalues') {
|
|
3920
|
+
return this._allValues[index];
|
|
3921
|
+
}
|
|
3922
|
+
|
|
3923
|
+
if (this._type === 'anyvalue') {
|
|
3924
|
+
return this._allValues[index];
|
|
3925
|
+
}
|
|
3926
|
+
|
|
3580
3927
|
return null;
|
|
3581
3928
|
}
|
|
3582
3929
|
/**
|
|
@@ -3588,7 +3935,11 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3588
3935
|
key: "getDimInterval",
|
|
3589
3936
|
value: function getDimInterval() {
|
|
3590
3937
|
this.initialize();
|
|
3591
|
-
|
|
3938
|
+
|
|
3939
|
+
if (!this.dimTimeInterval) {
|
|
3940
|
+
return undefined;
|
|
3941
|
+
}
|
|
3942
|
+
|
|
3592
3943
|
var _this$dimTimeInterval = this.dimTimeInterval,
|
|
3593
3944
|
year = _this$dimTimeInterval.year,
|
|
3594
3945
|
month = _this$dimTimeInterval.month,
|
|
@@ -3662,7 +4013,10 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3662
4013
|
|
|
3663
4014
|
return this._timeRangeDurationDate.getTimeStepFromDate(value, outSideOfRangeFlag);
|
|
3664
4015
|
} catch (e) {
|
|
3665
|
-
if (parseInt(e.message, 10) === 0)
|
|
4016
|
+
if (parseInt(e.message, 10) === 0) {
|
|
4017
|
+
return -1;
|
|
4018
|
+
}
|
|
4019
|
+
|
|
3666
4020
|
return -2;
|
|
3667
4021
|
}
|
|
3668
4022
|
}
|
|
@@ -3670,7 +4024,7 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3670
4024
|
if (this._type === 'timevalues') {
|
|
3671
4025
|
try {
|
|
3672
4026
|
var dateToFind = parseISO8601DateToDate(value).getTime();
|
|
3673
|
-
var minDistance;
|
|
4027
|
+
var minDistance = null;
|
|
3674
4028
|
var foundIndex = 0;
|
|
3675
4029
|
var minTime = null;
|
|
3676
4030
|
var maxTime = null;
|
|
@@ -3678,11 +4032,23 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3678
4032
|
for (var j = 0; j < this._allValues.length; j += 1) {
|
|
3679
4033
|
var time = this._allDates[j].getTime();
|
|
3680
4034
|
|
|
3681
|
-
if (time < minTime || minTime === null)
|
|
3682
|
-
|
|
4035
|
+
if (time < minTime || minTime === null) {
|
|
4036
|
+
minTime = time;
|
|
4037
|
+
}
|
|
4038
|
+
|
|
4039
|
+
if (time > maxTime || maxTime === null) {
|
|
4040
|
+
maxTime = time;
|
|
4041
|
+
}
|
|
4042
|
+
|
|
3683
4043
|
var distance = time - dateToFind;
|
|
3684
|
-
|
|
3685
|
-
if (
|
|
4044
|
+
|
|
4045
|
+
if (distance < 0) {
|
|
4046
|
+
distance = -distance;
|
|
4047
|
+
}
|
|
4048
|
+
|
|
4049
|
+
if (j === 0) {
|
|
4050
|
+
minDistance = distance;
|
|
4051
|
+
}
|
|
3686
4052
|
|
|
3687
4053
|
if (distance < minDistance) {
|
|
3688
4054
|
minDistance = distance;
|
|
@@ -3691,8 +4057,13 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3691
4057
|
}
|
|
3692
4058
|
|
|
3693
4059
|
if (outSideOfRangeFlag) {
|
|
3694
|
-
if (minTime > dateToFind)
|
|
3695
|
-
|
|
4060
|
+
if (minTime > dateToFind) {
|
|
4061
|
+
return -1;
|
|
4062
|
+
}
|
|
4063
|
+
|
|
4064
|
+
if (maxTime < dateToFind) {
|
|
4065
|
+
return -2;
|
|
4066
|
+
}
|
|
3696
4067
|
}
|
|
3697
4068
|
|
|
3698
4069
|
return foundIndex;
|
|
@@ -3704,7 +4075,9 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3704
4075
|
|
|
3705
4076
|
if (this._type === 'anyvalue') {
|
|
3706
4077
|
for (var _j2 = 0; _j2 < this._allValues.length; _j2 += 1) {
|
|
3707
|
-
if (this._allValues[_j2] === value)
|
|
4078
|
+
if (this._allValues[_j2] === value) {
|
|
4079
|
+
return _j2;
|
|
4080
|
+
}
|
|
3708
4081
|
}
|
|
3709
4082
|
}
|
|
3710
4083
|
|
|
@@ -3718,7 +4091,10 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3718
4091
|
key: "size",
|
|
3719
4092
|
value: function size() {
|
|
3720
4093
|
this.initialize();
|
|
3721
|
-
|
|
4094
|
+
|
|
4095
|
+
if (this._type === 'timestartstopres') {
|
|
4096
|
+
return this._timeRangeDurationDate.getTimeSteps();
|
|
4097
|
+
}
|
|
3722
4098
|
|
|
3723
4099
|
if (this._type === 'timevalues' || this._type === 'anyvalue') {
|
|
3724
4100
|
return this._allValues.length;
|
|
@@ -3812,7 +4188,9 @@ var MapPin = /*#__PURE__*/function () {
|
|
|
3812
4188
|
};
|
|
3813
4189
|
|
|
3814
4190
|
this.repositionMapPin = function (_bbox) {
|
|
3815
|
-
if (!_bbox)
|
|
4191
|
+
if (!_bbox) {
|
|
4192
|
+
return;
|
|
4193
|
+
}
|
|
3816
4194
|
|
|
3817
4195
|
var newpos = _this._map.getPixelCoordFromGeoCoord({
|
|
3818
4196
|
x: _this.geoPosX,
|
|
@@ -3825,8 +4203,14 @@ var MapPin = /*#__PURE__*/function () {
|
|
|
3825
4203
|
this.setMapPin = function (_x, _y, _bbox) {
|
|
3826
4204
|
var x = _x;
|
|
3827
4205
|
var y = _y;
|
|
3828
|
-
|
|
3829
|
-
if (
|
|
4206
|
+
|
|
4207
|
+
if (!x || !y) {
|
|
4208
|
+
return;
|
|
4209
|
+
}
|
|
4210
|
+
|
|
4211
|
+
if (_this.disableMapPin && !_bbox) {
|
|
4212
|
+
return; // we still want to update the pin position when the bbox changes.
|
|
4213
|
+
}
|
|
3830
4214
|
|
|
3831
4215
|
_this.x = parseInt(x, 10);
|
|
3832
4216
|
_this.y = parseInt(y, 10);
|
|
@@ -3941,10 +4325,12 @@ var getBBOXandProjString = function getBBOXandProjString(map, layer) {
|
|
|
3941
4325
|
}; // Build a valid WMS request for a certain layer
|
|
3942
4326
|
|
|
3943
4327
|
var buildWMSGetMapRequest = function buildWMSGetMapRequest(map, layer) {
|
|
3944
|
-
if (!isDefined(layer.name))
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
4328
|
+
if (!isDefined(layer.name)) {
|
|
4329
|
+
return {
|
|
4330
|
+
url: undefined,
|
|
4331
|
+
headers: null
|
|
4332
|
+
};
|
|
4333
|
+
}
|
|
3948
4334
|
|
|
3949
4335
|
var _map$getProjection2 = map.getProjection(),
|
|
3950
4336
|
srs = _map$getProjection2.srs;
|
|
@@ -3959,10 +4345,13 @@ var buildWMSGetMapRequest = function buildWMSGetMapRequest(map, layer) {
|
|
|
3959
4345
|
layer.format = 'image/png';
|
|
3960
4346
|
}
|
|
3961
4347
|
|
|
3962
|
-
if (layer.name.length < 1)
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
4348
|
+
if (layer.name.length < 1) {
|
|
4349
|
+
return {
|
|
4350
|
+
url: undefined,
|
|
4351
|
+
headers: null
|
|
4352
|
+
};
|
|
4353
|
+
} // GetFeatureInfo timeseries in the mapview
|
|
4354
|
+
|
|
3966
4355
|
|
|
3967
4356
|
if (srs === 'GFI:TIME_ELEVATION') {
|
|
3968
4357
|
var x = 707;
|
|
@@ -4056,8 +4445,10 @@ var buildWMSGetMapRequest = function buildWMSGetMapRequest(map, layer) {
|
|
|
4056
4445
|
|
|
4057
4446
|
var SCALE_DELAY = 10;
|
|
4058
4447
|
var ZOOMED_CALLBACK_DELAY = 500;
|
|
4448
|
+
var THROTTLE_OPTIONS = {
|
|
4449
|
+
noTrailing: true
|
|
4450
|
+
};
|
|
4059
4451
|
var THROTTLE_WAIT_TIME = 300;
|
|
4060
|
-
var THROTTLE_NO_TRAILING = true;
|
|
4061
4452
|
|
|
4062
4453
|
var WMFlyToBBox = function WMFlyToBBox(wmMap) {
|
|
4063
4454
|
var _this = this;
|
|
@@ -4066,7 +4457,6 @@ var WMFlyToBBox = function WMFlyToBBox(wmMap) {
|
|
|
4066
4457
|
|
|
4067
4458
|
this.flyZoomToBBOXTimerStart = 1;
|
|
4068
4459
|
this.flyZoomToBBOXTimerSteps = 5;
|
|
4069
|
-
this.flyZoomToBBOXDebounced = debounce;
|
|
4070
4460
|
this.flyZoomToBBOXScaler = 0;
|
|
4071
4461
|
this.flyZoomToBBOXCurrent = new WMBBOX();
|
|
4072
4462
|
this.flyZoomToBBOXFly = new WMBBOX();
|
|
@@ -4159,9 +4549,9 @@ var WMFlyToBBox = function WMFlyToBBox(wmMap) {
|
|
|
4159
4549
|
}
|
|
4160
4550
|
};
|
|
4161
4551
|
|
|
4162
|
-
this.startZoomThrottled = throttle(THROTTLE_WAIT_TIME,
|
|
4163
|
-
|
|
4164
|
-
});
|
|
4552
|
+
this.startZoomThrottled = throttle(THROTTLE_WAIT_TIME, function (currentbox, newbox) {
|
|
4553
|
+
_this.flyZoomToBBOXStartZoom(currentbox, newbox);
|
|
4554
|
+
}, THROTTLE_OPTIONS);
|
|
4165
4555
|
|
|
4166
4556
|
this.flyZoomToBBOXStartZoomThrottled = function (currentbox, newbox) {
|
|
4167
4557
|
_this.startZoomThrottled(currentbox, newbox);
|
|
@@ -4183,7 +4573,6 @@ var WebMapJSMapNo = 0;
|
|
|
4183
4573
|
var bgMapImageStore = new WMImageStore(bgImageStoreLength, {
|
|
4184
4574
|
id: 'bgMapImageStore'
|
|
4185
4575
|
});
|
|
4186
|
-
|
|
4187
4576
|
var detectLeftButton = function detectLeftButton(evt) {
|
|
4188
4577
|
if (evt.buttons) {
|
|
4189
4578
|
return evt.buttons === 1;
|
|
@@ -4345,7 +4734,6 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4345
4734
|
/* pan,zoom,zoomout,info */
|
|
4346
4735
|
|
|
4347
4736
|
this.numGetFeatureInfoRequests = 0;
|
|
4348
|
-
this.getFeatureInfoResult = [];
|
|
4349
4737
|
this.oldMapMode = undefined;
|
|
4350
4738
|
this.InValidMouseAction = 0;
|
|
4351
4739
|
this.resizingBBOXCursor = '';
|
|
@@ -4361,7 +4749,11 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4361
4749
|
this.proj4.srs = 'empty';
|
|
4362
4750
|
this.proj4.projection = undefined;
|
|
4363
4751
|
this.longlat = 'EPSG:4326';
|
|
4364
|
-
|
|
4752
|
+
|
|
4753
|
+
if (proj4) {
|
|
4754
|
+
proj4.defs(WMProj4Defs);
|
|
4755
|
+
}
|
|
4756
|
+
|
|
4365
4757
|
this.previousMouseButtonState = 'up';
|
|
4366
4758
|
/* Binds */
|
|
4367
4759
|
|
|
@@ -4400,7 +4792,6 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4400
4792
|
this.setSize = this.setSize.bind(this);
|
|
4401
4793
|
this._setSize = this._setSize.bind(this);
|
|
4402
4794
|
this.abort = this.abort.bind(this);
|
|
4403
|
-
this.isBusy = this.isBusy.bind(this);
|
|
4404
4795
|
this._makeInfoHTML = this._makeInfoHTML.bind(this);
|
|
4405
4796
|
this.showScaleBar = this.showScaleBar.bind(this);
|
|
4406
4797
|
this.hideScaleBar = this.hideScaleBar.bind(this);
|
|
@@ -4702,30 +5093,52 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4702
5093
|
do {
|
|
4703
5094
|
numMapUnits *= 10.0;
|
|
4704
5095
|
divFactor = a / numMapUnits;
|
|
4705
|
-
|
|
5096
|
+
|
|
5097
|
+
if (divFactor === 0) {
|
|
5098
|
+
return undefined;
|
|
5099
|
+
}
|
|
5100
|
+
|
|
4706
5101
|
realWidth = desiredWidth / divFactor;
|
|
4707
5102
|
} while (realWidth < desiredWidth);
|
|
4708
5103
|
|
|
4709
5104
|
do {
|
|
4710
5105
|
numMapUnits /= 2.0;
|
|
4711
5106
|
divFactor = a / numMapUnits;
|
|
4712
|
-
|
|
5107
|
+
|
|
5108
|
+
if (divFactor === 0) {
|
|
5109
|
+
return undefined;
|
|
5110
|
+
}
|
|
5111
|
+
|
|
4713
5112
|
realWidth = desiredWidth / divFactor;
|
|
4714
5113
|
} while (realWidth > desiredWidth);
|
|
4715
5114
|
|
|
4716
5115
|
do {
|
|
4717
5116
|
numMapUnits *= 1.2;
|
|
4718
5117
|
divFactor = a / numMapUnits;
|
|
4719
|
-
|
|
5118
|
+
|
|
5119
|
+
if (divFactor === 0) {
|
|
5120
|
+
return undefined;
|
|
5121
|
+
}
|
|
5122
|
+
|
|
4720
5123
|
realWidth = desiredWidth / divFactor;
|
|
4721
5124
|
} while (realWidth < desiredWidth);
|
|
4722
5125
|
|
|
4723
5126
|
var roundedMapUnits = numMapUnits;
|
|
4724
5127
|
var d = Math.pow(10, Math.round(Math.log10(numMapUnits) + 0.5) - 1);
|
|
4725
5128
|
roundedMapUnits = Math.round(roundedMapUnits / d);
|
|
4726
|
-
|
|
4727
|
-
if (roundedMapUnits
|
|
4728
|
-
|
|
5129
|
+
|
|
5130
|
+
if (roundedMapUnits < 2.5) {
|
|
5131
|
+
roundedMapUnits = 2.5;
|
|
5132
|
+
}
|
|
5133
|
+
|
|
5134
|
+
if (roundedMapUnits > 2.5 && roundedMapUnits < 7.5) {
|
|
5135
|
+
roundedMapUnits = 5;
|
|
5136
|
+
}
|
|
5137
|
+
|
|
5138
|
+
if (roundedMapUnits > 7.5) {
|
|
5139
|
+
roundedMapUnits = 10;
|
|
5140
|
+
}
|
|
5141
|
+
|
|
4729
5142
|
roundedMapUnits *= d;
|
|
4730
5143
|
divFactor = desiredWidth / pixelsPerUnit / roundedMapUnits;
|
|
4731
5144
|
realWidth = desiredWidth / divFactor;
|
|
@@ -4770,15 +5183,42 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4770
5183
|
ctx.moveTo(offsetX + scaleBarProps.width * 2 + 1, scaleBarHeight - 2 + offsetY);
|
|
4771
5184
|
ctx.lineTo(offsetX + scaleBarProps.width * 2 + 1, scaleBarHeight - 2 - 7 + offsetY);
|
|
4772
5185
|
var units = '';
|
|
4773
|
-
|
|
4774
|
-
if (this.srs === 'EPSG:
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
if (this.srs === 'EPSG:
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
5186
|
+
|
|
5187
|
+
if (this.srs === 'EPSG:3411') {
|
|
5188
|
+
units = 'meter';
|
|
5189
|
+
}
|
|
5190
|
+
|
|
5191
|
+
if (this.srs === 'EPSG:3412') {
|
|
5192
|
+
units = 'meter';
|
|
5193
|
+
}
|
|
5194
|
+
|
|
5195
|
+
if (this.srs === 'EPSG:3575') {
|
|
5196
|
+
units = 'meter';
|
|
5197
|
+
}
|
|
5198
|
+
|
|
5199
|
+
if (this.srs === 'EPSG:4326') {
|
|
5200
|
+
units = 'degrees';
|
|
5201
|
+
}
|
|
5202
|
+
|
|
5203
|
+
if (this.srs === 'EPSG:28992') {
|
|
5204
|
+
units = 'meter';
|
|
5205
|
+
}
|
|
5206
|
+
|
|
5207
|
+
if (this.srs === 'EPSG:32661') {
|
|
5208
|
+
units = 'meter';
|
|
5209
|
+
}
|
|
5210
|
+
|
|
5211
|
+
if (this.srs === 'EPSG:3857') {
|
|
5212
|
+
units = 'meter';
|
|
5213
|
+
}
|
|
5214
|
+
|
|
5215
|
+
if (this.srs === 'EPSG:900913') {
|
|
5216
|
+
units = 'meter';
|
|
5217
|
+
}
|
|
5218
|
+
|
|
5219
|
+
if (this.srs === 'EPSG:102100') {
|
|
5220
|
+
units = 'meter';
|
|
5221
|
+
}
|
|
4782
5222
|
|
|
4783
5223
|
if (units === 'meter') {
|
|
4784
5224
|
if (scaleBarProps.mapunits > 1000) {
|
|
@@ -4804,7 +5244,11 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4804
5244
|
|
|
4805
5245
|
if (isDefined(this.mouseGeoCoordXY)) {
|
|
4806
5246
|
var roundingFactor = 1.0 / Math.pow(10, parseInt(Math.log((this.bbox.right - this.bbox.left) / this.width) / Math.log(10), 10) - 2);
|
|
4807
|
-
|
|
5247
|
+
|
|
5248
|
+
if (roundingFactor < 1) {
|
|
5249
|
+
roundingFactor = 1;
|
|
5250
|
+
}
|
|
5251
|
+
|
|
4808
5252
|
ctx.fillStyle = '#000000';
|
|
4809
5253
|
var xText = Math.round(this.mouseGeoCoordXY.x * roundingFactor) / roundingFactor;
|
|
4810
5254
|
var yText = Math.round(this.mouseGeoCoordXY.y * roundingFactor) / roundingFactor;
|
|
@@ -5004,32 +5448,18 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5004
5448
|
}, {
|
|
5005
5449
|
key: "rebuildMapDimensions",
|
|
5006
5450
|
value: function rebuildMapDimensions() {
|
|
5007
|
-
for (var j = 0; j < this.mapdimensions.length; j += 1) {
|
|
5008
|
-
this.mapdimensions[j].used = false;
|
|
5009
|
-
}
|
|
5010
|
-
|
|
5011
5451
|
for (var i = 0; i < this.layers.length; i += 1) {
|
|
5012
|
-
for (var
|
|
5013
|
-
var dim = this.layers[i].dimensions[
|
|
5452
|
+
for (var j = 0; j < this.layers[i].dimensions.length; j += 1) {
|
|
5453
|
+
var dim = this.layers[i].dimensions[j];
|
|
5014
5454
|
var mapdim = this.getDimension(dim.name);
|
|
5015
5455
|
|
|
5016
|
-
if (isDefined(mapdim)) {
|
|
5017
|
-
mapdim.used = true;
|
|
5018
|
-
} else {
|
|
5456
|
+
if (!isDefined(mapdim)) {
|
|
5019
5457
|
var newdim = dim.clone();
|
|
5020
|
-
newdim.used = true;
|
|
5021
5458
|
this.mapdimensions.push(newdim);
|
|
5022
5459
|
}
|
|
5023
5460
|
}
|
|
5024
5461
|
}
|
|
5025
5462
|
|
|
5026
|
-
for (var _j5 = 0; _j5 < this.mapdimensions.length; _j5 += 1) {
|
|
5027
|
-
if (this.mapdimensions[_j5].used === false) {
|
|
5028
|
-
this.mapdimensions.splice(_j5, 1);
|
|
5029
|
-
_j5 -= 1;
|
|
5030
|
-
}
|
|
5031
|
-
}
|
|
5032
|
-
|
|
5033
5463
|
this.callBack.triggerEvent('onmapdimupdate');
|
|
5034
5464
|
}
|
|
5035
5465
|
}, {
|
|
@@ -5120,7 +5550,9 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5120
5550
|
value: function toggleLayer(layer) {
|
|
5121
5551
|
if (layer.enabled === true) {
|
|
5122
5552
|
layer.enabled = false;
|
|
5123
|
-
} else
|
|
5553
|
+
} else {
|
|
5554
|
+
layer.enabled = true;
|
|
5555
|
+
}
|
|
5124
5556
|
|
|
5125
5557
|
this.calculateNumBaseLayers();
|
|
5126
5558
|
this.rebuildMapDimensions();
|
|
@@ -5135,7 +5567,9 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5135
5567
|
}, {
|
|
5136
5568
|
key: "_getLayerIndex",
|
|
5137
5569
|
value: function _getLayerIndex(layer) {
|
|
5138
|
-
if (!layer)
|
|
5570
|
+
if (!layer) {
|
|
5571
|
+
return undefined;
|
|
5572
|
+
}
|
|
5139
5573
|
|
|
5140
5574
|
for (var j = 0; j < this.layers.length; j += 1) {
|
|
5141
5575
|
if (this.layers[j] === layer) {
|
|
@@ -5159,7 +5593,10 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5159
5593
|
}, {
|
|
5160
5594
|
key: "deleteLayer",
|
|
5161
5595
|
value: function deleteLayer(layerToDelete) {
|
|
5162
|
-
if (this.layers.length <= 0)
|
|
5596
|
+
if (this.layers.length <= 0) {
|
|
5597
|
+
return;
|
|
5598
|
+
}
|
|
5599
|
+
|
|
5163
5600
|
layerToDelete.setAutoUpdate(false);
|
|
5164
5601
|
|
|
5165
5602
|
var layerIndex = this._getLayerIndex(layerToDelete);
|
|
@@ -5317,14 +5754,18 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5317
5754
|
}, {
|
|
5318
5755
|
key: "setProjection",
|
|
5319
5756
|
value: function setProjection(_srs, _bbox) {
|
|
5320
|
-
if (!_srs)
|
|
5757
|
+
if (!_srs) {
|
|
5758
|
+
_srs = 'EPSG:4326';
|
|
5759
|
+
}
|
|
5321
5760
|
|
|
5322
5761
|
if (_typeof(_srs) === 'object') {
|
|
5323
5762
|
_bbox = _srs.bbox;
|
|
5324
5763
|
_srs = _srs.srs;
|
|
5325
5764
|
}
|
|
5326
5765
|
|
|
5327
|
-
if (!_srs)
|
|
5766
|
+
if (!_srs) {
|
|
5767
|
+
_srs = 'EPSG:4326';
|
|
5768
|
+
}
|
|
5328
5769
|
|
|
5329
5770
|
if (this.srs !== _srs) {
|
|
5330
5771
|
this.defaultBBOX.setBBOX(_bbox);
|
|
@@ -5426,7 +5867,9 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5426
5867
|
}, {
|
|
5427
5868
|
key: "_setSize",
|
|
5428
5869
|
value: function _setSize(w, h) {
|
|
5429
|
-
if (!w || !h)
|
|
5870
|
+
if (!w || !h) {
|
|
5871
|
+
return;
|
|
5872
|
+
}
|
|
5430
5873
|
|
|
5431
5874
|
if (w < 4 || h < 4) {
|
|
5432
5875
|
return;
|
|
@@ -5436,8 +5879,14 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5436
5879
|
var projinfo = this.getProjection();
|
|
5437
5880
|
this.width = w;
|
|
5438
5881
|
this.height = h;
|
|
5439
|
-
|
|
5440
|
-
if (this.
|
|
5882
|
+
|
|
5883
|
+
if (this.width < 4 || isNaN(this.width)) {
|
|
5884
|
+
this.width = 4;
|
|
5885
|
+
}
|
|
5886
|
+
|
|
5887
|
+
if (this.height < 4 || isNaN(this.height)) {
|
|
5888
|
+
this.height = 4;
|
|
5889
|
+
}
|
|
5441
5890
|
|
|
5442
5891
|
if (!projinfo.srs || !projinfo.bbox) {
|
|
5443
5892
|
debug(DebugType.Error);
|
|
@@ -5449,12 +5898,19 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5449
5898
|
this.setProjection(projinfo.srs, projinfo.bbox);
|
|
5450
5899
|
}
|
|
5451
5900
|
|
|
5452
|
-
if (!this.baseDiv || !this.baseDiv.style)
|
|
5901
|
+
if (!this.baseDiv || !this.baseDiv.style) {
|
|
5902
|
+
return;
|
|
5903
|
+
}
|
|
5904
|
+
|
|
5453
5905
|
Object.assign(this.baseDiv.style, {
|
|
5454
5906
|
width: this.width,
|
|
5455
5907
|
height: this.height
|
|
5456
5908
|
});
|
|
5457
|
-
|
|
5909
|
+
|
|
5910
|
+
if (!this.mainElement || !this.mainElement.style) {
|
|
5911
|
+
return;
|
|
5912
|
+
}
|
|
5913
|
+
|
|
5458
5914
|
this.mainElement.style.width = "".concat(this.width, "px");
|
|
5459
5915
|
this.mainElement.style.height = "".concat(this.height, "px");
|
|
5460
5916
|
this.setBBOX(this.resizeBBOX);
|
|
@@ -5474,16 +5930,6 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5474
5930
|
this.layersBusy = false;
|
|
5475
5931
|
this.callBack.triggerEvent('onloadingcomplete');
|
|
5476
5932
|
}
|
|
5477
|
-
}, {
|
|
5478
|
-
key: "isBusy",
|
|
5479
|
-
value: function isBusy() {
|
|
5480
|
-
if (this.suspendDrawing === true || this.mapBusy || this.layersBusy === 1) {
|
|
5481
|
-
return true;
|
|
5482
|
-
}
|
|
5483
|
-
|
|
5484
|
-
if (this.divBuffer[0].ready === false || this.divBuffer[1].ready === false) return true;
|
|
5485
|
-
return false;
|
|
5486
|
-
}
|
|
5487
5933
|
}, {
|
|
5488
5934
|
key: "_makeInfoHTML",
|
|
5489
5935
|
value: function _makeInfoHTML() {
|
|
@@ -5535,7 +5981,9 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5535
5981
|
}
|
|
5536
5982
|
}
|
|
5537
5983
|
|
|
5538
|
-
if (foundDim === false)
|
|
5984
|
+
if (foundDim === false) {
|
|
5985
|
+
infoHTML += '<td>-</td>';
|
|
5986
|
+
}
|
|
5539
5987
|
}
|
|
5540
5988
|
|
|
5541
5989
|
infoHTML += '</tr>';
|
|
@@ -5578,7 +6026,10 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5578
6026
|
}, {
|
|
5579
6027
|
key: "display",
|
|
5580
6028
|
value: function display() {
|
|
5581
|
-
if (!this.divBuffer)
|
|
6029
|
+
if (!this.divBuffer) {
|
|
6030
|
+
return;
|
|
6031
|
+
}
|
|
6032
|
+
|
|
5582
6033
|
this.divBuffer.display();
|
|
5583
6034
|
this.drawnBBOX.setBBOX(this.bbox);
|
|
5584
6035
|
}
|
|
@@ -5589,9 +6040,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5589
6040
|
}
|
|
5590
6041
|
}, {
|
|
5591
6042
|
key: "draw",
|
|
5592
|
-
value: function draw() {
|
|
5593
|
-
var animationList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5594
|
-
|
|
6043
|
+
value: function draw(animationList) {
|
|
5595
6044
|
if (this.isDestroyed) {
|
|
5596
6045
|
return;
|
|
5597
6046
|
}
|
|
@@ -5612,7 +6061,6 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5612
6061
|
/**
|
|
5613
6062
|
* API Function called to draw the layers, fires getmap request and shows the layers on the screen
|
|
5614
6063
|
*/
|
|
5615
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5616
6064
|
|
|
5617
6065
|
}, {
|
|
5618
6066
|
key: "_draw",
|
|
@@ -5631,8 +6079,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5631
6079
|
this.needsRedraw = false;
|
|
5632
6080
|
this.draw(this._animationList);
|
|
5633
6081
|
}
|
|
5634
|
-
}
|
|
5635
|
-
|
|
6082
|
+
}
|
|
5636
6083
|
}, {
|
|
5637
6084
|
key: "_drawAndLoad",
|
|
5638
6085
|
value: function _drawAndLoad(animationList) {
|
|
@@ -5793,9 +6240,17 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5793
6240
|
key: "_updateBoundingBox",
|
|
5794
6241
|
value: function _updateBoundingBox(_mapbbox) {
|
|
5795
6242
|
var triggerEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
5796
|
-
|
|
6243
|
+
|
|
6244
|
+
if (!this.divBuffer) {
|
|
6245
|
+
return;
|
|
6246
|
+
}
|
|
6247
|
+
|
|
5797
6248
|
var mapbbox = this.bbox;
|
|
5798
|
-
|
|
6249
|
+
|
|
6250
|
+
if (isDefined(_mapbbox)) {
|
|
6251
|
+
mapbbox = _mapbbox;
|
|
6252
|
+
}
|
|
6253
|
+
|
|
5799
6254
|
this.updateBBOX.setBBOX(mapbbox);
|
|
5800
6255
|
this.divBuffer.setBBOX(this.updateBBOX, this.drawnBBOX);
|
|
5801
6256
|
this.drawnBBOX.setBBOX(mapbbox);
|
|
@@ -5828,7 +6283,9 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5828
6283
|
}
|
|
5829
6284
|
|
|
5830
6285
|
this.callBack.triggerEvent('onlayeradd');
|
|
5831
|
-
} else
|
|
6286
|
+
} else {
|
|
6287
|
+
this.baseLayers = undefined;
|
|
6288
|
+
}
|
|
5832
6289
|
}
|
|
5833
6290
|
}, {
|
|
5834
6291
|
key: "setBaseLayers",
|
|
@@ -5846,7 +6303,9 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5846
6303
|
}
|
|
5847
6304
|
|
|
5848
6305
|
this.callBack.triggerEvent('onlayerchange');
|
|
5849
|
-
} else
|
|
6306
|
+
} else {
|
|
6307
|
+
this.baseLayers = undefined;
|
|
6308
|
+
}
|
|
5850
6309
|
}
|
|
5851
6310
|
}, {
|
|
5852
6311
|
key: "getBaseLayers",
|
|
@@ -5867,7 +6326,10 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5867
6326
|
key: "mouseWheelEvent",
|
|
5868
6327
|
value: function mouseWheelEvent(event) {
|
|
5869
6328
|
preventdefaultEvent(event);
|
|
5870
|
-
|
|
6329
|
+
|
|
6330
|
+
if (this.mouseWheelBusy === 1) {
|
|
6331
|
+
return;
|
|
6332
|
+
}
|
|
5871
6333
|
|
|
5872
6334
|
var _this$getMouseCoordin = this.getMouseCoordinatesForDocument(event),
|
|
5873
6335
|
x = _this$getMouseCoordin.x,
|
|
@@ -5926,7 +6388,10 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5926
6388
|
}, {
|
|
5927
6389
|
key: "destroy",
|
|
5928
6390
|
value: function destroy() {
|
|
5929
|
-
if (!this.initialized)
|
|
6391
|
+
if (!this.initialized) {
|
|
6392
|
+
return;
|
|
6393
|
+
}
|
|
6394
|
+
|
|
5930
6395
|
this.stopAnimating();
|
|
5931
6396
|
|
|
5932
6397
|
for (var i = this.layers.length - 1; i >= 0; i -= 1) {
|
|
@@ -6016,7 +6481,10 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6016
6481
|
var format = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'text/html';
|
|
6017
6482
|
|
|
6018
6483
|
/* For invalid layers we cannot build an url */
|
|
6019
|
-
if (!layer.name)
|
|
6484
|
+
if (!layer.name) {
|
|
6485
|
+
return '';
|
|
6486
|
+
}
|
|
6487
|
+
|
|
6020
6488
|
var request = WMJScheckURL(layer.service);
|
|
6021
6489
|
request += "&SERVICE=WMS&REQUEST=GetFeatureInfo&VERSION=".concat(layer.version);
|
|
6022
6490
|
request += "&LAYERS=".concat(URLEncode(layer.name));
|
|
@@ -6187,7 +6655,10 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6187
6655
|
this.oldMapMode = undefined;
|
|
6188
6656
|
}
|
|
6189
6657
|
} else {
|
|
6190
|
-
if (this.oldMapMode === undefined)
|
|
6658
|
+
if (this.oldMapMode === undefined) {
|
|
6659
|
+
this.oldMapMode = this.mapMode;
|
|
6660
|
+
}
|
|
6661
|
+
|
|
6191
6662
|
this.mapMode = 'zoom';
|
|
6192
6663
|
}
|
|
6193
6664
|
|
|
@@ -6318,7 +6789,10 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6318
6789
|
var foundBBOXRib = false;
|
|
6319
6790
|
|
|
6320
6791
|
if (this.mouseDownPressed === 0) {
|
|
6321
|
-
if (this.resizingBBOXEnabled === '')
|
|
6792
|
+
if (this.resizingBBOXEnabled === '') {
|
|
6793
|
+
this.resizingBBOXCursor = getComputedStyle(this.baseDiv).cursor;
|
|
6794
|
+
} // Find left rib
|
|
6795
|
+
|
|
6322
6796
|
|
|
6323
6797
|
if (Math.abs(this.mouseX - tlpx.x) < 6 && this.mouseY > tlpx.y && this.mouseY < brpx.y) {
|
|
6324
6798
|
foundBBOXRib = true;
|
|
@@ -6378,10 +6852,21 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6378
6852
|
|
|
6379
6853
|
if (foundBBOXRib === true || this.resizingBBOXEnabled !== '' && this.mouseDownPressed === 1) {
|
|
6380
6854
|
if (this.mouseDownPressed === 1) {
|
|
6381
|
-
if (this.resizingBBOXEnabled === 'left')
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6855
|
+
if (this.resizingBBOXEnabled === 'left') {
|
|
6856
|
+
tlpx.x = this.mouseX;
|
|
6857
|
+
}
|
|
6858
|
+
|
|
6859
|
+
if (this.resizingBBOXEnabled === 'top') {
|
|
6860
|
+
tlpx.y = this.mouseY;
|
|
6861
|
+
}
|
|
6862
|
+
|
|
6863
|
+
if (this.resizingBBOXEnabled === 'right') {
|
|
6864
|
+
brpx.x = this.mouseX;
|
|
6865
|
+
}
|
|
6866
|
+
|
|
6867
|
+
if (this.resizingBBOXEnabled === 'bottom') {
|
|
6868
|
+
brpx.y = this.mouseY;
|
|
6869
|
+
}
|
|
6385
6870
|
|
|
6386
6871
|
if (this.resizingBBOXEnabled === 'topleft') {
|
|
6387
6872
|
tlpx.x = this.mouseX;
|
|
@@ -6434,8 +6919,17 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6434
6919
|
|
|
6435
6920
|
this.mouseUpX = this.mouseX;
|
|
6436
6921
|
this.mouseUpY = this.mouseY;
|
|
6437
|
-
|
|
6438
|
-
if (this.
|
|
6922
|
+
|
|
6923
|
+
if (this.mapPanning === 0) {
|
|
6924
|
+
return;
|
|
6925
|
+
}
|
|
6926
|
+
|
|
6927
|
+
if (this.mouseDownPressed === 1) {
|
|
6928
|
+
if (this.mapMode === 'zoomout') {
|
|
6929
|
+
this.zoomOut();
|
|
6930
|
+
}
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6439
6933
|
this.mouseDownPressed = 0;
|
|
6440
6934
|
|
|
6441
6935
|
if (this.mouseDragging === 1) {
|
|
@@ -6525,8 +7019,13 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6525
7019
|
}, {
|
|
6526
7020
|
key: "_mouseDragStart",
|
|
6527
7021
|
value: function _mouseDragStart(x, y) {
|
|
6528
|
-
if (this.mapMode === 'pan')
|
|
6529
|
-
|
|
7022
|
+
if (this.mapMode === 'pan') {
|
|
7023
|
+
this._mapPanStart(x, y);
|
|
7024
|
+
}
|
|
7025
|
+
|
|
7026
|
+
if (this.mapMode === 'zoom') {
|
|
7027
|
+
this._mapZoomStart();
|
|
7028
|
+
}
|
|
6530
7029
|
}
|
|
6531
7030
|
}, {
|
|
6532
7031
|
key: "mouseDrag",
|
|
@@ -6537,16 +7036,31 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6537
7036
|
this.mouseDragging = 1;
|
|
6538
7037
|
}
|
|
6539
7038
|
|
|
6540
|
-
if (this.mapMode === 'pan')
|
|
6541
|
-
|
|
7039
|
+
if (this.mapMode === 'pan') {
|
|
7040
|
+
this._mapPan(x, y);
|
|
7041
|
+
}
|
|
7042
|
+
|
|
7043
|
+
if (this.mapMode === 'zoom') {
|
|
7044
|
+
this._mapZoom();
|
|
7045
|
+
}
|
|
6542
7046
|
}
|
|
6543
7047
|
}, {
|
|
6544
7048
|
key: "mouseDragEnd",
|
|
6545
7049
|
value: function mouseDragEnd(x, y) {
|
|
6546
|
-
if (this.mouseDragging === 0)
|
|
7050
|
+
if (this.mouseDragging === 0) {
|
|
7051
|
+
return;
|
|
7052
|
+
}
|
|
7053
|
+
|
|
6547
7054
|
this.mouseDragging = 0;
|
|
6548
|
-
|
|
6549
|
-
if (this.mapMode === '
|
|
7055
|
+
|
|
7056
|
+
if (this.mapMode === 'pan') {
|
|
7057
|
+
this._mapPanEnd(x, y);
|
|
7058
|
+
}
|
|
7059
|
+
|
|
7060
|
+
if (this.mapMode === 'zoom') {
|
|
7061
|
+
this._mapZoomEnd();
|
|
7062
|
+
}
|
|
7063
|
+
|
|
6550
7064
|
this.callBack.triggerEvent('mapdragend', {
|
|
6551
7065
|
map: this,
|
|
6552
7066
|
x: this.mouseUpX,
|
|
@@ -6579,7 +7093,9 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6579
7093
|
}, {
|
|
6580
7094
|
key: "_mapPan",
|
|
6581
7095
|
value: function _mapPan(x, y) {
|
|
6582
|
-
if (this.mapPanning === 0)
|
|
7096
|
+
if (this.mapPanning === 0) {
|
|
7097
|
+
return;
|
|
7098
|
+
}
|
|
6583
7099
|
|
|
6584
7100
|
if (this.mouseX < 0 || this.mouseY < 0 || this.mouseX > this.mainElement.clientWidth || this.mouseY > this.mainElement.clientHeight) {
|
|
6585
7101
|
this._mapPanEnd(x, y);
|
|
@@ -6608,7 +7124,11 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6608
7124
|
key: "_mapPanEnd",
|
|
6609
7125
|
value: function _mapPanEnd(x, y) {
|
|
6610
7126
|
this.baseDiv.style.cursor = 'default';
|
|
6611
|
-
|
|
7127
|
+
|
|
7128
|
+
if (this.mapPanning === 0) {
|
|
7129
|
+
return;
|
|
7130
|
+
}
|
|
7131
|
+
|
|
6612
7132
|
this.mapPanning = 0;
|
|
6613
7133
|
var mapPanGeoCoords = this.getGeoCoordFromPixelCoord({
|
|
6614
7134
|
x: x,
|
|
@@ -6666,7 +7186,10 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6666
7186
|
}, {
|
|
6667
7187
|
key: "_mapZoom",
|
|
6668
7188
|
value: function _mapZoom() {
|
|
6669
|
-
if (this.mapZooming === 0)
|
|
7189
|
+
if (this.mapZooming === 0) {
|
|
7190
|
+
return;
|
|
7191
|
+
}
|
|
7192
|
+
|
|
6670
7193
|
var x = this.mouseX - this.mouseDownX;
|
|
6671
7194
|
var y = this.mouseY - this.mouseDownY;
|
|
6672
7195
|
|
|
@@ -6683,12 +7206,16 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6683
7206
|
if (w < 0) {
|
|
6684
7207
|
w = -w;
|
|
6685
7208
|
this.divZoomBox.style.left = "".concat(this.mouseX, "px");
|
|
6686
|
-
} else
|
|
7209
|
+
} else {
|
|
7210
|
+
this.divZoomBox.style.left = "".concat(this.mouseDownX, "px");
|
|
7211
|
+
}
|
|
6687
7212
|
|
|
6688
7213
|
if (h < 0) {
|
|
6689
7214
|
h = -h;
|
|
6690
7215
|
this.divZoomBox.style.top = "".concat(this.mouseY, "px");
|
|
6691
|
-
} else
|
|
7216
|
+
} else {
|
|
7217
|
+
this.divZoomBox.style.top = "".concat(this.mouseDownY, "px");
|
|
7218
|
+
}
|
|
6692
7219
|
|
|
6693
7220
|
this.divZoomBox.style.width = "".concat(w, "px");
|
|
6694
7221
|
this.divZoomBox.style.height = "".concat(h, "px");
|
|
@@ -6699,10 +7226,18 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6699
7226
|
var x = this.mouseUpX - this.mouseDownX;
|
|
6700
7227
|
var y = this.mouseUpY - this.mouseDownY;
|
|
6701
7228
|
this.baseDiv.style.cursor = 'default';
|
|
6702
|
-
|
|
7229
|
+
|
|
7230
|
+
if (this.mapZooming === 0) {
|
|
7231
|
+
return;
|
|
7232
|
+
}
|
|
7233
|
+
|
|
6703
7234
|
this.mapZooming = 0;
|
|
6704
7235
|
this.divZoomBox.style.display = 'none';
|
|
6705
|
-
|
|
7236
|
+
|
|
7237
|
+
if (x < 0 && y < 0) {
|
|
7238
|
+
return;
|
|
7239
|
+
}
|
|
7240
|
+
|
|
6706
7241
|
var zoomBBOXPixels = new WMBBOX();
|
|
6707
7242
|
|
|
6708
7243
|
if (x < 0) {
|
|
@@ -6779,7 +7314,10 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6779
7314
|
ratio = 1;
|
|
6780
7315
|
}
|
|
6781
7316
|
|
|
6782
|
-
if (ratio < 0)
|
|
7317
|
+
if (ratio < 0) {
|
|
7318
|
+
ratio = -ratio;
|
|
7319
|
+
}
|
|
7320
|
+
|
|
6783
7321
|
var screenRatio = this.width / this.height; // Is W > H?
|
|
6784
7322
|
|
|
6785
7323
|
if (ratio > screenRatio) {
|
|
@@ -6828,8 +7366,14 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6828
7366
|
key: "getGeoCoordFromPixelCoord",
|
|
6829
7367
|
value: function getGeoCoordFromPixelCoord(coordinates, _bbox) {
|
|
6830
7368
|
var mybbox = this.bbox;
|
|
6831
|
-
|
|
6832
|
-
if (
|
|
7369
|
+
|
|
7370
|
+
if (_bbox) {
|
|
7371
|
+
mybbox = _bbox;
|
|
7372
|
+
}
|
|
7373
|
+
|
|
7374
|
+
if (!isDefined(coordinates)) {
|
|
7375
|
+
return undefined;
|
|
7376
|
+
}
|
|
6833
7377
|
|
|
6834
7378
|
try {
|
|
6835
7379
|
var lon = coordinates.x / this.width * (mybbox.right - mybbox.left) + mybbox.left;
|
|
@@ -6956,9 +7500,19 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6956
7500
|
var w = this.width;
|
|
6957
7501
|
var h = this.height;
|
|
6958
7502
|
var b = this.updateBBOX;
|
|
6959
|
-
|
|
6960
|
-
if (isDefined(
|
|
6961
|
-
|
|
7503
|
+
|
|
7504
|
+
if (isDefined(_width)) {
|
|
7505
|
+
w = _width;
|
|
7506
|
+
}
|
|
7507
|
+
|
|
7508
|
+
if (isDefined(_height)) {
|
|
7509
|
+
h = _height;
|
|
7510
|
+
}
|
|
7511
|
+
|
|
7512
|
+
if (isDefined(_bbox)) {
|
|
7513
|
+
b = _bbox;
|
|
7514
|
+
}
|
|
7515
|
+
|
|
6962
7516
|
var x = w * (coordinates.x - b.left) / (b.right - b.left);
|
|
6963
7517
|
var y = h * (coordinates.y - b.top) / (b.bottom - b.top);
|
|
6964
7518
|
return {
|
|
@@ -6976,7 +7530,10 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
6976
7530
|
}, {
|
|
6977
7531
|
key: "removeListener",
|
|
6978
7532
|
value: function removeListener(name, f) {
|
|
6979
|
-
if (this.isDestroyed)
|
|
7533
|
+
if (this.isDestroyed) {
|
|
7534
|
+
return;
|
|
7535
|
+
}
|
|
7536
|
+
|
|
6980
7537
|
this.callBack.removeEvents(name, f);
|
|
6981
7538
|
}
|
|
6982
7539
|
}, {
|
|
@@ -7117,23 +7674,26 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
7117
7674
|
this.WMProjectionTempUndo[j] = this.WMProjectionUndo[j];
|
|
7118
7675
|
}
|
|
7119
7676
|
|
|
7120
|
-
for (var
|
|
7121
|
-
this.WMProjectionUndo[
|
|
7677
|
+
for (var _j4 = 0; _j4 <= this.UndoPointer; _j4 += 1) {
|
|
7678
|
+
this.WMProjectionUndo[_j4] = this.WMProjectionTempUndo[this.UndoPointer - _j4];
|
|
7122
7679
|
}
|
|
7123
7680
|
|
|
7124
7681
|
this.UndoPointer = 0;
|
|
7125
7682
|
}
|
|
7126
7683
|
|
|
7127
|
-
for (var
|
|
7128
|
-
this.WMProjectionUndo[
|
|
7684
|
+
for (var _j5 = this.MaxUndos - 1; _j5 > 0; _j5 -= 1) {
|
|
7685
|
+
this.WMProjectionUndo[_j5].bbox.setBBOX(this.WMProjectionUndo[_j5 - 1].bbox);
|
|
7129
7686
|
|
|
7130
|
-
this.WMProjectionUndo[
|
|
7687
|
+
this.WMProjectionUndo[_j5].srs = this.WMProjectionUndo[_j5 - 1].srs;
|
|
7131
7688
|
}
|
|
7132
7689
|
|
|
7133
7690
|
this.WMProjectionUndo[0].bbox.setBBOX(this.bbox);
|
|
7134
7691
|
this.WMProjectionUndo[0].srs = this.srs;
|
|
7135
7692
|
this.NrOfUndos += 1;
|
|
7136
|
-
|
|
7693
|
+
|
|
7694
|
+
if (this.NrOfUndos > this.MaxUndos) {
|
|
7695
|
+
this.NrOfUndos = this.MaxUndos;
|
|
7696
|
+
}
|
|
7137
7697
|
}
|
|
7138
7698
|
|
|
7139
7699
|
this.DoRedo = 0;
|
|
@@ -7160,7 +7720,9 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
7160
7720
|
|
|
7161
7721
|
if (isDefined(ratio) === false) {
|
|
7162
7722
|
ratio = 1;
|
|
7163
|
-
} else if (ratio === 0)
|
|
7723
|
+
} else if (ratio === 0) {
|
|
7724
|
+
return;
|
|
7725
|
+
}
|
|
7164
7726
|
|
|
7165
7727
|
a *= ratio;
|
|
7166
7728
|
this.zoomTo(new WMBBOX(this.resizeBBOX.left - a, this.resizeBBOX.bottom - a, this.resizeBBOX.right + a, this.resizeBBOX.top + a));
|
|
@@ -7181,9 +7743,16 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
7181
7743
|
this.divBoundingBox.displayed = true;
|
|
7182
7744
|
}
|
|
7183
7745
|
|
|
7184
|
-
if (this.divBoundingBox.displayed !== true)
|
|
7746
|
+
if (this.divBoundingBox.displayed !== true) {
|
|
7747
|
+
return;
|
|
7748
|
+
}
|
|
7749
|
+
|
|
7185
7750
|
var b = this.bbox;
|
|
7186
|
-
|
|
7751
|
+
|
|
7752
|
+
if (isDefined(_mapbbox)) {
|
|
7753
|
+
b = _mapbbox;
|
|
7754
|
+
}
|
|
7755
|
+
|
|
7187
7756
|
var coord1 = this.getPixelCoordFromGeoCoord({
|
|
7188
7757
|
x: this.divBoundingBox.bbox.left,
|
|
7189
7758
|
y: this.divBoundingBox.bbox.top
|
|
@@ -7799,7 +8368,10 @@ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, op
|
|
|
7799
8368
|
|
|
7800
8369
|
/* Make the getCapabilitiesJSONrequest */
|
|
7801
8370
|
var headers = [];
|
|
7802
|
-
|
|
8371
|
+
|
|
8372
|
+
if (options && options.headers) {
|
|
8373
|
+
headers = options.headers;
|
|
8374
|
+
}
|
|
7803
8375
|
|
|
7804
8376
|
if (!isDefined(service)) {
|
|
7805
8377
|
fail(I18n.no_service_defined.text);
|
|
@@ -7903,7 +8475,10 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7903
8475
|
value: function checkVersion111(jsonData) {
|
|
7904
8476
|
try {
|
|
7905
8477
|
var rootLayer = jsonData.WMT_MS_Capabilities.Capability.Layer;
|
|
7906
|
-
|
|
8478
|
+
|
|
8479
|
+
if (!rootLayer) {
|
|
8480
|
+
throw new Error('No 111 layer');
|
|
8481
|
+
}
|
|
7907
8482
|
} catch (e) {
|
|
7908
8483
|
var message = this.checkException(jsonData);
|
|
7909
8484
|
|
|
@@ -7925,7 +8500,10 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7925
8500
|
value: function checkVersion130(jsonData) {
|
|
7926
8501
|
try {
|
|
7927
8502
|
var rootLayer = jsonData.WMS_Capabilities.Capability.Layer;
|
|
7928
|
-
|
|
8503
|
+
|
|
8504
|
+
if (!rootLayer) {
|
|
8505
|
+
throw new Error('No 130 layer');
|
|
8506
|
+
}
|
|
7929
8507
|
} catch (e) {
|
|
7930
8508
|
var message = this.checkException(jsonData);
|
|
7931
8509
|
|
|
@@ -7966,14 +8544,30 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7966
8544
|
var version = null;
|
|
7967
8545
|
|
|
7968
8546
|
try {
|
|
7969
|
-
if (WMSVersion.version100 === jsonData.WMT_MS_Capabilities.attr.version)
|
|
7970
|
-
|
|
7971
|
-
|
|
8547
|
+
if (WMSVersion.version100 === jsonData.WMT_MS_Capabilities.attr.version) {
|
|
8548
|
+
version = WMSVersion.version100;
|
|
8549
|
+
}
|
|
8550
|
+
|
|
8551
|
+
if (WMSVersion.version111 === jsonData.WMT_MS_Capabilities.attr.version) {
|
|
8552
|
+
version = WMSVersion.version111;
|
|
8553
|
+
}
|
|
8554
|
+
|
|
8555
|
+
if (WMSVersion.version130 === jsonData.WMT_MS_Capabilities.attr.version) {
|
|
8556
|
+
version = WMSVersion.version130;
|
|
8557
|
+
}
|
|
7972
8558
|
} catch (e) {
|
|
7973
8559
|
try {
|
|
7974
|
-
if (WMSVersion.version100 === jsonData.WMS_Capabilities.attr.version)
|
|
7975
|
-
|
|
7976
|
-
|
|
8560
|
+
if (WMSVersion.version100 === jsonData.WMS_Capabilities.attr.version) {
|
|
8561
|
+
version = WMSVersion.version100;
|
|
8562
|
+
}
|
|
8563
|
+
|
|
8564
|
+
if (WMSVersion.version111 === jsonData.WMS_Capabilities.attr.version) {
|
|
8565
|
+
version = WMSVersion.version111;
|
|
8566
|
+
}
|
|
8567
|
+
|
|
8568
|
+
if (WMSVersion.version130 === jsonData.WMS_Capabilities.attr.version) {
|
|
8569
|
+
version = WMSVersion.version130;
|
|
8570
|
+
}
|
|
7977
8571
|
} catch (_a) {
|
|
7978
8572
|
var message = this.checkException(jsonData);
|
|
7979
8573
|
|
|
@@ -8082,7 +8676,8 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
8082
8676
|
if (WMSCapabilities.Service.OnlineResource.value) {
|
|
8083
8677
|
_this.onlineresource = WMSCapabilities.Service.OnlineResource.value;
|
|
8084
8678
|
} else {
|
|
8085
|
-
_this.onlineresource =
|
|
8679
|
+
_this.onlineresource = // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8680
|
+
WMSCapabilities.Service.OnlineResource.attr['xlink:href'];
|
|
8086
8681
|
}
|
|
8087
8682
|
} catch (e) {
|
|
8088
8683
|
_this.onlineresource = I18n.not_available_message.text;
|
|
@@ -8119,7 +8714,9 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
8119
8714
|
|
|
8120
8715
|
if (se) {
|
|
8121
8716
|
try {
|
|
8122
|
-
if (se.attr.code)
|
|
8717
|
+
if (se.attr.code) {
|
|
8718
|
+
code = se.attr.code;
|
|
8719
|
+
}
|
|
8123
8720
|
} catch (e) {// do nothing
|
|
8124
8721
|
}
|
|
8125
8722
|
|
|
@@ -8146,8 +8743,6 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
8146
8743
|
value: function getNodes(succes, failure, forceReload, options) {
|
|
8147
8744
|
var _this2 = this;
|
|
8148
8745
|
|
|
8149
|
-
this.nodeCache = undefined;
|
|
8150
|
-
|
|
8151
8746
|
if (!failure) {
|
|
8152
8747
|
// eslint-disable-next-line no-param-reassign
|
|
8153
8748
|
failure = function failure(msg) {
|
|
@@ -8445,9 +9040,18 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8445
9040
|
this.getmapURL = options.service;
|
|
8446
9041
|
this.getfeatureinfoURL = options.service;
|
|
8447
9042
|
this.getlegendgraphicURL = options.service;
|
|
8448
|
-
|
|
9043
|
+
|
|
9044
|
+
if (options.active === true) {
|
|
9045
|
+
this.active = true;
|
|
9046
|
+
} else {
|
|
9047
|
+
this.active = false;
|
|
9048
|
+
}
|
|
9049
|
+
|
|
8449
9050
|
this.name = options.name;
|
|
8450
|
-
|
|
9051
|
+
|
|
9052
|
+
if (options.getgraphinfoURL) {
|
|
9053
|
+
this.getgraphinfoURL = options.getgraphinfoURL;
|
|
9054
|
+
}
|
|
8451
9055
|
|
|
8452
9056
|
if (options.style) {
|
|
8453
9057
|
this.currentStyle = options.style;
|
|
@@ -8465,16 +9069,29 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8465
9069
|
this.id = options.id;
|
|
8466
9070
|
}
|
|
8467
9071
|
|
|
8468
|
-
if (options.format)
|
|
9072
|
+
if (options.format) {
|
|
9073
|
+
this.format = options.format;
|
|
9074
|
+
} else {
|
|
9075
|
+
this.format = 'image/png';
|
|
9076
|
+
}
|
|
8469
9077
|
|
|
8470
9078
|
if (isDefined(options.opacity)) {
|
|
8471
9079
|
this.opacity = options.opacity;
|
|
8472
9080
|
}
|
|
8473
9081
|
|
|
8474
|
-
if (options.title)
|
|
9082
|
+
if (options.title) {
|
|
9083
|
+
this.title = options.title;
|
|
9084
|
+
}
|
|
9085
|
+
|
|
8475
9086
|
this["abstract"] = I18n.not_available_message.text;
|
|
8476
|
-
|
|
8477
|
-
if (options.
|
|
9087
|
+
|
|
9088
|
+
if (options.enabled === false) {
|
|
9089
|
+
this.enabled = false;
|
|
9090
|
+
}
|
|
9091
|
+
|
|
9092
|
+
if (options.keepOnTop === true) {
|
|
9093
|
+
this.keepOnTop = true;
|
|
9094
|
+
}
|
|
8478
9095
|
|
|
8479
9096
|
if (options.transparent === false) {
|
|
8480
9097
|
this.transparent = false;
|
|
@@ -8666,11 +9283,19 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8666
9283
|
key: "setDimension",
|
|
8667
9284
|
value: function setDimension(name, value) {
|
|
8668
9285
|
var updateMapDimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
8669
|
-
|
|
9286
|
+
|
|
9287
|
+
if (!isDefined(value)) {
|
|
9288
|
+
return;
|
|
9289
|
+
}
|
|
9290
|
+
|
|
8670
9291
|
var dimIndex = this.dimensions.findIndex(function (dim) {
|
|
8671
9292
|
return dim.name === name;
|
|
8672
9293
|
});
|
|
8673
|
-
|
|
9294
|
+
|
|
9295
|
+
if (dimIndex < 0) {
|
|
9296
|
+
return;
|
|
9297
|
+
}
|
|
9298
|
+
|
|
8674
9299
|
var dim = this.dimensions[dimIndex];
|
|
8675
9300
|
dim.setValue(value);
|
|
8676
9301
|
this.handleReferenceTime(name, value, updateMapDimensions);
|
|
@@ -8727,8 +9352,13 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8727
9352
|
var serverFormats = capabilityObject.Request.GetMap.Format;
|
|
8728
9353
|
|
|
8729
9354
|
for (var f = 0; f < serverFormats.length; f += 1) {
|
|
8730
|
-
if (serverFormats[f].value.indexOf('24') > 0)
|
|
8731
|
-
|
|
9355
|
+
if (serverFormats[f].value.indexOf('24') > 0) {
|
|
9356
|
+
this.optimalFormat = serverFormats[f].value;
|
|
9357
|
+
}
|
|
9358
|
+
|
|
9359
|
+
if (serverFormats[f].value.indexOf('32') > 0) {
|
|
9360
|
+
this.optimalFormat = serverFormats[f].value;
|
|
9361
|
+
}
|
|
8732
9362
|
}
|
|
8733
9363
|
} catch (e) {
|
|
8734
9364
|
debug(DebugType.Error);
|
|
@@ -9040,10 +9670,22 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
9040
9670
|
|
|
9041
9671
|
for (var j = 0; j < this.styles.length; j += 1) {
|
|
9042
9672
|
if (this.styles[j].name === styleName) {
|
|
9043
|
-
if (nextPrev === -1)
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9673
|
+
if (nextPrev === -1) {
|
|
9674
|
+
j -= 1;
|
|
9675
|
+
}
|
|
9676
|
+
|
|
9677
|
+
if (nextPrev === 1) {
|
|
9678
|
+
j += 1;
|
|
9679
|
+
}
|
|
9680
|
+
|
|
9681
|
+
if (j < 0) {
|
|
9682
|
+
j = this.styles.length - 1;
|
|
9683
|
+
}
|
|
9684
|
+
|
|
9685
|
+
if (j > this.styles.length - 1) {
|
|
9686
|
+
j = 0;
|
|
9687
|
+
}
|
|
9688
|
+
|
|
9047
9689
|
return this.styles[j];
|
|
9048
9690
|
}
|
|
9049
9691
|
}
|
|
@@ -9065,7 +9707,11 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
9065
9707
|
var dimIndex = this.dimensions.findIndex(function (dim) {
|
|
9066
9708
|
return dim.name === name;
|
|
9067
9709
|
});
|
|
9068
|
-
|
|
9710
|
+
|
|
9711
|
+
if (dimIndex < 0) {
|
|
9712
|
+
return undefined;
|
|
9713
|
+
}
|
|
9714
|
+
|
|
9069
9715
|
return this.dimensions[dimIndex];
|
|
9070
9716
|
}
|
|
9071
9717
|
/**
|