@opengeoweb/webmap 10.0.0 → 10.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/index.esm.js +290 -68
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/lib/components/IWMJSMap.d.ts +2 -2
- package/src/lib/components/WMConstants.d.ts +1 -0
- package/src/lib/components/WMImage.d.ts +12 -2
- package/src/lib/components/WMImageStore.d.ts +14 -2
- package/src/lib/components/WMJSDimension.d.ts +2 -1
- package/src/lib/components/makeHashUrlForGeoReferencedImage.d.ts +6 -0
- package/src/lib/components/makeHashUrlForGeoReferencedImage.spec.d.ts +1 -0
- package/src/lib/specs/index.d.ts +1 -0
- package/src/lib/specs/mockGetCapabilities.d.ts +1 -0
- package/src/lib/utils/consoleErrorMessages.d.ts +1 -0
- package/src/lib/utils/getCapabilities/utils.d.ts +7 -1
package/index.esm.js
CHANGED
|
@@ -383,6 +383,41 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
+
/* *
|
|
387
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
388
|
+
* you may not use this file except in compliance with the License.
|
|
389
|
+
* You may obtain a copy of the License at
|
|
390
|
+
*
|
|
391
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
392
|
+
*
|
|
393
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
394
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
395
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
396
|
+
* See the License for the specific language governing permissions and
|
|
397
|
+
* limitations under the License.
|
|
398
|
+
*
|
|
399
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
400
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
401
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
402
|
+
* */
|
|
403
|
+
/**
|
|
404
|
+
* Makes hashed georeferenced url without width, height and bbox
|
|
405
|
+
* @param url
|
|
406
|
+
* @returns
|
|
407
|
+
*/
|
|
408
|
+
var makeHashUrlForGeoReferencedImage = function makeHashUrlForGeoReferencedImage(url) {
|
|
409
|
+
try {
|
|
410
|
+
var urlAsURL = new URL(url);
|
|
411
|
+
var urlParams = new URLSearchParams(urlAsURL.search);
|
|
412
|
+
urlParams["delete"]('BBOX');
|
|
413
|
+
urlParams["delete"]('WIDTH');
|
|
414
|
+
urlParams["delete"]('HEIGHT');
|
|
415
|
+
return "" + urlAsURL.origin + urlAsURL.pathname + "?" + urlParams.toString();
|
|
416
|
+
} catch (e) {
|
|
417
|
+
return undefined;
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
|
|
386
421
|
/* *
|
|
387
422
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
388
423
|
* you may not use this file except in compliance with the License.
|
|
@@ -435,6 +470,7 @@ var WMEmptyLayerTitle = 'empty layer';
|
|
|
435
470
|
var WMDateOutSideRange = 'outside range';
|
|
436
471
|
var WMDateTooEarlyString = 'date too early';
|
|
437
472
|
var WMDateTooLateString = 'date too late';
|
|
473
|
+
var WMInvalidDateValues = new Set([WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString]);
|
|
438
474
|
var WMSJSMAP_MINIMUM_MAP_WIDTH = 4;
|
|
439
475
|
var WMSJSMAP_MINIMUM_MAP_HEIGHT = 4;
|
|
440
476
|
var WMSVersion = {
|
|
@@ -864,6 +900,8 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
864
900
|
*/
|
|
865
901
|
function WMImage(src, callback, options) {
|
|
866
902
|
var _this = this;
|
|
903
|
+
this._resolveList = [];
|
|
904
|
+
this.geoReference = null;
|
|
867
905
|
this._loadDuration = undefined;
|
|
868
906
|
this._loadStartTime = 0;
|
|
869
907
|
this.randomize = false;
|
|
@@ -916,6 +954,15 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
916
954
|
};
|
|
917
955
|
}
|
|
918
956
|
var _proto = WMImage.prototype;
|
|
957
|
+
_proto.setGeoReference = function setGeoReference(geoReference) {
|
|
958
|
+
if (this.geoReference) {
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
this.geoReference = {
|
|
962
|
+
extent: [].concat(geoReference.extent),
|
|
963
|
+
resolution: geoReference.resolution
|
|
964
|
+
};
|
|
965
|
+
};
|
|
919
966
|
_proto.init = function init() {
|
|
920
967
|
this._srcLoaded = 'undefined image';
|
|
921
968
|
this._isLoaded = false;
|
|
@@ -1019,10 +1066,39 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
1019
1066
|
*/;
|
|
1020
1067
|
_proto.hasError = function hasError() {
|
|
1021
1068
|
return this._hasError;
|
|
1069
|
+
};
|
|
1070
|
+
_proto._resolveAll = function _resolveAll() {
|
|
1071
|
+
while (this._resolveList.length !== 0) {
|
|
1072
|
+
var resolve = this._resolveList.pop();
|
|
1073
|
+
resolve && resolve(this);
|
|
1074
|
+
}
|
|
1022
1075
|
}
|
|
1023
1076
|
/**
|
|
1024
1077
|
* Start loading the image
|
|
1025
1078
|
*/;
|
|
1079
|
+
_proto.loadAwait =
|
|
1080
|
+
/*#__PURE__*/
|
|
1081
|
+
function () {
|
|
1082
|
+
var _loadAwait = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1083
|
+
var _this2 = this;
|
|
1084
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1085
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1086
|
+
case 0:
|
|
1087
|
+
return _context.abrupt("return", new Promise(function (resolve) {
|
|
1088
|
+
_this2._resolveList.push(resolve);
|
|
1089
|
+
_this2.load();
|
|
1090
|
+
}));
|
|
1091
|
+
case 1:
|
|
1092
|
+
case "end":
|
|
1093
|
+
return _context.stop();
|
|
1094
|
+
}
|
|
1095
|
+
}, _callee);
|
|
1096
|
+
}));
|
|
1097
|
+
function loadAwait() {
|
|
1098
|
+
return _loadAwait.apply(this, arguments);
|
|
1099
|
+
}
|
|
1100
|
+
return loadAwait;
|
|
1101
|
+
}();
|
|
1026
1102
|
_proto.load = function load() {
|
|
1027
1103
|
if (!this._isLoading) {
|
|
1028
1104
|
this._load();
|
|
@@ -1042,7 +1118,7 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
1042
1118
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1043
1119
|
;
|
|
1044
1120
|
_proto._getImageWithHeaders = function _getImageWithHeaders(url, headers) {
|
|
1045
|
-
var
|
|
1121
|
+
var _this3 = this;
|
|
1046
1122
|
var fetchHeaders = new Headers();
|
|
1047
1123
|
if (headers && headers.length > 0) {
|
|
1048
1124
|
for (var _iterator = _createForOfIteratorHelperLoose(headers), _step; !(_step = _iterator()).done;) {
|
|
@@ -1069,7 +1145,7 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
1069
1145
|
response.arrayBuffer().then(function (buffer) {
|
|
1070
1146
|
var base64Flag = 'data:image/png;base64,';
|
|
1071
1147
|
var imageStr = arrayBufferToBase64(buffer);
|
|
1072
|
-
|
|
1148
|
+
_this3.getElement().src = base64Flag + imageStr;
|
|
1073
1149
|
})["catch"](function () {
|
|
1074
1150
|
debugLogger(DebugType.Error);
|
|
1075
1151
|
});
|
|
@@ -1078,7 +1154,7 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
1078
1154
|
if (url.startsWith('http://')) {
|
|
1079
1155
|
debugLogger(DebugType.Error);
|
|
1080
1156
|
}
|
|
1081
|
-
|
|
1157
|
+
_this3._loadEvent(true);
|
|
1082
1158
|
});
|
|
1083
1159
|
};
|
|
1084
1160
|
_proto._load = function _load() {
|
|
@@ -1140,6 +1216,7 @@ var WMImage = /*#__PURE__*/function () {
|
|
|
1140
1216
|
this._isLoading = false;
|
|
1141
1217
|
this._isLoaded = true;
|
|
1142
1218
|
this._srcLoaded = this.srcToLoad;
|
|
1219
|
+
this._resolveAll();
|
|
1143
1220
|
(_this$loadEventCallba = this.loadEventCallback) == null || _this$loadEventCallba.call(this, this);
|
|
1144
1221
|
};
|
|
1145
1222
|
_proto.getLoadDuration = function getLoadDuration() {
|
|
@@ -1171,6 +1248,7 @@ var WMImageEventType;
|
|
|
1171
1248
|
WMImageEventType[WMImageEventType["Loaded"] = 0] = "Loaded";
|
|
1172
1249
|
WMImageEventType[WMImageEventType["Deleted"] = 1] = "Deleted";
|
|
1173
1250
|
})(WMImageEventType || (WMImageEventType = {}));
|
|
1251
|
+
var WMIMAGESTORE_MAX_ALTIMAGES_TO_KEEP = 4;
|
|
1174
1252
|
var WMImageStore = /*#__PURE__*/function () {
|
|
1175
1253
|
/**
|
|
1176
1254
|
* Constructs a new WMImageStore with given amount of image cache.
|
|
@@ -1179,12 +1257,13 @@ var WMImageStore = /*#__PURE__*/function () {
|
|
|
1179
1257
|
*/
|
|
1180
1258
|
function WMImageStore(maxNumberOfImages, options) {
|
|
1181
1259
|
this.imagesbysrc = new Map();
|
|
1260
|
+
this.imagesbyGeoRef = new Map();
|
|
1182
1261
|
this.imageLife = 0;
|
|
1183
1262
|
this._imageLifeCounter = 0;
|
|
1184
1263
|
this._loadEventCallbackList = []; // Array of callbacks, as multiple instances can register listeners
|
|
1185
1264
|
this._maxNumberOfImages = maxNumberOfImages;
|
|
1186
1265
|
this._options = options;
|
|
1187
|
-
this.emptyImage = new WMImage(null, null
|
|
1266
|
+
this.emptyImage = new WMImage(null, null);
|
|
1188
1267
|
this.imageLoadEventCallback = this.imageLoadEventCallback.bind(this);
|
|
1189
1268
|
this.getImageForSrc = this.getImageForSrc.bind(this);
|
|
1190
1269
|
this.clear = this.clear.bind(this);
|
|
@@ -1196,7 +1275,7 @@ var WMImageStore = /*#__PURE__*/function () {
|
|
|
1196
1275
|
}
|
|
1197
1276
|
var _proto = WMImageStore.prototype;
|
|
1198
1277
|
_proto.load = function load(imageUrl) {
|
|
1199
|
-
return this.getImage(imageUrl).
|
|
1278
|
+
return this.getImage(imageUrl).loadAwait();
|
|
1200
1279
|
};
|
|
1201
1280
|
_proto.imageLoadEventCallback = function imageLoadEventCallback(_img, imageEventType) {
|
|
1202
1281
|
for (var _iterator = _createForOfIteratorHelperLoose(this._loadEventCallbackList), _step; !(_step = _iterator()).done;) {
|
|
@@ -1249,6 +1328,68 @@ var WMImageStore = /*#__PURE__*/function () {
|
|
|
1249
1328
|
});
|
|
1250
1329
|
return numLoading;
|
|
1251
1330
|
}
|
|
1331
|
+
/**
|
|
1332
|
+
* getAltGeoReferencedImage will return an ready and loaded image for similar query parameters as requested.
|
|
1333
|
+
* This image can be used to display something during the period when the requested image one is still loading.
|
|
1334
|
+
* The alternative image will have the same query parameters but can have a different extent and resolution.
|
|
1335
|
+
* @param srcToLoad The url of the image for which we want to find an alternative
|
|
1336
|
+
* @param _extent Extent of the requested image
|
|
1337
|
+
* @param _resolution Resolution of the request image
|
|
1338
|
+
* @returns A WMImage which is ready to display. Can have a different extent and resolution then what was asked in srcToLoad
|
|
1339
|
+
*/;
|
|
1340
|
+
_proto.getAltGeoReferencedImage = function getAltGeoReferencedImage(srcToLoad,
|
|
1341
|
+
// eslint-disable-next-line no-unused-vars
|
|
1342
|
+
_extent,
|
|
1343
|
+
// eslint-disable-next-line no-unused-vars
|
|
1344
|
+
_resolution) {
|
|
1345
|
+
var hashUrl = makeHashUrlForGeoReferencedImage(srcToLoad);
|
|
1346
|
+
if (!hashUrl) {
|
|
1347
|
+
return false;
|
|
1348
|
+
}
|
|
1349
|
+
// Sort the imagesbyGeoRef array
|
|
1350
|
+
var imagesbyGeoRefArray = this.imagesbyGeoRef.get(hashUrl);
|
|
1351
|
+
if (!imagesbyGeoRefArray || imagesbyGeoRefArray.length === 0) {
|
|
1352
|
+
return false;
|
|
1353
|
+
}
|
|
1354
|
+
// Clean the set, only keep the most recent images
|
|
1355
|
+
var imagesbyGeoRefArraySortByImageLife = imagesbyGeoRefArray.sort(function (a, b) {
|
|
1356
|
+
if (a.imageLife > b.imageLife) {
|
|
1357
|
+
return -1;
|
|
1358
|
+
}
|
|
1359
|
+
if (a.imageLife < b.imageLife) {
|
|
1360
|
+
return 1;
|
|
1361
|
+
}
|
|
1362
|
+
return 0;
|
|
1363
|
+
}).slice(0, WMIMAGESTORE_MAX_ALTIMAGES_TO_KEEP);
|
|
1364
|
+
// Set this array back in the array
|
|
1365
|
+
this.imagesbyGeoRef.set(hashUrl, imagesbyGeoRefArraySortByImageLife);
|
|
1366
|
+
// Now filter out the loaded images, which can be used as alternative
|
|
1367
|
+
var sortByImageLifeFilterdLoaded = imagesbyGeoRefArraySortByImageLife.filter(function (image) {
|
|
1368
|
+
return image.isLoadedWithoutErrors();
|
|
1369
|
+
});
|
|
1370
|
+
// Just return most recent available image: TODO: Possibly make use of extent and resolution to find a better one.
|
|
1371
|
+
return sortByImageLifeFilterdLoaded.length > 0 ? sortByImageLifeFilterdLoaded[0] : false;
|
|
1372
|
+
};
|
|
1373
|
+
_proto.getGeoReferencedImage = function getGeoReferencedImage(src, geoReference) {
|
|
1374
|
+
var image = this.getImage(src);
|
|
1375
|
+
if (image) {
|
|
1376
|
+
// Make a hashUrl without BBOX
|
|
1377
|
+
if (!image.hashUrl) {
|
|
1378
|
+
var _this$imagesbyGeoRef$;
|
|
1379
|
+
var hashUrl = makeHashUrlForGeoReferencedImage(image.srcToLoad);
|
|
1380
|
+
if (!hashUrl) {
|
|
1381
|
+
return null;
|
|
1382
|
+
}
|
|
1383
|
+
image.hashUrl = hashUrl;
|
|
1384
|
+
if (image.hashUrl && !this.imagesbyGeoRef.has(image.hashUrl)) {
|
|
1385
|
+
this.imagesbyGeoRef.set(image.hashUrl, []);
|
|
1386
|
+
}
|
|
1387
|
+
image.hashUrl && ((_this$imagesbyGeoRef$ = this.imagesbyGeoRef.get(image.hashUrl)) == null ? void 0 : _this$imagesbyGeoRef$.push(image));
|
|
1388
|
+
}
|
|
1389
|
+
image.setGeoReference(geoReference);
|
|
1390
|
+
}
|
|
1391
|
+
return image;
|
|
1392
|
+
}
|
|
1252
1393
|
/**
|
|
1253
1394
|
* Get an WMImage object for given URL
|
|
1254
1395
|
* @param {*} src The url for the image
|
|
@@ -1259,8 +1400,8 @@ var WMImageStore = /*#__PURE__*/function () {
|
|
|
1259
1400
|
if (!src) {
|
|
1260
1401
|
return null;
|
|
1261
1402
|
}
|
|
1262
|
-
|
|
1263
|
-
var image = this.
|
|
1403
|
+
// Check if we have an image in the pipeline
|
|
1404
|
+
var image = this.imagesbysrc.get(src);
|
|
1264
1405
|
if (image !== undefined) {
|
|
1265
1406
|
this._imageLifeCounter += 1;
|
|
1266
1407
|
image.imageLife = this._imageLifeCounter;
|
|
@@ -1268,41 +1409,50 @@ var WMImageStore = /*#__PURE__*/function () {
|
|
|
1268
1409
|
}
|
|
1269
1410
|
// Create image
|
|
1270
1411
|
if (this.imagesbysrc.size < this._maxNumberOfImages) {
|
|
1271
|
-
|
|
1412
|
+
var _newImage = new WMImage(src, function (img) {
|
|
1272
1413
|
_this.imageLoadEventCallback(img, WMImageEventType.Loaded);
|
|
1273
1414
|
});
|
|
1274
|
-
|
|
1275
|
-
this.imagesbysrc.set(src,
|
|
1415
|
+
_newImage.setSource(src, loadOptions);
|
|
1416
|
+
this.imagesbysrc.set(src, _newImage);
|
|
1276
1417
|
this._imageLifeCounter += 1;
|
|
1277
|
-
|
|
1278
|
-
return
|
|
1418
|
+
_newImage.imageLife = this._imageLifeCounter;
|
|
1419
|
+
return _newImage;
|
|
1279
1420
|
}
|
|
1280
|
-
|
|
1281
|
-
var
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1421
|
+
// We have to reuse an image
|
|
1422
|
+
var imagesAsList = Array.from(this.imagesbysrc.values()).filter(function (imageBySrc) {
|
|
1423
|
+
return !imageBySrc || !imageBySrc.isLoading() || imageBySrc.hasError();
|
|
1424
|
+
});
|
|
1425
|
+
imagesAsList.sort(function (a, b) {
|
|
1426
|
+
if (a.imageLife < b.imageLife) {
|
|
1427
|
+
return -1;
|
|
1428
|
+
}
|
|
1429
|
+
if (a.imageLife > b.imageLife) {
|
|
1430
|
+
return 1;
|
|
1289
1431
|
}
|
|
1432
|
+
return 0;
|
|
1290
1433
|
});
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
this.
|
|
1297
|
-
this.
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1434
|
+
var imageIdByUrl = (imagesAsList == null ? void 0 : imagesAsList.length) > 0 ? imagesAsList[0].srcToLoad : '';
|
|
1435
|
+
if (imageIdByUrl === '') {
|
|
1436
|
+
console.error('IMAGESTORE TO LARGE TO LOAD');
|
|
1437
|
+
} else {
|
|
1438
|
+
var hashUrl = makeHashUrlForGeoReferencedImage(imageIdByUrl);
|
|
1439
|
+
hashUrl && this.imagesbyGeoRef["delete"](hashUrl);
|
|
1440
|
+
var reuseImage = this.imagesbysrc.get(imageIdByUrl);
|
|
1441
|
+
if (reuseImage) {
|
|
1442
|
+
this.imagesbysrc["delete"](imageIdByUrl);
|
|
1443
|
+
this.imageLoadEventCallback(reuseImage, WMImageEventType.Deleted);
|
|
1444
|
+
reuseImage.clear();
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
// Force return of new image
|
|
1448
|
+
var newImage = new WMImage(src, function (img) {
|
|
1449
|
+
_this.imageLoadEventCallback(img, WMImageEventType.Loaded);
|
|
1450
|
+
});
|
|
1451
|
+
newImage.setSource(src, loadOptions);
|
|
1452
|
+
this.imagesbysrc.set(src, newImage);
|
|
1453
|
+
this._imageLifeCounter += 1;
|
|
1454
|
+
newImage.imageLife = this._imageLifeCounter;
|
|
1455
|
+
return newImage;
|
|
1306
1456
|
};
|
|
1307
1457
|
return WMImageStore;
|
|
1308
1458
|
}();
|
|
@@ -3981,9 +4131,9 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
3981
4131
|
} else if (this._type === 'timevalues') {
|
|
3982
4132
|
/* Filter all dates from the array which are lower than given start value */
|
|
3983
4133
|
/* TODO: Maarten Plieger 2020-06-10: Make this also work for WMS times advertised as a comma separated list */
|
|
3984
|
-
var
|
|
4134
|
+
var _newValue = parseISO8601DateToDate(newStartValueTime.toISOString());
|
|
3985
4135
|
var newArray = this._allDates.filter(function (x) {
|
|
3986
|
-
return x >=
|
|
4136
|
+
return x >= _newValue;
|
|
3987
4137
|
});
|
|
3988
4138
|
var newValues = '';
|
|
3989
4139
|
for (var j = 0; j < newArray.length; j += 1) {
|
|
@@ -4263,36 +4413,37 @@ var WMJSDimension = /*#__PURE__*/function () {
|
|
|
4263
4413
|
this.reInitializeValues(this.values);
|
|
4264
4414
|
}
|
|
4265
4415
|
};
|
|
4266
|
-
_proto.
|
|
4416
|
+
_proto.getClosestValueForTime = function getClosestValueForTime(timeStamp) {
|
|
4417
|
+
var timeToFind = new Date(timeStamp).toISOString().substring(0, 19) + "Z";
|
|
4418
|
+
return this.getClosestValue(timeToFind);
|
|
4419
|
+
};
|
|
4420
|
+
_proto.getClosestValue = function getClosestValue(inputValue, evenWhenOutsideRange) {
|
|
4267
4421
|
if (evenWhenOutsideRange === void 0) {
|
|
4268
4422
|
evenWhenOutsideRange = false;
|
|
4269
4423
|
}
|
|
4270
4424
|
this.initialize();
|
|
4271
4425
|
if (!this._initialized) {
|
|
4272
|
-
return
|
|
4273
|
-
}
|
|
4274
|
-
var newValue =
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
return this.getFirstValue();
|
|
4426
|
+
return inputValue;
|
|
4427
|
+
}
|
|
4428
|
+
var newValue = (inputValue == null ? void 0 : inputValue.indexOf('/')) === -1 ? inputValue : inputValue.split('/')[0];
|
|
4429
|
+
switch (newValue) {
|
|
4430
|
+
case 'current':
|
|
4431
|
+
case 'default':
|
|
4432
|
+
case '':
|
|
4433
|
+
return this.defaultValue;
|
|
4434
|
+
case 'middle':
|
|
4435
|
+
{
|
|
4436
|
+
var middleIndex = Math.ceil(this.size() / 2) - 1;
|
|
4437
|
+
return this.getValueForIndex(middleIndex > 0 ? middleIndex : 0);
|
|
4438
|
+
}
|
|
4439
|
+
case 'earliest':
|
|
4440
|
+
return this.getFirstValue();
|
|
4441
|
+
case 'latest':
|
|
4442
|
+
return this.getLastValue();
|
|
4290
4443
|
}
|
|
4291
|
-
var index = -1;
|
|
4292
4444
|
var value = WMDateOutSideRange;
|
|
4293
4445
|
try {
|
|
4294
|
-
|
|
4295
|
-
value = this.getValueForIndex(index);
|
|
4446
|
+
value = this.getValueForIndex(this.getIndexForValue(newValue) || -1);
|
|
4296
4447
|
} catch (e) {
|
|
4297
4448
|
if (typeof e.message === 'number') {
|
|
4298
4449
|
if (e.message === '0') {
|
|
@@ -7253,7 +7404,8 @@ var consoleErrorMessages = {
|
|
|
7253
7404
|
serviceHasError: '--- service has an error ---',
|
|
7254
7405
|
serviceUrlEmpty: 'Service URL is empty',
|
|
7255
7406
|
unableToConnectServer: 'Unable to connect to the service.',
|
|
7256
|
-
wmsServiceExceptionCode: 'WMS Service exception with code'
|
|
7407
|
+
wmsServiceExceptionCode: 'WMS Service exception with code',
|
|
7408
|
+
layerNotFoundInService: 'WMS Layer was not found in service'
|
|
7257
7409
|
};
|
|
7258
7410
|
|
|
7259
7411
|
/* *
|
|
@@ -7321,15 +7473,18 @@ var privateWmsFlattenLayerTree = function privateWmsFlattenLayerTree(layerTree)
|
|
|
7321
7473
|
var flatLayerObject = recurseLayerTree(layerTree.children);
|
|
7322
7474
|
return sortArrayOfObjectsByKey(flatLayerObject, 'title');
|
|
7323
7475
|
};
|
|
7324
|
-
var
|
|
7476
|
+
var privateGetOGCCapabilitiesUrl = function privateGetOGCCapabilitiesUrl(url, service, additionalParams) {
|
|
7477
|
+
if (url === void 0) {
|
|
7478
|
+
url = '';
|
|
7479
|
+
}
|
|
7325
7480
|
if (service === void 0) {
|
|
7326
|
-
service = '';
|
|
7481
|
+
service = 'WMS';
|
|
7327
7482
|
}
|
|
7328
7483
|
if (additionalParams === void 0) {
|
|
7329
7484
|
additionalParams = {};
|
|
7330
7485
|
}
|
|
7331
|
-
return getUriAddParam(
|
|
7332
|
-
service:
|
|
7486
|
+
return getUriAddParam(url, Object.assign({
|
|
7487
|
+
service: service,
|
|
7333
7488
|
request: 'GetCapabilities'
|
|
7334
7489
|
}, additionalParams));
|
|
7335
7490
|
};
|
|
@@ -7372,7 +7527,7 @@ var privateWmsGetCapabilities = /*#__PURE__*/function () {
|
|
|
7372
7527
|
addParams = forceReload ? {
|
|
7373
7528
|
random: Math.random()
|
|
7374
7529
|
} : {};
|
|
7375
|
-
url =
|
|
7530
|
+
url = privateGetOGCCapabilitiesUrl(serviceUrl.indexOf('?') === -1 ? serviceUrl + "?" : serviceUrl, 'WMS', addParams);
|
|
7376
7531
|
return _context.abrupt("return", WMXMLParser(url, headers));
|
|
7377
7532
|
case 13:
|
|
7378
7533
|
case "end":
|
|
@@ -7384,6 +7539,67 @@ var privateWmsGetCapabilities = /*#__PURE__*/function () {
|
|
|
7384
7539
|
return _ref2.apply(this, arguments);
|
|
7385
7540
|
};
|
|
7386
7541
|
}();
|
|
7542
|
+
var privateWmtsGetCapabilities = /*#__PURE__*/function () {
|
|
7543
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(serviceUrl, headers, forceReload) {
|
|
7544
|
+
var addParams, url, fetchHeaders, _iterator, _step, header;
|
|
7545
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7546
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7547
|
+
case 0:
|
|
7548
|
+
if (headers === void 0) {
|
|
7549
|
+
headers = [];
|
|
7550
|
+
}
|
|
7551
|
+
if (forceReload === void 0) {
|
|
7552
|
+
forceReload = false;
|
|
7553
|
+
}
|
|
7554
|
+
if (isDefined(serviceUrl)) {
|
|
7555
|
+
_context2.next = 4;
|
|
7556
|
+
break;
|
|
7557
|
+
}
|
|
7558
|
+
throw new Error(consoleErrorMessages.noServiceDefined);
|
|
7559
|
+
case 4:
|
|
7560
|
+
if (!(serviceUrl.length === 0)) {
|
|
7561
|
+
_context2.next = 6;
|
|
7562
|
+
break;
|
|
7563
|
+
}
|
|
7564
|
+
throw new Error(consoleErrorMessages.serviceUrlEmpty);
|
|
7565
|
+
case 6:
|
|
7566
|
+
if (!(!serviceUrl.startsWith('http://') && !serviceUrl.startsWith('https:') && !serviceUrl.startsWith('//'))) {
|
|
7567
|
+
_context2.next = 8;
|
|
7568
|
+
break;
|
|
7569
|
+
}
|
|
7570
|
+
throw new Error(consoleErrorMessages.serviceUrlEmpty);
|
|
7571
|
+
case 8:
|
|
7572
|
+
addParams = forceReload ? {
|
|
7573
|
+
random: Math.random()
|
|
7574
|
+
} : {};
|
|
7575
|
+
url = privateGetOGCCapabilitiesUrl(serviceUrl.indexOf('?') === -1 ? serviceUrl + "?" : serviceUrl, 'WMTS', addParams);
|
|
7576
|
+
fetchHeaders = new Headers();
|
|
7577
|
+
if (headers && headers.length > 0) {
|
|
7578
|
+
for (_iterator = _createForOfIteratorHelperLoose(headers); !(_step = _iterator()).done;) {
|
|
7579
|
+
header = _step.value;
|
|
7580
|
+
fetchHeaders.append(header.name, header.value);
|
|
7581
|
+
}
|
|
7582
|
+
}
|
|
7583
|
+
return _context2.abrupt("return", fetch(url, {
|
|
7584
|
+
headers: fetchHeaders
|
|
7585
|
+
}).then(function (response) {
|
|
7586
|
+
return response.text();
|
|
7587
|
+
}));
|
|
7588
|
+
case 13:
|
|
7589
|
+
case "end":
|
|
7590
|
+
return _context2.stop();
|
|
7591
|
+
}
|
|
7592
|
+
}, _callee2);
|
|
7593
|
+
}));
|
|
7594
|
+
return function privateWmtsGetCapabilities(_x4, _x5, _x6) {
|
|
7595
|
+
return _ref3.apply(this, arguments);
|
|
7596
|
+
};
|
|
7597
|
+
}();
|
|
7598
|
+
/**
|
|
7599
|
+
* privateWmsGetCapabilityElement
|
|
7600
|
+
* @param jsonData
|
|
7601
|
+
* @returns
|
|
7602
|
+
*/
|
|
7387
7603
|
var privateWmsGetCapabilityElement = function privateWmsGetCapabilityElement(jsonData) {
|
|
7388
7604
|
var capabilityObject;
|
|
7389
7605
|
try {
|
|
@@ -8213,6 +8429,9 @@ var WMLayer = /*#__PURE__*/function () {
|
|
|
8213
8429
|
});
|
|
8214
8430
|
}
|
|
8215
8431
|
this.isConfigured = true;
|
|
8432
|
+
} else {
|
|
8433
|
+
this.hasError = true;
|
|
8434
|
+
this.lastError = consoleErrorMessages.layerNotFoundInService + " - " + this.name;
|
|
8216
8435
|
}
|
|
8217
8436
|
}
|
|
8218
8437
|
/** A Promise to parse the layer, it will fetch the WMS GetCapabilities document, configure the layer and resolve to a WMLayer object
|
|
@@ -9527,6 +9746,7 @@ var MOCK_URL_SLOW_FAILS = 'https://slowreject.nl';
|
|
|
9527
9746
|
var MOCK_URL_DEFAULT = 'https://defaultservice.nl';
|
|
9528
9747
|
var MOCK_URL_DEFAULT2 = 'https://defaultservice2.nl';
|
|
9529
9748
|
var MOCK_URL_HTTP = 'http://wmsservice.nl';
|
|
9749
|
+
var MOCK_URL_HARMONIE = 'WMS130GetCapabilitiesHarmN25';
|
|
9530
9750
|
var mockLayersNoChildren = {
|
|
9531
9751
|
leaf: false,
|
|
9532
9752
|
name: null,
|
|
@@ -9885,7 +10105,7 @@ var mockGetCapabilitiesFetcher = /*#__PURE__*/function () {
|
|
|
9885
10105
|
while (1) switch (_context2.prev = _context2.next) {
|
|
9886
10106
|
case 0:
|
|
9887
10107
|
_context2.t0 = serviceUrl;
|
|
9888
|
-
_context2.next = _context2.t0 === MOCK_URL_NO_CHILDREN ? 3 : _context2.t0 === MOCK_URL_WITH_CHILDREN ? 4 : _context2.t0 === MOCK_URL_WITH_SUBCATEGORY ? 5 : _context2.t0 === MOCK_URL_DEFAULT ? 6 : _context2.t0 === MOCK_URL_DEFAULT2 ? 7 : _context2.t0 === MOCK_URL_WITH_NO_TITLE ? 8 : _context2.t0 === MOCK_URL_WITH_NO_TITLE_OR_NAME ? 9 : _context2.t0 === 'https://testservice' ? 10 : _context2.t0 === 'testservice' ? 11 : _context2.t0 === 'WMS130GetCapabilitiesRadarTestWithoutInheritLayerprops' ? 12 : _context2.t0 === 'WMS130GetCapabilitiesRadarTestWithInheritLayerprops' ? 13 : _context2.t0 === 'WMS130GetCapabilitiesRadarTestWithInheritAndReplaceLayerprops' ? 14 : _context2.t0 === 'WMS111GetCapabilitiesGeoServicesRADAR' ? 15 : _context2.t0 === 'WMSSmartMet' ? 16 : _context2.t0 ===
|
|
10108
|
+
_context2.next = _context2.t0 === MOCK_URL_NO_CHILDREN ? 3 : _context2.t0 === MOCK_URL_WITH_CHILDREN ? 4 : _context2.t0 === 'https://geoservices.knmi.nl/wms?dataset=RADAR&' ? 4 : _context2.t0 === MOCK_URL_WITH_SUBCATEGORY ? 5 : _context2.t0 === MOCK_URL_DEFAULT ? 6 : _context2.t0 === MOCK_URL_DEFAULT2 ? 7 : _context2.t0 === MOCK_URL_WITH_NO_TITLE ? 8 : _context2.t0 === MOCK_URL_WITH_NO_TITLE_OR_NAME ? 9 : _context2.t0 === 'https://testservice' ? 10 : _context2.t0 === 'testservice' ? 11 : _context2.t0 === 'WMS130GetCapabilitiesRadarTestWithoutInheritLayerprops' ? 12 : _context2.t0 === 'WMS130GetCapabilitiesRadarTestWithInheritLayerprops' ? 13 : _context2.t0 === 'WMS130GetCapabilitiesRadarTestWithInheritAndReplaceLayerprops' ? 14 : _context2.t0 === 'WMS111GetCapabilitiesGeoServicesRADAR' ? 15 : _context2.t0 === 'WMSSmartMet' ? 16 : _context2.t0 === MOCK_URL_HARMONIE ? 17 : _context2.t0 === MOCK_URL_INVALID ? 18 : 19;
|
|
9889
10109
|
break;
|
|
9890
10110
|
case 3:
|
|
9891
10111
|
return _context2.abrupt("return", mockGetCapNoChilds);
|
|
@@ -9936,6 +10156,7 @@ var getCapabilities = /*#__PURE__*/Object.freeze({
|
|
|
9936
10156
|
__proto__: null,
|
|
9937
10157
|
MOCK_URL_DEFAULT: MOCK_URL_DEFAULT,
|
|
9938
10158
|
MOCK_URL_DEFAULT2: MOCK_URL_DEFAULT2,
|
|
10159
|
+
MOCK_URL_HARMONIE: MOCK_URL_HARMONIE,
|
|
9939
10160
|
MOCK_URL_HTTP: MOCK_URL_HTTP,
|
|
9940
10161
|
MOCK_URL_INVALID: MOCK_URL_INVALID,
|
|
9941
10162
|
MOCK_URL_NO_CHILDREN: MOCK_URL_NO_CHILDREN,
|
|
@@ -10947,7 +11168,8 @@ var privateWebMapUtils = {
|
|
|
10947
11168
|
privateGetWMSServiceInfo: privateGetWMSServiceInfo,
|
|
10948
11169
|
privateWmsGetLayerTree: privateWmsGetLayerTree,
|
|
10949
11170
|
privateWmsFlattenLayerTree: privateWmsFlattenLayerTree,
|
|
11171
|
+
privateWmtsGetCapabilities: privateWmtsGetCapabilities,
|
|
10950
11172
|
QUERYWMS_GETCAPABILITIES: QUERYWMS_GETCAPABILITIES
|
|
10951
11173
|
};
|
|
10952
11174
|
|
|
10953
|
-
export { DateInterval, DebugType, EVENT_GETCAPABILITIES_READY, EVENT_GETCAPABILITIES_START, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WEBMAP_NAMESPACE, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMImage, WMImageEventType, WMImageStore, WMJSDimension, WMJSMAP_LONLAT_EPSGCODE, WMJSMap, WMJScheckURL, WMLayer, WMListener, WMProj4Defs, WMProjection, WMSJSMAP_MINIMUM_MAP_HEIGHT, WMSJSMAP_MINIMUM_MAP_WIDTH, WMSVersion, WMXMLStringToJson, bgImageStoreLength, buildMapLayerDims, buildWMSGetMapRequest, clearImageCacheForAllMaps, debugLogger, detectLeftButton, detectRightButton, drawScaleBar, drawTextBG, generateLayerId, generateMapId, generateTimesliderId, getBBOXandProjString, getErrorsToDisplay, getGeoCoordFromLatLong, getGeoCoordFromPixelCoord, getLatLongFromPixelCoord, getLayerIndex, getLegendGraphicURLForLayer, getPixelCoordFromGeoCoord, getPixelCoordFromLatLong, getScaleBarProperties, getUriWithParam, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSMapIds, getWMJSTimeDimensionForLayerId, getWMLayerById, getWMSGetFeatureInfoRequestURL, getWMSRequests, getWMSServiceId, handleDateUtilsISOString, invalidateWMSGetCapabilities, isDefined, isProjectionSupported, legendImageStore, legendImageStoreLength, mapImageStoreLength, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, privateWebMapUtils, queryWMSGetCapabilities, queryWMSLayer, queryWMSLayers, queryWMSLayersTree, queryWMSServiceInfo, registerWMJSMap, registerWMLayer, roundWithTimeStep, setWMSGetCapabilitiesFetcher, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, index as webmapTestSettings, webmapTranslations, utils as webmapUtils, wmServiceListener, wmsQueryClient };
|
|
11175
|
+
export { DateInterval, DebugType, EVENT_GETCAPABILITIES_READY, EVENT_GETCAPABILITIES_START, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WEBMAP_NAMESPACE, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMImage, WMImageEventType, WMImageStore, WMInvalidDateValues, WMJSDimension, WMJSMAP_LONLAT_EPSGCODE, WMJSMap, WMJScheckURL, WMLayer, WMListener, WMProj4Defs, WMProjection, WMSJSMAP_MINIMUM_MAP_HEIGHT, WMSJSMAP_MINIMUM_MAP_WIDTH, WMSVersion, WMXMLStringToJson, bgImageStoreLength, buildMapLayerDims, buildWMSGetMapRequest, clearImageCacheForAllMaps, debugLogger, detectLeftButton, detectRightButton, drawScaleBar, drawTextBG, generateLayerId, generateMapId, generateTimesliderId, getBBOXandProjString, getErrorsToDisplay, getGeoCoordFromLatLong, getGeoCoordFromPixelCoord, getLatLongFromPixelCoord, getLayerIndex, getLegendGraphicURLForLayer, getPixelCoordFromGeoCoord, getPixelCoordFromLatLong, getScaleBarProperties, getUriWithParam, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSMapIds, getWMJSTimeDimensionForLayerId, getWMLayerById, getWMSGetFeatureInfoRequestURL, getWMSRequests, getWMSServiceId, handleDateUtilsISOString, invalidateWMSGetCapabilities, isDefined, isProjectionSupported, legendImageStore, legendImageStoreLength, mapImageStoreLength, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, privateWebMapUtils, queryWMSGetCapabilities, queryWMSLayer, queryWMSLayers, queryWMSLayersTree, queryWMSServiceInfo, registerWMJSMap, registerWMLayer, roundWithTimeStep, setWMSGetCapabilitiesFetcher, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, index as webmapTestSettings, webmapTranslations, utils as webmapUtils, wmServiceListener, wmsQueryClient };
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ declare const privateWebMapUtils: {
|
|
|
9
9
|
privateGetWMSServiceInfo: (getCapabilitiesJson: import("./lib").GetCapabilitiesJson, serviceUrl: string) => import("./lib").WMSServiceInfo;
|
|
10
10
|
privateWmsGetLayerTree: (jsonData: import("./lib").GetCapabilitiesJson) => import("./lib").LayerTree;
|
|
11
11
|
privateWmsFlattenLayerTree: (layerTree: import("./lib").LayerTree) => import("./lib").LayerProps[];
|
|
12
|
+
privateWmtsGetCapabilities: (serviceUrl: string, headers?: import("./lib").Header[], forceReload?: boolean) => Promise<string>;
|
|
12
13
|
QUERYWMS_GETCAPABILITIES: string;
|
|
13
14
|
};
|
|
14
15
|
export { privateWebMapUtils };
|
|
@@ -253,13 +253,13 @@ interface IWMJSMap {
|
|
|
253
253
|
* @param f
|
|
254
254
|
* @param keep
|
|
255
255
|
*/
|
|
256
|
-
addListener(name: string, f: (param
|
|
256
|
+
addListener<T>(name: string, f: (param: T) => void | boolean, keep?: boolean): boolean;
|
|
257
257
|
/**
|
|
258
258
|
* Remove something from the event listener
|
|
259
259
|
* @param name
|
|
260
260
|
* @param f
|
|
261
261
|
*/
|
|
262
|
-
removeListener(name: string, f: (param
|
|
262
|
+
removeListener<T>(name: string, f: (param: T) => void): void;
|
|
263
263
|
/**
|
|
264
264
|
* Get a direct handle to the event listener system
|
|
265
265
|
*/
|
|
@@ -3,6 +3,7 @@ export declare const WMEmptyLayerTitle = "empty layer";
|
|
|
3
3
|
export declare const WMDateOutSideRange = "outside range";
|
|
4
4
|
export declare const WMDateTooEarlyString = "date too early";
|
|
5
5
|
export declare const WMDateTooLateString = "date too late";
|
|
6
|
+
export declare const WMInvalidDateValues: Set<string>;
|
|
6
7
|
export declare const WMSJSMAP_MINIMUM_MAP_WIDTH = 4;
|
|
7
8
|
export declare const WMSJSMAP_MINIMUM_MAP_HEIGHT = 4;
|
|
8
9
|
export declare const WMSVersion: {
|
|
@@ -3,6 +3,10 @@ export interface WMImageOptions {
|
|
|
3
3
|
headers: Headers[];
|
|
4
4
|
fakeMaxAge?: number;
|
|
5
5
|
}
|
|
6
|
+
export interface WMGeoReference {
|
|
7
|
+
extent: number[];
|
|
8
|
+
resolution: number;
|
|
9
|
+
}
|
|
6
10
|
/**
|
|
7
11
|
* Returns the current time in ms
|
|
8
12
|
* @returns the current time in ms
|
|
@@ -27,6 +31,10 @@ export default class WMImage {
|
|
|
27
31
|
_loadStartTime: number;
|
|
28
32
|
_loadDuration?: number;
|
|
29
33
|
_fakeMaxAge?: number | null;
|
|
34
|
+
_resolveList: ((i: WMImage) => void)[];
|
|
35
|
+
geoReference: WMGeoReference | null;
|
|
36
|
+
hashUrl: string | undefined;
|
|
37
|
+
setGeoReference(geoReference: WMGeoReference): void;
|
|
30
38
|
/**
|
|
31
39
|
*
|
|
32
40
|
* @param src Optionally set the source URL to load
|
|
@@ -73,14 +81,16 @@ export default class WMImage {
|
|
|
73
81
|
* Check if the image has an error
|
|
74
82
|
*/
|
|
75
83
|
hasError(): boolean;
|
|
84
|
+
private _resolveAll;
|
|
76
85
|
/**
|
|
77
86
|
* Start loading the image
|
|
78
87
|
*/
|
|
88
|
+
loadAwait(): Promise<WMImage>;
|
|
79
89
|
load(): void;
|
|
80
90
|
forceReload(randomize?: boolean): void;
|
|
81
91
|
private _getImageWithHeaders;
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
_load(): void;
|
|
93
|
+
_loadEvent(hasError: boolean): void;
|
|
84
94
|
getLoadDuration(): number | undefined;
|
|
85
95
|
/**
|
|
86
96
|
* Get the width of the current image
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import WMImage, { WMImageOptions } from './WMImage';
|
|
1
|
+
import WMImage, { WMGeoReference, WMImageOptions } from './WMImage';
|
|
2
2
|
export declare enum WMImageEventType {
|
|
3
3
|
Loaded = 0,
|
|
4
4
|
Deleted = 1
|
|
@@ -16,6 +16,7 @@ export default class WMImageStore {
|
|
|
16
16
|
id: string;
|
|
17
17
|
};
|
|
18
18
|
emptyImage: WMImage;
|
|
19
|
+
imagesbyGeoRef: Map<string, WMImage[]>;
|
|
19
20
|
/**
|
|
20
21
|
* Constructs a new WMImageStore with given amount of image cache.
|
|
21
22
|
* @param {*} maxNumberOfImages
|
|
@@ -24,7 +25,7 @@ export default class WMImageStore {
|
|
|
24
25
|
constructor(maxNumberOfImages: number, options: {
|
|
25
26
|
id: string;
|
|
26
27
|
});
|
|
27
|
-
load(imageUrl: string):
|
|
28
|
+
load(imageUrl: string): Promise<WMImage>;
|
|
28
29
|
imageLoadEventCallback(_img: WMImage, imageEventType: WMImageEventType): void;
|
|
29
30
|
/**
|
|
30
31
|
* Check if we have similar images with the same source in the pipeline
|
|
@@ -35,6 +36,17 @@ export default class WMImageStore {
|
|
|
35
36
|
removeAllEventCallbacks(): void;
|
|
36
37
|
removeEventCallback(id: string): void;
|
|
37
38
|
getNumImagesLoading(): number;
|
|
39
|
+
/**
|
|
40
|
+
* getAltGeoReferencedImage will return an ready and loaded image for similar query parameters as requested.
|
|
41
|
+
* This image can be used to display something during the period when the requested image one is still loading.
|
|
42
|
+
* The alternative image will have the same query parameters but can have a different extent and resolution.
|
|
43
|
+
* @param srcToLoad The url of the image for which we want to find an alternative
|
|
44
|
+
* @param _extent Extent of the requested image
|
|
45
|
+
* @param _resolution Resolution of the request image
|
|
46
|
+
* @returns A WMImage which is ready to display. Can have a different extent and resolution then what was asked in srcToLoad
|
|
47
|
+
*/
|
|
48
|
+
getAltGeoReferencedImage(srcToLoad: string, _extent: number[], _resolution: number): WMImage | false;
|
|
49
|
+
getGeoReferencedImage(src: string, geoReference: WMGeoReference): WMImage;
|
|
38
50
|
/**
|
|
39
51
|
* Get an WMImage object for given URL
|
|
40
52
|
* @param {*} src The url for the image
|
|
@@ -69,7 +69,8 @@ export default class WMJSDimension implements Dimension {
|
|
|
69
69
|
setClosestValue(newValue?: string | null, evenWhenOutsideRange?: boolean): void;
|
|
70
70
|
addTimeRangeDurationToValue(value: string): string;
|
|
71
71
|
setTimeRangeDuration(duration: string): void;
|
|
72
|
-
|
|
72
|
+
getClosestValueForTime(timeStamp: number): string;
|
|
73
|
+
getClosestValue(inputValue: string, evenWhenOutsideRange?: boolean): string;
|
|
73
74
|
/**
|
|
74
75
|
* Get dimension value for specified index
|
|
75
76
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/src/lib/specs/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const mockGetCapabilities: {
|
|
|
12
12
|
MOCK_URL_DEFAULT: "https://defaultservice.nl";
|
|
13
13
|
MOCK_URL_DEFAULT2: "https://defaultservice2.nl";
|
|
14
14
|
MOCK_URL_HTTP: "http://wmsservice.nl";
|
|
15
|
+
MOCK_URL_HARMONIE: "WMS130GetCapabilitiesHarmN25";
|
|
15
16
|
mockLayersNoChildren: {
|
|
16
17
|
leaf: boolean;
|
|
17
18
|
name: null;
|
|
@@ -10,6 +10,7 @@ export declare const MOCK_URL_SLOW_FAILS = "https://slowreject.nl";
|
|
|
10
10
|
export declare const MOCK_URL_DEFAULT = "https://defaultservice.nl";
|
|
11
11
|
export declare const MOCK_URL_DEFAULT2 = "https://defaultservice2.nl";
|
|
12
12
|
export declare const MOCK_URL_HTTP = "http://wmsservice.nl";
|
|
13
|
+
export declare const MOCK_URL_HARMONIE = "WMS130GetCapabilitiesHarmN25";
|
|
13
14
|
export declare const mockLayersNoChildren: {
|
|
14
15
|
leaf: boolean;
|
|
15
16
|
name: null;
|
|
@@ -6,8 +6,14 @@ import { Capability, GetCapabilitiesJson, Header, LayerProps, LayerTree, WMSLaye
|
|
|
6
6
|
* @returns Flat array of layers as LayerProps[]
|
|
7
7
|
*/
|
|
8
8
|
export declare const privateWmsFlattenLayerTree: (layerTree: LayerTree) => LayerProps[];
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const privateGetOGCCapabilitiesUrl: (url?: string, service?: string, additionalParams?: {}) => string;
|
|
10
10
|
export declare const privateWmsGetCapabilities: (serviceUrl: string, headers?: Header[], forceReload?: boolean) => Promise<GetCapabilitiesJson>;
|
|
11
|
+
export declare const privateWmtsGetCapabilities: (serviceUrl: string, headers?: Header[], forceReload?: boolean) => Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* privateWmsGetCapabilityElement
|
|
14
|
+
* @param jsonData
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
11
17
|
export declare const privateWmsGetCapabilityElement: (jsonData: GetCapabilitiesJson) => Capability;
|
|
12
18
|
export declare const privateCheckException: (jsonData: GetCapabilitiesJson) => string | undefined;
|
|
13
19
|
export declare const privateWmsGetRootLayerFromGetCapabilities: (jsonData: GetCapabilitiesJson) => WMSLayerFromGetCapabilities;
|