@opengeoweb/store 9.22.0 → 9.23.1
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 +255 -265
- package/package.json +1 -1
- package/src/store/drawingtool/listener.d.ts +3 -0
- package/src/store/generic/synchronizationGroups/listener.d.ts +2 -0
- package/src/store/router/listener.d.ts +2 -0
- package/src/store/router/types.d.ts +1 -3
- package/src/store/ui/types.d.ts +2 -1
- package/src/store/drawingtool/sagas.d.ts +0 -7
- package/src/store/generic/synchronizationGroups/sagas.d.ts +0 -8
- package/src/store/router/sagas.d.ts +0 -5
- /package/src/store/drawingtool/{sagas.spec.d.ts → listener.spec.d.ts} +0 -0
- /package/src/store/generic/synchronizationGroups/{sagas.spec.d.ts → listener.spec.d.ts} +0 -0
- /package/src/store/router/{sagas.spec.d.ts → listener.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { webmapUtils, LayerType, getWMJSMapById, WMLayer, webmapTestSettings, getWMSRequests, isProjectionSupported, handleDateUtilsISOString, getCapabilities } from '@opengeoweb/webmap';
|
|
2
|
-
import { createAction, createSlice, createSelector, createEntityAdapter, createListenerMiddleware } from '@reduxjs/toolkit';
|
|
2
|
+
import { createAction, createSlice, createSelector, createEntityAdapter, createListenerMiddleware, isAnyOf } from '@reduxjs/toolkit';
|
|
3
3
|
import { getGeoJson, moveFeature, createInterSections, getLastEmptyFeatureIndex, defaultLayers, emptyGeoJSON, addSelectionTypeToGeoJSON, getFeatureCollection, defaultIntersectionStyleProperties } from '@opengeoweb/webmap-react';
|
|
4
4
|
export { defaultLayers } from '@opengeoweb/webmap-react';
|
|
5
5
|
import { dateUtils, defaultDelay, withEggs } from '@opengeoweb/shared';
|
|
@@ -4635,6 +4635,7 @@ var DialogTypes;
|
|
|
4635
4635
|
DialogTypes["ObjectManager"] = "objectManager";
|
|
4636
4636
|
DialogTypes["PublicWarnings"] = "publicWarnings";
|
|
4637
4637
|
DialogTypes["Search"] = "search";
|
|
4638
|
+
DialogTypes["AreaObjectLoader"] = "areaObjectLoader";
|
|
4638
4639
|
})(DialogTypes || (DialogTypes = {}));
|
|
4639
4640
|
|
|
4640
4641
|
var types$3 = /*#__PURE__*/Object.freeze({
|
|
@@ -4999,17 +5000,7 @@ const setBboxOrTimeSync = (draft, action) => {
|
|
|
4999
5000
|
});
|
|
5000
5001
|
}
|
|
5001
5002
|
};
|
|
5002
|
-
|
|
5003
|
-
syncGroupAddGroup,
|
|
5004
|
-
syncGroupAddSource,
|
|
5005
|
-
syncGroupAddTarget,
|
|
5006
|
-
syncGroupClear,
|
|
5007
|
-
syncGroupLinkTarget,
|
|
5008
|
-
syncGroupRemoveGroup,
|
|
5009
|
-
syncGroupRemoveSource,
|
|
5010
|
-
syncGroupRemoveTarget,
|
|
5011
|
-
syncGroupSetViewState
|
|
5012
|
-
} = slice$4.actions;
|
|
5003
|
+
slice$4.actions;
|
|
5013
5004
|
const {
|
|
5014
5005
|
actions,
|
|
5015
5006
|
reducer: reducer$3
|
|
@@ -8257,7 +8248,7 @@ function* setStepBackwardOrForwardSaga({
|
|
|
8257
8248
|
}));
|
|
8258
8249
|
}
|
|
8259
8250
|
}
|
|
8260
|
-
function* rootSaga$
|
|
8251
|
+
function* rootSaga$2() {
|
|
8261
8252
|
// resets IWMJSMap state
|
|
8262
8253
|
yield takeLatest(mapActions.mapStopAnimation.type, stopAnimationSaga);
|
|
8263
8254
|
yield takeLatest(mapActions.mapStartAnimation.type, startAnimationSaga);
|
|
@@ -8295,7 +8286,7 @@ function* fetchInitialServicesSaga({
|
|
|
8295
8286
|
}));
|
|
8296
8287
|
}));
|
|
8297
8288
|
}
|
|
8298
|
-
function* rootSaga$
|
|
8289
|
+
function* rootSaga$1() {
|
|
8299
8290
|
yield takeEvery(serviceActions.fetchInitialServices, fetchInitialServicesSaga);
|
|
8300
8291
|
}
|
|
8301
8292
|
|
|
@@ -8473,7 +8464,7 @@ const mapStoreReducers = {
|
|
|
8473
8464
|
const mapStoreModuleConfig = {
|
|
8474
8465
|
id: 'webmap-module',
|
|
8475
8466
|
reducersMap: mapStoreReducers,
|
|
8476
|
-
sagas: [rootSaga$
|
|
8467
|
+
sagas: [rootSaga$2, rootSaga$1],
|
|
8477
8468
|
middlewares: [metronomeListener.middleware, layersListener.middleware, mapUiListener.middleware]
|
|
8478
8469
|
};
|
|
8479
8470
|
|
|
@@ -8784,7 +8775,7 @@ function* mapBaseLayerActionsSaga({
|
|
|
8784
8775
|
yield put(setLayerActionSync(payload, targets, type));
|
|
8785
8776
|
}
|
|
8786
8777
|
}
|
|
8787
|
-
function* rootSaga
|
|
8778
|
+
function* rootSaga() {
|
|
8788
8779
|
yield takeLatest(setTime.type, setTimeSaga);
|
|
8789
8780
|
yield takeLatest(setBbox.type, setBBoxSaga);
|
|
8790
8781
|
yield takeLatest(layerActions.layerChangeName.type, layerActionsSaga);
|
|
@@ -8873,18 +8864,19 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
8873
8864
|
* See the License for the specific language governing permissions and
|
|
8874
8865
|
* limitations under the License.
|
|
8875
8866
|
*
|
|
8876
|
-
* Copyright
|
|
8877
|
-
* Copyright
|
|
8867
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8868
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
8878
8869
|
* */
|
|
8879
|
-
|
|
8880
|
-
|
|
8870
|
+
const routerListener = createListenerMiddleware();
|
|
8871
|
+
routerListener.startListening({
|
|
8872
|
+
actionCreator: routerActions.navigateToUrl,
|
|
8873
|
+
effect: ({
|
|
8881
8874
|
payload
|
|
8882
|
-
}
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
}
|
|
8875
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8876
|
+
listenerApi.cancelActiveListeners();
|
|
8877
|
+
historyDict.navigate(payload.url);
|
|
8878
|
+
})
|
|
8879
|
+
});
|
|
8888
8880
|
|
|
8889
8881
|
/* *
|
|
8890
8882
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -8907,7 +8899,7 @@ const routerModuleConfig = {
|
|
|
8907
8899
|
reducersMap: {
|
|
8908
8900
|
router: reducer$1
|
|
8909
8901
|
},
|
|
8910
|
-
|
|
8902
|
+
middlewares: [routerListener.middleware]
|
|
8911
8903
|
};
|
|
8912
8904
|
|
|
8913
8905
|
// reducer utils
|
|
@@ -9133,195 +9125,212 @@ var selectors = /*#__PURE__*/Object.freeze({
|
|
|
9133
9125
|
selectDrawToolById: selectDrawToolById
|
|
9134
9126
|
});
|
|
9135
9127
|
|
|
9128
|
+
const drawingToolListener = createListenerMiddleware();
|
|
9136
9129
|
const registerOrigin = 'drawings saga:registerDrawToolSaga';
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
defaultGeoJSON = emptyGeoJSON,
|
|
9146
|
-
defaultGeoJSONIntersection = emptyGeoJSON,
|
|
9147
|
-
defaultGeoJSONIntersectionBounds,
|
|
9148
|
-
defaultGeoJSONIntersectionProperties = defaultIntersectionStyleProperties
|
|
9149
|
-
} = payload;
|
|
9150
|
-
// create for every drawTool a draw layer
|
|
9151
|
-
if (geoJSONLayerId && mapId) {
|
|
9152
|
-
yield put(mapStoreActions.addLayer({
|
|
9153
|
-
mapId,
|
|
9154
|
-
layer: {
|
|
9155
|
-
// empty geoJSON
|
|
9156
|
-
geojson: defaultGeoJSON,
|
|
9157
|
-
layerType: LayerType.featureLayer
|
|
9158
|
-
},
|
|
9159
|
-
layerId: geoJSONLayerId,
|
|
9160
|
-
origin: registerOrigin
|
|
9161
|
-
}));
|
|
9162
|
-
}
|
|
9163
|
-
// create intersection layer
|
|
9164
|
-
if (geoJSONIntersectionLayerId && mapId) {
|
|
9165
|
-
yield put(mapStoreActions.addLayer({
|
|
9130
|
+
// register draw tool
|
|
9131
|
+
drawingToolListener.startListening({
|
|
9132
|
+
actionCreator: drawtoolActions.registerDrawTool,
|
|
9133
|
+
effect: ({
|
|
9134
|
+
payload
|
|
9135
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9136
|
+
listenerApi.cancelActiveListeners();
|
|
9137
|
+
const {
|
|
9166
9138
|
mapId,
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9170
|
-
|
|
9171
|
-
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
}
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
const existingBoundsLayer = yield select(getLayerById, geoJSONIntersectionBoundsLayerId);
|
|
9179
|
-
// don't add a new boundslayer when another drawtool using that same boundslayer
|
|
9180
|
-
if (!existingBoundsLayer) {
|
|
9181
|
-
yield put(mapStoreActions.addLayer({
|
|
9139
|
+
geoJSONLayerId,
|
|
9140
|
+
geoJSONIntersectionLayerId,
|
|
9141
|
+
geoJSONIntersectionBoundsLayerId,
|
|
9142
|
+
defaultGeoJSON = emptyGeoJSON,
|
|
9143
|
+
defaultGeoJSONIntersection = emptyGeoJSON,
|
|
9144
|
+
defaultGeoJSONIntersectionBounds,
|
|
9145
|
+
defaultGeoJSONIntersectionProperties = defaultIntersectionStyleProperties
|
|
9146
|
+
} = payload;
|
|
9147
|
+
// create for every drawTool a draw layer
|
|
9148
|
+
if (geoJSONLayerId && mapId) {
|
|
9149
|
+
listenerApi.dispatch(mapStoreActions.addLayer({
|
|
9182
9150
|
mapId,
|
|
9183
9151
|
layer: {
|
|
9184
|
-
|
|
9152
|
+
// empty geoJSON
|
|
9153
|
+
geojson: defaultGeoJSON,
|
|
9185
9154
|
layerType: LayerType.featureLayer
|
|
9186
9155
|
},
|
|
9187
|
-
layerId:
|
|
9156
|
+
layerId: geoJSONLayerId,
|
|
9188
9157
|
origin: registerOrigin
|
|
9189
9158
|
}));
|
|
9190
9159
|
}
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
drawModeId,
|
|
9203
|
-
drawToolId,
|
|
9204
|
-
shouldUpdateShape = true
|
|
9205
|
-
} = payload;
|
|
9206
|
-
const drawingTool = yield select(selectDrawToolById, drawToolId);
|
|
9207
|
-
const {
|
|
9208
|
-
shouldAllowMultipleShapes = false,
|
|
9209
|
-
geoJSONIntersectionLayerId,
|
|
9210
|
-
geoJSONIntersectionBoundsLayerId
|
|
9211
|
-
} = drawingTool;
|
|
9212
|
-
const newDrawMode = yield select(getDrawModeById, drawToolId, drawModeId);
|
|
9213
|
-
// disable layer when no new drawmode or when selecting same tool and is selectable
|
|
9214
|
-
if (!newDrawMode || !drawingTool.activeDrawModeId && newDrawMode.isSelectable) {
|
|
9215
|
-
yield put(layerActions.toggleFeatureMode({
|
|
9216
|
-
layerId: drawingTool.geoJSONLayerId,
|
|
9217
|
-
isInEditMode: false,
|
|
9218
|
-
drawMode: ''
|
|
9160
|
+
// create intersection layer
|
|
9161
|
+
if (geoJSONIntersectionLayerId && mapId) {
|
|
9162
|
+
listenerApi.dispatch(mapStoreActions.addLayer({
|
|
9163
|
+
mapId,
|
|
9164
|
+
layer: {
|
|
9165
|
+
geojson: defaultGeoJSONIntersection,
|
|
9166
|
+
layerType: LayerType.featureLayer,
|
|
9167
|
+
defaultGeoJSONProperties: defaultGeoJSONIntersectionProperties
|
|
9168
|
+
},
|
|
9169
|
+
layerId: geoJSONIntersectionLayerId,
|
|
9170
|
+
origin: registerOrigin
|
|
9219
9171
|
}));
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9172
|
+
}
|
|
9173
|
+
// create intersection bounds layer
|
|
9174
|
+
if (geoJSONIntersectionBoundsLayerId && mapId) {
|
|
9175
|
+
const existingBoundsLayer = getLayerById(listenerApi.getState(), geoJSONIntersectionBoundsLayerId);
|
|
9176
|
+
// don't add a new boundslayer when another drawtool using that same boundslayer
|
|
9177
|
+
if (!existingBoundsLayer) {
|
|
9178
|
+
listenerApi.dispatch(mapStoreActions.addLayer({
|
|
9179
|
+
mapId,
|
|
9180
|
+
layer: {
|
|
9181
|
+
geojson: defaultGeoJSONIntersectionBounds,
|
|
9182
|
+
layerType: LayerType.featureLayer
|
|
9183
|
+
},
|
|
9184
|
+
layerId: geoJSONIntersectionBoundsLayerId,
|
|
9185
|
+
origin: registerOrigin
|
|
9230
9186
|
}));
|
|
9231
|
-
|
|
9187
|
+
}
|
|
9188
|
+
listenerApi.dispatch(layerActions.orderLayerToFront({
|
|
9189
|
+
layerId: geoJSONIntersectionBoundsLayerId
|
|
9190
|
+
}));
|
|
9191
|
+
}
|
|
9192
|
+
})
|
|
9193
|
+
});
|
|
9194
|
+
// change draw tool
|
|
9195
|
+
drawingToolListener.startListening({
|
|
9196
|
+
actionCreator: drawtoolActions.changeDrawToolMode,
|
|
9197
|
+
effect: ({
|
|
9198
|
+
payload
|
|
9199
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9200
|
+
var _a, _b, _c;
|
|
9201
|
+
listenerApi.cancelActiveListeners();
|
|
9202
|
+
try {
|
|
9203
|
+
const {
|
|
9204
|
+
drawModeId,
|
|
9205
|
+
drawToolId,
|
|
9206
|
+
shouldUpdateShape = true
|
|
9207
|
+
} = payload;
|
|
9208
|
+
const drawingTool = selectDrawToolById(listenerApi.getState(), drawToolId);
|
|
9209
|
+
if (!drawingTool) {
|
|
9210
|
+
return;
|
|
9211
|
+
}
|
|
9212
|
+
const {
|
|
9213
|
+
shouldAllowMultipleShapes = false,
|
|
9214
|
+
geoJSONIntersectionLayerId,
|
|
9215
|
+
geoJSONIntersectionBoundsLayerId
|
|
9216
|
+
} = drawingTool;
|
|
9217
|
+
const newDrawMode = getDrawModeById(listenerApi.getState(), drawToolId, drawModeId);
|
|
9218
|
+
// disable layer when no new drawmode or when selecting same tool and is selectable
|
|
9219
|
+
if (!newDrawMode || !drawingTool.activeDrawModeId && newDrawMode.isSelectable) {
|
|
9220
|
+
listenerApi.dispatch(layerActions.toggleFeatureMode({
|
|
9232
9221
|
layerId: drawingTool.geoJSONLayerId,
|
|
9233
|
-
|
|
9222
|
+
isInEditMode: false,
|
|
9223
|
+
drawMode: ''
|
|
9234
9224
|
}));
|
|
9225
|
+
const geoJSONLayer = getLayerById(listenerApi.getState(), drawingTool.geoJSONLayerId);
|
|
9226
|
+
const geoJSON = geoJSONLayer === null || geoJSONLayer === void 0 ? void 0 : geoJSONLayer.geojson;
|
|
9227
|
+
const lastFeatureIndex = geoJSON !== undefined ? getLastEmptyFeatureIndex(geoJSON) : undefined;
|
|
9228
|
+
if (lastFeatureIndex !== undefined) {
|
|
9229
|
+
const newGeoJSON = Object.assign(Object.assign({}, geoJSON), {
|
|
9230
|
+
features: geoJSON.features.filter((_feature, index) => index !== lastFeatureIndex)
|
|
9231
|
+
});
|
|
9232
|
+
listenerApi.dispatch(layerActions.updateFeature({
|
|
9233
|
+
layerId: drawingTool.geoJSONLayerId,
|
|
9234
|
+
geojson: newGeoJSON
|
|
9235
|
+
}));
|
|
9236
|
+
listenerApi.dispatch(layerActions.setSelectedFeature({
|
|
9237
|
+
layerId: drawingTool.geoJSONLayerId,
|
|
9238
|
+
selectedFeatureIndex: newGeoJSON.features.length > 0 ? newGeoJSON.features.length - 1 : 0
|
|
9239
|
+
}));
|
|
9240
|
+
}
|
|
9241
|
+
return;
|
|
9235
9242
|
}
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9240
|
-
yield put(layerActions.layerChangeGeojson({
|
|
9241
|
-
layerId: drawingTool.geoJSONLayerId,
|
|
9242
|
-
geojson: emptyGeoJSON
|
|
9243
|
-
}));
|
|
9244
|
-
// clear intersection shape
|
|
9245
|
-
if (geoJSONIntersectionLayerId) {
|
|
9246
|
-
yield put(layerActions.layerChangeGeojson({
|
|
9247
|
-
layerId: geoJSONIntersectionLayerId,
|
|
9243
|
+
// delete shape
|
|
9244
|
+
if (newDrawMode.value === 'DELETE') {
|
|
9245
|
+
listenerApi.dispatch(layerActions.layerChangeGeojson({
|
|
9246
|
+
layerId: drawingTool.geoJSONLayerId,
|
|
9248
9247
|
geojson: emptyGeoJSON
|
|
9249
9248
|
}));
|
|
9249
|
+
// clear intersection shape
|
|
9250
|
+
if (geoJSONIntersectionLayerId) {
|
|
9251
|
+
listenerApi.dispatch(layerActions.layerChangeGeojson({
|
|
9252
|
+
layerId: geoJSONIntersectionLayerId,
|
|
9253
|
+
geojson: emptyGeoJSON
|
|
9254
|
+
}));
|
|
9255
|
+
}
|
|
9256
|
+
listenerApi.dispatch(layerActions.toggleFeatureMode({
|
|
9257
|
+
layerId: drawingTool.geoJSONLayerId,
|
|
9258
|
+
isInEditMode: false,
|
|
9259
|
+
drawMode: ''
|
|
9260
|
+
}));
|
|
9261
|
+
return;
|
|
9250
9262
|
}
|
|
9251
|
-
|
|
9263
|
+
// check tool is selected of existing drawn shape
|
|
9264
|
+
const currentGeoJSONLayer = getLayerById(listenerApi.getState(), drawingTool.geoJSONLayerId);
|
|
9265
|
+
const {
|
|
9266
|
+
geojson: currentGeoJSON,
|
|
9267
|
+
selectedFeatureIndex = 0
|
|
9268
|
+
} = currentGeoJSONLayer || {};
|
|
9269
|
+
const currentSelectionType = (_b = (_a = currentGeoJSON === null || currentGeoJSON === void 0 ? void 0 : currentGeoJSON.features[selectedFeatureIndex]) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.selectionType;
|
|
9270
|
+
const newSelectionType = newDrawMode.selectionType;
|
|
9271
|
+
const isNewToolSelected = currentSelectionType !== newSelectionType;
|
|
9272
|
+
const shouldUpdateNewShape = !((_c = currentGeoJSON === null || currentGeoJSON === void 0 ? void 0 : currentGeoJSON.features) === null || _c === void 0 ? void 0 : _c.length) || isNewToolSelected || !newDrawMode.isSelectable && shouldAllowMultipleShapes;
|
|
9273
|
+
// don't change anything if same tool is selected again
|
|
9274
|
+
if (shouldUpdateNewShape && shouldUpdateShape) {
|
|
9275
|
+
const shapeWithSelectionType = addSelectionTypeToGeoJSON(newDrawMode.shape, newDrawMode.selectionType);
|
|
9276
|
+
const geoJSONFeatureCollection = getFeatureCollection(shapeWithSelectionType, shouldAllowMultipleShapes, currentGeoJSON);
|
|
9277
|
+
const newGeoJSON = getGeoJson(geoJSONFeatureCollection, shouldAllowMultipleShapes);
|
|
9278
|
+
if (shouldAllowMultipleShapes) {
|
|
9279
|
+
moveFeature(currentGeoJSON, newGeoJSON, selectedFeatureIndex, '');
|
|
9280
|
+
}
|
|
9281
|
+
listenerApi.dispatch(layerActions.setSelectedFeature({
|
|
9282
|
+
layerId: drawingTool.geoJSONLayerId,
|
|
9283
|
+
selectedFeatureIndex: newGeoJSON.features.length - 1
|
|
9284
|
+
}));
|
|
9285
|
+
listenerApi.dispatch(layerActions.updateFeature(Object.assign(Object.assign({
|
|
9286
|
+
layerId: drawingTool.geoJSONLayerId,
|
|
9287
|
+
geojson: newGeoJSON
|
|
9288
|
+
}, geoJSONIntersectionLayerId && {
|
|
9289
|
+
geoJSONIntersectionLayerId
|
|
9290
|
+
}), geoJSONIntersectionBoundsLayerId && {
|
|
9291
|
+
geoJSONIntersectionBoundsLayerId
|
|
9292
|
+
})));
|
|
9293
|
+
}
|
|
9294
|
+
listenerApi.dispatch(layerActions.toggleFeatureMode({
|
|
9252
9295
|
layerId: drawingTool.geoJSONLayerId,
|
|
9253
|
-
isInEditMode:
|
|
9254
|
-
drawMode:
|
|
9296
|
+
isInEditMode: newDrawMode.isSelectable,
|
|
9297
|
+
drawMode: newDrawMode.value
|
|
9255
9298
|
}));
|
|
9256
|
-
|
|
9299
|
+
} catch (error) {
|
|
9300
|
+
// eslint-disable-next-line no-console
|
|
9301
|
+
console.log('error changeDrawToolSaga', error);
|
|
9257
9302
|
}
|
|
9258
|
-
|
|
9259
|
-
|
|
9303
|
+
})
|
|
9304
|
+
});
|
|
9305
|
+
// change intersection
|
|
9306
|
+
drawingToolListener.startListening({
|
|
9307
|
+
actionCreator: drawtoolActions.changeIntersectionBounds,
|
|
9308
|
+
effect: ({
|
|
9309
|
+
payload
|
|
9310
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9311
|
+
listenerApi.cancelActiveListeners();
|
|
9260
9312
|
const {
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
} =
|
|
9264
|
-
const
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
const shouldUpdateNewShape = !((_c = currentGeoJSON === null || currentGeoJSON === void 0 ? void 0 : currentGeoJSON.features) === null || _c === void 0 ? void 0 : _c.length) || isNewToolSelected || !newDrawMode.isSelectable && shouldAllowMultipleShapes;
|
|
9268
|
-
// don't change anything if same tool is selected again
|
|
9269
|
-
if (shouldUpdateNewShape && shouldUpdateShape) {
|
|
9270
|
-
const shapeWithSelectionType = addSelectionTypeToGeoJSON(newDrawMode.shape, newDrawMode.selectionType);
|
|
9271
|
-
const geoJSONFeatureCollection = getFeatureCollection(shapeWithSelectionType, shouldAllowMultipleShapes, currentGeoJSON);
|
|
9272
|
-
const newGeoJSON = getGeoJson(geoJSONFeatureCollection, shouldAllowMultipleShapes);
|
|
9273
|
-
if (shouldAllowMultipleShapes) {
|
|
9274
|
-
moveFeature(currentGeoJSON, newGeoJSON, selectedFeatureIndex, '');
|
|
9275
|
-
}
|
|
9276
|
-
yield put(layerActions.setSelectedFeature({
|
|
9277
|
-
layerId: drawingTool.geoJSONLayerId,
|
|
9278
|
-
selectedFeatureIndex: newGeoJSON.features.length - 1
|
|
9279
|
-
}));
|
|
9280
|
-
yield put(layerActions.updateFeature(Object.assign(Object.assign({
|
|
9281
|
-
layerId: drawingTool.geoJSONLayerId,
|
|
9282
|
-
geojson: newGeoJSON
|
|
9283
|
-
}, geoJSONIntersectionLayerId && {
|
|
9284
|
-
geoJSONIntersectionLayerId
|
|
9285
|
-
}), geoJSONIntersectionBoundsLayerId && {
|
|
9286
|
-
geoJSONIntersectionBoundsLayerId
|
|
9287
|
-
})));
|
|
9313
|
+
drawToolId,
|
|
9314
|
+
geoJSON
|
|
9315
|
+
} = payload;
|
|
9316
|
+
const drawtool = selectDrawToolById(listenerApi.getState(), drawToolId);
|
|
9317
|
+
if (!drawtool) {
|
|
9318
|
+
return;
|
|
9288
9319
|
}
|
|
9289
|
-
|
|
9290
|
-
layerId:
|
|
9291
|
-
|
|
9292
|
-
drawMode: newDrawMode.value
|
|
9320
|
+
listenerApi.dispatch(layerActions.layerChangeGeojson({
|
|
9321
|
+
layerId: drawtool.geoJSONIntersectionBoundsLayerId,
|
|
9322
|
+
geojson: geoJSON
|
|
9293
9323
|
}));
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
})
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
geoJSON
|
|
9305
|
-
} = payload;
|
|
9306
|
-
const drawtool = yield select(selectDrawToolById, drawToolId);
|
|
9307
|
-
yield put(layerActions.layerChangeGeojson({
|
|
9308
|
-
layerId: drawtool.geoJSONIntersectionBoundsLayerId,
|
|
9309
|
-
geojson: geoJSON
|
|
9310
|
-
}));
|
|
9311
|
-
yield put(layerActions.layerChangeGeojson({
|
|
9312
|
-
layerId: drawtool.geoJSONLayerId,
|
|
9313
|
-
geojson: emptyGeoJSON
|
|
9314
|
-
}));
|
|
9315
|
-
yield put(layerActions.layerChangeGeojson({
|
|
9316
|
-
layerId: drawtool.geoJSONIntersectionLayerId,
|
|
9317
|
-
geojson: emptyGeoJSON
|
|
9318
|
-
}));
|
|
9319
|
-
}
|
|
9320
|
-
function* drawingSaga() {
|
|
9321
|
-
yield takeLatest(drawtoolActions.registerDrawTool, registerDrawToolSaga);
|
|
9322
|
-
yield takeLatest(drawtoolActions.changeDrawToolMode, changeDrawToolSaga);
|
|
9323
|
-
yield takeLatest(drawtoolActions.changeIntersectionBounds, changeIntersectionSaga);
|
|
9324
|
-
}
|
|
9324
|
+
listenerApi.dispatch(layerActions.layerChangeGeojson({
|
|
9325
|
+
layerId: drawtool.geoJSONLayerId,
|
|
9326
|
+
geojson: emptyGeoJSON
|
|
9327
|
+
}));
|
|
9328
|
+
listenerApi.dispatch(layerActions.layerChangeGeojson({
|
|
9329
|
+
layerId: drawtool.geoJSONIntersectionLayerId,
|
|
9330
|
+
geojson: emptyGeoJSON
|
|
9331
|
+
}));
|
|
9332
|
+
})
|
|
9333
|
+
});
|
|
9325
9334
|
|
|
9326
9335
|
/* *
|
|
9327
9336
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -9344,7 +9353,7 @@ const drawtoolModuleConfig = {
|
|
|
9344
9353
|
reducersMap: {
|
|
9345
9354
|
drawingtools: reducer
|
|
9346
9355
|
},
|
|
9347
|
-
|
|
9356
|
+
middlewares: [drawingToolListener.middleware]
|
|
9348
9357
|
};
|
|
9349
9358
|
|
|
9350
9359
|
/* *
|
|
@@ -9645,77 +9654,57 @@ var storeTestUtils = /*#__PURE__*/Object.freeze({
|
|
|
9645
9654
|
* See the License for the specific language governing permissions and
|
|
9646
9655
|
* limitations under the License.
|
|
9647
9656
|
*
|
|
9648
|
-
* Copyright
|
|
9649
|
-
* Copyright
|
|
9657
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
9658
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
9650
9659
|
* */
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9660
|
+
const syncGroupsListener = createListenerMiddleware();
|
|
9661
|
+
syncGroupsListener.startListening({
|
|
9662
|
+
matcher: isAnyOf(actions.syncGroupAddTarget, actions.syncGroupLinkTarget),
|
|
9663
|
+
effect: ({
|
|
9664
|
+
payload
|
|
9665
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9666
|
+
listenerApi.cancelActiveListeners();
|
|
9667
|
+
const {
|
|
9668
|
+
groupId,
|
|
9669
|
+
linked,
|
|
9670
|
+
targetId: targetToUpdate
|
|
9671
|
+
} = payload;
|
|
9672
|
+
const group = getSynchronizationGroup(listenerApi.getState(), groupId);
|
|
9673
|
+
if (!linked && group) {
|
|
9674
|
+
switch (group.type) {
|
|
9675
|
+
case SYNCGROUPS_TYPE_SETTIME:
|
|
9676
|
+
if (!group.payloadByType[SYNCGROUPS_TYPE_SETTIME]) {
|
|
9677
|
+
return;
|
|
9678
|
+
}
|
|
9679
|
+
listenerApi.dispatch(setTimeSync(group.payloadByType[SYNCGROUPS_TYPE_SETTIME], [{
|
|
9680
|
+
targetId: targetToUpdate,
|
|
9681
|
+
value: group.payloadByType[SYNCGROUPS_TYPE_SETTIME].value
|
|
9682
|
+
}], [groupId]));
|
|
9683
|
+
break;
|
|
9684
|
+
case SYNCGROUPS_TYPE_SETBBOX:
|
|
9685
|
+
if (!group.payloadByType[SYNCGROUPS_TYPE_SETBBOX]) {
|
|
9686
|
+
return;
|
|
9687
|
+
}
|
|
9688
|
+
listenerApi.dispatch(setBboxSync(group.payloadByType[SYNCGROUPS_TYPE_SETBBOX], [{
|
|
9689
|
+
targetId: targetToUpdate,
|
|
9690
|
+
bbox: group.payloadByType[SYNCGROUPS_TYPE_SETBBOX].bbox,
|
|
9691
|
+
srs: group.payloadByType[SYNCGROUPS_TYPE_SETBBOX].srs
|
|
9692
|
+
}], [groupId]));
|
|
9693
|
+
break;
|
|
9669
9694
|
}
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
})
|
|
9681
|
-
|
|
9682
|
-
|
|
9683
|
-
linked,
|
|
9684
|
-
targetId: targetToUpdate
|
|
9685
|
-
} = payload;
|
|
9686
|
-
if (!linked) {
|
|
9687
|
-
yield call$e(updateSourceValueWhenLinkingComponentToGroupSaga, groupId, targetToUpdate);
|
|
9688
|
-
}
|
|
9689
|
-
}
|
|
9690
|
-
function* linkGroupTargetSaga({
|
|
9691
|
-
payload
|
|
9692
|
-
}) {
|
|
9693
|
-
const {
|
|
9694
|
-
groupId,
|
|
9695
|
-
linked,
|
|
9696
|
-
targetId: targetToUpdate
|
|
9697
|
-
} = payload;
|
|
9698
|
-
if (!linked) {
|
|
9699
|
-
yield call$e(updateSourceValueWhenLinkingComponentToGroupSaga, groupId, targetToUpdate);
|
|
9700
|
-
}
|
|
9701
|
-
}
|
|
9702
|
-
function* updateViewStateSaga() {
|
|
9703
|
-
const viewState = yield select(createSyncGroupViewStateSelector);
|
|
9704
|
-
yield put(syncGroupSetViewState({
|
|
9705
|
-
viewState
|
|
9706
|
-
}));
|
|
9707
|
-
}
|
|
9708
|
-
function* rootSaga() {
|
|
9709
|
-
yield takeLatest(syncGroupAddTarget.type, addGroupTargetSaga);
|
|
9710
|
-
yield takeLatest(syncGroupLinkTarget.type, linkGroupTargetSaga);
|
|
9711
|
-
yield takeLatest(syncGroupAddGroup.type, updateViewStateSaga);
|
|
9712
|
-
yield takeLatest(syncGroupRemoveGroup.type, updateViewStateSaga);
|
|
9713
|
-
yield takeLatest(syncGroupAddSource.type, updateViewStateSaga);
|
|
9714
|
-
yield takeLatest(syncGroupRemoveSource.type, updateViewStateSaga);
|
|
9715
|
-
yield takeLatest(syncGroupAddTarget.type, updateViewStateSaga);
|
|
9716
|
-
yield takeLatest(syncGroupRemoveTarget.type, updateViewStateSaga);
|
|
9717
|
-
yield takeLatest(syncGroupLinkTarget.type, updateViewStateSaga);
|
|
9718
|
-
}
|
|
9695
|
+
}
|
|
9696
|
+
})
|
|
9697
|
+
});
|
|
9698
|
+
syncGroupsListener.startListening({
|
|
9699
|
+
matcher: isAnyOf(actions.syncGroupAddGroup, actions.syncGroupRemoveGroup, actions.syncGroupAddSource, actions.syncGroupRemoveSource, actions.syncGroupAddTarget, actions.syncGroupRemoveTarget, actions.syncGroupLinkTarget),
|
|
9700
|
+
effect: (_, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9701
|
+
listenerApi.cancelActiveListeners();
|
|
9702
|
+
const viewState = createSyncGroupViewStateSelector(listenerApi.getState());
|
|
9703
|
+
listenerApi.dispatch(actions.syncGroupSetViewState({
|
|
9704
|
+
viewState
|
|
9705
|
+
}));
|
|
9706
|
+
})
|
|
9707
|
+
});
|
|
9719
9708
|
|
|
9720
9709
|
const synchronizationGroupConfig = {
|
|
9721
9710
|
id: 'syncronizationGroupStore-module',
|
|
@@ -9723,7 +9712,8 @@ const synchronizationGroupConfig = {
|
|
|
9723
9712
|
syncronizationGroupStore: reducer$3,
|
|
9724
9713
|
loadingIndicatorStore: loadingIndicatorReducer
|
|
9725
9714
|
},
|
|
9726
|
-
sagas: [rootSaga
|
|
9715
|
+
sagas: [rootSaga],
|
|
9716
|
+
middlewares: [syncGroupsListener.middleware]
|
|
9727
9717
|
};
|
|
9728
9718
|
|
|
9729
9719
|
/* *
|
|
@@ -9792,4 +9782,4 @@ const StoreProvider = ({
|
|
|
9792
9782
|
})
|
|
9793
9783
|
}));
|
|
9794
9784
|
|
|
9795
|
-
export { IS_LEGEND_OPEN_BY_DEFAULT, StoreProvider, coreModuleConfig, createStore, drawtoolActions, drawtoolModuleConfig, reducer as drawtoolReducer, selectors as drawtoolSelectors, filterLayers$1 as filterLayers, genericActions, rootSaga
|
|
9785
|
+
export { IS_LEGEND_OPEN_BY_DEFAULT, StoreProvider, coreModuleConfig, createStore, drawtoolActions, drawtoolModuleConfig, reducer as drawtoolReducer, selectors as drawtoolSelectors, filterLayers$1 as filterLayers, genericActions, rootSaga as genericSaga, selectors$4 as genericSelectors, types$1 as genericTypes, getSingularDrawtoolDrawLayerId, getUserAddedServices, initialState$3 as initialState, layerActions, reducer$6 as layerReducer, selectors$7 as layerSelectors, types$5 as layerTypes, utils$2 as layerUtils, loadingIndicatorActions, constants as loadingIndicatorConstants, loadingIndicatorReducer, selectors$3 as loadingIndicatorSelectors, mapActions, enums as mapEnums, rootSaga$2 as mapSaga, selectors$2 as mapSelectors, mapStoreActions, mapStoreModuleConfig, mapStoreReducers, types$4 as mapTypes, mapUtils, routerActions, routerModuleConfig, utils as routerUtils, selectorMemoizationOptions, serviceActions, selectors$1 as serviceSelectors, types as serviceTypes, setUserAddedServices, storeTestSettings, storeTestUtils, utils$1 as storeUtils, constants$1 as syncConstants, actions as syncGroupsActions, reducer$3 as syncGroupsReducer, selector as syncGroupsSelector, selectors$5 as syncGroupsSelectors, types$2 as syncGroupsTypes, types$2 as types, uiActions, uiModuleConfig, reducer$5 as uiReducer, selectors$6 as uiSelectors, types$3 as uiTypes, useSetupDialog, reducer$4 as webmapReducer };
|
package/package.json
CHANGED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DrawtoolModuleStore } from './reducer';
|
|
2
|
+
import { WebMapStateModuleState } from '../mapStore';
|
|
3
|
+
export declare const drawingToolListener: import("@reduxjs/toolkit").ListenerMiddlewareInstance<DrawtoolModuleStore & WebMapStateModuleState, import("@reduxjs/toolkit").ThunkDispatch<DrawtoolModuleStore & WebMapStateModuleState, unknown, import("redux").AnyAction>, unknown>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { SynchronizationGroupModuleState } from './types';
|
|
2
|
+
export declare const syncGroupsListener: import("@reduxjs/toolkit").ListenerMiddlewareInstance<SynchronizationGroupModuleState, import("@reduxjs/toolkit").ThunkDispatch<SynchronizationGroupModuleState, unknown, import("redux").AnyAction>, unknown>;
|
package/src/store/ui/types.d.ts
CHANGED
|
@@ -16,7 +16,8 @@ export declare enum DialogTypes {
|
|
|
16
16
|
DockedLayerManager = "dockedLayerManager",
|
|
17
17
|
ObjectManager = "objectManager",
|
|
18
18
|
PublicWarnings = "publicWarnings",
|
|
19
|
-
Search = "search"
|
|
19
|
+
Search = "search",
|
|
20
|
+
AreaObjectLoader = "areaObjectLoader"
|
|
20
21
|
}
|
|
21
22
|
export type DialogType = DialogTypes | LegendDialogType | GetFeatureInfoDialogType;
|
|
22
23
|
export type { Source };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SagaIterator } from 'redux-saga';
|
|
2
|
-
import { drawtoolActions } from './reducer';
|
|
3
|
-
export declare function registerDrawToolSaga({ payload, }: ReturnType<typeof drawtoolActions.registerDrawTool>): SagaIterator;
|
|
4
|
-
export declare function changeDrawToolSaga({ payload, }: ReturnType<typeof drawtoolActions.changeDrawToolMode>): SagaIterator;
|
|
5
|
-
export declare function changeIntersectionSaga({ payload, }: ReturnType<typeof drawtoolActions.changeIntersectionBounds>): SagaIterator;
|
|
6
|
-
declare function drawingSaga(): SagaIterator;
|
|
7
|
-
export default drawingSaga;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SagaIterator } from 'redux-saga';
|
|
2
|
-
import * as synchronizationGroupActions from './reducer';
|
|
3
|
-
export declare function updateSourceValueWhenLinkingComponentToGroupSaga(groupId: string, targetToUpdate: string): SagaIterator;
|
|
4
|
-
export declare function addGroupTargetSaga({ payload, }: ReturnType<typeof synchronizationGroupActions.syncGroupAddTarget>): SagaIterator;
|
|
5
|
-
export declare function linkGroupTargetSaga({ payload, }: ReturnType<typeof synchronizationGroupActions.syncGroupLinkTarget>): SagaIterator;
|
|
6
|
-
export declare function updateViewStateSaga(): SagaIterator;
|
|
7
|
-
declare function rootSaga(): SagaIterator;
|
|
8
|
-
export default rootSaga;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|