@opengeoweb/store 9.23.1 → 9.24.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 +387 -330
- package/package.json +1 -1
- package/src/store/generic/listener.d.ts +2 -0
- package/src/store/generic/listener.spec.d.ts +1 -0
- package/src/store/generic/sagas.d.ts +1 -5
- package/src/store/index.d.ts +1 -1
- package/src/store/mapStore/layers/types.d.ts +1 -1
- package/src/store/mapStore/map/listener.d.ts +3 -0
- package/src/store/mapStore/map/listener.spec.d.ts +1 -0
- package/src/store/mapStore/map/sagas.d.ts +0 -3
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { webmapUtils, LayerType, getWMJSMapById, WMLayer, webmapTestSettings,
|
|
1
|
+
import { webmapUtils, LayerType, getWMJSMapById, WMLayer, webmapTestSettings, isProjectionSupported, handleDateUtilsISOString, getCapabilities, getWMSRequests } from '@opengeoweb/webmap';
|
|
2
2
|
import { createAction, createSlice, createSelector, createEntityAdapter, createListenerMiddleware, isAnyOf } 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';
|
|
@@ -2000,7 +2000,7 @@ var LayerActionOrigin;
|
|
|
2000
2000
|
LayerActionOrigin["wmsLoader"] = "WMSLayerTreeConnect";
|
|
2001
2001
|
LayerActionOrigin["ReactMapViewParseLayer"] = "ReactMapViewParseLayer";
|
|
2002
2002
|
LayerActionOrigin["setLayerDimensionSaga"] = "setLayerDimensionSaga";
|
|
2003
|
-
LayerActionOrigin["
|
|
2003
|
+
LayerActionOrigin["toggleAutoUpdateListener"] = "toggleAutoUpdateListener";
|
|
2004
2004
|
LayerActionOrigin["unregisterMapSaga"] = "unregisterMapSaga";
|
|
2005
2005
|
})(LayerActionOrigin || (LayerActionOrigin = {}));
|
|
2006
2006
|
|
|
@@ -7621,115 +7621,6 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa
|
|
|
7621
7621
|
];
|
|
7622
7622
|
}, BUGGY || !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
|
|
7623
7623
|
|
|
7624
|
-
/* A map with all the timerIds and their current step */
|
|
7625
|
-
const stepMap = new Map();
|
|
7626
|
-
/* A map with a list of timers and their dwell */
|
|
7627
|
-
const timerDwellMap = new Map();
|
|
7628
|
-
/**
|
|
7629
|
-
* Returns the next step for given timerId.
|
|
7630
|
-
* @param timerId The timer id
|
|
7631
|
-
* @param numberOfStepsInAnimation Animation length in steps
|
|
7632
|
-
* @param numStepsToGoForward Amount of steps to go forwards, defaults to 1. Can be positive and negative
|
|
7633
|
-
* @returns
|
|
7634
|
-
*/
|
|
7635
|
-
const getNextStep = (timerId, numberOfStepsInAnimation, numStepsToGoForward = 1) => {
|
|
7636
|
-
const currentStep = getCurrentStep(timerId);
|
|
7637
|
-
const nextStep = currentStep + numStepsToGoForward;
|
|
7638
|
-
const nextStepClipped = (nextStep % numberOfStepsInAnimation + numberOfStepsInAnimation) % numberOfStepsInAnimation;
|
|
7639
|
-
return nextStepClipped;
|
|
7640
|
-
};
|
|
7641
|
-
/**
|
|
7642
|
-
* 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.
|
|
7643
|
-
* @param timerId The timer id
|
|
7644
|
-
* @param numberOfStepsInAnimation Number of steps in the animation
|
|
7645
|
-
* @param dwell The number of steps to wait at the end of the animation sequence before to continue
|
|
7646
|
-
* @returns
|
|
7647
|
-
*/
|
|
7648
|
-
const handleTimerDwell = (timerId, numberOfStepsInAnimation, dwell = 8) => {
|
|
7649
|
-
if (dwell > 0) {
|
|
7650
|
-
const currentStep = getCurrentStep(timerId);
|
|
7651
|
-
// Reset the dwell if we are not at the last animation step
|
|
7652
|
-
if (currentStep < numberOfStepsInAnimation - 1) {
|
|
7653
|
-
timerDwellMap.set(timerId, dwell);
|
|
7654
|
-
return false;
|
|
7655
|
-
}
|
|
7656
|
-
// We are at the last animation step, check the dwell
|
|
7657
|
-
const timerDwell = timerDwellMap.has(timerId) && timerDwellMap.get(timerId) || 0;
|
|
7658
|
-
if (currentStep === numberOfStepsInAnimation - 1 && timerDwell > 0) {
|
|
7659
|
-
timerDwellMap.set(timerId, timerDwell - 1);
|
|
7660
|
-
return true;
|
|
7661
|
-
}
|
|
7662
|
-
}
|
|
7663
|
-
return false;
|
|
7664
|
-
};
|
|
7665
|
-
/**
|
|
7666
|
-
* Set step for the timerId
|
|
7667
|
-
* @param timerId
|
|
7668
|
-
* @param timerStep
|
|
7669
|
-
*/
|
|
7670
|
-
const setStep = (timerId, timerStep) => {
|
|
7671
|
-
stepMap.set(timerId, timerStep);
|
|
7672
|
-
};
|
|
7673
|
-
/**
|
|
7674
|
-
* Gets the current step for the timer
|
|
7675
|
-
* @param timerId
|
|
7676
|
-
* @returns
|
|
7677
|
-
*/
|
|
7678
|
-
const getCurrentStep = timerId => {
|
|
7679
|
-
return stepMap.get(timerId) || 0;
|
|
7680
|
-
};
|
|
7681
|
-
const MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH = 2;
|
|
7682
|
-
const MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES = 8;
|
|
7683
|
-
/**
|
|
7684
|
-
* This prefetches all images connected to the same sync group as provided timerId
|
|
7685
|
-
* @param timerId The timerId
|
|
7686
|
-
* @param animationListValues List of animation steps in isostring to animate
|
|
7687
|
-
* @param targets List of targets to check
|
|
7688
|
-
* @returns True if all maps are ready to go forward, false if the map has no data to display yet.
|
|
7689
|
-
*/
|
|
7690
|
-
const prefetchAnimationTargetsForMetronome = (timerId, animationListValues, targets) => {
|
|
7691
|
-
let timerShouldStepForward = true;
|
|
7692
|
-
// The following code prefetches/buffers for all maps in the group
|
|
7693
|
-
for (let numPrefetch = 0; numPrefetch < MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH; numPrefetch += 1) {
|
|
7694
|
-
const nextStep = getNextStep(timerId, animationListValues.length, numPrefetch + 1);
|
|
7695
|
-
const nextTimeValueStepToCheck = animationListValues[nextStep];
|
|
7696
|
-
for (const target of targets) {
|
|
7697
|
-
const targetMapId = target.targetId;
|
|
7698
|
-
const wmMap = getWMJSMapById(targetMapId);
|
|
7699
|
-
if (wmMap) {
|
|
7700
|
-
const layersImageUrls = getWMSRequests(wmMap, [{
|
|
7701
|
-
name: 'time',
|
|
7702
|
-
currentValue: nextTimeValueStepToCheck
|
|
7703
|
-
}]);
|
|
7704
|
-
for (const layersImageUrl of layersImageUrls) {
|
|
7705
|
-
const image = wmMap.getMapImageStore.getImage(layersImageUrl.url);
|
|
7706
|
-
if (!image.isLoaded()) {
|
|
7707
|
-
if (wmMap.getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
|
|
7708
|
-
image.load();
|
|
7709
|
-
}
|
|
7710
|
-
if (numPrefetch === 0) {
|
|
7711
|
-
const altImage = wmMap.getAlternativeImage(layersImageUrl.url, wmMap.getBBOX(), true);
|
|
7712
|
-
// No alternative image available yet, so skipping animation.
|
|
7713
|
-
if (altImage.length === 0) {
|
|
7714
|
-
// This is useful to indicate that the map is loading and has nothing yet to display.
|
|
7715
|
-
// console.warn('No data available: Not stepping forward');
|
|
7716
|
-
timerShouldStepForward = false;
|
|
7717
|
-
}
|
|
7718
|
-
}
|
|
7719
|
-
} else if (image.isStale()) {
|
|
7720
|
-
if (wmMap.getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
|
|
7721
|
-
image.forceReload(true);
|
|
7722
|
-
}
|
|
7723
|
-
}
|
|
7724
|
-
}
|
|
7725
|
-
} else {
|
|
7726
|
-
return false; // Map was not registered so there is nothing to prefetch
|
|
7727
|
-
}
|
|
7728
|
-
}
|
|
7729
|
-
}
|
|
7730
|
-
return timerShouldStepForward;
|
|
7731
|
-
};
|
|
7732
|
-
|
|
7733
7624
|
const isAnimationEndTimeValid = animationEndTime => {
|
|
7734
7625
|
const hasValidPrefix = animationEndTime.split(/[-+]/)[0] === 'NOW' || animationEndTime.split(/[-+]/)[0] === 'TODAY';
|
|
7735
7626
|
const durationString = animationEndTime.substring(animationEndTime.indexOf('PT') + 2);
|
|
@@ -7740,37 +7631,6 @@ const isAnimationEndTimeValid = animationEndTime => {
|
|
|
7740
7631
|
const parsedDate = dateUtils.parseISO(animationEndTime);
|
|
7741
7632
|
return dateUtils.isValid(parsedDate);
|
|
7742
7633
|
};
|
|
7743
|
-
function* startAnimationSaga({
|
|
7744
|
-
payload
|
|
7745
|
-
}) {
|
|
7746
|
-
const {
|
|
7747
|
-
mapId,
|
|
7748
|
-
initialTime
|
|
7749
|
-
} = payload;
|
|
7750
|
-
const speedDelay = yield select(getMapAnimationDelay, mapId);
|
|
7751
|
-
const speed = 1000 / (speedDelay || 1);
|
|
7752
|
-
metronome.register(null, speed, mapId);
|
|
7753
|
-
const timeList = yield select(getAnimationList, mapId);
|
|
7754
|
-
// In case of the timeList
|
|
7755
|
-
if (timeList && timeList.length > 0) {
|
|
7756
|
-
// Determine animation step based on initialTime and timeList
|
|
7757
|
-
const initalTimerStep = timeList === null || timeList === void 0 ? void 0 : timeList.findIndex(timeNameValue => {
|
|
7758
|
-
return timeNameValue.value === initialTime;
|
|
7759
|
-
});
|
|
7760
|
-
if (initalTimerStep !== -1) {
|
|
7761
|
-
setStep(mapId, initalTimerStep);
|
|
7762
|
-
}
|
|
7763
|
-
}
|
|
7764
|
-
}
|
|
7765
|
-
// eslint-disable-next-line require-yield
|
|
7766
|
-
function* stopAnimationSaga({
|
|
7767
|
-
payload
|
|
7768
|
-
}) {
|
|
7769
|
-
const {
|
|
7770
|
-
mapId
|
|
7771
|
-
} = payload;
|
|
7772
|
-
metronome.unregister(mapId);
|
|
7773
|
-
}
|
|
7774
7634
|
function* deleteLayerSaga({
|
|
7775
7635
|
payload
|
|
7776
7636
|
}) {
|
|
@@ -7784,7 +7644,7 @@ function* deleteLayerSaga({
|
|
|
7784
7644
|
}));
|
|
7785
7645
|
}
|
|
7786
7646
|
}
|
|
7787
|
-
function* updateAnimation(mapId, maxValue) {
|
|
7647
|
+
function* updateAnimation$1(mapId, maxValue) {
|
|
7788
7648
|
const shouldEndtimeOverride$1 = yield select(shouldEndtimeOverride, mapId);
|
|
7789
7649
|
if (shouldEndtimeOverride$1 === true) {
|
|
7790
7650
|
return;
|
|
@@ -7862,59 +7722,7 @@ function* setLayerDimensionsSaga({
|
|
|
7862
7722
|
}))));
|
|
7863
7723
|
}
|
|
7864
7724
|
}
|
|
7865
|
-
yield call$e(updateAnimation, mapId, incomingMaxTime);
|
|
7866
|
-
}
|
|
7867
|
-
} catch (error) {
|
|
7868
|
-
// eslint-disable-next-line no-console
|
|
7869
|
-
console.warn(error);
|
|
7870
|
-
}
|
|
7871
|
-
}
|
|
7872
|
-
function* toggleAutoUpdateSaga({
|
|
7873
|
-
payload
|
|
7874
|
-
}) {
|
|
7875
|
-
const {
|
|
7876
|
-
shouldAutoUpdate,
|
|
7877
|
-
mapId
|
|
7878
|
-
} = payload;
|
|
7879
|
-
if (!shouldAutoUpdate) {
|
|
7880
|
-
return;
|
|
7881
|
-
}
|
|
7882
|
-
try {
|
|
7883
|
-
// go to end of active layer
|
|
7884
|
-
const autoUpdateLayerId = yield select(getAutoUpdateLayerId, mapId);
|
|
7885
|
-
const timeDimension = yield select(getLayerTimeDimension, autoUpdateLayerId);
|
|
7886
|
-
if (timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.maxValue) {
|
|
7887
|
-
yield put(layerActions.layerChangeDimension({
|
|
7888
|
-
layerId: autoUpdateLayerId,
|
|
7889
|
-
origin: LayerActionOrigin.toggleAutoUpdateSaga,
|
|
7890
|
-
dimension: {
|
|
7891
|
-
name: 'time',
|
|
7892
|
-
currentValue: timeDimension.maxValue
|
|
7893
|
-
}
|
|
7894
|
-
}));
|
|
7895
|
-
// Change time value for all other timesliders that are synced by syncgroups
|
|
7896
|
-
const syncedMapIds = yield select(getSyncedMapIdsForTimeslider);
|
|
7897
|
-
if (syncedMapIds.length > 0) {
|
|
7898
|
-
yield all(syncedMapIds.map(syncedMapId => put(setTime({
|
|
7899
|
-
origin: 'mapStore saga',
|
|
7900
|
-
sourceId: syncedMapId,
|
|
7901
|
-
value: timeDimension.maxValue
|
|
7902
|
-
}))));
|
|
7903
|
-
// When timesliders are synced by syncgrous autoupdate is toggled on, toggle autoupdate off for other timesliders
|
|
7904
|
-
const payloads = syncedMapIds.reduce((syncedMapIdList, syncedMapId) => {
|
|
7905
|
-
if (syncedMapId !== mapId) {
|
|
7906
|
-
return syncedMapIdList.concat({
|
|
7907
|
-
mapId: syncedMapId,
|
|
7908
|
-
shouldAutoUpdate: false
|
|
7909
|
-
});
|
|
7910
|
-
}
|
|
7911
|
-
return syncedMapIdList;
|
|
7912
|
-
}, []);
|
|
7913
|
-
if (payloads.length > 0) {
|
|
7914
|
-
yield all(payloads.map(payload => put(mapActions.toggleAutoUpdate(payload))));
|
|
7915
|
-
}
|
|
7916
|
-
}
|
|
7917
|
-
yield call$e(updateAnimation, mapId, timeDimension.maxValue);
|
|
7725
|
+
yield call$e(updateAnimation$1, mapId, incomingMaxTime);
|
|
7918
7726
|
}
|
|
7919
7727
|
} catch (error) {
|
|
7920
7728
|
// eslint-disable-next-line no-console
|
|
@@ -8250,11 +8058,8 @@ function* setStepBackwardOrForwardSaga({
|
|
|
8250
8058
|
}
|
|
8251
8059
|
function* rootSaga$2() {
|
|
8252
8060
|
// resets IWMJSMap state
|
|
8253
|
-
yield takeLatest(mapActions.mapStopAnimation.type, stopAnimationSaga);
|
|
8254
|
-
yield takeLatest(mapActions.mapStartAnimation.type, startAnimationSaga);
|
|
8255
8061
|
yield takeLatest(layerActions.layerDelete.type, deleteLayerSaga);
|
|
8256
8062
|
yield takeLatest(layerActions.onUpdateLayerInformation.type, setLayerDimensionsSaga);
|
|
8257
|
-
yield takeLatest(mapActions.toggleAutoUpdate.type, toggleAutoUpdateSaga);
|
|
8258
8063
|
yield takeEvery(mapActions.setMapPreset.type, setMapPresetSaga);
|
|
8259
8064
|
yield takeEvery(mapActions.unregisterMap.type, unregisterMapSaga);
|
|
8260
8065
|
yield takeEvery(mapActions.setStepBackwardOrForward.type, setStepBackwardOrForwardSaga);
|
|
@@ -8290,6 +8095,115 @@ function* rootSaga$1() {
|
|
|
8290
8095
|
yield takeEvery(serviceActions.fetchInitialServices, fetchInitialServicesSaga);
|
|
8291
8096
|
}
|
|
8292
8097
|
|
|
8098
|
+
/* A map with all the timerIds and their current step */
|
|
8099
|
+
const stepMap = new Map();
|
|
8100
|
+
/* A map with a list of timers and their dwell */
|
|
8101
|
+
const timerDwellMap = new Map();
|
|
8102
|
+
/**
|
|
8103
|
+
* Returns the next step for given timerId.
|
|
8104
|
+
* @param timerId The timer id
|
|
8105
|
+
* @param numberOfStepsInAnimation Animation length in steps
|
|
8106
|
+
* @param numStepsToGoForward Amount of steps to go forwards, defaults to 1. Can be positive and negative
|
|
8107
|
+
* @returns
|
|
8108
|
+
*/
|
|
8109
|
+
const getNextStep = (timerId, numberOfStepsInAnimation, numStepsToGoForward = 1) => {
|
|
8110
|
+
const currentStep = getCurrentStep(timerId);
|
|
8111
|
+
const nextStep = currentStep + numStepsToGoForward;
|
|
8112
|
+
const nextStepClipped = (nextStep % numberOfStepsInAnimation + numberOfStepsInAnimation) % numberOfStepsInAnimation;
|
|
8113
|
+
return nextStepClipped;
|
|
8114
|
+
};
|
|
8115
|
+
/**
|
|
8116
|
+
* 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.
|
|
8117
|
+
* @param timerId The timer id
|
|
8118
|
+
* @param numberOfStepsInAnimation Number of steps in the animation
|
|
8119
|
+
* @param dwell The number of steps to wait at the end of the animation sequence before to continue
|
|
8120
|
+
* @returns
|
|
8121
|
+
*/
|
|
8122
|
+
const handleTimerDwell = (timerId, numberOfStepsInAnimation, dwell = 8) => {
|
|
8123
|
+
if (dwell > 0) {
|
|
8124
|
+
const currentStep = getCurrentStep(timerId);
|
|
8125
|
+
// Reset the dwell if we are not at the last animation step
|
|
8126
|
+
if (currentStep < numberOfStepsInAnimation - 1) {
|
|
8127
|
+
timerDwellMap.set(timerId, dwell);
|
|
8128
|
+
return false;
|
|
8129
|
+
}
|
|
8130
|
+
// We are at the last animation step, check the dwell
|
|
8131
|
+
const timerDwell = timerDwellMap.has(timerId) && timerDwellMap.get(timerId) || 0;
|
|
8132
|
+
if (currentStep === numberOfStepsInAnimation - 1 && timerDwell > 0) {
|
|
8133
|
+
timerDwellMap.set(timerId, timerDwell - 1);
|
|
8134
|
+
return true;
|
|
8135
|
+
}
|
|
8136
|
+
}
|
|
8137
|
+
return false;
|
|
8138
|
+
};
|
|
8139
|
+
/**
|
|
8140
|
+
* Set step for the timerId
|
|
8141
|
+
* @param timerId
|
|
8142
|
+
* @param timerStep
|
|
8143
|
+
*/
|
|
8144
|
+
const setStep = (timerId, timerStep) => {
|
|
8145
|
+
stepMap.set(timerId, timerStep);
|
|
8146
|
+
};
|
|
8147
|
+
/**
|
|
8148
|
+
* Gets the current step for the timer
|
|
8149
|
+
* @param timerId
|
|
8150
|
+
* @returns
|
|
8151
|
+
*/
|
|
8152
|
+
const getCurrentStep = timerId => {
|
|
8153
|
+
return stepMap.get(timerId) || 0;
|
|
8154
|
+
};
|
|
8155
|
+
const MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH = 2;
|
|
8156
|
+
const MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES = 8;
|
|
8157
|
+
/**
|
|
8158
|
+
* This prefetches all images connected to the same sync group as provided timerId
|
|
8159
|
+
* @param timerId The timerId
|
|
8160
|
+
* @param animationListValues List of animation steps in isostring to animate
|
|
8161
|
+
* @param targets List of targets to check
|
|
8162
|
+
* @returns True if all maps are ready to go forward, false if the map has no data to display yet.
|
|
8163
|
+
*/
|
|
8164
|
+
const prefetchAnimationTargetsForMetronome = (timerId, animationListValues, targets) => {
|
|
8165
|
+
let timerShouldStepForward = true;
|
|
8166
|
+
// The following code prefetches/buffers for all maps in the group
|
|
8167
|
+
for (let numPrefetch = 0; numPrefetch < MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH; numPrefetch += 1) {
|
|
8168
|
+
const nextStep = getNextStep(timerId, animationListValues.length, numPrefetch + 1);
|
|
8169
|
+
const nextTimeValueStepToCheck = animationListValues[nextStep];
|
|
8170
|
+
for (const target of targets) {
|
|
8171
|
+
const targetMapId = target.targetId;
|
|
8172
|
+
const wmMap = getWMJSMapById(targetMapId);
|
|
8173
|
+
if (wmMap) {
|
|
8174
|
+
const layersImageUrls = getWMSRequests(wmMap, [{
|
|
8175
|
+
name: 'time',
|
|
8176
|
+
currentValue: nextTimeValueStepToCheck
|
|
8177
|
+
}]);
|
|
8178
|
+
for (const layersImageUrl of layersImageUrls) {
|
|
8179
|
+
const image = wmMap.getMapImageStore.getImage(layersImageUrl.url);
|
|
8180
|
+
if (!image.isLoaded()) {
|
|
8181
|
+
if (wmMap.getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
|
|
8182
|
+
image.load();
|
|
8183
|
+
}
|
|
8184
|
+
if (numPrefetch === 0) {
|
|
8185
|
+
const altImage = wmMap.getAlternativeImage(layersImageUrl.url, wmMap.getBBOX(), true);
|
|
8186
|
+
// No alternative image available yet, so skipping animation.
|
|
8187
|
+
if (altImage.length === 0) {
|
|
8188
|
+
// This is useful to indicate that the map is loading and has nothing yet to display.
|
|
8189
|
+
// console.warn('No data available: Not stepping forward');
|
|
8190
|
+
timerShouldStepForward = false;
|
|
8191
|
+
}
|
|
8192
|
+
}
|
|
8193
|
+
} else if (image.isStale()) {
|
|
8194
|
+
if (wmMap.getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
|
|
8195
|
+
image.forceReload(true);
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
8198
|
+
}
|
|
8199
|
+
} else {
|
|
8200
|
+
return false; // Map was not registered so there is nothing to prefetch
|
|
8201
|
+
}
|
|
8202
|
+
}
|
|
8203
|
+
}
|
|
8204
|
+
return timerShouldStepForward;
|
|
8205
|
+
};
|
|
8206
|
+
|
|
8293
8207
|
/**
|
|
8294
8208
|
* This handler is triggered by the metronome. An array of timerIds is given as argument.
|
|
8295
8209
|
* It will update the animation loop of multiple maps and sliders
|
|
@@ -8447,10 +8361,130 @@ mapUiListener.startListening({
|
|
|
8447
8361
|
setOpen: false
|
|
8448
8362
|
}));
|
|
8449
8363
|
}
|
|
8450
|
-
});
|
|
8364
|
+
});
|
|
8365
|
+
}
|
|
8366
|
+
})
|
|
8367
|
+
});
|
|
8368
|
+
|
|
8369
|
+
const mapListener = createListenerMiddleware();
|
|
8370
|
+
const updateAnimation = (mapId, maxValue, listenerApi) => {
|
|
8371
|
+
const shouldEndtimeOverride$1 = shouldEndtimeOverride(listenerApi.getState(), mapId);
|
|
8372
|
+
if (shouldEndtimeOverride$1 === true) {
|
|
8373
|
+
return;
|
|
8374
|
+
}
|
|
8375
|
+
const animationStart = getAnimationStartTime(listenerApi.getState(), mapId);
|
|
8376
|
+
// Calculate how much time the animation start need to move forwards
|
|
8377
|
+
const animationEnd = getAnimationEndTime(listenerApi.getState(), mapId);
|
|
8378
|
+
const animationEndUnix = dateUtils.unix(dateUtils.utc(animationEnd));
|
|
8379
|
+
const maxTimeAsUnix = dateUtils.unix(dateUtils.utc(maxValue));
|
|
8380
|
+
const timeInSecondToShiftAnimationForwards = maxTimeAsUnix - animationEndUnix;
|
|
8381
|
+
const animationStartUnix = dateUtils.unix(dateUtils.utc(animationStart));
|
|
8382
|
+
const newAnimationStartTime = dateUtils.dateToString(dateUtils.fromUnix(animationStartUnix + timeInSecondToShiftAnimationForwards), dateFormat);
|
|
8383
|
+
const newAnimationEndTime = dateUtils.dateToString(dateUtils.fromUnix(animationEndUnix + timeInSecondToShiftAnimationForwards), dateFormat);
|
|
8384
|
+
if (!newAnimationStartTime || !newAnimationEndTime) {
|
|
8385
|
+
return;
|
|
8386
|
+
}
|
|
8387
|
+
listenerApi.dispatch(mapActions.setAnimationEndTime({
|
|
8388
|
+
mapId,
|
|
8389
|
+
animationEndTime: newAnimationEndTime
|
|
8390
|
+
}));
|
|
8391
|
+
listenerApi.dispatch(mapActions.setAnimationStartTime({
|
|
8392
|
+
mapId,
|
|
8393
|
+
animationStartTime: newAnimationStartTime
|
|
8394
|
+
}));
|
|
8395
|
+
};
|
|
8396
|
+
mapListener.startListening({
|
|
8397
|
+
actionCreator: mapActions.toggleAutoUpdate,
|
|
8398
|
+
effect: ({
|
|
8399
|
+
payload
|
|
8400
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8401
|
+
listenerApi.cancelActiveListeners();
|
|
8402
|
+
const {
|
|
8403
|
+
shouldAutoUpdate,
|
|
8404
|
+
mapId
|
|
8405
|
+
} = payload;
|
|
8406
|
+
if (!shouldAutoUpdate) {
|
|
8407
|
+
return;
|
|
8408
|
+
}
|
|
8409
|
+
try {
|
|
8410
|
+
const autoUpdateLayerId = getAutoUpdateLayerId(listenerApi.getState(), mapId);
|
|
8411
|
+
const timeDimension = getLayerTimeDimension(listenerApi.getState(), autoUpdateLayerId);
|
|
8412
|
+
const syncedMapIds = getSyncedMapIdsForTimeslider(listenerApi.getState());
|
|
8413
|
+
// go to end of active layer
|
|
8414
|
+
if ((timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.maxValue) && autoUpdateLayerId) {
|
|
8415
|
+
listenerApi.dispatch(layerActions.layerChangeDimension({
|
|
8416
|
+
layerId: autoUpdateLayerId,
|
|
8417
|
+
origin: LayerActionOrigin.toggleAutoUpdateListener,
|
|
8418
|
+
dimension: {
|
|
8419
|
+
name: 'time',
|
|
8420
|
+
currentValue: timeDimension.maxValue
|
|
8421
|
+
}
|
|
8422
|
+
}));
|
|
8423
|
+
// Change time value for all timesliders that are synced by syncgroups
|
|
8424
|
+
if (syncedMapIds.length > 0) {
|
|
8425
|
+
syncedMapIds.map(syncedMapId => listenerApi.dispatch(setTime({
|
|
8426
|
+
origin: LayerActionOrigin.toggleAutoUpdateListener,
|
|
8427
|
+
sourceId: syncedMapId,
|
|
8428
|
+
value: timeDimension.maxValue
|
|
8429
|
+
})));
|
|
8430
|
+
}
|
|
8431
|
+
updateAnimation(mapId, timeDimension.maxValue, listenerApi);
|
|
8432
|
+
}
|
|
8433
|
+
// Toggle autoupdate off for synced timesliders
|
|
8434
|
+
const payloads = syncedMapIds.reduce((syncedMapIdList, syncedMapId) => {
|
|
8435
|
+
if (syncedMapId !== mapId) {
|
|
8436
|
+
return syncedMapIdList.concat({
|
|
8437
|
+
mapId: syncedMapId,
|
|
8438
|
+
shouldAutoUpdate: false
|
|
8439
|
+
});
|
|
8440
|
+
}
|
|
8441
|
+
return syncedMapIdList;
|
|
8442
|
+
}, []);
|
|
8443
|
+
if (payloads.length > 0) {
|
|
8444
|
+
payloads.map(payload => listenerApi.dispatch(mapActions.toggleAutoUpdate(payload)));
|
|
8445
|
+
}
|
|
8446
|
+
} catch (error) {
|
|
8447
|
+
// eslint-disable-next-line no-console
|
|
8448
|
+
console.warn(error);
|
|
8451
8449
|
}
|
|
8452
8450
|
})
|
|
8453
8451
|
});
|
|
8452
|
+
mapListener.startListening({
|
|
8453
|
+
actionCreator: mapActions.mapStartAnimation,
|
|
8454
|
+
effect: ({
|
|
8455
|
+
payload
|
|
8456
|
+
}, listenerApi) => {
|
|
8457
|
+
const {
|
|
8458
|
+
mapId,
|
|
8459
|
+
initialTime
|
|
8460
|
+
} = payload;
|
|
8461
|
+
const speedDelay = getMapAnimationDelay(listenerApi.getState(), mapId);
|
|
8462
|
+
const speed = 1000 / (speedDelay || 1);
|
|
8463
|
+
metronome.register(null, speed, mapId);
|
|
8464
|
+
const timeList = getAnimationList(listenerApi.getState(), mapId);
|
|
8465
|
+
// In case of the timeList
|
|
8466
|
+
if (timeList && timeList.length > 0) {
|
|
8467
|
+
// Determine animation step based on initialTime and timeList
|
|
8468
|
+
const initalTimerStep = timeList === null || timeList === void 0 ? void 0 : timeList.findIndex(timeNameValue => {
|
|
8469
|
+
return timeNameValue.value === initialTime;
|
|
8470
|
+
});
|
|
8471
|
+
if (initalTimerStep !== -1) {
|
|
8472
|
+
setStep(mapId, initalTimerStep);
|
|
8473
|
+
}
|
|
8474
|
+
}
|
|
8475
|
+
}
|
|
8476
|
+
});
|
|
8477
|
+
mapListener.startListening({
|
|
8478
|
+
actionCreator: mapActions.mapStopAnimation,
|
|
8479
|
+
effect: ({
|
|
8480
|
+
payload
|
|
8481
|
+
}) => {
|
|
8482
|
+
const {
|
|
8483
|
+
mapId
|
|
8484
|
+
} = payload;
|
|
8485
|
+
metronome.unregister(mapId);
|
|
8486
|
+
}
|
|
8487
|
+
});
|
|
8454
8488
|
|
|
8455
8489
|
// TODO: This fixes typecheck errors but maybe there is a better way to do that
|
|
8456
8490
|
createStore$1({
|
|
@@ -8465,7 +8499,7 @@ const mapStoreModuleConfig = {
|
|
|
8465
8499
|
id: 'webmap-module',
|
|
8466
8500
|
reducersMap: mapStoreReducers,
|
|
8467
8501
|
sagas: [rootSaga$2, rootSaga$1],
|
|
8468
|
-
middlewares: [metronomeListener.middleware, layersListener.middleware, mapUiListener.middleware]
|
|
8502
|
+
middlewares: [metronomeListener.middleware, layersListener.middleware, mapUiListener.middleware, mapListener.middleware]
|
|
8469
8503
|
};
|
|
8470
8504
|
|
|
8471
8505
|
const mapStoreActions = Object.assign(Object.assign(Object.assign({}, layerActions), mapActions), serviceActions);
|
|
@@ -8664,132 +8698,55 @@ const getMapBaseLayerActionsTargets = (state, payload, actionType) => {
|
|
|
8664
8698
|
};
|
|
8665
8699
|
|
|
8666
8700
|
const setTimeValidatorRexexp = /^(19|20)\d\d-(0[1-9]|1[012])-([012]\d|3[01])T([01]\d|2[0-3]):([0-5]\d):([0-5]\d)Z$/;
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
}
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
}
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
}
|
|
8715
|
-
}
|
|
8716
|
-
function* duplicateMapLayerActionsSaga({
|
|
8717
|
-
payload
|
|
8718
|
-
}) {
|
|
8719
|
-
const sourceLayer = yield select(getLayerById, payload.oldLayerId);
|
|
8720
|
-
const newPayload = {
|
|
8721
|
-
mapId: payload.mapId,
|
|
8722
|
-
layer: sourceLayer,
|
|
8723
|
-
origin: payload.origin
|
|
8724
|
-
};
|
|
8725
|
-
const targets = yield select(getAddLayerActionsTargets, newPayload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
8726
|
-
if (targets && targets.length > 0) {
|
|
8727
|
-
yield put(setLayerActionSync(newPayload, targets, layerActions.addLayer.type));
|
|
8728
|
-
}
|
|
8729
|
-
}
|
|
8730
|
-
function* deleteLayerActionsSaga({
|
|
8731
|
-
payload,
|
|
8732
|
-
type
|
|
8733
|
-
}) {
|
|
8734
|
-
/* Should not listen to actions from itself */
|
|
8735
|
-
if (payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer) {
|
|
8736
|
-
return;
|
|
8737
|
-
}
|
|
8738
|
-
const targets = yield select(getLayerDeleteActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
8739
|
-
if (targets && targets.length > 0) {
|
|
8740
|
-
yield put(setLayerActionSync(payload, targets, type));
|
|
8741
|
-
}
|
|
8742
|
-
}
|
|
8743
|
-
function* moveLayerActionsSaga({
|
|
8744
|
-
payload,
|
|
8745
|
-
type
|
|
8746
|
-
}) {
|
|
8747
|
-
/* Should not listen to actions from itself */
|
|
8748
|
-
if (payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer) {
|
|
8749
|
-
return;
|
|
8750
|
-
}
|
|
8751
|
-
const targets = yield select(getLayerMoveActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
8752
|
-
if (targets && targets.length > 0) {
|
|
8753
|
-
yield put(setLayerActionSync(payload, targets, type));
|
|
8754
|
-
}
|
|
8755
|
-
}
|
|
8756
|
-
function* setAutoLayerIdActionsSaga({
|
|
8757
|
-
payload,
|
|
8758
|
-
type
|
|
8759
|
-
}) {
|
|
8760
|
-
const targets = yield select(getSetActiveLayerIdActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
8761
|
-
if (targets && targets.length > 0) {
|
|
8762
|
-
yield put(setLayerActionSync(payload, targets, type));
|
|
8763
|
-
}
|
|
8764
|
-
}
|
|
8765
|
-
function* mapBaseLayerActionsSaga({
|
|
8766
|
-
payload,
|
|
8767
|
-
type
|
|
8768
|
-
}) {
|
|
8769
|
-
/* Should not listen to actions from itself */
|
|
8770
|
-
if (payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer) {
|
|
8771
|
-
return;
|
|
8772
|
-
}
|
|
8773
|
-
const targets = yield select(getMapBaseLayerActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
8774
|
-
if (targets && targets.length > 0) {
|
|
8775
|
-
yield put(setLayerActionSync(payload, targets, type));
|
|
8776
|
-
}
|
|
8777
|
-
}
|
|
8778
|
-
function* rootSaga() {
|
|
8779
|
-
yield takeLatest(setTime.type, setTimeSaga);
|
|
8780
|
-
yield takeLatest(setBbox.type, setBBoxSaga);
|
|
8781
|
-
yield takeLatest(layerActions.layerChangeName.type, layerActionsSaga);
|
|
8782
|
-
yield takeLatest(layerActions.layerChangeEnabled.type, layerActionsSaga);
|
|
8783
|
-
yield takeLatest(layerActions.layerChangeOpacity.type, layerActionsSaga);
|
|
8784
|
-
yield takeLatest(layerActions.layerChangeDimension.type, layerActionsSaga);
|
|
8785
|
-
yield takeLatest(layerActions.layerChangeStyle.type, layerActionsSaga);
|
|
8786
|
-
yield takeLatest(layerActions.layerDelete.type, deleteLayerActionsSaga);
|
|
8787
|
-
yield takeLatest(layerActions.addLayer.type, addLayerActionsSaga);
|
|
8788
|
-
yield takeLatest(layerActions.duplicateMapLayer.type, duplicateMapLayerActionsSaga);
|
|
8789
|
-
yield takeLatest(mapActions.layerMoveLayer.type, moveLayerActionsSaga);
|
|
8790
|
-
yield takeLatest(mapActions.setAutoLayerId.type, setAutoLayerIdActionsSaga);
|
|
8791
|
-
yield takeLatest(layerActions.setBaseLayers.type, mapBaseLayerActionsSaga);
|
|
8792
|
-
}
|
|
8701
|
+
const genericListener = createListenerMiddleware();
|
|
8702
|
+
genericListener.startListening({
|
|
8703
|
+
actionCreator: setTime,
|
|
8704
|
+
effect: ({
|
|
8705
|
+
payload
|
|
8706
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8707
|
+
listenerApi.cancelActiveListeners();
|
|
8708
|
+
const {
|
|
8709
|
+
value,
|
|
8710
|
+
origin
|
|
8711
|
+
} = payload;
|
|
8712
|
+
/* Test if the value is according to the expected time format */
|
|
8713
|
+
if (!setTimeValidatorRexexp.test(value)) {
|
|
8714
|
+
console.error(`setTime value ${value} does not conform to format [YYYY-MM-DDThh:mm:ssZ]. It was triggered by ${origin}`);
|
|
8715
|
+
} else {
|
|
8716
|
+
const targets = getTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETTIME);
|
|
8717
|
+
const groups = getTargetGroups(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETTIME);
|
|
8718
|
+
listenerApi.dispatch(setTimeSync(payload, targets, groups));
|
|
8719
|
+
}
|
|
8720
|
+
})
|
|
8721
|
+
});
|
|
8722
|
+
genericListener.startListening({
|
|
8723
|
+
actionCreator: setBbox,
|
|
8724
|
+
effect: ({
|
|
8725
|
+
payload
|
|
8726
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8727
|
+
listenerApi.cancelActiveListeners();
|
|
8728
|
+
const targets = getTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETBBOX);
|
|
8729
|
+
const groups = getTargetGroups(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETBBOX);
|
|
8730
|
+
listenerApi.dispatch(setBboxSync(payload, targets, groups));
|
|
8731
|
+
})
|
|
8732
|
+
});
|
|
8733
|
+
genericListener.startListening({
|
|
8734
|
+
matcher: isAnyOf(layerActions.layerChangeName, layerActions.layerChangeEnabled, layerActions.layerChangeOpacity, layerActions.layerChangeDimension, layerActions.layerChangeStyle),
|
|
8735
|
+
effect: ({
|
|
8736
|
+
payload,
|
|
8737
|
+
type
|
|
8738
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8739
|
+
listenerApi.cancelActiveListeners();
|
|
8740
|
+
/* Should not listen to actions from itself */
|
|
8741
|
+
if (payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer) {
|
|
8742
|
+
return;
|
|
8743
|
+
}
|
|
8744
|
+
const targets = getLayerActionsTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
8745
|
+
if (targets && targets.length > 0) {
|
|
8746
|
+
listenerApi.dispatch(setLayerActionSync(payload, targets, type));
|
|
8747
|
+
}
|
|
8748
|
+
})
|
|
8749
|
+
});
|
|
8793
8750
|
|
|
8794
8751
|
/* *
|
|
8795
8752
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -9641,6 +9598,106 @@ var storeTestUtils = /*#__PURE__*/Object.freeze({
|
|
|
9641
9598
|
webmapStateWithAddedLayer: webmapStateWithAddedLayer
|
|
9642
9599
|
});
|
|
9643
9600
|
|
|
9601
|
+
/* *
|
|
9602
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9603
|
+
* you may not use this file except in compliance with the License.
|
|
9604
|
+
* You may obtain a copy of the License at
|
|
9605
|
+
*
|
|
9606
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9607
|
+
*
|
|
9608
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9609
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9610
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9611
|
+
* See the License for the specific language governing permissions and
|
|
9612
|
+
* limitations under the License.
|
|
9613
|
+
*
|
|
9614
|
+
* Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
9615
|
+
* Copyright 2020 - Finnish Meteorological Institute (FMI)
|
|
9616
|
+
* */
|
|
9617
|
+
function* addLayerActionsSaga({
|
|
9618
|
+
payload,
|
|
9619
|
+
type
|
|
9620
|
+
}) {
|
|
9621
|
+
/* Should not listen to actions from itself */
|
|
9622
|
+
if (payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer) {
|
|
9623
|
+
return;
|
|
9624
|
+
}
|
|
9625
|
+
const targets = yield select(getAddLayerActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
9626
|
+
if (targets && targets.length > 0) {
|
|
9627
|
+
yield put(setLayerActionSync(payload, targets, type));
|
|
9628
|
+
}
|
|
9629
|
+
}
|
|
9630
|
+
function* duplicateMapLayerActionsSaga({
|
|
9631
|
+
payload
|
|
9632
|
+
}) {
|
|
9633
|
+
const sourceLayer = yield select(getLayerById, payload.oldLayerId);
|
|
9634
|
+
const newPayload = {
|
|
9635
|
+
mapId: payload.mapId,
|
|
9636
|
+
layer: sourceLayer,
|
|
9637
|
+
origin: payload.origin
|
|
9638
|
+
};
|
|
9639
|
+
const targets = yield select(getAddLayerActionsTargets, newPayload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
9640
|
+
if (targets && targets.length > 0) {
|
|
9641
|
+
yield put(setLayerActionSync(newPayload, targets, layerActions.addLayer.type));
|
|
9642
|
+
}
|
|
9643
|
+
}
|
|
9644
|
+
function* deleteLayerActionsSaga({
|
|
9645
|
+
payload,
|
|
9646
|
+
type
|
|
9647
|
+
}) {
|
|
9648
|
+
/* Should not listen to actions from itself */
|
|
9649
|
+
if (payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer) {
|
|
9650
|
+
return;
|
|
9651
|
+
}
|
|
9652
|
+
const targets = yield select(getLayerDeleteActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
9653
|
+
if (targets && targets.length > 0) {
|
|
9654
|
+
yield put(setLayerActionSync(payload, targets, type));
|
|
9655
|
+
}
|
|
9656
|
+
}
|
|
9657
|
+
function* moveLayerActionsSaga({
|
|
9658
|
+
payload,
|
|
9659
|
+
type
|
|
9660
|
+
}) {
|
|
9661
|
+
/* Should not listen to actions from itself */
|
|
9662
|
+
if (payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer) {
|
|
9663
|
+
return;
|
|
9664
|
+
}
|
|
9665
|
+
const targets = yield select(getLayerMoveActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
9666
|
+
if (targets && targets.length > 0) {
|
|
9667
|
+
yield put(setLayerActionSync(payload, targets, type));
|
|
9668
|
+
}
|
|
9669
|
+
}
|
|
9670
|
+
function* setAutoLayerIdActionsSaga({
|
|
9671
|
+
payload,
|
|
9672
|
+
type
|
|
9673
|
+
}) {
|
|
9674
|
+
const targets = yield select(getSetActiveLayerIdActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
9675
|
+
if (targets && targets.length > 0) {
|
|
9676
|
+
yield put(setLayerActionSync(payload, targets, type));
|
|
9677
|
+
}
|
|
9678
|
+
}
|
|
9679
|
+
function* mapBaseLayerActionsSaga({
|
|
9680
|
+
payload,
|
|
9681
|
+
type
|
|
9682
|
+
}) {
|
|
9683
|
+
/* Should not listen to actions from itself */
|
|
9684
|
+
if (payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer) {
|
|
9685
|
+
return;
|
|
9686
|
+
}
|
|
9687
|
+
const targets = yield select(getMapBaseLayerActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
9688
|
+
if (targets && targets.length > 0) {
|
|
9689
|
+
yield put(setLayerActionSync(payload, targets, type));
|
|
9690
|
+
}
|
|
9691
|
+
}
|
|
9692
|
+
function* rootSaga() {
|
|
9693
|
+
yield takeLatest(layerActions.layerDelete.type, deleteLayerActionsSaga);
|
|
9694
|
+
yield takeLatest(layerActions.addLayer.type, addLayerActionsSaga);
|
|
9695
|
+
yield takeLatest(layerActions.duplicateMapLayer.type, duplicateMapLayerActionsSaga);
|
|
9696
|
+
yield takeLatest(mapActions.layerMoveLayer.type, moveLayerActionsSaga);
|
|
9697
|
+
yield takeLatest(mapActions.setAutoLayerId.type, setAutoLayerIdActionsSaga);
|
|
9698
|
+
yield takeLatest(layerActions.setBaseLayers.type, mapBaseLayerActionsSaga);
|
|
9699
|
+
}
|
|
9700
|
+
|
|
9644
9701
|
/* *
|
|
9645
9702
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9646
9703
|
* you may not use this file except in compliance with the License.
|
|
@@ -9713,7 +9770,7 @@ const synchronizationGroupConfig = {
|
|
|
9713
9770
|
loadingIndicatorStore: loadingIndicatorReducer
|
|
9714
9771
|
},
|
|
9715
9772
|
sagas: [rootSaga],
|
|
9716
|
-
middlewares: [syncGroupsListener.middleware]
|
|
9773
|
+
middlewares: [genericListener.middleware, syncGroupsListener.middleware]
|
|
9717
9774
|
};
|
|
9718
9775
|
|
|
9719
9776
|
/* *
|
|
@@ -9759,7 +9816,7 @@ const coreModuleConfig = [mapStoreModuleConfig, synchronizationGroupConfig, uiMo
|
|
|
9759
9816
|
|
|
9760
9817
|
const createStore = () => createStore$1({
|
|
9761
9818
|
extensions: [getSagaExtension({}), {
|
|
9762
|
-
middlewares: [metronomeListener.middleware]
|
|
9819
|
+
middlewares: [metronomeListener.middleware, mapListener.middleware]
|
|
9763
9820
|
}]
|
|
9764
9821
|
});
|
|
9765
9822
|
const WrapperWithModules = withEggs(coreModuleConfig)(({
|
|
@@ -9782,4 +9839,4 @@ const StoreProvider = ({
|
|
|
9782
9839
|
})
|
|
9783
9840
|
}));
|
|
9784
9841
|
|
|
9785
|
-
export { IS_LEGEND_OPEN_BY_DEFAULT, StoreProvider, coreModuleConfig, createStore, drawtoolActions, drawtoolModuleConfig, reducer as drawtoolReducer, selectors as drawtoolSelectors, filterLayers$1 as filterLayers, genericActions,
|
|
9842
|
+
export { IS_LEGEND_OPEN_BY_DEFAULT, StoreProvider, coreModuleConfig, createStore, drawtoolActions, drawtoolModuleConfig, reducer as drawtoolReducer, selectors as drawtoolSelectors, filterLayers$1 as filterLayers, genericActions, genericListener, selectors$4 as genericSelectors, types$1 as genericTypes, getSingularDrawtoolDrawLayerId, getUserAddedServices, initialState$3 as initialState, layerActions, reducer$6 as layerReducer, selectors$7 as layerSelectors, types$5 as layerTypes, utils$2 as layerUtils, loadingIndicatorActions, constants as loadingIndicatorConstants, loadingIndicatorReducer, selectors$3 as loadingIndicatorSelectors, mapActions, enums as mapEnums, rootSaga$2 as mapSaga, selectors$2 as mapSelectors, mapStoreActions, mapStoreModuleConfig, mapStoreReducers, types$4 as mapTypes, mapUtils, routerActions, routerModuleConfig, utils as routerUtils, selectorMemoizationOptions, serviceActions, selectors$1 as serviceSelectors, types as serviceTypes, setUserAddedServices, storeTestSettings, storeTestUtils, utils$1 as storeUtils, constants$1 as syncConstants, actions as syncGroupsActions, reducer$3 as syncGroupsReducer, selector as syncGroupsSelector, selectors$5 as syncGroupsSelectors, types$2 as syncGroupsTypes, types$2 as types, uiActions, uiModuleConfig, reducer$5 as uiReducer, selectors$6 as uiSelectors, types$3 as uiTypes, useSetupDialog, reducer$4 as webmapReducer };
|
package/package.json
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { SynchronizationGroupModuleState } from './synchronizationGroups/types';
|
|
2
|
+
export declare const genericListener: import("@reduxjs/toolkit").ListenerMiddlewareInstance<SynchronizationGroupModuleState, import("@reduxjs/toolkit").ThunkDispatch<SynchronizationGroupModuleState, unknown, import("redux").AnyAction>, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { SagaIterator } from 'redux-saga';
|
|
2
2
|
import { mapActions } from '../mapStore';
|
|
3
|
-
import {
|
|
4
|
-
import { layerActions, LayerActions } from '../mapStore/layers/reducer';
|
|
5
|
-
export declare function setTimeSaga({ payload, }: ReturnType<typeof setTime>): SagaIterator;
|
|
6
|
-
export declare function setBBoxSaga({ payload, }: ReturnType<typeof setBbox>): SagaIterator;
|
|
7
|
-
export declare function layerActionsSaga({ payload, type, }: LayerActions): SagaIterator;
|
|
3
|
+
import { layerActions } from '../mapStore/layers/reducer';
|
|
8
4
|
export declare function addLayerActionsSaga({ payload, type, }: ReturnType<typeof layerActions.addLayer>): SagaIterator;
|
|
9
5
|
export declare function duplicateMapLayerActionsSaga({ payload, }: ReturnType<typeof layerActions.duplicateMapLayer>): SagaIterator;
|
|
10
6
|
export declare function deleteLayerActionsSaga({ payload, type, }: ReturnType<typeof layerActions.layerDelete>): SagaIterator;
|
package/src/store/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './mapStore';
|
|
2
2
|
export * from './ui';
|
|
3
3
|
export * from './generic';
|
|
4
|
-
export {
|
|
4
|
+
export { genericListener } from './generic/listener';
|
|
5
5
|
export * from './router';
|
|
6
6
|
export * from './drawingtool';
|
|
7
7
|
export * from './types';
|
|
@@ -14,7 +14,7 @@ export declare enum LayerActionOrigin {
|
|
|
14
14
|
wmsLoader = "WMSLayerTreeConnect",
|
|
15
15
|
ReactMapViewParseLayer = "ReactMapViewParseLayer",
|
|
16
16
|
setLayerDimensionSaga = "setLayerDimensionSaga",
|
|
17
|
-
|
|
17
|
+
toggleAutoUpdateListener = "toggleAutoUpdateListener",
|
|
18
18
|
unregisterMapSaga = "unregisterMapSaga"
|
|
19
19
|
}
|
|
20
20
|
export interface FeatureLayer {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { AnyAction, ThunkDispatch } from '@reduxjs/toolkit';
|
|
2
|
+
import { WebMapStateModuleState } from '../types';
|
|
3
|
+
export declare const mapListener: import("@reduxjs/toolkit").ListenerMiddlewareInstance<WebMapStateModuleState, ThunkDispatch<WebMapStateModuleState, unknown, AnyAction>, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,12 +4,9 @@ import { layerActions } from '../layers';
|
|
|
4
4
|
import { Layer } from '../layers/types';
|
|
5
5
|
export declare const getAnimationEndTime: (animationEndTime: string) => string;
|
|
6
6
|
export declare const isAnimationEndTimeValid: (animationEndTime: string) => boolean;
|
|
7
|
-
export declare function startAnimationSaga({ payload, }: ReturnType<typeof mapActions.mapStartAnimation>): Generator;
|
|
8
|
-
export declare function stopAnimationSaga({ payload, }: ReturnType<typeof mapActions.mapStopAnimation>): Generator;
|
|
9
7
|
export declare function deleteLayerSaga({ payload, }: ReturnType<typeof layerActions.layerDelete>): SagaIterator;
|
|
10
8
|
export declare function updateAnimation(mapId: string, maxValue: string): SagaIterator;
|
|
11
9
|
export declare function setLayerDimensionsSaga({ payload, }: ReturnType<typeof layerActions.onUpdateLayerInformation>): SagaIterator;
|
|
12
|
-
export declare function toggleAutoUpdateSaga({ payload, }: ReturnType<typeof mapActions.toggleAutoUpdate>): SagaIterator;
|
|
13
10
|
export declare function handleBaseLayersSaga(mapId: string, baseLayers: Layer[]): SagaIterator;
|
|
14
11
|
export declare function setMapPresetSaga({ payload, }: ReturnType<typeof mapActions.setMapPreset>): SagaIterator;
|
|
15
12
|
export declare function unregisterMapSaga({ payload, }: ReturnType<typeof mapActions.unregisterMap>): Generator;
|