@opengeoweb/store 19.4.0 → 19.5.1-nightly-20260831
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/dist/index.esm.js +126 -64
- package/dist/src/store/map/layer/reducer.d.ts +3 -1
- package/dist/src/store/map/layer/selectors.d.ts +10 -10
- package/dist/src/store/map/layer/types.d.ts +3 -0
- package/dist/src/store/map/layer/utils.d.ts +18 -0
- package/dist/src/store/ui/types.d.ts +2 -2
- package/package.json +46 -45
package/dist/index.esm.js
CHANGED
|
@@ -7,6 +7,7 @@ import { secondsPerPxFromCanvasWidth, defaultTimeSpan, defaultSecondsPerPx, defa
|
|
|
7
7
|
import { produce } from 'immer';
|
|
8
8
|
import { getLastEmptyFeatureIndex, getGeoJson, moveFeature, createInterSections, defaultLayers, fetchStacCatalogRoot, stacCatalogCollectionToLayerProps, fetchStacCatalogCollections, emptyGeoJSON, defaultIntersectionStyleProperties, addSelectionTypeToGeoJSON, getFeatureCollection } from '@opengeoweb/webmap-react';
|
|
9
9
|
export { defaultLayers } from '@opengeoweb/webmap-react';
|
|
10
|
+
import { v4 } from 'uuid';
|
|
10
11
|
import React, { useEffect, useRef, useCallback } from 'react';
|
|
11
12
|
import { useDispatch, useSelector, shallowEqual, useStore } from 'react-redux';
|
|
12
13
|
import { center } from '@turf/turf';
|
|
@@ -1273,6 +1274,48 @@ var types$2 = /*#__PURE__*/Object.freeze({
|
|
|
1273
1274
|
get LayerStatus () { return LayerStatus; }
|
|
1274
1275
|
});
|
|
1275
1276
|
|
|
1277
|
+
var trimTrailingSlashes = function trimTrailingSlashes(url) {
|
|
1278
|
+
return url.replace(/\/+$/, '');
|
|
1279
|
+
};
|
|
1280
|
+
var getSTACServiceRootUrl = function getSTACServiceRootUrl(serviceUrl) {
|
|
1281
|
+
return trimTrailingSlashes(serviceUrl).replace(/\/collections\/[^/]+$/, '');
|
|
1282
|
+
};
|
|
1283
|
+
var getTrailingSlashVariant = function getTrailingSlashVariant(url) {
|
|
1284
|
+
return url.endsWith('/') ? url.slice(0, -1) : "".concat(url, "/");
|
|
1285
|
+
};
|
|
1286
|
+
/**
|
|
1287
|
+
* Generates a unique id for a geoJSON feature. Feature ids need to be stable
|
|
1288
|
+
* over the lifetime of a feature (also when other features are added or
|
|
1289
|
+
* removed), because they are used to select features and to link feature
|
|
1290
|
+
* properties (eg objectName) to form fields.
|
|
1291
|
+
* @returns unique feature id
|
|
1292
|
+
*/
|
|
1293
|
+
var generateFeatureId = function generateFeatureId() {
|
|
1294
|
+
return "drawFeature-".concat(v4());
|
|
1295
|
+
};
|
|
1296
|
+
/**
|
|
1297
|
+
* Makes sure every feature in the featurecollection has a unique id. Existing
|
|
1298
|
+
* unique ids are preserved, missing or duplicate ids are (re)generated.
|
|
1299
|
+
* @param geojson The featurecollection to add ids to
|
|
1300
|
+
* @returns featurecollection where every feature has a unique id
|
|
1301
|
+
*/
|
|
1302
|
+
var ensureFeatureIds = function ensureFeatureIds(geojson) {
|
|
1303
|
+
var usedIds = new Set();
|
|
1304
|
+
return _objectSpread2(_objectSpread2({}, geojson), {}, {
|
|
1305
|
+
features: geojson.features.map(function (feature) {
|
|
1306
|
+
var currentId = feature.id !== undefined && feature.id !== null ? String(feature.id) : undefined;
|
|
1307
|
+
if (currentId !== undefined && !usedIds.has(currentId)) {
|
|
1308
|
+
usedIds.add(currentId);
|
|
1309
|
+
return feature;
|
|
1310
|
+
}
|
|
1311
|
+
var newId = generateFeatureId();
|
|
1312
|
+
usedIds.add(newId);
|
|
1313
|
+
return _objectSpread2(_objectSpread2({}, feature), {}, {
|
|
1314
|
+
id: newId
|
|
1315
|
+
});
|
|
1316
|
+
})
|
|
1317
|
+
});
|
|
1318
|
+
};
|
|
1276
1319
|
var getFeatureSelectionKey = function getFeatureSelectionKey(feature) {
|
|
1277
1320
|
var _feature$properties;
|
|
1278
1321
|
if (!feature) {
|
|
@@ -1496,14 +1539,19 @@ var updateMinMaxValueWhenReferenceTimeChanges = function updateMinMaxValueWhenRe
|
|
|
1496
1539
|
|
|
1497
1540
|
var utils$1 = /*#__PURE__*/Object.freeze({
|
|
1498
1541
|
__proto__: null,
|
|
1542
|
+
ensureFeatureIds: ensureFeatureIds,
|
|
1499
1543
|
filterCurrentValueFromDimensions: filterCurrentValueFromDimensions,
|
|
1500
1544
|
filterNonTimeDimensions: filterNonTimeDimensions,
|
|
1545
|
+
generateFeatureId: generateFeatureId,
|
|
1501
1546
|
getFeatureSelectionKey: getFeatureSelectionKey,
|
|
1547
|
+
getSTACServiceRootUrl: getSTACServiceRootUrl,
|
|
1502
1548
|
getSelectedFeatureIndexByIds: getSelectedFeatureIndexByIds,
|
|
1549
|
+
getTrailingSlashVariant: getTrailingSlashVariant,
|
|
1503
1550
|
isActionLayerSynced: isActionLayerSynced,
|
|
1504
1551
|
produceDimensionActionForMapLayer: produceDimensionActionForMapLayer,
|
|
1505
1552
|
produceDraftStateForAllLayersForDimensionWithinMap: produceDraftStateForAllLayersForDimensionWithinMap,
|
|
1506
1553
|
shouldResetCurrentValueToParsedValue: shouldResetCurrentValueToParsedValue,
|
|
1554
|
+
trimTrailingSlashes: trimTrailingSlashes,
|
|
1507
1555
|
updateMinMaxValueWhenReferenceTimeChanges: updateMinMaxValueWhenReferenceTimeChanges
|
|
1508
1556
|
});
|
|
1509
1557
|
|
|
@@ -2029,14 +2077,7 @@ var slice$7 = createSlice({
|
|
|
2029
2077
|
nextSelectedFeatureIndex = newFeatureIndex;
|
|
2030
2078
|
}
|
|
2031
2079
|
}
|
|
2032
|
-
var updatedGeoJSONWithIds = shouldAllowMultipleShapes ?
|
|
2033
|
-
features: updatedGeoJSON.features.map(function (feature, index) {
|
|
2034
|
-
return _objectSpread2(_objectSpread2({}, feature), {}, {
|
|
2035
|
-
// Save the index as id so we can use it to select features
|
|
2036
|
-
id: index
|
|
2037
|
-
});
|
|
2038
|
-
})
|
|
2039
|
-
}) : updatedGeoJSON;
|
|
2080
|
+
var updatedGeoJSONWithIds = shouldAllowMultipleShapes ? ensureFeatureIds(updatedGeoJSON) : updatedGeoJSON;
|
|
2040
2081
|
currentLayer.geojson = updatedGeoJSONWithIds;
|
|
2041
2082
|
if (nextSelectedFeatureIndex !== undefined) {
|
|
2042
2083
|
var selectedFeature = updatedGeoJSONWithIds.features[nextSelectedFeatureIndex];
|
|
@@ -2075,11 +2116,47 @@ var slice$7 = createSlice({
|
|
|
2075
2116
|
});
|
|
2076
2117
|
}
|
|
2077
2118
|
},
|
|
2078
|
-
|
|
2119
|
+
deleteFeature: function deleteFeature(draft, action) {
|
|
2120
|
+
var _currentLayer$geojson3, _currentLayer$selecte, _currentLayer$hovered;
|
|
2079
2121
|
var _action$payload21 = action.payload,
|
|
2080
2122
|
layerId = _action$payload21.layerId,
|
|
2081
|
-
|
|
2082
|
-
|
|
2123
|
+
featureId = _action$payload21.featureId;
|
|
2124
|
+
var currentLayer = draft.byId[layerId];
|
|
2125
|
+
if (!(currentLayer !== null && currentLayer !== void 0 && (_currentLayer$geojson3 = currentLayer.geojson) !== null && _currentLayer$geojson3 !== void 0 && _currentLayer$geojson3.features.length)) {
|
|
2126
|
+
return;
|
|
2127
|
+
}
|
|
2128
|
+
var features = currentLayer.geojson.features;
|
|
2129
|
+
var featureIndex = features.findIndex(function (feature) {
|
|
2130
|
+
return getFeatureSelectionKey(feature) === featureId;
|
|
2131
|
+
});
|
|
2132
|
+
if (featureIndex < 0) {
|
|
2133
|
+
return;
|
|
2134
|
+
}
|
|
2135
|
+
currentLayer.geojson = _objectSpread2(_objectSpread2({}, currentLayer.geojson), {}, {
|
|
2136
|
+
features: features.filter(function (_feature, index) {
|
|
2137
|
+
return index !== featureIndex;
|
|
2138
|
+
})
|
|
2139
|
+
});
|
|
2140
|
+
var wasSelected = !!((_currentLayer$selecte = currentLayer.selectedFeatureIds) !== null && _currentLayer$selecte !== void 0 && _currentLayer$selecte.includes(featureId));
|
|
2141
|
+
if (wasSelected) {
|
|
2142
|
+
currentLayer.selectedFeatureIds = currentLayer.selectedFeatureIds.filter(function (selectedFeatureId) {
|
|
2143
|
+
return selectedFeatureId !== featureId;
|
|
2144
|
+
});
|
|
2145
|
+
// deleting the feature being edited should also end the edit mode
|
|
2146
|
+
if (!currentLayer.selectedFeatureIds.length) {
|
|
2147
|
+
currentLayer.isInEditMode = false;
|
|
2148
|
+
currentLayer.drawMode = '';
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
currentLayer.hoveredFeatureIds = (_currentLayer$hovered = currentLayer.hoveredFeatureIds) === null || _currentLayer$hovered === void 0 ? void 0 : _currentLayer$hovered.filter(function (hoveredFeatureId) {
|
|
2152
|
+
return hoveredFeatureId !== featureId;
|
|
2153
|
+
});
|
|
2154
|
+
},
|
|
2155
|
+
toggleFeatureMode: function toggleFeatureMode(draft, action) {
|
|
2156
|
+
var _action$payload22 = action.payload,
|
|
2157
|
+
layerId = _action$payload22.layerId,
|
|
2158
|
+
isInEditMode = _action$payload22.isInEditMode,
|
|
2159
|
+
drawMode = _action$payload22.drawMode;
|
|
2083
2160
|
if (!draft.byId[layerId]) {
|
|
2084
2161
|
return;
|
|
2085
2162
|
}
|
|
@@ -2091,10 +2168,10 @@ var slice$7 = createSlice({
|
|
|
2091
2168
|
}
|
|
2092
2169
|
},
|
|
2093
2170
|
exitFeatureDrawMode: function exitFeatureDrawMode(draft, action) {
|
|
2094
|
-
var _action$
|
|
2095
|
-
layerId = _action$
|
|
2096
|
-
shouldAllowMultipleShapes = _action$
|
|
2097
|
-
reason = _action$
|
|
2171
|
+
var _action$payload23 = action.payload,
|
|
2172
|
+
layerId = _action$payload23.layerId,
|
|
2173
|
+
shouldAllowMultipleShapes = _action$payload23.shouldAllowMultipleShapes,
|
|
2174
|
+
reason = _action$payload23.reason;
|
|
2098
2175
|
if (!draft.byId[layerId]) {
|
|
2099
2176
|
return;
|
|
2100
2177
|
}
|
|
@@ -2130,10 +2207,10 @@ var slice$7 = createSlice({
|
|
|
2130
2207
|
},
|
|
2131
2208
|
// layer info actions
|
|
2132
2209
|
showLayerInfo: function showLayerInfo(draft, action) {
|
|
2133
|
-
var _action$
|
|
2134
|
-
serviceUrl = _action$
|
|
2135
|
-
layerName = _action$
|
|
2136
|
-
style = _action$
|
|
2210
|
+
var _action$payload24 = action.payload,
|
|
2211
|
+
serviceUrl = _action$payload24.serviceUrl,
|
|
2212
|
+
layerName = _action$payload24.layerName,
|
|
2213
|
+
style = _action$payload24.style;
|
|
2137
2214
|
draft.activeLayerInfo = {
|
|
2138
2215
|
serviceUrl: serviceUrl,
|
|
2139
2216
|
layerName: layerName,
|
|
@@ -2144,9 +2221,9 @@ var slice$7 = createSlice({
|
|
|
2144
2221
|
delete draft.activeLayerInfo;
|
|
2145
2222
|
},
|
|
2146
2223
|
SetLayerLegendVisibilityPayload: function SetLayerLegendVisibilityPayload(draft, action) {
|
|
2147
|
-
var _action$
|
|
2148
|
-
layerId = _action$
|
|
2149
|
-
showLayerLegend = _action$
|
|
2224
|
+
var _action$payload25 = action.payload,
|
|
2225
|
+
layerId = _action$payload25.layerId,
|
|
2226
|
+
showLayerLegend = _action$payload25.showLayerLegend;
|
|
2150
2227
|
var layer = draft.byId[layerId];
|
|
2151
2228
|
if (!layer) {
|
|
2152
2229
|
return;
|
|
@@ -2159,9 +2236,9 @@ var slice$7 = createSlice({
|
|
|
2159
2236
|
},
|
|
2160
2237
|
extraReducers: function extraReducers(builder) {
|
|
2161
2238
|
builder.addCase(setTimeSync, function (draft, action) {
|
|
2162
|
-
var _action$
|
|
2163
|
-
targetsFromAction = _action$
|
|
2164
|
-
source = _action$
|
|
2239
|
+
var _action$payload26 = action.payload,
|
|
2240
|
+
targetsFromAction = _action$payload26.targets,
|
|
2241
|
+
source = _action$payload26.source;
|
|
2165
2242
|
/* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
|
|
2166
2243
|
var targets = [];
|
|
2167
2244
|
if (source) {
|
|
@@ -2191,9 +2268,9 @@ var slice$7 = createSlice({
|
|
|
2191
2268
|
* These targets can be used as payloads in new Layer actions.
|
|
2192
2269
|
* These actions are here handled via the layer reducer, as it is the same logic
|
|
2193
2270
|
*/
|
|
2194
|
-
var _action$
|
|
2195
|
-
targets = _action$
|
|
2196
|
-
source = _action$
|
|
2271
|
+
var _action$payload27 = action.payload,
|
|
2272
|
+
targets = _action$payload27.targets,
|
|
2273
|
+
source = _action$payload27.source;
|
|
2197
2274
|
return targets.reduce(function (prevState, target) {
|
|
2198
2275
|
var actionType = (source === null || source === void 0 ? void 0 : source.type) || 'GENERIC_SYNC_SETLAYERACTIONS';
|
|
2199
2276
|
var action = {
|
|
@@ -2772,6 +2849,9 @@ var slice$6 = createSlice({
|
|
|
2772
2849
|
map.mapLayers = map.mapLayers.filter(function (id) {
|
|
2773
2850
|
return id !== layerId;
|
|
2774
2851
|
});
|
|
2852
|
+
map.featureLayers = map.featureLayers.filter(function (id) {
|
|
2853
|
+
return id !== layerId;
|
|
2854
|
+
});
|
|
2775
2855
|
// if auto layer is deleted, change auto layer ids
|
|
2776
2856
|
if (!map.mapLayers.length) {
|
|
2777
2857
|
map.autoUpdateLayerId = undefined;
|
|
@@ -2786,9 +2866,6 @@ var slice$6 = createSlice({
|
|
|
2786
2866
|
if (map.autoTimeStepLayerId === layerId) {
|
|
2787
2867
|
map.autoTimeStepLayerId = activeLayerId;
|
|
2788
2868
|
}
|
|
2789
|
-
map.featureLayers = map.featureLayers.filter(function (id) {
|
|
2790
|
-
return id !== layerId;
|
|
2791
|
-
});
|
|
2792
2869
|
}).addCase(layerActions.baseLayerDelete, function (draft, action) {
|
|
2793
2870
|
var _action$payload36 = action.payload,
|
|
2794
2871
|
mapId = _action$payload36.mapId,
|
|
@@ -4946,12 +5023,6 @@ var useSyncgroupTimeState = function useSyncgroupTimeState(panelId) {
|
|
|
4946
5023
|
var layerStore = function layerStore(store) {
|
|
4947
5024
|
return store === null || store === void 0 ? void 0 : store.layers;
|
|
4948
5025
|
};
|
|
4949
|
-
var getSTACServiceRootUrl = function getSTACServiceRootUrl(serviceUrl) {
|
|
4950
|
-
return serviceUrl.replace(/\/collections\/[^/]+\/?$/, '');
|
|
4951
|
-
};
|
|
4952
|
-
var getTrailingSlashVariant = function getTrailingSlashVariant(url) {
|
|
4953
|
-
return url.endsWith('/') ? url.slice(0, -1) : "".concat(url, "/");
|
|
4954
|
-
};
|
|
4955
5026
|
/**
|
|
4956
5027
|
* Gets a layer from the layers part of the store by its Id
|
|
4957
5028
|
*
|
|
@@ -5193,11 +5264,10 @@ var getLayerEnabled = createSelector(getLayerById, function (layer) {
|
|
|
5193
5264
|
* @returns {string} returnType: string - layer name
|
|
5194
5265
|
*/
|
|
5195
5266
|
var getLayerName = createSelector(getLayerById, function (layer) {
|
|
5196
|
-
var _layer$options;
|
|
5197
5267
|
if (!layer) {
|
|
5198
5268
|
return '';
|
|
5199
5269
|
}
|
|
5200
|
-
if (layer.layerType === LayerType.edrFeatureLayer &&
|
|
5270
|
+
if (layer.layerType === LayerType.edrFeatureLayer && layer.options && 'parameterNames' in layer.options && layer.options.parameterNames.length) {
|
|
5201
5271
|
return layer.options.parameterNames[0];
|
|
5202
5272
|
}
|
|
5203
5273
|
return (layer === null || layer === void 0 ? void 0 : layer.name) || '';
|
|
@@ -5453,8 +5523,8 @@ var getLayerTitleFromService = createSelector(function (store) {
|
|
|
5453
5523
|
* @returns {string} returnType: string - layer displayname
|
|
5454
5524
|
*/
|
|
5455
5525
|
var getLayerDisplayName = createSelector(getLayerType, getLayerOptions, getLayerTitleFromService, getLayerName, function (layerType, layerOptions, layerTitle, layerName) {
|
|
5456
|
-
if (layerType === LayerType.edrFeatureLayer && layerOptions) {
|
|
5457
|
-
return
|
|
5526
|
+
if (layerType === LayerType.edrFeatureLayer && layerOptions && 'parameterNames' in layerOptions) {
|
|
5527
|
+
return layerOptions.parameterNames.length > 1 && layerOptions.collectionId ? layerOptions.collectionId : layerTitle || layerName;
|
|
5458
5528
|
}
|
|
5459
5529
|
return layerTitle || layerName;
|
|
5460
5530
|
}, selectorMemoizationOptions);
|
|
@@ -6098,12 +6168,12 @@ var DialogTypes;
|
|
|
6098
6168
|
DialogTypes["Legend"] = "legend";
|
|
6099
6169
|
DialogTypes["DrawingTool"] = "drawingTool";
|
|
6100
6170
|
DialogTypes["DockedLayerManager"] = "dockedLayerManager";
|
|
6101
|
-
DialogTypes["
|
|
6171
|
+
DialogTypes["AreaDrawingManager"] = "areaDrawingManager";
|
|
6102
6172
|
DialogTypes["PublicWarnings"] = "publicWarnings";
|
|
6103
6173
|
DialogTypes["WarningsEvent"] = "warningsEvent";
|
|
6104
6174
|
DialogTypes["WarningsEventSummary"] = "warningsEventSummary";
|
|
6105
6175
|
DialogTypes["Search"] = "search";
|
|
6106
|
-
DialogTypes["
|
|
6176
|
+
DialogTypes["AreaDrawingLoader"] = "areaDrawingLoaderType";
|
|
6107
6177
|
DialogTypes["DataExplorer"] = "dataExplorer";
|
|
6108
6178
|
DialogTypes["DataExplorerInfo"] = "dataExplorerInfo";
|
|
6109
6179
|
DialogTypes["SelectedFeatures"] = "selectedFeatures";
|
|
@@ -9791,7 +9861,7 @@ drawingToolListener.startListening({
|
|
|
9791
9861
|
actionCreator: drawingToolActions.changeDrawToolMode,
|
|
9792
9862
|
effect: function () {
|
|
9793
9863
|
var _effect2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref2, listenerApi) {
|
|
9794
|
-
var payload, _layerSelectors$getAc, _currentGeoJSON$featu, _currentGeoJSON$featu2, drawModeId, drawToolId, _payload$shouldUpdate, shouldUpdateShape, drawingTool, _drawingTool$shouldAl, shouldAllowMultipleShapes, geoJSONIntersectionLayerId, geoJSONIntersectionBoundsLayerId, newDrawMode, geoJSONLayer, geoJSON, lastFeatureIndex, newGeoJSON, selectedFeature, _selectedFeatureIndex, isLayerInEditMode,
|
|
9864
|
+
var payload, _layerSelectors$getAc, _currentGeoJSON$featu, _currentGeoJSON$featu2, drawModeId, drawToolId, _payload$shouldUpdate, shouldUpdateShape, drawingTool, _drawingTool$shouldAl, shouldAllowMultipleShapes, geoJSONIntersectionLayerId, geoJSONIntersectionBoundsLayerId, newDrawMode, geoJSONLayer, geoJSON, lastFeatureIndex, newGeoJSON, selectedFeature, _selectedFeatureIndex, isLayerInEditMode, _selectedFeature, selectedFeatureId, currentGeoJSONLayer, _ref3, currentGeoJSON, selectedFeatureIndex, currentSelectionType, newSelectionType, isNewToolSelected, shouldUpdateNewShape, shapeWithSelectionType, geoJSONFeatureCollection, _newGeoJSON, _selectedFeature2, _t;
|
|
9795
9865
|
return _regenerator().w(function (_context2) {
|
|
9796
9866
|
while (1) switch (_context2.p = _context2.n) {
|
|
9797
9867
|
case 0:
|
|
@@ -9844,20 +9914,12 @@ drawingToolListener.startListening({
|
|
|
9844
9914
|
}
|
|
9845
9915
|
_selectedFeatureIndex = getActiveFeatureIndex(listenerApi.getState(), drawingTool.geoJSONLayerId);
|
|
9846
9916
|
isLayerInEditMode = getIsLayerInEditMode(listenerApi.getState(), drawingTool.geoJSONLayerId);
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
return index !== _selectedFeatureIndex;
|
|
9852
|
-
})
|
|
9853
|
-
});
|
|
9854
|
-
listenerApi.dispatch(layerActions.updateFeature({
|
|
9855
|
-
layerId: drawingTool.geoJSONLayerId,
|
|
9856
|
-
geojson: _newGeoJSON
|
|
9857
|
-
}));
|
|
9858
|
-
listenerApi.dispatch(layerActions.setSelectedFeatures({
|
|
9917
|
+
_selectedFeature = _selectedFeatureIndex !== undefined && geoJSON ? geoJSON.features[_selectedFeatureIndex] : undefined;
|
|
9918
|
+
selectedFeatureId = getFeatureSelectionKey(_selectedFeature);
|
|
9919
|
+
if (isLayerInEditMode && selectedFeatureId) {
|
|
9920
|
+
listenerApi.dispatch(layerActions.deleteFeature({
|
|
9859
9921
|
layerId: drawingTool.geoJSONLayerId,
|
|
9860
|
-
|
|
9922
|
+
featureId: selectedFeatureId
|
|
9861
9923
|
}));
|
|
9862
9924
|
} else {
|
|
9863
9925
|
// if nothing selected, delete all
|
|
@@ -9907,18 +9969,18 @@ drawingToolListener.startListening({
|
|
|
9907
9969
|
if (shouldUpdateNewShape && shouldUpdateShape) {
|
|
9908
9970
|
shapeWithSelectionType = addSelectionTypeToGeoJSON(newDrawMode.shape, newDrawMode.selectionType);
|
|
9909
9971
|
geoJSONFeatureCollection = getFeatureCollection(shapeWithSelectionType, shouldAllowMultipleShapes, currentGeoJSON);
|
|
9910
|
-
|
|
9972
|
+
_newGeoJSON = getGeoJson(geoJSONFeatureCollection, shouldAllowMultipleShapes);
|
|
9911
9973
|
if (shouldAllowMultipleShapes) {
|
|
9912
|
-
moveFeature(currentGeoJSON,
|
|
9974
|
+
moveFeature(currentGeoJSON, _newGeoJSON, selectedFeatureIndex, '');
|
|
9913
9975
|
}
|
|
9914
|
-
|
|
9976
|
+
_selectedFeature2 = shouldAllowMultipleShapes ? _objectSpread2(_objectSpread2({}, _newGeoJSON.features[_newGeoJSON.features.length - 1]), {}, {
|
|
9915
9977
|
// Keep this in sync with layerReducer.updateFeature, which
|
|
9916
9978
|
// materializes multi-shape feature ids from their array index.
|
|
9917
|
-
id:
|
|
9918
|
-
}) :
|
|
9979
|
+
id: _newGeoJSON.features.length - 1
|
|
9980
|
+
}) : _newGeoJSON.features[_newGeoJSON.features.length - 1];
|
|
9919
9981
|
listenerApi.dispatch(layerActions.updateFeature(_objectSpread2(_objectSpread2({
|
|
9920
9982
|
layerId: drawingTool.geoJSONLayerId,
|
|
9921
|
-
geojson:
|
|
9983
|
+
geojson: _newGeoJSON
|
|
9922
9984
|
}, geoJSONIntersectionLayerId && {
|
|
9923
9985
|
geoJSONIntersectionLayerId: geoJSONIntersectionLayerId
|
|
9924
9986
|
}), geoJSONIntersectionBoundsLayerId && {
|
|
@@ -9926,7 +9988,7 @@ drawingToolListener.startListening({
|
|
|
9926
9988
|
})));
|
|
9927
9989
|
listenerApi.dispatch(layerActions.setSelectedFeatures({
|
|
9928
9990
|
layerId: drawingTool.geoJSONLayerId,
|
|
9929
|
-
selectedFeatureIds: getSelectedFeatureIds(
|
|
9991
|
+
selectedFeatureIds: getSelectedFeatureIds(_selectedFeature2)
|
|
9930
9992
|
}));
|
|
9931
9993
|
}
|
|
9932
9994
|
listenerApi.dispatch(layerActions.toggleFeatureMode({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Draft, PayloadAction } from '@reduxjs/toolkit';
|
|
2
2
|
import type { SetLayerAcceptanceTimePayload, SetLayerDimensionsPayload, SetLayerStylePayload, UpdateLayerInfoPayload } from '@opengeoweb/webmap-react';
|
|
3
|
-
import type { LayerState, Layer, AddLayerPayload, SetLayerDimensionPayload, SetLayerEnabledPayload, SetLayerOpacityPayload, SetLayerNamePayload, SetLayerServicePayload, SetLayerGeojsonPayload, DeleteLayerPayload, ErrorLayerPayload, SetLayersPayload, SetBaseLayersPayload, AddBaseLayerPayload, AddAvailableBaseLayerPayload, AddAvailableBaseLayersPayload, SetAvailableBaseLayersPayload, SetSelectedFeaturesPayload, SetHoveredFeaturesPayload, UpdateFeaturePayload, ExitFeatureDrawModePayload, ToggleFeatureModePayload, UpdateFeaturePropertiesPayload, DuplicateMapLayerPayload, ShowLayerInfoPayload, SetLayerGeojsonFromLayerPayload, SetLayerOptionsPayload, SetLayerLegendVisibilityPayload } from './types';
|
|
3
|
+
import type { LayerState, Layer, AddLayerPayload, SetLayerDimensionPayload, SetLayerEnabledPayload, SetLayerOpacityPayload, SetLayerNamePayload, SetLayerServicePayload, SetLayerGeojsonPayload, DeleteLayerPayload, ErrorLayerPayload, SetLayersPayload, SetBaseLayersPayload, AddBaseLayerPayload, AddAvailableBaseLayerPayload, AddAvailableBaseLayersPayload, SetAvailableBaseLayersPayload, SetSelectedFeaturesPayload, SetHoveredFeaturesPayload, UpdateFeaturePayload, ExitFeatureDrawModePayload, ToggleFeatureModePayload, UpdateFeaturePropertiesPayload, DeleteFeaturePayload, DuplicateMapLayerPayload, ShowLayerInfoPayload, SetLayerGeojsonFromLayerPayload, SetLayerOptionsPayload, SetLayerLegendVisibilityPayload } from './types';
|
|
4
4
|
export declare const createLayer: ({ id, opacity, acceptanceTimeInMinutes, enabled, layerType, status, useLatestReferenceTime, ...props }: Layer) => Layer;
|
|
5
5
|
export declare const initialState: LayerState;
|
|
6
6
|
export declare const slice: import("@reduxjs/toolkit").Slice<LayerState, {
|
|
@@ -38,6 +38,7 @@ export declare const slice: import("@reduxjs/toolkit").Slice<LayerState, {
|
|
|
38
38
|
setHoveredFeatures: (draft: Draft<LayerState>, action: PayloadAction<SetHoveredFeaturesPayload>) => void;
|
|
39
39
|
updateFeature: (draft: Draft<LayerState>, action: PayloadAction<UpdateFeaturePayload>) => void;
|
|
40
40
|
updateFeatureProperties: (draft: Draft<LayerState>, action: PayloadAction<UpdateFeaturePropertiesPayload>) => void;
|
|
41
|
+
deleteFeature: (draft: Draft<LayerState>, action: PayloadAction<DeleteFeaturePayload>) => void;
|
|
41
42
|
toggleFeatureMode: (draft: Draft<LayerState>, action: PayloadAction<ToggleFeatureModePayload>) => void;
|
|
42
43
|
exitFeatureDrawMode: (draft: Draft<LayerState>, action: PayloadAction<ExitFeatureDrawModePayload>) => void;
|
|
43
44
|
toggleSelectableFeatures: (draft: Draft<LayerState>, action: PayloadAction<{
|
|
@@ -82,6 +83,7 @@ export declare const layerReducer: import("redux").Reducer<LayerState>, layerAct
|
|
|
82
83
|
setHoveredFeatures: (draft: Draft<LayerState>, action: PayloadAction<SetHoveredFeaturesPayload>) => void;
|
|
83
84
|
updateFeature: (draft: Draft<LayerState>, action: PayloadAction<UpdateFeaturePayload>) => void;
|
|
84
85
|
updateFeatureProperties: (draft: Draft<LayerState>, action: PayloadAction<UpdateFeaturePropertiesPayload>) => void;
|
|
86
|
+
deleteFeature: (draft: Draft<LayerState>, action: PayloadAction<DeleteFeaturePayload>) => void;
|
|
85
87
|
toggleFeatureMode: (draft: Draft<LayerState>, action: PayloadAction<ToggleFeatureModePayload>) => void;
|
|
86
88
|
exitFeatureDrawMode: (draft: Draft<LayerState>, action: PayloadAction<ExitFeatureDrawModePayload>) => void;
|
|
87
89
|
toggleSelectableFeatures: (draft: Draft<LayerState>, action: PayloadAction<{
|
|
@@ -2298,18 +2298,18 @@ export declare const getLayerType: ((state: any, layerId: any) => LayerType | "m
|
|
|
2298
2298
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
2299
2299
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
2300
2300
|
};
|
|
2301
|
-
export declare const getLayerOptions: ((state: any, layerId: any) => import("@opengeoweb/webmap").EDRFeatureLayerOptions | undefined) & {
|
|
2301
|
+
export declare const getLayerOptions: ((state: any, layerId: any) => import("@opengeoweb/webmap").EDRFeatureLayerOptions | import("@opengeoweb/webmap").STACGeoTIFFLayerOptions | undefined) & {
|
|
2302
2302
|
clearCache: () => void;
|
|
2303
2303
|
resultsCount: () => number;
|
|
2304
2304
|
resetResultsCount: () => void;
|
|
2305
2305
|
} & {
|
|
2306
|
-
resultFunc: (resultFuncArgs_0: ReduxLayer | undefined) => import("@opengeoweb/webmap").EDRFeatureLayerOptions | undefined;
|
|
2307
|
-
memoizedResultFunc: ((resultFuncArgs_0: ReduxLayer | undefined) => import("@opengeoweb/webmap").EDRFeatureLayerOptions | undefined) & {
|
|
2306
|
+
resultFunc: (resultFuncArgs_0: ReduxLayer | undefined) => import("@opengeoweb/webmap").EDRFeatureLayerOptions | import("@opengeoweb/webmap").STACGeoTIFFLayerOptions | undefined;
|
|
2307
|
+
memoizedResultFunc: ((resultFuncArgs_0: ReduxLayer | undefined) => import("@opengeoweb/webmap").EDRFeatureLayerOptions | import("@opengeoweb/webmap").STACGeoTIFFLayerOptions | undefined) & {
|
|
2308
2308
|
clearCache: () => void;
|
|
2309
2309
|
resultsCount: () => number;
|
|
2310
2310
|
resetResultsCount: () => void;
|
|
2311
2311
|
};
|
|
2312
|
-
lastResult: () => import("@opengeoweb/webmap").EDRFeatureLayerOptions | undefined;
|
|
2312
|
+
lastResult: () => import("@opengeoweb/webmap").EDRFeatureLayerOptions | import("@opengeoweb/webmap").STACGeoTIFFLayerOptions | undefined;
|
|
2313
2313
|
dependencies: [((state: any, layerId: any) => ReduxLayer | undefined) & {
|
|
2314
2314
|
clearCache: () => void;
|
|
2315
2315
|
resultsCount: () => number;
|
|
@@ -2421,8 +2421,8 @@ export declare const getLayerDisplayName: ((state: any, layerId: any) => string)
|
|
|
2421
2421
|
resultsCount: () => number;
|
|
2422
2422
|
resetResultsCount: () => void;
|
|
2423
2423
|
} & {
|
|
2424
|
-
resultFunc: (resultFuncArgs_0: LayerType | "mapLayer", resultFuncArgs_1: import("@opengeoweb/webmap").EDRFeatureLayerOptions | undefined, resultFuncArgs_2: string | undefined, resultFuncArgs_3: string) => string;
|
|
2425
|
-
memoizedResultFunc: ((resultFuncArgs_0: LayerType | "mapLayer", resultFuncArgs_1: import("@opengeoweb/webmap").EDRFeatureLayerOptions | undefined, resultFuncArgs_2: string | undefined, resultFuncArgs_3: string) => string) & {
|
|
2424
|
+
resultFunc: (resultFuncArgs_0: LayerType | "mapLayer", resultFuncArgs_1: import("@opengeoweb/webmap").EDRFeatureLayerOptions | import("@opengeoweb/webmap").STACGeoTIFFLayerOptions | undefined, resultFuncArgs_2: string | undefined, resultFuncArgs_3: string) => string;
|
|
2425
|
+
memoizedResultFunc: ((resultFuncArgs_0: LayerType | "mapLayer", resultFuncArgs_1: import("@opengeoweb/webmap").EDRFeatureLayerOptions | import("@opengeoweb/webmap").STACGeoTIFFLayerOptions | undefined, resultFuncArgs_2: string | undefined, resultFuncArgs_3: string) => string) & {
|
|
2426
2426
|
clearCache: () => void;
|
|
2427
2427
|
resultsCount: () => number;
|
|
2428
2428
|
resetResultsCount: () => void;
|
|
@@ -2468,18 +2468,18 @@ export declare const getLayerDisplayName: ((state: any, layerId: any) => string)
|
|
|
2468
2468
|
} & {
|
|
2469
2469
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
2470
2470
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
2471
|
-
}, ((state: any, layerId: any) => import("@opengeoweb/webmap").EDRFeatureLayerOptions | undefined) & {
|
|
2471
|
+
}, ((state: any, layerId: any) => import("@opengeoweb/webmap").EDRFeatureLayerOptions | import("@opengeoweb/webmap").STACGeoTIFFLayerOptions | undefined) & {
|
|
2472
2472
|
clearCache: () => void;
|
|
2473
2473
|
resultsCount: () => number;
|
|
2474
2474
|
resetResultsCount: () => void;
|
|
2475
2475
|
} & {
|
|
2476
|
-
resultFunc: (resultFuncArgs_0: ReduxLayer | undefined) => import("@opengeoweb/webmap").EDRFeatureLayerOptions | undefined;
|
|
2477
|
-
memoizedResultFunc: ((resultFuncArgs_0: ReduxLayer | undefined) => import("@opengeoweb/webmap").EDRFeatureLayerOptions | undefined) & {
|
|
2476
|
+
resultFunc: (resultFuncArgs_0: ReduxLayer | undefined) => import("@opengeoweb/webmap").EDRFeatureLayerOptions | import("@opengeoweb/webmap").STACGeoTIFFLayerOptions | undefined;
|
|
2477
|
+
memoizedResultFunc: ((resultFuncArgs_0: ReduxLayer | undefined) => import("@opengeoweb/webmap").EDRFeatureLayerOptions | import("@opengeoweb/webmap").STACGeoTIFFLayerOptions | undefined) & {
|
|
2478
2478
|
clearCache: () => void;
|
|
2479
2479
|
resultsCount: () => number;
|
|
2480
2480
|
resetResultsCount: () => void;
|
|
2481
2481
|
};
|
|
2482
|
-
lastResult: () => import("@opengeoweb/webmap").EDRFeatureLayerOptions | undefined;
|
|
2482
|
+
lastResult: () => import("@opengeoweb/webmap").EDRFeatureLayerOptions | import("@opengeoweb/webmap").STACGeoTIFFLayerOptions | undefined;
|
|
2483
2483
|
dependencies: [((state: any, layerId: any) => ReduxLayer | undefined) & {
|
|
2484
2484
|
clearCache: () => void;
|
|
2485
2485
|
resultsCount: () => number;
|
|
@@ -175,6 +175,9 @@ export interface UpdateFeaturePropertiesPayload extends LayerPayload {
|
|
|
175
175
|
properties: GeoJSON.GeoJsonProperties;
|
|
176
176
|
targetFeatureIndex?: number;
|
|
177
177
|
}
|
|
178
|
+
export interface DeleteFeaturePayload extends LayerPayload {
|
|
179
|
+
featureId: string;
|
|
180
|
+
}
|
|
178
181
|
export interface ToggleFeatureModePayload extends LayerPayload {
|
|
179
182
|
isInEditMode?: boolean;
|
|
180
183
|
drawMode?: string;
|
|
@@ -2,6 +2,24 @@ import type { Draft } from '@reduxjs/toolkit';
|
|
|
2
2
|
import type { WMJSDimension } from '@opengeoweb/webmap';
|
|
3
3
|
import type { Dimension, ReduxLayer } from '../types';
|
|
4
4
|
import type { LayerState } from './types';
|
|
5
|
+
export declare const trimTrailingSlashes: (url: string) => string;
|
|
6
|
+
export declare const getSTACServiceRootUrl: (serviceUrl: string) => string;
|
|
7
|
+
export declare const getTrailingSlashVariant: (url: string) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Generates a unique id for a geoJSON feature. Feature ids need to be stable
|
|
10
|
+
* over the lifetime of a feature (also when other features are added or
|
|
11
|
+
* removed), because they are used to select features and to link feature
|
|
12
|
+
* properties (eg objectName) to form fields.
|
|
13
|
+
* @returns unique feature id
|
|
14
|
+
*/
|
|
15
|
+
export declare const generateFeatureId: () => string;
|
|
16
|
+
/**
|
|
17
|
+
* Makes sure every feature in the featurecollection has a unique id. Existing
|
|
18
|
+
* unique ids are preserved, missing or duplicate ids are (re)generated.
|
|
19
|
+
* @param geojson The featurecollection to add ids to
|
|
20
|
+
* @returns featurecollection where every feature has a unique id
|
|
21
|
+
*/
|
|
22
|
+
export declare const ensureFeatureIds: (geojson: GeoJSON.FeatureCollection) => GeoJSON.FeatureCollection;
|
|
5
23
|
export declare const getFeatureSelectionKey: (feature?: GeoJSON.Feature) => string | undefined;
|
|
6
24
|
export declare const getSelectedFeatureIndexByIds: (geojson: GeoJSON.FeatureCollection | undefined, selectedFeatureIds: string[] | undefined) => number | undefined;
|
|
7
25
|
export declare const isActionLayerSynced: (state: LayerState, layerIdFromAction: string, dimension: Dimension) => boolean;
|
|
@@ -23,12 +23,12 @@ export declare enum DialogTypes {
|
|
|
23
23
|
Legend = "legend",
|
|
24
24
|
DrawingTool = "drawingTool",
|
|
25
25
|
DockedLayerManager = "dockedLayerManager",
|
|
26
|
-
|
|
26
|
+
AreaDrawingManager = "areaDrawingManager",
|
|
27
27
|
PublicWarnings = "publicWarnings",
|
|
28
28
|
WarningsEvent = "warningsEvent",
|
|
29
29
|
WarningsEventSummary = "warningsEventSummary",
|
|
30
30
|
Search = "search",
|
|
31
|
-
|
|
31
|
+
AreaDrawingLoader = "areaDrawingLoaderType",
|
|
32
32
|
DataExplorer = "dataExplorer",
|
|
33
33
|
DataExplorerInfo = "dataExplorerInfo",
|
|
34
34
|
SelectedFeatures = "selectedFeatures",
|
package/package.json
CHANGED
|
@@ -1,46 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
2
|
+
"name": "@opengeoweb/store",
|
|
3
|
+
"version": "19.5.1-nightly-20260831",
|
|
4
|
+
"description": "GeoWeb Store library for the opengeoweb project",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.esm.js",
|
|
11
|
+
"module": "./dist/index.esm.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
"./package.json": "./package.json",
|
|
15
|
+
".": {
|
|
16
|
+
"@opengeoweb/source": "./src/index.ts",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.esm.js",
|
|
19
|
+
"default": "./dist/index.esm.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@opengeoweb/shared": "19.5.1-nightly-20260831",
|
|
24
|
+
"react-redux": "^9.2.0",
|
|
25
|
+
"@reduxjs/toolkit": "^2.6.1",
|
|
26
|
+
"@opengeoweb/webmap-react": "19.5.1-nightly-20260831",
|
|
27
|
+
"@opengeoweb/webmap": "19.5.1-nightly-20260831",
|
|
28
|
+
"immer": "^10.0.3",
|
|
29
|
+
"lodash": "^4.18.1",
|
|
30
|
+
"@opengeoweb/metronome": "19.5.1-nightly-20260831",
|
|
31
|
+
"@opengeoweb/time-slider": "19.5.1-nightly-20260831",
|
|
32
|
+
"ol": "^10.4.0",
|
|
33
|
+
"@turf/turf": "^7.2.0",
|
|
34
|
+
"@types/geojson": "^7946.0.14",
|
|
35
|
+
"react-router": "^7.15.1",
|
|
36
|
+
"uuid": "^11.0.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"react": "19"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"!dist/package.json",
|
|
44
|
+
"README.md",
|
|
45
|
+
"package.json"
|
|
46
|
+
]
|
|
47
|
+
}
|