@opengeoweb/webmap 2.1.3 → 2.2.1
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} +249 -148
- package/{webmap.umd.js → index.umd.js} +240 -149
- package/lib/components/WMCanvasBuffer.d.ts +4 -4
- package/lib/components/WMImage.d.ts +17 -0
- package/lib/components/WMJSDimension.d.ts +15 -4
- package/lib/components/WMJSService.d.ts +4 -2
- package/lib/components/WMJSTools.d.ts +7 -0
- package/lib/components/WMLayer.d.ts +2 -17
- 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
|
*/
|
|
@@ -4907,7 +5046,7 @@ var WMJSMap = /*#__PURE__*/function () {
|
|
|
4907
5046
|
resolve(_this5);
|
|
4908
5047
|
};
|
|
4909
5048
|
|
|
4910
|
-
layer.parseLayer(done, undefined);
|
|
5049
|
+
layer.parseLayer(done, undefined, 'WMJSMap addLayer');
|
|
4911
5050
|
});
|
|
4912
5051
|
}
|
|
4913
5052
|
}, {
|
|
@@ -7434,13 +7573,15 @@ rootNode, path) {
|
|
|
7434
7573
|
keywords: toArray(layers[j].KeywordList && layers[j].KeywordList.Keyword).map(function (keywords) {
|
|
7435
7574
|
return keywords.value;
|
|
7436
7575
|
}),
|
|
7437
|
-
"abstract": layers[j].Abstract && layers[j].Abstract.value
|
|
7576
|
+
"abstract": layers[j].Abstract && layers[j].Abstract.value,
|
|
7577
|
+
styles: addStylesForLayer(layers[j])
|
|
7438
7578
|
};
|
|
7439
7579
|
} else {
|
|
7440
7580
|
var nodeText = isNull(layers[j].Title) ? 'Layer' : layers[j].Title.value;
|
|
7441
7581
|
nodeObject = {
|
|
7442
7582
|
text: nodeText,
|
|
7443
|
-
leaf: isleaf
|
|
7583
|
+
leaf: isleaf,
|
|
7584
|
+
styles: []
|
|
7444
7585
|
};
|
|
7445
7586
|
}
|
|
7446
7587
|
|
|
@@ -7448,7 +7589,7 @@ rootNode, path) {
|
|
|
7448
7589
|
|
|
7449
7590
|
if (layers[j].Layer) {
|
|
7450
7591
|
nodeObject.children = [];
|
|
7451
|
-
recursivelyFindLayer(toArray(layers[j].Layer), nodeObject.children, path
|
|
7592
|
+
recursivelyFindLayer(toArray(layers[j].Layer), nodeObject.children, [].concat(_toConsumableArray(path), [layers[j].Title.value]));
|
|
7452
7593
|
}
|
|
7453
7594
|
} // Sort nodes alphabetically.
|
|
7454
7595
|
|
|
@@ -7698,12 +7839,7 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7698
7839
|
|
|
7699
7840
|
WMJSGetCapabilities(this.service, succes, fail, options);
|
|
7700
7841
|
} else {
|
|
7701
|
-
|
|
7702
|
-
By using window.setTimeOut they are externally called
|
|
7703
|
-
*/
|
|
7704
|
-
window.setTimeout(function () {
|
|
7705
|
-
succescallback(_this.getcapabilitiesDoc);
|
|
7706
|
-
}, 1);
|
|
7842
|
+
succescallback(this.getcapabilitiesDoc);
|
|
7707
7843
|
}
|
|
7708
7844
|
} // eslint-disable-next-line class-methods-use-this
|
|
7709
7845
|
|
|
@@ -7781,7 +7917,7 @@ var WMJSService = /*#__PURE__*/function () {
|
|
|
7781
7917
|
nodeStructure.text = I18n.unnamed_service.text;
|
|
7782
7918
|
}
|
|
7783
7919
|
|
|
7784
|
-
recursivelyFindLayer(WMSLayers, nodeStructure.children,
|
|
7920
|
+
recursivelyFindLayer(WMSLayers, nodeStructure.children, []);
|
|
7785
7921
|
succes(nodeStructure);
|
|
7786
7922
|
};
|
|
7787
7923
|
|
|
@@ -7875,55 +8011,6 @@ var LayerType;
|
|
|
7875
8011
|
LayerType["baseLayer"] = "baseLayer";
|
|
7876
8012
|
LayerType["overLayer"] = "overLayer";
|
|
7877
8013
|
})(LayerType || (LayerType = {}));
|
|
7878
|
-
/**
|
|
7879
|
-
* Helper function to figure out the styles from the WMS layer object from the WMS GetCapabilties document
|
|
7880
|
-
* @param layerStyles The layer styles object from the WMS GetCapabilities
|
|
7881
|
-
* @param layer The WMLayer to configure
|
|
7882
|
-
*/
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS, layer) {
|
|
7886
|
-
/* Get the Style object */
|
|
7887
|
-
if (!layerObjectFromWMS.Style) return;
|
|
7888
|
-
var layerStyles = toArray(layerObjectFromWMS.Style);
|
|
7889
|
-
/* 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 */
|
|
7890
|
-
|
|
7891
|
-
for (var k = 0; k < layerStyles.length; k += 1) {
|
|
7892
|
-
var layerStyle = layerStyles[k];
|
|
7893
|
-
var style = {
|
|
7894
|
-
title: 'default',
|
|
7895
|
-
name: 'default',
|
|
7896
|
-
legendURL: '',
|
|
7897
|
-
"abstract": 'No abstract available'
|
|
7898
|
-
};
|
|
7899
|
-
|
|
7900
|
-
try {
|
|
7901
|
-
style.title = layerStyle.Title.value;
|
|
7902
|
-
} catch (e) {
|
|
7903
|
-
/* Do nothing */
|
|
7904
|
-
}
|
|
7905
|
-
|
|
7906
|
-
try {
|
|
7907
|
-
style.name = layerStyle.Name.value;
|
|
7908
|
-
} catch (e) {
|
|
7909
|
-
/* Do nothing */
|
|
7910
|
-
}
|
|
7911
|
-
|
|
7912
|
-
try {
|
|
7913
|
-
style.legendURL = layerStyle.LegendURL.OnlineResource.attr['xlink:href'];
|
|
7914
|
-
} catch (e) {
|
|
7915
|
-
/* Do nothing */
|
|
7916
|
-
}
|
|
7917
|
-
|
|
7918
|
-
try {
|
|
7919
|
-
style["abstract"] = layerStyle.Abstract.value;
|
|
7920
|
-
} catch (e) {
|
|
7921
|
-
/* Do nothing */
|
|
7922
|
-
}
|
|
7923
|
-
|
|
7924
|
-
layer.styles.push(style);
|
|
7925
|
-
}
|
|
7926
|
-
};
|
|
7927
8014
|
/**
|
|
7928
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.
|
|
7929
8016
|
* @param layerObjectFromWMS The corresponding layer object from the WMS GetCapabilities.
|
|
@@ -7931,6 +8018,7 @@ var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS, layer) {
|
|
|
7931
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.
|
|
7932
8019
|
*/
|
|
7933
8020
|
|
|
8021
|
+
|
|
7934
8022
|
var addDimsForLayer = function addDimsForLayer(layerObjectFromWMS, layer, layerDimNamesToRemove) {
|
|
7935
8023
|
/* Information from the WMS GetCapabilities document */
|
|
7936
8024
|
var layerDims = toArray(layerObjectFromWMS.Dimension);
|
|
@@ -8041,7 +8129,10 @@ var configureStyles = function configureStyles(nestedLayerPath, wmLayer) {
|
|
|
8041
8129
|
/* Now add the previous parent layer objects style info (inherit) and end with the Style info from this layer */
|
|
8042
8130
|
try {
|
|
8043
8131
|
for (var o = 0; o < nestedLayerPath.length; o += 1) {
|
|
8044
|
-
|
|
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])));
|
|
8045
8136
|
} // eslint-disable-next-line no-empty
|
|
8046
8137
|
|
|
8047
8138
|
} catch (_a) {}
|
|
@@ -8278,7 +8369,7 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8278
8369
|
if (this.autoupdate) {
|
|
8279
8370
|
var numDeltaMS = 60000;
|
|
8280
8371
|
this.timer = setInterval(function () {
|
|
8281
|
-
_this.parseLayer(undefined, true);
|
|
8372
|
+
_this.parseLayer(undefined, true, 'WMLayer toggleAutoUpdate');
|
|
8282
8373
|
}, numDeltaMS);
|
|
8283
8374
|
} else {
|
|
8284
8375
|
clearInterval(this.timer);
|
|
@@ -8296,7 +8387,7 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8296
8387
|
clearInterval(this.timer);
|
|
8297
8388
|
} else {
|
|
8298
8389
|
this.timer = setInterval(function () {
|
|
8299
|
-
_this2.parseLayer(callback, true);
|
|
8390
|
+
_this2.parseLayer(callback, true, 'WMLayer setAutoUpdate');
|
|
8300
8391
|
}, interval);
|
|
8301
8392
|
}
|
|
8302
8393
|
}
|
|
@@ -8458,51 +8549,58 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8458
8549
|
return;
|
|
8459
8550
|
}
|
|
8460
8551
|
|
|
8461
|
-
|
|
8552
|
+
this.getmapURL = undefined;
|
|
8462
8553
|
|
|
8463
|
-
|
|
8464
|
-
|
|
8554
|
+
try {
|
|
8555
|
+
this.getmapURL = capabilityObject.Request.GetMap.DCPType.HTTP.Get.OnlineResource.attr['xlink:href'];
|
|
8556
|
+
} catch (e) {
|
|
8557
|
+
/* Do nothing */
|
|
8558
|
+
}
|
|
8465
8559
|
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
}
|
|
8560
|
+
if (!isDefined(this.getmapURL)) {
|
|
8561
|
+
this.getmapURL = this.service;
|
|
8562
|
+
debug(DebugType.Error);
|
|
8563
|
+
}
|
|
8471
8564
|
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
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
|
+
}
|
|
8476
8572
|
|
|
8477
|
-
|
|
8573
|
+
if (!isDefined(this.getfeatureinfoURL)) {
|
|
8574
|
+
this.getfeatureinfoURL = this.service;
|
|
8575
|
+
debug(DebugType.Error);
|
|
8576
|
+
}
|
|
8478
8577
|
|
|
8479
|
-
|
|
8480
|
-
_this3.getfeatureinfoURL = capabilityObject.Request.GetFeatureInfo.DCPType.HTTP.Get.OnlineResource.attr['xlink:href'];
|
|
8481
|
-
} catch (e) {
|
|
8482
|
-
/* Do nothing */
|
|
8483
|
-
}
|
|
8578
|
+
this.getlegendgraphicURL = undefined;
|
|
8484
8579
|
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8580
|
+
try {
|
|
8581
|
+
this.getlegendgraphicURL = capabilityObject.Request.GetLegendGraphic.DCPType.HTTP.Get.OnlineResource.attr['xlink:href'];
|
|
8582
|
+
} catch (e) {
|
|
8583
|
+
/* Do nothing */
|
|
8584
|
+
}
|
|
8489
8585
|
|
|
8490
|
-
|
|
8586
|
+
if (!isDefined(this.getlegendgraphicURL)) {
|
|
8587
|
+
this.getlegendgraphicURL = this.service;
|
|
8588
|
+
} // TODO Should be arranged also for the other services:
|
|
8491
8589
|
|
|
8492
|
-
try {
|
|
8493
|
-
_this3.getlegendgraphicURL = capabilityObject.Request.GetLegendGraphic.DCPType.HTTP.Get.OnlineResource.attr['xlink:href'];
|
|
8494
|
-
} catch (e) {
|
|
8495
|
-
/* Do nothing */
|
|
8496
|
-
}
|
|
8497
8590
|
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
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 */
|
|
8501
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
|
|
8502
8602
|
|
|
8503
|
-
|
|
8504
|
-
_this3.getfeatureinfoURL = WMJScheckURL(_this3.getfeatureinfoURL);
|
|
8505
|
-
_this3.getlegendgraphicURL = WMJScheckURL(_this3.getlegendgraphicURL);
|
|
8603
|
+
var foundLayerFunction = function foundLayerFunction(jsonlayer, path, nestedLayerPath) {
|
|
8506
8604
|
_this3.title = jsonlayer.Title.value;
|
|
8507
8605
|
|
|
8508
8606
|
try {
|
|
@@ -8512,7 +8610,6 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8512
8610
|
}
|
|
8513
8611
|
|
|
8514
8612
|
_this3.path = path;
|
|
8515
|
-
_this3.styles = [];
|
|
8516
8613
|
/** ***************** Go through styles **************** */
|
|
8517
8614
|
|
|
8518
8615
|
configureStyles(nestedLayerPath, _this3);
|
|
@@ -8525,7 +8622,6 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8525
8622
|
gp = toArray(jsonlayer.CRS);
|
|
8526
8623
|
}
|
|
8527
8624
|
|
|
8528
|
-
_this3.projectionProperties = [];
|
|
8529
8625
|
var tempSRS = [];
|
|
8530
8626
|
|
|
8531
8627
|
var getgpbbox = function getgpbbox(data) {
|
|
@@ -8686,7 +8782,8 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8686
8782
|
|
|
8687
8783
|
}, {
|
|
8688
8784
|
key: "parseLayer",
|
|
8689
|
-
value: function parseLayer(_layerDoneCallback, forceReload
|
|
8785
|
+
value: function parseLayer(_layerDoneCallback, forceReload, // eslint-disable-next-line no-unused-vars
|
|
8786
|
+
origin) {
|
|
8690
8787
|
var _this4 = this;
|
|
8691
8788
|
|
|
8692
8789
|
this.hasError = false;
|
|
@@ -8694,7 +8791,10 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8694
8791
|
var layerDoneCallback = function layerDoneCallback(__layer) {
|
|
8695
8792
|
if (isDefined(_layerDoneCallback)) {
|
|
8696
8793
|
try {
|
|
8697
|
-
|
|
8794
|
+
/* Enable these two console timings to do performance measurments of parseLayer */
|
|
8795
|
+
// console.time(origin);
|
|
8796
|
+
_layerDoneCallback(__layer); // console.timeEnd(origin);
|
|
8797
|
+
|
|
8698
8798
|
} catch (e) {
|
|
8699
8799
|
debug(DebugType.Error);
|
|
8700
8800
|
}
|
|
@@ -8720,7 +8820,6 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8720
8820
|
fail(_this4, I18n.no_capability_element_found.text);
|
|
8721
8821
|
};
|
|
8722
8822
|
|
|
8723
|
-
var wmjsService = WMGetServiceFromStore(this.service);
|
|
8724
8823
|
var options = {
|
|
8725
8824
|
headers: {}
|
|
8726
8825
|
};
|
|
@@ -8729,6 +8828,8 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8729
8828
|
options.headers = this.headers;
|
|
8730
8829
|
}
|
|
8731
8830
|
|
|
8831
|
+
var wmjsService = WMGetServiceFromStore(this.service);
|
|
8832
|
+
|
|
8732
8833
|
if (wmjsService.service !== undefined) {
|
|
8733
8834
|
wmjsService.getCapabilities(function (data) {
|
|
8734
8835
|
callback(data);
|
|
@@ -8755,7 +8856,7 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8755
8856
|
} else {
|
|
8756
8857
|
resolve(layer);
|
|
8757
8858
|
}
|
|
8758
|
-
}, forceReload);
|
|
8859
|
+
}, forceReload, 'WMLayer parseLayerPromise');
|
|
8759
8860
|
});
|
|
8760
8861
|
}
|
|
8761
8862
|
}, {
|