@opengeoweb/webmap 8.4.1 → 9.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
@@ -20055,28 +20055,26 @@ function prefetchImagesForAnimation(wmMap) {
20055
20055
  var maxImagesToPrefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : MAX_IMAGES_TO_PREFETCH_DEFAULT;
20056
20056
  var animationSteps = wmMap.animationList;
20057
20057
  var countAnimationSteps = animationSteps.length;
20058
- var timesToPrefetchInOrder = lodash.exports.range(0, countAnimationSteps).map(function (offset) {
20058
+ var animationStepsInOrder = lodash.exports.range(0, countAnimationSteps).map(function (offset) {
20059
20059
  // start prefecthing images for the next animation step first
20060
20060
  // when reaching end of animation, start from the beginning
20061
20061
  var indexOfNextAnimationStep = (wmMap.currentAnimationStep + offset) % countAnimationSteps;
20062
- return animationSteps[indexOfNextAnimationStep].value;
20062
+ return animationSteps[indexOfNextAnimationStep];
20063
20063
  });
20064
- var currentTime = animationSteps[wmMap.currentAnimationStep].value;
20065
- prefetchLayerImagesInOrder(wmMap, timesToPrefetchInOrder, maxImagesToPrefetch, currentTime);
20064
+ prefetchLayerImagesInOrderWithUrls(animationStepsInOrder, maxImagesToPrefetch);
20066
20065
  }
20067
- function prefetchLayerImagesInOrder(wmMap, timesToPrefetchInOrder, maxImagesToPrefetch, currentTime) {
20068
- var _iterator = _createForOfIteratorHelper(timesToPrefetchInOrder),
20066
+ function prefetchLayerImagesInOrderWithUrls(animationStepsInOrder, maxImagesToPrefetch) {
20067
+ var _iterator = _createForOfIteratorHelper(animationStepsInOrder),
20069
20068
  _step;
20070
20069
  try {
20071
20070
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
20072
- var timeToPrefetch = _step.value;
20071
+ var animationStep = _step.value;
20073
20072
  // dont prefetch if already prefetching too many images
20074
20073
  var countImagesLoading = getMapImageStore.getNumImagesLoading();
20075
20074
  if (countImagesLoading > maxImagesToPrefetch - 1) {
20076
20075
  break;
20077
20076
  }
20078
- var layersImageUrls = getLayersImageUrlsForTime(wmMap, timeToPrefetch, currentTime);
20079
- prefetchLayerImagesForTime(layersImageUrls);
20077
+ prefetchLayerImagesForTime(animationStep.requests || []);
20080
20078
  }
20081
20079
  } catch (err) {
20082
20080
  _iterator.e(err);
@@ -20084,6 +20082,26 @@ function prefetchLayerImagesInOrder(wmMap, timesToPrefetchInOrder, maxImagesToPr
20084
20082
  _iterator.f();
20085
20083
  }
20086
20084
  }
20085
+ function prefetchLayerImagesInOrder(wmMap, timesToPrefetchInOrder, maxImagesToPrefetch, currentTime) {
20086
+ var _iterator2 = _createForOfIteratorHelper(timesToPrefetchInOrder),
20087
+ _step2;
20088
+ try {
20089
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
20090
+ var timeToPrefetch = _step2.value;
20091
+ // dont prefetch if already prefetching too many images
20092
+ var countImagesLoading = getMapImageStore.getNumImagesLoading();
20093
+ if (countImagesLoading > maxImagesToPrefetch - 1) {
20094
+ break;
20095
+ }
20096
+ var layersImageUrls = getLayersImageUrlsForTime(wmMap, timeToPrefetch, currentTime);
20097
+ prefetchLayerImagesForTime(layersImageUrls);
20098
+ }
20099
+ } catch (err) {
20100
+ _iterator2.e(err);
20101
+ } finally {
20102
+ _iterator2.f();
20103
+ }
20104
+ }
20087
20105
  function getLayersImageUrlsForTime(wmMap, timeToPrefetch, currentTime) {
20088
20106
  // get urls for layers at time
20089
20107
  wmMap.setTimeDimension(timeToPrefetch, false);
@@ -26851,6 +26869,26 @@ function init(){
26851
26869
  }
26852
26870
  */
26853
26871
 
26872
+ /**
26873
+ * Re-formats moment's isoString to the string that is expected by WMJSDimension (for time).
26874
+ * @param dateIn The input date to re-format, usually in the format `YYYY-MM-DDThh:mm:ss.uuuZ`
26875
+ * @returns The formated input date in the format `YYYY-MM-DDThh:mm:ssZ`
26876
+ */
26877
+ var handleMomentISOString = function handleMomentISOString(dateIn) {
26878
+ /* Try to fix the timestrings generated by moment js made with moment.toISOString() */
26879
+ if (!dateIn) {
26880
+ return null;
26881
+ }
26882
+ if (dateIn.length > 20) {
26883
+ var fixedDate = dateIn.substring(0, 19);
26884
+ return "".concat(fixedDate, "Z");
26885
+ }
26886
+ if (dateIn.length === 17) {
26887
+ var _fixedDate = dateIn.substring(0, 16);
26888
+ return "".concat(_fixedDate, ":00Z");
26889
+ }
26890
+ return dateIn;
26891
+ };
26854
26892
  /**
26855
26893
  * WMJSDimension Class
26856
26894
  * Keep all information for a single dimension, like time.
@@ -29101,14 +29139,14 @@ var WMJSMap = /*#__PURE__*/function () {
29101
29139
  }
29102
29140
  }, {
29103
29141
  key: "_drawAndLoad",
29104
- value: function _drawAndLoad(animationList) {
29142
+ value: function _drawAndLoad(inputAnimationList) {
29105
29143
  var _this8 = this;
29106
29144
  if (this.width < 4 || this.height < 4) {
29107
29145
  this._drawReady();
29108
29146
  return;
29109
29147
  }
29110
29148
  this.callBack.triggerEvent('beforedraw');
29111
- if (this.isAnimating === false && animationList !== undefined && _typeof$1(animationList) === 'object' && animationList.length > 0) {
29149
+ if (this.isAnimating === false && inputAnimationList !== undefined && _typeof$1(inputAnimationList) === 'object' && inputAnimationList.length > 0) {
29112
29150
  // Ensure the time dimension has been loaded for the map before starting animation
29113
29151
  var timeDim = this.getDimension('time');
29114
29152
  if (!timeDim) {
@@ -29120,7 +29158,7 @@ var WMJSMap = /*#__PURE__*/function () {
29120
29158
  this.currentAnimationStep = this.initialAnimationStep;
29121
29159
  this.animationList = [];
29122
29160
  this.mouseHoverAnimationBox = false;
29123
- animationList.forEach(function (animationStepWithoutRequests, j) {
29161
+ inputAnimationList.forEach(function (animationStepWithoutRequests, j) {
29124
29162
  if (selectedTime && animationStepWithoutRequests.value === selectedTime) {
29125
29163
  _this8.currentAnimationStep = j;
29126
29164
  }
@@ -32834,6 +32872,36 @@ var styleListForRADNL25PCPCMLayer = [{
32834
32872
  legendURL: 'https://geoservices.knmi.nl/wms?DATASET=RADAR&SERVICE=WMS&&version=1.1.1&service=WMS&request=GetLegendGraphic&layer=RAD_NL25_PCP_CM&format=image/png&STYLE=precip-with-range/nearest',
32835
32873
  "abstract": 'No abstract available'
32836
32874
  }];
32875
+ var multiDimensionLayer3 = {
32876
+ service: 'https://testservicedimensions',
32877
+ id: 'multiDimensionLayerMock2',
32878
+ name: 'netcdf_5dims',
32879
+ layerType: LayerType.mapLayer,
32880
+ dimensions: [{
32881
+ name: 'member',
32882
+ units: 'member number',
32883
+ currentValue: 'member1',
32884
+ values: 'member1,member2,member3,member4'
32885
+ }, {
32886
+ name: 'elevation',
32887
+ units: 'meters',
32888
+ currentValue: '9000',
32889
+ values: '1000,5000,9000'
32890
+ }, {
32891
+ name: 'time',
32892
+ units: 'ISO8601',
32893
+ currentValue: '2017-01-01T00:25:00Z',
32894
+ timeInterval: {
32895
+ year: 0,
32896
+ month: 0,
32897
+ day: 0,
32898
+ hour: 0,
32899
+ minute: 5,
32900
+ second: 0,
32901
+ isRegularInterval: true
32902
+ }
32903
+ }]
32904
+ };
32837
32905
 
32838
32906
  var testSettings = /*#__PURE__*/Object.freeze({
32839
32907
  __proto__: null,
@@ -32846,7 +32914,8 @@ var testSettings = /*#__PURE__*/Object.freeze({
32846
32914
  layerWithoutTimeDimension: layerWithoutTimeDimension,
32847
32915
  WmLayerWithoutTimeDimension: WmLayerWithoutTimeDimension,
32848
32916
  crsListForRADNL25PCPCMLayer: crsListForRADNL25PCPCMLayer,
32849
- styleListForRADNL25PCPCMLayer: styleListForRADNL25PCPCMLayer
32917
+ styleListForRADNL25PCPCMLayer: styleListForRADNL25PCPCMLayer,
32918
+ multiDimensionLayer3: multiDimensionLayer3
32850
32919
  });
32851
32920
 
32852
32921
  /* *
@@ -33553,4 +33622,4 @@ var getCapabilities = /*#__PURE__*/Object.freeze({
33553
33622
  getLayersFlattenedFromService: getLayersFlattenedFromService
33554
33623
  });
33555
33624
 
33556
- export { DateInterval, DebugType, EPSGCode, I18n, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMGetServiceFromStore, WMImage, WMImageEventType, WMJSDimension, WMJSMap, WMJSService, WMJScheckURL, WMLayer, WMTimer, clearImageCache, debugLogger, generateLayerId, generateMapId, generateTimesliderId, getCapabilities, getLegendGraphicURLForLayer, getMapImageStore, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, isDefined, legendImageStore, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, registerWMJSMap, registerWMLayer, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, testSettings as webmapTestSettings, utils as webmapUtils };
33625
+ export { DateInterval, DebugType, EPSGCode, I18n, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMGetServiceFromStore, WMImage, WMImageEventType, WMJSDimension, WMJSMap, WMJSService, WMJScheckURL, WMLayer, WMTimer, clearImageCache, debugLogger, generateLayerId, generateMapId, generateTimesliderId, getCapabilities, getLegendGraphicURLForLayer, getMapImageStore, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, handleMomentISOString, isDefined, legendImageStore, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, registerWMJSMap, registerWMLayer, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, testSettings as webmapTestSettings, utils as webmapUtils };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap",
3
- "version": "8.4.1",
3
+ "version": "9.0.0",
4
4
  "description": "GeoWeb webmap library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -9,15 +9,5 @@
9
9
  },
10
10
  "module": "./index.esm.js",
11
11
  "type": "module",
12
- "main": "./index.esm.js",
13
- "dependencies": {},
14
- "peerDependencies": {
15
- "@opengeoweb/shared": "8.4.1",
16
- "date-fns": "2.30.0",
17
- "immer": "9.0.21",
18
- "lodash": "4.17.21",
19
- "moment": "2.29.4",
20
- "proj4": "2.9.1",
21
- "throttle-debounce": "5.0.0"
22
- }
12
+ "main": "./index.esm.js"
23
13
  }
@@ -1,5 +1,11 @@
1
1
  import { Dimension, TimeInterval } from './types';
2
2
  import { CustomDate } from './WMTimeTypes';
3
+ /**
4
+ * Re-formats moment's isoString to the string that is expected by WMJSDimension (for time).
5
+ * @param dateIn The input date to re-format, usually in the format `YYYY-MM-DDThh:mm:ss.uuuZ`
6
+ * @returns The formated input date in the format `YYYY-MM-DDThh:mm:ssZ`
7
+ */
8
+ export declare const handleMomentISOString: (dateIn: string) => string;
3
9
  interface WMJSDimensionConfig {
4
10
  name?: string;
5
11
  units?: string;
@@ -5,7 +5,7 @@ import { proj4 } from './WMJSExternalDependencies';
5
5
  import WMJSDimension from './WMJSDimension';
6
6
  import MapPin from './WMMapPin';
7
7
  import WMLayer from './WMLayer';
8
- import { AnimationList, LinkedInfo } from './types';
8
+ import { AnimationStep, LinkedInfo } from './types';
9
9
  export declare const detectLeftButton: (evt: MouseEvent) => boolean;
10
10
  export declare const detectRightButton: (evt: MouseEvent) => boolean;
11
11
  export declare const getErrorsToDisplay: (canvasErrors: LinkedInfo[], getLayerByServiceAndName: (layerservice: string, layername: string) => WMLayer) => string[];
@@ -22,8 +22,8 @@ export default class WMJSMap {
22
22
  showLayerInfo: boolean;
23
23
  isAnimating: boolean;
24
24
  animationDelay: number;
25
- animationList: AnimationList[] | string | undefined;
26
- _animationList: AnimationList[] | string | undefined;
25
+ animationList: AnimationStep[] | string | undefined;
26
+ _animationList: AnimationStep[] | string | undefined;
27
27
  currentAnimationStep: number;
28
28
  initialAnimationStep: number;
29
29
  setAnimationDelay: (delay: number) => void;
@@ -183,13 +183,13 @@ export default class WMJSMap {
183
183
  displayScaleBarInMap(display: boolean): void;
184
184
  display(): void;
185
185
  _animFrameRedraw(): void;
186
- draw(animationList?: AnimationList[] | string | undefined): void;
186
+ draw(animationList?: AnimationStep[] | string | undefined): void;
187
187
  /**
188
188
  * API Function called to draw the layers, fires getmap request and shows the layers on the screen
189
189
  */
190
- _draw(animationList: AnimationList[] | string | undefined): void;
190
+ _draw(animationList: AnimationStep[] | string | undefined): void;
191
191
  _drawReady(): void;
192
- _drawAndLoad(animationList: AnimationList[] | string | undefined): void;
192
+ _drawAndLoad(inputAnimationList: AnimationStep[] | string | undefined): void;
193
193
  _onLayersReadyCallbackFunction(): void;
194
194
  _onMapReadyCallbackFunction(): void;
195
195
  _onResumeSuspendCallbackFunction(): void;
@@ -9,11 +9,11 @@ import WMImage from './WMImage';
9
9
  import { getLegendGraphicURLForLayer, legendImageStore } from './WMLegend';
10
10
  import { getMapImageStore, WMImageEventType } from './WMImageStore';
11
11
  import { WMJSService } from './WMJSService';
12
- import WMJSDimension from './WMJSDimension';
12
+ export { default as WMJSDimension, handleMomentISOString, } from './WMJSDimension';
13
13
  export { default as WMLayer, LayerType } from './WMLayer';
14
14
  export type { LayerOptions, LayerFoundation } from './WMLayer';
15
15
  export { default as WMBBOX } from './WMBBOX';
16
16
  export type { Bbox } from './WMBBOX';
17
- export { WMJSMap, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration, isDefined, WMTimer, WMGetServiceFromStore, WMJScheckURL, URLEncode, URLDecode, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, parseISO8601DateToDate, I18n, toArray, getLegendGraphicURLForLayer, legendImageStore, WMImage, debugLogger, DebugType, WMImageEventType, WMJSService, getMapImageStore, WMJSDimension, clearImageCache, };
17
+ export { WMJSMap, DateInterval, parseISO8601IntervalToDateInterval, ParseISOTimeRangeDuration, isDefined, WMTimer, WMGetServiceFromStore, WMJScheckURL, URLEncode, URLDecode, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, parseISO8601DateToDate, I18n, toArray, getLegendGraphicURLForLayer, legendImageStore, WMImage, debugLogger, DebugType, WMImageEventType, WMJSService, getMapImageStore, clearImageCache, };
18
18
  export * from './types';
19
19
  export * from './WMTimeTypes';
@@ -2,7 +2,7 @@ import type WMJSDimension from './WMJSDimension';
2
2
  import type WMLayer from './WMLayer';
3
3
  import { Bbox } from './WMBBOX';
4
4
  import type WMImage from './WMImage';
5
- export interface AnimationList {
5
+ export interface AnimationStep {
6
6
  name: string;
7
7
  value: string;
8
8
  requests?: {
@@ -11,3 +11,4 @@ export declare const layerWithoutTimeDimension: LayerOptions;
11
11
  export declare const WmLayerWithoutTimeDimension: WMLayer;
12
12
  export declare const crsListForRADNL25PCPCMLayer: CoordinateReferenceSystem[];
13
13
  export declare const styleListForRADNL25PCPCMLayer: Style[];
14
+ export declare const multiDimensionLayer3: LayerFoundation;