@opengeoweb/store 9.21.0 → 9.22.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
@@ -1,4 +1,4 @@
1
- import { webmapUtils, LayerType, getWMJSMapById, WMLayer, webmapTestSettings, handleDateUtilsISOString, getCapabilities } from '@opengeoweb/webmap';
1
+ import { webmapUtils, LayerType, getWMJSMapById, WMLayer, webmapTestSettings, getWMSRequests, isProjectionSupported, handleDateUtilsISOString, getCapabilities } from '@opengeoweb/webmap';
2
2
  import { createAction, createSlice, createSelector, createEntityAdapter, createListenerMiddleware } from '@reduxjs/toolkit';
3
3
  import { getGeoJson, moveFeature, createInterSections, getLastEmptyFeatureIndex, defaultLayers, emptyGeoJSON, addSelectionTypeToGeoJSON, getFeatureCollection, defaultIntersectionStyleProperties } from '@opengeoweb/webmap-react';
4
4
  export { defaultLayers } from '@opengeoweb/webmap-react';
@@ -7632,6 +7632,8 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa
7632
7632
 
7633
7633
  /* A map with all the timerIds and their current step */
7634
7634
  const stepMap = new Map();
7635
+ /* A map with a list of timers and their dwell */
7636
+ const timerDwellMap = new Map();
7635
7637
  /**
7636
7638
  * Returns the next step for given timerId.
7637
7639
  * @param timerId The timer id
@@ -7645,6 +7647,30 @@ const getNextStep = (timerId, numberOfStepsInAnimation, numStepsToGoForward = 1)
7645
7647
  const nextStepClipped = (nextStep % numberOfStepsInAnimation + numberOfStepsInAnimation) % numberOfStepsInAnimation;
7646
7648
  return nextStepClipped;
7647
7649
  };
7650
+ /**
7651
+ * Handles dwell at the end of the animation loop sequence. The number of steps to wait till proceed can be set by the dwell parameter.
7652
+ * @param timerId The timer id
7653
+ * @param numberOfStepsInAnimation Number of steps in the animation
7654
+ * @param dwell The number of steps to wait at the end of the animation sequence before to continue
7655
+ * @returns
7656
+ */
7657
+ const handleTimerDwell = (timerId, numberOfStepsInAnimation, dwell = 8) => {
7658
+ if (dwell > 0) {
7659
+ const currentStep = getCurrentStep(timerId);
7660
+ // Reset the dwell if we are not at the last animation step
7661
+ if (currentStep < numberOfStepsInAnimation - 1) {
7662
+ timerDwellMap.set(timerId, dwell);
7663
+ return false;
7664
+ }
7665
+ // We are at the last animation step, check the dwell
7666
+ const timerDwell = timerDwellMap.has(timerId) && timerDwellMap.get(timerId) || 0;
7667
+ if (currentStep === numberOfStepsInAnimation - 1 && timerDwell > 0) {
7668
+ timerDwellMap.set(timerId, timerDwell - 1);
7669
+ return true;
7670
+ }
7671
+ }
7672
+ return false;
7673
+ };
7648
7674
  /**
7649
7675
  * Set step for the timerId
7650
7676
  * @param timerId
@@ -7680,7 +7706,7 @@ const prefetchAnimationTargetsForMetronome = (timerId, animationListValues, targ
7680
7706
  const targetMapId = target.targetId;
7681
7707
  const wmMap = getWMJSMapById(targetMapId);
7682
7708
  if (wmMap) {
7683
- const layersImageUrls = wmMap.getWMSRequests([{
7709
+ const layersImageUrls = getWMSRequests(wmMap, [{
7684
7710
  name: 'time',
7685
7711
  currentValue: nextTimeValueStepToCheck
7686
7712
  }]);
@@ -7999,8 +8025,8 @@ function* setMapPresetSaga({
7999
8025
  }));
8000
8026
  yield call$e(handleBaseLayersSaga, mapId, allBaseLayers);
8001
8027
  if (proj) {
8002
- const isProjectionSupported = webmapUtils.getWMJSMapById(mapId).isProjectionSupported(proj.srs);
8003
- if (!isProjectionSupported) {
8028
+ const checkIsprojectionSupported = isProjectionSupported(proj.srs);
8029
+ if (!checkIsprojectionSupported) {
8004
8030
  throw new Error(`Projection ${proj.srs} is not supported`);
8005
8031
  }
8006
8032
  // set bbox
@@ -8232,7 +8258,7 @@ function* setStepBackwardOrForwardSaga({
8232
8258
  }
8233
8259
  }
8234
8260
  function* rootSaga$4() {
8235
- // resets WMJSMap state
8261
+ // resets IWMJSMap state
8236
8262
  yield takeLatest(mapActions.mapStopAnimation.type, stopAnimationSaga);
8237
8263
  yield takeLatest(mapActions.mapStartAnimation.type, startAnimationSaga);
8238
8264
  yield takeLatest(layerActions.layerDelete.type, deleteLayerSaga);
@@ -8296,7 +8322,8 @@ const metronomeHandler = (timerIds, listenerApi) => {
8296
8322
  value: ''
8297
8323
  });
8298
8324
  }
8299
- const timerShouldStepForward = prefetchAnimationTargetsForMetronome(timerId, animationListValues, targets);
8325
+ const timerIsInDwell = handleTimerDwell(timerId, animationListValues.length);
8326
+ const timerShouldStepForward = prefetchAnimationTargetsForMetronome(timerId, animationListValues, targets) && !timerIsInDwell;
8300
8327
  // Determine the next step
8301
8328
  const timerStep = timerShouldStepForward ? getNextStep(timerId, animationListValues.length) : getCurrentStep(timerId);
8302
8329
  setStep(timerId, timerStep);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/store",
3
- "version": "9.21.0",
3
+ "version": "9.22.0",
4
4
  "description": "GeoWeb Store library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -7,6 +7,14 @@ import { SetTimeSyncPayload } from '../../generic/synchronizationActions/types';
7
7
  * @returns
8
8
  */
9
9
  export declare const getNextStep: (timerId: string, numberOfStepsInAnimation: number, numStepsToGoForward?: number) => number;
10
+ /**
11
+ * Handles dwell at the end of the animation loop sequence. The number of steps to wait till proceed can be set by the dwell parameter.
12
+ * @param timerId The timer id
13
+ * @param numberOfStepsInAnimation Number of steps in the animation
14
+ * @param dwell The number of steps to wait at the end of the animation sequence before to continue
15
+ * @returns
16
+ */
17
+ export declare const handleTimerDwell: (timerId: string, numberOfStepsInAnimation: number, dwell?: number) => boolean;
10
18
  /**
11
19
  * Set step for the timerId
12
20
  * @param timerId