@opengeoweb/webmap 2.1.2 → 2.2.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/{webmap.esm.js → index.esm.js} +320 -255
- package/{webmap.umd.js → index.umd.js} +310 -259
- package/lib/components/WMCanvasBuffer.d.ts +4 -4
- package/lib/components/WMGetServiceFromStore.d.ts +1 -1
- package/lib/components/WMImage.d.ts +17 -0
- package/lib/components/WMJSDimension.d.ts +15 -4
- package/lib/components/WMJSMap.d.ts +0 -2
- package/lib/components/WMJSService.d.ts +8 -9
- package/lib/components/WMJSTools.d.ts +7 -0
- package/lib/components/WMLayer.d.ts +6 -28
- package/lib/components/types.d.ts +10 -2
- package/package.json +5 -5
|
@@ -44,10 +44,22 @@ function _slicedToArray(arr, i) {
|
|
|
44
44
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
function _toConsumableArray(arr) {
|
|
48
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function _arrayWithoutHoles(arr) {
|
|
52
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
function _arrayWithHoles(arr) {
|
|
48
56
|
if (Array.isArray(arr)) return arr;
|
|
49
57
|
}
|
|
50
58
|
|
|
59
|
+
function _iterableToArray(iter) {
|
|
60
|
+
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
|
61
|
+
}
|
|
62
|
+
|
|
51
63
|
function _iterableToArrayLimit(arr, i) {
|
|
52
64
|
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
53
65
|
var _arr = [];
|
|
@@ -92,6 +104,10 @@ function _arrayLikeToArray(arr, len) {
|
|
|
92
104
|
return arr2;
|
|
93
105
|
}
|
|
94
106
|
|
|
107
|
+
function _nonIterableSpread() {
|
|
108
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
109
|
+
}
|
|
110
|
+
|
|
95
111
|
function _nonIterableRest() {
|
|
96
112
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
97
113
|
}
|
|
@@ -428,7 +444,62 @@ var dateToISO8601 = function dateToISO8601(date) {
|
|
|
428
444
|
var iso = "".concat(prf(date.getUTCFullYear(), 4), "-").concat(prf(date.getUTCMonth() + 1, 2), "-").concat(prf(date.getUTCDate(), 2), "T").concat(prf(date.getUTCHours(), 2), ":").concat(prf(date.getUTCMinutes(), 2), ":").concat(prf(date.getUTCSeconds(), 2), "Z");
|
|
429
445
|
return iso;
|
|
430
446
|
};
|
|
447
|
+
/**
|
|
448
|
+
* Helper function to figure out the styles from the WMS layer object from the WMS GetCapabilties document
|
|
449
|
+
* @param layerObjectFromWMS The layer object from the WMS GetCapabilities JSON document
|
|
450
|
+
* @returns Style[] Array of style objects.
|
|
451
|
+
*/
|
|
452
|
+
|
|
453
|
+
var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS) {
|
|
454
|
+
/* Get the Style object */
|
|
455
|
+
if (!layerObjectFromWMS.Style) return [];
|
|
456
|
+
var layerStyles = toArray(layerObjectFromWMS.Style);
|
|
457
|
+
/* 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 */
|
|
458
|
+
|
|
459
|
+
return layerStyles.map(function (layerStyle) {
|
|
460
|
+
var style = {
|
|
461
|
+
title: 'default',
|
|
462
|
+
name: 'default',
|
|
463
|
+
legendURL: '',
|
|
464
|
+
"abstract": 'No abstract available'
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
try {
|
|
468
|
+
style.title = layerStyle.Title.value;
|
|
469
|
+
} catch (e) {
|
|
470
|
+
/* Do nothing */
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
try {
|
|
474
|
+
style.name = layerStyle.Name.value;
|
|
475
|
+
} catch (e) {
|
|
476
|
+
/* Do nothing */
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
try {
|
|
480
|
+
style.legendURL = layerStyle.LegendURL.OnlineResource.attr['xlink:href'];
|
|
481
|
+
} catch (e) {
|
|
482
|
+
/* Do nothing */
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
try {
|
|
486
|
+
style["abstract"] = layerStyle.Abstract.value;
|
|
487
|
+
} catch (e) {
|
|
488
|
+
/* Do nothing */
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
return style;
|
|
492
|
+
});
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Returns the current time in ms
|
|
497
|
+
* @returns the current time in ms
|
|
498
|
+
*/
|
|
431
499
|
|
|
500
|
+
var getCurrentImageTime = function getCurrentImageTime() {
|
|
501
|
+
return new Date().getTime();
|
|
502
|
+
};
|
|
432
503
|
/**
|
|
433
504
|
* WMImage provides an API to the HTML image element. It is used for caching and easier access to images.
|
|
434
505
|
*/
|
|
@@ -450,6 +521,8 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
450
521
|
this._isLoaded = undefined;
|
|
451
522
|
this._isLoading = undefined;
|
|
452
523
|
this._hasError = undefined;
|
|
524
|
+
this._imageTimeStampAtError = getCurrentImageTime();
|
|
525
|
+
this._numFailedAttempts = 0;
|
|
453
526
|
this.srcToLoad = src;
|
|
454
527
|
this.loadEventCallback = callback;
|
|
455
528
|
this.el = new Image();
|
|
@@ -468,6 +541,9 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
468
541
|
this.hasError = this.hasError.bind(this);
|
|
469
542
|
this._load = this._load.bind(this);
|
|
470
543
|
this.load = this.load.bind(this);
|
|
544
|
+
this.forceReload = this.forceReload.bind(this);
|
|
545
|
+
this.getLastErrorMSecondsAgo = this.getLastErrorMSecondsAgo.bind(this);
|
|
546
|
+
this.getNumFailedAttempts = this.getNumFailedAttempts.bind(this);
|
|
471
547
|
this._loadEvent = this._loadEvent.bind(this);
|
|
472
548
|
this.getWidth = this.getWidth.bind(this);
|
|
473
549
|
this.getHeight = this.getHeight.bind(this);
|
|
@@ -478,6 +554,9 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
478
554
|
_this._loadEvent(false);
|
|
479
555
|
});
|
|
480
556
|
this.el.addEventListener('error', function () {
|
|
557
|
+
_this._imageTimeStampAtError = getCurrentImageTime();
|
|
558
|
+
_this._numFailedAttempts += 1;
|
|
559
|
+
|
|
481
560
|
_this._loadEvent(true);
|
|
482
561
|
});
|
|
483
562
|
|
|
@@ -497,6 +576,8 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
497
576
|
this._isLoaded = false;
|
|
498
577
|
this._isLoading = false;
|
|
499
578
|
this._hasError = false;
|
|
579
|
+
this._numFailedAttempts = 0;
|
|
580
|
+
this._imageTimeStampAtError = getCurrentImageTime();
|
|
500
581
|
}
|
|
501
582
|
/**
|
|
502
583
|
* Returns true if the image has been loaded
|
|
@@ -517,6 +598,25 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
517
598
|
value: function isLoading() {
|
|
518
599
|
return this._isLoading;
|
|
519
600
|
}
|
|
601
|
+
/**
|
|
602
|
+
* Get the amount of milliseconds since the image experienced an image load.
|
|
603
|
+
* @returns milliseconds since the image had an error
|
|
604
|
+
*/
|
|
605
|
+
|
|
606
|
+
}, {
|
|
607
|
+
key: "getLastErrorMSecondsAgo",
|
|
608
|
+
value: function getLastErrorMSecondsAgo() {
|
|
609
|
+
return getCurrentImageTime() - this._imageTimeStampAtError;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* @returns The number of failed attempts for this image
|
|
613
|
+
*/
|
|
614
|
+
|
|
615
|
+
}, {
|
|
616
|
+
key: "getNumFailedAttempts",
|
|
617
|
+
value: function getNumFailedAttempts() {
|
|
618
|
+
return this._numFailedAttempts;
|
|
619
|
+
}
|
|
520
620
|
/**
|
|
521
621
|
* Set source of image, but it will not load the image yet.
|
|
522
622
|
* @param src URL of the image to load
|
|
@@ -542,6 +642,8 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
542
642
|
return;
|
|
543
643
|
}
|
|
544
644
|
|
|
645
|
+
this._numFailedAttempts = 0;
|
|
646
|
+
this._imageTimeStampAtError = getCurrentImageTime();
|
|
545
647
|
this._isLoaded = false;
|
|
546
648
|
}
|
|
547
649
|
/**
|
|
@@ -581,6 +683,14 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
581
683
|
this._load();
|
|
582
684
|
}
|
|
583
685
|
}, {
|
|
686
|
+
key: "forceReload",
|
|
687
|
+
value: function forceReload() {
|
|
688
|
+
this._isLoaded = false;
|
|
689
|
+
this._srcLoaded = undefined;
|
|
690
|
+
|
|
691
|
+
this._load();
|
|
692
|
+
}
|
|
693
|
+
}, {
|
|
584
694
|
key: "_getImageWithHeaders",
|
|
585
695
|
value: function _getImageWithHeaders(url, headers) {
|
|
586
696
|
var _this2 = this;
|
|
@@ -651,8 +761,12 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
651
761
|
var hostName = "".concat(splittedHREF[0], "//").concat(splittedHREF[1], "/");
|
|
652
762
|
this.srcToLoad = hostName + this.srcToLoad;
|
|
653
763
|
}
|
|
764
|
+
/*
|
|
765
|
+
* If the image has already loaded this source succesfully (without error), simply trigger the loadevent.
|
|
766
|
+
*/
|
|
767
|
+
|
|
654
768
|
|
|
655
|
-
if (this.srcToLoad === this._srcLoaded) {
|
|
769
|
+
if (this.srcToLoad === this._srcLoaded && !this._hasError) {
|
|
656
770
|
this._loadEvent(false);
|
|
657
771
|
|
|
658
772
|
return;
|
|
@@ -1274,13 +1388,14 @@ var addAlternativeImage = function addAlternativeImage(newLayer) {
|
|
|
1274
1388
|
/* It is not in the list, so add it */
|
|
1275
1389
|
|
|
1276
1390
|
if (imageIsAlreadyIndex === -1) {
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1391
|
+
/* Ensure that the oldest images are removed, keep a maximum of 10 images per signature url */
|
|
1392
|
+
while (sharedImagesList[sigImageUrl].length >= 10) {
|
|
1393
|
+
sharedImagesList[sigImageUrl].pop();
|
|
1394
|
+
}
|
|
1395
|
+
/* Add it to the beginning of the array for efficieny in searching at a later stage */
|
|
1280
1396
|
|
|
1281
1397
|
|
|
1282
|
-
|
|
1283
|
-
sharedImagesList[sigImageUrl].splice(0, 1);
|
|
1398
|
+
sharedImagesList[sigImageUrl].unshift(newLayer);
|
|
1284
1399
|
}
|
|
1285
1400
|
};
|
|
1286
1401
|
/**
|
|
@@ -1305,38 +1420,17 @@ var removeAlternativeImage = function removeAlternativeImage(imageUrl) {
|
|
|
1305
1420
|
}
|
|
1306
1421
|
};
|
|
1307
1422
|
/**
|
|
1308
|
-
*
|
|
1309
|
-
* @param rect1
|
|
1310
|
-
* @param rect2
|
|
1311
|
-
* @returns
|
|
1312
|
-
*/
|
|
1313
|
-
|
|
1314
|
-
var geClosestBBox = function geClosestBBox(rect1, rect2) {
|
|
1315
|
-
var diffTLX = rect1.left - rect2.left;
|
|
1316
|
-
var diffTLY = rect1.top - rect2.top;
|
|
1317
|
-
var diffBRX = rect1.right - rect2.right;
|
|
1318
|
-
var diffBRY = rect1.bottom - rect2.bottom;
|
|
1319
|
-
return Math.sqrt(diffTLX * diffTLX + diffTLY * diffTLY) + Math.sqrt(diffBRX * diffBRX + diffBRY * diffBRY);
|
|
1320
|
-
};
|
|
1321
|
-
/**
|
|
1322
|
-
* Sort the imageslist by overlapping area, highest area first
|
|
1423
|
+
* Sort the imageslist by imagedate, newewst image first.
|
|
1323
1424
|
* @param imagesList
|
|
1324
|
-
* @param bbox
|
|
1325
1425
|
* @returns
|
|
1326
1426
|
*/
|
|
1327
1427
|
|
|
1328
|
-
var
|
|
1329
|
-
var
|
|
1330
|
-
return
|
|
1331
|
-
dist: geClosestBBox(im.bbox, bbox),
|
|
1332
|
-
image: im
|
|
1333
|
-
};
|
|
1334
|
-
});
|
|
1335
|
-
var sorted = toSort.sort(function (a, b) {
|
|
1336
|
-
return a.dist > b.dist ? 1 : -1;
|
|
1428
|
+
var sortByImageDate = function sortByImageDate(imagesList) {
|
|
1429
|
+
var sorted = imagesList.sort(function (a, b) {
|
|
1430
|
+
return a.imageAge < b.imageAge ? 1 : -1;
|
|
1337
1431
|
});
|
|
1338
1432
|
return sorted.map(function (i) {
|
|
1339
|
-
return i
|
|
1433
|
+
return i;
|
|
1340
1434
|
});
|
|
1341
1435
|
};
|
|
1342
1436
|
/**
|
|
@@ -1347,17 +1441,18 @@ var sortByOverlappingArea = function sortByOverlappingArea(imagesList, bbox) {
|
|
|
1347
1441
|
* @returns A canvasLayer, containing the new image source with its geo properties
|
|
1348
1442
|
*/
|
|
1349
1443
|
|
|
1350
|
-
var getAlternativeImage = function getAlternativeImage(imageUrl, imageStore,
|
|
1444
|
+
var getAlternativeImage = function getAlternativeImage(imageUrl, imageStore, // eslint-disable-next-line no-unused-vars
|
|
1445
|
+
_bbox) {
|
|
1351
1446
|
var sigImageUrl = makeQueryStringWithoutGeoInfo(imageUrl);
|
|
1352
1447
|
var imagesForUrl = sharedImagesList[sigImageUrl];
|
|
1353
1448
|
|
|
1354
1449
|
if (imagesForUrl && imagesForUrl.length > 0) {
|
|
1355
|
-
var sortedImagesForUrl =
|
|
1356
|
-
/* Find the first image in this list which is also loaded */
|
|
1450
|
+
var sortedImagesForUrl = sortByImageDate(imagesForUrl);
|
|
1451
|
+
/* Find the first image in this list which is also loaded and has no error */
|
|
1357
1452
|
|
|
1358
1453
|
var index = sortedImagesForUrl.findIndex(function (altImage) {
|
|
1359
1454
|
var cachedImage = imageStore.getImageForSrc(altImage.imageSource);
|
|
1360
|
-
return cachedImage && cachedImage.isLoaded();
|
|
1455
|
+
return cachedImage && cachedImage.isLoaded() && !cachedImage.isLoading() && !cachedImage.hasError();
|
|
1361
1456
|
});
|
|
1362
1457
|
if (index !== -1) return sortedImagesForUrl[index];
|
|
1363
1458
|
}
|
|
@@ -1525,16 +1620,29 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
1525
1620
|
for (var j = 0; j < this.layers.length; j += 1) {
|
|
1526
1621
|
var imageToDisplay = this._imageStore.getImageForSrc(this.layers[j].imageSource);
|
|
1527
1622
|
|
|
1528
|
-
if (
|
|
1529
|
-
|
|
1623
|
+
if (imageToDisplay && imageToDisplay.isLoaded() && !imageToDisplay.isLoading() && !imageToDisplay.hasError()) {
|
|
1624
|
+
// Draw this image, it is loaded and OK
|
|
1625
|
+
this._drawImage(this.layers[j]);
|
|
1626
|
+
} else {
|
|
1627
|
+
/**
|
|
1628
|
+
* Check if this image has an error.
|
|
1629
|
+
* If the error has occured some time ago, and the amount of retries is low, just retry to load the image.
|
|
1630
|
+
*/
|
|
1631
|
+
if (imageToDisplay.hasError()) {
|
|
1632
|
+
if (imageToDisplay.isLoading() === false && imageToDisplay.getLastErrorMSecondsAgo() > 5000) {
|
|
1633
|
+
if (imageToDisplay.getNumFailedAttempts() < 10) {
|
|
1634
|
+
imageToDisplay.forceReload();
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
/* Find closest alternative and display instead image */
|
|
1639
|
+
|
|
1640
|
+
|
|
1530
1641
|
var im = getAlternativeImage(this.layers[j].imageSource, this._imageStore, this._currentnewbbox);
|
|
1531
1642
|
|
|
1532
1643
|
if (im) {
|
|
1533
1644
|
this._drawImage(im);
|
|
1534
1645
|
}
|
|
1535
|
-
} else {
|
|
1536
|
-
// Draw
|
|
1537
|
-
this._drawImage(this.layers[j]);
|
|
1538
1646
|
}
|
|
1539
1647
|
}
|
|
1540
1648
|
|
|
@@ -1624,6 +1732,7 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
|
|
|
1624
1732
|
|
|
1625
1733
|
var newLayer = {
|
|
1626
1734
|
imageSource: imageSource,
|
|
1735
|
+
imageAge: getCurrentImageTime(),
|
|
1627
1736
|
opacity: opacity,
|
|
1628
1737
|
bbox: {
|
|
1629
1738
|
left: bbox.left,
|
|
@@ -1844,8 +1953,9 @@ var WMJSAnimate = /*#__PURE__*/function () {
|
|
|
1844
1953
|
for (var i = 0; i < this._map.animationList[nextStep].requests.length; i += 1) {
|
|
1845
1954
|
var url = this._map.animationList[nextStep].requests[i].url;
|
|
1846
1955
|
var image = getMapImageStore.getImageForSrc(url);
|
|
1956
|
+
/* Get a loaded image which has no error */
|
|
1847
1957
|
|
|
1848
|
-
if (image && image.isLoaded()) {
|
|
1958
|
+
if (image && image.isLoaded() && !image.isLoading() && !image.hasError()) {
|
|
1849
1959
|
numReady += 1;
|
|
1850
1960
|
} else {
|
|
1851
1961
|
/* Check if a similar image is available instead, then we can continue with the smoother animation */
|
|
@@ -1853,11 +1963,14 @@ var WMJSAnimate = /*#__PURE__*/function () {
|
|
|
1853
1963
|
|
|
1854
1964
|
if (im) {
|
|
1855
1965
|
numReady += 1;
|
|
1966
|
+
} else if (!(image && image.isLoading())) {
|
|
1967
|
+
/* No alternatives and current image is not loading, so lets continue the animation */
|
|
1968
|
+
numReady += 1;
|
|
1856
1969
|
}
|
|
1857
1970
|
}
|
|
1858
1971
|
}
|
|
1859
1972
|
|
|
1860
|
-
if (numReady
|
|
1973
|
+
if (numReady >= this._map.animationList[nextStep].requests.length) {
|
|
1861
1974
|
continueAnimation = true;
|
|
1862
1975
|
}
|
|
1863
1976
|
|
|
@@ -1911,9 +2024,11 @@ var WMJSAnimate = /*#__PURE__*/function () {
|
|
|
1911
2024
|
this._map.setDimension(animationStep.name, animationStep.value, false);
|
|
1912
2025
|
|
|
1913
2026
|
this._map.animationList[index].imagesInPrefetch = prefetch(this._map.animationList[index].requests);
|
|
1914
|
-
getNumImagesLoading
|
|
2027
|
+
getNumImagesLoading = this._imageStore.getNumImagesLoading();
|
|
1915
2028
|
|
|
1916
|
-
if (getNumImagesLoading > maxSimultaneousLoads - 1)
|
|
2029
|
+
if (getNumImagesLoading > maxSimultaneousLoads - 1) {
|
|
2030
|
+
break;
|
|
2031
|
+
}
|
|
1917
2032
|
}
|
|
1918
2033
|
}
|
|
1919
2034
|
}
|
|
@@ -2814,6 +2929,7 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
2814
2929
|
this.initialize = this.initialize.bind(this);
|
|
2815
2930
|
this.getValue = this.getValue.bind(this);
|
|
2816
2931
|
this.setValue = this.setValue.bind(this);
|
|
2932
|
+
this.getValues = this.setValue.bind(this);
|
|
2817
2933
|
this.setClosestValue = this.setClosestValue.bind(this);
|
|
2818
2934
|
this.addTimeRangeDurationToValue = this.addTimeRangeDurationToValue.bind(this);
|
|
2819
2935
|
this.setTimeRangeDuration = this.setTimeRangeDuration.bind(this);
|
|
@@ -2822,6 +2938,7 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
2822
2938
|
this.get = this.get.bind(this);
|
|
2823
2939
|
this.getFirstValue = this.getFirstValue.bind(this);
|
|
2824
2940
|
this.getLastValue = this.getLastValue.bind(this);
|
|
2941
|
+
this.getDimInterval = this.getDimInterval.bind(this);
|
|
2825
2942
|
this.getIndexForValue = this.getIndexForValue.bind(this);
|
|
2826
2943
|
this.size = this.size.bind(this);
|
|
2827
2944
|
this.clone = this.clone.bind(this);
|
|
@@ -3096,6 +3213,17 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3096
3213
|
|
|
3097
3214
|
this.currentValue = value;
|
|
3098
3215
|
}
|
|
3216
|
+
/**
|
|
3217
|
+
* Returns values of the dimension, according to values defined in WMS specification, e.g. 2011-01-01T00:00:00Z/2012-01-01T00:00:00Z/P1M or list of values.
|
|
3218
|
+
* @returns
|
|
3219
|
+
*/
|
|
3220
|
+
|
|
3221
|
+
}, {
|
|
3222
|
+
key: "getValues",
|
|
3223
|
+
value: function getValues() {
|
|
3224
|
+
this.initialize();
|
|
3225
|
+
return this.values;
|
|
3226
|
+
}
|
|
3099
3227
|
}, {
|
|
3100
3228
|
key: "setClosestValue",
|
|
3101
3229
|
value: function setClosestValue() {
|
|
@@ -3238,6 +3366,17 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3238
3366
|
if (this._type === 'anyvalue') return this._allValues[index];
|
|
3239
3367
|
return null;
|
|
3240
3368
|
}
|
|
3369
|
+
/**
|
|
3370
|
+
* Hint about the timestep size / time resolution of this dimension.
|
|
3371
|
+
* @returns The dimTimeInterval
|
|
3372
|
+
*/
|
|
3373
|
+
|
|
3374
|
+
}, {
|
|
3375
|
+
key: "getDimInterval",
|
|
3376
|
+
value: function getDimInterval() {
|
|
3377
|
+
this.initialize();
|
|
3378
|
+
return this.dimTimeInterval;
|
|
3379
|
+
}
|
|
3241
3380
|
/**
|
|
3242
3381
|
* Shorthand functionf or getValueForIndex
|
|
3243
3382
|
*/
|
|
@@ -3960,7 +4099,6 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
3960
4099
|
this.previousMouseButtonState = 'up';
|
|
3961
4100
|
/* Binds */
|
|
3962
4101
|
|
|
3963
|
-
this.setXML2JSONURL = this.setXML2JSONURL.bind(this);
|
|
3964
4102
|
this.setWMTileRendererTileSettings = this.setWMTileRendererTileSettings.bind(this);
|
|
3965
4103
|
this.makeComponentId = this.makeComponentId.bind(this);
|
|
3966
4104
|
this.setMessage = this.setMessage.bind(this);
|
|
@@ -4086,11 +4224,6 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4086
4224
|
}
|
|
4087
4225
|
|
|
4088
4226
|
_createClass(WMJSMap, [{
|
|
4089
|
-
key: "setXML2JSONURL",
|
|
4090
|
-
value: function setXML2JSONURL(_xml2jsonrequest) {
|
|
4091
|
-
this.xml2jsonrequest = _xml2jsonrequest;
|
|
4092
|
-
}
|
|
4093
|
-
}, {
|
|
4094
4227
|
key: "setWMTileRendererTileSettings",
|
|
4095
4228
|
value: function setWMTileRendererTileSettings(_WMTileRendererTileSettings) {
|
|
4096
4229
|
this.tileRenderSettings = _WMTileRendererTileSettings;
|
|
@@ -4898,10 +5031,10 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4898
5031
|
reject(new Error('layer has no constructor'));
|
|
4899
5032
|
return;
|
|
4900
5033
|
}
|
|
5034
|
+
/* Set a reference in the layer to this map */
|
|
4901
5035
|
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
}
|
|
5036
|
+
|
|
5037
|
+
layer.parentMap = _this5;
|
|
4905
5038
|
|
|
4906
5039
|
_this5.layers.push(layer);
|
|
4907
5040
|
|
|
@@ -4913,7 +5046,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4913
5046
|
resolve(_this5);
|
|
4914
5047
|
};
|
|
4915
5048
|
|
|
4916
|
-
layer.parseLayer(done, undefined);
|
|
5049
|
+
layer.parseLayer(done, undefined, 'WMJSMap addLayer');
|
|
4917
5050
|
});
|
|
4918
5051
|
}
|
|
4919
5052
|
}, {
|
|
@@ -5451,9 +5584,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
5451
5584
|
this.baseLayers = layer;
|
|
5452
5585
|
|
|
5453
5586
|
for (var j = 0; j < this.baseLayers.length; j += 1) {
|
|
5454
|
-
|
|
5455
|
-
this.baseLayers[j].parentMaps.push(this);
|
|
5456
|
-
}
|
|
5587
|
+
this.baseLayers[j].parentMap = this;
|
|
5457
5588
|
|
|
5458
5589
|
if (this.baseLayers[j].keepOnTop !== true) {
|
|
5459
5590
|
this.numBaseLayers += 1;
|
|
@@ -7353,8 +7484,8 @@ var getWMSUrl = function getWMSUrl() {
|
|
|
7353
7484
|
* Global getcapabilities function
|
|
7354
7485
|
*/
|
|
7355
7486
|
|
|
7356
|
-
var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail,
|
|
7357
|
-
var disableCache = arguments.length >
|
|
7487
|
+
var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, options) {
|
|
7488
|
+
var disableCache = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
7358
7489
|
|
|
7359
7490
|
/* Make the getCapabilitiesJSONrequest */
|
|
7360
7491
|
var headers = [];
|
|
@@ -7398,7 +7529,6 @@ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, xm
|
|
|
7398
7529
|
random: Math.random()
|
|
7399
7530
|
} : {};
|
|
7400
7531
|
var url = getWMSUrl(service, addParams);
|
|
7401
|
-
var newXml2jsonrequestURL = xml2jsonrequestURL;
|
|
7402
7532
|
WMXMLParser(url, headers).then(function (data) {
|
|
7403
7533
|
try {
|
|
7404
7534
|
succes(data);
|
|
@@ -7408,7 +7538,7 @@ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, xm
|
|
|
7408
7538
|
})["catch"](function () {
|
|
7409
7539
|
loadGetCapabilitiesViaProxy(url, succes, function () {
|
|
7410
7540
|
fail("Request failed for ".concat(url));
|
|
7411
|
-
},
|
|
7541
|
+
}, WMServiceStoreXML2JSONRequest.proxy);
|
|
7412
7542
|
});
|
|
7413
7543
|
};
|
|
7414
7544
|
var sortByKey = function sortByKey(array, key) {
|
|
@@ -7443,13 +7573,15 @@ rootNode, path) {
|
|
|
7443
7573
|
keywords: toArray(layers[j].KeywordList && layers[j].KeywordList.Keyword).map(function (keywords) {
|
|
7444
7574
|
return keywords.value;
|
|
7445
7575
|
}),
|
|
7446
|
-
"abstract": layers[j].Abstract && layers[j].Abstract.value
|
|
7576
|
+
"abstract": layers[j].Abstract && layers[j].Abstract.value,
|
|
7577
|
+
styles: addStylesForLayer(layers[j])
|
|
7447
7578
|
};
|
|
7448
7579
|
} else {
|
|
7449
7580
|
var nodeText = isNull(layers[j].Title) ? 'Layer' : layers[j].Title.value;
|
|
7450
7581
|
nodeObject = {
|
|
7451
7582
|
text: nodeText,
|
|
7452
|
-
leaf: isleaf
|
|
7583
|
+
leaf: isleaf,
|
|
7584
|
+
styles: []
|
|
7453
7585
|
};
|
|
7454
7586
|
}
|
|
7455
7587
|
|
|
@@ -7457,7 +7589,7 @@ rootNode, path) {
|
|
|
7457
7589
|
|
|
7458
7590
|
if (layers[j].Layer) {
|
|
7459
7591
|
nodeObject.children = [];
|
|
7460
|
-
recursivelyFindLayer(toArray(layers[j].Layer), nodeObject.children, path
|
|
7592
|
+
recursivelyFindLayer(toArray(layers[j].Layer), nodeObject.children, [].concat(_toConsumableArray(path), [layers[j].Title.value]));
|
|
7461
7593
|
}
|
|
7462
7594
|
} // Sort nodes alphabetically.
|
|
7463
7595
|
|
|
@@ -7469,7 +7601,6 @@ rootNode, path) {
|
|
|
7469
7601
|
*
|
|
7470
7602
|
* options:
|
|
7471
7603
|
* service
|
|
7472
|
-
* xml2jsonrequestURL
|
|
7473
7604
|
* title (optional)
|
|
7474
7605
|
*/
|
|
7475
7606
|
|
|
@@ -7490,7 +7621,6 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7490
7621
|
if (options) {
|
|
7491
7622
|
this.service = options.service;
|
|
7492
7623
|
this.title = options.title;
|
|
7493
|
-
this.xml2jsonrequestURL = options.xml2jsonrequestURL;
|
|
7494
7624
|
}
|
|
7495
7625
|
|
|
7496
7626
|
this.checkVersion111 = this.checkVersion111.bind(this);
|
|
@@ -7613,7 +7743,7 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7613
7743
|
|
|
7614
7744
|
}, {
|
|
7615
7745
|
key: "getCapabilities",
|
|
7616
|
-
value: function getCapabilities(succescallback, failcallback, forceReload,
|
|
7746
|
+
value: function getCapabilities(succescallback, failcallback, forceReload, options) {
|
|
7617
7747
|
var _this = this;
|
|
7618
7748
|
|
|
7619
7749
|
if (options) {
|
|
@@ -7698,7 +7828,7 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7698
7828
|
return null;
|
|
7699
7829
|
}, function () {
|
|
7700
7830
|
return null;
|
|
7701
|
-
}, false,
|
|
7831
|
+
}, false, options);
|
|
7702
7832
|
|
|
7703
7833
|
var current;
|
|
7704
7834
|
|
|
@@ -7707,14 +7837,9 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7707
7837
|
}
|
|
7708
7838
|
};
|
|
7709
7839
|
|
|
7710
|
-
WMJSGetCapabilities(this.service, succes, fail,
|
|
7840
|
+
WMJSGetCapabilities(this.service, succes, fail, options);
|
|
7711
7841
|
} else {
|
|
7712
|
-
|
|
7713
|
-
By using window.setTimeOut they are externally called
|
|
7714
|
-
*/
|
|
7715
|
-
window.setTimeout(function () {
|
|
7716
|
-
succescallback(_this.getcapabilitiesDoc);
|
|
7717
|
-
}, 1);
|
|
7842
|
+
succescallback(this.getcapabilitiesDoc);
|
|
7718
7843
|
}
|
|
7719
7844
|
} // eslint-disable-next-line class-methods-use-this
|
|
7720
7845
|
|
|
@@ -7753,11 +7878,9 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7753
7878
|
|
|
7754
7879
|
}, {
|
|
7755
7880
|
key: "getNodes",
|
|
7756
|
-
value: function getNodes(succes, failure, forceReload) {
|
|
7881
|
+
value: function getNodes(succes, failure, forceReload, options) {
|
|
7757
7882
|
var _this2 = this;
|
|
7758
7883
|
|
|
7759
|
-
var xml2jsonrequestURL = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.xml2jsonrequestURL;
|
|
7760
|
-
var options = arguments.length > 4 ? arguments[4] : undefined;
|
|
7761
7884
|
this.nodeCache = undefined;
|
|
7762
7885
|
|
|
7763
7886
|
if (!failure) {
|
|
@@ -7794,7 +7917,7 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7794
7917
|
nodeStructure.text = I18n.unnamed_service.text;
|
|
7795
7918
|
}
|
|
7796
7919
|
|
|
7797
|
-
recursivelyFindLayer(WMSLayers, nodeStructure.children,
|
|
7920
|
+
recursivelyFindLayer(WMSLayers, nodeStructure.children, []);
|
|
7798
7921
|
succes(nodeStructure);
|
|
7799
7922
|
};
|
|
7800
7923
|
|
|
@@ -7806,7 +7929,7 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7806
7929
|
failure(data);
|
|
7807
7930
|
};
|
|
7808
7931
|
|
|
7809
|
-
this.getCapabilities(callback, fail, forceReload,
|
|
7932
|
+
this.getCapabilities(callback, fail, forceReload, options);
|
|
7810
7933
|
}
|
|
7811
7934
|
/** Calls succes with an array of all layerobjects
|
|
7812
7935
|
* Calls failure when something goes wrong
|
|
@@ -7817,13 +7940,7 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7817
7940
|
value: function getLayerObjectsFlat(succes, failure, forceReload) {
|
|
7818
7941
|
var _this3 = this;
|
|
7819
7942
|
|
|
7820
|
-
var
|
|
7821
|
-
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : this._options;
|
|
7822
|
-
|
|
7823
|
-
if (!xml2jsonrequestURL) {
|
|
7824
|
-
// eslint-disable-next-line no-param-reassign
|
|
7825
|
-
xml2jsonrequestURL = this.xml2jsonrequestURL;
|
|
7826
|
-
}
|
|
7943
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this._options;
|
|
7827
7944
|
|
|
7828
7945
|
if (isDefined(this._flatLayerObject) && forceReload !== true) {
|
|
7829
7946
|
succes(this._flatLayerObject);
|
|
@@ -7849,7 +7966,7 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7849
7966
|
succes(_this3._flatLayerObject);
|
|
7850
7967
|
};
|
|
7851
7968
|
|
|
7852
|
-
this.getNodes(callback, failure, forceReload,
|
|
7969
|
+
this.getNodes(callback, failure, forceReload, options);
|
|
7853
7970
|
}
|
|
7854
7971
|
}]);
|
|
7855
7972
|
|
|
@@ -7873,20 +7990,15 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7873
7990
|
* Copyright 2020 - Finnish Meteorological Institute (FMI)
|
|
7874
7991
|
* */
|
|
7875
7992
|
|
|
7876
|
-
var WMGetServiceFromStore = function WMGetServiceFromStore(serviceName
|
|
7993
|
+
var WMGetServiceFromStore = function WMGetServiceFromStore(serviceName) {
|
|
7877
7994
|
for (var j = 0; j < WMServiceStore.length; j += 1) {
|
|
7878
7995
|
if (WMServiceStore[j].service === serviceName) {
|
|
7879
7996
|
return WMServiceStore[j];
|
|
7880
7997
|
}
|
|
7881
7998
|
}
|
|
7882
7999
|
|
|
7883
|
-
if (xml2jsonrequestURL) {
|
|
7884
|
-
WMServiceStoreXML2JSONRequest.proxy = xml2jsonrequestURL;
|
|
7885
|
-
}
|
|
7886
|
-
|
|
7887
8000
|
var service = new WMJSService({
|
|
7888
|
-
service: serviceName
|
|
7889
|
-
xml2jsonrequestURL: WMServiceStoreXML2JSONRequest.proxy
|
|
8001
|
+
service: serviceName
|
|
7890
8002
|
});
|
|
7891
8003
|
WMServiceStore.push(service);
|
|
7892
8004
|
return service;
|
|
@@ -7899,55 +8011,6 @@ var LayerType;
|
|
|
7899
8011
|
LayerType["baseLayer"] = "baseLayer";
|
|
7900
8012
|
LayerType["overLayer"] = "overLayer";
|
|
7901
8013
|
})(LayerType || (LayerType = {}));
|
|
7902
|
-
/**
|
|
7903
|
-
* Helper function to figure out the styles from the WMS layer object from the WMS GetCapabilties document
|
|
7904
|
-
* @param layerStyles The layer styles object from the WMS GetCapabilities
|
|
7905
|
-
* @param layer The WMLayer to configure
|
|
7906
|
-
*/
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS, layer) {
|
|
7910
|
-
/* Get the Style object */
|
|
7911
|
-
if (!layerObjectFromWMS.Style) return;
|
|
7912
|
-
var layerStyles = toArray(layerObjectFromWMS.Style);
|
|
7913
|
-
/* 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 */
|
|
7914
|
-
|
|
7915
|
-
for (var k = 0; k < layerStyles.length; k += 1) {
|
|
7916
|
-
var layerStyle = layerStyles[k];
|
|
7917
|
-
var style = {
|
|
7918
|
-
title: 'default',
|
|
7919
|
-
name: 'default',
|
|
7920
|
-
legendURL: '',
|
|
7921
|
-
"abstract": 'No abstract available'
|
|
7922
|
-
};
|
|
7923
|
-
|
|
7924
|
-
try {
|
|
7925
|
-
style.title = layerStyle.Title.value;
|
|
7926
|
-
} catch (e) {
|
|
7927
|
-
/* Do nothing */
|
|
7928
|
-
}
|
|
7929
|
-
|
|
7930
|
-
try {
|
|
7931
|
-
style.name = layerStyle.Name.value;
|
|
7932
|
-
} catch (e) {
|
|
7933
|
-
/* Do nothing */
|
|
7934
|
-
}
|
|
7935
|
-
|
|
7936
|
-
try {
|
|
7937
|
-
style.legendURL = layerStyle.LegendURL.OnlineResource.attr['xlink:href'];
|
|
7938
|
-
} catch (e) {
|
|
7939
|
-
/* Do nothing */
|
|
7940
|
-
}
|
|
7941
|
-
|
|
7942
|
-
try {
|
|
7943
|
-
style["abstract"] = layerStyle.Abstract.value;
|
|
7944
|
-
} catch (e) {
|
|
7945
|
-
/* Do nothing */
|
|
7946
|
-
}
|
|
7947
|
-
|
|
7948
|
-
layer.styles.push(style);
|
|
7949
|
-
}
|
|
7950
|
-
};
|
|
7951
8014
|
/**
|
|
7952
8015
|
* Helper function to figure out the dimensions from the WMS layer object (From WMS GetCapabilities). Parses both WMS 1.1.1 and WMS 1.3.0.
|
|
7953
8016
|
* @param layerObjectFromWMS The corresponding layer object from the WMS GetCapabilities.
|
|
@@ -7955,6 +8018,7 @@ var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS, layer) {
|
|
|
7955
8018
|
* @param layerDimNamesToRemove A set of dimensions names which are flagged for removal, this function removes the dimension from the set if found in the layer.
|
|
7956
8019
|
*/
|
|
7957
8020
|
|
|
8021
|
+
|
|
7958
8022
|
var addDimsForLayer = function addDimsForLayer(layerObjectFromWMS, layer, layerDimNamesToRemove) {
|
|
7959
8023
|
/* Information from the WMS GetCapabilities document */
|
|
7960
8024
|
var layerDims = toArray(layerObjectFromWMS.Dimension);
|
|
@@ -8028,8 +8092,8 @@ var addDimsForLayer = function addDimsForLayer(layerObjectFromWMS, layer, layerD
|
|
|
8028
8092
|
});
|
|
8029
8093
|
/* Check if the dimension should take the value from the map */
|
|
8030
8094
|
|
|
8031
|
-
if (layer.
|
|
8032
|
-
var mapDim = layer.
|
|
8095
|
+
if (layer.parentMap) {
|
|
8096
|
+
var mapDim = layer.parentMap.getDimension(layerDim.name);
|
|
8033
8097
|
|
|
8034
8098
|
if (mapDim && mapDim.linked && isDefined(mapDim.currentValue)) {
|
|
8035
8099
|
var dimensionCurrentValue = dimension.getClosestValue(mapDim.currentValue);
|
|
@@ -8065,7 +8129,10 @@ var configureStyles = function configureStyles(nestedLayerPath, wmLayer) {
|
|
|
8065
8129
|
/* Now add the previous parent layer objects style info (inherit) and end with the Style info from this layer */
|
|
8066
8130
|
try {
|
|
8067
8131
|
for (var o = 0; o < nestedLayerPath.length; o += 1) {
|
|
8068
|
-
|
|
8132
|
+
var _wmLayer$styles;
|
|
8133
|
+
|
|
8134
|
+
// eslint-disable-next-line no-param-reassign
|
|
8135
|
+
(_wmLayer$styles = wmLayer.styles).push.apply(_wmLayer$styles, _toConsumableArray(addStylesForLayer(nestedLayerPath[o])));
|
|
8069
8136
|
} // eslint-disable-next-line no-empty
|
|
8070
8137
|
|
|
8071
8138
|
} catch (_a) {}
|
|
@@ -8134,8 +8201,8 @@ var configureDimensions = function configureDimensions(nestedLayerPath, wmLayer)
|
|
|
8134
8201
|
wmLayer.handleReferenceTime('reference_time', refTimeDimension.getValue());
|
|
8135
8202
|
}
|
|
8136
8203
|
|
|
8137
|
-
if (wmLayer.
|
|
8138
|
-
wmLayer.
|
|
8204
|
+
if (wmLayer.parentMap) {
|
|
8205
|
+
wmLayer.parentMap.configureMapDimensions(wmLayer);
|
|
8139
8206
|
}
|
|
8140
8207
|
};
|
|
8141
8208
|
|
|
@@ -8235,8 +8302,8 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8235
8302
|
this.type = options.type;
|
|
8236
8303
|
}
|
|
8237
8304
|
|
|
8238
|
-
if (options.
|
|
8239
|
-
this.
|
|
8305
|
+
if (options.parentMap) {
|
|
8306
|
+
this.parentMap = options.parentMap;
|
|
8240
8307
|
}
|
|
8241
8308
|
|
|
8242
8309
|
if (options.headers) {
|
|
@@ -8252,8 +8319,6 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8252
8319
|
this.timer = undefined;
|
|
8253
8320
|
this.service = undefined; // URL of the WMS Service
|
|
8254
8321
|
|
|
8255
|
-
this.WMJSService = undefined; // Corresponding WMJSService
|
|
8256
|
-
|
|
8257
8322
|
this.getmapURL = undefined;
|
|
8258
8323
|
this.getfeatureinfoURL = undefined;
|
|
8259
8324
|
this.getlegendgraphicURL = undefined;
|
|
@@ -8284,9 +8349,8 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8284
8349
|
this.id = '-1';
|
|
8285
8350
|
this.opacity = 1.0; // Ranges from 0.0-1.0
|
|
8286
8351
|
|
|
8287
|
-
this.getCapabilitiesDoc = undefined;
|
|
8288
8352
|
this.serviceTitle = 'not defined';
|
|
8289
|
-
this.
|
|
8353
|
+
this.parentMap = null;
|
|
8290
8354
|
this.sldURL = null;
|
|
8291
8355
|
this.isConfigured = false;
|
|
8292
8356
|
}
|
|
@@ -8305,7 +8369,7 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8305
8369
|
if (this.autoupdate) {
|
|
8306
8370
|
var numDeltaMS = 60000;
|
|
8307
8371
|
this.timer = setInterval(function () {
|
|
8308
|
-
_this.parseLayer(undefined, true,
|
|
8372
|
+
_this.parseLayer(undefined, true, 'WMLayer toggleAutoUpdate');
|
|
8309
8373
|
}, numDeltaMS);
|
|
8310
8374
|
} else {
|
|
8311
8375
|
clearInterval(this.timer);
|
|
@@ -8323,7 +8387,7 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8323
8387
|
clearInterval(this.timer);
|
|
8324
8388
|
} else {
|
|
8325
8389
|
this.timer = setInterval(function () {
|
|
8326
|
-
_this2.parseLayer(callback, true,
|
|
8390
|
+
_this2.parseLayer(callback, true, 'WMLayer setAutoUpdate');
|
|
8327
8391
|
}, interval);
|
|
8328
8392
|
}
|
|
8329
8393
|
}
|
|
@@ -8332,10 +8396,7 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8332
8396
|
key: "setOpacity",
|
|
8333
8397
|
value: function setOpacity(opacityValue) {
|
|
8334
8398
|
this.opacity = parseFloat(opacityValue);
|
|
8335
|
-
|
|
8336
|
-
for (var j = 0; j < this.parentMaps.length; j += 1) {
|
|
8337
|
-
this.parentMaps[j].redrawBuffer();
|
|
8338
|
-
}
|
|
8399
|
+
this.parentMap && this.parentMap.redrawBuffer();
|
|
8339
8400
|
}
|
|
8340
8401
|
}, {
|
|
8341
8402
|
key: "getOpacity",
|
|
@@ -8345,9 +8406,9 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8345
8406
|
}, {
|
|
8346
8407
|
key: "remove",
|
|
8347
8408
|
value: function remove() {
|
|
8348
|
-
|
|
8349
|
-
this.
|
|
8350
|
-
this.
|
|
8409
|
+
if (this.parentMap) {
|
|
8410
|
+
this.parentMap.deleteLayer(this);
|
|
8411
|
+
this.parentMap.draw('WMLayer::remove');
|
|
8351
8412
|
}
|
|
8352
8413
|
|
|
8353
8414
|
clearInterval(this.timer);
|
|
@@ -8355,31 +8416,31 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8355
8416
|
}, {
|
|
8356
8417
|
key: "moveUp",
|
|
8357
8418
|
value: function moveUp() {
|
|
8358
|
-
|
|
8359
|
-
this.
|
|
8360
|
-
this.
|
|
8419
|
+
if (this.parentMap) {
|
|
8420
|
+
this.parentMap.moveLayerUp(this);
|
|
8421
|
+
this.parentMap.draw('WMLayer::moveUp');
|
|
8361
8422
|
}
|
|
8362
8423
|
}
|
|
8363
8424
|
}, {
|
|
8364
8425
|
key: "moveDown",
|
|
8365
8426
|
value: function moveDown() {
|
|
8366
|
-
|
|
8367
|
-
this.
|
|
8368
|
-
this.
|
|
8427
|
+
if (this.parentMap) {
|
|
8428
|
+
this.parentMap.moveLayerDown(this);
|
|
8429
|
+
this.parentMap.draw('WMLayer::moveDown');
|
|
8369
8430
|
}
|
|
8370
8431
|
}
|
|
8371
8432
|
}, {
|
|
8372
8433
|
key: "zoomToLayer",
|
|
8373
8434
|
value: function zoomToLayer() {
|
|
8374
|
-
|
|
8375
|
-
this.
|
|
8435
|
+
if (this.parentMap) {
|
|
8436
|
+
this.parentMap.zoomToLayer(this);
|
|
8376
8437
|
}
|
|
8377
8438
|
}
|
|
8378
8439
|
}, {
|
|
8379
8440
|
key: "draw",
|
|
8380
8441
|
value: function draw(e) {
|
|
8381
|
-
|
|
8382
|
-
this.
|
|
8442
|
+
if (this.parentMap) {
|
|
8443
|
+
this.parentMap.draw("WMLayer::draw::".concat(e));
|
|
8383
8444
|
}
|
|
8384
8445
|
}
|
|
8385
8446
|
}, {
|
|
@@ -8395,9 +8456,9 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8395
8456
|
timeDim.setTimeValuesForReferenceTime(value, referenceTimeDim);
|
|
8396
8457
|
|
|
8397
8458
|
if (updateMapDimensions) {
|
|
8398
|
-
if (this.
|
|
8459
|
+
if (this.parentMap) {
|
|
8399
8460
|
if (this.enabled !== false) {
|
|
8400
|
-
this.
|
|
8461
|
+
this.parentMap.getListener().triggerEvent('ondimchange', 'time');
|
|
8401
8462
|
}
|
|
8402
8463
|
}
|
|
8403
8464
|
}
|
|
@@ -8424,43 +8485,41 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8424
8485
|
|
|
8425
8486
|
if (updateMapDimensions) {
|
|
8426
8487
|
if (dim.linked === true) {
|
|
8427
|
-
|
|
8428
|
-
this.
|
|
8488
|
+
if (this.parentMap) {
|
|
8489
|
+
this.parentMap.setDimension(name, dim.getValue());
|
|
8429
8490
|
}
|
|
8430
8491
|
}
|
|
8431
8492
|
}
|
|
8432
8493
|
}
|
|
8433
8494
|
}, {
|
|
8434
8495
|
key: "__parseGetCapForLayer",
|
|
8435
|
-
value: function __parseGetCapForLayer(
|
|
8496
|
+
value: function __parseGetCapForLayer(getcapabilitiesjson, layerDoneCallback, fail) {
|
|
8436
8497
|
var _this3 = this;
|
|
8437
8498
|
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
if (!jsondata) {
|
|
8499
|
+
if (!getcapabilitiesjson) {
|
|
8441
8500
|
this.title = I18n.service_has_error.text;
|
|
8442
8501
|
this["abstract"] = I18n.not_available_message.text;
|
|
8443
|
-
fail(
|
|
8502
|
+
fail(this, I18n.unable_to_connect_server.text);
|
|
8444
8503
|
return;
|
|
8445
8504
|
}
|
|
8446
8505
|
|
|
8447
|
-
var
|
|
8506
|
+
var wmjsService = WMGetServiceFromStore(this.service); // Get the capability object
|
|
8448
8507
|
|
|
8449
8508
|
var capabilityObject;
|
|
8450
8509
|
|
|
8451
8510
|
try {
|
|
8452
|
-
capabilityObject =
|
|
8511
|
+
capabilityObject = wmjsService.getCapabilityElement(getcapabilitiesjson);
|
|
8453
8512
|
} catch (_a) {
|
|
8454
|
-
fail(
|
|
8513
|
+
fail(this, 'No capability element in service');
|
|
8455
8514
|
return;
|
|
8456
8515
|
}
|
|
8457
8516
|
|
|
8458
|
-
this.version =
|
|
8517
|
+
this.version = wmjsService.version; // Get the rootLayer
|
|
8459
8518
|
|
|
8460
8519
|
var rootLayer = capabilityObject.Layer;
|
|
8461
8520
|
|
|
8462
8521
|
if (!isDefined(rootLayer)) {
|
|
8463
|
-
fail(
|
|
8522
|
+
fail(this, 'No Layer element in service');
|
|
8464
8523
|
return;
|
|
8465
8524
|
}
|
|
8466
8525
|
|
|
@@ -8490,52 +8549,58 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8490
8549
|
return;
|
|
8491
8550
|
}
|
|
8492
8551
|
|
|
8493
|
-
|
|
8552
|
+
this.getmapURL = undefined;
|
|
8494
8553
|
|
|
8495
|
-
|
|
8496
|
-
|
|
8554
|
+
try {
|
|
8555
|
+
this.getmapURL = capabilityObject.Request.GetMap.DCPType.HTTP.Get.OnlineResource.attr['xlink:href'];
|
|
8556
|
+
} catch (e) {
|
|
8557
|
+
/* Do nothing */
|
|
8558
|
+
}
|
|
8497
8559
|
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
}
|
|
8560
|
+
if (!isDefined(this.getmapURL)) {
|
|
8561
|
+
this.getmapURL = this.service;
|
|
8562
|
+
debug(DebugType.Error);
|
|
8563
|
+
}
|
|
8503
8564
|
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8565
|
+
this.getfeatureinfoURL = undefined;
|
|
8566
|
+
|
|
8567
|
+
try {
|
|
8568
|
+
this.getfeatureinfoURL = capabilityObject.Request.GetFeatureInfo.DCPType.HTTP.Get.OnlineResource.attr['xlink:href'];
|
|
8569
|
+
} catch (e) {
|
|
8570
|
+
/* Do nothing */
|
|
8571
|
+
}
|
|
8508
8572
|
|
|
8509
|
-
|
|
8573
|
+
if (!isDefined(this.getfeatureinfoURL)) {
|
|
8574
|
+
this.getfeatureinfoURL = this.service;
|
|
8575
|
+
debug(DebugType.Error);
|
|
8576
|
+
}
|
|
8510
8577
|
|
|
8511
|
-
|
|
8512
|
-
_this3.getfeatureinfoURL = capabilityObject.Request.GetFeatureInfo.DCPType.HTTP.Get.OnlineResource.attr['xlink:href'];
|
|
8513
|
-
} catch (e) {
|
|
8514
|
-
/* Do nothing */
|
|
8515
|
-
}
|
|
8578
|
+
this.getlegendgraphicURL = undefined;
|
|
8516
8579
|
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8580
|
+
try {
|
|
8581
|
+
this.getlegendgraphicURL = capabilityObject.Request.GetLegendGraphic.DCPType.HTTP.Get.OnlineResource.attr['xlink:href'];
|
|
8582
|
+
} catch (e) {
|
|
8583
|
+
/* Do nothing */
|
|
8584
|
+
}
|
|
8521
8585
|
|
|
8522
|
-
|
|
8586
|
+
if (!isDefined(this.getlegendgraphicURL)) {
|
|
8587
|
+
this.getlegendgraphicURL = this.service;
|
|
8588
|
+
} // TODO Should be arranged also for the other services:
|
|
8523
8589
|
|
|
8524
|
-
try {
|
|
8525
|
-
_this3.getlegendgraphicURL = capabilityObject.Request.GetLegendGraphic.DCPType.HTTP.Get.OnlineResource.attr['xlink:href'];
|
|
8526
|
-
} catch (e) {
|
|
8527
|
-
/* Do nothing */
|
|
8528
|
-
}
|
|
8529
8590
|
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8591
|
+
this.getmapURL = WMJScheckURL(this.getmapURL);
|
|
8592
|
+
this.getfeatureinfoURL = WMJScheckURL(this.getfeatureinfoURL);
|
|
8593
|
+
this.getlegendgraphicURL = WMJScheckURL(this.getlegendgraphicURL);
|
|
8594
|
+
this.styles = [];
|
|
8595
|
+
this.projectionProperties = [];
|
|
8596
|
+
/* Set default to layer name, try to find details in next steps */
|
|
8533
8597
|
|
|
8598
|
+
this.title = this.name;
|
|
8599
|
+
this["abstract"] = '';
|
|
8600
|
+
this.path = '';
|
|
8601
|
+
var foundLayer = 0; // Function will be called when the layer with the right name is found in the getcap doc
|
|
8534
8602
|
|
|
8535
|
-
|
|
8536
|
-
_this3.getfeatureinfoURL = WMJScheckURL(layer.getfeatureinfoURL);
|
|
8537
|
-
_this3.getlegendgraphicURL = WMJScheckURL(layer.getlegendgraphicURL);
|
|
8538
|
-
_this3.getCapabilitiesDoc = jsondata;
|
|
8603
|
+
var foundLayerFunction = function foundLayerFunction(jsonlayer, path, nestedLayerPath) {
|
|
8539
8604
|
_this3.title = jsonlayer.Title.value;
|
|
8540
8605
|
|
|
8541
8606
|
try {
|
|
@@ -8545,7 +8610,6 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8545
8610
|
}
|
|
8546
8611
|
|
|
8547
8612
|
_this3.path = path;
|
|
8548
|
-
_this3.styles = [];
|
|
8549
8613
|
/** ***************** Go through styles **************** */
|
|
8550
8614
|
|
|
8551
8615
|
configureStyles(nestedLayerPath, _this3);
|
|
@@ -8558,7 +8622,6 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8558
8622
|
gp = toArray(jsonlayer.CRS);
|
|
8559
8623
|
}
|
|
8560
8624
|
|
|
8561
|
-
_this3.projectionProperties = [];
|
|
8562
8625
|
var tempSRS = [];
|
|
8563
8626
|
|
|
8564
8627
|
var getgpbbox = function getgpbbox(data) {
|
|
@@ -8566,7 +8629,7 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8566
8629
|
// Fill in SRS and BBOX on basis of BoundingBox attribute
|
|
8567
8630
|
var gpbbox = toArray(data.BoundingBox);
|
|
8568
8631
|
|
|
8569
|
-
for (j = 0; j < gpbbox.length; j += 1) {
|
|
8632
|
+
for (var j = 0; j < gpbbox.length; j += 1) {
|
|
8570
8633
|
var srs = void 0;
|
|
8571
8634
|
srs = gpbbox[j].attr.SRS;
|
|
8572
8635
|
|
|
@@ -8594,8 +8657,8 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8594
8657
|
geoProperty.srs = srs;
|
|
8595
8658
|
var swapBBOX = false;
|
|
8596
8659
|
|
|
8597
|
-
if (
|
|
8598
|
-
if (geoProperty.srs === 'EPSG:4326' &&
|
|
8660
|
+
if (_this3.version === WMSVersion.version130) {
|
|
8661
|
+
if (geoProperty.srs === 'EPSG:4326' && _this3.wms130bboxcompatibilitymode === false) {
|
|
8599
8662
|
swapBBOX = true;
|
|
8600
8663
|
}
|
|
8601
8664
|
}
|
|
@@ -8623,7 +8686,7 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8623
8686
|
getgpbbox(jsonlayer);
|
|
8624
8687
|
getgpbbox(rootLayer); // Fill in SRS on basis of SRS attribute
|
|
8625
8688
|
|
|
8626
|
-
for (j = 0; j < gp.length; j += 1) {
|
|
8689
|
+
for (var j = 0; j < gp.length; j += 1) {
|
|
8627
8690
|
if (tempSRS.indexOf(gp[j].value) === -1) {
|
|
8628
8691
|
var geoProperty = new WMProjection();
|
|
8629
8692
|
debug(DebugType.Error, "Warning: BoundingBOX missing for SRS ".concat(gp[j].value));
|
|
@@ -8632,7 +8695,8 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8632
8695
|
geoProperty.bbox.right = 180;
|
|
8633
8696
|
geoProperty.bbox.top = 90;
|
|
8634
8697
|
geoProperty.srs = gp[j].value;
|
|
8635
|
-
|
|
8698
|
+
|
|
8699
|
+
_this3.projectionProperties.push(geoProperty);
|
|
8636
8700
|
}
|
|
8637
8701
|
}
|
|
8638
8702
|
|
|
@@ -8644,13 +8708,13 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8644
8708
|
try {
|
|
8645
8709
|
if (parseInt(jsonlayer.attr.queryable, 10) === 1) _this3.queryable = true;else _this3.queryable = false;
|
|
8646
8710
|
} catch (e) {
|
|
8647
|
-
debug(DebugType.Error, "Unable to detect whether this layer is queryable (for layer ".concat(
|
|
8711
|
+
debug(DebugType.Error, "Unable to detect whether this layer is queryable (for layer ".concat(_this3.title, ")"));
|
|
8648
8712
|
}
|
|
8649
8713
|
|
|
8650
8714
|
foundLayer = 1;
|
|
8651
8715
|
};
|
|
8652
8716
|
|
|
8653
|
-
function recursivelyFindLayer(JSONLayers, path, _prevNestedLayerPath) {
|
|
8717
|
+
function recursivelyFindLayer(thisLayer, JSONLayers, path, _prevNestedLayerPath) {
|
|
8654
8718
|
for (var k = 0; k < JSONLayers.length; k += 1) {
|
|
8655
8719
|
var _nestedLayerPath = [];
|
|
8656
8720
|
|
|
@@ -8669,9 +8733,9 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8669
8733
|
/* Do nothing */
|
|
8670
8734
|
}
|
|
8671
8735
|
|
|
8672
|
-
recursivelyFindLayer(toArray(JSONLayers[k].Layer), pathnew, _nestedLayerPath);
|
|
8736
|
+
recursivelyFindLayer(thisLayer, toArray(JSONLayers[k].Layer), pathnew, _nestedLayerPath);
|
|
8673
8737
|
} else if (JSONLayers[k].Name) {
|
|
8674
|
-
if (JSONLayers[k].Name.value ===
|
|
8738
|
+
if (JSONLayers[k].Name.value === thisLayer.name) {
|
|
8675
8739
|
foundLayerFunction(JSONLayers[k], path, _nestedLayerPath);
|
|
8676
8740
|
return;
|
|
8677
8741
|
}
|
|
@@ -8683,13 +8747,13 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8683
8747
|
var JSONLayers = toArray(rootLayer.Layer);
|
|
8684
8748
|
var path = '';
|
|
8685
8749
|
var nestedLayerPath = [rootLayer];
|
|
8686
|
-
recursivelyFindLayer(JSONLayers, path, nestedLayerPath);
|
|
8750
|
+
recursivelyFindLayer(this, JSONLayers, path, nestedLayerPath);
|
|
8687
8751
|
|
|
8688
8752
|
if (foundLayer === 0) {
|
|
8689
8753
|
// Layer was not found...
|
|
8690
8754
|
var message = '';
|
|
8691
8755
|
|
|
8692
|
-
if (
|
|
8756
|
+
if (this.name) {
|
|
8693
8757
|
message = "Unable to find layer '".concat(this.name, "' in service '").concat(this.service, "'");
|
|
8694
8758
|
} else {
|
|
8695
8759
|
message = "Unable to find layer '".concat(this.title, "' in service '").concat(this.service, "'");
|
|
@@ -8718,7 +8782,8 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8718
8782
|
|
|
8719
8783
|
}, {
|
|
8720
8784
|
key: "parseLayer",
|
|
8721
|
-
value: function parseLayer(_layerDoneCallback, forceReload,
|
|
8785
|
+
value: function parseLayer(_layerDoneCallback, forceReload, // eslint-disable-next-line no-unused-vars
|
|
8786
|
+
origin) {
|
|
8722
8787
|
var _this4 = this;
|
|
8723
8788
|
|
|
8724
8789
|
this.hasError = false;
|
|
@@ -8726,7 +8791,10 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8726
8791
|
var layerDoneCallback = function layerDoneCallback(__layer) {
|
|
8727
8792
|
if (isDefined(_layerDoneCallback)) {
|
|
8728
8793
|
try {
|
|
8729
|
-
|
|
8794
|
+
/* Enable these two console timings to do performance measurments of parseLayer */
|
|
8795
|
+
// console.time(origin);
|
|
8796
|
+
_layerDoneCallback(__layer); // console.timeEnd(origin);
|
|
8797
|
+
|
|
8730
8798
|
} catch (e) {
|
|
8731
8799
|
debug(DebugType.Error);
|
|
8732
8800
|
}
|
|
@@ -8745,20 +8813,13 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8745
8813
|
};
|
|
8746
8814
|
|
|
8747
8815
|
var callback = function callback(data) {
|
|
8748
|
-
_this4.__parseGetCapForLayer(
|
|
8816
|
+
_this4.__parseGetCapForLayer(data, layerDoneCallback, fail);
|
|
8749
8817
|
};
|
|
8750
8818
|
|
|
8751
8819
|
var requestfail = function requestfail() {
|
|
8752
8820
|
fail(_this4, I18n.no_capability_element_found.text);
|
|
8753
8821
|
};
|
|
8754
8822
|
|
|
8755
|
-
var newXml2jsonrequest = xml2jsonrequest;
|
|
8756
|
-
|
|
8757
|
-
if (!xml2jsonrequest) {
|
|
8758
|
-
newXml2jsonrequest = this.parentMaps && this.parentMaps.length > 0 ? this.parentMaps[0].xml2jsonrequest : undefined;
|
|
8759
|
-
}
|
|
8760
|
-
|
|
8761
|
-
this.WMJSService = WMGetServiceFromStore(this.service, newXml2jsonrequest);
|
|
8762
8823
|
var options = {
|
|
8763
8824
|
headers: {}
|
|
8764
8825
|
};
|
|
@@ -8767,10 +8828,12 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8767
8828
|
options.headers = this.headers;
|
|
8768
8829
|
}
|
|
8769
8830
|
|
|
8770
|
-
|
|
8771
|
-
|
|
8831
|
+
var wmjsService = WMGetServiceFromStore(this.service);
|
|
8832
|
+
|
|
8833
|
+
if (wmjsService.service !== undefined) {
|
|
8834
|
+
wmjsService.getCapabilities(function (data) {
|
|
8772
8835
|
callback(data);
|
|
8773
|
-
}, requestfail, forceReload,
|
|
8836
|
+
}, requestfail, forceReload, options);
|
|
8774
8837
|
}
|
|
8775
8838
|
}
|
|
8776
8839
|
/**
|
|
@@ -8793,7 +8856,7 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8793
8856
|
} else {
|
|
8794
8857
|
resolve(layer);
|
|
8795
8858
|
}
|
|
8796
|
-
}, forceReload);
|
|
8859
|
+
}, forceReload, 'WMLayer parseLayerPromise');
|
|
8797
8860
|
});
|
|
8798
8861
|
}
|
|
8799
8862
|
}, {
|
|
@@ -8846,7 +8909,8 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8846
8909
|
success(layerObjects[currentLayerIndex], currentLayerIndex, layerObjects.length);
|
|
8847
8910
|
};
|
|
8848
8911
|
|
|
8849
|
-
this.
|
|
8912
|
+
var wmjsService = WMGetServiceFromStore(this.service);
|
|
8913
|
+
wmjsService.getLayerObjectsFlat(getLayerObjectsFinished, failure, undefined);
|
|
8850
8914
|
}
|
|
8851
8915
|
}, {
|
|
8852
8916
|
key: "autoSelectLayer",
|
|
@@ -8864,7 +8928,8 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8864
8928
|
}
|
|
8865
8929
|
};
|
|
8866
8930
|
|
|
8867
|
-
this.
|
|
8931
|
+
var wmjsService = WMGetServiceFromStore(this.service);
|
|
8932
|
+
wmjsService.getLayerObjectsFlat(getLayerObjectsFinished, failure, undefined);
|
|
8868
8933
|
}
|
|
8869
8934
|
}, {
|
|
8870
8935
|
key: "getNextLayer",
|
|
@@ -9040,8 +9105,8 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
9040
9105
|
value: function display(displayornot) {
|
|
9041
9106
|
this.enabled = displayornot;
|
|
9042
9107
|
|
|
9043
|
-
|
|
9044
|
-
this.
|
|
9108
|
+
if (this.parentMap) {
|
|
9109
|
+
this.parentMap.displayLayer(this, this.enabled);
|
|
9045
9110
|
}
|
|
9046
9111
|
}
|
|
9047
9112
|
}]);
|