@opengeoweb/webmap 15.1.0 → 15.3.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
@@ -1425,14 +1425,24 @@ var WMImageStore = /*#__PURE__*/function () {
1425
1425
  * @returns A WMImage which is ready to display. Can have a different extent and resolution then what was asked in srcToLoad
1426
1426
  */;
1427
1427
  _proto.getAltGeoReferencedImage = function getAltGeoReferencedImage(srcToLoad, _extent, _resolution) {
1428
+ var imagesbyGeoRefArraySortByImageLife = this.getAltGeoReferencedImages(srcToLoad, _extent, _resolution);
1429
+ // Now filter out the loaded images, which can be used as alternative
1430
+ var sortByImageLifeFilterdLoaded = imagesbyGeoRefArraySortByImageLife.filter(function (image) {
1431
+ return image.isLoadedWithoutErrors();
1432
+ });
1433
+ // Just return most recent available image: TODO: Possibly make use of extent and resolution to find a better one.
1434
+ // https://gitlab.com/opengeoweb/geoweb-assets/-/issues/4481
1435
+ return sortByImageLifeFilterdLoaded.length > 0 ? sortByImageLifeFilterdLoaded[0] : false;
1436
+ };
1437
+ _proto.getAltGeoReferencedImages = function getAltGeoReferencedImages(srcToLoad, _extent, _resolution) {
1428
1438
  var hashUrl = makeHashUrlForGeoReferencedImage(srcToLoad);
1429
1439
  if (!hashUrl) {
1430
- return false;
1440
+ return [];
1431
1441
  }
1432
1442
  // Sort the imagesbyGeoRef array
1433
1443
  var imagesbyGeoRefArray = this.imagesbyGeoRef.get(hashUrl);
1434
1444
  if (!imagesbyGeoRefArray || imagesbyGeoRefArray.length === 0) {
1435
- return false;
1445
+ return [];
1436
1446
  }
1437
1447
  // Clean the set, only keep the most recent images
1438
1448
  var imagesbyGeoRefArraySortByImageLife = imagesbyGeoRefArray.sort(function (imageA, imageB) {
@@ -1446,14 +1456,9 @@ var WMImageStore = /*#__PURE__*/function () {
1446
1456
  }).slice(0, WMIMAGESTORE_MAX_ALTIMAGES_TO_KEEP);
1447
1457
  // Set this array back in the array
1448
1458
  this.imagesbyGeoRef.set(hashUrl, imagesbyGeoRefArraySortByImageLife);
1449
- // Now filter out the loaded images, which can be used as alternative
1450
- var sortByImageLifeFilterdLoaded = imagesbyGeoRefArraySortByImageLife.filter(function (image) {
1451
- return image.isLoadedWithoutErrors();
1452
- });
1453
- // Just return most recent available image: TODO: Possibly make use of extent and resolution to find a better one.
1454
- return sortByImageLifeFilterdLoaded.length > 0 ? sortByImageLifeFilterdLoaded[0] : false;
1459
+ return imagesbyGeoRefArraySortByImageLife;
1455
1460
  };
1456
- _proto.getGeoReferencedImage = function getGeoReferencedImage(src, geoReference) {
1461
+ _proto.getImageAndSetGeoReference = function getImageAndSetGeoReference(src, geoReference) {
1457
1462
  var image = this.getImage(src);
1458
1463
  if (image) {
1459
1464
  // Make a hashUrl without BBOX
@@ -3137,7 +3142,10 @@ var WMJSDimension = /*#__PURE__*/function () {
3137
3142
  var timeToFind = new Date(timeStamp).toISOString().substring(0, 19) + "Z";
3138
3143
  return this.getClosestValue(timeToFind);
3139
3144
  };
3140
- _proto.getValueForSpecialString = function getValueForSpecialString(inputValue) {
3145
+ _proto.getValueForSpecialString = function getValueForSpecialString(inputValue, evenWhenOutsideRange) {
3146
+ if (evenWhenOutsideRange === void 0) {
3147
+ evenWhenOutsideRange = false;
3148
+ }
3141
3149
  // Check for special cases like: 'current', 'default, '', 'middle', 'earliest' and 'latest'
3142
3150
  switch (inputValue) {
3143
3151
  case 'current':
@@ -3147,12 +3155,16 @@ var WMJSDimension = /*#__PURE__*/function () {
3147
3155
  case 'middle':
3148
3156
  return this.getMiddleValue();
3149
3157
  case 'earliest':
3150
- case WMDateTooEarlyString:
3151
3158
  return this.getFirstValue();
3152
3159
  case 'latest':
3153
- case WMDateTooLateString:
3154
3160
  return this.getLastValue();
3155
3161
  }
3162
+ if (inputValue === WMDateTooEarlyString && evenWhenOutsideRange) {
3163
+ return this.getFirstValue();
3164
+ }
3165
+ if (inputValue === WMDateTooLateString && evenWhenOutsideRange) {
3166
+ return this.getLastValue();
3167
+ }
3156
3168
  return inputValue;
3157
3169
  };
3158
3170
  _proto.getExactMatchingValue = function getExactMatchingValue(inputValue) {
@@ -3180,11 +3192,11 @@ var WMJSDimension = /*#__PURE__*/function () {
3180
3192
  // Just make sure to return the first part if accidently start/stop/res was given.
3181
3193
  var firstPartValue = getFirstPartOfDimensionValueSet(inputValue);
3182
3194
  // Handle 'current', 'default, '', 'middle', 'earliest' and 'latest'
3183
- var newValue = this.getValueForSpecialString(firstPartValue);
3195
+ var newValue = this.getValueForSpecialString(firstPartValue, evenWhenOutsideRange);
3184
3196
  // Get the exact value as present in the dimension values
3185
3197
  var matchingValue = this.getExactMatchingValue(newValue);
3186
3198
  // Handle 'current', 'default, '', 'middle', 'earliest' and 'latest'
3187
- return evenWhenOutsideRange ? this.getValueForSpecialString(matchingValue) : matchingValue;
3199
+ return evenWhenOutsideRange ? this.getValueForSpecialString(matchingValue, evenWhenOutsideRange) : matchingValue;
3188
3200
  }
3189
3201
  /**
3190
3202
  * Get dimension value for specified index
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap",
3
- "version": "15.1.0",
3
+ "version": "15.3.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": "15.1.0",
11
+ "@opengeoweb/shared": "15.3.0",
12
12
  "@tanstack/query-core": "^5.69.2",
13
13
  "lodash": "^4.17.21",
14
14
  "i18next": "^25.0.1",
@@ -49,7 +49,8 @@ export default class WMImageStore {
49
49
  * @returns A WMImage which is ready to display. Can have a different extent and resolution then what was asked in srcToLoad
50
50
  */
51
51
  getAltGeoReferencedImage(srcToLoad: string, _extent: number[], _resolution: number): WMImage | false;
52
- getGeoReferencedImage(src: string, geoReference: WMGeoReference): WMImage;
52
+ getAltGeoReferencedImages(srcToLoad: string, _extent: number[], _resolution: number): WMImage[];
53
+ getImageAndSetGeoReference(src: string, geoReference: WMGeoReference): WMImage;
53
54
  getNumCached(): number;
54
55
  /**
55
56
  * Get an WMImage object for given URL
@@ -74,7 +74,7 @@ export default class WMJSDimension implements Dimension {
74
74
  addTimeRangeDurationToValue(value: string): string;
75
75
  setTimeRangeDuration(duration: string): void;
76
76
  getClosestValueForTime(timeStamp: number): string;
77
- getValueForSpecialString(inputValue: string): string;
77
+ getValueForSpecialString(inputValue: string, evenWhenOutsideRange?: boolean): string;
78
78
  getExactMatchingValue(inputValue: string): string;
79
79
  getClosestValue(inputValue: string, evenWhenOutsideRange?: boolean): string;
80
80
  /**