@opengeoweb/webmap 13.1.1 → 14.0.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 CHANGED
@@ -327,6 +327,104 @@ function _regeneratorRuntime() {
327
327
  })();
328
328
  }
329
329
 
330
+ /* *
331
+ * Licensed under the Apache License, Version 2.0 (the "License");
332
+ * you may not use this file except in compliance with the License.
333
+ * You may obtain a copy of the License at
334
+ *
335
+ * http://www.apache.org/licenses/LICENSE-2.0
336
+ *
337
+ * Unless required by applicable law or agreed to in writing, software
338
+ * distributed under the License is distributed on an "AS IS" BASIS,
339
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
340
+ * See the License for the specific language governing permissions and
341
+ * limitations under the License.
342
+ *
343
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
344
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
345
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
346
+ * */
347
+ var WMImageStoreLoadType;
348
+ (function (WMImageStoreLoadType) {
349
+ WMImageStoreLoadType["PREFETCH"] = "A";
350
+ WMImageStoreLoadType["GETMAP"] = "B";
351
+ })(WMImageStoreLoadType || (WMImageStoreLoadType = {}));
352
+ var LoadDurationCounter = /*#__PURE__*/function () {
353
+ function LoadDurationCounter() {
354
+ this._loadingListForIds = new Map();
355
+ this._loadingDurationForIds = new Map();
356
+ this.setLoadingStatusForId = this.setLoadingStatusForId.bind(this);
357
+ this.getTotalLoadingPercentageForIds = this.getTotalLoadingPercentageForIds.bind(this);
358
+ this.getLoadDurationForId = this.getLoadDurationForId.bind(this);
359
+ this.setLoadDurationForId = this.setLoadDurationForId.bind(this);
360
+ }
361
+ var _proto = LoadDurationCounter.prototype;
362
+ _proto.setLoadingStatusForId = function setLoadingStatusForId(type, identifier, doneLoading, totalLoading, resetDuration) {
363
+ if (resetDuration === void 0) {
364
+ resetDuration = false;
365
+ }
366
+ var typeAndIdentifier = "" + type + identifier;
367
+ this._loadingListForIds.set(typeAndIdentifier, {
368
+ doneLoading: doneLoading,
369
+ totalLoading: totalLoading,
370
+ found: true
371
+ });
372
+ if (resetDuration) {
373
+ this._loadingDurationForIds.set(identifier, undefined);
374
+ }
375
+ };
376
+ _proto.setLoadDurationForId = function setLoadDurationForId(identifier, duration) {
377
+ if (duration !== undefined) {
378
+ this._loadingDurationForIds.set(identifier, duration);
379
+ }
380
+ };
381
+ _proto.getLoadDurationForId = function getLoadDurationForId(identifier) {
382
+ return this._loadingDurationForIds.get(identifier);
383
+ };
384
+ _proto.getTotalLoadingPercentageForIds = function getTotalLoadingPercentageForIds(identifierList) {
385
+ var _this = this;
386
+ if (!(identifierList != null && identifierList.length)) {
387
+ return {
388
+ percentage: 100,
389
+ doneLoading: 0,
390
+ totalLoading: 0
391
+ };
392
+ }
393
+ // Make list of possible identifiers
394
+ var typeAndIdentifierList = identifierList.reduce(function (prev, cur) {
395
+ return [].concat(prev, ["" + WMImageStoreLoadType.GETMAP + cur, "" + WMImageStoreLoadType.PREFETCH + cur]);
396
+ }, []);
397
+ // Combine all loading images into one number
398
+ var numLoadingDoneTotal = typeAndIdentifierList.reduce(function (previousValue, identifier) {
399
+ var info = _this._loadingListForIds.get(identifier);
400
+ return info ? {
401
+ doneLoading: info.doneLoading + previousValue.doneLoading,
402
+ totalLoading: info.totalLoading + previousValue.totalLoading,
403
+ found: true
404
+ } : previousValue;
405
+ }, {
406
+ doneLoading: 0,
407
+ totalLoading: 0,
408
+ found: false
409
+ });
410
+ // If nothing loading, just return 100 %
411
+ if (numLoadingDoneTotal.totalLoading === 0) {
412
+ return {
413
+ percentage: numLoadingDoneTotal.found ? 0 : 100,
414
+ doneLoading: 0,
415
+ totalLoading: 0
416
+ };
417
+ }
418
+ // Round upwards to percentages
419
+ return {
420
+ percentage: Math.round(numLoadingDoneTotal.doneLoading / numLoadingDoneTotal.totalLoading * 100),
421
+ doneLoading: numLoadingDoneTotal.doneLoading,
422
+ totalLoading: numLoadingDoneTotal.totalLoading
423
+ };
424
+ };
425
+ return LoadDurationCounter;
426
+ }();
427
+
330
428
  /* *
331
429
  * Licensed under the Apache License, Version 2.0 (the "License");
332
430
  * you may not use this file except in compliance with the License.
@@ -357,7 +455,7 @@ var makeHashUrlForGeoReferencedImage = function makeHashUrlForGeoReferencedImage
357
455
  urlParams["delete"]('WIDTH');
358
456
  urlParams["delete"]('HEIGHT');
359
457
  return "" + urlAsURL.origin + urlAsURL.pathname + "?" + urlParams.toString();
360
- } catch (e) {
458
+ } catch (_e) {
361
459
  return undefined;
362
460
  }
363
461
  };
@@ -688,22 +786,22 @@ var addStylesForLayer = function addStylesForLayer(layerObjectFromWMS) {
688
786
  };
689
787
  try {
690
788
  style.title = layerStyle.Title.value;
691
- } catch (e) {
789
+ } catch (_e) {
692
790
  /* Do nothing */
693
791
  }
694
792
  try {
695
793
  style.name = layerStyle.Name.value;
696
- } catch (e) {
794
+ } catch (_e) {
697
795
  /* Do nothing */
698
796
  }
699
797
  try {
700
798
  style.legendURL = layerStyle.LegendURL.OnlineResource.attr['xlink:href'];
701
- } catch (e) {
799
+ } catch (_e) {
702
800
  /* Do nothing */
703
801
  }
704
802
  try {
705
803
  style["abstract"] = layerStyle.Abstract.value;
706
- } catch (e) {
804
+ } catch (_e) {
707
805
  /* Do nothing */
708
806
  }
709
807
  return style;
@@ -854,7 +952,7 @@ var makeNodeLayerFromWMSGetCapabilityLayer = function makeNodeLayerFromWMSGetCap
854
952
  };
855
953
  };
856
954
  var getFirstPartOfDimensionValueSet = function getFirstPartOfDimensionValueSet(inputValue) {
857
- return (inputValue == null ? void 0 : inputValue.indexOf('/')) === -1 ? inputValue : inputValue.split('/')[0];
955
+ return !(inputValue != null && inputValue.indexOf) || (inputValue == null ? void 0 : inputValue.indexOf('/')) === -1 ? inputValue : inputValue.split('/')[0];
858
956
  };
859
957
 
860
958
  /**
@@ -972,7 +1070,7 @@ var WMImage = /*#__PURE__*/function () {
972
1070
  } else {
973
1071
  this._fakeMaxAge = null;
974
1072
  }
975
- } catch (e) {
1073
+ } catch (_e) {
976
1074
  // failed to form URL
977
1075
  this._fakeMaxAge = null;
978
1076
  }
@@ -1232,6 +1330,7 @@ var WMImageStore = /*#__PURE__*/function () {
1232
1330
  * @param {*} options
1233
1331
  */
1234
1332
  function WMImageStore(maxNumberOfImages, options) {
1333
+ this.loadDuration = new LoadDurationCounter();
1235
1334
  this.imagesbysrc = new Map();
1236
1335
  this.imagesbyGeoRef = new Map();
1237
1336
  this.imageLife = 0;
@@ -1314,11 +1413,7 @@ var WMImageStore = /*#__PURE__*/function () {
1314
1413
  * @param _resolution Resolution of the request image
1315
1414
  * @returns A WMImage which is ready to display. Can have a different extent and resolution then what was asked in srcToLoad
1316
1415
  */;
1317
- _proto.getAltGeoReferencedImage = function getAltGeoReferencedImage(srcToLoad,
1318
- // eslint-disable-next-line no-unused-vars
1319
- _extent,
1320
- // eslint-disable-next-line no-unused-vars
1321
- _resolution) {
1416
+ _proto.getAltGeoReferencedImage = function getAltGeoReferencedImage(srcToLoad, _extent, _resolution) {
1322
1417
  var hashUrl = makeHashUrlForGeoReferencedImage(srcToLoad);
1323
1418
  if (!hashUrl) {
1324
1419
  return false;
@@ -1868,7 +1963,7 @@ var ParseISOTimeRangeDuration = /*#__PURE__*/function () {
1868
1963
  times[2] = defaultInterval;
1869
1964
  }
1870
1965
  if (times[1] === undefined) {
1871
- // eslint-disable-next-line prefer-destructuring
1966
+ // eslint-disable-next-line @typescript-eslint/prefer-destructuring
1872
1967
  times[1] = times[0];
1873
1968
  times[2] = defaultInterval;
1874
1969
  }
@@ -1924,7 +2019,7 @@ var ParseISOTimeRangeDuration = /*#__PURE__*/function () {
1924
2019
  var currentDate = null;
1925
2020
  try {
1926
2021
  currentDate = parseISO8601DateToDate(currentISODate);
1927
- } catch (e) {
2022
+ } catch (_e) {
1928
2023
  throw new Error("The date " + currentISODate + " is not a valid date");
1929
2024
  }
1930
2025
  return this.getTimeStepFromDate(currentDate, throwIfOutsideRange);
@@ -2048,7 +2143,7 @@ var getLegendGraphicURLForLayer = function getLegendGraphicURLForLayer(layer, wi
2048
2143
  if (!legendURL.includes('&width=') && !legendURL.includes('&height=')) {
2049
2144
  legendURL += "&width=" + width + "&height=" + height;
2050
2145
  }
2051
- } catch (e) {
2146
+ } catch (_e) {
2052
2147
  return undefined;
2053
2148
  }
2054
2149
  // Handle WMS extensions
@@ -2303,7 +2398,7 @@ var WMBBOX = /*#__PURE__*/function () {
2303
2398
  this.bottom = parseFloat(bboxArray[1]);
2304
2399
  this.right = parseFloat(bboxArray[2]);
2305
2400
  this.top = parseFloat(bboxArray[3]);
2306
- } catch (e) {
2401
+ } catch (_e) {
2307
2402
  return;
2308
2403
  }
2309
2404
  }
@@ -2417,7 +2512,6 @@ var WMXMLStringToXMLDocument = function WMXMLStringToXMLDocument(xmlString) {
2417
2512
  return xmlData;
2418
2513
  };
2419
2514
  var WMXMLtoJSON = function WMXMLtoJSON(xmlDocument) {
2420
- // eslint-disable-next-line no-shadow
2421
2515
  var traverse = function traverse(data, path, json) {
2422
2516
  if (data.children && data.children.length) {
2423
2517
  for (var _iterator = _createForOfIteratorHelperLoose(data.children), _step; !(_step = _iterator()).done;) {
@@ -2743,7 +2837,7 @@ var WMJSDimension = /*#__PURE__*/function () {
2743
2837
  var dataAtTimeStep = partTimeRanges.getDateAtTimeStep(i);
2744
2838
  try {
2745
2839
  _this._allValues.push(dataAtTimeStep.toISO8601());
2746
- } catch (e) {
2840
+ } catch (_e) {
2747
2841
  _this._allValues.push(dataAtTimeStep.toString());
2748
2842
  }
2749
2843
  }
@@ -3026,7 +3120,7 @@ var WMJSDimension = /*#__PURE__*/function () {
3026
3120
  if (this._type === 'timestartstopres') {
3027
3121
  try {
3028
3122
  return this._timeRangeDurationDate.getDateAtTimeStep(index).toISO8601();
3029
- } catch (e) {
3123
+ } catch (_e) {
3030
3124
  // nothing
3031
3125
  }
3032
3126
  return this._timeRangeDurationDate.getDateAtTimeStep(index);
@@ -3433,7 +3527,7 @@ var privateWmsGetCapabilityElement = function privateWmsGetCapabilityElement(jso
3433
3527
  var capabilityObject;
3434
3528
  try {
3435
3529
  capabilityObject = jsonData.WMT_MS_Capabilities.Capability;
3436
- } catch (e) {
3530
+ } catch (_e) {
3437
3531
  try {
3438
3532
  capabilityObject = jsonData.WMS_Capabilities.Capability;
3439
3533
  } catch (_unused) {
@@ -3453,7 +3547,7 @@ var privateCheckException = function privateCheckException(jsonData) {
3453
3547
  if (se.attr.code) {
3454
3548
  code = se.attr.code;
3455
3549
  }
3456
- } catch (e) {
3550
+ } catch (_e) {
3457
3551
  // do nothing
3458
3552
  }
3459
3553
  if (se.value) {
@@ -3463,7 +3557,7 @@ var privateCheckException = function privateCheckException(jsonData) {
3463
3557
  }
3464
3558
  return consoleErrorMessages.wmsServiceExceptionCode + " " + code;
3465
3559
  }
3466
- } catch (e) {
3560
+ } catch (_e) {
3467
3561
  // do nothing
3468
3562
  }
3469
3563
  return undefined;
@@ -3477,7 +3571,7 @@ var privateCheckVersion111 = function privateCheckVersion111(jsonData) {
3477
3571
  if (!rootLayer) {
3478
3572
  throw new Error('No 111 layer');
3479
3573
  }
3480
- } catch (e) {
3574
+ } catch (_e) {
3481
3575
  var message = privateCheckException(jsonData);
3482
3576
  if (message !== undefined) {
3483
3577
  throw new Error(message);
@@ -3496,7 +3590,7 @@ var privateCheckVersion130 = function privateCheckVersion130(jsonData) {
3496
3590
  if (!rootLayer) {
3497
3591
  throw new Error('No 130 layer');
3498
3592
  }
3499
- } catch (e) {
3593
+ } catch (_e) {
3500
3594
  var message = privateCheckException(jsonData);
3501
3595
  if (message !== undefined) {
3502
3596
  throw new Error(message);
@@ -3521,7 +3615,7 @@ var privateCheckVersion = function privateCheckVersion(jsonData) {
3521
3615
  if (WMSVersion.version130 === jsonData.WMT_MS_Capabilities.attr.version) {
3522
3616
  version = WMSVersion.version130;
3523
3617
  }
3524
- } catch (e) {
3618
+ } catch (_e) {
3525
3619
  try {
3526
3620
  if (WMSVersion.version100 === jsonData.WMS_Capabilities.attr.version) {
3527
3621
  version = WMSVersion.version100;
@@ -4005,8 +4099,6 @@ var WMLayer = /*#__PURE__*/function () {
4005
4099
  this.setSLDURL = this.setSLDURL.bind(this);
4006
4100
  this.display = this.display.bind(this);
4007
4101
  this.getDimensions = this.getDimensions.bind(this);
4008
- this.getCurrentRequestedGetMapURL = this.getCurrentRequestedGetMapURL.bind(this);
4009
- this.setCurrentRequestedGetMapURL = this.setCurrentRequestedGetMapURL.bind(this);
4010
4102
  this.init();
4011
4103
  this._options = options;
4012
4104
  this.sldURL = null;
@@ -4423,12 +4515,6 @@ var WMLayer = /*#__PURE__*/function () {
4423
4515
  _proto.display = function display(displayornot) {
4424
4516
  this.enabled = displayornot;
4425
4517
  };
4426
- _proto.setCurrentRequestedGetMapURL = function setCurrentRequestedGetMapURL(url) {
4427
- this.currentRequestedGetMapURL = url;
4428
- };
4429
- _proto.getCurrentRequestedGetMapURL = function getCurrentRequestedGetMapURL() {
4430
- return this.currentRequestedGetMapURL;
4431
- };
4432
4518
  return WMLayer;
4433
4519
  }();
4434
4520
 
@@ -6815,4 +6901,4 @@ var privateWebMapUtils = {
6815
6901
  QUERYWMS_GETCAPABILITIES: QUERYWMS_GETCAPABILITIES
6816
6902
  };
6817
6903
 
6818
- export { DateInterval, DebugType, EVENT_GETCAPABILITIES_READY, EVENT_GETCAPABILITIES_START, LayerType, ParseISOTimeRangeDuration, WEBMAP_NAMESPACE, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMDateUnit, WMEmptyLayerName, WMEmptyLayerTitle, WMImage, WMImageEventType, WMImageStore, WMInvalidDateValues, WMJSDimension, WMJSMAP_LONLAT_EPSGCODE, WMLayer, WMListener, WMProj4Defs, WMProjection, WMSVersion, WMXMLStringToJson, bgImageStoreLength, debugLogger, generateLayerId, generateMapId, generateTimesliderId, getCorrectWMSDimName, getLegendGraphicURLForLayer, getMapDimURL, getUriWithParam, getWMJSDimensionForLayerAndDimension, getWMJSTimeDimensionForLayerId, getWMLayerById, getWMSServiceId, handleDateUtilsISOString, invalidateWMSGetCapabilities, isDefined, isProjectionSupported, legendImageStore, legendImageStoreLength, mapImageStoreLength, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, privateWebMapUtils, queryWMSGetCapabilities, queryWMSLayer, queryWMSLayers, queryWMSLayersTree, queryWMSServiceInfo, registerWMLayer, roundWithTimeStep, setWMSGetCapabilitiesFetcher, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, index as webmapTestSettings, webmapTranslations, utils as webmapUtils, wmServiceListener, wmsQueryClient };
6904
+ export { DateInterval, DebugType, EVENT_GETCAPABILITIES_READY, EVENT_GETCAPABILITIES_START, LayerType, ParseISOTimeRangeDuration, WEBMAP_NAMESPACE, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMDateUnit, WMEmptyLayerName, WMEmptyLayerTitle, WMImage, WMImageEventType, WMImageStore, WMImageStoreLoadType, WMInvalidDateValues, WMJSDimension, WMJSMAP_LONLAT_EPSGCODE, WMLayer, WMListener, WMProj4Defs, WMProjection, WMSVersion, WMXMLStringToJson, bgImageStoreLength, debugLogger, generateLayerId, generateMapId, generateTimesliderId, getCorrectWMSDimName, getLegendGraphicURLForLayer, getMapDimURL, getUriWithParam, getWMJSDimensionForLayerAndDimension, getWMJSTimeDimensionForLayerId, getWMLayerById, getWMSServiceId, handleDateUtilsISOString, invalidateWMSGetCapabilities, isDefined, isProjectionSupported, legendImageStore, legendImageStoreLength, mapImageStoreLength, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, privateWebMapUtils, queryWMSGetCapabilities, queryWMSLayer, queryWMSLayers, queryWMSLayersTree, queryWMSServiceInfo, registerWMLayer, roundWithTimeStep, setWMSGetCapabilitiesFetcher, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, index as webmapTestSettings, webmapTranslations, utils as webmapUtils, wmServiceListener, wmsQueryClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap",
3
- "version": "13.1.1",
3
+ "version": "14.0.0",
4
4
  "description": "GeoWeb webmap library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,7 +8,7 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/shared": "13.1.1",
11
+ "@opengeoweb/shared": "14.0.0",
12
12
  "@tanstack/query-core": "^5.69.2",
13
13
  "lodash": "^4.17.21",
14
14
  "i18next": "^25.0.1",
@@ -0,0 +1,17 @@
1
+ export declare enum WMImageStoreLoadType {
2
+ 'PREFETCH' = "A",
3
+ 'GETMAP' = "B"
4
+ }
5
+ export default class LoadDurationCounter {
6
+ constructor();
7
+ private _loadingListForIds;
8
+ private _loadingDurationForIds;
9
+ setLoadingStatusForId(type: WMImageStoreLoadType, identifier: string, doneLoading: number, totalLoading: number, resetDuration?: boolean): void;
10
+ setLoadDurationForId(identifier: string, duration: number | undefined): void;
11
+ getLoadDurationForId(identifier: string): number | undefined;
12
+ getTotalLoadingPercentageForIds(identifierList: string[]): {
13
+ percentage: number;
14
+ doneLoading: number;
15
+ totalLoading: number;
16
+ };
17
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ import LoadDurationCounter from './LoadDurationCounter';
1
2
  import WMImage, { WMGeoReference, WMImageOptions } from './WMImage';
2
3
  export declare enum WMImageEventType {
3
4
  Loaded = 0,
@@ -17,6 +18,7 @@ export default class WMImageStore {
17
18
  };
18
19
  emptyImage: WMImage;
19
20
  imagesbyGeoRef: Map<string, WMImage[]>;
21
+ loadDuration: LoadDurationCounter;
20
22
  /**
21
23
  * Constructs a new WMImageStore with given amount of image cache.
22
24
  * @param {*} maxNumberOfImages
@@ -111,6 +111,4 @@ export default class WMLayer {
111
111
  getProjection(srsName: string): WMProjection;
112
112
  setSLDURL(url: string): void;
113
113
  display(displayornot: boolean): void;
114
- setCurrentRequestedGetMapURL(url: string): void;
115
- getCurrentRequestedGetMapURL(): string | undefined;
116
114
  }
@@ -7,6 +7,7 @@ import WMListener from './WMListener';
7
7
  import WMProjection from './WMProjection';
8
8
  import { LayerType } from './WMLayerTypes';
9
9
  import { WMXMLStringToJson } from './WMXMLParser';
10
+ import { WMImageStoreLoadType } from './LoadDurationCounter';
10
11
  export { default as WMJSDimension, handleDateUtilsISOString, } from './WMJSDimension';
11
12
  export { default as WMLayer } from './WMLayer';
12
13
  export type { LayerOptions, LayerFoundation, EDRFeatureLayerOptions, } from './WMLayerTypes';
@@ -15,7 +16,7 @@ export { default as WMBBOX } from './WMBBOX';
15
16
  export type { Bbox } from './WMBBOX';
16
17
  export type { WMProjectionWH } from './WMProjection';
17
18
  export { WMProjection };
18
- export { DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration, isDefined, parseISO8601DateToDate, toArray, getLegendGraphicURLForLayer, legendImageStore, WMImage, debugLogger, DebugType, WMImageEventType, getUriWithParam, getMapDimURL, WMListener, WMXMLStringToJson, };
19
+ export { DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration, isDefined, parseISO8601DateToDate, toArray, getLegendGraphicURLForLayer, legendImageStore, WMImage, debugLogger, DebugType, WMImageEventType, getUriWithParam, getMapDimURL, WMListener, WMXMLStringToJson, WMImageStoreLoadType, };
19
20
  export * from './types';
20
21
  export * from './WMTimeTypes';
21
22
  export * from './WMConstants';