@opengeoweb/store 10.2.0 → 11.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 +1318 -1366
- package/package.json +3 -2
- package/src/store/drawingTool/index.d.ts +2 -3
- package/src/store/generic/hooks.d.ts +1 -1
- package/src/store/generic/index.d.ts +15 -15
- package/src/store/generic/listener.d.ts +1 -1
- package/src/store/generic/selectors.d.ts +2 -2
- package/src/store/generic/{synchronizationGroups → syncGroups}/index.d.ts +2 -1
- package/src/store/generic/{synchronizationGroups → syncGroups}/reducer.d.ts +2 -2
- package/src/store/generic/{synchronizationGroups → syncGroups}/types.d.ts +6 -7
- package/src/store/index.d.ts +1 -2
- package/src/store/map/index.d.ts +0 -1
- package/src/store/map/layer/index.d.ts +1 -1
- package/src/store/map/layer/reducer.d.ts +1 -2
- package/src/store/map/layer/types.d.ts +2 -2
- package/src/store/map/map/index.d.ts +1 -1
- package/src/store/map/map/reducer.d.ts +1 -1
- package/src/store/map/service/index.d.ts +1 -1
- package/src/store/map/service/reducer.d.ts +1 -2
- package/src/store/map/service/types.d.ts +4 -4
- package/src/store/router/index.d.ts +1 -2
- package/src/store/router/reducer.d.ts +1 -2
- package/src/store/store.d.ts +18 -0
- package/src/store/types.d.ts +1 -1
- package/src/store/ui/index.d.ts +2 -1
- package/src/store/ui/reducer.d.ts +1 -2
- package/src/store/coreModuleConfig.d.ts +0 -9
- package/src/store/drawingTool/config.d.ts +0 -7
- package/src/store/generic/config.d.ts +0 -9
- package/src/store/map/config.d.ts +0 -8
- package/src/store/router/config.d.ts +0 -7
- package/src/store/ui/config.d.ts +0 -5
- package/src/store/utils/testUtils.d.ts +0 -3
- /package/src/store/generic/{synchronizationGroups → syncGroups}/__mocks__/mockState.d.ts +0 -0
- /package/src/store/generic/{synchronizationGroups → syncGroups}/constants.d.ts +0 -0
- /package/src/store/generic/{synchronizationGroups → syncGroups}/listener.d.ts +0 -0
- /package/src/store/generic/{synchronizationGroups → syncGroups}/listener.spec.d.ts +0 -0
- /package/src/store/generic/{synchronizationGroups → syncGroups}/reducer.spec.d.ts +0 -0
- /package/src/store/generic/{synchronizationGroups → syncGroups}/selector.d.ts +0 -0
- /package/src/store/generic/{synchronizationGroups → syncGroups}/selectors.d.ts +0 -0
- /package/src/store/generic/{synchronizationGroups → syncGroups}/selectors.spec.d.ts +0 -0
- /package/src/store/generic/{synchronizationGroups → syncGroups}/utils.d.ts +0 -0
- /package/src/store/generic/{synchronizationGroups → syncGroups}/utils.spec.d.ts +0 -0
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSlice, createSelector, createAction, createListenerMiddleware, isAnyOf, createEntityAdapter } from '@reduxjs/toolkit';
|
|
1
|
+
import { createSlice, createSelector, createAction, createListenerMiddleware, isAnyOf, createEntityAdapter, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
2
|
import { isEqual, isEmpty, compact } from 'lodash';
|
|
3
3
|
import { dateUtils, PROJECTION, defaultDelay } from '@opengeoweb/shared';
|
|
4
4
|
import { webmapUtils, parseISO8601IntervalToDateInterval, LayerType, getWMJSMapById, webmapTestSettings, WMLayer, getWMSRequests, handleDateUtilsISOString, isProjectionSupported, queryWMSLayers } from '@opengeoweb/webmap';
|
|
@@ -8,6 +8,7 @@ import { getGeoJson, moveFeature, createInterSections, getLastEmptyFeatureIndex,
|
|
|
8
8
|
export { defaultLayers } from '@opengeoweb/webmap-react';
|
|
9
9
|
import { useSelector, useDispatch } from 'react-redux';
|
|
10
10
|
import { useCallback, useEffect } from 'react';
|
|
11
|
+
import * as turf from '@turf/turf';
|
|
11
12
|
import { metronome } from '@opengeoweb/metronome';
|
|
12
13
|
|
|
13
14
|
/* *
|
|
@@ -63,8 +64,8 @@ var slice$7 = createSlice({
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
});
|
|
66
|
-
var
|
|
67
|
-
|
|
67
|
+
var serviceReducer = slice$7.reducer,
|
|
68
|
+
serviceActions = slice$7.actions;
|
|
68
69
|
|
|
69
70
|
/* *
|
|
70
71
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -2025,7 +2026,7 @@ var slice$6 = createSlice({
|
|
|
2025
2026
|
type: source && source.type
|
|
2026
2027
|
};
|
|
2027
2028
|
/* Handle the Layer action with the same logic, using the same reducer */
|
|
2028
|
-
return
|
|
2029
|
+
return layerReducer(prevState, action);
|
|
2029
2030
|
}, draft);
|
|
2030
2031
|
}).addCase(setMapPreset, function (draft, action) {
|
|
2031
2032
|
var mapId = action.payload.mapId;
|
|
@@ -2045,8 +2046,8 @@ var slice$6 = createSlice({
|
|
|
2045
2046
|
});
|
|
2046
2047
|
}
|
|
2047
2048
|
});
|
|
2048
|
-
var
|
|
2049
|
-
|
|
2049
|
+
var layerReducer = slice$6.reducer,
|
|
2050
|
+
layerActions = slice$6.actions;
|
|
2050
2051
|
|
|
2051
2052
|
/* *
|
|
2052
2053
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -2179,8 +2180,8 @@ var slice$5 = createSlice({
|
|
|
2179
2180
|
}
|
|
2180
2181
|
}
|
|
2181
2182
|
});
|
|
2182
|
-
var
|
|
2183
|
-
|
|
2183
|
+
var uiReducer = slice$5.reducer,
|
|
2184
|
+
uiActions = slice$5.actions;
|
|
2184
2185
|
|
|
2185
2186
|
/**
|
|
2186
2187
|
* Checks if the layer id is already taken in one of the maps.
|
|
@@ -2799,7 +2800,7 @@ var slice$4 = createSlice({
|
|
|
2799
2800
|
type: source && source.type
|
|
2800
2801
|
};
|
|
2801
2802
|
/* Handle the Layer action with the same logic, using the same reducer */
|
|
2802
|
-
return
|
|
2803
|
+
return mapReducer(prevState, action);
|
|
2803
2804
|
}, draft);
|
|
2804
2805
|
}).addCase(layerActions.onUpdateLayerInformation, function (draft, action) {
|
|
2805
2806
|
var mapDimensions = action.payload.mapDimensions;
|
|
@@ -2849,7 +2850,7 @@ var mapActions = Object.assign({}, slice$4.actions, {
|
|
|
2849
2850
|
setMapPreset: setMapPreset,
|
|
2850
2851
|
mapChangeDimension: mapChangeDimension
|
|
2851
2852
|
});
|
|
2852
|
-
var
|
|
2853
|
+
var mapReducer = slice$4.reducer;
|
|
2853
2854
|
|
|
2854
2855
|
var layerStore = function layerStore(store) {
|
|
2855
2856
|
return store == null ? void 0 : store.layers;
|
|
@@ -3965,8 +3966,8 @@ var _slice$actions = slice$3.actions;
|
|
|
3965
3966
|
_slice$actions.syncGroupRemoveSource;
|
|
3966
3967
|
_slice$actions.syncGroupRemoveTarget;
|
|
3967
3968
|
_slice$actions.syncGroupSetViewState;
|
|
3968
|
-
var
|
|
3969
|
-
|
|
3969
|
+
var syncGroupsReducer = slice$3.reducer,
|
|
3970
|
+
syncGroupsActions = slice$3.actions;
|
|
3970
3971
|
|
|
3971
3972
|
/* *
|
|
3972
3973
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -4237,7 +4238,7 @@ var selector = /*#__PURE__*/Object.freeze({
|
|
|
4237
4238
|
|
|
4238
4239
|
var syncGroupsListener = createListenerMiddleware();
|
|
4239
4240
|
syncGroupsListener.startListening({
|
|
4240
|
-
matcher: isAnyOf(
|
|
4241
|
+
matcher: isAnyOf(syncGroupsActions.syncGroupAddTarget, syncGroupsActions.syncGroupLinkTarget),
|
|
4241
4242
|
effect: function () {
|
|
4242
4243
|
var _effect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, listenerApi) {
|
|
4243
4244
|
var payload, groupId, linked, targetToUpdate, group;
|
|
@@ -4295,7 +4296,7 @@ syncGroupsListener.startListening({
|
|
|
4295
4296
|
}()
|
|
4296
4297
|
});
|
|
4297
4298
|
syncGroupsListener.startListening({
|
|
4298
|
-
matcher: isAnyOf(
|
|
4299
|
+
matcher: isAnyOf(syncGroupsActions.syncGroupAddGroup, syncGroupsActions.syncGroupRemoveGroup, syncGroupsActions.syncGroupAddSource, syncGroupsActions.syncGroupRemoveSource, syncGroupsActions.syncGroupAddTarget, syncGroupsActions.syncGroupRemoveTarget, syncGroupsActions.syncGroupLinkTarget),
|
|
4299
4300
|
effect: function () {
|
|
4300
4301
|
var _effect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_, listenerApi) {
|
|
4301
4302
|
var viewState;
|
|
@@ -4304,7 +4305,7 @@ syncGroupsListener.startListening({
|
|
|
4304
4305
|
case 0:
|
|
4305
4306
|
listenerApi.cancelActiveListeners();
|
|
4306
4307
|
viewState = createSyncGroupViewStateSelector(listenerApi.getState());
|
|
4307
|
-
listenerApi.dispatch(
|
|
4308
|
+
listenerApi.dispatch(syncGroupsActions.syncGroupSetViewState({
|
|
4308
4309
|
viewState: viewState
|
|
4309
4310
|
}));
|
|
4310
4311
|
case 3:
|
|
@@ -4492,6 +4493,18 @@ function (state, mapId) {
|
|
|
4492
4493
|
name: (_selectedFeature$prop3 = selectedFeature.properties) == null ? void 0 : _selectedFeature$prop3.name
|
|
4493
4494
|
};
|
|
4494
4495
|
}
|
|
4496
|
+
if (selectedFeature) {
|
|
4497
|
+
var _selectedFeature$prop4, _selectedFeature$prop5, _selectedFeature$prop6;
|
|
4498
|
+
var center = turf.center(selectedFeature);
|
|
4499
|
+
return {
|
|
4500
|
+
lat: center.geometry.coordinates[1],
|
|
4501
|
+
lon: center.geometry.coordinates[0],
|
|
4502
|
+
id: selectedFeature.id,
|
|
4503
|
+
serviceId: (_selectedFeature$prop4 = selectedFeature.properties) == null ? void 0 : _selectedFeature$prop4.serviceId,
|
|
4504
|
+
collectionId: (_selectedFeature$prop5 = selectedFeature.properties) == null ? void 0 : _selectedFeature$prop5.collectionId,
|
|
4505
|
+
name: (_selectedFeature$prop6 = selectedFeature.properties) == null ? void 0 : _selectedFeature$prop6.name
|
|
4506
|
+
};
|
|
4507
|
+
}
|
|
4495
4508
|
return null;
|
|
4496
4509
|
});
|
|
4497
4510
|
|
|
@@ -4537,7 +4550,7 @@ var useUpdateSharedData = function useUpdateSharedData(data, panelId) {
|
|
|
4537
4550
|
useEffect(function () {
|
|
4538
4551
|
var diff = Object.assign({}, sharedData, data);
|
|
4539
4552
|
if (panelId && (linkedMaps == null ? void 0 : linkedMaps.length) > 0 && !isEqual(diff, sharedData)) {
|
|
4540
|
-
dispatch(
|
|
4553
|
+
dispatch(syncGroupsActions.addSharedData({
|
|
4541
4554
|
panelId: panelId,
|
|
4542
4555
|
data: data
|
|
4543
4556
|
}));
|
|
@@ -4546,7 +4559,7 @@ var useUpdateSharedData = function useUpdateSharedData(data, panelId) {
|
|
|
4546
4559
|
useEffect(function () {
|
|
4547
4560
|
return function () {
|
|
4548
4561
|
if (panelId) {
|
|
4549
|
-
dispatch(
|
|
4562
|
+
dispatch(syncGroupsActions.deleteSharedData({
|
|
4550
4563
|
panelId: panelId
|
|
4551
4564
|
}));
|
|
4552
4565
|
}
|
|
@@ -4735,7 +4748,7 @@ var selectors$2 = /*#__PURE__*/Object.freeze({
|
|
|
4735
4748
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4736
4749
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
4737
4750
|
* */
|
|
4738
|
-
var genericActions = Object.assign({},
|
|
4751
|
+
var genericActions = Object.assign({}, syncGroupsActions, {
|
|
4739
4752
|
initialSyncState: initialState$2,
|
|
4740
4753
|
setTime: setTime,
|
|
4741
4754
|
setBbox: setBbox
|
|
@@ -5963,218 +5976,217 @@ var storeTestSettings = /*#__PURE__*/Object.freeze({
|
|
|
5963
5976
|
styleListForRADNLOPERR25PCPRRL3KNMILayer: styleListForRADNLOPERR25PCPRRL3KNMILayer
|
|
5964
5977
|
});
|
|
5965
5978
|
|
|
5966
|
-
|
|
5967
|
-
var stepMap = new Map();
|
|
5968
|
-
/* A map with a list of timers and their dwell */
|
|
5969
|
-
var timerDwellMap = new Map();
|
|
5979
|
+
var _excluded$1 = ["id"];
|
|
5970
5980
|
/**
|
|
5971
|
-
*
|
|
5972
|
-
* @param
|
|
5973
|
-
* @param
|
|
5974
|
-
* @param
|
|
5981
|
+
* Tries to find the layerId's in the other map based on the payload of the action. It works for all layer actions.
|
|
5982
|
+
* @param state
|
|
5983
|
+
* @param mapId
|
|
5984
|
+
* @param targetMapId
|
|
5985
|
+
* @param payload
|
|
5975
5986
|
* @returns
|
|
5976
5987
|
*/
|
|
5977
|
-
var
|
|
5978
|
-
if (
|
|
5979
|
-
|
|
5988
|
+
var getTargetLayerIdFromPayload = function getTargetLayerIdFromPayload(state, mapId, targetMapId, payload) {
|
|
5989
|
+
if (!payload) {
|
|
5990
|
+
return null;
|
|
5980
5991
|
}
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5992
|
+
/* Try to find the layer for the DeleteLayerPayload, it uses layerIndex to reference the layer */
|
|
5993
|
+
if ('layerIndex' in payload) {
|
|
5994
|
+
var tempLayerIndex = payload.layerIndex;
|
|
5995
|
+
if (tempLayerIndex !== undefined) {
|
|
5996
|
+
var targetLayer = getLayerByLayerIndex(state, targetMapId, tempLayerIndex);
|
|
5997
|
+
return !targetLayer ? null : targetLayer.id;
|
|
5998
|
+
}
|
|
5999
|
+
}
|
|
6000
|
+
/* Try to find the layer for the LayerActionsWithLayerIds, it uses layerId to reference the layer */
|
|
6001
|
+
if ('layerId' in payload) {
|
|
6002
|
+
var _targetLayer = getLayerByLayerIndex(state, targetMapId, getLayerIndexByLayerId(state, mapId, payload.layerId));
|
|
6003
|
+
return !_targetLayer ? null : _targetLayer.id;
|
|
6004
|
+
}
|
|
6005
|
+
/* This payload probably does not reference to a layerId */
|
|
6006
|
+
return null;
|
|
5985
6007
|
};
|
|
5986
6008
|
/**
|
|
5987
|
-
*
|
|
5988
|
-
* @param
|
|
5989
|
-
* @param
|
|
5990
|
-
* @param
|
|
5991
|
-
* @
|
|
6009
|
+
* Local helper function used by getLayerDeleteActionsTargets, getLayerActionsTargets, getAddLayerActionsTargets, getTargetLayerIdFromPayload to find the targets
|
|
6010
|
+
* @param state
|
|
6011
|
+
* @param payload
|
|
6012
|
+
* @param actionType
|
|
6013
|
+
* @param sourceMapId
|
|
6014
|
+
* @returns The found targets
|
|
5992
6015
|
*/
|
|
5993
|
-
var
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
if (
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6016
|
+
var findTargets = function findTargets(state, payload, actionType, sourceMapId) {
|
|
6017
|
+
var actionPayloads = [];
|
|
6018
|
+
var targetsInActionPayload = {};
|
|
6019
|
+
var syncGroups = syncGroupStore(state);
|
|
6020
|
+
if (syncGroups && payload) {
|
|
6021
|
+
syncGroups.groups.allIds.forEach(function (id) {
|
|
6022
|
+
var syncronizationGroup = syncGroups.groups.byId[id];
|
|
6023
|
+
if (actionType === syncronizationGroup.type) {
|
|
6024
|
+
/* Check if the source is in the target list of the synchonizationGroup */
|
|
6025
|
+
var source = syncronizationGroup.targets.byId[sourceMapId];
|
|
6026
|
+
/* If the source is part of the target list, and is linked, continue syncing the other targets */
|
|
6027
|
+
if (source && source.linked) {
|
|
6028
|
+
syncronizationGroup.targets.allIds.forEach(function (targetId) {
|
|
6029
|
+
var target = syncronizationGroup.targets.byId[targetId];
|
|
6030
|
+
if (targetId !== sourceMapId && target.linked && !targetsInActionPayload[targetId]) {
|
|
6031
|
+
/* Remember that we have already added this target in the action payloads, prevents adding it twice */
|
|
6032
|
+
targetsInActionPayload[targetId] = true;
|
|
6033
|
+
var otherLayerId = getTargetLayerIdFromPayload(state, sourceMapId, targetId, payload);
|
|
6034
|
+
actionPayloads.push({
|
|
6035
|
+
payload: payload,
|
|
6036
|
+
targetId: targetId,
|
|
6037
|
+
layerId: otherLayerId
|
|
6038
|
+
});
|
|
6039
|
+
}
|
|
6040
|
+
});
|
|
6041
|
+
}
|
|
6042
|
+
}
|
|
6043
|
+
});
|
|
6010
6044
|
}
|
|
6011
|
-
return
|
|
6045
|
+
return actionPayloads;
|
|
6012
6046
|
};
|
|
6013
6047
|
/**
|
|
6014
|
-
*
|
|
6015
|
-
* @param
|
|
6016
|
-
* @param
|
|
6048
|
+
* These targets are found for layer actions that work with a layerId like: SetLayerName, SetLayerEnabled, SetLayerOpacity, SetLayerDimension and SetLayerStyle
|
|
6049
|
+
* @param state
|
|
6050
|
+
* @param payload
|
|
6051
|
+
* @param actionType
|
|
6052
|
+
* @returns
|
|
6017
6053
|
*/
|
|
6018
|
-
var
|
|
6019
|
-
|
|
6054
|
+
var getLayerActionsTargets = function getLayerActionsTargets(state, payload, actionType) {
|
|
6055
|
+
var mapId = getMapIdFromLayerId(state, payload.layerId);
|
|
6056
|
+
if (!mapId) {
|
|
6057
|
+
return [];
|
|
6058
|
+
}
|
|
6059
|
+
var foundTargets = findTargets(state, payload, actionType, mapId);
|
|
6060
|
+
return foundTargets.map(function (target) {
|
|
6061
|
+
var payload = target.payload;
|
|
6062
|
+
return Object.assign({}, payload, {
|
|
6063
|
+
layerId: target.layerId,
|
|
6064
|
+
origin: SyncGroupActionOrigin.layerActions,
|
|
6065
|
+
mapId: payload.mapId
|
|
6066
|
+
});
|
|
6067
|
+
});
|
|
6020
6068
|
};
|
|
6021
6069
|
/**
|
|
6022
|
-
*
|
|
6023
|
-
* @param
|
|
6070
|
+
* These targets are found for the layer/map action AddLayer. AddLayer does not have a layerId (because it's new)
|
|
6071
|
+
* @param state
|
|
6072
|
+
* @param payload
|
|
6073
|
+
* @param actionType
|
|
6024
6074
|
* @returns
|
|
6025
6075
|
*/
|
|
6026
|
-
var
|
|
6027
|
-
|
|
6076
|
+
var getAddLayerActionsTargets = function getAddLayerActionsTargets(state, payload, actionType) {
|
|
6077
|
+
var foundTargets = findTargets(state, payload, actionType, payload.mapId);
|
|
6078
|
+
return foundTargets.map(function (_ref) {
|
|
6079
|
+
var payload = _ref.payload,
|
|
6080
|
+
targetId = _ref.targetId;
|
|
6081
|
+
var layer = payload.layer;
|
|
6082
|
+
layer.id;
|
|
6083
|
+
var layerWithoutId = _objectWithoutPropertiesLoose(layer, _excluded$1);
|
|
6084
|
+
var layerId = webmapUtils.generateLayerId();
|
|
6085
|
+
return Object.assign({}, payload, {
|
|
6086
|
+
layer: layerWithoutId,
|
|
6087
|
+
layerId: layerId,
|
|
6088
|
+
mapId: targetId,
|
|
6089
|
+
origin: SyncGroupActionOrigin.add
|
|
6090
|
+
});
|
|
6091
|
+
});
|
|
6028
6092
|
};
|
|
6029
|
-
var MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH = 2;
|
|
6030
|
-
var MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES = 8;
|
|
6031
6093
|
/**
|
|
6032
|
-
*
|
|
6033
|
-
* @param
|
|
6034
|
-
* @param
|
|
6035
|
-
* @param
|
|
6036
|
-
* @returns
|
|
6094
|
+
* These targets are found for the layer/map action DeleteLayer. The layer is already gone, so there is no layerId anymore. Using layerIndex instead.
|
|
6095
|
+
* @param state
|
|
6096
|
+
* @param payload
|
|
6097
|
+
* @param actionType
|
|
6098
|
+
* @returns
|
|
6037
6099
|
*/
|
|
6038
|
-
var
|
|
6039
|
-
var
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
var wmMap = getWMJSMapById(targetMapId);
|
|
6048
|
-
if (!wmMap) {
|
|
6049
|
-
return true; // Map was not registered so there is nothing to prefetch, do not block going forward
|
|
6050
|
-
}
|
|
6051
|
-
var layersImageUrls = getWMSRequests(wmMap, [{
|
|
6052
|
-
name: 'time',
|
|
6053
|
-
currentValue: nextTimeValueStepToCheck
|
|
6054
|
-
}]);
|
|
6055
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(layersImageUrls), _step2; !(_step2 = _iterator2()).done;) {
|
|
6056
|
-
var layersImageUrl = _step2.value;
|
|
6057
|
-
var image = wmMap.getMapImageStore.getImage(layersImageUrl.url);
|
|
6058
|
-
if (!image.isLoaded()) {
|
|
6059
|
-
if (wmMap.getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
|
|
6060
|
-
image.load();
|
|
6061
|
-
}
|
|
6062
|
-
if (numPrefetch === 0) {
|
|
6063
|
-
var altImage = wmMap.getAlternativeImage(layersImageUrl.url, wmMap.getBBOX(), true);
|
|
6064
|
-
// No alternative image available yet, so skipping animation.
|
|
6065
|
-
if (altImage.length === 0) {
|
|
6066
|
-
// This is useful to indicate that the map is loading and has nothing yet to display.
|
|
6067
|
-
// console.warn('No data available: Not stepping forward');
|
|
6068
|
-
timerShouldStepForward = false;
|
|
6069
|
-
}
|
|
6070
|
-
}
|
|
6071
|
-
} else if (image.isStale()) {
|
|
6072
|
-
if (wmMap.getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
|
|
6073
|
-
image.forceReload(true);
|
|
6074
|
-
}
|
|
6075
|
-
}
|
|
6076
|
-
}
|
|
6077
|
-
}
|
|
6078
|
-
}
|
|
6079
|
-
return timerShouldStepForward;
|
|
6100
|
+
var getLayerDeleteActionsTargets = function getLayerDeleteActionsTargets(state, payload, actionType) {
|
|
6101
|
+
var foundTargets = findTargets(state, payload, actionType, payload.mapId);
|
|
6102
|
+
return foundTargets.map(function (target) {
|
|
6103
|
+
return Object.assign({}, target.payload, {
|
|
6104
|
+
mapId: target.targetId,
|
|
6105
|
+
layerId: target.layerId,
|
|
6106
|
+
origin: SyncGroupActionOrigin["delete"]
|
|
6107
|
+
});
|
|
6108
|
+
});
|
|
6080
6109
|
};
|
|
6081
|
-
|
|
6082
6110
|
/**
|
|
6083
|
-
*
|
|
6084
|
-
*
|
|
6085
|
-
*
|
|
6086
|
-
* @param
|
|
6087
|
-
* @
|
|
6111
|
+
* These targets are found for the layer/map action MoveLayer. Here layers are referenced by newIndex and oldIndex.
|
|
6112
|
+
* @param state
|
|
6113
|
+
* @param payload
|
|
6114
|
+
* @param actionType
|
|
6115
|
+
* @returns
|
|
6088
6116
|
*/
|
|
6089
|
-
var
|
|
6090
|
-
var
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
return nameAndValue.value;
|
|
6117
|
+
var getLayerMoveActionsTargets = function getLayerMoveActionsTargets(state, payload, actionType) {
|
|
6118
|
+
var foundTargets = findTargets(state, payload, actionType, payload.mapId);
|
|
6119
|
+
return foundTargets.map(function (target) {
|
|
6120
|
+
return Object.assign({}, target.payload, {
|
|
6121
|
+
mapId: target.targetId,
|
|
6122
|
+
origin: SyncGroupActionOrigin.move
|
|
6096
6123
|
});
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6124
|
+
});
|
|
6125
|
+
};
|
|
6126
|
+
/**
|
|
6127
|
+
* These targets are found for the map action SetAutoLayerId. It needs both a target mapId and layerId
|
|
6128
|
+
* @param state
|
|
6129
|
+
* @param payload
|
|
6130
|
+
* @param actionType
|
|
6131
|
+
* @returns
|
|
6132
|
+
*/
|
|
6133
|
+
var getSetAutoLayerIdActionsTargets = function getSetAutoLayerIdActionsTargets(state, payload, actionType) {
|
|
6134
|
+
var payloadWithLayerId = Object.assign({}, payload, {
|
|
6135
|
+
layerId: payload.autoUpdateLayerId || payload.autoTimeStepLayerId || payload.layerId
|
|
6136
|
+
});
|
|
6137
|
+
var foundTargets = findTargets(state, payloadWithLayerId, actionType, payload.mapId);
|
|
6138
|
+
return foundTargets.map(function (target) {
|
|
6139
|
+
return {
|
|
6140
|
+
mapId: target.targetId,
|
|
6141
|
+
layerId: target.layerId,
|
|
6142
|
+
origin: SyncGroupActionOrigin.autoLayerId
|
|
6143
|
+
};
|
|
6144
|
+
});
|
|
6145
|
+
};
|
|
6146
|
+
/**
|
|
6147
|
+
* These targets are found for baselayer actions that work with a mapId like: setBaseLayers
|
|
6148
|
+
* @param state
|
|
6149
|
+
* @param payload
|
|
6150
|
+
* @param actionType
|
|
6151
|
+
* @returns
|
|
6152
|
+
*/
|
|
6153
|
+
var getMapBaseLayerActionsTargets = function getMapBaseLayerActionsTargets(state, payload, actionType) {
|
|
6154
|
+
var foundTargets = findTargets(state, payload, actionType, payload.mapId);
|
|
6155
|
+
return foundTargets.map(function (target) {
|
|
6156
|
+
return {
|
|
6157
|
+
layers: payload.layers.map(function (layer) {
|
|
6158
|
+
return Object.assign({}, layer, {
|
|
6159
|
+
id: webmapUtils.generateLayerId()
|
|
6160
|
+
});
|
|
6161
|
+
}),
|
|
6162
|
+
mapId: target.targetId,
|
|
6163
|
+
origin: SyncGroupActionOrigin.layerActions
|
|
6164
|
+
};
|
|
6165
|
+
});
|
|
6130
6166
|
};
|
|
6131
|
-
var metronomeListener = createListenerMiddleware();
|
|
6132
|
-
metronomeListener.startListening({
|
|
6133
|
-
actionCreator: mapActions.mapStartAnimation,
|
|
6134
|
-
effect: function () {
|
|
6135
|
-
var _effect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_, listenerApi) {
|
|
6136
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6137
|
-
while (1) switch (_context.prev = _context.next) {
|
|
6138
|
-
case 0:
|
|
6139
|
-
// register handler with access to listenerApi
|
|
6140
|
-
metronome.handleTimerTicks = function (timerIds) {
|
|
6141
|
-
metronomeHandler(timerIds, listenerApi);
|
|
6142
|
-
};
|
|
6143
|
-
case 1:
|
|
6144
|
-
case "end":
|
|
6145
|
-
return _context.stop();
|
|
6146
|
-
}
|
|
6147
|
-
}, _callee);
|
|
6148
|
-
}));
|
|
6149
|
-
function effect(_x, _x2) {
|
|
6150
|
-
return _effect.apply(this, arguments);
|
|
6151
|
-
}
|
|
6152
|
-
return effect;
|
|
6153
|
-
}()
|
|
6154
|
-
});
|
|
6155
6167
|
|
|
6156
|
-
var
|
|
6157
|
-
|
|
6158
|
-
|
|
6168
|
+
var 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$/;
|
|
6169
|
+
var genericListener = createListenerMiddleware();
|
|
6170
|
+
genericListener.startListening({
|
|
6171
|
+
actionCreator: setTime,
|
|
6159
6172
|
effect: function () {
|
|
6160
6173
|
var _effect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, listenerApi) {
|
|
6161
|
-
var payload,
|
|
6174
|
+
var payload, value, origin, targets, groups;
|
|
6162
6175
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6163
6176
|
while (1) switch (_context.prev = _context.next) {
|
|
6164
6177
|
case 0:
|
|
6165
6178
|
payload = _ref.payload;
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
if (
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
}));
|
|
6179
|
+
listenerApi.cancelActiveListeners();
|
|
6180
|
+
value = payload.value, origin = payload.origin;
|
|
6181
|
+
/* Test if the value is according to the expected time format */
|
|
6182
|
+
if (!setTimeValidatorRexexp.test(value)) {
|
|
6183
|
+
console.error("setTime value " + value + " does not conform to format [YYYY-MM-DDThh:mm:ssZ]. It was triggered by " + origin);
|
|
6184
|
+
} else {
|
|
6185
|
+
targets = getTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETTIME);
|
|
6186
|
+
groups = getTargetGroups(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETTIME);
|
|
6187
|
+
listenerApi.dispatch(setTimeSync(payload, targets, groups));
|
|
6176
6188
|
}
|
|
6177
|
-
case
|
|
6189
|
+
case 4:
|
|
6178
6190
|
case "end":
|
|
6179
6191
|
return _context.stop();
|
|
6180
6192
|
}
|
|
@@ -6186,23 +6198,20 @@ layersListener.startListening({
|
|
|
6186
6198
|
return effect;
|
|
6187
6199
|
}()
|
|
6188
6200
|
});
|
|
6189
|
-
|
|
6190
|
-
actionCreator:
|
|
6201
|
+
genericListener.startListening({
|
|
6202
|
+
actionCreator: setBbox,
|
|
6191
6203
|
effect: function () {
|
|
6192
6204
|
var _effect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2, listenerApi) {
|
|
6193
|
-
var payload,
|
|
6205
|
+
var payload, targets, groups;
|
|
6194
6206
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
6195
6207
|
while (1) switch (_context2.prev = _context2.next) {
|
|
6196
6208
|
case 0:
|
|
6197
6209
|
payload = _ref2.payload;
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
}
|
|
6204
|
-
}
|
|
6205
|
-
case 3:
|
|
6210
|
+
listenerApi.cancelActiveListeners();
|
|
6211
|
+
targets = getTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETBBOX);
|
|
6212
|
+
groups = getTargetGroups(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETBBOX);
|
|
6213
|
+
listenerApi.dispatch(setBboxSync(payload, targets, groups));
|
|
6214
|
+
case 5:
|
|
6206
6215
|
case "end":
|
|
6207
6216
|
return _context2.stop();
|
|
6208
6217
|
}
|
|
@@ -6214,1166 +6223,1042 @@ layersListener.startListening({
|
|
|
6214
6223
|
return effect;
|
|
6215
6224
|
}()
|
|
6216
6225
|
});
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
var hasValidPrefix = animationEndTime.split(/[-+]/)[0] === 'NOW' || animationEndTime.split(/[-+]/)[0] === 'TODAY';
|
|
6220
|
-
var durationString = animationEndTime.substring(animationEndTime.indexOf('PT') + 2);
|
|
6221
|
-
var hasValidDate = /^(\d+H)?(\d+M)?$/.test(durationString);
|
|
6222
|
-
if (hasValidPrefix && hasValidDate) {
|
|
6223
|
-
return true;
|
|
6224
|
-
}
|
|
6225
|
-
var parsedDate = dateUtils.parseISO(animationEndTime);
|
|
6226
|
-
return dateUtils.isValid(parsedDate);
|
|
6227
|
-
};
|
|
6228
|
-
var mapListener = createListenerMiddleware();
|
|
6229
|
-
mapListener.startListening({
|
|
6230
|
-
actionCreator: layerActions.layerDelete,
|
|
6231
|
-
effect: function effect(_ref, listenerApi) {
|
|
6232
|
-
var payload = _ref.payload;
|
|
6233
|
-
var mapId = payload.mapId;
|
|
6234
|
-
var layers = getMapLayersWithoutDimensionCurrentValue(listenerApi.getState(), mapId);
|
|
6235
|
-
if (!layers.length) {
|
|
6236
|
-
listenerApi.dispatch(mapActions.mapStopAnimation({
|
|
6237
|
-
mapId: mapId
|
|
6238
|
-
}));
|
|
6239
|
-
}
|
|
6240
|
-
}
|
|
6241
|
-
});
|
|
6242
|
-
// update layer, synced maps and animation on latest max time if autoupdating
|
|
6243
|
-
mapListener.startListening({
|
|
6244
|
-
actionCreator: layerActions.onUpdateLayerInformation,
|
|
6245
|
-
effect: function effect(_ref2, listenerApi) {
|
|
6246
|
-
var payload = _ref2.payload;
|
|
6247
|
-
try {
|
|
6248
|
-
var layerDimensions = payload.layerDimensions;
|
|
6249
|
-
if (!layerDimensions) {
|
|
6250
|
-
return;
|
|
6251
|
-
}
|
|
6252
|
-
var dimensions = layerDimensions.dimensions,
|
|
6253
|
-
layerId = layerDimensions.layerId;
|
|
6254
|
-
var layer = getLayerById(listenerApi.getState(), layerId);
|
|
6255
|
-
if (!layer) {
|
|
6256
|
-
return;
|
|
6257
|
-
}
|
|
6258
|
-
var newTimeDimension = dimensions.find(function (dimension) {
|
|
6259
|
-
return dimension.name === 'time';
|
|
6260
|
-
});
|
|
6261
|
-
var mapId = layer.mapId;
|
|
6262
|
-
if (!mapId) {
|
|
6263
|
-
return;
|
|
6264
|
-
}
|
|
6265
|
-
var autoUpdateLayerId = getAutoUpdateLayerId(listenerApi.getState(), mapId);
|
|
6266
|
-
var shouldAutoUpdate = isAutoUpdating(listenerApi.getState(), mapId);
|
|
6267
|
-
var prevTimeDimension = getLayerTimeDimension(listenerApi.getState(), layerId);
|
|
6268
|
-
var isAutoUpdateLayer = layerId === autoUpdateLayerId;
|
|
6269
|
-
var incomingMaxTime = newTimeDimension == null ? void 0 : newTimeDimension.maxValue;
|
|
6270
|
-
var isIncomingMaxTimeLaterThanCurrentLayerTime = incomingMaxTime && (prevTimeDimension == null ? void 0 : prevTimeDimension.currentValue) && prevTimeDimension.currentValue !== incomingMaxTime;
|
|
6271
|
-
if (isAutoUpdateLayer &&
|
|
6272
|
-
// only update the active layer
|
|
6273
|
-
shouldAutoUpdate && isIncomingMaxTimeLaterThanCurrentLayerTime) {
|
|
6274
|
-
var isMapAnimating = isAnimating(listenerApi.getState(), mapId);
|
|
6275
|
-
if (!isMapAnimating) {
|
|
6276
|
-
listenerApi.dispatch(layerActions.layerChangeDimension({
|
|
6277
|
-
layerId: layerId,
|
|
6278
|
-
origin: LayerActionOrigin.updateLayerInformationListener,
|
|
6279
|
-
dimension: {
|
|
6280
|
-
name: 'time',
|
|
6281
|
-
currentValue: incomingMaxTime
|
|
6282
|
-
}
|
|
6283
|
-
}));
|
|
6284
|
-
// Each time a layer updates, set the new time for all synced timesliders
|
|
6285
|
-
var syncedMapIds = getSyncedMapIdsForTimeslider(listenerApi.getState());
|
|
6286
|
-
if (syncedMapIds) {
|
|
6287
|
-
// Change time value for all other timesliders
|
|
6288
|
-
syncedMapIds.map(function (syncedMapId) {
|
|
6289
|
-
return listenerApi.dispatch(setTime({
|
|
6290
|
-
origin: LayerActionOrigin.updateLayerInformationListener,
|
|
6291
|
-
sourceId: syncedMapId,
|
|
6292
|
-
value: incomingMaxTime
|
|
6293
|
-
}));
|
|
6294
|
-
});
|
|
6295
|
-
}
|
|
6296
|
-
}
|
|
6297
|
-
updateAnimation(mapId, incomingMaxTime, listenerApi);
|
|
6298
|
-
}
|
|
6299
|
-
} catch (error) {
|
|
6300
|
-
// eslint-disable-next-line no-console
|
|
6301
|
-
console.warn(error);
|
|
6302
|
-
}
|
|
6303
|
-
}
|
|
6304
|
-
});
|
|
6305
|
-
var updateAnimation = function updateAnimation(mapId, maxValue, listenerApi) {
|
|
6306
|
-
var shouldEndtimeOverride$1 = shouldEndtimeOverride(listenerApi.getState(), mapId);
|
|
6307
|
-
if (shouldEndtimeOverride$1 === true) {
|
|
6308
|
-
return;
|
|
6309
|
-
}
|
|
6310
|
-
var animationStart = getAnimationStartTime(listenerApi.getState(), mapId);
|
|
6311
|
-
// Calculate how much time the animation start need to move forwards
|
|
6312
|
-
var animationEnd = getAnimationEndTime(listenerApi.getState(), mapId);
|
|
6313
|
-
var animationEndUnix = dateUtils.unix(dateUtils.utc(animationEnd));
|
|
6314
|
-
var maxTimeAsUnix = dateUtils.unix(dateUtils.utc(maxValue));
|
|
6315
|
-
var timeInSecondToShiftAnimationForwards = maxTimeAsUnix - animationEndUnix;
|
|
6316
|
-
var animationStartUnix = dateUtils.unix(dateUtils.utc(animationStart));
|
|
6317
|
-
var newAnimationStartTime = dateUtils.dateToString(dateUtils.fromUnix(animationStartUnix + timeInSecondToShiftAnimationForwards), dateFormat);
|
|
6318
|
-
var newAnimationEndTime = dateUtils.dateToString(dateUtils.fromUnix(animationEndUnix + timeInSecondToShiftAnimationForwards), dateFormat);
|
|
6319
|
-
if (!newAnimationStartTime || !newAnimationEndTime) {
|
|
6320
|
-
return;
|
|
6321
|
-
}
|
|
6322
|
-
listenerApi.dispatch(mapActions.setAnimationEndTime({
|
|
6323
|
-
mapId: mapId,
|
|
6324
|
-
animationEndTime: newAnimationEndTime
|
|
6325
|
-
}));
|
|
6326
|
-
listenerApi.dispatch(mapActions.setAnimationStartTime({
|
|
6327
|
-
mapId: mapId,
|
|
6328
|
-
animationStartTime: newAnimationStartTime
|
|
6329
|
-
}));
|
|
6330
|
-
};
|
|
6331
|
-
mapListener.startListening({
|
|
6332
|
-
actionCreator: mapActions.toggleAutoUpdate,
|
|
6226
|
+
genericListener.startListening({
|
|
6227
|
+
matcher: isAnyOf(layerActions.layerChangeName, layerActions.layerChangeEnabled, layerActions.layerChangeOpacity, layerActions.layerChangeDimension, layerActions.layerChangeStyle),
|
|
6333
6228
|
effect: function () {
|
|
6334
|
-
var
|
|
6335
|
-
var payload,
|
|
6336
|
-
return _regeneratorRuntime().wrap(function
|
|
6337
|
-
while (1) switch (
|
|
6229
|
+
var _effect3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref3, listenerApi) {
|
|
6230
|
+
var payload, type, targets;
|
|
6231
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
6232
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
6338
6233
|
case 0:
|
|
6339
|
-
payload = _ref3.payload;
|
|
6234
|
+
payload = _ref3.payload, type = _ref3.type;
|
|
6340
6235
|
listenerApi.cancelActiveListeners();
|
|
6341
|
-
|
|
6342
|
-
if (
|
|
6343
|
-
|
|
6236
|
+
/* Should not listen to actions from itself */
|
|
6237
|
+
if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
|
|
6238
|
+
_context3.next = 4;
|
|
6344
6239
|
break;
|
|
6345
6240
|
}
|
|
6346
|
-
return
|
|
6347
|
-
case
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
syncedMapIds = getSyncedMapIdsForTimeslider(listenerApi.getState()); // go to end of active layer
|
|
6352
|
-
if (timeDimension != null && timeDimension.maxValue && autoUpdateLayerId) {
|
|
6353
|
-
listenerApi.dispatch(layerActions.layerChangeDimension({
|
|
6354
|
-
layerId: autoUpdateLayerId,
|
|
6355
|
-
origin: LayerActionOrigin.toggleAutoUpdateListener,
|
|
6356
|
-
dimension: {
|
|
6357
|
-
name: 'time',
|
|
6358
|
-
currentValue: timeDimension.maxValue
|
|
6359
|
-
}
|
|
6360
|
-
}));
|
|
6361
|
-
// Change time value for all timesliders that are synced by syncgroups
|
|
6362
|
-
if (syncedMapIds.length > 0) {
|
|
6363
|
-
syncedMapIds.map(function (syncedMapId) {
|
|
6364
|
-
return listenerApi.dispatch(setTime({
|
|
6365
|
-
origin: LayerActionOrigin.toggleAutoUpdateListener,
|
|
6366
|
-
sourceId: syncedMapId,
|
|
6367
|
-
value: timeDimension.maxValue
|
|
6368
|
-
}));
|
|
6369
|
-
});
|
|
6370
|
-
}
|
|
6371
|
-
updateAnimation(mapId, timeDimension.maxValue, listenerApi);
|
|
6372
|
-
}
|
|
6373
|
-
// Toggle autoupdate off for synced timesliders
|
|
6374
|
-
payloads = syncedMapIds.reduce(function (syncedMapIdList, syncedMapId) {
|
|
6375
|
-
if (syncedMapId !== mapId) {
|
|
6376
|
-
return syncedMapIdList.concat({
|
|
6377
|
-
mapId: syncedMapId,
|
|
6378
|
-
shouldAutoUpdate: false
|
|
6379
|
-
});
|
|
6380
|
-
}
|
|
6381
|
-
return syncedMapIdList;
|
|
6382
|
-
}, []);
|
|
6383
|
-
if (payloads.length > 0) {
|
|
6384
|
-
payloads.map(function (payload) {
|
|
6385
|
-
return listenerApi.dispatch(mapActions.toggleAutoUpdate(payload));
|
|
6386
|
-
});
|
|
6387
|
-
}
|
|
6388
|
-
} catch (error) {
|
|
6389
|
-
// eslint-disable-next-line no-console
|
|
6390
|
-
console.warn(error);
|
|
6241
|
+
return _context3.abrupt("return");
|
|
6242
|
+
case 4:
|
|
6243
|
+
targets = getLayerActionsTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
6244
|
+
if (targets && targets.length > 0) {
|
|
6245
|
+
listenerApi.dispatch(setLayerActionSync(payload, targets, type));
|
|
6391
6246
|
}
|
|
6392
6247
|
case 6:
|
|
6393
6248
|
case "end":
|
|
6394
|
-
return
|
|
6249
|
+
return _context3.stop();
|
|
6395
6250
|
}
|
|
6396
|
-
},
|
|
6251
|
+
}, _callee3);
|
|
6397
6252
|
}));
|
|
6398
|
-
function effect(
|
|
6399
|
-
return
|
|
6253
|
+
function effect(_x5, _x6) {
|
|
6254
|
+
return _effect3.apply(this, arguments);
|
|
6400
6255
|
}
|
|
6401
6256
|
return effect;
|
|
6402
6257
|
}()
|
|
6403
6258
|
});
|
|
6404
|
-
|
|
6405
|
-
actionCreator:
|
|
6406
|
-
effect: function effect(_ref4, listenerApi) {
|
|
6407
|
-
var payload = _ref4.payload;
|
|
6408
|
-
var mapId = payload.mapId,
|
|
6409
|
-
initialTime = payload.initialTime;
|
|
6410
|
-
var speedDelay = getMapAnimationDelay(listenerApi.getState(), mapId);
|
|
6411
|
-
var speed = 1000 / (speedDelay || 1);
|
|
6412
|
-
metronome.register(null, speed, mapId);
|
|
6413
|
-
var timeList = getAnimationList(listenerApi.getState(), mapId);
|
|
6414
|
-
// In case of the timeList
|
|
6415
|
-
if (timeList && timeList.length > 0) {
|
|
6416
|
-
// Determine animation step based on initialTime and timeList
|
|
6417
|
-
var initalTimerStep = timeList == null ? void 0 : timeList.findIndex(function (timeNameValue) {
|
|
6418
|
-
return timeNameValue.value === initialTime;
|
|
6419
|
-
});
|
|
6420
|
-
if (initalTimerStep !== -1) {
|
|
6421
|
-
setStep(mapId, initalTimerStep);
|
|
6422
|
-
}
|
|
6423
|
-
}
|
|
6424
|
-
}
|
|
6425
|
-
});
|
|
6426
|
-
mapListener.startListening({
|
|
6427
|
-
actionCreator: mapActions.mapStopAnimation,
|
|
6428
|
-
effect: function effect(_ref5) {
|
|
6429
|
-
var payload = _ref5.payload;
|
|
6430
|
-
var mapId = payload.mapId;
|
|
6431
|
-
metronome.unregister(mapId);
|
|
6432
|
-
}
|
|
6433
|
-
});
|
|
6434
|
-
var handleBaseLayers = function handleBaseLayers(mapId, baseLayers, listenerApi) {
|
|
6435
|
-
var baseLayer = baseLayers.find(function (layer) {
|
|
6436
|
-
return layer.layerType === 'baseLayer';
|
|
6437
|
-
});
|
|
6438
|
-
var currentAvailableBaseLayers = getAvailableBaseLayersForMap(listenerApi.getState(), mapId);
|
|
6439
|
-
// find a availableBaseLayer with the same name, and use that id for the active baselayer
|
|
6440
|
-
var activeAvailableBaseLayer = currentAvailableBaseLayers.find(function (availableBaseLayer) {
|
|
6441
|
-
return availableBaseLayer.name === baseLayer.name;
|
|
6442
|
-
});
|
|
6443
|
-
var activeBaseLayerId = activeAvailableBaseLayer ? activeAvailableBaseLayer.id : webmapUtils.generateLayerId();
|
|
6444
|
-
// if the baseLayer can't be found in a visible available baseLayer list, add it
|
|
6445
|
-
// This happens when switching to a preset that has non-default baselayers
|
|
6446
|
-
if (!activeAvailableBaseLayer && currentAvailableBaseLayers.length) {
|
|
6447
|
-
listenerApi.dispatch(layerActions.addAvailableBaseLayers({
|
|
6448
|
-
layers: [Object.assign({}, baseLayer, {
|
|
6449
|
-
mapId: mapId,
|
|
6450
|
-
id: activeBaseLayerId
|
|
6451
|
-
})]
|
|
6452
|
-
}));
|
|
6453
|
-
}
|
|
6454
|
-
var baseLayersWithActiveId = baseLayers.map(function (layer, index) {
|
|
6455
|
-
return index === 0 ? Object.assign({}, layer, {
|
|
6456
|
-
id: activeBaseLayerId || layer.id
|
|
6457
|
-
}) : layer;
|
|
6458
|
-
});
|
|
6459
|
-
listenerApi.dispatch(layerActions.setBaseLayers({
|
|
6460
|
-
mapId: mapId,
|
|
6461
|
-
layers: baseLayersWithActiveId
|
|
6462
|
-
}));
|
|
6463
|
-
};
|
|
6464
|
-
mapListener.startListening({
|
|
6465
|
-
actionCreator: mapActions.setMapPreset,
|
|
6259
|
+
genericListener.startListening({
|
|
6260
|
+
actionCreator: layerActions.addLayer,
|
|
6466
6261
|
effect: function () {
|
|
6467
|
-
var
|
|
6468
|
-
var payload,
|
|
6469
|
-
return _regeneratorRuntime().wrap(function
|
|
6470
|
-
while (1) switch (
|
|
6262
|
+
var _effect4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref4, listenerApi) {
|
|
6263
|
+
var payload, type, targets;
|
|
6264
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
6265
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
6471
6266
|
case 0:
|
|
6472
|
-
payload =
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
_context2.next = 50;
|
|
6267
|
+
payload = _ref4.payload, type = _ref4.type;
|
|
6268
|
+
listenerApi.cancelActiveListeners();
|
|
6269
|
+
/* Should not listen to actions from itself */
|
|
6270
|
+
if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
|
|
6271
|
+
_context4.next = 4;
|
|
6478
6272
|
break;
|
|
6479
6273
|
}
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
autoUpdateLayerIdNew = autoUpdateLayerId;
|
|
6486
|
-
onlyActiveLayerIdIsSet = !autoTimeStepLayerId && !autoUpdateLayerId && activeLayerId;
|
|
6487
|
-
if (onlyActiveLayerIdIsSet) {
|
|
6488
|
-
autoTimeStepLayerIdNew = activeLayerId;
|
|
6489
|
-
autoUpdateLayerIdNew = activeLayerId;
|
|
6490
|
-
}
|
|
6491
|
-
newLayerIds = replaceLayerIdsToEnsureUniqueLayerIdsInStore({
|
|
6492
|
-
layers: mapLayers,
|
|
6493
|
-
autoTimeStepLayerId: autoTimeStepLayerIdNew,
|
|
6494
|
-
autoUpdateLayerId: autoUpdateLayerIdNew
|
|
6495
|
-
}); // set layers
|
|
6496
|
-
listenerApi.dispatch(layerActions.setLayers({
|
|
6497
|
-
mapId: mapId,
|
|
6498
|
-
layers: newLayerIds.layers
|
|
6499
|
-
}));
|
|
6500
|
-
// make sure layer with new id exist and if not, default to first layer
|
|
6501
|
-
newAutoUpdateLayerId = ((_newLayerIds$layers$f = newLayerIds.layers.find(function (layer) {
|
|
6502
|
-
return layer.id === newLayerIds.autoUpdateLayerId;
|
|
6503
|
-
})) == null ? void 0 : _newLayerIds$layers$f.id) || ((_newLayerIds$layers$ = newLayerIds.layers[0]) == null ? void 0 : _newLayerIds$layers$.id);
|
|
6504
|
-
newAutoTimeStepLayerId = ((_newLayerIds$layers$f2 = newLayerIds.layers.find(function (layer) {
|
|
6505
|
-
return layer.id === newLayerIds.autoTimeStepLayerId;
|
|
6506
|
-
})) == null ? void 0 : _newLayerIds$layers$f2.id) || ((_newLayerIds$layers$2 = newLayerIds.layers[0]) == null ? void 0 : _newLayerIds$layers$2.id);
|
|
6507
|
-
listenerApi.dispatch(mapActions.setAutoLayerId({
|
|
6508
|
-
mapId: mapId,
|
|
6509
|
-
autoUpdateLayerId: newAutoUpdateLayerId,
|
|
6510
|
-
autoTimeStepLayerId: newAutoTimeStepLayerId
|
|
6511
|
-
}));
|
|
6274
|
+
return _context4.abrupt("return");
|
|
6275
|
+
case 4:
|
|
6276
|
+
targets = getAddLayerActionsTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
6277
|
+
if (targets && targets.length > 0) {
|
|
6278
|
+
listenerApi.dispatch(setLayerActionSync(payload, targets, type));
|
|
6512
6279
|
}
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6280
|
+
case 6:
|
|
6281
|
+
case "end":
|
|
6282
|
+
return _context4.stop();
|
|
6283
|
+
}
|
|
6284
|
+
}, _callee4);
|
|
6285
|
+
}));
|
|
6286
|
+
function effect(_x7, _x8) {
|
|
6287
|
+
return _effect4.apply(this, arguments);
|
|
6288
|
+
}
|
|
6289
|
+
return effect;
|
|
6290
|
+
}()
|
|
6291
|
+
});
|
|
6292
|
+
genericListener.startListening({
|
|
6293
|
+
actionCreator: layerActions.duplicateMapLayer,
|
|
6294
|
+
effect: function () {
|
|
6295
|
+
var _effect5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref5, listenerApi) {
|
|
6296
|
+
var payload, sourceLayer, newPayload, targets;
|
|
6297
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
6298
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
6299
|
+
case 0:
|
|
6300
|
+
payload = _ref5.payload;
|
|
6301
|
+
listenerApi.cancelActiveListeners();
|
|
6302
|
+
sourceLayer = getLayerById(listenerApi.getState(), payload.oldLayerId);
|
|
6303
|
+
newPayload = {
|
|
6304
|
+
mapId: payload.mapId,
|
|
6305
|
+
layer: sourceLayer,
|
|
6306
|
+
origin: payload.origin
|
|
6307
|
+
};
|
|
6308
|
+
targets = getAddLayerActionsTargets(listenerApi.getState(), newPayload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
6309
|
+
if (targets && targets.length > 0) {
|
|
6310
|
+
listenerApi.dispatch(setLayerActionSync(newPayload, targets, layerActions.addLayer.type));
|
|
6531
6311
|
}
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6312
|
+
case 6:
|
|
6313
|
+
case "end":
|
|
6314
|
+
return _context5.stop();
|
|
6315
|
+
}
|
|
6316
|
+
}, _callee5);
|
|
6317
|
+
}));
|
|
6318
|
+
function effect(_x9, _x10) {
|
|
6319
|
+
return _effect5.apply(this, arguments);
|
|
6320
|
+
}
|
|
6321
|
+
return effect;
|
|
6322
|
+
}()
|
|
6323
|
+
});
|
|
6324
|
+
genericListener.startListening({
|
|
6325
|
+
actionCreator: mapActions.layerMoveLayer,
|
|
6326
|
+
effect: function () {
|
|
6327
|
+
var _effect6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref6, listenerApi) {
|
|
6328
|
+
var payload, type, targets;
|
|
6329
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
6330
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
6331
|
+
case 0:
|
|
6332
|
+
payload = _ref6.payload, type = _ref6.type;
|
|
6333
|
+
listenerApi.cancelActiveListeners();
|
|
6334
|
+
/* Should not listen to actions from itself */
|
|
6335
|
+
if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
|
|
6336
|
+
_context6.next = 4;
|
|
6535
6337
|
break;
|
|
6536
6338
|
}
|
|
6537
|
-
|
|
6538
|
-
case
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
bbox: proj.bbox,
|
|
6543
|
-
srs: proj.srs
|
|
6544
|
-
}));
|
|
6545
|
-
case 20:
|
|
6546
|
-
animationLength = animationPayload && animationPayload.duration;
|
|
6547
|
-
animationEndTime = animationPayload && animationPayload.endTime && isAnimationEndTimeValid(animationPayload.endTime) && animationPayload.endTime;
|
|
6548
|
-
shouldEndtimeOverride = animationPayload ? animationPayload.shouldEndtimeOverride : false;
|
|
6549
|
-
if (shouldEndtimeOverride) {
|
|
6550
|
-
// auto update
|
|
6551
|
-
listenerApi.dispatch(mapActions.setEndTimeOverriding({
|
|
6552
|
-
mapId: mapId,
|
|
6553
|
-
shouldEndtimeOverride: shouldEndtimeOverride
|
|
6554
|
-
}));
|
|
6555
|
-
}
|
|
6556
|
-
if (shouldAutoUpdate !== undefined && !animationEndTime) {
|
|
6557
|
-
// auto update
|
|
6558
|
-
listenerApi.dispatch(mapActions.toggleAutoUpdate({
|
|
6559
|
-
mapId: mapId,
|
|
6560
|
-
shouldAutoUpdate: shouldAutoUpdate
|
|
6561
|
-
}));
|
|
6562
|
-
}
|
|
6563
|
-
if (showTimeSlider !== undefined) {
|
|
6564
|
-
// toggle timeslider
|
|
6565
|
-
listenerApi.dispatch(mapActions.toggleTimeSliderIsVisible({
|
|
6566
|
-
mapId: mapId,
|
|
6567
|
-
isTimeSliderVisible: showTimeSlider
|
|
6568
|
-
}));
|
|
6569
|
-
}
|
|
6570
|
-
if (timeSliderSpan !== undefined) {
|
|
6571
|
-
// set timeslider span
|
|
6572
|
-
listenerApi.dispatch(mapActions.setTimeSliderSpan({
|
|
6573
|
-
mapId: mapId,
|
|
6574
|
-
timeSliderSpan: timeSliderSpan
|
|
6575
|
-
}));
|
|
6576
|
-
}
|
|
6577
|
-
if (toggleTimeSpanAuto !== undefined) {
|
|
6578
|
-
// toggle timeslider span auto
|
|
6579
|
-
listenerApi.dispatch(mapActions.toggleTimeSpanAuto({
|
|
6580
|
-
mapId: mapId,
|
|
6581
|
-
timeSpanAuto: toggleTimeSpanAuto
|
|
6582
|
-
}));
|
|
6583
|
-
}
|
|
6584
|
-
if (shouldShowZoomControls !== undefined) {
|
|
6585
|
-
// toggle zoom controls
|
|
6586
|
-
listenerApi.dispatch(mapActions.toggleZoomControls({
|
|
6587
|
-
mapId: mapId,
|
|
6588
|
-
shouldShowZoomControls: shouldShowZoomControls
|
|
6589
|
-
}));
|
|
6590
|
-
}
|
|
6591
|
-
if (displayMapPin !== undefined) {
|
|
6592
|
-
// display map pin
|
|
6593
|
-
listenerApi.dispatch(mapActions.toggleMapPinIsVisible({
|
|
6594
|
-
mapId: mapId,
|
|
6595
|
-
displayMapPin: displayMapPin
|
|
6596
|
-
}));
|
|
6597
|
-
}
|
|
6598
|
-
// sets timestep by interval of animationPayload
|
|
6599
|
-
interval = animationPayload && animationPayload.interval;
|
|
6600
|
-
if (interval) {
|
|
6601
|
-
listenerApi.dispatch(mapActions.setTimeStep({
|
|
6602
|
-
mapId: mapId,
|
|
6603
|
-
timeStep: interval
|
|
6604
|
-
}));
|
|
6605
|
-
}
|
|
6606
|
-
// sets animationEndTime by endTime of animationPayload
|
|
6607
|
-
if (animationEndTime) {
|
|
6608
|
-
endTime = animationEndTime.includes('NOW') || animationEndTime.includes('TODAY') ? dateUtils.convertNOWandTODAYFormatsToUTC(animationEndTime) : animationEndTime;
|
|
6609
|
-
listenerApi.dispatch(mapActions.setAnimationEndTime({
|
|
6610
|
-
mapId: mapId,
|
|
6611
|
-
animationEndTime: handleDateUtilsISOString(endTime)
|
|
6612
|
-
}));
|
|
6613
|
-
startTime = handleDateUtilsISOString(dateUtils.sub(dateUtils.utc(endTime), {
|
|
6614
|
-
minutes: 5 * 60 // set to default of 5 hours
|
|
6615
|
-
}).toISOString());
|
|
6616
|
-
listenerApi.dispatch(mapActions.setAnimationStartTime({
|
|
6617
|
-
mapId: mapId,
|
|
6618
|
-
animationStartTime: startTime
|
|
6619
|
-
}));
|
|
6620
|
-
listenerApi.dispatch(genericActions.setTime({
|
|
6621
|
-
origin: '',
|
|
6622
|
-
sourceId: mapId,
|
|
6623
|
-
value: startTime
|
|
6624
|
-
}));
|
|
6625
|
-
centerTimeInSeconds = new Date(handleDateUtilsISOString(endTime)).getTime();
|
|
6626
|
-
listenerApi.dispatch(mapActions.setTimeSliderCenterTime({
|
|
6627
|
-
mapId: mapId,
|
|
6628
|
-
timeSliderCenterTime: centerTimeInSeconds
|
|
6629
|
-
}));
|
|
6630
|
-
}
|
|
6631
|
-
// sets animationStartTime by duration of animationPayload
|
|
6632
|
-
if (animationLength) {
|
|
6633
|
-
animationEnd = getAnimationEndTime(listenerApi.getState(), mapId);
|
|
6634
|
-
_startTime = handleDateUtilsISOString(dateUtils.sub(dateUtils.utc(animationEnd), {
|
|
6635
|
-
minutes: animationLength
|
|
6636
|
-
}).toISOString());
|
|
6637
|
-
listenerApi.dispatch(mapActions.setAnimationStartTime({
|
|
6638
|
-
mapId: mapId,
|
|
6639
|
-
animationStartTime: _startTime
|
|
6640
|
-
}));
|
|
6641
|
-
listenerApi.dispatch(genericActions.setTime({
|
|
6642
|
-
origin: '',
|
|
6643
|
-
sourceId: mapId,
|
|
6644
|
-
value: _startTime
|
|
6645
|
-
}));
|
|
6646
|
-
}
|
|
6647
|
-
// sets animationDelay by speed of animationPayload
|
|
6648
|
-
if (animationPayload && animationPayload.speed) {
|
|
6649
|
-
listenerApi.dispatch(mapActions.setAnimationDelay({
|
|
6650
|
-
mapId: mapId,
|
|
6651
|
-
animationDelay: getSpeedDelay(animationPayload.speed)
|
|
6652
|
-
}));
|
|
6653
|
-
}
|
|
6654
|
-
// turn animation on
|
|
6655
|
-
if (shouldAnimate === true) {
|
|
6656
|
-
duration = animationPayload && animationPayload.duration ? animationPayload.duration : 5 * 60; // set to default of 5 hours
|
|
6657
|
-
_animationEnd = shouldEndtimeOverride && animationEndTime ? getAnimationEndTime(listenerApi.getState(), mapId) : dateUtils.dateToString(dateUtils.utc(), dateFormat);
|
|
6658
|
-
animationStart = shouldEndtimeOverride && animationLength ? getAnimationStartTime(listenerApi.getState(), mapId) : dateUtils.dateToString(dateUtils.sub(dateUtils.utc(_animationEnd), {
|
|
6659
|
-
minutes: duration
|
|
6660
|
-
}), dateFormat);
|
|
6661
|
-
listenerApi.dispatch(mapActions.mapStartAnimation({
|
|
6662
|
-
mapId: mapId,
|
|
6663
|
-
start: animationStart,
|
|
6664
|
-
end: _animationEnd,
|
|
6665
|
-
interval: interval || defaultTimeStep
|
|
6666
|
-
}));
|
|
6667
|
-
// If animation interval set, set the timestep auto property to false
|
|
6668
|
-
if (interval) {
|
|
6669
|
-
listenerApi.dispatch(mapActions.toggleTimestepAuto({
|
|
6670
|
-
mapId: mapId,
|
|
6671
|
-
timestepAuto: false
|
|
6672
|
-
}));
|
|
6673
|
-
}
|
|
6674
|
-
} else if (toggleTimestepAuto !== undefined) {
|
|
6675
|
-
// Set timestep auto based on preset if animation is off
|
|
6676
|
-
listenerApi.dispatch(mapActions.toggleTimestepAuto({
|
|
6677
|
-
mapId: mapId,
|
|
6678
|
-
timestepAuto: toggleTimestepAuto
|
|
6679
|
-
}));
|
|
6680
|
-
}
|
|
6681
|
-
// show legend
|
|
6682
|
-
shouldOpenLegend = shouldShowLegend !== undefined ? shouldShowLegend : IS_LEGEND_OPEN_BY_DEFAULT;
|
|
6683
|
-
legendId = getLegendId(listenerApi.getState(), mapId);
|
|
6684
|
-
if (legendId) {
|
|
6685
|
-
listenerApi.dispatch(uiActions.setToggleOpenDialog({
|
|
6686
|
-
type: legendId,
|
|
6687
|
-
setOpen: shouldOpenLegend
|
|
6688
|
-
}));
|
|
6339
|
+
return _context6.abrupt("return");
|
|
6340
|
+
case 4:
|
|
6341
|
+
targets = getLayerMoveActionsTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
6342
|
+
if (targets && targets.length > 0) {
|
|
6343
|
+
listenerApi.dispatch(setLayerActionSync(payload, targets, type));
|
|
6689
6344
|
}
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6345
|
+
case 6:
|
|
6346
|
+
case "end":
|
|
6347
|
+
return _context6.stop();
|
|
6348
|
+
}
|
|
6349
|
+
}, _callee6);
|
|
6350
|
+
}));
|
|
6351
|
+
function effect(_x11, _x12) {
|
|
6352
|
+
return _effect6.apply(this, arguments);
|
|
6353
|
+
}
|
|
6354
|
+
return effect;
|
|
6355
|
+
}()
|
|
6356
|
+
});
|
|
6357
|
+
genericListener.startListening({
|
|
6358
|
+
matcher: isAnyOf(mapActions.setAutoLayerId, mapActions.setAutoUpdateLayerId, mapActions.setAutoTimestepLayerId),
|
|
6359
|
+
effect: function () {
|
|
6360
|
+
var _effect7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref7, listenerApi) {
|
|
6361
|
+
var payload, type, targets;
|
|
6362
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
6363
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
6364
|
+
case 0:
|
|
6365
|
+
payload = _ref7.payload, type = _ref7.type;
|
|
6366
|
+
listenerApi.cancelActiveListeners();
|
|
6367
|
+
targets = getSetAutoLayerIdActionsTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
6368
|
+
if (targets && targets.length > 0) {
|
|
6369
|
+
listenerApi.dispatch(setLayerActionSync(payload, targets, type));
|
|
6695
6370
|
}
|
|
6696
|
-
case
|
|
6697
|
-
|
|
6698
|
-
|
|
6371
|
+
case 4:
|
|
6372
|
+
case "end":
|
|
6373
|
+
return _context7.stop();
|
|
6374
|
+
}
|
|
6375
|
+
}, _callee7);
|
|
6376
|
+
}));
|
|
6377
|
+
function effect(_x13, _x14) {
|
|
6378
|
+
return _effect7.apply(this, arguments);
|
|
6379
|
+
}
|
|
6380
|
+
return effect;
|
|
6381
|
+
}()
|
|
6382
|
+
});
|
|
6383
|
+
genericListener.startListening({
|
|
6384
|
+
actionCreator: layerActions.setBaseLayers,
|
|
6385
|
+
effect: function () {
|
|
6386
|
+
var _effect8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref8, listenerApi) {
|
|
6387
|
+
var payload, type, targets;
|
|
6388
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
6389
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
6390
|
+
case 0:
|
|
6391
|
+
payload = _ref8.payload, type = _ref8.type;
|
|
6392
|
+
listenerApi.cancelActiveListeners();
|
|
6393
|
+
/* Should not listen to actions from itself */
|
|
6394
|
+
if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
|
|
6395
|
+
_context8.next = 4;
|
|
6699
6396
|
break;
|
|
6700
6397
|
}
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
listenerApi.dispatch(mapActions.setAnimationEndTime({
|
|
6707
|
-
mapId: mapId,
|
|
6708
|
-
animationEndTime: dateUtils.add(dateUtils.utc(_animationEnd2), {
|
|
6709
|
-
minutes: 5
|
|
6710
|
-
}).toISOString()
|
|
6711
|
-
}));
|
|
6712
|
-
_animationStart = getAnimationStartTime(listenerApi.getState(), mapId);
|
|
6713
|
-
listenerApi.dispatch(mapActions.setAnimationStartTime({
|
|
6714
|
-
mapId: mapId,
|
|
6715
|
-
animationStartTime: dateUtils.add(dateUtils.utc(_animationStart), {
|
|
6716
|
-
minutes: 5
|
|
6717
|
-
}).toISOString()
|
|
6718
|
-
}));
|
|
6719
|
-
_context2.next = 40;
|
|
6720
|
-
break;
|
|
6721
|
-
case 50:
|
|
6722
|
-
_context2.next = 55;
|
|
6723
|
-
break;
|
|
6724
|
-
case 52:
|
|
6725
|
-
_context2.prev = 52;
|
|
6726
|
-
_context2.t0 = _context2["catch"](1);
|
|
6727
|
-
if (_context2.t0 instanceof Error) {
|
|
6728
|
-
listenerApi.dispatch(mapActions.setMapPresetError({
|
|
6729
|
-
mapId: payload.mapId,
|
|
6730
|
-
error: _context2.t0.message
|
|
6731
|
-
}));
|
|
6398
|
+
return _context8.abrupt("return");
|
|
6399
|
+
case 4:
|
|
6400
|
+
targets = getMapBaseLayerActionsTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
6401
|
+
if (targets && targets.length > 0) {
|
|
6402
|
+
listenerApi.dispatch(setLayerActionSync(payload, targets, type));
|
|
6732
6403
|
}
|
|
6733
|
-
case
|
|
6404
|
+
case 6:
|
|
6734
6405
|
case "end":
|
|
6735
|
-
return
|
|
6406
|
+
return _context8.stop();
|
|
6736
6407
|
}
|
|
6737
|
-
},
|
|
6408
|
+
}, _callee8);
|
|
6738
6409
|
}));
|
|
6739
|
-
function effect(
|
|
6740
|
-
return
|
|
6410
|
+
function effect(_x15, _x16) {
|
|
6411
|
+
return _effect8.apply(this, arguments);
|
|
6741
6412
|
}
|
|
6742
6413
|
return effect;
|
|
6743
6414
|
}()
|
|
6744
6415
|
});
|
|
6745
|
-
|
|
6746
|
-
actionCreator:
|
|
6747
|
-
effect: function effect(_ref7, listenerApi) {
|
|
6748
|
-
var payload = _ref7.payload;
|
|
6749
|
-
var mapId = payload.mapId;
|
|
6750
|
-
var layerList = getLayersByMapId(listenerApi.getState(), mapId);
|
|
6751
|
-
metronome.unregister(mapId);
|
|
6752
|
-
layerList.map(function (layer) {
|
|
6753
|
-
return listenerApi.dispatch(layerActions.layerDelete({
|
|
6754
|
-
mapId: mapId,
|
|
6755
|
-
layerId: layer.id,
|
|
6756
|
-
origin: LayerActionOrigin.unregisterMapListener
|
|
6757
|
-
}));
|
|
6758
|
-
});
|
|
6759
|
-
}
|
|
6760
|
-
});
|
|
6761
|
-
mapListener.startListening({
|
|
6762
|
-
actionCreator: mapActions.setStepBackwardOrForward,
|
|
6763
|
-
effect: function effect(_ref8, listenerApi) {
|
|
6764
|
-
var payload = _ref8.payload;
|
|
6765
|
-
var mapId = payload.mapId,
|
|
6766
|
-
isForwardStep = payload.isForwardStep;
|
|
6767
|
-
var timeStep = getMapTimeStep(listenerApi.getState(), mapId);
|
|
6768
|
-
var currentTime = getSelectedTime(listenerApi.getState(), mapId);
|
|
6769
|
-
var _mapSelectors$getData = getDataLimitsFromLayers(listenerApi.getState(), mapId),
|
|
6770
|
-
dataStartTime = _mapSelectors$getData[0],
|
|
6771
|
-
dataEndTime = _mapSelectors$getData[1];
|
|
6772
|
-
if (dateUtils.isValid(currentTime)) {
|
|
6773
|
-
var makeForwardStep = function makeForwardStep() {
|
|
6774
|
-
var nextTime = currentTime + timeStep;
|
|
6775
|
-
var roundedTime = roundWithTimeStep(nextTime, timeStep, 'ceil');
|
|
6776
|
-
var newTime = Math.min(roundedTime, dataEndTime || roundedTime);
|
|
6777
|
-
return dateUtils.fromUnix(newTime).toISOString();
|
|
6778
|
-
};
|
|
6779
|
-
var makeBackwardStep = function makeBackwardStep() {
|
|
6780
|
-
var nextTime = currentTime - timeStep;
|
|
6781
|
-
var roundedTime = roundWithTimeStep(nextTime, timeStep, 'floor');
|
|
6782
|
-
var newTime = Math.max(roundedTime, dataStartTime || roundedTime);
|
|
6783
|
-
return dateUtils.fromUnix(newTime).toISOString();
|
|
6784
|
-
};
|
|
6785
|
-
var selectedTimeString = isForwardStep ? makeForwardStep() : makeBackwardStep();
|
|
6786
|
-
var isMapAnimating = isAnimating(listenerApi.getState(), mapId);
|
|
6787
|
-
if (isMapAnimating) {
|
|
6788
|
-
listenerApi.dispatch(mapActions.mapStopAnimation({
|
|
6789
|
-
mapId: mapId,
|
|
6790
|
-
origin: MapActionOrigin.map
|
|
6791
|
-
}));
|
|
6792
|
-
}
|
|
6793
|
-
listenerApi.dispatch(genericActions.setTime({
|
|
6794
|
-
origin: '',
|
|
6795
|
-
sourceId: mapId,
|
|
6796
|
-
value: handleDateUtilsISOString(selectedTimeString)
|
|
6797
|
-
}));
|
|
6798
|
-
}
|
|
6799
|
-
}
|
|
6800
|
-
});
|
|
6801
|
-
|
|
6802
|
-
var _excluded$1 = ["url"];
|
|
6803
|
-
var serviceListener = createListenerMiddleware();
|
|
6804
|
-
var fetchService = /*#__PURE__*/function () {
|
|
6805
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(service, listenerApi) {
|
|
6806
|
-
var layers;
|
|
6807
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6808
|
-
while (1) switch (_context.prev = _context.next) {
|
|
6809
|
-
case 0:
|
|
6810
|
-
_context.prev = 0;
|
|
6811
|
-
_context.next = 3;
|
|
6812
|
-
return queryWMSLayers(service.serviceUrl);
|
|
6813
|
-
case 3:
|
|
6814
|
-
layers = _context.sent;
|
|
6815
|
-
listenerApi.dispatch(serviceActions.serviceSetLayers(Object.assign({}, service, {
|
|
6816
|
-
layers: layers
|
|
6817
|
-
})));
|
|
6818
|
-
_context.next = 10;
|
|
6819
|
-
break;
|
|
6820
|
-
case 7:
|
|
6821
|
-
_context.prev = 7;
|
|
6822
|
-
_context.t0 = _context["catch"](0);
|
|
6823
|
-
if (_context.t0 instanceof Error) {
|
|
6824
|
-
console.warn(_context.t0.message);
|
|
6825
|
-
}
|
|
6826
|
-
case 10:
|
|
6827
|
-
case "end":
|
|
6828
|
-
return _context.stop();
|
|
6829
|
-
}
|
|
6830
|
-
}, _callee, null, [[0, 7]]);
|
|
6831
|
-
}));
|
|
6832
|
-
return function fetchService(_x, _x2) {
|
|
6833
|
-
return _ref.apply(this, arguments);
|
|
6834
|
-
};
|
|
6835
|
-
}();
|
|
6836
|
-
var fetchInitialServices = /*#__PURE__*/function () {
|
|
6837
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(payload, listenerApi) {
|
|
6838
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
6839
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
6840
|
-
case 0:
|
|
6841
|
-
if (!(!payload || !payload.services)) {
|
|
6842
|
-
_context2.next = 2;
|
|
6843
|
-
break;
|
|
6844
|
-
}
|
|
6845
|
-
return _context2.abrupt("return");
|
|
6846
|
-
case 2:
|
|
6847
|
-
_context2.prev = 2;
|
|
6848
|
-
_context2.next = 5;
|
|
6849
|
-
return Promise.all(payload.services.map(function (_ref3) {
|
|
6850
|
-
var url = _ref3.url,
|
|
6851
|
-
service = _objectWithoutPropertiesLoose(_ref3, _excluded$1);
|
|
6852
|
-
return fetchService(Object.assign({}, service, {
|
|
6853
|
-
serviceUrl: url
|
|
6854
|
-
}), listenerApi);
|
|
6855
|
-
}));
|
|
6856
|
-
case 5:
|
|
6857
|
-
_context2.next = 10;
|
|
6858
|
-
break;
|
|
6859
|
-
case 7:
|
|
6860
|
-
_context2.prev = 7;
|
|
6861
|
-
_context2.t0 = _context2["catch"](2);
|
|
6862
|
-
// eslint-disable-next-line no-console
|
|
6863
|
-
console.warn(_context2.t0);
|
|
6864
|
-
case 10:
|
|
6865
|
-
case "end":
|
|
6866
|
-
return _context2.stop();
|
|
6867
|
-
}
|
|
6868
|
-
}, _callee2, null, [[2, 7]]);
|
|
6869
|
-
}));
|
|
6870
|
-
return function fetchInitialServices(_x3, _x4) {
|
|
6871
|
-
return _ref2.apply(this, arguments);
|
|
6872
|
-
};
|
|
6873
|
-
}();
|
|
6874
|
-
serviceListener.startListening({
|
|
6875
|
-
actionCreator: serviceActions.fetchInitialServices,
|
|
6416
|
+
genericListener.startListening({
|
|
6417
|
+
actionCreator: layerActions.layerDelete,
|
|
6876
6418
|
effect: function () {
|
|
6877
|
-
var
|
|
6878
|
-
var payload;
|
|
6879
|
-
return _regeneratorRuntime().wrap(function
|
|
6880
|
-
while (1) switch (
|
|
6419
|
+
var _effect9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref9, listenerApi) {
|
|
6420
|
+
var payload, type, targets;
|
|
6421
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
6422
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
6881
6423
|
case 0:
|
|
6882
|
-
payload =
|
|
6424
|
+
payload = _ref9.payload, type = _ref9.type;
|
|
6883
6425
|
listenerApi.cancelActiveListeners();
|
|
6884
|
-
|
|
6885
|
-
|
|
6426
|
+
/* Should not listen to actions from itself */
|
|
6427
|
+
if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
|
|
6428
|
+
_context9.next = 4;
|
|
6429
|
+
break;
|
|
6430
|
+
}
|
|
6431
|
+
return _context9.abrupt("return");
|
|
6886
6432
|
case 4:
|
|
6433
|
+
targets = getLayerDeleteActionsTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
6434
|
+
if (targets && targets.length > 0) {
|
|
6435
|
+
listenerApi.dispatch(setLayerActionSync(payload, targets, type));
|
|
6436
|
+
}
|
|
6437
|
+
case 6:
|
|
6887
6438
|
case "end":
|
|
6888
|
-
return
|
|
6439
|
+
return _context9.stop();
|
|
6889
6440
|
}
|
|
6890
|
-
},
|
|
6441
|
+
}, _callee9);
|
|
6891
6442
|
}));
|
|
6892
|
-
function effect(
|
|
6893
|
-
return
|
|
6443
|
+
function effect(_x17, _x18) {
|
|
6444
|
+
return _effect9.apply(this, arguments);
|
|
6894
6445
|
}
|
|
6895
6446
|
return effect;
|
|
6896
6447
|
}()
|
|
6897
6448
|
});
|
|
6898
6449
|
|
|
6899
|
-
|
|
6900
|
-
var
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6450
|
+
/* A map with all the timerIds and their current step */
|
|
6451
|
+
var stepMap = new Map();
|
|
6452
|
+
/* A map with a list of timers and their dwell */
|
|
6453
|
+
var timerDwellMap = new Map();
|
|
6454
|
+
/**
|
|
6455
|
+
* Returns the next step for given timerId.
|
|
6456
|
+
* @param timerId The timer id
|
|
6457
|
+
* @param numberOfStepsInAnimation Animation length in steps
|
|
6458
|
+
* @param numStepsToGoForward Amount of steps to go forwards, defaults to 1. Can be positive and negative
|
|
6459
|
+
* @returns
|
|
6460
|
+
*/
|
|
6461
|
+
var getNextStep = function getNextStep(timerId, numberOfStepsInAnimation, numStepsToGoForward) {
|
|
6462
|
+
if (numStepsToGoForward === void 0) {
|
|
6463
|
+
numStepsToGoForward = 1;
|
|
6464
|
+
}
|
|
6465
|
+
var currentStep = getCurrentStep(timerId);
|
|
6466
|
+
var nextStep = currentStep + numStepsToGoForward;
|
|
6467
|
+
var nextStepClipped = (nextStep % numberOfStepsInAnimation + numberOfStepsInAnimation) % numberOfStepsInAnimation;
|
|
6468
|
+
return nextStepClipped;
|
|
6909
6469
|
};
|
|
6910
|
-
|
|
6911
|
-
var _excluded = ["id"];
|
|
6912
6470
|
/**
|
|
6913
|
-
*
|
|
6914
|
-
* @param
|
|
6915
|
-
* @param
|
|
6916
|
-
* @param
|
|
6917
|
-
* @param payload
|
|
6471
|
+
* 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.
|
|
6472
|
+
* @param timerId The timer id
|
|
6473
|
+
* @param numberOfStepsInAnimation Number of steps in the animation
|
|
6474
|
+
* @param dwell The number of steps to wait at the end of the animation sequence before to continue
|
|
6918
6475
|
* @returns
|
|
6919
6476
|
*/
|
|
6920
|
-
var
|
|
6921
|
-
if (
|
|
6922
|
-
|
|
6477
|
+
var handleTimerDwell = function handleTimerDwell(timerId, numberOfStepsInAnimation, dwell) {
|
|
6478
|
+
if (dwell === void 0) {
|
|
6479
|
+
dwell = 8;
|
|
6923
6480
|
}
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
if (
|
|
6928
|
-
|
|
6929
|
-
return
|
|
6481
|
+
if (dwell > 0) {
|
|
6482
|
+
var currentStep = getCurrentStep(timerId);
|
|
6483
|
+
// Reset the dwell if we are not at the last animation step
|
|
6484
|
+
if (currentStep < numberOfStepsInAnimation - 1) {
|
|
6485
|
+
timerDwellMap.set(timerId, dwell);
|
|
6486
|
+
return false;
|
|
6487
|
+
}
|
|
6488
|
+
// We are at the last animation step, check the dwell
|
|
6489
|
+
var timerDwell = timerDwellMap.has(timerId) && timerDwellMap.get(timerId) || 0;
|
|
6490
|
+
if (currentStep === numberOfStepsInAnimation - 1 && timerDwell > 0) {
|
|
6491
|
+
timerDwellMap.set(timerId, timerDwell - 1);
|
|
6492
|
+
return true;
|
|
6930
6493
|
}
|
|
6931
6494
|
}
|
|
6932
|
-
|
|
6933
|
-
if ('layerId' in payload) {
|
|
6934
|
-
var _targetLayer = getLayerByLayerIndex(state, targetMapId, getLayerIndexByLayerId(state, mapId, payload.layerId));
|
|
6935
|
-
return !_targetLayer ? null : _targetLayer.id;
|
|
6936
|
-
}
|
|
6937
|
-
/* This payload probably does not reference to a layerId */
|
|
6938
|
-
return null;
|
|
6495
|
+
return false;
|
|
6939
6496
|
};
|
|
6940
6497
|
/**
|
|
6941
|
-
*
|
|
6942
|
-
* @param
|
|
6943
|
-
* @param
|
|
6944
|
-
* @param actionType
|
|
6945
|
-
* @param sourceMapId
|
|
6946
|
-
* @returns The found targets
|
|
6498
|
+
* Set step for the timerId
|
|
6499
|
+
* @param timerId
|
|
6500
|
+
* @param timerStep
|
|
6947
6501
|
*/
|
|
6948
|
-
var
|
|
6949
|
-
|
|
6950
|
-
var targetsInActionPayload = {};
|
|
6951
|
-
var syncGroups = syncGroupStore(state);
|
|
6952
|
-
if (syncGroups && payload) {
|
|
6953
|
-
syncGroups.groups.allIds.forEach(function (id) {
|
|
6954
|
-
var syncronizationGroup = syncGroups.groups.byId[id];
|
|
6955
|
-
if (actionType === syncronizationGroup.type) {
|
|
6956
|
-
/* Check if the source is in the target list of the synchonizationGroup */
|
|
6957
|
-
var source = syncronizationGroup.targets.byId[sourceMapId];
|
|
6958
|
-
/* If the source is part of the target list, and is linked, continue syncing the other targets */
|
|
6959
|
-
if (source && source.linked) {
|
|
6960
|
-
syncronizationGroup.targets.allIds.forEach(function (targetId) {
|
|
6961
|
-
var target = syncronizationGroup.targets.byId[targetId];
|
|
6962
|
-
if (targetId !== sourceMapId && target.linked && !targetsInActionPayload[targetId]) {
|
|
6963
|
-
/* Remember that we have already added this target in the action payloads, prevents adding it twice */
|
|
6964
|
-
targetsInActionPayload[targetId] = true;
|
|
6965
|
-
var otherLayerId = getTargetLayerIdFromPayload(state, sourceMapId, targetId, payload);
|
|
6966
|
-
actionPayloads.push({
|
|
6967
|
-
payload: payload,
|
|
6968
|
-
targetId: targetId,
|
|
6969
|
-
layerId: otherLayerId
|
|
6970
|
-
});
|
|
6971
|
-
}
|
|
6972
|
-
});
|
|
6973
|
-
}
|
|
6974
|
-
}
|
|
6975
|
-
});
|
|
6976
|
-
}
|
|
6977
|
-
return actionPayloads;
|
|
6978
|
-
};
|
|
6979
|
-
/**
|
|
6980
|
-
* These targets are found for layer actions that work with a layerId like: SetLayerName, SetLayerEnabled, SetLayerOpacity, SetLayerDimension and SetLayerStyle
|
|
6981
|
-
* @param state
|
|
6982
|
-
* @param payload
|
|
6983
|
-
* @param actionType
|
|
6984
|
-
* @returns
|
|
6985
|
-
*/
|
|
6986
|
-
var getLayerActionsTargets = function getLayerActionsTargets(state, payload, actionType) {
|
|
6987
|
-
var mapId = getMapIdFromLayerId(state, payload.layerId);
|
|
6988
|
-
if (!mapId) {
|
|
6989
|
-
return [];
|
|
6990
|
-
}
|
|
6991
|
-
var foundTargets = findTargets(state, payload, actionType, mapId);
|
|
6992
|
-
return foundTargets.map(function (target) {
|
|
6993
|
-
var payload = target.payload;
|
|
6994
|
-
return Object.assign({}, payload, {
|
|
6995
|
-
layerId: target.layerId,
|
|
6996
|
-
origin: SyncGroupActionOrigin.layerActions,
|
|
6997
|
-
mapId: payload.mapId
|
|
6998
|
-
});
|
|
6999
|
-
});
|
|
7000
|
-
};
|
|
7001
|
-
/**
|
|
7002
|
-
* These targets are found for the layer/map action AddLayer. AddLayer does not have a layerId (because it's new)
|
|
7003
|
-
* @param state
|
|
7004
|
-
* @param payload
|
|
7005
|
-
* @param actionType
|
|
7006
|
-
* @returns
|
|
7007
|
-
*/
|
|
7008
|
-
var getAddLayerActionsTargets = function getAddLayerActionsTargets(state, payload, actionType) {
|
|
7009
|
-
var foundTargets = findTargets(state, payload, actionType, payload.mapId);
|
|
7010
|
-
return foundTargets.map(function (_ref) {
|
|
7011
|
-
var payload = _ref.payload,
|
|
7012
|
-
targetId = _ref.targetId;
|
|
7013
|
-
var layer = payload.layer;
|
|
7014
|
-
layer.id;
|
|
7015
|
-
var layerWithoutId = _objectWithoutPropertiesLoose(layer, _excluded);
|
|
7016
|
-
var layerId = webmapUtils.generateLayerId();
|
|
7017
|
-
return Object.assign({}, payload, {
|
|
7018
|
-
layer: layerWithoutId,
|
|
7019
|
-
layerId: layerId,
|
|
7020
|
-
mapId: targetId,
|
|
7021
|
-
origin: SyncGroupActionOrigin.add
|
|
7022
|
-
});
|
|
7023
|
-
});
|
|
7024
|
-
};
|
|
7025
|
-
/**
|
|
7026
|
-
* These targets are found for the layer/map action DeleteLayer. The layer is already gone, so there is no layerId anymore. Using layerIndex instead.
|
|
7027
|
-
* @param state
|
|
7028
|
-
* @param payload
|
|
7029
|
-
* @param actionType
|
|
7030
|
-
* @returns
|
|
7031
|
-
*/
|
|
7032
|
-
var getLayerDeleteActionsTargets = function getLayerDeleteActionsTargets(state, payload, actionType) {
|
|
7033
|
-
var foundTargets = findTargets(state, payload, actionType, payload.mapId);
|
|
7034
|
-
return foundTargets.map(function (target) {
|
|
7035
|
-
return Object.assign({}, target.payload, {
|
|
7036
|
-
mapId: target.targetId,
|
|
7037
|
-
layerId: target.layerId,
|
|
7038
|
-
origin: SyncGroupActionOrigin["delete"]
|
|
7039
|
-
});
|
|
7040
|
-
});
|
|
7041
|
-
};
|
|
7042
|
-
/**
|
|
7043
|
-
* These targets are found for the layer/map action MoveLayer. Here layers are referenced by newIndex and oldIndex.
|
|
7044
|
-
* @param state
|
|
7045
|
-
* @param payload
|
|
7046
|
-
* @param actionType
|
|
7047
|
-
* @returns
|
|
7048
|
-
*/
|
|
7049
|
-
var getLayerMoveActionsTargets = function getLayerMoveActionsTargets(state, payload, actionType) {
|
|
7050
|
-
var foundTargets = findTargets(state, payload, actionType, payload.mapId);
|
|
7051
|
-
return foundTargets.map(function (target) {
|
|
7052
|
-
return Object.assign({}, target.payload, {
|
|
7053
|
-
mapId: target.targetId,
|
|
7054
|
-
origin: SyncGroupActionOrigin.move
|
|
7055
|
-
});
|
|
7056
|
-
});
|
|
6502
|
+
var setStep = function setStep(timerId, timerStep) {
|
|
6503
|
+
stepMap.set(timerId, timerStep);
|
|
7057
6504
|
};
|
|
7058
6505
|
/**
|
|
7059
|
-
*
|
|
7060
|
-
* @param
|
|
7061
|
-
* @param payload
|
|
7062
|
-
* @param actionType
|
|
6506
|
+
* Gets the current step for the timer
|
|
6507
|
+
* @param timerId
|
|
7063
6508
|
* @returns
|
|
7064
6509
|
*/
|
|
7065
|
-
var
|
|
7066
|
-
|
|
7067
|
-
layerId: payload.autoUpdateLayerId || payload.autoTimeStepLayerId || payload.layerId
|
|
7068
|
-
});
|
|
7069
|
-
var foundTargets = findTargets(state, payloadWithLayerId, actionType, payload.mapId);
|
|
7070
|
-
return foundTargets.map(function (target) {
|
|
7071
|
-
return {
|
|
7072
|
-
mapId: target.targetId,
|
|
7073
|
-
layerId: target.layerId,
|
|
7074
|
-
origin: SyncGroupActionOrigin.autoLayerId
|
|
7075
|
-
};
|
|
7076
|
-
});
|
|
6510
|
+
var getCurrentStep = function getCurrentStep(timerId) {
|
|
6511
|
+
return stepMap.get(timerId) || 0;
|
|
7077
6512
|
};
|
|
6513
|
+
var MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH = 2;
|
|
6514
|
+
var MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES = 8;
|
|
7078
6515
|
/**
|
|
7079
|
-
*
|
|
7080
|
-
* @param
|
|
7081
|
-
* @param
|
|
7082
|
-
* @param
|
|
7083
|
-
* @returns
|
|
6516
|
+
* This prefetches all images connected to the same sync group as provided timerId
|
|
6517
|
+
* @param timerId The timerId
|
|
6518
|
+
* @param animationListValues List of animation steps in isostring to animate
|
|
6519
|
+
* @param targets List of targets to check
|
|
6520
|
+
* @returns True if all maps are ready to go forward, false if the map has no data to display yet.
|
|
7084
6521
|
*/
|
|
7085
|
-
var
|
|
7086
|
-
var
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
} else {
|
|
7117
|
-
targets = getTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETTIME);
|
|
7118
|
-
groups = getTargetGroups(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETTIME);
|
|
7119
|
-
listenerApi.dispatch(setTimeSync(payload, targets, groups));
|
|
6522
|
+
var prefetchAnimationTargetsForMetronome = function prefetchAnimationTargetsForMetronome(timerId, animationListValues, targets) {
|
|
6523
|
+
var timerShouldStepForward = true;
|
|
6524
|
+
// The following code prefetches/buffers for all maps in the group
|
|
6525
|
+
for (var numPrefetch = 0; numPrefetch < MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH; numPrefetch += 1) {
|
|
6526
|
+
var nextStep = getNextStep(timerId, animationListValues.length, numPrefetch + 1);
|
|
6527
|
+
var nextTimeValueStepToCheck = animationListValues[nextStep];
|
|
6528
|
+
for (var _iterator = _createForOfIteratorHelperLoose(targets), _step; !(_step = _iterator()).done;) {
|
|
6529
|
+
var target = _step.value;
|
|
6530
|
+
var targetMapId = target.targetId;
|
|
6531
|
+
var wmMap = getWMJSMapById(targetMapId);
|
|
6532
|
+
if (!wmMap) {
|
|
6533
|
+
return true; // Map was not registered so there is nothing to prefetch, do not block going forward
|
|
6534
|
+
}
|
|
6535
|
+
var layersImageUrls = getWMSRequests(wmMap, [{
|
|
6536
|
+
name: 'time',
|
|
6537
|
+
currentValue: nextTimeValueStepToCheck
|
|
6538
|
+
}]);
|
|
6539
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(layersImageUrls), _step2; !(_step2 = _iterator2()).done;) {
|
|
6540
|
+
var layersImageUrl = _step2.value;
|
|
6541
|
+
var image = wmMap.getMapImageStore.getImage(layersImageUrl.url);
|
|
6542
|
+
if (!image.isLoaded()) {
|
|
6543
|
+
if (wmMap.getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
|
|
6544
|
+
image.load();
|
|
6545
|
+
}
|
|
6546
|
+
if (numPrefetch === 0) {
|
|
6547
|
+
var altImage = wmMap.getAlternativeImage(layersImageUrl.url, wmMap.getBBOX(), true);
|
|
6548
|
+
// No alternative image available yet, so skipping animation.
|
|
6549
|
+
if (altImage.length === 0) {
|
|
6550
|
+
// This is useful to indicate that the map is loading and has nothing yet to display.
|
|
6551
|
+
// console.warn('No data available: Not stepping forward');
|
|
6552
|
+
timerShouldStepForward = false;
|
|
7120
6553
|
}
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
6554
|
+
}
|
|
6555
|
+
} else if (image.isStale()) {
|
|
6556
|
+
if (wmMap.getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
|
|
6557
|
+
image.forceReload(true);
|
|
6558
|
+
}
|
|
7124
6559
|
}
|
|
7125
|
-
}
|
|
7126
|
-
}));
|
|
7127
|
-
function effect(_x, _x2) {
|
|
7128
|
-
return _effect.apply(this, arguments);
|
|
6560
|
+
}
|
|
7129
6561
|
}
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
}
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
6562
|
+
}
|
|
6563
|
+
return timerShouldStepForward;
|
|
6564
|
+
};
|
|
6565
|
+
|
|
6566
|
+
var isAnimationEndTimeValid = function isAnimationEndTimeValid(animationEndTime) {
|
|
6567
|
+
var hasValidPrefix = animationEndTime.split(/[-+]/)[0] === 'NOW' || animationEndTime.split(/[-+]/)[0] === 'TODAY';
|
|
6568
|
+
var durationString = animationEndTime.substring(animationEndTime.indexOf('PT') + 2);
|
|
6569
|
+
var hasValidDate = /^(\d+H)?(\d+M)?$/.test(durationString);
|
|
6570
|
+
if (hasValidPrefix && hasValidDate) {
|
|
6571
|
+
return true;
|
|
6572
|
+
}
|
|
6573
|
+
var parsedDate = dateUtils.parseISO(animationEndTime);
|
|
6574
|
+
return dateUtils.isValid(parsedDate);
|
|
6575
|
+
};
|
|
6576
|
+
var mapListener = createListenerMiddleware();
|
|
6577
|
+
mapListener.startListening({
|
|
6578
|
+
actionCreator: layerActions.layerDelete,
|
|
6579
|
+
effect: function effect(_ref, listenerApi) {
|
|
6580
|
+
var payload = _ref.payload;
|
|
6581
|
+
var mapId = payload.mapId;
|
|
6582
|
+
var layers = getMapLayersWithoutDimensionCurrentValue(listenerApi.getState(), mapId);
|
|
6583
|
+
if (!layers.length) {
|
|
6584
|
+
listenerApi.dispatch(mapActions.mapStopAnimation({
|
|
6585
|
+
mapId: mapId
|
|
6586
|
+
}));
|
|
7154
6587
|
}
|
|
7155
|
-
|
|
7156
|
-
}()
|
|
6588
|
+
}
|
|
7157
6589
|
});
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
|
|
7169
|
-
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
6590
|
+
// update layer, synced maps and animation on latest max time if autoupdating
|
|
6591
|
+
mapListener.startListening({
|
|
6592
|
+
actionCreator: layerActions.onUpdateLayerInformation,
|
|
6593
|
+
effect: function effect(_ref2, listenerApi) {
|
|
6594
|
+
var payload = _ref2.payload;
|
|
6595
|
+
try {
|
|
6596
|
+
var layerDimensions = payload.layerDimensions;
|
|
6597
|
+
if (!layerDimensions) {
|
|
6598
|
+
return;
|
|
6599
|
+
}
|
|
6600
|
+
var dimensions = layerDimensions.dimensions,
|
|
6601
|
+
layerId = layerDimensions.layerId;
|
|
6602
|
+
var layer = getLayerById(listenerApi.getState(), layerId);
|
|
6603
|
+
if (!layer) {
|
|
6604
|
+
return;
|
|
6605
|
+
}
|
|
6606
|
+
var newTimeDimension = dimensions.find(function (dimension) {
|
|
6607
|
+
return dimension.name === 'time';
|
|
6608
|
+
});
|
|
6609
|
+
var mapId = layer.mapId;
|
|
6610
|
+
if (!mapId) {
|
|
6611
|
+
return;
|
|
6612
|
+
}
|
|
6613
|
+
var autoUpdateLayerId = getAutoUpdateLayerId(listenerApi.getState(), mapId);
|
|
6614
|
+
var shouldAutoUpdate = isAutoUpdating(listenerApi.getState(), mapId);
|
|
6615
|
+
var prevTimeDimension = getLayerTimeDimension(listenerApi.getState(), layerId);
|
|
6616
|
+
var isAutoUpdateLayer = layerId === autoUpdateLayerId;
|
|
6617
|
+
var incomingMaxTime = newTimeDimension == null ? void 0 : newTimeDimension.maxValue;
|
|
6618
|
+
var isIncomingMaxTimeLaterThanCurrentLayerTime = incomingMaxTime && (prevTimeDimension == null ? void 0 : prevTimeDimension.currentValue) && prevTimeDimension.currentValue !== incomingMaxTime;
|
|
6619
|
+
if (isAutoUpdateLayer &&
|
|
6620
|
+
// only update the active layer
|
|
6621
|
+
shouldAutoUpdate && isIncomingMaxTimeLaterThanCurrentLayerTime) {
|
|
6622
|
+
var isMapAnimating = isAnimating(listenerApi.getState(), mapId);
|
|
6623
|
+
if (!isMapAnimating) {
|
|
6624
|
+
listenerApi.dispatch(layerActions.layerChangeDimension({
|
|
6625
|
+
layerId: layerId,
|
|
6626
|
+
origin: LayerActionOrigin.updateLayerInformationListener,
|
|
6627
|
+
dimension: {
|
|
6628
|
+
name: 'time',
|
|
6629
|
+
currentValue: incomingMaxTime
|
|
7178
6630
|
}
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
6631
|
+
}));
|
|
6632
|
+
// Each time a layer updates, set the new time for all synced timesliders
|
|
6633
|
+
var syncedMapIds = getSyncedMapIdsForTimeslider(listenerApi.getState());
|
|
6634
|
+
if (syncedMapIds) {
|
|
6635
|
+
// Change time value for all other timesliders
|
|
6636
|
+
syncedMapIds.map(function (syncedMapId) {
|
|
6637
|
+
return listenerApi.dispatch(setTime({
|
|
6638
|
+
origin: LayerActionOrigin.updateLayerInformationListener,
|
|
6639
|
+
sourceId: syncedMapId,
|
|
6640
|
+
value: incomingMaxTime
|
|
6641
|
+
}));
|
|
6642
|
+
});
|
|
6643
|
+
}
|
|
7182
6644
|
}
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
6645
|
+
updateAnimation(mapId, incomingMaxTime, listenerApi);
|
|
6646
|
+
}
|
|
6647
|
+
} catch (error) {
|
|
6648
|
+
// eslint-disable-next-line no-console
|
|
6649
|
+
console.warn(error);
|
|
7187
6650
|
}
|
|
7188
|
-
|
|
7189
|
-
}()
|
|
6651
|
+
}
|
|
7190
6652
|
});
|
|
7191
|
-
|
|
7192
|
-
|
|
6653
|
+
var updateAnimation = function updateAnimation(mapId, maxValue, listenerApi) {
|
|
6654
|
+
var shouldEndtimeOverride$1 = shouldEndtimeOverride(listenerApi.getState(), mapId);
|
|
6655
|
+
if (shouldEndtimeOverride$1 === true) {
|
|
6656
|
+
return;
|
|
6657
|
+
}
|
|
6658
|
+
var animationStart = getAnimationStartTime(listenerApi.getState(), mapId);
|
|
6659
|
+
// Calculate how much time the animation start need to move forwards
|
|
6660
|
+
var animationEnd = getAnimationEndTime(listenerApi.getState(), mapId);
|
|
6661
|
+
var animationEndUnix = dateUtils.unix(dateUtils.utc(animationEnd));
|
|
6662
|
+
var maxTimeAsUnix = dateUtils.unix(dateUtils.utc(maxValue));
|
|
6663
|
+
var timeInSecondToShiftAnimationForwards = maxTimeAsUnix - animationEndUnix;
|
|
6664
|
+
var animationStartUnix = dateUtils.unix(dateUtils.utc(animationStart));
|
|
6665
|
+
var newAnimationStartTime = dateUtils.dateToString(dateUtils.fromUnix(animationStartUnix + timeInSecondToShiftAnimationForwards), dateFormat);
|
|
6666
|
+
var newAnimationEndTime = dateUtils.dateToString(dateUtils.fromUnix(animationEndUnix + timeInSecondToShiftAnimationForwards), dateFormat);
|
|
6667
|
+
if (!newAnimationStartTime || !newAnimationEndTime) {
|
|
6668
|
+
return;
|
|
6669
|
+
}
|
|
6670
|
+
// Check if the mapId is part of a syncgroup
|
|
6671
|
+
var syncedMapIds = getSyncedMapIdsForTimeslider(listenerApi.getState());
|
|
6672
|
+
var isSyncedMap = syncedMapIds.includes(mapId);
|
|
6673
|
+
var mapIdsToUpdate = isSyncedMap ? syncedMapIds : [mapId];
|
|
6674
|
+
// Update new animation times for the map or in case of syncgroup, all maps in the syncgroup
|
|
6675
|
+
mapIdsToUpdate.forEach(function (id) {
|
|
6676
|
+
listenerApi.dispatch(mapActions.setAnimationEndTime({
|
|
6677
|
+
mapId: id,
|
|
6678
|
+
animationEndTime: newAnimationEndTime
|
|
6679
|
+
}));
|
|
6680
|
+
listenerApi.dispatch(mapActions.setAnimationStartTime({
|
|
6681
|
+
mapId: id,
|
|
6682
|
+
animationStartTime: newAnimationStartTime
|
|
6683
|
+
}));
|
|
6684
|
+
});
|
|
6685
|
+
};
|
|
6686
|
+
mapListener.startListening({
|
|
6687
|
+
actionCreator: mapActions.toggleAutoUpdate,
|
|
7193
6688
|
effect: function () {
|
|
7194
|
-
var
|
|
7195
|
-
var payload,
|
|
7196
|
-
return _regeneratorRuntime().wrap(function
|
|
7197
|
-
while (1) switch (
|
|
6689
|
+
var _effect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref3, listenerApi) {
|
|
6690
|
+
var payload, shouldAutoUpdate, mapId, autoUpdateLayerId, timeDimension, syncedMapIds, payloads;
|
|
6691
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6692
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7198
6693
|
case 0:
|
|
7199
|
-
payload =
|
|
6694
|
+
payload = _ref3.payload;
|
|
7200
6695
|
listenerApi.cancelActiveListeners();
|
|
7201
|
-
|
|
7202
|
-
if (
|
|
7203
|
-
|
|
6696
|
+
shouldAutoUpdate = payload.shouldAutoUpdate, mapId = payload.mapId;
|
|
6697
|
+
if (shouldAutoUpdate) {
|
|
6698
|
+
_context.next = 5;
|
|
7204
6699
|
break;
|
|
7205
6700
|
}
|
|
7206
|
-
return
|
|
7207
|
-
case
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
listenerApi.
|
|
6701
|
+
return _context.abrupt("return");
|
|
6702
|
+
case 5:
|
|
6703
|
+
try {
|
|
6704
|
+
autoUpdateLayerId = getAutoUpdateLayerId(listenerApi.getState(), mapId);
|
|
6705
|
+
timeDimension = getLayerTimeDimension(listenerApi.getState(), autoUpdateLayerId);
|
|
6706
|
+
syncedMapIds = getSyncedMapIdsForTimeslider(listenerApi.getState()); // go to end of active layer
|
|
6707
|
+
if (timeDimension != null && timeDimension.maxValue && autoUpdateLayerId) {
|
|
6708
|
+
listenerApi.dispatch(layerActions.layerChangeDimension({
|
|
6709
|
+
layerId: autoUpdateLayerId,
|
|
6710
|
+
origin: LayerActionOrigin.toggleAutoUpdateListener,
|
|
6711
|
+
dimension: {
|
|
6712
|
+
name: 'time',
|
|
6713
|
+
currentValue: timeDimension.maxValue
|
|
6714
|
+
}
|
|
6715
|
+
}));
|
|
6716
|
+
// Change time value for all timesliders that are synced by syncgroups
|
|
6717
|
+
if (syncedMapIds.length > 0) {
|
|
6718
|
+
syncedMapIds.map(function (syncedMapId) {
|
|
6719
|
+
return listenerApi.dispatch(setTime({
|
|
6720
|
+
origin: LayerActionOrigin.toggleAutoUpdateListener,
|
|
6721
|
+
sourceId: syncedMapId,
|
|
6722
|
+
value: timeDimension.maxValue
|
|
6723
|
+
}));
|
|
6724
|
+
});
|
|
6725
|
+
}
|
|
6726
|
+
updateAnimation(mapId, timeDimension.maxValue, listenerApi);
|
|
6727
|
+
}
|
|
6728
|
+
// Toggle autoupdate off for synced timesliders
|
|
6729
|
+
payloads = syncedMapIds.reduce(function (syncedMapIdList, syncedMapId) {
|
|
6730
|
+
if (syncedMapId !== mapId) {
|
|
6731
|
+
return syncedMapIdList.concat({
|
|
6732
|
+
mapId: syncedMapId,
|
|
6733
|
+
shouldAutoUpdate: false
|
|
6734
|
+
});
|
|
6735
|
+
}
|
|
6736
|
+
return syncedMapIdList;
|
|
6737
|
+
}, []);
|
|
6738
|
+
if (payloads.length > 0) {
|
|
6739
|
+
payloads.map(function (payload) {
|
|
6740
|
+
return listenerApi.dispatch(mapActions.toggleAutoUpdate(payload));
|
|
6741
|
+
});
|
|
6742
|
+
}
|
|
6743
|
+
} catch (error) {
|
|
6744
|
+
// eslint-disable-next-line no-console
|
|
6745
|
+
console.warn(error);
|
|
7211
6746
|
}
|
|
7212
6747
|
case 6:
|
|
7213
6748
|
case "end":
|
|
7214
|
-
return
|
|
6749
|
+
return _context.stop();
|
|
7215
6750
|
}
|
|
7216
|
-
},
|
|
6751
|
+
}, _callee);
|
|
7217
6752
|
}));
|
|
7218
|
-
function effect(
|
|
7219
|
-
return
|
|
6753
|
+
function effect(_x, _x2) {
|
|
6754
|
+
return _effect.apply(this, arguments);
|
|
7220
6755
|
}
|
|
7221
6756
|
return effect;
|
|
7222
6757
|
}()
|
|
7223
6758
|
});
|
|
7224
|
-
|
|
7225
|
-
actionCreator:
|
|
7226
|
-
effect: function () {
|
|
7227
|
-
var
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
return _effect5.apply(this, arguments);
|
|
6759
|
+
mapListener.startListening({
|
|
6760
|
+
actionCreator: mapActions.mapStartAnimation,
|
|
6761
|
+
effect: function effect(_ref4, listenerApi) {
|
|
6762
|
+
var payload = _ref4.payload;
|
|
6763
|
+
var mapId = payload.mapId,
|
|
6764
|
+
initialTime = payload.initialTime;
|
|
6765
|
+
// Check if the mapId is part of a syncgroup
|
|
6766
|
+
var syncedMapIds = getSyncedMapIdsForTimeslider(listenerApi.getState());
|
|
6767
|
+
var isSyncedMap = syncedMapIds.includes(mapId);
|
|
6768
|
+
var autoUpdateMapId = syncedMapIds.find(function (syncedMapId) {
|
|
6769
|
+
return isAutoUpdating(listenerApi.getState(), syncedMapId);
|
|
6770
|
+
});
|
|
6771
|
+
// Start animation with the mapId that started the animation or in case of syncgroup, the map that is auto updating
|
|
6772
|
+
var useMapId = isSyncedMap ? autoUpdateMapId || mapId : mapId;
|
|
6773
|
+
var speedDelay = getMapAnimationDelay(listenerApi.getState(), useMapId);
|
|
6774
|
+
var speed = 1000 / (speedDelay || 1);
|
|
6775
|
+
metronome.register(null, speed, useMapId);
|
|
6776
|
+
var timeList = getAnimationList(listenerApi.getState(), useMapId);
|
|
6777
|
+
// In case of the timeList
|
|
6778
|
+
if (timeList && timeList.length > 0) {
|
|
6779
|
+
// Determine animation step based on initialTime and timeList
|
|
6780
|
+
var initalTimerStep = timeList == null ? void 0 : timeList.findIndex(function (timeNameValue) {
|
|
6781
|
+
return timeNameValue.value === initialTime;
|
|
6782
|
+
});
|
|
6783
|
+
if (initalTimerStep !== -1) {
|
|
6784
|
+
setStep(useMapId, initalTimerStep);
|
|
6785
|
+
}
|
|
7252
6786
|
}
|
|
7253
|
-
|
|
7254
|
-
}()
|
|
6787
|
+
}
|
|
7255
6788
|
});
|
|
7256
|
-
|
|
7257
|
-
actionCreator: mapActions.
|
|
6789
|
+
mapListener.startListening({
|
|
6790
|
+
actionCreator: mapActions.mapStopAnimation,
|
|
6791
|
+
effect: function effect(_ref5, listenerApi) {
|
|
6792
|
+
var mapId = _ref5.payload.mapId;
|
|
6793
|
+
// Check if the mapId is part of a syncgroup
|
|
6794
|
+
var syncedMapIds = getSyncedMapIdsForTimeslider(listenerApi.getState());
|
|
6795
|
+
var isSyncedMap = syncedMapIds.includes(mapId);
|
|
6796
|
+
var mapIdsToUnregister = isSyncedMap ? syncedMapIds : [mapId];
|
|
6797
|
+
mapIdsToUnregister.forEach(function (mapId) {
|
|
6798
|
+
return metronome.unregister(mapId);
|
|
6799
|
+
});
|
|
6800
|
+
}
|
|
6801
|
+
});
|
|
6802
|
+
var handleBaseLayers = function handleBaseLayers(mapId, baseLayers, listenerApi) {
|
|
6803
|
+
var baseLayer = baseLayers.find(function (layer) {
|
|
6804
|
+
return layer.layerType === 'baseLayer';
|
|
6805
|
+
});
|
|
6806
|
+
var currentAvailableBaseLayers = getAvailableBaseLayersForMap(listenerApi.getState(), mapId);
|
|
6807
|
+
// find a availableBaseLayer with the same name, and use that id for the active baselayer
|
|
6808
|
+
var activeAvailableBaseLayer = currentAvailableBaseLayers.find(function (availableBaseLayer) {
|
|
6809
|
+
return availableBaseLayer.name === baseLayer.name;
|
|
6810
|
+
});
|
|
6811
|
+
var activeBaseLayerId = activeAvailableBaseLayer ? activeAvailableBaseLayer.id : webmapUtils.generateLayerId();
|
|
6812
|
+
// if the baseLayer can't be found in a visible available baseLayer list, add it
|
|
6813
|
+
// This happens when switching to a preset that has non-default baselayers
|
|
6814
|
+
if (!activeAvailableBaseLayer && currentAvailableBaseLayers.length) {
|
|
6815
|
+
listenerApi.dispatch(layerActions.addAvailableBaseLayers({
|
|
6816
|
+
layers: [Object.assign({}, baseLayer, {
|
|
6817
|
+
mapId: mapId,
|
|
6818
|
+
id: activeBaseLayerId
|
|
6819
|
+
})]
|
|
6820
|
+
}));
|
|
6821
|
+
}
|
|
6822
|
+
var baseLayersWithActiveId = baseLayers.map(function (layer, index) {
|
|
6823
|
+
return index === 0 ? Object.assign({}, layer, {
|
|
6824
|
+
id: activeBaseLayerId || layer.id
|
|
6825
|
+
}) : layer;
|
|
6826
|
+
});
|
|
6827
|
+
listenerApi.dispatch(layerActions.setBaseLayers({
|
|
6828
|
+
mapId: mapId,
|
|
6829
|
+
layers: baseLayersWithActiveId
|
|
6830
|
+
}));
|
|
6831
|
+
};
|
|
6832
|
+
mapListener.startListening({
|
|
6833
|
+
actionCreator: mapActions.setMapPreset,
|
|
7258
6834
|
effect: function () {
|
|
7259
|
-
var
|
|
7260
|
-
var payload,
|
|
7261
|
-
return _regeneratorRuntime().wrap(function
|
|
7262
|
-
while (1) switch (
|
|
6835
|
+
var _effect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref6, listenerApi) {
|
|
6836
|
+
var payload, mapId, initialProps, mapPreset, layers, activeLayerId, autoTimeStepLayerId, autoUpdateLayerId, proj, shouldAutoUpdate, shouldAnimate, animationPayload, toggleTimestepAuto, showTimeSlider, displayMapPin, shouldShowZoomControls, shouldShowLegend, dockedLayerManagerSize, timeSliderSpan, toggleTimeSpanAuto, _filterLayers, mapLayers, baseLayers, overLayers, _newLayerIds$layers$f, _newLayerIds$layers$, _newLayerIds$layers$f2, _newLayerIds$layers$2, autoTimeStepLayerIdNew, autoUpdateLayerIdNew, onlyActiveLayerIdIsSet, newLayerIds, newAutoUpdateLayerId, newAutoTimeStepLayerId, customLayers, customBaseLayer, customOverLayer, baseLayersWithDefaultLayer, overLayersWithDefaultLayer, allBaseLayers, checkIsprojectionSupported, animationLength, animationEndTime, shouldEndtimeOverride, interval, endTime, startTime, centerTimeInSeconds, animationEnd, _startTime, duration, _animationEnd, animationStart, shouldOpenLegend, legendId, fiveMinuteDelayForAnimation, _animationEnd2, _animationStart;
|
|
6837
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
6838
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7263
6839
|
case 0:
|
|
7264
|
-
payload = _ref6.payload
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
6840
|
+
payload = _ref6.payload;
|
|
6841
|
+
_context2.prev = 1;
|
|
6842
|
+
mapId = payload.mapId, initialProps = payload.initialProps;
|
|
6843
|
+
mapPreset = initialProps.mapPreset;
|
|
6844
|
+
if (!mapPreset) {
|
|
6845
|
+
_context2.next = 50;
|
|
6846
|
+
break;
|
|
6847
|
+
}
|
|
6848
|
+
layers = mapPreset.layers, activeLayerId = mapPreset.activeLayerId, autoTimeStepLayerId = mapPreset.autoTimeStepLayerId, autoUpdateLayerId = mapPreset.autoUpdateLayerId, proj = mapPreset.proj, shouldAutoUpdate = mapPreset.shouldAutoUpdate, shouldAnimate = mapPreset.shouldAnimate, animationPayload = mapPreset.animationPayload, toggleTimestepAuto = mapPreset.toggleTimestepAuto, showTimeSlider = mapPreset.showTimeSlider, displayMapPin = mapPreset.displayMapPin, shouldShowZoomControls = mapPreset.shouldShowZoomControls, shouldShowLegend = mapPreset.shouldShowLegend, dockedLayerManagerSize = mapPreset.dockedLayerManagerSize, timeSliderSpan = mapPreset.timeSliderSpan, toggleTimeSpanAuto = mapPreset.toggleTimeSpanAuto;
|
|
6849
|
+
_filterLayers = filterLayers(layers), mapLayers = _filterLayers.mapLayers, baseLayers = _filterLayers.baseLayers, overLayers = _filterLayers.overLayers;
|
|
6850
|
+
if (layers) {
|
|
6851
|
+
// make sure all layers have a unique id before going forward
|
|
6852
|
+
autoTimeStepLayerIdNew = autoTimeStepLayerId;
|
|
6853
|
+
autoUpdateLayerIdNew = autoUpdateLayerId;
|
|
6854
|
+
onlyActiveLayerIdIsSet = !autoTimeStepLayerId && !autoUpdateLayerId && activeLayerId;
|
|
6855
|
+
if (onlyActiveLayerIdIsSet) {
|
|
6856
|
+
autoTimeStepLayerIdNew = activeLayerId;
|
|
6857
|
+
autoUpdateLayerIdNew = activeLayerId;
|
|
6858
|
+
}
|
|
6859
|
+
newLayerIds = replaceLayerIdsToEnsureUniqueLayerIdsInStore({
|
|
6860
|
+
layers: mapLayers,
|
|
6861
|
+
autoTimeStepLayerId: autoTimeStepLayerIdNew,
|
|
6862
|
+
autoUpdateLayerId: autoUpdateLayerIdNew
|
|
6863
|
+
}); // set layers
|
|
6864
|
+
listenerApi.dispatch(layerActions.setLayers({
|
|
6865
|
+
mapId: mapId,
|
|
6866
|
+
layers: newLayerIds.layers
|
|
6867
|
+
}));
|
|
6868
|
+
// make sure layer with new id exist and if not, default to first layer
|
|
6869
|
+
newAutoUpdateLayerId = ((_newLayerIds$layers$f = newLayerIds.layers.find(function (layer) {
|
|
6870
|
+
return layer.id === newLayerIds.autoUpdateLayerId;
|
|
6871
|
+
})) == null ? void 0 : _newLayerIds$layers$f.id) || ((_newLayerIds$layers$ = newLayerIds.layers[0]) == null ? void 0 : _newLayerIds$layers$.id);
|
|
6872
|
+
newAutoTimeStepLayerId = ((_newLayerIds$layers$f2 = newLayerIds.layers.find(function (layer) {
|
|
6873
|
+
return layer.id === newLayerIds.autoTimeStepLayerId;
|
|
6874
|
+
})) == null ? void 0 : _newLayerIds$layers$f2.id) || ((_newLayerIds$layers$2 = newLayerIds.layers[0]) == null ? void 0 : _newLayerIds$layers$2.id);
|
|
6875
|
+
listenerApi.dispatch(mapActions.setAutoLayerId({
|
|
6876
|
+
mapId: mapId,
|
|
6877
|
+
autoUpdateLayerId: newAutoUpdateLayerId,
|
|
6878
|
+
autoTimeStepLayerId: newAutoTimeStepLayerId
|
|
6879
|
+
}));
|
|
6880
|
+
}
|
|
6881
|
+
customLayers = getdefaultMapSettingsLayers(listenerApi.getState());
|
|
6882
|
+
customBaseLayer = customLayers == null ? void 0 : customLayers.find(function (layer) {
|
|
6883
|
+
return layer.layerType === LayerType.baseLayer;
|
|
6884
|
+
});
|
|
6885
|
+
customOverLayer = customLayers == null ? void 0 : customLayers.find(function (layer) {
|
|
6886
|
+
return layer.layerType === LayerType.overLayer;
|
|
6887
|
+
}); // sets (default) baseLayers
|
|
6888
|
+
baseLayersWithDefaultLayer = baseLayers.length ? baseLayers : [customBaseLayer || defaultLayers.baseLayerGrey]; // sets (default) overLayers
|
|
6889
|
+
overLayersWithDefaultLayer = overLayers.length ? overLayers : [customOverLayer || defaultLayers.overLayer];
|
|
6890
|
+
allBaseLayers = [].concat(baseLayersWithDefaultLayer, overLayersWithDefaultLayer).map(function (layer) {
|
|
6891
|
+
return Object.assign({}, layer, {
|
|
6892
|
+
id: webmapUtils.generateLayerId()
|
|
6893
|
+
});
|
|
6894
|
+
});
|
|
6895
|
+
handleBaseLayers(mapId, allBaseLayers, listenerApi);
|
|
6896
|
+
if (!proj) {
|
|
6897
|
+
_context2.next = 20;
|
|
7269
6898
|
break;
|
|
7270
6899
|
}
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
6900
|
+
checkIsprojectionSupported = isProjectionSupported(proj.srs);
|
|
6901
|
+
if (checkIsprojectionSupported) {
|
|
6902
|
+
_context2.next = 19;
|
|
6903
|
+
break;
|
|
6904
|
+
}
|
|
6905
|
+
throw new Error("Projection " + proj.srs + " is not supported");
|
|
6906
|
+
case 19:
|
|
6907
|
+
// set bbox
|
|
6908
|
+
listenerApi.dispatch(mapActions.setBbox({
|
|
6909
|
+
mapId: mapId,
|
|
6910
|
+
bbox: proj.bbox,
|
|
6911
|
+
srs: proj.srs
|
|
6912
|
+
}));
|
|
6913
|
+
case 20:
|
|
6914
|
+
animationLength = animationPayload && animationPayload.duration;
|
|
6915
|
+
animationEndTime = animationPayload && animationPayload.endTime && isAnimationEndTimeValid(animationPayload.endTime) && animationPayload.endTime;
|
|
6916
|
+
shouldEndtimeOverride = animationPayload ? animationPayload.shouldEndtimeOverride : false;
|
|
6917
|
+
if (shouldEndtimeOverride) {
|
|
6918
|
+
// auto update
|
|
6919
|
+
listenerApi.dispatch(mapActions.setEndTimeOverriding({
|
|
6920
|
+
mapId: mapId,
|
|
6921
|
+
shouldEndtimeOverride: shouldEndtimeOverride
|
|
6922
|
+
}));
|
|
6923
|
+
}
|
|
6924
|
+
if (shouldAutoUpdate !== undefined && !animationEndTime) {
|
|
6925
|
+
// auto update
|
|
6926
|
+
listenerApi.dispatch(mapActions.toggleAutoUpdate({
|
|
6927
|
+
mapId: mapId,
|
|
6928
|
+
shouldAutoUpdate: shouldAutoUpdate
|
|
6929
|
+
}));
|
|
6930
|
+
}
|
|
6931
|
+
if (showTimeSlider !== undefined) {
|
|
6932
|
+
// toggle timeslider
|
|
6933
|
+
listenerApi.dispatch(mapActions.toggleTimeSliderIsVisible({
|
|
6934
|
+
mapId: mapId,
|
|
6935
|
+
isTimeSliderVisible: showTimeSlider
|
|
6936
|
+
}));
|
|
6937
|
+
}
|
|
6938
|
+
if (timeSliderSpan !== undefined) {
|
|
6939
|
+
// set timeslider span
|
|
6940
|
+
listenerApi.dispatch(mapActions.setTimeSliderSpan({
|
|
6941
|
+
mapId: mapId,
|
|
6942
|
+
timeSliderSpan: timeSliderSpan
|
|
6943
|
+
}));
|
|
6944
|
+
}
|
|
6945
|
+
if (toggleTimeSpanAuto !== undefined) {
|
|
6946
|
+
// toggle timeslider span auto
|
|
6947
|
+
listenerApi.dispatch(mapActions.toggleTimeSpanAuto({
|
|
6948
|
+
mapId: mapId,
|
|
6949
|
+
timeSpanAuto: toggleTimeSpanAuto
|
|
6950
|
+
}));
|
|
6951
|
+
}
|
|
6952
|
+
if (shouldShowZoomControls !== undefined) {
|
|
6953
|
+
// toggle zoom controls
|
|
6954
|
+
listenerApi.dispatch(mapActions.toggleZoomControls({
|
|
6955
|
+
mapId: mapId,
|
|
6956
|
+
shouldShowZoomControls: shouldShowZoomControls
|
|
6957
|
+
}));
|
|
6958
|
+
}
|
|
6959
|
+
if (displayMapPin !== undefined) {
|
|
6960
|
+
// display map pin
|
|
6961
|
+
listenerApi.dispatch(mapActions.toggleMapPinIsVisible({
|
|
6962
|
+
mapId: mapId,
|
|
6963
|
+
displayMapPin: displayMapPin
|
|
6964
|
+
}));
|
|
6965
|
+
}
|
|
6966
|
+
// sets timestep by interval of animationPayload
|
|
6967
|
+
interval = animationPayload && animationPayload.interval;
|
|
6968
|
+
if (interval) {
|
|
6969
|
+
listenerApi.dispatch(mapActions.setTimeStep({
|
|
6970
|
+
mapId: mapId,
|
|
6971
|
+
timeStep: interval
|
|
6972
|
+
}));
|
|
6973
|
+
}
|
|
6974
|
+
// sets animationEndTime by endTime of animationPayload
|
|
6975
|
+
if (animationEndTime) {
|
|
6976
|
+
endTime = animationEndTime.includes('NOW') || animationEndTime.includes('TODAY') ? dateUtils.convertNOWandTODAYFormatsToUTC(animationEndTime) : animationEndTime;
|
|
6977
|
+
listenerApi.dispatch(mapActions.setAnimationEndTime({
|
|
6978
|
+
mapId: mapId,
|
|
6979
|
+
animationEndTime: handleDateUtilsISOString(endTime)
|
|
6980
|
+
}));
|
|
6981
|
+
startTime = handleDateUtilsISOString(dateUtils.sub(dateUtils.utc(endTime), {
|
|
6982
|
+
minutes: 5 * 60 // set to default of 5 hours
|
|
6983
|
+
}).toISOString());
|
|
6984
|
+
listenerApi.dispatch(mapActions.setAnimationStartTime({
|
|
6985
|
+
mapId: mapId,
|
|
6986
|
+
animationStartTime: startTime
|
|
6987
|
+
}));
|
|
6988
|
+
listenerApi.dispatch(genericActions.setTime({
|
|
6989
|
+
origin: '',
|
|
6990
|
+
sourceId: mapId,
|
|
6991
|
+
value: startTime
|
|
6992
|
+
}));
|
|
6993
|
+
centerTimeInSeconds = new Date(handleDateUtilsISOString(endTime)).getTime();
|
|
6994
|
+
listenerApi.dispatch(mapActions.setTimeSliderCenterTime({
|
|
6995
|
+
mapId: mapId,
|
|
6996
|
+
timeSliderCenterTime: centerTimeInSeconds
|
|
6997
|
+
}));
|
|
6998
|
+
}
|
|
6999
|
+
// sets animationStartTime by duration of animationPayload
|
|
7000
|
+
if (animationLength) {
|
|
7001
|
+
animationEnd = getAnimationEndTime(listenerApi.getState(), mapId);
|
|
7002
|
+
_startTime = handleDateUtilsISOString(dateUtils.sub(dateUtils.utc(animationEnd), {
|
|
7003
|
+
minutes: animationLength
|
|
7004
|
+
}).toISOString());
|
|
7005
|
+
listenerApi.dispatch(mapActions.setAnimationStartTime({
|
|
7006
|
+
mapId: mapId,
|
|
7007
|
+
animationStartTime: _startTime
|
|
7008
|
+
}));
|
|
7009
|
+
listenerApi.dispatch(genericActions.setTime({
|
|
7010
|
+
origin: '',
|
|
7011
|
+
sourceId: mapId,
|
|
7012
|
+
value: _startTime
|
|
7013
|
+
}));
|
|
7014
|
+
}
|
|
7015
|
+
// sets animationDelay by speed of animationPayload
|
|
7016
|
+
if (animationPayload && animationPayload.speed) {
|
|
7017
|
+
listenerApi.dispatch(mapActions.setAnimationDelay({
|
|
7018
|
+
mapId: mapId,
|
|
7019
|
+
animationDelay: getSpeedDelay(animationPayload.speed)
|
|
7020
|
+
}));
|
|
7021
|
+
}
|
|
7022
|
+
// turn animation on
|
|
7023
|
+
if (shouldAnimate === true) {
|
|
7024
|
+
duration = animationPayload && animationPayload.duration ? animationPayload.duration : 5 * 60; // set to default of 5 hours
|
|
7025
|
+
_animationEnd = shouldEndtimeOverride && animationEndTime ? getAnimationEndTime(listenerApi.getState(), mapId) : dateUtils.dateToString(dateUtils.utc(), dateFormat);
|
|
7026
|
+
animationStart = shouldEndtimeOverride && animationLength ? getAnimationStartTime(listenerApi.getState(), mapId) : dateUtils.dateToString(dateUtils.sub(dateUtils.utc(_animationEnd), {
|
|
7027
|
+
minutes: duration
|
|
7028
|
+
}), dateFormat);
|
|
7029
|
+
listenerApi.dispatch(mapActions.mapStartAnimation({
|
|
7030
|
+
mapId: mapId,
|
|
7031
|
+
start: animationStart,
|
|
7032
|
+
end: _animationEnd,
|
|
7033
|
+
interval: interval || defaultTimeStep
|
|
7034
|
+
}));
|
|
7035
|
+
// If animation interval set, set the timestep auto property to false
|
|
7036
|
+
if (interval) {
|
|
7037
|
+
listenerApi.dispatch(mapActions.toggleTimestepAuto({
|
|
7038
|
+
mapId: mapId,
|
|
7039
|
+
timestepAuto: false
|
|
7040
|
+
}));
|
|
7041
|
+
}
|
|
7042
|
+
} else if (toggleTimestepAuto !== undefined) {
|
|
7043
|
+
// Set timestep auto based on preset if animation is off
|
|
7044
|
+
listenerApi.dispatch(mapActions.toggleTimestepAuto({
|
|
7045
|
+
mapId: mapId,
|
|
7046
|
+
timestepAuto: toggleTimestepAuto
|
|
7047
|
+
}));
|
|
7048
|
+
}
|
|
7049
|
+
// show legend
|
|
7050
|
+
shouldOpenLegend = shouldShowLegend !== undefined ? shouldShowLegend : IS_LEGEND_OPEN_BY_DEFAULT;
|
|
7051
|
+
legendId = getLegendId(listenerApi.getState(), mapId);
|
|
7052
|
+
if (legendId) {
|
|
7053
|
+
listenerApi.dispatch(uiActions.setToggleOpenDialog({
|
|
7054
|
+
type: legendId,
|
|
7055
|
+
setOpen: shouldOpenLegend
|
|
7056
|
+
}));
|
|
7276
7057
|
}
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
}));
|
|
7283
|
-
function effect(_x11, _x12) {
|
|
7284
|
-
return _effect6.apply(this, arguments);
|
|
7285
|
-
}
|
|
7286
|
-
return effect;
|
|
7287
|
-
}()
|
|
7288
|
-
});
|
|
7289
|
-
genericListener.startListening({
|
|
7290
|
-
matcher: isAnyOf(mapActions.setAutoLayerId, mapActions.setAutoUpdateLayerId, mapActions.setAutoTimestepLayerId),
|
|
7291
|
-
effect: function () {
|
|
7292
|
-
var _effect7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref7, listenerApi) {
|
|
7293
|
-
var payload, type, targets;
|
|
7294
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
7295
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
7296
|
-
case 0:
|
|
7297
|
-
payload = _ref7.payload, type = _ref7.type;
|
|
7298
|
-
listenerApi.cancelActiveListeners();
|
|
7299
|
-
targets = getSetAutoLayerIdActionsTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
7300
|
-
if (targets && targets.length > 0) {
|
|
7301
|
-
listenerApi.dispatch(setLayerActionSync(payload, targets, type));
|
|
7058
|
+
if (dockedLayerManagerSize) {
|
|
7059
|
+
listenerApi.dispatch(mapActions.setDockedLayerManagerSize({
|
|
7060
|
+
mapId: mapId,
|
|
7061
|
+
dockedLayerManagerSize: dockedLayerManagerSize
|
|
7062
|
+
}));
|
|
7302
7063
|
}
|
|
7303
|
-
case
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
}
|
|
7307
|
-
}, _callee7);
|
|
7308
|
-
}));
|
|
7309
|
-
function effect(_x13, _x14) {
|
|
7310
|
-
return _effect7.apply(this, arguments);
|
|
7311
|
-
}
|
|
7312
|
-
return effect;
|
|
7313
|
-
}()
|
|
7314
|
-
});
|
|
7315
|
-
genericListener.startListening({
|
|
7316
|
-
actionCreator: layerActions.setBaseLayers,
|
|
7317
|
-
effect: function () {
|
|
7318
|
-
var _effect8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref8, listenerApi) {
|
|
7319
|
-
var payload, type, targets;
|
|
7320
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
7321
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
7322
|
-
case 0:
|
|
7323
|
-
payload = _ref8.payload, type = _ref8.type;
|
|
7324
|
-
listenerApi.cancelActiveListeners();
|
|
7325
|
-
/* Should not listen to actions from itself */
|
|
7326
|
-
if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
|
|
7327
|
-
_context8.next = 4;
|
|
7064
|
+
case 40:
|
|
7065
|
+
if (!(animationEndTime && (shouldEndtimeOverride || !(shouldAutoUpdate || shouldAnimate)))) {
|
|
7066
|
+
_context2.next = 50;
|
|
7328
7067
|
break;
|
|
7329
7068
|
}
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7069
|
+
fiveMinuteDelayForAnimation = 1000 * 60 * 5; // eslint-disable-next-line no-await-in-loop
|
|
7070
|
+
_context2.next = 44;
|
|
7071
|
+
return listenerApi.delay(fiveMinuteDelayForAnimation);
|
|
7072
|
+
case 44:
|
|
7073
|
+
_animationEnd2 = getAnimationEndTime(listenerApi.getState(), mapId);
|
|
7074
|
+
listenerApi.dispatch(mapActions.setAnimationEndTime({
|
|
7075
|
+
mapId: mapId,
|
|
7076
|
+
animationEndTime: dateUtils.add(dateUtils.utc(_animationEnd2), {
|
|
7077
|
+
minutes: 5
|
|
7078
|
+
}).toISOString()
|
|
7079
|
+
}));
|
|
7080
|
+
_animationStart = getAnimationStartTime(listenerApi.getState(), mapId);
|
|
7081
|
+
listenerApi.dispatch(mapActions.setAnimationStartTime({
|
|
7082
|
+
mapId: mapId,
|
|
7083
|
+
animationStartTime: dateUtils.add(dateUtils.utc(_animationStart), {
|
|
7084
|
+
minutes: 5
|
|
7085
|
+
}).toISOString()
|
|
7086
|
+
}));
|
|
7087
|
+
_context2.next = 40;
|
|
7088
|
+
break;
|
|
7089
|
+
case 50:
|
|
7090
|
+
_context2.next = 55;
|
|
7091
|
+
break;
|
|
7092
|
+
case 52:
|
|
7093
|
+
_context2.prev = 52;
|
|
7094
|
+
_context2.t0 = _context2["catch"](1);
|
|
7095
|
+
if (_context2.t0 instanceof Error) {
|
|
7096
|
+
listenerApi.dispatch(mapActions.setMapPresetError({
|
|
7097
|
+
mapId: payload.mapId,
|
|
7098
|
+
error: _context2.t0.message
|
|
7099
|
+
}));
|
|
7335
7100
|
}
|
|
7336
|
-
case
|
|
7101
|
+
case 55:
|
|
7337
7102
|
case "end":
|
|
7338
|
-
return
|
|
7103
|
+
return _context2.stop();
|
|
7339
7104
|
}
|
|
7340
|
-
},
|
|
7105
|
+
}, _callee2, null, [[1, 52]]);
|
|
7341
7106
|
}));
|
|
7342
|
-
function effect(
|
|
7343
|
-
return
|
|
7107
|
+
function effect(_x3, _x4) {
|
|
7108
|
+
return _effect2.apply(this, arguments);
|
|
7344
7109
|
}
|
|
7345
7110
|
return effect;
|
|
7346
7111
|
}()
|
|
7347
7112
|
});
|
|
7348
|
-
|
|
7349
|
-
actionCreator:
|
|
7350
|
-
effect: function () {
|
|
7351
|
-
var
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7113
|
+
mapListener.startListening({
|
|
7114
|
+
actionCreator: mapActions.unregisterMap,
|
|
7115
|
+
effect: function effect(_ref7, listenerApi) {
|
|
7116
|
+
var payload = _ref7.payload;
|
|
7117
|
+
var mapId = payload.mapId;
|
|
7118
|
+
var layerList = getLayersByMapId(listenerApi.getState(), mapId);
|
|
7119
|
+
metronome.unregister(mapId);
|
|
7120
|
+
layerList.map(function (layer) {
|
|
7121
|
+
return listenerApi.dispatch(layerActions.layerDelete({
|
|
7122
|
+
mapId: mapId,
|
|
7123
|
+
layerId: layer.id,
|
|
7124
|
+
origin: LayerActionOrigin.unregisterMapListener
|
|
7125
|
+
}));
|
|
7126
|
+
});
|
|
7127
|
+
}
|
|
7128
|
+
});
|
|
7129
|
+
mapListener.startListening({
|
|
7130
|
+
actionCreator: mapActions.setStepBackwardOrForward,
|
|
7131
|
+
effect: function effect(_ref8, listenerApi) {
|
|
7132
|
+
var payload = _ref8.payload;
|
|
7133
|
+
var mapId = payload.mapId,
|
|
7134
|
+
isForwardStep = payload.isForwardStep;
|
|
7135
|
+
var timeStep = getMapTimeStep(listenerApi.getState(), mapId);
|
|
7136
|
+
var currentTime = getSelectedTime(listenerApi.getState(), mapId);
|
|
7137
|
+
var _mapSelectors$getData = getDataLimitsFromLayers(listenerApi.getState(), mapId),
|
|
7138
|
+
dataStartTime = _mapSelectors$getData[0],
|
|
7139
|
+
dataEndTime = _mapSelectors$getData[1];
|
|
7140
|
+
if (dateUtils.isValid(currentTime)) {
|
|
7141
|
+
var makeForwardStep = function makeForwardStep() {
|
|
7142
|
+
var nextTime = currentTime + timeStep;
|
|
7143
|
+
var roundedTime = roundWithTimeStep(nextTime, timeStep, 'ceil');
|
|
7144
|
+
var newTime = Math.min(roundedTime, dataEndTime || roundedTime);
|
|
7145
|
+
return dateUtils.fromUnix(newTime).toISOString();
|
|
7146
|
+
};
|
|
7147
|
+
var makeBackwardStep = function makeBackwardStep() {
|
|
7148
|
+
var nextTime = currentTime - timeStep;
|
|
7149
|
+
var roundedTime = roundWithTimeStep(nextTime, timeStep, 'floor');
|
|
7150
|
+
var newTime = Math.max(roundedTime, dataStartTime || roundedTime);
|
|
7151
|
+
return dateUtils.fromUnix(newTime).toISOString();
|
|
7152
|
+
};
|
|
7153
|
+
var selectedTimeString = isForwardStep ? makeForwardStep() : makeBackwardStep();
|
|
7154
|
+
var isMapAnimating = isAnimating(listenerApi.getState(), mapId);
|
|
7155
|
+
if (isMapAnimating) {
|
|
7156
|
+
listenerApi.dispatch(mapActions.mapStopAnimation({
|
|
7157
|
+
mapId: mapId,
|
|
7158
|
+
origin: MapActionOrigin.map
|
|
7159
|
+
}));
|
|
7160
|
+
}
|
|
7161
|
+
listenerApi.dispatch(genericActions.setTime({
|
|
7162
|
+
origin: '',
|
|
7163
|
+
sourceId: mapId,
|
|
7164
|
+
value: handleDateUtilsISOString(selectedTimeString)
|
|
7165
|
+
}));
|
|
7166
|
+
}
|
|
7167
|
+
}
|
|
7168
|
+
});
|
|
7169
|
+
|
|
7170
|
+
var _excluded = ["url"];
|
|
7171
|
+
var serviceListener = createListenerMiddleware();
|
|
7172
|
+
var fetchService = /*#__PURE__*/function () {
|
|
7173
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(service, listenerApi) {
|
|
7174
|
+
var layers;
|
|
7175
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7176
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7177
|
+
case 0:
|
|
7178
|
+
_context.prev = 0;
|
|
7179
|
+
_context.next = 3;
|
|
7180
|
+
return queryWMSLayers(service.serviceUrl);
|
|
7181
|
+
case 3:
|
|
7182
|
+
layers = _context.sent;
|
|
7183
|
+
listenerApi.dispatch(serviceActions.serviceSetLayers(Object.assign({}, service, {
|
|
7184
|
+
layers: layers
|
|
7185
|
+
})));
|
|
7186
|
+
_context.next = 10;
|
|
7187
|
+
break;
|
|
7188
|
+
case 7:
|
|
7189
|
+
_context.prev = 7;
|
|
7190
|
+
_context.t0 = _context["catch"](0);
|
|
7191
|
+
if (_context.t0 instanceof Error) {
|
|
7192
|
+
console.warn(_context.t0.message);
|
|
7193
|
+
}
|
|
7194
|
+
case 10:
|
|
7195
|
+
case "end":
|
|
7196
|
+
return _context.stop();
|
|
7197
|
+
}
|
|
7198
|
+
}, _callee, null, [[0, 7]]);
|
|
7199
|
+
}));
|
|
7200
|
+
return function fetchService(_x, _x2) {
|
|
7201
|
+
return _ref.apply(this, arguments);
|
|
7202
|
+
};
|
|
7203
|
+
}();
|
|
7204
|
+
var fetchInitialServices = /*#__PURE__*/function () {
|
|
7205
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(payload, listenerApi) {
|
|
7206
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7207
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7208
|
+
case 0:
|
|
7209
|
+
if (!(!payload || !payload.services)) {
|
|
7210
|
+
_context2.next = 2;
|
|
7211
|
+
break;
|
|
7212
|
+
}
|
|
7213
|
+
return _context2.abrupt("return");
|
|
7214
|
+
case 2:
|
|
7215
|
+
_context2.prev = 2;
|
|
7216
|
+
_context2.next = 5;
|
|
7217
|
+
return Promise.all(payload.services.map(function (_ref3) {
|
|
7218
|
+
var url = _ref3.url,
|
|
7219
|
+
service = _objectWithoutPropertiesLoose(_ref3, _excluded);
|
|
7220
|
+
return fetchService(Object.assign({}, service, {
|
|
7221
|
+
serviceUrl: url
|
|
7222
|
+
}), listenerApi);
|
|
7223
|
+
}));
|
|
7224
|
+
case 5:
|
|
7225
|
+
_context2.next = 10;
|
|
7226
|
+
break;
|
|
7227
|
+
case 7:
|
|
7228
|
+
_context2.prev = 7;
|
|
7229
|
+
_context2.t0 = _context2["catch"](2);
|
|
7230
|
+
// eslint-disable-next-line no-console
|
|
7231
|
+
console.warn(_context2.t0);
|
|
7232
|
+
case 10:
|
|
7233
|
+
case "end":
|
|
7234
|
+
return _context2.stop();
|
|
7235
|
+
}
|
|
7236
|
+
}, _callee2, null, [[2, 7]]);
|
|
7237
|
+
}));
|
|
7238
|
+
return function fetchInitialServices(_x3, _x4) {
|
|
7239
|
+
return _ref2.apply(this, arguments);
|
|
7240
|
+
};
|
|
7241
|
+
}();
|
|
7242
|
+
serviceListener.startListening({
|
|
7243
|
+
actionCreator: serviceActions.fetchInitialServices,
|
|
7244
|
+
effect: function () {
|
|
7245
|
+
var _effect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4, listenerApi) {
|
|
7246
|
+
var payload;
|
|
7247
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
7248
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
7355
7249
|
case 0:
|
|
7356
|
-
payload =
|
|
7250
|
+
payload = _ref4.payload;
|
|
7357
7251
|
listenerApi.cancelActiveListeners();
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
_context9.next = 4;
|
|
7361
|
-
break;
|
|
7362
|
-
}
|
|
7363
|
-
return _context9.abrupt("return");
|
|
7252
|
+
_context3.next = 4;
|
|
7253
|
+
return fetchInitialServices(payload, listenerApi);
|
|
7364
7254
|
case 4:
|
|
7365
|
-
targets = getLayerDeleteActionsTargets(listenerApi.getState(), payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
|
|
7366
|
-
if (targets && targets.length > 0) {
|
|
7367
|
-
listenerApi.dispatch(setLayerActionSync(payload, targets, type));
|
|
7368
|
-
}
|
|
7369
|
-
case 6:
|
|
7370
7255
|
case "end":
|
|
7371
|
-
return
|
|
7256
|
+
return _context3.stop();
|
|
7372
7257
|
}
|
|
7373
|
-
},
|
|
7258
|
+
}, _callee3);
|
|
7374
7259
|
}));
|
|
7375
|
-
function effect(
|
|
7376
|
-
return
|
|
7260
|
+
function effect(_x5, _x6) {
|
|
7261
|
+
return _effect.apply(this, arguments);
|
|
7377
7262
|
}
|
|
7378
7263
|
return effect;
|
|
7379
7264
|
}()
|
|
@@ -7408,8 +7293,8 @@ var slice$1 = createSlice({
|
|
|
7408
7293
|
action) {}
|
|
7409
7294
|
}
|
|
7410
7295
|
});
|
|
7411
|
-
var
|
|
7412
|
-
|
|
7296
|
+
var routerReducer = slice$1.reducer,
|
|
7297
|
+
routerActions = slice$1.actions;
|
|
7413
7298
|
|
|
7414
7299
|
/* *
|
|
7415
7300
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -7960,57 +7845,141 @@ drawingToolListener.startListening({
|
|
|
7960
7845
|
}()
|
|
7961
7846
|
});
|
|
7962
7847
|
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
};
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
}
|
|
7848
|
+
var layersListener = createListenerMiddleware();
|
|
7849
|
+
layersListener.startListening({
|
|
7850
|
+
actionCreator: layerActions.showLayerInfo,
|
|
7851
|
+
effect: function () {
|
|
7852
|
+
var _effect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, listenerApi) {
|
|
7853
|
+
var payload, mapId, source, currentActiveMapId, isOpenInStore;
|
|
7854
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7855
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7856
|
+
case 0:
|
|
7857
|
+
payload = _ref.payload;
|
|
7858
|
+
mapId = payload.mapId, source = payload.source;
|
|
7859
|
+
currentActiveMapId = getDialogMapId(listenerApi.getState(), DialogTypes.LayerInfo);
|
|
7860
|
+
isOpenInStore = getisDialogOpen(listenerApi.getState(), DialogTypes.LayerInfo);
|
|
7861
|
+
if (currentActiveMapId !== mapId ? true : !isOpenInStore) {
|
|
7862
|
+
listenerApi.dispatch(uiActions.setActiveMapIdForDialog({
|
|
7863
|
+
type: DialogTypes.LayerInfo,
|
|
7864
|
+
mapId: mapId,
|
|
7865
|
+
setOpen: true,
|
|
7866
|
+
source: source
|
|
7867
|
+
}));
|
|
7868
|
+
}
|
|
7869
|
+
case 5:
|
|
7870
|
+
case "end":
|
|
7871
|
+
return _context.stop();
|
|
7872
|
+
}
|
|
7873
|
+
}, _callee);
|
|
7874
|
+
}));
|
|
7875
|
+
function effect(_x, _x2) {
|
|
7876
|
+
return _effect.apply(this, arguments);
|
|
7877
|
+
}
|
|
7878
|
+
return effect;
|
|
7879
|
+
}()
|
|
7880
|
+
});
|
|
7881
|
+
layersListener.startListening({
|
|
7882
|
+
actionCreator: uiActions.setToggleOpenDialog,
|
|
7883
|
+
effect: function () {
|
|
7884
|
+
var _effect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2, listenerApi) {
|
|
7885
|
+
var payload, setOpen, type, isOpenInStore;
|
|
7886
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7887
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7888
|
+
case 0:
|
|
7889
|
+
payload = _ref2.payload;
|
|
7890
|
+
setOpen = payload.setOpen, type = payload.type; // close LayerInfo if open and LayerManager is closed
|
|
7891
|
+
if (type === DialogTypes.LayerManager && !setOpen) {
|
|
7892
|
+
isOpenInStore = getisDialogOpen(listenerApi.getState(), DialogTypes.LayerInfo);
|
|
7893
|
+
if (isOpenInStore) {
|
|
7894
|
+
listenerApi.dispatch(layerActions.hideLayerInfo());
|
|
7895
|
+
}
|
|
7896
|
+
}
|
|
7897
|
+
case 3:
|
|
7898
|
+
case "end":
|
|
7899
|
+
return _context2.stop();
|
|
7900
|
+
}
|
|
7901
|
+
}, _callee2);
|
|
7902
|
+
}));
|
|
7903
|
+
function effect(_x3, _x4) {
|
|
7904
|
+
return _effect2.apply(this, arguments);
|
|
7905
|
+
}
|
|
7906
|
+
return effect;
|
|
7907
|
+
}()
|
|
7908
|
+
});
|
|
7988
7909
|
|
|
7989
|
-
|
|
7990
|
-
*
|
|
7991
|
-
*
|
|
7992
|
-
*
|
|
7993
|
-
*
|
|
7994
|
-
*
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
7910
|
+
/**
|
|
7911
|
+
* This handler is triggered by the metronome. An array of timerIds is given as argument.
|
|
7912
|
+
* It will update the animation loop of multiple maps and sliders
|
|
7913
|
+
* It will prefetch images for maps
|
|
7914
|
+
* @param timerIds string[] array of timerIds
|
|
7915
|
+
* @param listenerApi ListenerEffectAPI<CoreAppStore, Dispatch, unknown> listenerApi as received from listener
|
|
7916
|
+
*/
|
|
7917
|
+
var metronomeHandler = function metronomeHandler(timerIds, listenerApi) {
|
|
7918
|
+
var targetsWithUpdateValue = [];
|
|
7919
|
+
var _loop = function _loop() {
|
|
7920
|
+
var timerId = _step.value;
|
|
7921
|
+
var animationListValuesNameAndValue = getAnimationList(listenerApi.getState(), timerId);
|
|
7922
|
+
var animationListValues = animationListValuesNameAndValue.map(function (nameAndValue) {
|
|
7923
|
+
return nameAndValue.value;
|
|
7924
|
+
});
|
|
7925
|
+
var targets = getTargets(listenerApi.getState(), {
|
|
7926
|
+
sourceId: timerId,
|
|
7927
|
+
origin: timerId
|
|
7928
|
+
}, SYNCGROUPS_TYPE_SETTIME);
|
|
7929
|
+
if (targets.length === 0) {
|
|
7930
|
+
// When there are no targets, default to one
|
|
7931
|
+
targets.push({
|
|
7932
|
+
targetId: timerId,
|
|
7933
|
+
value: ''
|
|
7934
|
+
});
|
|
7935
|
+
}
|
|
7936
|
+
var timerIsInDwell = handleTimerDwell(timerId, animationListValues.length);
|
|
7937
|
+
var timerShouldStepForward = prefetchAnimationTargetsForMetronome(timerId, animationListValues, targets) && !timerIsInDwell;
|
|
7938
|
+
// Determine the next step
|
|
7939
|
+
var timerStep = timerShouldStepForward ? getNextStep(timerId, animationListValues.length) : getCurrentStep(timerId);
|
|
7940
|
+
setStep(timerId, timerStep);
|
|
7941
|
+
var updatedValue = animationListValues[timerStep];
|
|
7942
|
+
targetsWithUpdateValue.push.apply(targetsWithUpdateValue, targets.map(function (target) {
|
|
7943
|
+
return Object.assign({}, target, {
|
|
7944
|
+
value: updatedValue
|
|
7945
|
+
});
|
|
7946
|
+
}));
|
|
7947
|
+
var speedDelay = getMapAnimationDelay(listenerApi.getState(), timerId);
|
|
7948
|
+
var speed = 1000 / (speedDelay || 1);
|
|
7949
|
+
metronome.setSpeed(timerId, speed);
|
|
7950
|
+
};
|
|
7951
|
+
for (var _iterator = _createForOfIteratorHelperLoose(timerIds), _step; !(_step = _iterator()).done;) {
|
|
7952
|
+
_loop();
|
|
7953
|
+
}
|
|
7954
|
+
// Update all targets of all sync groups in one action.
|
|
7955
|
+
if (targetsWithUpdateValue.length > 0) {
|
|
7956
|
+
listenerApi.dispatch(setTimeSync(null, targetsWithUpdateValue, ['metronomelistener']));
|
|
7957
|
+
}
|
|
8013
7958
|
};
|
|
7959
|
+
var metronomeListener = createListenerMiddleware();
|
|
7960
|
+
metronomeListener.startListening({
|
|
7961
|
+
actionCreator: mapActions.mapStartAnimation,
|
|
7962
|
+
effect: function () {
|
|
7963
|
+
var _effect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_, listenerApi) {
|
|
7964
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7965
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7966
|
+
case 0:
|
|
7967
|
+
// register handler with access to listenerApi
|
|
7968
|
+
metronome.handleTimerTicks = function (timerIds) {
|
|
7969
|
+
metronomeHandler(timerIds, listenerApi);
|
|
7970
|
+
};
|
|
7971
|
+
case 1:
|
|
7972
|
+
case "end":
|
|
7973
|
+
return _context.stop();
|
|
7974
|
+
}
|
|
7975
|
+
}, _callee);
|
|
7976
|
+
}));
|
|
7977
|
+
function effect(_x, _x2) {
|
|
7978
|
+
return _effect.apply(this, arguments);
|
|
7979
|
+
}
|
|
7980
|
+
return effect;
|
|
7981
|
+
}()
|
|
7982
|
+
});
|
|
8014
7983
|
|
|
8015
7984
|
/* *
|
|
8016
7985
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -8391,17 +8360,6 @@ var storeTestUtils = /*#__PURE__*/Object.freeze({
|
|
|
8391
8360
|
webmapStateWithAddedLayer: webmapStateWithAddedLayer
|
|
8392
8361
|
});
|
|
8393
8362
|
|
|
8394
|
-
var synchronizationGroupReducersMap = {
|
|
8395
|
-
syncGroups: reducer$1,
|
|
8396
|
-
loadingIndicator: loadingIndicatorReducer
|
|
8397
|
-
};
|
|
8398
|
-
var synchronizationGroupMiddlewares = [genericListener.middleware, syncGroupsListener.middleware];
|
|
8399
|
-
var synchronizationGroupConfig = {
|
|
8400
|
-
id: 'syncGroups-module',
|
|
8401
|
-
reducersMap: synchronizationGroupReducersMap,
|
|
8402
|
-
middlewares: synchronizationGroupMiddlewares
|
|
8403
|
-
};
|
|
8404
|
-
|
|
8405
8363
|
/* *
|
|
8406
8364
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8407
8365
|
* you may not use this file except in compliance with the License.
|
|
@@ -8415,37 +8373,22 @@ var synchronizationGroupConfig = {
|
|
|
8415
8373
|
* See the License for the specific language governing permissions and
|
|
8416
8374
|
* limitations under the License.
|
|
8417
8375
|
*
|
|
8418
|
-
* Copyright
|
|
8419
|
-
* Copyright
|
|
8376
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8377
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
8420
8378
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
8421
8379
|
* */
|
|
8422
|
-
var
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8380
|
+
var SupportedComponentTypes;
|
|
8381
|
+
(function (SupportedComponentTypes) {
|
|
8382
|
+
SupportedComponentTypes["WarningList"] = "WarningList";
|
|
8383
|
+
SupportedComponentTypes["TimeSeries"] = "TimeSeries";
|
|
8384
|
+
})(SupportedComponentTypes || (SupportedComponentTypes = {}));
|
|
8385
|
+
var supportedComponentTypesForLinking = [SupportedComponentTypes.WarningList, SupportedComponentTypes.TimeSeries];
|
|
8428
8386
|
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8435
|
-
*
|
|
8436
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
8437
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8438
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8439
|
-
* See the License for the specific language governing permissions and
|
|
8440
|
-
* limitations under the License.
|
|
8441
|
-
*
|
|
8442
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8443
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
8444
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
8445
|
-
* */
|
|
8446
|
-
var coreModuleConfig = [mapStoreModuleConfig, synchronizationGroupConfig, uiModuleConfig, drawtoolModuleConfig];
|
|
8447
|
-
var coreModuleReducersMap = Object.assign({}, mapStoreReducers, synchronizationGroupReducersMap, uiReducersMap, drawtoolReducersMap);
|
|
8448
|
-
var coreModuleMiddlewares = [].concat(mapStoreMiddlewares, synchronizationGroupMiddlewares, drawtoolMiddlewares);
|
|
8387
|
+
var constants = /*#__PURE__*/Object.freeze({
|
|
8388
|
+
__proto__: null,
|
|
8389
|
+
get SupportedComponentTypes () { return SupportedComponentTypes; },
|
|
8390
|
+
supportedComponentTypesForLinking: supportedComponentTypesForLinking
|
|
8391
|
+
});
|
|
8449
8392
|
|
|
8450
8393
|
/* *
|
|
8451
8394
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -8460,21 +8403,30 @@ var coreModuleMiddlewares = [].concat(mapStoreMiddlewares, synchronizationGroupM
|
|
|
8460
8403
|
* See the License for the specific language governing permissions and
|
|
8461
8404
|
* limitations under the License.
|
|
8462
8405
|
*
|
|
8463
|
-
* Copyright
|
|
8464
|
-
* Copyright
|
|
8465
|
-
* Copyright
|
|
8406
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8407
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
8408
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
8466
8409
|
* */
|
|
8467
|
-
var
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8410
|
+
var storeReducerMap = {
|
|
8411
|
+
webmap: mapReducer,
|
|
8412
|
+
services: serviceReducer,
|
|
8413
|
+
layers: layerReducer,
|
|
8414
|
+
syncGroups: syncGroupsReducer,
|
|
8415
|
+
loadingIndicator: loadingIndicatorReducer,
|
|
8416
|
+
ui: uiReducer,
|
|
8417
|
+
drawingtools: drawingToolReducer,
|
|
8418
|
+
router: routerReducer
|
|
8419
|
+
};
|
|
8420
|
+
var storeMiddlewares = [mapListener.middleware, serviceListener.middleware, layersListener.middleware, metronomeListener.middleware, syncGroupsListener.middleware, genericListener.middleware, drawingToolListener.middleware, routerListener.middleware];
|
|
8421
|
+
var storeRootReducer = combineReducers(storeReducerMap);
|
|
8422
|
+
var createMockStore = function createMockStore(mockState) {
|
|
8423
|
+
return configureStore({
|
|
8424
|
+
reducer: storeRootReducer,
|
|
8425
|
+
preloadedState: mockState,
|
|
8426
|
+
middleware: function middleware(getDefaultMiddleware) {
|
|
8427
|
+
return getDefaultMiddleware().concat(storeMiddlewares);
|
|
8428
|
+
}
|
|
8429
|
+
});
|
|
8430
|
+
};
|
|
8479
8431
|
|
|
8480
|
-
export { IS_LEGEND_OPEN_BY_DEFAULT,
|
|
8432
|
+
export { IS_LEGEND_OPEN_BY_DEFAULT, createMockStore, drawingToolActions, drawingToolListener, drawingToolReducer, selectors as drawingToolSelectors, filterLayers$1 as filterLayers, genericActions, genericListener, selectors$3 as genericSelectors, types as genericTypes, getSingularDrawtoolDrawLayerId, getUserAddedServices, initialState$2 as initialState, layerActions, layerReducer, selectors$6 as layerSelectors, types$3 as layerTypes, utils$1 as layerUtils, layersListener, constants as linkComponentTypesConstants, loadingIndicatorActions, constants$1 as loadingIndicatorConstants, loadingIndicatorReducer, selectors$2 as loadingIndicatorSelectors, mapActions, enums as mapEnums, mapListener, mapReducer, selectors$1 as mapSelectors, types$4 as mapTypes, mapUtils, metronomeListener, routerActions, routerListener, routerReducer, utils as routerUtils, selectorMemoizationOptions, serviceActions, serviceListener, serviceReducer, selectors$7 as serviceSelectors, types$5 as serviceTypes, setUserAddedServices, storeMiddlewares, storeReducerMap, storeTestSettings, storeTestUtils, utils$3 as storeUtils, constants$2 as syncConstants, syncGroupsActions, syncGroupsListener, syncGroupsReducer, selector as syncGroupsSelector, selectors$4 as syncGroupsSelectors, types$1 as syncGroupsTypes, types$1 as types, uiActions, uiReducer, selectors$5 as uiSelectors, types$2 as uiTypes, useSetupDialog, useUpdateSharedData };
|