@opengeoweb/store 9.8.0 → 9.9.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 +311 -178
- package/package.json +2 -3
- package/src/store/drawingtool/reducer.spec.d.ts +4 -22
- package/src/store/mapStore/config.d.ts +1 -1
- package/src/store/mapStore/index.d.ts +1 -1
- package/src/store/mapStore/layers/reducer.d.ts +4 -4
- package/src/store/mapStore/map/filterLayers.d.ts +2 -2
- package/src/store/mapStore/map/index.d.ts +1 -1
- package/src/store/mapStore/map/selectors.d.ts +5 -5
- package/src/store/mapStore/map/types.d.ts +3 -3
- package/src/store/mapStore/map/utils.d.ts +2 -2
- package/src/store/mapStore/service/types.d.ts +1 -3
package/index.esm.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { current, produce } from 'immer';
|
|
2
2
|
import { webmapUtils, LayerType, webmapTestSettings, WMLayer, handleMomentISOString, getCapabilities } from '@opengeoweb/webmap';
|
|
3
|
-
import { createAction, createSlice, createSelector, createEntityAdapter
|
|
4
|
-
import { getGeoJson, moveFeature, createInterSections, defaultLayers, getFeatureCollection, emptyGeoJSON, defaultIntersectionStyleProperties } from '@opengeoweb/webmap-react';
|
|
3
|
+
import { createAction, createSlice, createSelector, createEntityAdapter } from '@reduxjs/toolkit';
|
|
4
|
+
import { getGeoJson, moveFeature, createInterSections, getLastEmptyFeatureIndex, defaultLayers, addSelectionTypeToGeoJSON, getFeatureCollection, emptyGeoJSON, defaultIntersectionStyleProperties } from '@opengeoweb/webmap-react';
|
|
5
5
|
export { defaultLayers } from '@opengeoweb/webmap-react';
|
|
6
|
-
import { differenceInMinutes, isValid, fromUnixTime } from 'date-fns';
|
|
7
6
|
import { dateUtils, withEggs } from '@opengeoweb/shared';
|
|
8
7
|
import { isEqual, compact } from 'lodash';
|
|
9
8
|
import { createStore as createStore$1 } from '@redux-eggs/redux-toolkit';
|
|
@@ -403,6 +402,57 @@ function _nonIterableSpread() {
|
|
|
403
402
|
function _nonIterableRest() {
|
|
404
403
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
405
404
|
}
|
|
405
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
406
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
407
|
+
if (!it) {
|
|
408
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
409
|
+
if (it) o = it;
|
|
410
|
+
var i = 0;
|
|
411
|
+
var F = function () {};
|
|
412
|
+
return {
|
|
413
|
+
s: F,
|
|
414
|
+
n: function () {
|
|
415
|
+
if (i >= o.length) return {
|
|
416
|
+
done: true
|
|
417
|
+
};
|
|
418
|
+
return {
|
|
419
|
+
done: false,
|
|
420
|
+
value: o[i++]
|
|
421
|
+
};
|
|
422
|
+
},
|
|
423
|
+
e: function (e) {
|
|
424
|
+
throw e;
|
|
425
|
+
},
|
|
426
|
+
f: F
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
430
|
+
}
|
|
431
|
+
var normalCompletion = true,
|
|
432
|
+
didErr = false,
|
|
433
|
+
err;
|
|
434
|
+
return {
|
|
435
|
+
s: function () {
|
|
436
|
+
it = it.call(o);
|
|
437
|
+
},
|
|
438
|
+
n: function () {
|
|
439
|
+
var step = it.next();
|
|
440
|
+
normalCompletion = step.done;
|
|
441
|
+
return step;
|
|
442
|
+
},
|
|
443
|
+
e: function (e) {
|
|
444
|
+
didErr = true;
|
|
445
|
+
err = e;
|
|
446
|
+
},
|
|
447
|
+
f: function () {
|
|
448
|
+
try {
|
|
449
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
450
|
+
} finally {
|
|
451
|
+
if (didErr) throw err;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
}
|
|
406
456
|
|
|
407
457
|
/******************************************************************************
|
|
408
458
|
Copyright (c) Microsoft Corporation.
|
|
@@ -562,17 +612,17 @@ var createMap = function createMap(_ref) {
|
|
|
562
612
|
_ref$isAnimating = _ref.isAnimating,
|
|
563
613
|
isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating,
|
|
564
614
|
_ref$animationStartTi = _ref.animationStartTime,
|
|
565
|
-
animationStartTime = _ref$animationStartTi === void 0 ? dateUtils.dateToString(dateUtils.sub(dateUtils.
|
|
615
|
+
animationStartTime = _ref$animationStartTi === void 0 ? dateUtils.dateToString(dateUtils.sub(dateUtils.getNowUtc(), {
|
|
566
616
|
hours: 5
|
|
567
617
|
}), dateFormat) : _ref$animationStartTi,
|
|
568
618
|
_ref$animationEndTime = _ref.animationEndTime,
|
|
569
|
-
animationEndTime = _ref$animationEndTime === void 0 ? dateUtils.dateToString(dateUtils.sub(dateUtils.
|
|
619
|
+
animationEndTime = _ref$animationEndTime === void 0 ? dateUtils.dateToString(dateUtils.sub(dateUtils.getNowUtc(), {
|
|
570
620
|
minutes: 10
|
|
571
621
|
}), dateFormat) : _ref$animationEndTime,
|
|
572
622
|
_ref$isAutoUpdating = _ref.isAutoUpdating,
|
|
573
623
|
isAutoUpdating = _ref$isAutoUpdating === void 0 ? false : _ref$isAutoUpdating,
|
|
574
|
-
_ref$
|
|
575
|
-
|
|
624
|
+
_ref$shouldEndtimeOve = _ref.shouldEndtimeOverride,
|
|
625
|
+
shouldEndtimeOverride = _ref$shouldEndtimeOve === void 0 ? false : _ref$shouldEndtimeOve,
|
|
576
626
|
_ref$bbox = _ref.bbox,
|
|
577
627
|
bbox = _ref$bbox === void 0 ? {
|
|
578
628
|
left: -19000000,
|
|
@@ -626,7 +676,7 @@ var createMap = function createMap(_ref) {
|
|
|
626
676
|
animationStartTime: animationStartTime,
|
|
627
677
|
animationEndTime: animationEndTime,
|
|
628
678
|
isAutoUpdating: isAutoUpdating,
|
|
629
|
-
|
|
679
|
+
shouldEndtimeOverride: shouldEndtimeOverride,
|
|
630
680
|
srs: srs,
|
|
631
681
|
bbox: bbox,
|
|
632
682
|
baseLayers: baseLayers,
|
|
@@ -654,19 +704,28 @@ var createMap = function createMap(_ref) {
|
|
|
654
704
|
var checkValidLayersPayload = function checkValidLayersPayload(layers, mapId) {
|
|
655
705
|
/* Check for duplicate ids */
|
|
656
706
|
var layerIds = {};
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
707
|
+
var _iterator = _createForOfIteratorHelper(layers),
|
|
708
|
+
_step;
|
|
709
|
+
try {
|
|
710
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
711
|
+
var layer = _step.value;
|
|
712
|
+
if (layer.id) {
|
|
713
|
+
/* Check if layer is already added to a different map */
|
|
714
|
+
if (layer.mapId && mapId && layer.mapId !== mapId) {
|
|
715
|
+
return false;
|
|
716
|
+
}
|
|
717
|
+
/* Check duplicate */
|
|
718
|
+
if (!layerIds[layer.id]) {
|
|
719
|
+
layerIds[layer.id] = true;
|
|
720
|
+
} else {
|
|
721
|
+
return false;
|
|
722
|
+
}
|
|
668
723
|
}
|
|
669
724
|
}
|
|
725
|
+
} catch (err) {
|
|
726
|
+
_iterator.e(err);
|
|
727
|
+
} finally {
|
|
728
|
+
_iterator.f();
|
|
670
729
|
}
|
|
671
730
|
return true;
|
|
672
731
|
};
|
|
@@ -799,7 +858,7 @@ var getSpeedFactor = function getSpeedFactor(speedDelay) {
|
|
|
799
858
|
return defaultDelay / speedDelay;
|
|
800
859
|
};
|
|
801
860
|
var getAnimationDuration = function getAnimationDuration(animationEndTime, animationStartTime) {
|
|
802
|
-
return animationEndTime && animationStartTime ? differenceInMinutes(new Date(animationEndTime), new Date(animationStartTime)) : 0;
|
|
861
|
+
return animationEndTime && animationStartTime ? dateUtils.differenceInMinutes(new Date(animationEndTime), new Date(animationStartTime)) : 0;
|
|
803
862
|
};
|
|
804
863
|
/**
|
|
805
864
|
* Returns speed delay for given speedFactor. For options, see defined above in "speedFactors"
|
|
@@ -1300,17 +1359,15 @@ var slice$7 = createSlice({
|
|
|
1300
1359
|
}
|
|
1301
1360
|
/*
|
|
1302
1361
|
All layer id's for the specified mapId should be removed.
|
|
1303
|
-
This is done by
|
|
1362
|
+
This is done by filtering the allId array. Keeping only the layer id's which don't exist in the byId object
|
|
1304
1363
|
At the same time the byId object is synchronized.
|
|
1305
1364
|
*/
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
state.allIds.forEach(function (layerId) {
|
|
1309
|
-
if (state.byId[layerId] && state.byId[layerId].layerType !== LayerType.baseLayer && state.byId[layerId].layerType !== LayerType.overLayer && state.byId[layerId].mapId === mapId) {
|
|
1365
|
+
draft.allIds = draft.allIds.filter(function (layerId) {
|
|
1366
|
+
if (draft.byId[layerId] && draft.byId[layerId].layerType !== LayerType.baseLayer && draft.byId[layerId].layerType !== LayerType.overLayer && draft.byId[layerId].mapId === mapId) {
|
|
1310
1367
|
delete draft.byId[layerId];
|
|
1311
|
-
|
|
1312
|
-
draft.allIds.push(layerId);
|
|
1368
|
+
return false;
|
|
1313
1369
|
}
|
|
1370
|
+
return true;
|
|
1314
1371
|
});
|
|
1315
1372
|
/*
|
|
1316
1373
|
Here we set the layers for the mapId from the action. byId and allIds is updated.
|
|
@@ -1340,14 +1397,13 @@ var slice$7 = createSlice({
|
|
|
1340
1397
|
layerTypes.push(layer.layerType);
|
|
1341
1398
|
}
|
|
1342
1399
|
});
|
|
1343
|
-
var state = current(draft);
|
|
1344
1400
|
// remove current layers with same type as one of the passed layers
|
|
1345
|
-
|
|
1346
|
-
if (
|
|
1401
|
+
draft.allIds = draft.allIds.filter(function (layerId) {
|
|
1402
|
+
if (draft.byId[layerId] && layerTypes.includes(draft.byId[layerId].layerType) && draft.byId[layerId].mapId === mapId) {
|
|
1347
1403
|
delete draft.byId[layerId];
|
|
1348
|
-
|
|
1349
|
-
draft.allIds.splice(index, 1);
|
|
1404
|
+
return false;
|
|
1350
1405
|
}
|
|
1406
|
+
return true;
|
|
1351
1407
|
});
|
|
1352
1408
|
// set over and base layers
|
|
1353
1409
|
filtererdBaseLayers.forEach(function (layer) {
|
|
@@ -1412,14 +1468,13 @@ var slice$7 = createSlice({
|
|
|
1412
1468
|
var _action$payload13 = action.payload,
|
|
1413
1469
|
layers = _action$payload13.layers,
|
|
1414
1470
|
mapId = _action$payload13.mapId;
|
|
1415
|
-
var state = current(draft);
|
|
1416
1471
|
// remove current baselayers for passed map
|
|
1417
|
-
|
|
1418
|
-
if (
|
|
1472
|
+
draft.availableBaseLayers.allIds = draft.availableBaseLayers.allIds.filter(function (layerId) {
|
|
1473
|
+
if (draft.availableBaseLayers.byId[layerId] && draft.availableBaseLayers.byId[layerId].mapId === mapId) {
|
|
1419
1474
|
delete draft.availableBaseLayers.byId[layerId];
|
|
1420
|
-
|
|
1421
|
-
draft.availableBaseLayers.allIds.splice(index, 1);
|
|
1475
|
+
return false;
|
|
1422
1476
|
}
|
|
1477
|
+
return true;
|
|
1423
1478
|
});
|
|
1424
1479
|
// add new available baselayers
|
|
1425
1480
|
layers.forEach(function (layer) {
|
|
@@ -1599,9 +1654,23 @@ var slice$7 = createSlice({
|
|
|
1599
1654
|
if (!draft.byId[layerId]) {
|
|
1600
1655
|
return;
|
|
1601
1656
|
}
|
|
1602
|
-
|
|
1657
|
+
var exitMultipleShapes = shouldAllowMultipleShapes && reason === 'escaped';
|
|
1658
|
+
if (!shouldAllowMultipleShapes || exitMultipleShapes) {
|
|
1603
1659
|
draft.byId[layerId].isInEditMode = false;
|
|
1604
1660
|
draft.byId[layerId].drawMode = '';
|
|
1661
|
+
if (exitMultipleShapes) {
|
|
1662
|
+
var currentGeoJSON = current(draft.byId[layerId].geojson);
|
|
1663
|
+
var lastFeatureIndex = currentGeoJSON !== undefined && getLastEmptyFeatureIndex(currentGeoJSON);
|
|
1664
|
+
if (currentGeoJSON && lastFeatureIndex !== undefined) {
|
|
1665
|
+
var newGeoJSON = Object.assign(Object.assign({}, currentGeoJSON), {
|
|
1666
|
+
features: currentGeoJSON.features.filter(function (_feature, index) {
|
|
1667
|
+
return index !== lastFeatureIndex;
|
|
1668
|
+
})
|
|
1669
|
+
});
|
|
1670
|
+
draft.byId[layerId].geojson = newGeoJSON;
|
|
1671
|
+
draft.byId[layerId].selectedFeatureIndex = newGeoJSON.features.length > 0 ? newGeoJSON.features.length - 1 : 0;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1605
1674
|
}
|
|
1606
1675
|
}
|
|
1607
1676
|
},
|
|
@@ -1636,7 +1705,6 @@ var slice$7 = createSlice({
|
|
|
1636
1705
|
var _action$payload22 = action.payload,
|
|
1637
1706
|
targets = _action$payload22.targets,
|
|
1638
1707
|
source = _action$payload22.source;
|
|
1639
|
-
var state = current(draft);
|
|
1640
1708
|
return targets.reduce(function (prevState, target) {
|
|
1641
1709
|
var action = {
|
|
1642
1710
|
payload: target,
|
|
@@ -1644,7 +1712,7 @@ var slice$7 = createSlice({
|
|
|
1644
1712
|
};
|
|
1645
1713
|
/* Handle the Layer action with the same logic, using the same reducer */
|
|
1646
1714
|
return reducer$7(prevState, action);
|
|
1647
|
-
},
|
|
1715
|
+
}, draft);
|
|
1648
1716
|
}).addCase(setMapPreset, function (draft, action) {
|
|
1649
1717
|
var mapId = action.payload.mapId;
|
|
1650
1718
|
var layers = draft.allIds.map(function (id) {
|
|
@@ -2402,14 +2470,22 @@ var createLayersWithIds = function createLayersWithIds(state, layers) {
|
|
|
2402
2470
|
return layers;
|
|
2403
2471
|
}
|
|
2404
2472
|
return produce(layers, function (draft) {
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2473
|
+
var _iterator = _createForOfIteratorHelper(draft),
|
|
2474
|
+
_step;
|
|
2475
|
+
try {
|
|
2476
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2477
|
+
var layer = _step.value;
|
|
2478
|
+
if (!layer.id) {
|
|
2479
|
+
layer.id = webmapUtils.generateLayerId();
|
|
2480
|
+
} else if (checkIfMapLayerIdIsAlreadyTaken(state, layer.id)) {
|
|
2481
|
+
console.warn("Warning: Layer id ".concat(layer.id, " was already taken: Generating new one."));
|
|
2482
|
+
layer.id = webmapUtils.generateLayerId();
|
|
2483
|
+
}
|
|
2412
2484
|
}
|
|
2485
|
+
} catch (err) {
|
|
2486
|
+
_iterator.e(err);
|
|
2487
|
+
} finally {
|
|
2488
|
+
_iterator.f();
|
|
2413
2489
|
}
|
|
2414
2490
|
});
|
|
2415
2491
|
};
|
|
@@ -2639,7 +2715,7 @@ var slice$5 = createSlice({
|
|
|
2639
2715
|
if (!draft.byId[mapId]) {
|
|
2640
2716
|
return;
|
|
2641
2717
|
}
|
|
2642
|
-
draft.byId[mapId].
|
|
2718
|
+
draft.byId[mapId].shouldEndtimeOverride = shouldEndtimeOverride;
|
|
2643
2719
|
},
|
|
2644
2720
|
toggleTimestepAuto: function toggleTimestepAuto(draft, action) {
|
|
2645
2721
|
var _action$payload18 = action.payload,
|
|
@@ -3346,12 +3422,13 @@ var slice$4 = createSlice({
|
|
|
3346
3422
|
}
|
|
3347
3423
|
},
|
|
3348
3424
|
syncGroupAddTarget: function syncGroupAddTarget(draft, action) {
|
|
3349
|
-
var
|
|
3425
|
+
var _a;
|
|
3350
3426
|
var _action$payload2 = action.payload,
|
|
3351
3427
|
groupId = _action$payload2.groupId,
|
|
3352
3428
|
targetId = _action$payload2.targetId,
|
|
3353
3429
|
linked = _action$payload2.linked;
|
|
3354
|
-
|
|
3430
|
+
var synchronizationGroup = draft.groups.byId[groupId];
|
|
3431
|
+
if (!synchronizationGroup) {
|
|
3355
3432
|
console.warn("SYNCGROUPS_ADD_TARGET: Group ".concat(groupId, " does not exist."));
|
|
3356
3433
|
return;
|
|
3357
3434
|
}
|
|
@@ -3359,21 +3436,17 @@ var slice$4 = createSlice({
|
|
|
3359
3436
|
console.warn("SYNCGROUPS_ADD_TARGET: targetId is not defined.");
|
|
3360
3437
|
return;
|
|
3361
3438
|
}
|
|
3362
|
-
if (
|
|
3439
|
+
if (synchronizationGroup.targets.allIds.includes(targetId)) {
|
|
3363
3440
|
return;
|
|
3364
3441
|
}
|
|
3365
|
-
|
|
3366
|
-
|
|
3442
|
+
var isSourceLinked = (_a = synchronizationGroup.targets.byId[targetId]) === null || _a === void 0 ? void 0 : _a.linked;
|
|
3443
|
+
synchronizationGroup.targets.allIds.push(targetId);
|
|
3444
|
+
synchronizationGroup.targets.byId[targetId] = {
|
|
3367
3445
|
linked: linked !== false
|
|
3368
3446
|
};
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
var source = state.groups.byId[groupId].targets.byId[targetId];
|
|
3373
|
-
/* If the source is part of the target list, and is linked, continue syncing the other targets */
|
|
3374
|
-
if (source && source.linked) {
|
|
3375
|
-
var type = syncronizationGroup.type;
|
|
3376
|
-
draft.sources.byId[targetId].payloadByType[type] = syncronizationGroup.payloadByType[type];
|
|
3447
|
+
if (isSourceLinked) {
|
|
3448
|
+
var type = synchronizationGroup.type;
|
|
3449
|
+
draft.sources.byId[targetId].payloadByType[type] = synchronizationGroup.payloadByType[type];
|
|
3377
3450
|
}
|
|
3378
3451
|
},
|
|
3379
3452
|
syncGroupRemoveTarget: function syncGroupRemoveTarget(draft, action) {
|
|
@@ -3449,48 +3522,46 @@ var slice$4 = createSlice({
|
|
|
3449
3522
|
});
|
|
3450
3523
|
}
|
|
3451
3524
|
});
|
|
3452
|
-
var setBboxOrTimeSync = function setBboxOrTimeSync(
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
return null;
|
|
3466
|
-
}
|
|
3467
|
-
};
|
|
3468
|
-
var payloadKey = getPayLoadKey(action.type);
|
|
3469
|
-
if (!source.payload || !payloadKey) {
|
|
3470
|
-
console.warn('Wrong sync action: ', action);
|
|
3471
|
-
return;
|
|
3525
|
+
var setBboxOrTimeSync = function setBboxOrTimeSync(draft, action) {
|
|
3526
|
+
var _action$payload6 = action.payload,
|
|
3527
|
+
targets = _action$payload6.targets,
|
|
3528
|
+
source = _action$payload6.source,
|
|
3529
|
+
groups = _action$payload6.groups;
|
|
3530
|
+
var getPayLoadKey = function getPayLoadKey(type) {
|
|
3531
|
+
switch (type) {
|
|
3532
|
+
case setTimeSync.type:
|
|
3533
|
+
return SYNCGROUPS_TYPE_SETTIME;
|
|
3534
|
+
case setBboxSync.type:
|
|
3535
|
+
return SYNCGROUPS_TYPE_SETBBOX;
|
|
3536
|
+
default:
|
|
3537
|
+
return null;
|
|
3472
3538
|
}
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3539
|
+
};
|
|
3540
|
+
var payloadKey = getPayLoadKey(action.type);
|
|
3541
|
+
if (!source.payload || !payloadKey) {
|
|
3542
|
+
console.warn('Wrong sync action: ', action);
|
|
3543
|
+
return;
|
|
3544
|
+
}
|
|
3545
|
+
if (draft.sources.byId[source.payload.sourceId]) {
|
|
3546
|
+
if (!draft.sources.byId[source.payload.sourceId].payloadByType) {
|
|
3547
|
+
draft.sources.byId[source.payload.sourceId].payloadByType = {};
|
|
3478
3548
|
}
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
draft.sources.byId[target.targetId].payloadByType
|
|
3486
|
-
}
|
|
3487
|
-
});
|
|
3488
|
-
/* Set the value in the group */
|
|
3489
|
-
groups.forEach(function (group) {
|
|
3490
|
-
if (draft.groups.byId[group]) {
|
|
3491
|
-
draft.groups.byId[group].payloadByType[payloadKey] = source.payload;
|
|
3549
|
+
draft.sources.byId[source.payload.sourceId].payloadByType[payloadKey] = source.payload;
|
|
3550
|
+
}
|
|
3551
|
+
/* Update all targets */
|
|
3552
|
+
targets.forEach(function (target) {
|
|
3553
|
+
if (draft.sources.byId[target.targetId]) {
|
|
3554
|
+
if (!draft.sources.byId[target.targetId].payloadByType) {
|
|
3555
|
+
draft.sources.byId[target.targetId].payloadByType = {};
|
|
3492
3556
|
}
|
|
3493
|
-
|
|
3557
|
+
draft.sources.byId[target.targetId].payloadByType[payloadKey] = source.payload;
|
|
3558
|
+
}
|
|
3559
|
+
});
|
|
3560
|
+
/* Set the value in the group */
|
|
3561
|
+
groups.forEach(function (group) {
|
|
3562
|
+
if (draft.groups.byId[group]) {
|
|
3563
|
+
draft.groups.byId[group].payloadByType[payloadKey] = source.payload;
|
|
3564
|
+
}
|
|
3494
3565
|
});
|
|
3495
3566
|
};
|
|
3496
3567
|
var _slice$actions = slice$4.actions,
|
|
@@ -4203,13 +4274,13 @@ var isAutoUpdating = createSelector(getMapById, function (store) {
|
|
|
4203
4274
|
/**
|
|
4204
4275
|
* Gets if endTime and duration of animationPayload are overriding maxValue and minValue of leading layer
|
|
4205
4276
|
*
|
|
4206
|
-
* Example:
|
|
4277
|
+
* Example: shouldEndtimeOverride = shouldEndtimeOverride(store, 'mapid_1')
|
|
4207
4278
|
* @param {object} store store: object - store object
|
|
4208
4279
|
* @param {string} mapId mapId: string - Id of the map
|
|
4209
4280
|
* @returns {boolean} returnType: boolean
|
|
4210
4281
|
*/
|
|
4211
|
-
var
|
|
4212
|
-
return store ? store.
|
|
4282
|
+
var shouldEndtimeOverride = createSelector(getMapById, function (store) {
|
|
4283
|
+
return store ? store.shouldEndtimeOverride : false;
|
|
4213
4284
|
}, selectorMemoizationOptions);
|
|
4214
4285
|
/**
|
|
4215
4286
|
* Gets activeLayerId for map
|
|
@@ -4650,7 +4721,7 @@ var selectors$2 = /*#__PURE__*/Object.freeze({
|
|
|
4650
4721
|
getAnimationStartTime: getAnimationStartTime,
|
|
4651
4722
|
getAnimationEndTime: getAnimationEndTime$1,
|
|
4652
4723
|
isAutoUpdating: isAutoUpdating,
|
|
4653
|
-
|
|
4724
|
+
shouldEndtimeOverride: shouldEndtimeOverride,
|
|
4654
4725
|
getActiveLayerId: getActiveLayerId,
|
|
4655
4726
|
getAutoUpdateLayerId: getAutoUpdateLayerId,
|
|
4656
4727
|
getAutoTimeStepLayerId: getAutoTimeStepLayerId,
|
|
@@ -5155,6 +5226,10 @@ var generateTimeList = function generateTimeList(start, end, interval) {
|
|
|
5155
5226
|
return timeList;
|
|
5156
5227
|
};
|
|
5157
5228
|
var getAnimationEndTime = function getAnimationEndTime(animationEndTime) {
|
|
5229
|
+
var ISOtime = dateUtils.parseISO(animationEndTime);
|
|
5230
|
+
if (dateUtils.isValid(ISOtime)) {
|
|
5231
|
+
return ISOtime.toISOString();
|
|
5232
|
+
}
|
|
5158
5233
|
var calculateFromNow = animationEndTime.split(/[-+]/)[0] === 'NOW';
|
|
5159
5234
|
var isAddingTime = animationEndTime.indexOf('+') !== -1;
|
|
5160
5235
|
var duration = animationEndTime.substring(animationEndTime.indexOf('PT') + 2);
|
|
@@ -5175,7 +5250,11 @@ var isAnimationEndTimeValid = function isAnimationEndTimeValid(animationEndTime)
|
|
|
5175
5250
|
var hasValidPrefix = animationEndTime.split(/[-+]/)[0] === 'NOW' || animationEndTime.split(/[-+]/)[0] === 'TODAY';
|
|
5176
5251
|
var durationString = animationEndTime.substring(animationEndTime.indexOf('PT') + 2);
|
|
5177
5252
|
var hasValidDate = /^(\d+H)?(\d+M)?$/.test(durationString);
|
|
5178
|
-
|
|
5253
|
+
if (hasValidPrefix && hasValidDate) {
|
|
5254
|
+
return true;
|
|
5255
|
+
}
|
|
5256
|
+
var parsedDate = dateUtils.parseISO(animationEndTime);
|
|
5257
|
+
return dateUtils.isValid(parsedDate);
|
|
5179
5258
|
};
|
|
5180
5259
|
var validInitialAnimationStep = function validInitialAnimationStep(initialAnimationStep, draw) {
|
|
5181
5260
|
return !!initialAnimationStep && !!(draw === null || draw === void 0 ? void 0 : draw.length) && initialAnimationStep >= 0 && draw.length > initialAnimationStep;
|
|
@@ -5265,56 +5344,72 @@ function deleteLayerSaga(_ref3) {
|
|
|
5265
5344
|
})();
|
|
5266
5345
|
}
|
|
5267
5346
|
function updateAnimation(mapId, maxValue) {
|
|
5268
|
-
var animationStart, animationStartUnix, animationEnd, animationEndUnix, t, deltaT, start, end, isAnimating$1, timeStep;
|
|
5347
|
+
var shouldEndtimeOverride$1, animationStart, animationStartUnix, animationEnd, animationEndUnix, t, deltaT, start, end, isAnimating$1, timeStep;
|
|
5269
5348
|
return _regeneratorRuntime().wrap(function updateAnimation$(_context4) {
|
|
5270
5349
|
while (1) switch (_context4.prev = _context4.next) {
|
|
5271
5350
|
case 0:
|
|
5272
5351
|
_context4.next = 2;
|
|
5273
|
-
return select(
|
|
5352
|
+
return select(shouldEndtimeOverride, mapId);
|
|
5274
5353
|
case 2:
|
|
5354
|
+
shouldEndtimeOverride$1 = _context4.sent;
|
|
5355
|
+
if (!(shouldEndtimeOverride$1 === true)) {
|
|
5356
|
+
_context4.next = 5;
|
|
5357
|
+
break;
|
|
5358
|
+
}
|
|
5359
|
+
return _context4.abrupt("return");
|
|
5360
|
+
case 5:
|
|
5361
|
+
_context4.next = 7;
|
|
5362
|
+
return select(getAnimationStartTime, mapId);
|
|
5363
|
+
case 7:
|
|
5275
5364
|
animationStart = _context4.sent;
|
|
5276
5365
|
animationStartUnix = dateUtils.unix(dateUtils.utc(animationStart));
|
|
5277
|
-
_context4.next =
|
|
5366
|
+
_context4.next = 11;
|
|
5278
5367
|
return select(getAnimationEndTime$1, mapId);
|
|
5279
|
-
case
|
|
5368
|
+
case 11:
|
|
5280
5369
|
animationEnd = _context4.sent;
|
|
5281
5370
|
animationEndUnix = dateUtils.unix(dateUtils.utc(animationEnd));
|
|
5282
5371
|
t = dateUtils.unix(dateUtils.utc(maxValue));
|
|
5283
5372
|
deltaT = t - animationEndUnix;
|
|
5284
5373
|
start = dateUtils.dateToString(dateUtils.fromUnix(animationStartUnix + deltaT), dateFormat);
|
|
5285
5374
|
end = dateUtils.dateToString(dateUtils.fromUnix(animationEndUnix + deltaT), dateFormat);
|
|
5286
|
-
|
|
5375
|
+
if (!(!start || !end)) {
|
|
5376
|
+
_context4.next = 19;
|
|
5377
|
+
break;
|
|
5378
|
+
}
|
|
5379
|
+
return _context4.abrupt("return");
|
|
5380
|
+
case 19:
|
|
5381
|
+
_context4.next = 21;
|
|
5287
5382
|
return put(mapActions.setAnimationEndTime({
|
|
5288
5383
|
mapId: mapId,
|
|
5289
5384
|
animationEndTime: end
|
|
5290
5385
|
}));
|
|
5291
|
-
case
|
|
5292
|
-
_context4.next =
|
|
5386
|
+
case 21:
|
|
5387
|
+
_context4.next = 23;
|
|
5293
5388
|
return put(mapActions.setAnimationStartTime({
|
|
5294
5389
|
mapId: mapId,
|
|
5295
5390
|
animationStartTime: start
|
|
5296
5391
|
}));
|
|
5297
|
-
case
|
|
5298
|
-
_context4.next =
|
|
5392
|
+
case 23:
|
|
5393
|
+
_context4.next = 25;
|
|
5299
5394
|
return select(isAnimating, mapId);
|
|
5300
|
-
case
|
|
5395
|
+
case 25:
|
|
5301
5396
|
isAnimating$1 = _context4.sent;
|
|
5302
5397
|
if (!isAnimating$1) {
|
|
5303
|
-
_context4.next =
|
|
5398
|
+
_context4.next = 32;
|
|
5304
5399
|
break;
|
|
5305
5400
|
}
|
|
5306
|
-
_context4.next =
|
|
5401
|
+
_context4.next = 29;
|
|
5307
5402
|
return select(getMapTimeStep, mapId);
|
|
5308
|
-
case
|
|
5403
|
+
case 29:
|
|
5309
5404
|
timeStep = _context4.sent;
|
|
5310
|
-
_context4.next =
|
|
5405
|
+
_context4.next = 32;
|
|
5311
5406
|
return put(mapActions.mapStartAnimation({
|
|
5312
5407
|
mapId: mapId,
|
|
5313
5408
|
start: start,
|
|
5314
5409
|
end: end,
|
|
5315
5410
|
interval: timeStep
|
|
5316
5411
|
}));
|
|
5317
|
-
case
|
|
5412
|
+
case 32:
|
|
5318
5413
|
case "end":
|
|
5319
5414
|
return _context4.stop();
|
|
5320
5415
|
}
|
|
@@ -5963,7 +6058,7 @@ function setStepBackwardOrForwardSaga(_ref8) {
|
|
|
5963
6058
|
_yield$select2 = _slicedToArray(_yield$select, 2);
|
|
5964
6059
|
dataStartTime = _yield$select2[0];
|
|
5965
6060
|
dataEndTime = _yield$select2[1];
|
|
5966
|
-
if (!isValid(currentTime)) {
|
|
6061
|
+
if (!dateUtils.isValid(currentTime)) {
|
|
5967
6062
|
_context10.next = 23;
|
|
5968
6063
|
break;
|
|
5969
6064
|
}
|
|
@@ -5971,13 +6066,13 @@ function setStepBackwardOrForwardSaga(_ref8) {
|
|
|
5971
6066
|
var nextTime = currentTime + timeStep;
|
|
5972
6067
|
var roundedTime = mapUtils.roundWithTimeStep(nextTime, timeStep, 'ceil');
|
|
5973
6068
|
var newTime = Math.min(roundedTime, dataEndTime || roundedTime);
|
|
5974
|
-
return
|
|
6069
|
+
return dateUtils.fromUnix(newTime).toISOString();
|
|
5975
6070
|
};
|
|
5976
6071
|
makeBackwardStep = function makeBackwardStep() {
|
|
5977
6072
|
var nextTime = currentTime - timeStep;
|
|
5978
6073
|
var roundedTime = mapUtils.roundWithTimeStep(nextTime, timeStep, 'floor');
|
|
5979
6074
|
var newTime = Math.max(roundedTime, dataStartTime || roundedTime);
|
|
5980
|
-
return
|
|
6075
|
+
return dateUtils.fromUnix(newTime).toISOString();
|
|
5981
6076
|
};
|
|
5982
6077
|
selectedTimeString = isForwardStep ? makeForwardStep() : makeBackwardStep();
|
|
5983
6078
|
_context10.next = 19;
|
|
@@ -6844,9 +6939,8 @@ var drawAdapter = createEntityAdapter({
|
|
|
6844
6939
|
}
|
|
6845
6940
|
});
|
|
6846
6941
|
var getDrawToolByLayerId = function getDrawToolByLayerId(draft, layerId) {
|
|
6847
|
-
var
|
|
6848
|
-
|
|
6849
|
-
return state.entities[id];
|
|
6942
|
+
var drawTool = draft.ids.map(function (id) {
|
|
6943
|
+
return draft.entities[id];
|
|
6850
6944
|
}).find(function (tool) {
|
|
6851
6945
|
return (tool === null || tool === void 0 ? void 0 : tool.geoJSONLayerId) === layerId;
|
|
6852
6946
|
});
|
|
@@ -7153,7 +7247,7 @@ function registerDrawToolSaga(_ref) {
|
|
|
7153
7247
|
function changeDrawToolSaga(_ref2) {
|
|
7154
7248
|
var payload = _ref2.payload;
|
|
7155
7249
|
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
7156
|
-
var _a, _b, _c,
|
|
7250
|
+
var _a, _b, _c, drawModeId, drawToolId, _payload$shouldUpdate, shouldUpdateShape, drawingTool, _drawingTool$shouldAl, shouldAllowMultipleShapes, geoJSONIntersectionLayerId, geoJSONIntersectionBoundsLayerId, newDrawMode, geoJSONLayer, geoJSON, lastFeatureIndex, newGeoJSON, currentGeoJSONLayer, _ref3, currentGeoJSON, _ref3$selectedFeature, selectedFeatureIndex, currentSelectionType, newSelectionType, isNewToolSelected, shouldUpdateNewShape, shapeWithSelectionType, geoJSONFeatureCollection, _newGeoJSON;
|
|
7157
7251
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7158
7252
|
while (1) switch (_context2.prev = _context2.next) {
|
|
7159
7253
|
case 0:
|
|
@@ -7169,7 +7263,7 @@ function changeDrawToolSaga(_ref2) {
|
|
|
7169
7263
|
case 8:
|
|
7170
7264
|
newDrawMode = _context2.sent;
|
|
7171
7265
|
if (!(!newDrawMode || !drawingTool.activeDrawModeId && newDrawMode.isSelectable)) {
|
|
7172
|
-
_context2.next =
|
|
7266
|
+
_context2.next = 24;
|
|
7173
7267
|
break;
|
|
7174
7268
|
}
|
|
7175
7269
|
_context2.next = 12;
|
|
@@ -7179,90 +7273,118 @@ function changeDrawToolSaga(_ref2) {
|
|
|
7179
7273
|
drawMode: ''
|
|
7180
7274
|
}));
|
|
7181
7275
|
case 12:
|
|
7276
|
+
_context2.next = 14;
|
|
7277
|
+
return select(getLayerById, drawingTool.geoJSONLayerId);
|
|
7278
|
+
case 14:
|
|
7279
|
+
geoJSONLayer = _context2.sent;
|
|
7280
|
+
geoJSON = geoJSONLayer === null || geoJSONLayer === void 0 ? void 0 : geoJSONLayer.geojson;
|
|
7281
|
+
lastFeatureIndex = geoJSON !== undefined && getLastEmptyFeatureIndex(geoJSON) || undefined;
|
|
7282
|
+
if (!(lastFeatureIndex !== undefined)) {
|
|
7283
|
+
_context2.next = 23;
|
|
7284
|
+
break;
|
|
7285
|
+
}
|
|
7286
|
+
newGeoJSON = Object.assign(Object.assign({}, geoJSON), {
|
|
7287
|
+
features: geoJSON.features.filter(function (_feature, index) {
|
|
7288
|
+
return index !== lastFeatureIndex;
|
|
7289
|
+
})
|
|
7290
|
+
});
|
|
7291
|
+
_context2.next = 21;
|
|
7292
|
+
return put(layerActions.updateFeature({
|
|
7293
|
+
layerId: drawingTool.geoJSONLayerId,
|
|
7294
|
+
geojson: newGeoJSON
|
|
7295
|
+
}));
|
|
7296
|
+
case 21:
|
|
7297
|
+
_context2.next = 23;
|
|
7298
|
+
return put(layerActions.setSelectedFeature({
|
|
7299
|
+
layerId: drawingTool.geoJSONLayerId,
|
|
7300
|
+
selectedFeatureIndex: newGeoJSON.features.length > 0 ? newGeoJSON.features.length - 1 : 0
|
|
7301
|
+
}));
|
|
7302
|
+
case 23:
|
|
7182
7303
|
return _context2.abrupt("return");
|
|
7183
|
-
case
|
|
7304
|
+
case 24:
|
|
7184
7305
|
if (!(newDrawMode.value === 'DELETE')) {
|
|
7185
|
-
_context2.next =
|
|
7306
|
+
_context2.next = 33;
|
|
7186
7307
|
break;
|
|
7187
7308
|
}
|
|
7188
|
-
_context2.next =
|
|
7309
|
+
_context2.next = 27;
|
|
7189
7310
|
return put(layerActions.layerChangeGeojson({
|
|
7190
7311
|
layerId: drawingTool.geoJSONLayerId,
|
|
7191
7312
|
geojson: emptyGeoJSON
|
|
7192
7313
|
}));
|
|
7193
|
-
case
|
|
7314
|
+
case 27:
|
|
7194
7315
|
if (!geoJSONIntersectionLayerId) {
|
|
7195
|
-
_context2.next =
|
|
7316
|
+
_context2.next = 30;
|
|
7196
7317
|
break;
|
|
7197
7318
|
}
|
|
7198
|
-
_context2.next =
|
|
7319
|
+
_context2.next = 30;
|
|
7199
7320
|
return put(layerActions.layerChangeGeojson({
|
|
7200
7321
|
layerId: geoJSONIntersectionLayerId,
|
|
7201
7322
|
geojson: emptyGeoJSON
|
|
7202
7323
|
}));
|
|
7203
|
-
case
|
|
7204
|
-
_context2.next =
|
|
7324
|
+
case 30:
|
|
7325
|
+
_context2.next = 32;
|
|
7205
7326
|
return put(layerActions.toggleFeatureMode({
|
|
7206
7327
|
layerId: drawingTool.geoJSONLayerId,
|
|
7207
7328
|
isInEditMode: false,
|
|
7208
7329
|
drawMode: ''
|
|
7209
7330
|
}));
|
|
7210
|
-
case
|
|
7331
|
+
case 32:
|
|
7211
7332
|
return _context2.abrupt("return");
|
|
7212
|
-
case
|
|
7213
|
-
_context2.next =
|
|
7333
|
+
case 33:
|
|
7334
|
+
_context2.next = 35;
|
|
7214
7335
|
return select(getLayerById, drawingTool.geoJSONLayerId);
|
|
7215
|
-
case
|
|
7336
|
+
case 35:
|
|
7216
7337
|
currentGeoJSONLayer = _context2.sent;
|
|
7217
7338
|
_ref3 = currentGeoJSONLayer || {}, currentGeoJSON = _ref3.geojson, _ref3$selectedFeature = _ref3.selectedFeatureIndex, selectedFeatureIndex = _ref3$selectedFeature === void 0 ? 0 : _ref3$selectedFeature;
|
|
7218
7339
|
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;
|
|
7219
|
-
newSelectionType =
|
|
7340
|
+
newSelectionType = newDrawMode.selectionType;
|
|
7220
7341
|
isNewToolSelected = currentSelectionType !== newSelectionType;
|
|
7221
|
-
shouldUpdateNewShape = !((
|
|
7342
|
+
shouldUpdateNewShape = !((_c = currentGeoJSON === null || currentGeoJSON === void 0 ? void 0 : currentGeoJSON.features) === null || _c === void 0 ? void 0 : _c.length) || isNewToolSelected; // don't change anything if same tool is selected again
|
|
7222
7343
|
if (!(shouldUpdateNewShape && shouldUpdateShape)) {
|
|
7223
|
-
_context2.next =
|
|
7344
|
+
_context2.next = 50;
|
|
7224
7345
|
break;
|
|
7225
7346
|
}
|
|
7226
|
-
|
|
7227
|
-
|
|
7347
|
+
shapeWithSelectionType = addSelectionTypeToGeoJSON(newDrawMode.shape, newDrawMode.selectionType);
|
|
7348
|
+
geoJSONFeatureCollection = getFeatureCollection(shapeWithSelectionType, shouldAllowMultipleShapes, currentGeoJSON);
|
|
7349
|
+
_newGeoJSON = getGeoJson(geoJSONFeatureCollection, shouldAllowMultipleShapes);
|
|
7228
7350
|
if (shouldAllowMultipleShapes) {
|
|
7229
|
-
moveFeature(currentGeoJSON,
|
|
7351
|
+
moveFeature(currentGeoJSON, _newGeoJSON, selectedFeatureIndex, '');
|
|
7230
7352
|
}
|
|
7231
|
-
_context2.next =
|
|
7353
|
+
_context2.next = 48;
|
|
7232
7354
|
return put(layerActions.setSelectedFeature({
|
|
7233
7355
|
layerId: drawingTool.geoJSONLayerId,
|
|
7234
|
-
selectedFeatureIndex:
|
|
7356
|
+
selectedFeatureIndex: _newGeoJSON.features.length - 1
|
|
7235
7357
|
}));
|
|
7236
|
-
case
|
|
7237
|
-
_context2.next =
|
|
7358
|
+
case 48:
|
|
7359
|
+
_context2.next = 50;
|
|
7238
7360
|
return put(layerActions.updateFeature(Object.assign(Object.assign({
|
|
7239
7361
|
layerId: drawingTool.geoJSONLayerId,
|
|
7240
|
-
geojson:
|
|
7362
|
+
geojson: _newGeoJSON
|
|
7241
7363
|
}, geoJSONIntersectionLayerId && {
|
|
7242
7364
|
geoJSONIntersectionLayerId: geoJSONIntersectionLayerId
|
|
7243
7365
|
}), geoJSONIntersectionBoundsLayerId && {
|
|
7244
7366
|
geoJSONIntersectionBoundsLayerId: geoJSONIntersectionBoundsLayerId
|
|
7245
7367
|
})));
|
|
7246
|
-
case
|
|
7247
|
-
_context2.next =
|
|
7368
|
+
case 50:
|
|
7369
|
+
_context2.next = 52;
|
|
7248
7370
|
return put(layerActions.toggleFeatureMode({
|
|
7249
7371
|
layerId: drawingTool.geoJSONLayerId,
|
|
7250
7372
|
isInEditMode: newDrawMode.isSelectable,
|
|
7251
7373
|
drawMode: newDrawMode.value
|
|
7252
7374
|
}));
|
|
7253
|
-
case
|
|
7254
|
-
_context2.next =
|
|
7375
|
+
case 52:
|
|
7376
|
+
_context2.next = 57;
|
|
7255
7377
|
break;
|
|
7256
|
-
case
|
|
7257
|
-
_context2.prev =
|
|
7378
|
+
case 54:
|
|
7379
|
+
_context2.prev = 54;
|
|
7258
7380
|
_context2.t0 = _context2["catch"](0);
|
|
7259
7381
|
// eslint-disable-next-line no-console
|
|
7260
7382
|
console.log('error changeDrawToolSaga', _context2.t0);
|
|
7261
|
-
case
|
|
7383
|
+
case 57:
|
|
7262
7384
|
case "end":
|
|
7263
7385
|
return _context2.stop();
|
|
7264
7386
|
}
|
|
7265
|
-
}, _callee2, null, [[0,
|
|
7387
|
+
}, _callee2, null, [[0, 54]]);
|
|
7266
7388
|
})();
|
|
7267
7389
|
}
|
|
7268
7390
|
function changeIntersectionSaga(_ref4) {
|
|
@@ -7386,17 +7508,26 @@ var createMultipleLayersState = function createMultipleLayersState(layers, mapId
|
|
|
7386
7508
|
byId: {}
|
|
7387
7509
|
}
|
|
7388
7510
|
};
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
mockState.
|
|
7511
|
+
var _iterator = _createForOfIteratorHelper(layers),
|
|
7512
|
+
_step;
|
|
7513
|
+
try {
|
|
7514
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
7515
|
+
var layer = _step.value;
|
|
7516
|
+
var layerState = createLayer(Object.assign(Object.assign({}, layer), {
|
|
7517
|
+
id: layer.id,
|
|
7518
|
+
mapId: mapId
|
|
7519
|
+
}));
|
|
7520
|
+
mockState.byId[layer.id] = Object.assign({}, layerState);
|
|
7521
|
+
mockState.allIds.push(layer.id);
|
|
7522
|
+
if (layer.layerType === LayerType.baseLayer) {
|
|
7523
|
+
mockState.availableBaseLayers.byId[layer.id] = Object.assign({}, layerState);
|
|
7524
|
+
mockState.availableBaseLayers.allIds.push(layer.id);
|
|
7525
|
+
}
|
|
7399
7526
|
}
|
|
7527
|
+
} catch (err) {
|
|
7528
|
+
_iterator.e(err);
|
|
7529
|
+
} finally {
|
|
7530
|
+
_iterator.f();
|
|
7400
7531
|
}
|
|
7401
7532
|
return mockState;
|
|
7402
7533
|
};
|
|
@@ -7408,12 +7539,13 @@ var createWebmapState = function createWebmapState() {
|
|
|
7408
7539
|
for (var _len = arguments.length, mapIds = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
7409
7540
|
mapIds[_key] = arguments[_key];
|
|
7410
7541
|
}
|
|
7411
|
-
for (var
|
|
7542
|
+
for (var _i = 0, _mapIds = mapIds; _i < _mapIds.length; _i++) {
|
|
7543
|
+
var mapId = _mapIds[_i];
|
|
7412
7544
|
var mapState = createMap({
|
|
7413
|
-
id:
|
|
7545
|
+
id: mapId
|
|
7414
7546
|
});
|
|
7415
|
-
mockState.byId[
|
|
7416
|
-
mockState.allIds.push(
|
|
7547
|
+
mockState.byId[mapId] = Object.assign({}, mapState);
|
|
7548
|
+
mockState.allIds.push(mapId);
|
|
7417
7549
|
}
|
|
7418
7550
|
return mockState;
|
|
7419
7551
|
};
|
|
@@ -7425,13 +7557,14 @@ var createMapDimensionsState = function createMapDimensionsState(dimensions) {
|
|
|
7425
7557
|
for (var _len2 = arguments.length, mapIds = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
7426
7558
|
mapIds[_key2 - 1] = arguments[_key2];
|
|
7427
7559
|
}
|
|
7428
|
-
for (var
|
|
7560
|
+
for (var _i2 = 0, _mapIds2 = mapIds; _i2 < _mapIds2.length; _i2++) {
|
|
7561
|
+
var mapId = _mapIds2[_i2];
|
|
7429
7562
|
var mapState = createMap({
|
|
7430
|
-
id:
|
|
7563
|
+
id: mapId
|
|
7431
7564
|
});
|
|
7432
|
-
mockState.byId[
|
|
7433
|
-
mockState.byId[
|
|
7434
|
-
mockState.allIds.push(
|
|
7565
|
+
mockState.byId[mapId] = Object.assign({}, mapState);
|
|
7566
|
+
mockState.byId[mapId].dimensions = dimensions;
|
|
7567
|
+
mockState.allIds.push(mapId);
|
|
7435
7568
|
}
|
|
7436
7569
|
return mockState;
|
|
7437
7570
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/store",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.9.0",
|
|
4
4
|
"description": "GeoWeb Store library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -15,10 +15,9 @@
|
|
|
15
15
|
"@opengeoweb/webmap-react": "*",
|
|
16
16
|
"redux-saga": "^1.2.3",
|
|
17
17
|
"@opengeoweb/webmap": "*",
|
|
18
|
-
"immer": "^
|
|
18
|
+
"immer": "^10.0.3",
|
|
19
19
|
"@redux-eggs/redux-toolkit": "^2.2.0",
|
|
20
20
|
"@redux-eggs/saga-extension": "^2.2.0",
|
|
21
|
-
"date-fns": "^3.3.0",
|
|
22
21
|
"lodash": "^4.17.21",
|
|
23
22
|
"@opengeoweb/theme": "*"
|
|
24
23
|
},
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const testDefaultPoint:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
title: string;
|
|
6
|
-
shape: import("geojson").Feature<import("geojson").Geometry, import("geojson").GeoJsonProperties>;
|
|
7
|
-
isSelectable: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare const testDefaultPolygon: {
|
|
10
|
-
drawModeId: string;
|
|
11
|
-
value: DRAWMODE;
|
|
12
|
-
title: string;
|
|
13
|
-
shape: import("geojson").Feature<import("geojson").Geometry, import("geojson").GeoJsonProperties>;
|
|
14
|
-
isSelectable: boolean;
|
|
15
|
-
};
|
|
16
|
-
export declare const testDefaultDelete: {
|
|
17
|
-
drawModeId: string;
|
|
18
|
-
value: "DELETE";
|
|
19
|
-
title: string;
|
|
20
|
-
shape: import("geojson").Feature<import("geojson").Geometry, import("geojson").GeoJsonProperties>;
|
|
21
|
-
isSelectable: boolean;
|
|
22
|
-
};
|
|
1
|
+
import { DrawMode } from '@opengeoweb/webmap-react';
|
|
2
|
+
export declare const testDefaultPoint: DrawMode;
|
|
3
|
+
export declare const testDefaultPolygon: DrawMode;
|
|
4
|
+
export declare const testDefaultDelete: DrawMode;
|
|
@@ -4,6 +4,6 @@ import { WebMapStateModuleState } from './types';
|
|
|
4
4
|
export declare const mapStoreReducers: {
|
|
5
5
|
webmap: import("redux").Reducer<import("./types").WebMapState, import("redux").AnyAction>;
|
|
6
6
|
services: import("redux").Reducer<import("./types").ServiceState, import("redux").AnyAction>;
|
|
7
|
-
layers: import("redux").Reducer<import("
|
|
7
|
+
layers: import("redux").Reducer<import("./types").LayerState, import("redux").AnyAction>;
|
|
8
8
|
};
|
|
9
9
|
export declare const mapStoreModuleConfig: Egg<Store<WebMapStateModuleState>>;
|
|
@@ -88,6 +88,6 @@ export declare const mapStoreActions: {
|
|
|
88
88
|
export * from './service';
|
|
89
89
|
export * from './map';
|
|
90
90
|
export * from './layers';
|
|
91
|
-
export type { WebMapStateModuleState } from './types';
|
|
91
|
+
export type { WebMapStateModuleState, MapPreset } from './types';
|
|
92
92
|
export * as storeTestSettings from './storeTestSettings';
|
|
93
93
|
export * from './config';
|
|
@@ -3,7 +3,7 @@ import { SetLayerDimensionsPayload, SetLayerStylePayload, UpdateLayerInfoPayload
|
|
|
3
3
|
import { LayerState, Layer, AddLayerPayload, SetLayerDimensionPayload, SetLayerEnabledPayload, SetLayerOpacityPayload, SetLayerNamePayload, SetLayerGeojsonPayload, DeleteLayerPayload, ErrorLayerPayload, SetLayersPayload, SetBaseLayersPayload, AddBaseLayerPayload, AddAvailableBaseLayerPayload, AddAvailableBaseLayersPayload, SetAvailableBaseLayersPayload, SetSelectedFeaturePayload, UpdateFeaturePayload, ExitFeatureDrawModePayload, ToggleFeatureModePayload, UpdateFeaturePropertiesPayload, DuplicateMapLayerPayload } 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
|
-
export declare const slice: import("@reduxjs/toolkit").Slice<
|
|
6
|
+
export declare const slice: import("@reduxjs/toolkit").Slice<LayerState, {
|
|
7
7
|
addLayer: (draft: Draft<LayerState>, action: PayloadAction<AddLayerPayload>) => void;
|
|
8
8
|
duplicateMapLayer: (draft: Draft<LayerState>, action: PayloadAction<DuplicateMapLayerPayload>) => void;
|
|
9
9
|
layerChangeDimension: (draft: Draft<LayerState>, action: PayloadAction<SetLayerDimensionPayload>) => void;
|
|
@@ -26,7 +26,7 @@ export declare const slice: import("@reduxjs/toolkit").Slice<import("immer/dist/
|
|
|
26
26
|
addAvailableBaseLayer: (draft: Draft<LayerState>, action: PayloadAction<AddAvailableBaseLayerPayload>) => void;
|
|
27
27
|
addAvailableBaseLayers: (draft: Draft<LayerState>, action: PayloadAction<AddAvailableBaseLayersPayload>) => void;
|
|
28
28
|
setAvailableBaseLayers: (draft: Draft<LayerState>, action: PayloadAction<SetAvailableBaseLayersPayload>) => void;
|
|
29
|
-
setUseLatestReferenceTime: (draft:
|
|
29
|
+
setUseLatestReferenceTime: (draft: Draft<LayerState>, action: PayloadAction<{
|
|
30
30
|
id: string;
|
|
31
31
|
useLatestReferenceTime: boolean;
|
|
32
32
|
}>) => void;
|
|
@@ -40,7 +40,7 @@ export declare const slice: import("@reduxjs/toolkit").Slice<import("immer/dist/
|
|
|
40
40
|
toggleFeatureMode: (draft: Draft<LayerState>, action: PayloadAction<ToggleFeatureModePayload>) => void;
|
|
41
41
|
exitFeatureDrawMode: (draft: Draft<LayerState>, action: PayloadAction<ExitFeatureDrawModePayload>) => void;
|
|
42
42
|
}, "layerReducer">;
|
|
43
|
-
export declare const reducer: import("redux").Reducer<
|
|
43
|
+
export declare const reducer: import("redux").Reducer<LayerState, import("redux").AnyAction>;
|
|
44
44
|
export declare const layerActions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
45
45
|
addLayer: (draft: Draft<LayerState>, action: PayloadAction<AddLayerPayload>) => void;
|
|
46
46
|
duplicateMapLayer: (draft: Draft<LayerState>, action: PayloadAction<DuplicateMapLayerPayload>) => void;
|
|
@@ -64,7 +64,7 @@ export declare const layerActions: import("@reduxjs/toolkit").CaseReducerActions
|
|
|
64
64
|
addAvailableBaseLayer: (draft: Draft<LayerState>, action: PayloadAction<AddAvailableBaseLayerPayload>) => void;
|
|
65
65
|
addAvailableBaseLayers: (draft: Draft<LayerState>, action: PayloadAction<AddAvailableBaseLayersPayload>) => void;
|
|
66
66
|
setAvailableBaseLayers: (draft: Draft<LayerState>, action: PayloadAction<SetAvailableBaseLayersPayload>) => void;
|
|
67
|
-
setUseLatestReferenceTime: (draft:
|
|
67
|
+
setUseLatestReferenceTime: (draft: Draft<LayerState>, action: PayloadAction<{
|
|
68
68
|
id: string;
|
|
69
69
|
useLatestReferenceTime: boolean;
|
|
70
70
|
}>) => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { layerTypes } from '../layers';
|
|
2
2
|
export declare const filterLayers: (layers?: layerTypes.Layer[], layerParser?: (layer: layerTypes.Layer) => layerTypes.Layer) => FilteredLayerList;
|
|
3
3
|
export declare const createEmtpyFilteredList: (existingList: []) => FilteredLayerList;
|
|
4
|
-
export
|
|
4
|
+
export interface FilteredLayerList {
|
|
5
5
|
mapLayers: layerTypes.Layer[];
|
|
6
6
|
baseLayers: layerTypes.Layer[];
|
|
7
7
|
overLayers?: layerTypes.Layer[];
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
export declare const parseBoolean: (value: string | boolean) => boolean;
|
|
10
10
|
export declare const parseLayer: (layer: layerTypes.Layer) => layerTypes.Layer;
|
|
@@ -4,7 +4,7 @@ export declare const mapUtils: {
|
|
|
4
4
|
replaceLayerIdsToEnsureUniqueLayerIdsInStore: (layerIds: import("./replaceLayerIdsToEnsureUniqueLayerIdsInStore").LayersAndAutoLayerIds) => import("./replaceLayerIdsToEnsureUniqueLayerIdsInStore").LayersAndAutoLayerIds;
|
|
5
5
|
moveArrayElements<T>(array: T[], oldIndex: number, newIndex: number): T[];
|
|
6
6
|
dateFormat: "yyyy-MM-dd'T'HH:mm:ss'Z";
|
|
7
|
-
createMap: ({ id, isAnimating, animationStartTime, animationEndTime, isAutoUpdating,
|
|
7
|
+
createMap: ({ id, isAnimating, animationStartTime, animationEndTime, isAutoUpdating, shouldEndtimeOverride, bbox, srs, baseLayers, overLayers, mapLayers, featureLayers, dimensions, autoUpdateLayerId, autoTimeStepLayerId, timeSliderSpan, timeStep, animationDelay, timeSliderWidth, timeSliderCenterTime, timeSliderSecondsPerPx, isTimestepAuto, isTimeSpanAuto, isTimeSliderHoverOn, isTimeSliderVisible, displayMapPin, disableMapPin, shouldShowZoomControls, }: utils.CreateMapProps) => mapTypes.WebMap;
|
|
8
8
|
checkValidLayersPayload: (layers: import("../types").Layer[], mapId: string) => boolean;
|
|
9
9
|
getDraftMapById: (mapId: string, draft: mapTypes.WebMapState) => mapTypes.WebMap;
|
|
10
10
|
produceDraftStateSetWebMapDimension: (draft: mapTypes.WebMapState, mapId: string, dimensionFromAction: mapTypes.Dimension, overwriteCurrentValue: boolean) => void;
|
|
@@ -264,7 +264,7 @@ export declare const linkedMapAnimationInfo: ((state: CoreAppStore, mapId: strin
|
|
|
264
264
|
* @param {string} mapId mapId: string - Id of the map
|
|
265
265
|
* @returns {string} returnType: string
|
|
266
266
|
*/
|
|
267
|
-
export declare const getAnimationStartTime: ((state: any, mapId: any) => string) & import("reselect").OutputSelectorFields<(args_0: WebMap | undefined) => string, {
|
|
267
|
+
export declare const getAnimationStartTime: ((state: any, mapId: any) => string | undefined) & import("reselect").OutputSelectorFields<(args_0: WebMap | undefined) => string | undefined, {
|
|
268
268
|
clearCache: () => void;
|
|
269
269
|
}> & {
|
|
270
270
|
clearCache: () => void;
|
|
@@ -277,7 +277,7 @@ export declare const getAnimationStartTime: ((state: any, mapId: any) => string)
|
|
|
277
277
|
* @param {string} mapId mapId: string - Id of the map
|
|
278
278
|
* @returns {string} returnType: string
|
|
279
279
|
*/
|
|
280
|
-
export declare const getAnimationEndTime: ((state: any, mapId: any) => string) & import("reselect").OutputSelectorFields<(args_0: WebMap | undefined) => string, {
|
|
280
|
+
export declare const getAnimationEndTime: ((state: any, mapId: any) => string | undefined) & import("reselect").OutputSelectorFields<(args_0: WebMap | undefined) => string | undefined, {
|
|
281
281
|
clearCache: () => void;
|
|
282
282
|
}> & {
|
|
283
283
|
clearCache: () => void;
|
|
@@ -298,12 +298,12 @@ export declare const isAutoUpdating: ((state: any, mapId: any) => boolean) & imp
|
|
|
298
298
|
/**
|
|
299
299
|
* Gets if endTime and duration of animationPayload are overriding maxValue and minValue of leading layer
|
|
300
300
|
*
|
|
301
|
-
* Example:
|
|
301
|
+
* Example: shouldEndtimeOverride = shouldEndtimeOverride(store, 'mapid_1')
|
|
302
302
|
* @param {object} store store: object - store object
|
|
303
303
|
* @param {string} mapId mapId: string - Id of the map
|
|
304
304
|
* @returns {boolean} returnType: boolean
|
|
305
305
|
*/
|
|
306
|
-
export declare const
|
|
306
|
+
export declare const shouldEndtimeOverride: ((state: any, mapId: any) => boolean) & import("reselect").OutputSelectorFields<(args_0: WebMap | undefined) => boolean, {
|
|
307
307
|
clearCache: () => void;
|
|
308
308
|
}> & {
|
|
309
309
|
clearCache: () => void;
|
|
@@ -647,7 +647,7 @@ export declare const getLegendId: ((state: any, mapId: any) => string | undefine
|
|
|
647
647
|
* @param {string} mapId mapId: string - Id of the map
|
|
648
648
|
* @returns {MapPreset} returnType: MapPreset
|
|
649
649
|
*/
|
|
650
|
-
export declare const getMapPreset: ((state: any, mapId: any) => MapPreset) & import("reselect").OutputSelectorFields<(args_0: import("../types").ReduxLayer[], args_1: import("../types").ReduxLayer[], args_2: import("../types").ReduxLayer[], args_3: Bbox, args_4: string, args_5: string | undefined, args_6: string | undefined, args_7: string | undefined, args_8: boolean, args_9: boolean, args_10: boolean | undefined, args_11: boolean | undefined, args_12: boolean | undefined, args_13: number, args_14: number | undefined, args_15: string, args_16: string, args_17: boolean | undefined, args_18: string | undefined, args_19: uiTypes.UIStoreType) => MapPreset, {
|
|
650
|
+
export declare const getMapPreset: ((state: any, mapId: any) => MapPreset) & import("reselect").OutputSelectorFields<(args_0: import("../types").ReduxLayer[], args_1: import("../types").ReduxLayer[], args_2: import("../types").ReduxLayer[], args_3: Bbox, args_4: string, args_5: string | undefined, args_6: string | undefined, args_7: string | undefined, args_8: boolean, args_9: boolean, args_10: boolean | undefined, args_11: boolean | undefined, args_12: boolean | undefined, args_13: number, args_14: number | undefined, args_15: string | undefined, args_16: string | undefined, args_17: boolean | undefined, args_18: string | undefined, args_19: uiTypes.UIStoreType) => MapPreset, {
|
|
651
651
|
clearCache: () => void;
|
|
652
652
|
}> & {
|
|
653
653
|
clearCache: () => void;
|
|
@@ -19,7 +19,7 @@ export interface WebMap {
|
|
|
19
19
|
animationStartTime?: string;
|
|
20
20
|
animationEndTime?: string;
|
|
21
21
|
isAutoUpdating: boolean;
|
|
22
|
-
|
|
22
|
+
shouldEndtimeOverride: boolean;
|
|
23
23
|
srs: string;
|
|
24
24
|
bbox: Bbox;
|
|
25
25
|
mapLayers: string[];
|
|
@@ -108,10 +108,10 @@ export interface MoveLayerPayload {
|
|
|
108
108
|
newIndex: number;
|
|
109
109
|
origin: string;
|
|
110
110
|
}
|
|
111
|
-
export
|
|
111
|
+
export interface TimeListType {
|
|
112
112
|
name: string;
|
|
113
113
|
value: string;
|
|
114
|
-
}
|
|
114
|
+
}
|
|
115
115
|
export interface SetMapAnimationStartPayload {
|
|
116
116
|
mapId: string;
|
|
117
117
|
start?: string;
|
|
@@ -10,7 +10,7 @@ export interface CreateMapProps {
|
|
|
10
10
|
animationStartTime?: string;
|
|
11
11
|
animationEndTime?: string;
|
|
12
12
|
isAutoUpdating?: boolean;
|
|
13
|
-
|
|
13
|
+
shouldEndtimeOverride?: boolean;
|
|
14
14
|
srs?: string;
|
|
15
15
|
bbox?: Bbox;
|
|
16
16
|
mapLayers?: string[];
|
|
@@ -34,7 +34,7 @@ export interface CreateMapProps {
|
|
|
34
34
|
disableMapPin?: boolean;
|
|
35
35
|
shouldShowZoomControls?: boolean;
|
|
36
36
|
}
|
|
37
|
-
export declare const createMap: ({ id, isAnimating, animationStartTime, animationEndTime, isAutoUpdating,
|
|
37
|
+
export declare const createMap: ({ id, isAnimating, animationStartTime, animationEndTime, isAutoUpdating, shouldEndtimeOverride, bbox, srs, baseLayers, overLayers, mapLayers, featureLayers, dimensions, autoUpdateLayerId, autoTimeStepLayerId, timeSliderSpan, timeStep, animationDelay, timeSliderWidth, timeSliderCenterTime, timeSliderSecondsPerPx, isTimestepAuto, isTimeSpanAuto, isTimeSliderHoverOn, isTimeSliderVisible, displayMapPin, disableMapPin, shouldShowZoomControls, }: CreateMapProps) => WebMap;
|
|
38
38
|
export declare const checkValidLayersPayload: (layers: Layer[], mapId: string) => boolean;
|
|
39
39
|
/**
|
|
40
40
|
* This will get the map from the map draftstate.
|
|
@@ -6,9 +6,7 @@ export interface InitialService {
|
|
|
6
6
|
scope?: ServiceScope;
|
|
7
7
|
abstract?: string;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
10
|
-
[key: string]: ReduxService;
|
|
11
|
-
}
|
|
9
|
+
export type Services = Record<string, ReduxService>;
|
|
12
10
|
export type ServiceScope = 'user' | 'system';
|
|
13
11
|
export interface ReduxService {
|
|
14
12
|
id?: string;
|