@opengeoweb/store 9.8.0 → 9.10.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 +895 -577
- package/package.json +3 -5
- package/src/store/drawingtool/reducer.spec.d.ts +4 -22
- package/src/store/drawingtool/selectors.d.ts +5 -0
- package/src/store/generic/synchronizationActions/actions.d.ts +1 -1
- package/src/store/generic/synchronizationActions/types.d.ts +3 -3
- 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/layers/types.d.ts +1 -0
- 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/mapSagaAnimationUtils.d.ts +30 -0
- package/src/store/mapStore/map/sagas.d.ts +18 -8
- package/src/store/mapStore/map/selectors.d.ts +17 -6
- package/src/store/mapStore/map/types.d.ts +8 -3
- package/src/store/mapStore/map/utils.d.ts +2 -2
- package/src/store/mapStore/service/types.d.ts +1 -3
- package/src/store/testUtils/Providers.d.ts +4 -6
- package/src/store/ui/listener.d.ts +2 -0
- package/src/store/ui/listener.spec.d.ts +1 -0
- package/src/store/ui/sagas.d.ts +0 -5
- /package/src/store/{ui/sagas.spec.d.ts → mapStore/map/mapSagaAnimationUtils.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { getGeoJson, moveFeature, createInterSections, defaultLayers, getFeatureCollection, emptyGeoJSON, defaultIntersectionStyleProperties } from '@opengeoweb/webmap-react';
|
|
1
|
+
import { webmapUtils, LayerType, webmapTestSettings, WMLayer, getWMJSMapById, getMapImageStore, getAlternativeImage, handleMomentISOString, getCapabilities } from '@opengeoweb/webmap';
|
|
2
|
+
import { createAction, createSlice, createSelector, createEntityAdapter, createListenerMiddleware } from '@reduxjs/toolkit';
|
|
3
|
+
import { getGeoJson, moveFeature, createInterSections, getLastEmptyFeatureIndex, defaultLayers, addSelectionTypeToGeoJSON, getFeatureCollection, emptyGeoJSON, defaultIntersectionStyleProperties } from '@opengeoweb/webmap-react';
|
|
5
4
|
export { defaultLayers } from '@opengeoweb/webmap-react';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { dateUtils, metronome, withEggs } from '@opengeoweb/shared';
|
|
6
|
+
import { produce } from 'immer';
|
|
8
7
|
import { isEqual, compact } from 'lodash';
|
|
9
8
|
import { createStore as createStore$1 } from '@redux-eggs/redux-toolkit';
|
|
10
9
|
import { getSagaExtension } from '@redux-eggs/saga-extension';
|
|
11
|
-
import { takeEvery, takeLatest,
|
|
10
|
+
import { call, takeEvery, takeLatest, select, put, all, take, delay } from 'redux-saga/effects';
|
|
11
|
+
import { eventChannel } from 'redux-saga';
|
|
12
12
|
import React, { useCallback, useEffect } from 'react';
|
|
13
13
|
import { Provider, useDispatch, useSelector } from 'react-redux';
|
|
14
|
-
import { ThemeWrapper, lightTheme } from '@opengeoweb/theme';
|
|
15
14
|
|
|
16
15
|
function _iterableToArrayLimit(r, l) {
|
|
17
16
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
@@ -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.
|
|
@@ -431,6 +481,16 @@ function __rest(s, e) {
|
|
|
431
481
|
return t;
|
|
432
482
|
}
|
|
433
483
|
|
|
484
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
485
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
486
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
487
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
488
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
489
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
490
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
|
|
434
494
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
435
495
|
var e = new Error(message);
|
|
436
496
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -562,17 +622,17 @@ var createMap = function createMap(_ref) {
|
|
|
562
622
|
_ref$isAnimating = _ref.isAnimating,
|
|
563
623
|
isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating,
|
|
564
624
|
_ref$animationStartTi = _ref.animationStartTime,
|
|
565
|
-
animationStartTime = _ref$animationStartTi === void 0 ? dateUtils.dateToString(dateUtils.sub(dateUtils.
|
|
625
|
+
animationStartTime = _ref$animationStartTi === void 0 ? dateUtils.dateToString(dateUtils.sub(dateUtils.getNowUtc(), {
|
|
566
626
|
hours: 5
|
|
567
627
|
}), dateFormat) : _ref$animationStartTi,
|
|
568
628
|
_ref$animationEndTime = _ref.animationEndTime,
|
|
569
|
-
animationEndTime = _ref$animationEndTime === void 0 ? dateUtils.dateToString(dateUtils.sub(dateUtils.
|
|
629
|
+
animationEndTime = _ref$animationEndTime === void 0 ? dateUtils.dateToString(dateUtils.sub(dateUtils.getNowUtc(), {
|
|
570
630
|
minutes: 10
|
|
571
631
|
}), dateFormat) : _ref$animationEndTime,
|
|
572
632
|
_ref$isAutoUpdating = _ref.isAutoUpdating,
|
|
573
633
|
isAutoUpdating = _ref$isAutoUpdating === void 0 ? false : _ref$isAutoUpdating,
|
|
574
|
-
_ref$
|
|
575
|
-
|
|
634
|
+
_ref$shouldEndtimeOve = _ref.shouldEndtimeOverride,
|
|
635
|
+
shouldEndtimeOverride = _ref$shouldEndtimeOve === void 0 ? false : _ref$shouldEndtimeOve,
|
|
576
636
|
_ref$bbox = _ref.bbox,
|
|
577
637
|
bbox = _ref$bbox === void 0 ? {
|
|
578
638
|
left: -19000000,
|
|
@@ -626,7 +686,7 @@ var createMap = function createMap(_ref) {
|
|
|
626
686
|
animationStartTime: animationStartTime,
|
|
627
687
|
animationEndTime: animationEndTime,
|
|
628
688
|
isAutoUpdating: isAutoUpdating,
|
|
629
|
-
|
|
689
|
+
shouldEndtimeOverride: shouldEndtimeOverride,
|
|
630
690
|
srs: srs,
|
|
631
691
|
bbox: bbox,
|
|
632
692
|
baseLayers: baseLayers,
|
|
@@ -654,19 +714,28 @@ var createMap = function createMap(_ref) {
|
|
|
654
714
|
var checkValidLayersPayload = function checkValidLayersPayload(layers, mapId) {
|
|
655
715
|
/* Check for duplicate ids */
|
|
656
716
|
var layerIds = {};
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
717
|
+
var _iterator = _createForOfIteratorHelper(layers),
|
|
718
|
+
_step;
|
|
719
|
+
try {
|
|
720
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
721
|
+
var layer = _step.value;
|
|
722
|
+
if (layer.id) {
|
|
723
|
+
/* Check if layer is already added to a different map */
|
|
724
|
+
if (layer.mapId && mapId && layer.mapId !== mapId) {
|
|
725
|
+
return false;
|
|
726
|
+
}
|
|
727
|
+
/* Check duplicate */
|
|
728
|
+
if (!layerIds[layer.id]) {
|
|
729
|
+
layerIds[layer.id] = true;
|
|
730
|
+
} else {
|
|
731
|
+
return false;
|
|
732
|
+
}
|
|
668
733
|
}
|
|
669
734
|
}
|
|
735
|
+
} catch (err) {
|
|
736
|
+
_iterator.e(err);
|
|
737
|
+
} finally {
|
|
738
|
+
_iterator.f();
|
|
670
739
|
}
|
|
671
740
|
return true;
|
|
672
741
|
};
|
|
@@ -799,7 +868,7 @@ var getSpeedFactor = function getSpeedFactor(speedDelay) {
|
|
|
799
868
|
return defaultDelay / speedDelay;
|
|
800
869
|
};
|
|
801
870
|
var getAnimationDuration = function getAnimationDuration(animationEndTime, animationStartTime) {
|
|
802
|
-
return animationEndTime && animationStartTime ? differenceInMinutes(new Date(animationEndTime), new Date(animationStartTime)) : 0;
|
|
871
|
+
return animationEndTime && animationStartTime ? dateUtils.differenceInMinutes(new Date(animationEndTime), new Date(animationStartTime)) : 0;
|
|
803
872
|
};
|
|
804
873
|
/**
|
|
805
874
|
* Returns speed delay for given speedFactor. For options, see defined above in "speedFactors"
|
|
@@ -1098,10 +1167,10 @@ var setBbox = createAction('GENERIC_SETBBOX');
|
|
|
1098
1167
|
*
|
|
1099
1168
|
* These actions should not be used by components directly. Components should only use the generic actions.
|
|
1100
1169
|
*/
|
|
1101
|
-
var setTimeSync = createAction('GENERIC_SYNC_SETTIME', function (
|
|
1170
|
+
var setTimeSync = createAction('GENERIC_SYNC_SETTIME', function (setTimePayload, targets, groups) {
|
|
1102
1171
|
return {
|
|
1103
1172
|
payload: {
|
|
1104
|
-
source: setTime(
|
|
1173
|
+
source: setTimePayload && setTime(setTimePayload),
|
|
1105
1174
|
groups: groups,
|
|
1106
1175
|
targets: targets
|
|
1107
1176
|
}
|
|
@@ -1300,17 +1369,15 @@ var slice$7 = createSlice({
|
|
|
1300
1369
|
}
|
|
1301
1370
|
/*
|
|
1302
1371
|
All layer id's for the specified mapId should be removed.
|
|
1303
|
-
This is done by
|
|
1372
|
+
This is done by filtering the allId array. Keeping only the layer id's which don't exist in the byId object
|
|
1304
1373
|
At the same time the byId object is synchronized.
|
|
1305
1374
|
*/
|
|
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) {
|
|
1375
|
+
draft.allIds = draft.allIds.filter(function (layerId) {
|
|
1376
|
+
if (draft.byId[layerId] && draft.byId[layerId].layerType !== LayerType.baseLayer && draft.byId[layerId].layerType !== LayerType.overLayer && draft.byId[layerId].mapId === mapId) {
|
|
1310
1377
|
delete draft.byId[layerId];
|
|
1311
|
-
|
|
1312
|
-
draft.allIds.push(layerId);
|
|
1378
|
+
return false;
|
|
1313
1379
|
}
|
|
1380
|
+
return true;
|
|
1314
1381
|
});
|
|
1315
1382
|
/*
|
|
1316
1383
|
Here we set the layers for the mapId from the action. byId and allIds is updated.
|
|
@@ -1340,14 +1407,13 @@ var slice$7 = createSlice({
|
|
|
1340
1407
|
layerTypes.push(layer.layerType);
|
|
1341
1408
|
}
|
|
1342
1409
|
});
|
|
1343
|
-
var state = current(draft);
|
|
1344
1410
|
// remove current layers with same type as one of the passed layers
|
|
1345
|
-
|
|
1346
|
-
if (
|
|
1411
|
+
draft.allIds = draft.allIds.filter(function (layerId) {
|
|
1412
|
+
if (draft.byId[layerId] && layerTypes.includes(draft.byId[layerId].layerType) && draft.byId[layerId].mapId === mapId) {
|
|
1347
1413
|
delete draft.byId[layerId];
|
|
1348
|
-
|
|
1349
|
-
draft.allIds.splice(index, 1);
|
|
1414
|
+
return false;
|
|
1350
1415
|
}
|
|
1416
|
+
return true;
|
|
1351
1417
|
});
|
|
1352
1418
|
// set over and base layers
|
|
1353
1419
|
filtererdBaseLayers.forEach(function (layer) {
|
|
@@ -1412,14 +1478,13 @@ var slice$7 = createSlice({
|
|
|
1412
1478
|
var _action$payload13 = action.payload,
|
|
1413
1479
|
layers = _action$payload13.layers,
|
|
1414
1480
|
mapId = _action$payload13.mapId;
|
|
1415
|
-
var state = current(draft);
|
|
1416
1481
|
// remove current baselayers for passed map
|
|
1417
|
-
|
|
1418
|
-
if (
|
|
1482
|
+
draft.availableBaseLayers.allIds = draft.availableBaseLayers.allIds.filter(function (layerId) {
|
|
1483
|
+
if (draft.availableBaseLayers.byId[layerId] && draft.availableBaseLayers.byId[layerId].mapId === mapId) {
|
|
1419
1484
|
delete draft.availableBaseLayers.byId[layerId];
|
|
1420
|
-
|
|
1421
|
-
draft.availableBaseLayers.allIds.splice(index, 1);
|
|
1485
|
+
return false;
|
|
1422
1486
|
}
|
|
1487
|
+
return true;
|
|
1423
1488
|
});
|
|
1424
1489
|
// add new available baselayers
|
|
1425
1490
|
layers.forEach(function (layer) {
|
|
@@ -1529,18 +1594,18 @@ var slice$7 = createSlice({
|
|
|
1529
1594
|
_action$payload17$rea = _action$payload17.reason,
|
|
1530
1595
|
reason = _action$payload17$rea === void 0 ? '' : _action$payload17$rea,
|
|
1531
1596
|
geoJSONIntersectionLayerId = _action$payload17.geoJSONIntersectionLayerId,
|
|
1532
|
-
geoJSONIntersectionBoundsLayerId = _action$payload17.geoJSONIntersectionBoundsLayerId
|
|
1597
|
+
geoJSONIntersectionBoundsLayerId = _action$payload17.geoJSONIntersectionBoundsLayerId,
|
|
1598
|
+
selectionType = _action$payload17.selectionType;
|
|
1533
1599
|
var currentLayer = draft.byId[layerId];
|
|
1534
1600
|
if (!currentLayer) {
|
|
1535
1601
|
return;
|
|
1536
1602
|
}
|
|
1537
1603
|
var updatedGeoJSON = getGeoJson(geojson, shouldAllowMultipleShapes);
|
|
1538
1604
|
if (shouldAllowMultipleShapes) {
|
|
1539
|
-
var
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
var newFeatureIndex = moveFeature(currentGeoJSON, updatedGeoJSON, selectedFeatureIndex, reason);
|
|
1605
|
+
var currentGeoJSON = currentLayer.geojson,
|
|
1606
|
+
_currentLayer$selecte = currentLayer.selectedFeatureIndex,
|
|
1607
|
+
selectedFeatureIndex = _currentLayer$selecte === void 0 ? 0 : _currentLayer$selecte;
|
|
1608
|
+
var newFeatureIndex = moveFeature(currentGeoJSON, updatedGeoJSON, selectedFeatureIndex, reason, selectionType);
|
|
1544
1609
|
if (newFeatureIndex !== undefined) {
|
|
1545
1610
|
currentLayer.selectedFeatureIndex = newFeatureIndex;
|
|
1546
1611
|
}
|
|
@@ -1552,8 +1617,8 @@ var slice$7 = createSlice({
|
|
|
1552
1617
|
if (!intersectionLayer || !intersectionBoundsLayer) {
|
|
1553
1618
|
return;
|
|
1554
1619
|
}
|
|
1555
|
-
var bounds =
|
|
1556
|
-
var geoJSONProperties =
|
|
1620
|
+
var bounds = intersectionBoundsLayer.geojson;
|
|
1621
|
+
var geoJSONProperties = intersectionLayer.defaultGeoJSONProperties || ((_b = (_a = currentLayer.geojson) === null || _a === void 0 ? void 0 : _a.features[0]) === null || _b === void 0 ? void 0 : _b.properties);
|
|
1557
1622
|
intersectionLayer.geojson = createInterSections(updatedGeoJSON, bounds, geoJSONProperties);
|
|
1558
1623
|
}
|
|
1559
1624
|
},
|
|
@@ -1599,9 +1664,23 @@ var slice$7 = createSlice({
|
|
|
1599
1664
|
if (!draft.byId[layerId]) {
|
|
1600
1665
|
return;
|
|
1601
1666
|
}
|
|
1602
|
-
|
|
1667
|
+
var exitMultipleShapes = shouldAllowMultipleShapes && reason === 'escaped';
|
|
1668
|
+
if (!shouldAllowMultipleShapes || exitMultipleShapes) {
|
|
1603
1669
|
draft.byId[layerId].isInEditMode = false;
|
|
1604
1670
|
draft.byId[layerId].drawMode = '';
|
|
1671
|
+
if (exitMultipleShapes) {
|
|
1672
|
+
var currentGeoJSON = draft.byId[layerId].geojson;
|
|
1673
|
+
var lastFeatureIndex = currentGeoJSON !== undefined && getLastEmptyFeatureIndex(currentGeoJSON);
|
|
1674
|
+
if (currentGeoJSON && lastFeatureIndex !== undefined) {
|
|
1675
|
+
var newGeoJSON = Object.assign(Object.assign({}, currentGeoJSON), {
|
|
1676
|
+
features: currentGeoJSON.features.filter(function (_feature, index) {
|
|
1677
|
+
return index !== lastFeatureIndex;
|
|
1678
|
+
})
|
|
1679
|
+
});
|
|
1680
|
+
draft.byId[layerId].geojson = newGeoJSON;
|
|
1681
|
+
draft.byId[layerId].selectedFeatureIndex = newGeoJSON.features.length > 0 ? newGeoJSON.features.length - 1 : 0;
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1605
1684
|
}
|
|
1606
1685
|
}
|
|
1607
1686
|
},
|
|
@@ -1611,10 +1690,13 @@ var slice$7 = createSlice({
|
|
|
1611
1690
|
targetsFromAction = _action$payload21.targets,
|
|
1612
1691
|
source = _action$payload21.source;
|
|
1613
1692
|
/* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
|
|
1614
|
-
var targets = [
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1693
|
+
var targets = [];
|
|
1694
|
+
if (source) {
|
|
1695
|
+
targets.push({
|
|
1696
|
+
targetId: source.payload.sourceId,
|
|
1697
|
+
value: source.payload.value
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1618
1700
|
/* And then append the targets form the action */
|
|
1619
1701
|
targets.push.apply(targets, _toConsumableArray(targetsFromAction));
|
|
1620
1702
|
targets.forEach(function (payload) {
|
|
@@ -1636,15 +1718,14 @@ var slice$7 = createSlice({
|
|
|
1636
1718
|
var _action$payload22 = action.payload,
|
|
1637
1719
|
targets = _action$payload22.targets,
|
|
1638
1720
|
source = _action$payload22.source;
|
|
1639
|
-
var state = current(draft);
|
|
1640
1721
|
return targets.reduce(function (prevState, target) {
|
|
1641
1722
|
var action = {
|
|
1642
1723
|
payload: target,
|
|
1643
|
-
type: source.type
|
|
1724
|
+
type: source && source.type
|
|
1644
1725
|
};
|
|
1645
1726
|
/* Handle the Layer action with the same logic, using the same reducer */
|
|
1646
1727
|
return reducer$7(prevState, action);
|
|
1647
|
-
},
|
|
1728
|
+
}, draft);
|
|
1648
1729
|
}).addCase(setMapPreset, function (draft, action) {
|
|
1649
1730
|
var mapId = action.payload.mapId;
|
|
1650
1731
|
var layers = draft.allIds.map(function (id) {
|
|
@@ -2402,14 +2483,22 @@ var createLayersWithIds = function createLayersWithIds(state, layers) {
|
|
|
2402
2483
|
return layers;
|
|
2403
2484
|
}
|
|
2404
2485
|
return produce(layers, function (draft) {
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2486
|
+
var _iterator = _createForOfIteratorHelper(draft),
|
|
2487
|
+
_step;
|
|
2488
|
+
try {
|
|
2489
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2490
|
+
var layer = _step.value;
|
|
2491
|
+
if (!layer.id) {
|
|
2492
|
+
layer.id = webmapUtils.generateLayerId();
|
|
2493
|
+
} else if (checkIfMapLayerIdIsAlreadyTaken(state, layer.id)) {
|
|
2494
|
+
console.warn("Warning: Layer id ".concat(layer.id, " was already taken: Generating new one."));
|
|
2495
|
+
layer.id = webmapUtils.generateLayerId();
|
|
2496
|
+
}
|
|
2412
2497
|
}
|
|
2498
|
+
} catch (err) {
|
|
2499
|
+
_iterator.e(err);
|
|
2500
|
+
} finally {
|
|
2501
|
+
_iterator.f();
|
|
2413
2502
|
}
|
|
2414
2503
|
});
|
|
2415
2504
|
};
|
|
@@ -2468,16 +2557,27 @@ var slice$5 = createSlice({
|
|
|
2468
2557
|
});
|
|
2469
2558
|
},
|
|
2470
2559
|
mapStartAnimation: function mapStartAnimation(draft, action) {
|
|
2471
|
-
var
|
|
2560
|
+
var _action$payload3 = action.payload,
|
|
2561
|
+
mapId = _action$payload3.mapId,
|
|
2562
|
+
timeList = _action$payload3.timeList,
|
|
2563
|
+
start = _action$payload3.start,
|
|
2564
|
+
end = _action$payload3.end;
|
|
2472
2565
|
if (!draft.byId[mapId]) {
|
|
2473
2566
|
return;
|
|
2474
2567
|
}
|
|
2475
2568
|
draft.byId[mapId].isAnimating = true;
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
if (
|
|
2480
|
-
draft.byId[mapId].
|
|
2569
|
+
// Animation is defined by one of the following:
|
|
2570
|
+
// - start, end and interval for a continuous animation loop with constant interval
|
|
2571
|
+
// - timeList, for a custom timeList
|
|
2572
|
+
if (start && end) {
|
|
2573
|
+
draft.byId[mapId].animationStartTime = start;
|
|
2574
|
+
draft.byId[mapId].animationEndTime = end;
|
|
2575
|
+
draft.byId[mapId].timeList = undefined;
|
|
2576
|
+
}
|
|
2577
|
+
if (timeList && timeList.length >= 0) {
|
|
2578
|
+
draft.byId[mapId].animationStartTime = undefined;
|
|
2579
|
+
draft.byId[mapId].animationEndTime = undefined;
|
|
2580
|
+
draft.byId[mapId].timeList = timeList;
|
|
2481
2581
|
}
|
|
2482
2582
|
if (action.payload.interval && action.payload.interval !== draft.byId[mapId].timeStep) {
|
|
2483
2583
|
draft.byId[mapId].timeStep = action.payload.interval;
|
|
@@ -2492,66 +2592,66 @@ var slice$5 = createSlice({
|
|
|
2492
2592
|
draft.byId[mapId].isAnimating = false;
|
|
2493
2593
|
},
|
|
2494
2594
|
setTimeSliderSpan: function setTimeSliderSpan(draft, action) {
|
|
2495
|
-
var _action$
|
|
2496
|
-
mapId = _action$
|
|
2497
|
-
timeSliderSpan = _action$
|
|
2595
|
+
var _action$payload4 = action.payload,
|
|
2596
|
+
mapId = _action$payload4.mapId,
|
|
2597
|
+
timeSliderSpan = _action$payload4.timeSliderSpan;
|
|
2498
2598
|
if (!draft.byId[mapId]) {
|
|
2499
2599
|
return;
|
|
2500
2600
|
}
|
|
2501
2601
|
draft.byId[mapId].timeSliderSpan = timeSliderSpan;
|
|
2502
2602
|
},
|
|
2503
2603
|
setTimeStep: function setTimeStep(draft, action) {
|
|
2504
|
-
var _action$
|
|
2505
|
-
mapId = _action$
|
|
2506
|
-
timeStep = _action$
|
|
2604
|
+
var _action$payload5 = action.payload,
|
|
2605
|
+
mapId = _action$payload5.mapId,
|
|
2606
|
+
timeStep = _action$payload5.timeStep;
|
|
2507
2607
|
if (!draft.byId[mapId]) {
|
|
2508
2608
|
return;
|
|
2509
2609
|
}
|
|
2510
2610
|
draft.byId[mapId].timeStep = timeStep;
|
|
2511
2611
|
},
|
|
2512
2612
|
setAnimationStartTime: function setAnimationStartTime(draft, action) {
|
|
2513
|
-
var _action$
|
|
2514
|
-
mapId = _action$
|
|
2515
|
-
animationStartTime = _action$
|
|
2613
|
+
var _action$payload6 = action.payload,
|
|
2614
|
+
mapId = _action$payload6.mapId,
|
|
2615
|
+
animationStartTime = _action$payload6.animationStartTime;
|
|
2516
2616
|
if (!draft.byId[mapId]) {
|
|
2517
2617
|
return;
|
|
2518
2618
|
}
|
|
2519
2619
|
draft.byId[mapId].animationStartTime = animationStartTime;
|
|
2520
2620
|
},
|
|
2521
2621
|
setAnimationEndTime: function setAnimationEndTime(draft, action) {
|
|
2522
|
-
var _action$
|
|
2523
|
-
mapId = _action$
|
|
2524
|
-
animationEndTime = _action$
|
|
2622
|
+
var _action$payload7 = action.payload,
|
|
2623
|
+
mapId = _action$payload7.mapId,
|
|
2624
|
+
animationEndTime = _action$payload7.animationEndTime;
|
|
2525
2625
|
if (!draft.byId[mapId]) {
|
|
2526
2626
|
return;
|
|
2527
2627
|
}
|
|
2528
2628
|
draft.byId[mapId].animationEndTime = animationEndTime;
|
|
2529
2629
|
},
|
|
2530
2630
|
setAnimationDelay: function setAnimationDelay(draft, action) {
|
|
2531
|
-
var _action$
|
|
2532
|
-
mapId = _action$
|
|
2533
|
-
animationDelay = _action$
|
|
2631
|
+
var _action$payload8 = action.payload,
|
|
2632
|
+
mapId = _action$payload8.mapId,
|
|
2633
|
+
animationDelay = _action$payload8.animationDelay;
|
|
2534
2634
|
if (!draft.byId[mapId]) {
|
|
2535
2635
|
return;
|
|
2536
2636
|
}
|
|
2537
2637
|
draft.byId[mapId].animationDelay = animationDelay;
|
|
2538
2638
|
},
|
|
2539
2639
|
layerMoveLayer: function layerMoveLayer(draft, action) {
|
|
2540
|
-
var _action$
|
|
2541
|
-
oldIndex = _action$
|
|
2542
|
-
newIndex = _action$
|
|
2543
|
-
mapId = _action$
|
|
2640
|
+
var _action$payload9 = action.payload,
|
|
2641
|
+
oldIndex = _action$payload9.oldIndex,
|
|
2642
|
+
newIndex = _action$payload9.newIndex,
|
|
2643
|
+
mapId = _action$payload9.mapId;
|
|
2544
2644
|
if (!draft.byId[mapId]) {
|
|
2545
2645
|
return;
|
|
2546
2646
|
}
|
|
2547
2647
|
draft.byId[mapId].mapLayers = moveArrayElements(draft.byId[mapId].mapLayers, oldIndex, newIndex);
|
|
2548
2648
|
},
|
|
2549
2649
|
setAutoLayerId: function setAutoLayerId(draft, action) {
|
|
2550
|
-
var _action$
|
|
2551
|
-
mapId = _action$
|
|
2552
|
-
layerId = _action$
|
|
2553
|
-
autoTimeStepLayerId = _action$
|
|
2554
|
-
autoUpdateLayerId = _action$
|
|
2650
|
+
var _action$payload10 = action.payload,
|
|
2651
|
+
mapId = _action$payload10.mapId,
|
|
2652
|
+
layerId = _action$payload10.layerId,
|
|
2653
|
+
autoTimeStepLayerId = _action$payload10.autoTimeStepLayerId,
|
|
2654
|
+
autoUpdateLayerId = _action$payload10.autoUpdateLayerId;
|
|
2555
2655
|
var map = draft.byId[mapId];
|
|
2556
2656
|
if (!map) {
|
|
2557
2657
|
return;
|
|
@@ -2568,9 +2668,9 @@ var slice$5 = createSlice({
|
|
|
2568
2668
|
}
|
|
2569
2669
|
},
|
|
2570
2670
|
setAutoTimestepLayerId: function setAutoTimestepLayerId(draft, action) {
|
|
2571
|
-
var _action$
|
|
2572
|
-
mapId = _action$
|
|
2573
|
-
autoTimestepLayerId = _action$
|
|
2671
|
+
var _action$payload11 = action.payload,
|
|
2672
|
+
mapId = _action$payload11.mapId,
|
|
2673
|
+
autoTimestepLayerId = _action$payload11.autoTimestepLayerId;
|
|
2574
2674
|
var map = draft.byId[mapId];
|
|
2575
2675
|
if (!map) {
|
|
2576
2676
|
return;
|
|
@@ -2578,9 +2678,9 @@ var slice$5 = createSlice({
|
|
|
2578
2678
|
map.autoTimeStepLayerId = autoTimestepLayerId;
|
|
2579
2679
|
},
|
|
2580
2680
|
setAutoUpdateLayerId: function setAutoUpdateLayerId(draft, action) {
|
|
2581
|
-
var _action$
|
|
2582
|
-
mapId = _action$
|
|
2583
|
-
autoUpdateLayerId = _action$
|
|
2681
|
+
var _action$payload12 = action.payload,
|
|
2682
|
+
mapId = _action$payload12.mapId,
|
|
2683
|
+
autoUpdateLayerId = _action$payload12.autoUpdateLayerId;
|
|
2584
2684
|
var map = draft.byId[mapId];
|
|
2585
2685
|
if (!map) {
|
|
2586
2686
|
return;
|
|
@@ -2588,135 +2688,135 @@ var slice$5 = createSlice({
|
|
|
2588
2688
|
map.autoUpdateLayerId = autoUpdateLayerId;
|
|
2589
2689
|
},
|
|
2590
2690
|
setTimeSliderWidth: function setTimeSliderWidth(draft, action) {
|
|
2591
|
-
var _action$
|
|
2592
|
-
mapId = _action$
|
|
2593
|
-
timeSliderWidth = _action$
|
|
2691
|
+
var _action$payload13 = action.payload,
|
|
2692
|
+
mapId = _action$payload13.mapId,
|
|
2693
|
+
timeSliderWidth = _action$payload13.timeSliderWidth;
|
|
2594
2694
|
if (!draft.byId[mapId]) {
|
|
2595
2695
|
return;
|
|
2596
2696
|
}
|
|
2597
2697
|
draft.byId[mapId].timeSliderWidth = timeSliderWidth;
|
|
2598
2698
|
},
|
|
2599
2699
|
setTimeSliderCenterTime: function setTimeSliderCenterTime(draft, action) {
|
|
2600
|
-
var _action$
|
|
2601
|
-
mapId = _action$
|
|
2602
|
-
timeSliderCenterTime = _action$
|
|
2700
|
+
var _action$payload14 = action.payload,
|
|
2701
|
+
mapId = _action$payload14.mapId,
|
|
2702
|
+
timeSliderCenterTime = _action$payload14.timeSliderCenterTime;
|
|
2603
2703
|
if (!draft.byId[mapId]) {
|
|
2604
2704
|
return;
|
|
2605
2705
|
}
|
|
2606
2706
|
draft.byId[mapId].timeSliderCenterTime = timeSliderCenterTime;
|
|
2607
2707
|
},
|
|
2608
2708
|
setTimeSliderUnfilteredSelectedTime: function setTimeSliderUnfilteredSelectedTime(draft, action) {
|
|
2609
|
-
var _action$
|
|
2610
|
-
mapId = _action$
|
|
2611
|
-
timeSliderUnfilteredSelectedTime = _action$
|
|
2709
|
+
var _action$payload15 = action.payload,
|
|
2710
|
+
mapId = _action$payload15.mapId,
|
|
2711
|
+
timeSliderUnfilteredSelectedTime = _action$payload15.timeSliderUnfilteredSelectedTime;
|
|
2612
2712
|
if (!draft.byId[mapId]) {
|
|
2613
2713
|
return;
|
|
2614
2714
|
}
|
|
2615
2715
|
draft.byId[mapId].timeSliderUnfilteredSelectedTime = timeSliderUnfilteredSelectedTime;
|
|
2616
2716
|
},
|
|
2617
2717
|
setTimeSliderSecondsPerPx: function setTimeSliderSecondsPerPx(draft, action) {
|
|
2618
|
-
var _action$
|
|
2619
|
-
mapId = _action$
|
|
2620
|
-
timeSliderSecondsPerPx = _action$
|
|
2718
|
+
var _action$payload16 = action.payload,
|
|
2719
|
+
mapId = _action$payload16.mapId,
|
|
2720
|
+
timeSliderSecondsPerPx = _action$payload16.timeSliderSecondsPerPx;
|
|
2621
2721
|
if (!draft.byId[mapId]) {
|
|
2622
2722
|
return;
|
|
2623
2723
|
}
|
|
2624
2724
|
draft.byId[mapId].timeSliderSecondsPerPx = timeSliderSecondsPerPx;
|
|
2625
2725
|
},
|
|
2626
2726
|
toggleAutoUpdate: function toggleAutoUpdate(draft, action) {
|
|
2627
|
-
var _action$
|
|
2628
|
-
mapId = _action$
|
|
2629
|
-
shouldAutoUpdate = _action$
|
|
2727
|
+
var _action$payload17 = action.payload,
|
|
2728
|
+
mapId = _action$payload17.mapId,
|
|
2729
|
+
shouldAutoUpdate = _action$payload17.shouldAutoUpdate;
|
|
2630
2730
|
if (!draft.byId[mapId]) {
|
|
2631
2731
|
return;
|
|
2632
2732
|
}
|
|
2633
2733
|
draft.byId[mapId].isAutoUpdating = shouldAutoUpdate;
|
|
2634
2734
|
},
|
|
2635
2735
|
setEndTimeOverriding: function setEndTimeOverriding(draft, action) {
|
|
2636
|
-
var _action$
|
|
2637
|
-
mapId = _action$
|
|
2638
|
-
shouldEndtimeOverride = _action$
|
|
2736
|
+
var _action$payload18 = action.payload,
|
|
2737
|
+
mapId = _action$payload18.mapId,
|
|
2738
|
+
shouldEndtimeOverride = _action$payload18.shouldEndtimeOverride;
|
|
2639
2739
|
if (!draft.byId[mapId]) {
|
|
2640
2740
|
return;
|
|
2641
2741
|
}
|
|
2642
|
-
draft.byId[mapId].
|
|
2742
|
+
draft.byId[mapId].shouldEndtimeOverride = shouldEndtimeOverride;
|
|
2643
2743
|
},
|
|
2644
2744
|
toggleTimestepAuto: function toggleTimestepAuto(draft, action) {
|
|
2645
|
-
var _action$
|
|
2646
|
-
mapId = _action$
|
|
2647
|
-
timestepAuto = _action$
|
|
2745
|
+
var _action$payload19 = action.payload,
|
|
2746
|
+
mapId = _action$payload19.mapId,
|
|
2747
|
+
timestepAuto = _action$payload19.timestepAuto;
|
|
2648
2748
|
if (!draft.byId[mapId]) {
|
|
2649
2749
|
return;
|
|
2650
2750
|
}
|
|
2651
2751
|
draft.byId[mapId].isTimestepAuto = timestepAuto;
|
|
2652
2752
|
},
|
|
2653
2753
|
toggleTimeSpanAuto: function toggleTimeSpanAuto(draft, action) {
|
|
2654
|
-
var _action$
|
|
2655
|
-
mapId = _action$
|
|
2656
|
-
timeSpanAuto = _action$
|
|
2754
|
+
var _action$payload20 = action.payload,
|
|
2755
|
+
mapId = _action$payload20.mapId,
|
|
2756
|
+
timeSpanAuto = _action$payload20.timeSpanAuto;
|
|
2657
2757
|
if (!draft.byId[mapId]) {
|
|
2658
2758
|
return;
|
|
2659
2759
|
}
|
|
2660
2760
|
draft.byId[mapId].isTimeSpanAuto = timeSpanAuto;
|
|
2661
2761
|
},
|
|
2662
2762
|
toggleTimeSliderHover: function toggleTimeSliderHover(draft, action) {
|
|
2663
|
-
var _action$
|
|
2664
|
-
mapId = _action$
|
|
2665
|
-
isTimeSliderHoverOn = _action$
|
|
2763
|
+
var _action$payload21 = action.payload,
|
|
2764
|
+
mapId = _action$payload21.mapId,
|
|
2765
|
+
isTimeSliderHoverOn = _action$payload21.isTimeSliderHoverOn;
|
|
2666
2766
|
if (!draft.byId[mapId]) {
|
|
2667
2767
|
return;
|
|
2668
2768
|
}
|
|
2669
2769
|
draft.byId[mapId].isTimeSliderHoverOn = isTimeSliderHoverOn;
|
|
2670
2770
|
},
|
|
2671
2771
|
toggleTimeSliderIsVisible: function toggleTimeSliderIsVisible(draft, action) {
|
|
2672
|
-
var _action$
|
|
2673
|
-
mapId = _action$
|
|
2674
|
-
isTimeSliderVisible = _action$
|
|
2772
|
+
var _action$payload22 = action.payload,
|
|
2773
|
+
mapId = _action$payload22.mapId,
|
|
2774
|
+
isTimeSliderVisible = _action$payload22.isTimeSliderVisible;
|
|
2675
2775
|
if (!draft.byId[mapId]) {
|
|
2676
2776
|
return;
|
|
2677
2777
|
}
|
|
2678
2778
|
draft.byId[mapId].isTimeSliderVisible = isTimeSliderVisible;
|
|
2679
2779
|
},
|
|
2680
2780
|
toggleZoomControls: function toggleZoomControls(draft, action) {
|
|
2681
|
-
var _action$
|
|
2682
|
-
mapId = _action$
|
|
2683
|
-
shouldShowZoomControls = _action$
|
|
2781
|
+
var _action$payload23 = action.payload,
|
|
2782
|
+
mapId = _action$payload23.mapId,
|
|
2783
|
+
shouldShowZoomControls = _action$payload23.shouldShowZoomControls;
|
|
2684
2784
|
if (!draft.byId[mapId]) {
|
|
2685
2785
|
return;
|
|
2686
2786
|
}
|
|
2687
2787
|
draft.byId[mapId].shouldShowZoomControls = shouldShowZoomControls;
|
|
2688
2788
|
},
|
|
2689
2789
|
setMapPinLocation: function setMapPinLocation(draft, action) {
|
|
2690
|
-
var _action$
|
|
2691
|
-
mapId = _action$
|
|
2692
|
-
mapPinLocation = _action$
|
|
2790
|
+
var _action$payload24 = action.payload,
|
|
2791
|
+
mapId = _action$payload24.mapId,
|
|
2792
|
+
mapPinLocation = _action$payload24.mapPinLocation;
|
|
2693
2793
|
if (!draft.byId[mapId]) {
|
|
2694
2794
|
return;
|
|
2695
2795
|
}
|
|
2696
2796
|
draft.byId[mapId].mapPinLocation = mapPinLocation;
|
|
2697
2797
|
},
|
|
2698
2798
|
setDisableMapPin: function setDisableMapPin(draft, action) {
|
|
2699
|
-
var _action$
|
|
2700
|
-
mapId = _action$
|
|
2701
|
-
disableMapPin = _action$
|
|
2799
|
+
var _action$payload25 = action.payload,
|
|
2800
|
+
mapId = _action$payload25.mapId,
|
|
2801
|
+
disableMapPin = _action$payload25.disableMapPin;
|
|
2702
2802
|
if (!draft.byId[mapId]) {
|
|
2703
2803
|
return;
|
|
2704
2804
|
}
|
|
2705
2805
|
draft.byId[mapId].disableMapPin = disableMapPin;
|
|
2706
2806
|
},
|
|
2707
2807
|
toggleMapPinIsVisible: function toggleMapPinIsVisible(draft, action) {
|
|
2708
|
-
var _action$
|
|
2709
|
-
mapId = _action$
|
|
2710
|
-
displayMapPin = _action$
|
|
2808
|
+
var _action$payload26 = action.payload,
|
|
2809
|
+
mapId = _action$payload26.mapId,
|
|
2810
|
+
displayMapPin = _action$payload26.displayMapPin;
|
|
2711
2811
|
if (!draft.byId[mapId]) {
|
|
2712
2812
|
return;
|
|
2713
2813
|
}
|
|
2714
2814
|
draft.byId[mapId].displayMapPin = displayMapPin;
|
|
2715
2815
|
},
|
|
2716
2816
|
setDockedLayerManagerSize: function setDockedLayerManagerSize(draft, action) {
|
|
2717
|
-
var _action$
|
|
2718
|
-
mapId = _action$
|
|
2719
|
-
dockedLayerManagerSize = _action$
|
|
2817
|
+
var _action$payload27 = action.payload,
|
|
2818
|
+
mapId = _action$payload27.mapId,
|
|
2819
|
+
dockedLayerManagerSize = _action$payload27.dockedLayerManagerSize;
|
|
2720
2820
|
if (!draft.byId[mapId]) {
|
|
2721
2821
|
return;
|
|
2722
2822
|
}
|
|
@@ -2730,10 +2830,10 @@ var slice$5 = createSlice({
|
|
|
2730
2830
|
},
|
|
2731
2831
|
extraReducers: function extraReducers(builder) {
|
|
2732
2832
|
builder.addCase(layerActions.addLayer, function (draft, action) {
|
|
2733
|
-
var _action$
|
|
2734
|
-
layerId = _action$
|
|
2735
|
-
mapId = _action$
|
|
2736
|
-
layer = _action$
|
|
2833
|
+
var _action$payload28 = action.payload,
|
|
2834
|
+
layerId = _action$payload28.layerId,
|
|
2835
|
+
mapId = _action$payload28.mapId,
|
|
2836
|
+
layer = _action$payload28.layer;
|
|
2737
2837
|
if (!draft.byId[mapId]) {
|
|
2738
2838
|
return;
|
|
2739
2839
|
}
|
|
@@ -2752,9 +2852,9 @@ var slice$5 = createSlice({
|
|
|
2752
2852
|
draft.byId[mapId].mapLayers.unshift(layerId);
|
|
2753
2853
|
}
|
|
2754
2854
|
}).addCase(layerActions.duplicateMapLayer, function (draft, action) {
|
|
2755
|
-
var _action$
|
|
2756
|
-
newLayerId = _action$
|
|
2757
|
-
mapId = _action$
|
|
2855
|
+
var _action$payload29 = action.payload,
|
|
2856
|
+
newLayerId = _action$payload29.newLayerId,
|
|
2857
|
+
mapId = _action$payload29.mapId;
|
|
2758
2858
|
if (!draft.byId[mapId]) {
|
|
2759
2859
|
return;
|
|
2760
2860
|
}
|
|
@@ -2764,10 +2864,10 @@ var slice$5 = createSlice({
|
|
|
2764
2864
|
}
|
|
2765
2865
|
draft.byId[mapId].mapLayers.unshift(newLayerId);
|
|
2766
2866
|
}).addCase(layerActions.addBaseLayer, function (draft, action) {
|
|
2767
|
-
var _action$
|
|
2768
|
-
layer = _action$
|
|
2769
|
-
layerId = _action$
|
|
2770
|
-
mapId = _action$
|
|
2867
|
+
var _action$payload30 = action.payload,
|
|
2868
|
+
layer = _action$payload30.layer,
|
|
2869
|
+
layerId = _action$payload30.layerId,
|
|
2870
|
+
mapId = _action$payload30.mapId;
|
|
2771
2871
|
if (!draft.byId[mapId]) {
|
|
2772
2872
|
return;
|
|
2773
2873
|
}
|
|
@@ -2823,9 +2923,9 @@ var slice$5 = createSlice({
|
|
|
2823
2923
|
}
|
|
2824
2924
|
}
|
|
2825
2925
|
}).addCase(layerActions.setBaseLayers, function (draft, action) {
|
|
2826
|
-
var _action$
|
|
2827
|
-
layers = _action$
|
|
2828
|
-
mapId = _action$
|
|
2926
|
+
var _action$payload31 = action.payload,
|
|
2927
|
+
layers = _action$payload31.layers,
|
|
2928
|
+
mapId = _action$payload31.mapId;
|
|
2829
2929
|
// Split into base and overlayers
|
|
2830
2930
|
var baseLayers = [];
|
|
2831
2931
|
var overLayers = [];
|
|
@@ -2855,9 +2955,9 @@ var slice$5 = createSlice({
|
|
|
2855
2955
|
}
|
|
2856
2956
|
}
|
|
2857
2957
|
}).addCase(layerActions.layerDelete, function (draft, action) {
|
|
2858
|
-
var _action$
|
|
2859
|
-
mapId = _action$
|
|
2860
|
-
layerId = _action$
|
|
2958
|
+
var _action$payload32 = action.payload,
|
|
2959
|
+
mapId = _action$payload32.mapId,
|
|
2960
|
+
layerId = _action$payload32.layerId;
|
|
2861
2961
|
var map = draft.byId[mapId];
|
|
2862
2962
|
if (!map) {
|
|
2863
2963
|
return;
|
|
@@ -2883,9 +2983,9 @@ var slice$5 = createSlice({
|
|
|
2883
2983
|
return id !== layerId;
|
|
2884
2984
|
});
|
|
2885
2985
|
}).addCase(layerActions.baseLayerDelete, function (draft, action) {
|
|
2886
|
-
var _action$
|
|
2887
|
-
mapId = _action$
|
|
2888
|
-
layerId = _action$
|
|
2986
|
+
var _action$payload33 = action.payload,
|
|
2987
|
+
mapId = _action$payload33.mapId,
|
|
2988
|
+
layerId = _action$payload33.layerId;
|
|
2889
2989
|
if (!draft.byId[mapId]) {
|
|
2890
2990
|
return;
|
|
2891
2991
|
}
|
|
@@ -2896,19 +2996,22 @@ var slice$5 = createSlice({
|
|
|
2896
2996
|
return id !== layerId;
|
|
2897
2997
|
});
|
|
2898
2998
|
}).addCase(layerActions.layerChangeDimension, function (draft, action) {
|
|
2899
|
-
var _action$
|
|
2900
|
-
layerId = _action$
|
|
2901
|
-
dimension = _action$
|
|
2999
|
+
var _action$payload34 = action.payload,
|
|
3000
|
+
layerId = _action$payload34.layerId,
|
|
3001
|
+
dimension = _action$payload34.dimension;
|
|
2902
3002
|
produceDraftStateSetMapDimensionFromLayerChangeDimension(draft, layerId, dimension);
|
|
2903
3003
|
}).addCase(setTimeSync, function (draft, action) {
|
|
2904
|
-
var _action$
|
|
2905
|
-
targetsFromAction = _action$
|
|
2906
|
-
source = _action$
|
|
3004
|
+
var _action$payload35 = action.payload,
|
|
3005
|
+
targetsFromAction = _action$payload35.targets,
|
|
3006
|
+
source = _action$payload35.source;
|
|
2907
3007
|
/* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
|
|
2908
|
-
var targets = [
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
3008
|
+
var targets = [];
|
|
3009
|
+
if (source) {
|
|
3010
|
+
targets.push({
|
|
3011
|
+
targetId: source.payload.sourceId,
|
|
3012
|
+
value: source.payload.value
|
|
3013
|
+
});
|
|
3014
|
+
}
|
|
2912
3015
|
/* And then append the targets form the action */
|
|
2913
3016
|
targets.push.apply(targets, _toConsumableArray(targetsFromAction));
|
|
2914
3017
|
targets.forEach(function (target) {
|
|
@@ -2924,15 +3027,18 @@ var slice$5 = createSlice({
|
|
|
2924
3027
|
}
|
|
2925
3028
|
});
|
|
2926
3029
|
}).addCase(setBboxSync, function (draft, action) {
|
|
2927
|
-
var _action$
|
|
2928
|
-
targetsFromAction = _action$
|
|
2929
|
-
source = _action$
|
|
3030
|
+
var _action$payload36 = action.payload,
|
|
3031
|
+
targetsFromAction = _action$payload36.targets,
|
|
3032
|
+
source = _action$payload36.source;
|
|
2930
3033
|
/* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
|
|
2931
|
-
var targets = [
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
3034
|
+
var targets = [];
|
|
3035
|
+
if (source) {
|
|
3036
|
+
targets.push({
|
|
3037
|
+
targetId: source.payload.sourceId,
|
|
3038
|
+
bbox: source.payload.bbox,
|
|
3039
|
+
srs: source.payload.srs
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
2936
3042
|
/* And then append the targets form the action */
|
|
2937
3043
|
targets.push.apply(targets, _toConsumableArray(targetsFromAction));
|
|
2938
3044
|
targets.forEach(function (payload) {
|
|
@@ -2955,13 +3061,13 @@ var slice$5 = createSlice({
|
|
|
2955
3061
|
* These targets can be used as payloads in new Layer actions.
|
|
2956
3062
|
* These actions are here handled via the layer reducer, as it is the same logic
|
|
2957
3063
|
*/
|
|
2958
|
-
var _action$
|
|
2959
|
-
targets = _action$
|
|
2960
|
-
source = _action$
|
|
3064
|
+
var _action$payload37 = action.payload,
|
|
3065
|
+
targets = _action$payload37.targets,
|
|
3066
|
+
source = _action$payload37.source;
|
|
2961
3067
|
return targets.reduce(function (prevState, target) {
|
|
2962
3068
|
var action = {
|
|
2963
3069
|
payload: target,
|
|
2964
|
-
type: source.type
|
|
3070
|
+
type: source && source.type
|
|
2965
3071
|
};
|
|
2966
3072
|
/* Handle the Layer action with the same logic, using the same reducer */
|
|
2967
3073
|
return reducer$5(prevState, action);
|
|
@@ -2978,9 +3084,9 @@ var slice$5 = createSlice({
|
|
|
2978
3084
|
});
|
|
2979
3085
|
return draft;
|
|
2980
3086
|
}).addCase(mapChangeDimension, function (draft, action) {
|
|
2981
|
-
var _action$
|
|
2982
|
-
mapId = _action$
|
|
2983
|
-
dimensionFromAction = _action$
|
|
3087
|
+
var _action$payload38 = action.payload,
|
|
3088
|
+
mapId = _action$payload38.mapId,
|
|
3089
|
+
dimensionFromAction = _action$payload38.dimension;
|
|
2984
3090
|
produceDraftStateSetWebMapDimension(draft, mapId, dimensionFromAction, true);
|
|
2985
3091
|
}).addCase(setMapPreset, function (draft, action) {
|
|
2986
3092
|
var mapId = action.payload.mapId;
|
|
@@ -3000,9 +3106,9 @@ var slice$5 = createSlice({
|
|
|
3000
3106
|
draft.byId[mapId].animationDelay = defaultAnimationDelayAtStart;
|
|
3001
3107
|
draft.byId[mapId].dockedLayerManagerSize = '';
|
|
3002
3108
|
}).addCase(uiActions.registerDialog, function (draft, action) {
|
|
3003
|
-
var _action$
|
|
3004
|
-
mapId = _action$
|
|
3005
|
-
type = _action$
|
|
3109
|
+
var _action$payload39 = action.payload,
|
|
3110
|
+
mapId = _action$payload39.mapId,
|
|
3111
|
+
type = _action$payload39.type;
|
|
3006
3112
|
if (!draft.byId[mapId]) {
|
|
3007
3113
|
return;
|
|
3008
3114
|
}
|
|
@@ -3346,12 +3452,13 @@ var slice$4 = createSlice({
|
|
|
3346
3452
|
}
|
|
3347
3453
|
},
|
|
3348
3454
|
syncGroupAddTarget: function syncGroupAddTarget(draft, action) {
|
|
3349
|
-
var
|
|
3455
|
+
var _a;
|
|
3350
3456
|
var _action$payload2 = action.payload,
|
|
3351
3457
|
groupId = _action$payload2.groupId,
|
|
3352
3458
|
targetId = _action$payload2.targetId,
|
|
3353
3459
|
linked = _action$payload2.linked;
|
|
3354
|
-
|
|
3460
|
+
var synchronizationGroup = draft.groups.byId[groupId];
|
|
3461
|
+
if (!synchronizationGroup) {
|
|
3355
3462
|
console.warn("SYNCGROUPS_ADD_TARGET: Group ".concat(groupId, " does not exist."));
|
|
3356
3463
|
return;
|
|
3357
3464
|
}
|
|
@@ -3359,21 +3466,17 @@ var slice$4 = createSlice({
|
|
|
3359
3466
|
console.warn("SYNCGROUPS_ADD_TARGET: targetId is not defined.");
|
|
3360
3467
|
return;
|
|
3361
3468
|
}
|
|
3362
|
-
if (
|
|
3469
|
+
if (synchronizationGroup.targets.allIds.includes(targetId)) {
|
|
3363
3470
|
return;
|
|
3364
3471
|
}
|
|
3365
|
-
|
|
3366
|
-
|
|
3472
|
+
var isSourceLinked = (_a = synchronizationGroup.targets.byId[targetId]) === null || _a === void 0 ? void 0 : _a.linked;
|
|
3473
|
+
synchronizationGroup.targets.allIds.push(targetId);
|
|
3474
|
+
synchronizationGroup.targets.byId[targetId] = {
|
|
3367
3475
|
linked: linked !== false
|
|
3368
3476
|
};
|
|
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];
|
|
3477
|
+
if (isSourceLinked) {
|
|
3478
|
+
var type = synchronizationGroup.type;
|
|
3479
|
+
draft.sources.byId[targetId].payloadByType[type] = synchronizationGroup.payloadByType[type];
|
|
3377
3480
|
}
|
|
3378
3481
|
},
|
|
3379
3482
|
syncGroupRemoveTarget: function syncGroupRemoveTarget(draft, action) {
|
|
@@ -3449,22 +3552,22 @@ var slice$4 = createSlice({
|
|
|
3449
3552
|
});
|
|
3450
3553
|
}
|
|
3451
3554
|
});
|
|
3452
|
-
var setBboxOrTimeSync = function setBboxOrTimeSync(
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3555
|
+
var setBboxOrTimeSync = function setBboxOrTimeSync(draft, action) {
|
|
3556
|
+
var _action$payload6 = action.payload,
|
|
3557
|
+
targets = _action$payload6.targets,
|
|
3558
|
+
source = _action$payload6.source,
|
|
3559
|
+
groups = _action$payload6.groups;
|
|
3560
|
+
var getPayLoadKey = function getPayLoadKey(type) {
|
|
3561
|
+
switch (type) {
|
|
3562
|
+
case setTimeSync.type:
|
|
3563
|
+
return SYNCGROUPS_TYPE_SETTIME;
|
|
3564
|
+
case setBboxSync.type:
|
|
3565
|
+
return SYNCGROUPS_TYPE_SETBBOX;
|
|
3566
|
+
default:
|
|
3567
|
+
return null;
|
|
3568
|
+
}
|
|
3569
|
+
};
|
|
3570
|
+
if (source) {
|
|
3468
3571
|
var payloadKey = getPayLoadKey(action.type);
|
|
3469
3572
|
if (!source.payload || !payloadKey) {
|
|
3470
3573
|
console.warn('Wrong sync action: ', action);
|
|
@@ -3491,7 +3594,7 @@ var setBboxOrTimeSync = function setBboxOrTimeSync(state, action) {
|
|
|
3491
3594
|
draft.groups.byId[group].payloadByType[payloadKey] = source.payload;
|
|
3492
3595
|
}
|
|
3493
3596
|
});
|
|
3494
|
-
}
|
|
3597
|
+
}
|
|
3495
3598
|
};
|
|
3496
3599
|
var _slice$actions = slice$4.actions,
|
|
3497
3600
|
syncGroupAddGroup = _slice$actions.syncGroupAddGroup,
|
|
@@ -4203,13 +4306,13 @@ var isAutoUpdating = createSelector(getMapById, function (store) {
|
|
|
4203
4306
|
/**
|
|
4204
4307
|
* Gets if endTime and duration of animationPayload are overriding maxValue and minValue of leading layer
|
|
4205
4308
|
*
|
|
4206
|
-
* Example:
|
|
4309
|
+
* Example: shouldEndtimeOverride = shouldEndtimeOverride(store, 'mapid_1')
|
|
4207
4310
|
* @param {object} store store: object - store object
|
|
4208
4311
|
* @param {string} mapId mapId: string - Id of the map
|
|
4209
4312
|
* @returns {boolean} returnType: boolean
|
|
4210
4313
|
*/
|
|
4211
|
-
var
|
|
4212
|
-
return store ? store.
|
|
4314
|
+
var shouldEndtimeOverride = createSelector(getMapById, function (store) {
|
|
4315
|
+
return store ? store.shouldEndtimeOverride : false;
|
|
4213
4316
|
}, selectorMemoizationOptions);
|
|
4214
4317
|
/**
|
|
4215
4318
|
* Gets activeLayerId for map
|
|
@@ -4623,6 +4726,35 @@ var getIsEnabledLayersForMapDimension = createSelector(getMapLayerIdsEnabled, fu
|
|
|
4623
4726
|
var getDockedLayerManagerSize = createSelector(getMapById, function (store) {
|
|
4624
4727
|
return store ? store.dockedLayerManagerSize : 'sizeSmall';
|
|
4625
4728
|
}, selectorMemoizationOptions);
|
|
4729
|
+
/**
|
|
4730
|
+
* Returns the animation list for given map id
|
|
4731
|
+
* @param {object} store store: object - store object
|
|
4732
|
+
* @param {string} mapId mapId: string - Id of the map
|
|
4733
|
+
* @returns {animationList} returnType: WebMapAnimationList, list of timesteps to animate for this map.
|
|
4734
|
+
*/
|
|
4735
|
+
var getAnimationList = createSelector(getMapById, getAnimationStartTime, getAnimationEndTime$1, getMapTimeStep, function (mapStore, animationStart, animationEnd, animationInterval) {
|
|
4736
|
+
// Animation is defined by one of the following:
|
|
4737
|
+
// - start, end and interval for a continuous animation loop with constant interval
|
|
4738
|
+
// - timeList, for a custom timeList
|
|
4739
|
+
// Here the animation is defined by a timeList
|
|
4740
|
+
if (mapStore && (mapStore === null || mapStore === void 0 ? void 0 : mapStore.timeList) && mapStore.timeList.length > 0) {
|
|
4741
|
+
return mapStore.timeList;
|
|
4742
|
+
}
|
|
4743
|
+
// Here the animation is defined by a start/stop/interval
|
|
4744
|
+
var roundedStart = roundWithTimeStep(Number(animationStart && dateUtils.unix(dateUtils.utc(animationStart))), animationInterval, 'ceil');
|
|
4745
|
+
var roundedEnd = roundWithTimeStep(Number(animationEnd && dateUtils.unix(dateUtils.utc(animationEnd))), animationInterval, 'floor');
|
|
4746
|
+
var timeList = [];
|
|
4747
|
+
var unixStart = dateUtils.unix(dateUtils.fromUnix(roundedStart));
|
|
4748
|
+
var unixEnd = dateUtils.unix(dateUtils.fromUnix(roundedEnd));
|
|
4749
|
+
var intervalSeconds = animationInterval * 60;
|
|
4750
|
+
for (var j = unixStart; j <= unixEnd; j += intervalSeconds) {
|
|
4751
|
+
timeList.push({
|
|
4752
|
+
name: 'time',
|
|
4753
|
+
value: dateUtils.fromUnix(j).toISOString()
|
|
4754
|
+
});
|
|
4755
|
+
}
|
|
4756
|
+
return timeList;
|
|
4757
|
+
}, selectorMemoizationOptions);
|
|
4626
4758
|
|
|
4627
4759
|
var selectors$2 = /*#__PURE__*/Object.freeze({
|
|
4628
4760
|
__proto__: null,
|
|
@@ -4650,7 +4782,7 @@ var selectors$2 = /*#__PURE__*/Object.freeze({
|
|
|
4650
4782
|
getAnimationStartTime: getAnimationStartTime,
|
|
4651
4783
|
getAnimationEndTime: getAnimationEndTime$1,
|
|
4652
4784
|
isAutoUpdating: isAutoUpdating,
|
|
4653
|
-
|
|
4785
|
+
shouldEndtimeOverride: shouldEndtimeOverride,
|
|
4654
4786
|
getActiveLayerId: getActiveLayerId,
|
|
4655
4787
|
getAutoUpdateLayerId: getAutoUpdateLayerId,
|
|
4656
4788
|
getAutoTimeStepLayerId: getAutoTimeStepLayerId,
|
|
@@ -4680,7 +4812,8 @@ var selectors$2 = /*#__PURE__*/Object.freeze({
|
|
|
4680
4812
|
getMapPreset: getMapPreset,
|
|
4681
4813
|
getMapLayerIdsEnabled: getMapLayerIdsEnabled,
|
|
4682
4814
|
getIsEnabledLayersForMapDimension: getIsEnabledLayersForMapDimension,
|
|
4683
|
-
getDockedLayerManagerSize: getDockedLayerManagerSize
|
|
4815
|
+
getDockedLayerManagerSize: getDockedLayerManagerSize,
|
|
4816
|
+
getAnimationList: getAnimationList
|
|
4684
4817
|
});
|
|
4685
4818
|
|
|
4686
4819
|
/* *
|
|
@@ -5137,24 +5270,115 @@ var storeTestSettings = /*#__PURE__*/Object.freeze({
|
|
|
5137
5270
|
WmMultiDimensionServices: WmMultiDimensionServices
|
|
5138
5271
|
});
|
|
5139
5272
|
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5273
|
+
/* A map with all the timerIds and their current step */
|
|
5274
|
+
var stepMap = new Map();
|
|
5275
|
+
/**
|
|
5276
|
+
* Returns the next step for given timerId.
|
|
5277
|
+
* @param timerId The timer id
|
|
5278
|
+
* @param numberOfStepsInAnimation Animation length in steps
|
|
5279
|
+
* @param numStepsToGoForward Amount of steps to go forwards, defaults to 1. Can be positive and negative
|
|
5280
|
+
* @returns
|
|
5281
|
+
*/
|
|
5282
|
+
var getNextStep = function getNextStep(timerId, numberOfStepsInAnimation) {
|
|
5283
|
+
var numStepsToGoForward = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
5284
|
+
var currentStep = getCurrentStep(timerId);
|
|
5285
|
+
var nextStep = currentStep + numStepsToGoForward;
|
|
5286
|
+
var nextStepClipped = (nextStep % numberOfStepsInAnimation + numberOfStepsInAnimation) % numberOfStepsInAnimation;
|
|
5287
|
+
return nextStepClipped;
|
|
5288
|
+
};
|
|
5289
|
+
/**
|
|
5290
|
+
* Set step for the timerId
|
|
5291
|
+
* @param timerId
|
|
5292
|
+
* @param timerStep
|
|
5293
|
+
*/
|
|
5294
|
+
var setStep = function setStep(timerId, timerStep) {
|
|
5295
|
+
stepMap.set(timerId, timerStep);
|
|
5296
|
+
};
|
|
5297
|
+
/**
|
|
5298
|
+
* Gets the current step for the timer
|
|
5299
|
+
* @param timerId
|
|
5300
|
+
* @returns
|
|
5301
|
+
*/
|
|
5302
|
+
var getCurrentStep = function getCurrentStep(timerId) {
|
|
5303
|
+
return stepMap.get(timerId) || 0;
|
|
5304
|
+
};
|
|
5305
|
+
var MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH = 2;
|
|
5306
|
+
var MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES = 8;
|
|
5307
|
+
/**
|
|
5308
|
+
* This prefetches all images connected to the same sync group as provided timerId
|
|
5309
|
+
* @param timerId The timerId
|
|
5310
|
+
* @param animationListValues List of animation steps in isostring to animate
|
|
5311
|
+
* @param targets List of targets to check
|
|
5312
|
+
* @returns True if all maps are ready to go forward, false if the map has no data to display yet.
|
|
5313
|
+
*/
|
|
5314
|
+
var prefetchAnimationTargetsForSaga = function prefetchAnimationTargetsForSaga(timerId, animationListValues, targets) {
|
|
5315
|
+
var timerShouldStepForward = true;
|
|
5316
|
+
// The following code prefetches/buffers for all maps in the group
|
|
5317
|
+
for (var numPrefetch = 0; numPrefetch < MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH; numPrefetch += 1) {
|
|
5318
|
+
var nextStep = getNextStep(timerId, animationListValues.length, numPrefetch + 1);
|
|
5319
|
+
var nextTimeValueStepToCheck = animationListValues[nextStep];
|
|
5320
|
+
var _iterator = _createForOfIteratorHelper(targets),
|
|
5321
|
+
_step;
|
|
5322
|
+
try {
|
|
5323
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
5324
|
+
var target = _step.value;
|
|
5325
|
+
var targetMapId = target.targetId;
|
|
5326
|
+
var wmMap = getWMJSMapById(targetMapId);
|
|
5327
|
+
if (wmMap) {
|
|
5328
|
+
var layersImageUrls = wmMap.getWMSRequests([{
|
|
5329
|
+
name: 'time',
|
|
5330
|
+
currentValue: nextTimeValueStepToCheck
|
|
5331
|
+
}]);
|
|
5332
|
+
var _iterator2 = _createForOfIteratorHelper(layersImageUrls),
|
|
5333
|
+
_step2;
|
|
5334
|
+
try {
|
|
5335
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
5336
|
+
var layersImageUrl = _step2.value;
|
|
5337
|
+
var image = getMapImageStore.getImage(layersImageUrl.url);
|
|
5338
|
+
if (!image.isLoaded()) {
|
|
5339
|
+
if (getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
|
|
5340
|
+
image.load();
|
|
5341
|
+
}
|
|
5342
|
+
if (numPrefetch === 0) {
|
|
5343
|
+
var altImage = getAlternativeImage(layersImageUrl.url, getMapImageStore, wmMap.getBBOX());
|
|
5344
|
+
// No alternative image available yet, so skipping animation.
|
|
5345
|
+
if (!altImage) {
|
|
5346
|
+
// This is useful to indicate that the map is loading and has nothing yet to display.
|
|
5347
|
+
// console.warn('No data available: Not stepping forward');
|
|
5348
|
+
timerShouldStepForward = false;
|
|
5349
|
+
}
|
|
5350
|
+
}
|
|
5351
|
+
}
|
|
5352
|
+
}
|
|
5353
|
+
} catch (err) {
|
|
5354
|
+
_iterator2.e(err);
|
|
5355
|
+
} finally {
|
|
5356
|
+
_iterator2.f();
|
|
5357
|
+
}
|
|
5358
|
+
} else {
|
|
5359
|
+
return false; // Map was not registered so there is nothing to prefetch
|
|
5360
|
+
}
|
|
5361
|
+
}
|
|
5362
|
+
} catch (err) {
|
|
5363
|
+
_iterator.e(err);
|
|
5364
|
+
} finally {
|
|
5365
|
+
_iterator.f();
|
|
5366
|
+
}
|
|
5154
5367
|
}
|
|
5155
|
-
return
|
|
5368
|
+
return timerShouldStepForward;
|
|
5156
5369
|
};
|
|
5370
|
+
|
|
5371
|
+
var _marked$5 = /*#__PURE__*/_regeneratorRuntime().mark(updateAnimation),
|
|
5372
|
+
_marked2$3 = /*#__PURE__*/_regeneratorRuntime().mark(handleBaseLayersSaga),
|
|
5373
|
+
_marked3$1 = /*#__PURE__*/_regeneratorRuntime().mark(metronomeSaga),
|
|
5374
|
+
_marked4 = /*#__PURE__*/_regeneratorRuntime().mark(metronomeSagaWithChannel),
|
|
5375
|
+
_marked5 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$4);
|
|
5376
|
+
// Expects start, end time as Date object and interval in minutes
|
|
5157
5377
|
var getAnimationEndTime = function getAnimationEndTime(animationEndTime) {
|
|
5378
|
+
var ISOtime = dateUtils.parseISO(animationEndTime);
|
|
5379
|
+
if (dateUtils.isValid(ISOtime)) {
|
|
5380
|
+
return ISOtime.toISOString();
|
|
5381
|
+
}
|
|
5158
5382
|
var calculateFromNow = animationEndTime.split(/[-+]/)[0] === 'NOW';
|
|
5159
5383
|
var isAddingTime = animationEndTime.indexOf('+') !== -1;
|
|
5160
5384
|
var duration = animationEndTime.substring(animationEndTime.indexOf('PT') + 2);
|
|
@@ -5175,51 +5399,48 @@ var isAnimationEndTimeValid = function isAnimationEndTimeValid(animationEndTime)
|
|
|
5175
5399
|
var hasValidPrefix = animationEndTime.split(/[-+]/)[0] === 'NOW' || animationEndTime.split(/[-+]/)[0] === 'TODAY';
|
|
5176
5400
|
var durationString = animationEndTime.substring(animationEndTime.indexOf('PT') + 2);
|
|
5177
5401
|
var hasValidDate = /^(\d+H)?(\d+M)?$/.test(durationString);
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
var validInitialAnimationStep = function validInitialAnimationStep(initialAnimationStep, draw) {
|
|
5181
|
-
return !!initialAnimationStep && !!(draw === null || draw === void 0 ? void 0 : draw.length) && initialAnimationStep >= 0 && draw.length > initialAnimationStep;
|
|
5182
|
-
};
|
|
5183
|
-
function updateMapDraw(mapId, draw, initialAnimationStep) {
|
|
5184
|
-
var webMap = webmapUtils.getWMJSMapById(mapId);
|
|
5185
|
-
if (webMap) {
|
|
5186
|
-
webMap.getListener().suspendEvents();
|
|
5187
|
-
webMap.stopAnimating();
|
|
5188
|
-
if (initialAnimationStep && validInitialAnimationStep(initialAnimationStep, draw)) {
|
|
5189
|
-
webMap.initialAnimationStep = initialAnimationStep;
|
|
5190
|
-
} else {
|
|
5191
|
-
webMap.initialAnimationStep = 0;
|
|
5192
|
-
}
|
|
5193
|
-
webMap.draw(draw);
|
|
5194
|
-
webMap.getListener().resumeEvents();
|
|
5402
|
+
if (hasValidPrefix && hasValidDate) {
|
|
5403
|
+
return true;
|
|
5195
5404
|
}
|
|
5196
|
-
|
|
5405
|
+
var parsedDate = dateUtils.parseISO(animationEndTime);
|
|
5406
|
+
return dateUtils.isValid(parsedDate);
|
|
5407
|
+
};
|
|
5197
5408
|
function startAnimationSaga(_ref) {
|
|
5198
5409
|
var payload = _ref.payload;
|
|
5199
5410
|
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
5200
|
-
var mapId,
|
|
5411
|
+
var mapId, initialTime, speedDelay, speed, timeList, initalTimerStep;
|
|
5201
5412
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5202
5413
|
while (1) switch (_context.prev = _context.next) {
|
|
5203
5414
|
case 0:
|
|
5204
|
-
mapId = payload.mapId,
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5415
|
+
mapId = payload.mapId, initialTime = payload.initialTime;
|
|
5416
|
+
_context.next = 3;
|
|
5417
|
+
return select(getMapAnimationDelay, mapId);
|
|
5418
|
+
case 3:
|
|
5419
|
+
speedDelay = _context.sent;
|
|
5420
|
+
speed = 1000 / (speedDelay || 1);
|
|
5421
|
+
metronome.register(null, speed, mapId);
|
|
5422
|
+
_context.next = 8;
|
|
5423
|
+
return select(getAnimationList, mapId);
|
|
5424
|
+
case 8:
|
|
5425
|
+
timeList = _context.sent;
|
|
5426
|
+
// In case of the timeList
|
|
5427
|
+
if (timeList && timeList.length > 0) {
|
|
5428
|
+
// Determine animation step based on initialTime and timeList
|
|
5429
|
+
initalTimerStep = timeList === null || timeList === void 0 ? void 0 : timeList.findIndex(function (timeNameValue) {
|
|
5430
|
+
return timeNameValue.value === initialTime;
|
|
5431
|
+
});
|
|
5432
|
+
if (initalTimerStep !== -1) {
|
|
5433
|
+
setStep(mapId, initalTimerStep);
|
|
5434
|
+
}
|
|
5435
|
+
}
|
|
5436
|
+
case 10:
|
|
5217
5437
|
case "end":
|
|
5218
5438
|
return _context.stop();
|
|
5219
5439
|
}
|
|
5220
5440
|
}, _callee);
|
|
5221
5441
|
})();
|
|
5222
5442
|
}
|
|
5443
|
+
// eslint-disable-next-line require-yield
|
|
5223
5444
|
function stopAnimationSaga(_ref2) {
|
|
5224
5445
|
var payload = _ref2.payload;
|
|
5225
5446
|
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
@@ -5228,9 +5449,8 @@ function stopAnimationSaga(_ref2) {
|
|
|
5228
5449
|
while (1) switch (_context2.prev = _context2.next) {
|
|
5229
5450
|
case 0:
|
|
5230
5451
|
mapId = payload.mapId;
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
case 3:
|
|
5452
|
+
metronome.unregister(mapId);
|
|
5453
|
+
case 2:
|
|
5234
5454
|
case "end":
|
|
5235
5455
|
return _context2.stop();
|
|
5236
5456
|
}
|
|
@@ -5265,65 +5485,61 @@ function deleteLayerSaga(_ref3) {
|
|
|
5265
5485
|
})();
|
|
5266
5486
|
}
|
|
5267
5487
|
function updateAnimation(mapId, maxValue) {
|
|
5268
|
-
var
|
|
5488
|
+
var shouldEndtimeOverride$1, animationStart, animationEnd, animationEndUnix, maxTimeAsUnix, timeInSecondToShiftAnimationForwards, animationStartUnix, newAnimationStartTime, newAnimationEndTime;
|
|
5269
5489
|
return _regeneratorRuntime().wrap(function updateAnimation$(_context4) {
|
|
5270
5490
|
while (1) switch (_context4.prev = _context4.next) {
|
|
5271
5491
|
case 0:
|
|
5272
5492
|
_context4.next = 2;
|
|
5273
|
-
return select(
|
|
5493
|
+
return select(shouldEndtimeOverride, mapId);
|
|
5274
5494
|
case 2:
|
|
5495
|
+
shouldEndtimeOverride$1 = _context4.sent;
|
|
5496
|
+
if (!(shouldEndtimeOverride$1 === true)) {
|
|
5497
|
+
_context4.next = 5;
|
|
5498
|
+
break;
|
|
5499
|
+
}
|
|
5500
|
+
return _context4.abrupt("return");
|
|
5501
|
+
case 5:
|
|
5502
|
+
_context4.next = 7;
|
|
5503
|
+
return select(getAnimationStartTime, mapId);
|
|
5504
|
+
case 7:
|
|
5275
5505
|
animationStart = _context4.sent;
|
|
5276
|
-
|
|
5277
|
-
_context4.next = 6;
|
|
5506
|
+
_context4.next = 10;
|
|
5278
5507
|
return select(getAnimationEndTime$1, mapId);
|
|
5279
|
-
case
|
|
5508
|
+
case 10:
|
|
5280
5509
|
animationEnd = _context4.sent;
|
|
5281
5510
|
animationEndUnix = dateUtils.unix(dateUtils.utc(animationEnd));
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5511
|
+
maxTimeAsUnix = dateUtils.unix(dateUtils.utc(maxValue));
|
|
5512
|
+
timeInSecondToShiftAnimationForwards = maxTimeAsUnix - animationEndUnix;
|
|
5513
|
+
animationStartUnix = dateUtils.unix(dateUtils.utc(animationStart));
|
|
5514
|
+
newAnimationStartTime = dateUtils.dateToString(dateUtils.fromUnix(animationStartUnix + timeInSecondToShiftAnimationForwards), dateFormat);
|
|
5515
|
+
newAnimationEndTime = dateUtils.dateToString(dateUtils.fromUnix(animationEndUnix + timeInSecondToShiftAnimationForwards), dateFormat);
|
|
5516
|
+
if (!(!newAnimationStartTime || !newAnimationEndTime)) {
|
|
5517
|
+
_context4.next = 19;
|
|
5518
|
+
break;
|
|
5519
|
+
}
|
|
5520
|
+
return _context4.abrupt("return");
|
|
5521
|
+
case 19:
|
|
5522
|
+
_context4.next = 21;
|
|
5287
5523
|
return put(mapActions.setAnimationEndTime({
|
|
5288
5524
|
mapId: mapId,
|
|
5289
|
-
animationEndTime:
|
|
5525
|
+
animationEndTime: newAnimationEndTime
|
|
5290
5526
|
}));
|
|
5291
|
-
case
|
|
5292
|
-
_context4.next =
|
|
5527
|
+
case 21:
|
|
5528
|
+
_context4.next = 23;
|
|
5293
5529
|
return put(mapActions.setAnimationStartTime({
|
|
5294
5530
|
mapId: mapId,
|
|
5295
|
-
animationStartTime:
|
|
5531
|
+
animationStartTime: newAnimationStartTime
|
|
5296
5532
|
}));
|
|
5297
|
-
case
|
|
5298
|
-
_context4.next = 18;
|
|
5299
|
-
return select(isAnimating, mapId);
|
|
5300
|
-
case 18:
|
|
5301
|
-
isAnimating$1 = _context4.sent;
|
|
5302
|
-
if (!isAnimating$1) {
|
|
5303
|
-
_context4.next = 25;
|
|
5304
|
-
break;
|
|
5305
|
-
}
|
|
5306
|
-
_context4.next = 22;
|
|
5307
|
-
return select(getMapTimeStep, mapId);
|
|
5308
|
-
case 22:
|
|
5309
|
-
timeStep = _context4.sent;
|
|
5310
|
-
_context4.next = 25;
|
|
5311
|
-
return put(mapActions.mapStartAnimation({
|
|
5312
|
-
mapId: mapId,
|
|
5313
|
-
start: start,
|
|
5314
|
-
end: end,
|
|
5315
|
-
interval: timeStep
|
|
5316
|
-
}));
|
|
5317
|
-
case 25:
|
|
5533
|
+
case 23:
|
|
5318
5534
|
case "end":
|
|
5319
5535
|
return _context4.stop();
|
|
5320
5536
|
}
|
|
5321
|
-
}, _marked$
|
|
5537
|
+
}, _marked$5);
|
|
5322
5538
|
}
|
|
5323
|
-
function
|
|
5539
|
+
function updateAnimationWithLatestUpdate(_ref4) {
|
|
5324
5540
|
var payload = _ref4.payload;
|
|
5325
5541
|
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
5326
|
-
var layerDimensions, dimensions, layerId, layer, newTimeDimension, mapId, autoUpdateLayerId, shouldAutoUpdate, prevTimeDimension,
|
|
5542
|
+
var layerDimensions, dimensions, layerId, layer, newTimeDimension, mapId, autoUpdateLayerId, shouldAutoUpdate, prevTimeDimension, isAutoUpdateLayer, incomingMaxTime, isIncomingMaxTimeLaterThanCurrentLayerTime;
|
|
5327
5543
|
return _regeneratorRuntime().wrap(function _callee4$(_context5) {
|
|
5328
5544
|
while (1) switch (_context5.prev = _context5.next) {
|
|
5329
5545
|
case 0:
|
|
@@ -5362,76 +5578,30 @@ function setLayerDimensionsSaga(_ref4) {
|
|
|
5362
5578
|
return select(getLayerTimeDimension, layerId);
|
|
5363
5579
|
case 20:
|
|
5364
5580
|
prevTimeDimension = _context5.sent;
|
|
5365
|
-
_context5.next = 23;
|
|
5366
|
-
return select(isAnimating, mapId);
|
|
5367
|
-
case 23:
|
|
5368
|
-
isAnimating$1 = _context5.sent;
|
|
5369
|
-
webmapInstance = webmapUtils.getWMJSMapById(mapId);
|
|
5370
5581
|
isAutoUpdateLayer = layerId === autoUpdateLayerId;
|
|
5371
5582
|
incomingMaxTime = newTimeDimension === null || newTimeDimension === void 0 ? void 0 : newTimeDimension.maxValue;
|
|
5372
5583
|
isIncomingMaxTimeLaterThanCurrentLayerTime = incomingMaxTime && (prevTimeDimension === null || prevTimeDimension === void 0 ? void 0 : prevTimeDimension.currentValue) && prevTimeDimension.currentValue !== incomingMaxTime;
|
|
5373
5584
|
if (!(isAutoUpdateLayer &&
|
|
5374
5585
|
// only update the active layer
|
|
5375
5586
|
shouldAutoUpdate && isIncomingMaxTimeLaterThanCurrentLayerTime)) {
|
|
5376
|
-
_context5.next =
|
|
5377
|
-
break;
|
|
5378
|
-
}
|
|
5379
|
-
if (isAnimating$1) {
|
|
5380
|
-
_context5.next = 32;
|
|
5381
|
-
break;
|
|
5382
|
-
}
|
|
5383
|
-
_context5.next = 32;
|
|
5384
|
-
return put(layerActions.layerChangeDimension({
|
|
5385
|
-
layerId: layerId,
|
|
5386
|
-
origin: LayerActionOrigin.setLayerDimensionSaga,
|
|
5387
|
-
dimension: {
|
|
5388
|
-
name: 'time',
|
|
5389
|
-
currentValue: incomingMaxTime
|
|
5390
|
-
}
|
|
5391
|
-
}));
|
|
5392
|
-
case 32:
|
|
5393
|
-
_context5.next = 34;
|
|
5394
|
-
return select(getSyncedMapIdsForTimeslider);
|
|
5395
|
-
case 34:
|
|
5396
|
-
syncedMapIds = _context5.sent;
|
|
5397
|
-
if (!syncedMapIds) {
|
|
5398
|
-
_context5.next = 38;
|
|
5399
|
-
break;
|
|
5400
|
-
}
|
|
5401
|
-
_context5.next = 38;
|
|
5402
|
-
return all(syncedMapIds.map(function (syncedMapId) {
|
|
5403
|
-
return put(setTime({
|
|
5404
|
-
origin: 'mapStore saga',
|
|
5405
|
-
sourceId: syncedMapId,
|
|
5406
|
-
value: incomingMaxTime
|
|
5407
|
-
}));
|
|
5408
|
-
}));
|
|
5409
|
-
case 38:
|
|
5410
|
-
_context5.next = 40;
|
|
5411
|
-
return call(updateAnimation, mapId, incomingMaxTime);
|
|
5412
|
-
case 40:
|
|
5413
|
-
_context5.next = 45;
|
|
5414
|
-
break;
|
|
5415
|
-
case 42:
|
|
5416
|
-
if (!(isAnimating$1 && !webmapInstance.isAnimating && incomingMaxTime)) {
|
|
5417
|
-
_context5.next = 45;
|
|
5587
|
+
_context5.next = 27;
|
|
5418
5588
|
break;
|
|
5419
5589
|
}
|
|
5420
|
-
_context5.next =
|
|
5590
|
+
_context5.next = 27;
|
|
5421
5591
|
return call(updateAnimation, mapId, incomingMaxTime);
|
|
5422
|
-
case
|
|
5423
|
-
_context5.next =
|
|
5592
|
+
case 27:
|
|
5593
|
+
_context5.next = 32;
|
|
5424
5594
|
break;
|
|
5425
|
-
case
|
|
5426
|
-
_context5.prev =
|
|
5595
|
+
case 29:
|
|
5596
|
+
_context5.prev = 29;
|
|
5427
5597
|
_context5.t0 = _context5["catch"](0);
|
|
5428
5598
|
// eslint-disable-next-line no-console
|
|
5429
5599
|
console.warn(_context5.t0);
|
|
5430
|
-
case
|
|
5600
|
+
case 32:
|
|
5431
5601
|
case "end":
|
|
5432
5602
|
return _context5.stop();
|
|
5433
5603
|
}
|
|
5434
|
-
}, _callee4, null, [[0,
|
|
5604
|
+
}, _callee4, null, [[0, 29]]);
|
|
5435
5605
|
})();
|
|
5436
5606
|
}
|
|
5437
5607
|
function toggleAutoUpdateSaga(_ref5) {
|
|
@@ -5569,7 +5739,7 @@ function handleBaseLayersSaga(mapId, baseLayers) {
|
|
|
5569
5739
|
case "end":
|
|
5570
5740
|
return _context7.stop();
|
|
5571
5741
|
}
|
|
5572
|
-
}, _marked2$
|
|
5742
|
+
}, _marked2$3);
|
|
5573
5743
|
}
|
|
5574
5744
|
function setMapPresetSaga(_ref6) {
|
|
5575
5745
|
var payload = _ref6.payload;
|
|
@@ -5924,7 +6094,8 @@ function unregisterMapSaga(_ref7) {
|
|
|
5924
6094
|
return select(getLayersByMapId, mapId);
|
|
5925
6095
|
case 3:
|
|
5926
6096
|
layerList = _context9.sent;
|
|
5927
|
-
|
|
6097
|
+
metronome.unregister(mapId);
|
|
6098
|
+
_context9.next = 7;
|
|
5928
6099
|
return all(layerList.map(function (layer) {
|
|
5929
6100
|
return put(layerActions.layerDelete({
|
|
5930
6101
|
mapId: mapId,
|
|
@@ -5933,7 +6104,7 @@ function unregisterMapSaga(_ref7) {
|
|
|
5933
6104
|
origin: LayerActionOrigin.unregisterMapSaga
|
|
5934
6105
|
}));
|
|
5935
6106
|
}));
|
|
5936
|
-
case
|
|
6107
|
+
case 7:
|
|
5937
6108
|
case "end":
|
|
5938
6109
|
return _context9.stop();
|
|
5939
6110
|
}
|
|
@@ -5963,7 +6134,7 @@ function setStepBackwardOrForwardSaga(_ref8) {
|
|
|
5963
6134
|
_yield$select2 = _slicedToArray(_yield$select, 2);
|
|
5964
6135
|
dataStartTime = _yield$select2[0];
|
|
5965
6136
|
dataEndTime = _yield$select2[1];
|
|
5966
|
-
if (!isValid(currentTime)) {
|
|
6137
|
+
if (!dateUtils.isValid(currentTime)) {
|
|
5967
6138
|
_context10.next = 23;
|
|
5968
6139
|
break;
|
|
5969
6140
|
}
|
|
@@ -5971,13 +6142,13 @@ function setStepBackwardOrForwardSaga(_ref8) {
|
|
|
5971
6142
|
var nextTime = currentTime + timeStep;
|
|
5972
6143
|
var roundedTime = mapUtils.roundWithTimeStep(nextTime, timeStep, 'ceil');
|
|
5973
6144
|
var newTime = Math.min(roundedTime, dataEndTime || roundedTime);
|
|
5974
|
-
return
|
|
6145
|
+
return dateUtils.fromUnix(newTime).toISOString();
|
|
5975
6146
|
};
|
|
5976
6147
|
makeBackwardStep = function makeBackwardStep() {
|
|
5977
6148
|
var nextTime = currentTime - timeStep;
|
|
5978
6149
|
var roundedTime = mapUtils.roundWithTimeStep(nextTime, timeStep, 'floor');
|
|
5979
6150
|
var newTime = Math.max(roundedTime, dataStartTime || roundedTime);
|
|
5980
|
-
return
|
|
6151
|
+
return dateUtils.fromUnix(newTime).toISOString();
|
|
5981
6152
|
};
|
|
5982
6153
|
selectedTimeString = isForwardStep ? makeForwardStep() : makeBackwardStep();
|
|
5983
6154
|
_context10.next = 19;
|
|
@@ -6005,42 +6176,184 @@ function setStepBackwardOrForwardSaga(_ref8) {
|
|
|
6005
6176
|
}, _callee8);
|
|
6006
6177
|
})();
|
|
6007
6178
|
}
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6179
|
+
/**
|
|
6180
|
+
* This saga is triggered by the metronome. An array of timerIds is given as argument.
|
|
6181
|
+
* It will update the animation loop of multiple maps and sliders
|
|
6182
|
+
* It will prefetch images for maps
|
|
6183
|
+
* @param timerIds string[] array of timerIds
|
|
6184
|
+
*/
|
|
6185
|
+
function metronomeSaga(timerIds) {
|
|
6186
|
+
var targetsWithUpdateValue, _iterator, _step, _loop;
|
|
6187
|
+
return _regeneratorRuntime().wrap(function metronomeSaga$(_context12) {
|
|
6188
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
6011
6189
|
case 0:
|
|
6012
|
-
|
|
6190
|
+
targetsWithUpdateValue = [];
|
|
6191
|
+
_iterator = _createForOfIteratorHelper(timerIds);
|
|
6192
|
+
_context12.prev = 2;
|
|
6193
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
6194
|
+
var timerId, animationListValuesNameAndValue, animationListValues, targets, timerShouldStepForward, timerStep, updatedValue, speedDelay, speed;
|
|
6195
|
+
return _regeneratorRuntime().wrap(function _loop$(_context11) {
|
|
6196
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
6197
|
+
case 0:
|
|
6198
|
+
timerId = _step.value;
|
|
6199
|
+
_context11.next = 3;
|
|
6200
|
+
return select(getAnimationList, timerId);
|
|
6201
|
+
case 3:
|
|
6202
|
+
animationListValuesNameAndValue = _context11.sent;
|
|
6203
|
+
animationListValues = animationListValuesNameAndValue.map(function (nameAndValue) {
|
|
6204
|
+
return nameAndValue.value;
|
|
6205
|
+
});
|
|
6206
|
+
_context11.next = 7;
|
|
6207
|
+
return select(getTargets, {
|
|
6208
|
+
sourceId: timerId,
|
|
6209
|
+
origin: timerId
|
|
6210
|
+
}, SYNCGROUPS_TYPE_SETTIME);
|
|
6211
|
+
case 7:
|
|
6212
|
+
targets = _context11.sent;
|
|
6213
|
+
if (targets.length === 0) {
|
|
6214
|
+
// When there are no targets, default to one
|
|
6215
|
+
targets.push({
|
|
6216
|
+
targetId: timerId,
|
|
6217
|
+
value: ''
|
|
6218
|
+
});
|
|
6219
|
+
}
|
|
6220
|
+
timerShouldStepForward = prefetchAnimationTargetsForSaga(timerId, animationListValues, targets); // Determine the next step
|
|
6221
|
+
timerStep = timerShouldStepForward ? getNextStep(timerId, animationListValues.length) : getCurrentStep(timerId);
|
|
6222
|
+
setStep(timerId, timerStep);
|
|
6223
|
+
updatedValue = animationListValues[timerStep];
|
|
6224
|
+
targetsWithUpdateValue.push.apply(targetsWithUpdateValue, _toConsumableArray(targets.map(function (target) {
|
|
6225
|
+
return Object.assign(Object.assign({}, target), {
|
|
6226
|
+
value: updatedValue
|
|
6227
|
+
});
|
|
6228
|
+
})));
|
|
6229
|
+
_context11.next = 16;
|
|
6230
|
+
return select(getMapAnimationDelay, timerId);
|
|
6231
|
+
case 16:
|
|
6232
|
+
speedDelay = _context11.sent;
|
|
6233
|
+
speed = 1000 / (speedDelay || 1);
|
|
6234
|
+
metronome.setSpeed(timerId, speed);
|
|
6235
|
+
case 19:
|
|
6236
|
+
case "end":
|
|
6237
|
+
return _context11.stop();
|
|
6238
|
+
}
|
|
6239
|
+
}, _loop);
|
|
6240
|
+
});
|
|
6241
|
+
_iterator.s();
|
|
6242
|
+
case 5:
|
|
6243
|
+
if ((_step = _iterator.n()).done) {
|
|
6244
|
+
_context12.next = 9;
|
|
6245
|
+
break;
|
|
6246
|
+
}
|
|
6247
|
+
return _context12.delegateYield(_loop(), "t0", 7);
|
|
6248
|
+
case 7:
|
|
6249
|
+
_context12.next = 5;
|
|
6250
|
+
break;
|
|
6251
|
+
case 9:
|
|
6252
|
+
_context12.next = 14;
|
|
6253
|
+
break;
|
|
6254
|
+
case 11:
|
|
6255
|
+
_context12.prev = 11;
|
|
6256
|
+
_context12.t1 = _context12["catch"](2);
|
|
6257
|
+
_iterator.e(_context12.t1);
|
|
6258
|
+
case 14:
|
|
6259
|
+
_context12.prev = 14;
|
|
6260
|
+
_iterator.f();
|
|
6261
|
+
return _context12.finish(14);
|
|
6262
|
+
case 17:
|
|
6263
|
+
if (!(targetsWithUpdateValue.length > 0)) {
|
|
6264
|
+
_context12.next = 20;
|
|
6265
|
+
break;
|
|
6266
|
+
}
|
|
6267
|
+
_context12.next = 20;
|
|
6268
|
+
return put(setTimeSync(null, targetsWithUpdateValue, ['metronomesaga']));
|
|
6269
|
+
case 20:
|
|
6270
|
+
case "end":
|
|
6271
|
+
return _context12.stop();
|
|
6272
|
+
}
|
|
6273
|
+
}, _marked3$1, null, [[2, 11, 14, 17]]);
|
|
6274
|
+
}
|
|
6275
|
+
/**
|
|
6276
|
+
* Creates a channel for the metronome
|
|
6277
|
+
* @returns
|
|
6278
|
+
*/
|
|
6279
|
+
function metronomeTicker() {
|
|
6280
|
+
return eventChannel(function (emitter) {
|
|
6281
|
+
metronome.handleTimerTicks = function (timerIds) {
|
|
6282
|
+
emitter(timerIds);
|
|
6283
|
+
};
|
|
6284
|
+
// The subscriber must return an unsubscribe function
|
|
6285
|
+
return function () {
|
|
6286
|
+
metronome.unregisterAllTimers();
|
|
6287
|
+
};
|
|
6288
|
+
});
|
|
6289
|
+
}
|
|
6290
|
+
/**
|
|
6291
|
+
* Makes a saga channel for the metronome ticker
|
|
6292
|
+
*/
|
|
6293
|
+
function metronomeSagaWithChannel() {
|
|
6294
|
+
var channel, metronomeHandler;
|
|
6295
|
+
return _regeneratorRuntime().wrap(function metronomeSagaWithChannel$(_context13) {
|
|
6296
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
6297
|
+
case 0:
|
|
6298
|
+
_context13.next = 2;
|
|
6299
|
+
return call(metronomeTicker);
|
|
6300
|
+
case 2:
|
|
6301
|
+
channel = _context13.sent;
|
|
6302
|
+
case 3:
|
|
6303
|
+
_context13.next = 6;
|
|
6304
|
+
return take(channel);
|
|
6305
|
+
case 6:
|
|
6306
|
+
metronomeHandler = _context13.sent;
|
|
6307
|
+
_context13.next = 9;
|
|
6308
|
+
return call(metronomeSaga, metronomeHandler);
|
|
6309
|
+
case 9:
|
|
6310
|
+
_context13.next = 3;
|
|
6311
|
+
break;
|
|
6312
|
+
case 11:
|
|
6313
|
+
case "end":
|
|
6314
|
+
return _context13.stop();
|
|
6315
|
+
}
|
|
6316
|
+
}, _marked4);
|
|
6317
|
+
}
|
|
6318
|
+
function rootSaga$4() {
|
|
6319
|
+
return _regeneratorRuntime().wrap(function rootSaga$(_context14) {
|
|
6320
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
6321
|
+
case 0:
|
|
6322
|
+
_context14.next = 2;
|
|
6013
6323
|
return takeLatest(mapActions.mapStopAnimation.type, stopAnimationSaga);
|
|
6014
6324
|
case 2:
|
|
6015
|
-
|
|
6325
|
+
_context14.next = 4;
|
|
6016
6326
|
return takeLatest(mapActions.mapStartAnimation.type, startAnimationSaga);
|
|
6017
6327
|
case 4:
|
|
6018
|
-
|
|
6328
|
+
_context14.next = 6;
|
|
6019
6329
|
return takeLatest(layerActions.layerDelete.type, deleteLayerSaga);
|
|
6020
6330
|
case 6:
|
|
6021
|
-
|
|
6022
|
-
return takeLatest(layerActions.onUpdateLayerInformation.type,
|
|
6331
|
+
_context14.next = 8;
|
|
6332
|
+
return takeLatest(layerActions.onUpdateLayerInformation.type, updateAnimationWithLatestUpdate);
|
|
6023
6333
|
case 8:
|
|
6024
|
-
|
|
6334
|
+
_context14.next = 10;
|
|
6025
6335
|
return takeLatest(mapActions.toggleAutoUpdate.type, toggleAutoUpdateSaga);
|
|
6026
6336
|
case 10:
|
|
6027
|
-
|
|
6337
|
+
_context14.next = 12;
|
|
6028
6338
|
return takeEvery(mapActions.setMapPreset.type, setMapPresetSaga);
|
|
6029
6339
|
case 12:
|
|
6030
|
-
|
|
6340
|
+
_context14.next = 14;
|
|
6031
6341
|
return takeEvery(mapActions.unregisterMap.type, unregisterMapSaga);
|
|
6032
6342
|
case 14:
|
|
6033
|
-
|
|
6343
|
+
_context14.next = 16;
|
|
6034
6344
|
return takeEvery(mapActions.setStepBackwardOrForward.type, setStepBackwardOrForwardSaga);
|
|
6035
6345
|
case 16:
|
|
6346
|
+
_context14.next = 18;
|
|
6347
|
+
return call(metronomeSagaWithChannel);
|
|
6348
|
+
case 18:
|
|
6036
6349
|
case "end":
|
|
6037
|
-
return
|
|
6350
|
+
return _context14.stop();
|
|
6038
6351
|
}
|
|
6039
|
-
},
|
|
6352
|
+
}, _marked5);
|
|
6040
6353
|
}
|
|
6041
6354
|
|
|
6042
|
-
var _marked$
|
|
6043
|
-
_marked2$
|
|
6355
|
+
var _marked$4 = /*#__PURE__*/_regeneratorRuntime().mark(fetchServiceSaga),
|
|
6356
|
+
_marked2$2 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$3);
|
|
6044
6357
|
function fetchServiceSaga(service) {
|
|
6045
6358
|
var layers;
|
|
6046
6359
|
return _regeneratorRuntime().wrap(function fetchServiceSaga$(_context) {
|
|
@@ -6065,7 +6378,7 @@ function fetchServiceSaga(service) {
|
|
|
6065
6378
|
case "end":
|
|
6066
6379
|
return _context.stop();
|
|
6067
6380
|
}
|
|
6068
|
-
}, _marked$
|
|
6381
|
+
}, _marked$4, null, [[0, 8]]);
|
|
6069
6382
|
}
|
|
6070
6383
|
function fetchInitialServicesSaga(_ref) {
|
|
6071
6384
|
var payload = _ref.payload;
|
|
@@ -6086,7 +6399,7 @@ function fetchInitialServicesSaga(_ref) {
|
|
|
6086
6399
|
}, _callee);
|
|
6087
6400
|
})();
|
|
6088
6401
|
}
|
|
6089
|
-
function rootSaga$
|
|
6402
|
+
function rootSaga$3() {
|
|
6090
6403
|
return _regeneratorRuntime().wrap(function rootSaga$(_context3) {
|
|
6091
6404
|
while (1) switch (_context3.prev = _context3.next) {
|
|
6092
6405
|
case 0:
|
|
@@ -6096,7 +6409,7 @@ function rootSaga$4() {
|
|
|
6096
6409
|
case "end":
|
|
6097
6410
|
return _context3.stop();
|
|
6098
6411
|
}
|
|
6099
|
-
}, _marked2$
|
|
6412
|
+
}, _marked2$2);
|
|
6100
6413
|
}
|
|
6101
6414
|
|
|
6102
6415
|
// TODO: This fixes typecheck errors but maybe there is a better way to do that
|
|
@@ -6111,7 +6424,7 @@ var mapStoreReducers = {
|
|
|
6111
6424
|
var mapStoreModuleConfig = {
|
|
6112
6425
|
id: 'webmap-module',
|
|
6113
6426
|
reducersMap: mapStoreReducers,
|
|
6114
|
-
sagas: [rootSaga$
|
|
6427
|
+
sagas: [rootSaga$4, rootSaga$3]
|
|
6115
6428
|
};
|
|
6116
6429
|
|
|
6117
6430
|
/* *
|
|
@@ -6334,7 +6647,7 @@ var getMapBaseLayerActionsTargets = function getMapBaseLayerActionsTargets(state
|
|
|
6334
6647
|
});
|
|
6335
6648
|
};
|
|
6336
6649
|
|
|
6337
|
-
var _marked$
|
|
6650
|
+
var _marked$3 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$2);
|
|
6338
6651
|
var setTimeValidatorRexexp = /^(19|20)\d\d-(0[1-9]|1[012])-([012]\d|3[01])T([01]\d|2[0-3]):([0-5]\d):([0-5]\d)Z$/;
|
|
6339
6652
|
function setTimeSaga(_ref) {
|
|
6340
6653
|
var payload = _ref.payload;
|
|
@@ -6607,7 +6920,7 @@ function mapBaseLayerActionsSaga(_ref9) {
|
|
|
6607
6920
|
}, _callee9);
|
|
6608
6921
|
})();
|
|
6609
6922
|
}
|
|
6610
|
-
function rootSaga$
|
|
6923
|
+
function rootSaga$2() {
|
|
6611
6924
|
return _regeneratorRuntime().wrap(function rootSaga$(_context10) {
|
|
6612
6925
|
while (1) switch (_context10.prev = _context10.next) {
|
|
6613
6926
|
case 0:
|
|
@@ -6653,7 +6966,7 @@ function rootSaga$3() {
|
|
|
6653
6966
|
case "end":
|
|
6654
6967
|
return _context10.stop();
|
|
6655
6968
|
}
|
|
6656
|
-
}, _marked$
|
|
6969
|
+
}, _marked$3);
|
|
6657
6970
|
}
|
|
6658
6971
|
|
|
6659
6972
|
/* *
|
|
@@ -6714,8 +7027,8 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
6714
7027
|
historyDict: historyDict
|
|
6715
7028
|
});
|
|
6716
7029
|
|
|
6717
|
-
var _marked$
|
|
6718
|
-
_marked2$
|
|
7030
|
+
var _marked$2 = /*#__PURE__*/_regeneratorRuntime().mark(navigateToUrlSaga),
|
|
7031
|
+
_marked2$1 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$1);
|
|
6719
7032
|
function navigateToUrlSaga(action) {
|
|
6720
7033
|
var payload;
|
|
6721
7034
|
return _regeneratorRuntime().wrap(function navigateToUrlSaga$(_context) {
|
|
@@ -6728,9 +7041,9 @@ function navigateToUrlSaga(action) {
|
|
|
6728
7041
|
case "end":
|
|
6729
7042
|
return _context.stop();
|
|
6730
7043
|
}
|
|
6731
|
-
}, _marked$
|
|
7044
|
+
}, _marked$2);
|
|
6732
7045
|
}
|
|
6733
|
-
function rootSaga$
|
|
7046
|
+
function rootSaga$1() {
|
|
6734
7047
|
return _regeneratorRuntime().wrap(function rootSaga$(_context2) {
|
|
6735
7048
|
while (1) switch (_context2.prev = _context2.next) {
|
|
6736
7049
|
case 0:
|
|
@@ -6740,7 +7053,7 @@ function rootSaga$2() {
|
|
|
6740
7053
|
case "end":
|
|
6741
7054
|
return _context2.stop();
|
|
6742
7055
|
}
|
|
6743
|
-
}, _marked2$
|
|
7056
|
+
}, _marked2$1);
|
|
6744
7057
|
}
|
|
6745
7058
|
|
|
6746
7059
|
/* *
|
|
@@ -6764,7 +7077,7 @@ var routerModuleConfig = {
|
|
|
6764
7077
|
reducersMap: {
|
|
6765
7078
|
router: reducer$2
|
|
6766
7079
|
},
|
|
6767
|
-
sagas: [rootSaga$
|
|
7080
|
+
sagas: [rootSaga$1]
|
|
6768
7081
|
};
|
|
6769
7082
|
|
|
6770
7083
|
/* *
|
|
@@ -6844,9 +7157,8 @@ var drawAdapter = createEntityAdapter({
|
|
|
6844
7157
|
}
|
|
6845
7158
|
});
|
|
6846
7159
|
var getDrawToolByLayerId = function getDrawToolByLayerId(draft, layerId) {
|
|
6847
|
-
var
|
|
6848
|
-
|
|
6849
|
-
return state.entities[id];
|
|
7160
|
+
var drawTool = draft.ids.map(function (id) {
|
|
7161
|
+
return draft.entities[id];
|
|
6850
7162
|
}).find(function (tool) {
|
|
6851
7163
|
return (tool === null || tool === void 0 ? void 0 : tool.geoJSONLayerId) === layerId;
|
|
6852
7164
|
});
|
|
@@ -7059,6 +7371,11 @@ var getGeoJSONIntersectionBoundsLayerId = createSelector(selectDrawToolById, fun
|
|
|
7059
7371
|
var getShouldAllowMultipleShapes = createSelector(selectDrawToolById, function (drawingTool) {
|
|
7060
7372
|
return (drawingTool === null || drawingTool === void 0 ? void 0 : drawingTool.shouldAllowMultipleShapes) || false;
|
|
7061
7373
|
});
|
|
7374
|
+
var getActiveDrawMode = createSelector(selectDrawToolById, function (drawingTool) {
|
|
7375
|
+
return drawingTool === null || drawingTool === void 0 ? void 0 : drawingTool.drawModes.find(function (mode) {
|
|
7376
|
+
return mode.drawModeId === drawingTool.activeDrawModeId;
|
|
7377
|
+
});
|
|
7378
|
+
});
|
|
7062
7379
|
|
|
7063
7380
|
var selectors = /*#__PURE__*/Object.freeze({
|
|
7064
7381
|
__proto__: null,
|
|
@@ -7071,10 +7388,11 @@ var selectors = /*#__PURE__*/Object.freeze({
|
|
|
7071
7388
|
getDrawToolGeoJSONLayerId: getDrawToolGeoJSONLayerId,
|
|
7072
7389
|
getGeoJSONIntersectionLayerId: getGeoJSONIntersectionLayerId,
|
|
7073
7390
|
getGeoJSONIntersectionBoundsLayerId: getGeoJSONIntersectionBoundsLayerId,
|
|
7074
|
-
getShouldAllowMultipleShapes: getShouldAllowMultipleShapes
|
|
7391
|
+
getShouldAllowMultipleShapes: getShouldAllowMultipleShapes,
|
|
7392
|
+
getActiveDrawMode: getActiveDrawMode
|
|
7075
7393
|
});
|
|
7076
7394
|
|
|
7077
|
-
var _marked$
|
|
7395
|
+
var _marked$1 = /*#__PURE__*/_regeneratorRuntime().mark(drawingSaga);
|
|
7078
7396
|
var registerOrigin = 'drawings saga:registerDrawToolSaga';
|
|
7079
7397
|
function registerDrawToolSaga(_ref) {
|
|
7080
7398
|
var payload = _ref.payload;
|
|
@@ -7153,7 +7471,7 @@ function registerDrawToolSaga(_ref) {
|
|
|
7153
7471
|
function changeDrawToolSaga(_ref2) {
|
|
7154
7472
|
var payload = _ref2.payload;
|
|
7155
7473
|
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
7156
|
-
var _a, _b, _c,
|
|
7474
|
+
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
7475
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7158
7476
|
while (1) switch (_context2.prev = _context2.next) {
|
|
7159
7477
|
case 0:
|
|
@@ -7169,7 +7487,7 @@ function changeDrawToolSaga(_ref2) {
|
|
|
7169
7487
|
case 8:
|
|
7170
7488
|
newDrawMode = _context2.sent;
|
|
7171
7489
|
if (!(!newDrawMode || !drawingTool.activeDrawModeId && newDrawMode.isSelectable)) {
|
|
7172
|
-
_context2.next =
|
|
7490
|
+
_context2.next = 24;
|
|
7173
7491
|
break;
|
|
7174
7492
|
}
|
|
7175
7493
|
_context2.next = 12;
|
|
@@ -7179,90 +7497,118 @@ function changeDrawToolSaga(_ref2) {
|
|
|
7179
7497
|
drawMode: ''
|
|
7180
7498
|
}));
|
|
7181
7499
|
case 12:
|
|
7500
|
+
_context2.next = 14;
|
|
7501
|
+
return select(getLayerById, drawingTool.geoJSONLayerId);
|
|
7502
|
+
case 14:
|
|
7503
|
+
geoJSONLayer = _context2.sent;
|
|
7504
|
+
geoJSON = geoJSONLayer === null || geoJSONLayer === void 0 ? void 0 : geoJSONLayer.geojson;
|
|
7505
|
+
lastFeatureIndex = geoJSON !== undefined ? getLastEmptyFeatureIndex(geoJSON) : undefined;
|
|
7506
|
+
if (!(lastFeatureIndex !== undefined)) {
|
|
7507
|
+
_context2.next = 23;
|
|
7508
|
+
break;
|
|
7509
|
+
}
|
|
7510
|
+
newGeoJSON = Object.assign(Object.assign({}, geoJSON), {
|
|
7511
|
+
features: geoJSON.features.filter(function (_feature, index) {
|
|
7512
|
+
return index !== lastFeatureIndex;
|
|
7513
|
+
})
|
|
7514
|
+
});
|
|
7515
|
+
_context2.next = 21;
|
|
7516
|
+
return put(layerActions.updateFeature({
|
|
7517
|
+
layerId: drawingTool.geoJSONLayerId,
|
|
7518
|
+
geojson: newGeoJSON
|
|
7519
|
+
}));
|
|
7520
|
+
case 21:
|
|
7521
|
+
_context2.next = 23;
|
|
7522
|
+
return put(layerActions.setSelectedFeature({
|
|
7523
|
+
layerId: drawingTool.geoJSONLayerId,
|
|
7524
|
+
selectedFeatureIndex: newGeoJSON.features.length > 0 ? newGeoJSON.features.length - 1 : 0
|
|
7525
|
+
}));
|
|
7526
|
+
case 23:
|
|
7182
7527
|
return _context2.abrupt("return");
|
|
7183
|
-
case
|
|
7528
|
+
case 24:
|
|
7184
7529
|
if (!(newDrawMode.value === 'DELETE')) {
|
|
7185
|
-
_context2.next =
|
|
7530
|
+
_context2.next = 33;
|
|
7186
7531
|
break;
|
|
7187
7532
|
}
|
|
7188
|
-
_context2.next =
|
|
7533
|
+
_context2.next = 27;
|
|
7189
7534
|
return put(layerActions.layerChangeGeojson({
|
|
7190
7535
|
layerId: drawingTool.geoJSONLayerId,
|
|
7191
7536
|
geojson: emptyGeoJSON
|
|
7192
7537
|
}));
|
|
7193
|
-
case
|
|
7538
|
+
case 27:
|
|
7194
7539
|
if (!geoJSONIntersectionLayerId) {
|
|
7195
|
-
_context2.next =
|
|
7540
|
+
_context2.next = 30;
|
|
7196
7541
|
break;
|
|
7197
7542
|
}
|
|
7198
|
-
_context2.next =
|
|
7543
|
+
_context2.next = 30;
|
|
7199
7544
|
return put(layerActions.layerChangeGeojson({
|
|
7200
7545
|
layerId: geoJSONIntersectionLayerId,
|
|
7201
7546
|
geojson: emptyGeoJSON
|
|
7202
7547
|
}));
|
|
7203
|
-
case
|
|
7204
|
-
_context2.next =
|
|
7548
|
+
case 30:
|
|
7549
|
+
_context2.next = 32;
|
|
7205
7550
|
return put(layerActions.toggleFeatureMode({
|
|
7206
7551
|
layerId: drawingTool.geoJSONLayerId,
|
|
7207
7552
|
isInEditMode: false,
|
|
7208
7553
|
drawMode: ''
|
|
7209
7554
|
}));
|
|
7210
|
-
case
|
|
7555
|
+
case 32:
|
|
7211
7556
|
return _context2.abrupt("return");
|
|
7212
|
-
case
|
|
7213
|
-
_context2.next =
|
|
7557
|
+
case 33:
|
|
7558
|
+
_context2.next = 35;
|
|
7214
7559
|
return select(getLayerById, drawingTool.geoJSONLayerId);
|
|
7215
|
-
case
|
|
7560
|
+
case 35:
|
|
7216
7561
|
currentGeoJSONLayer = _context2.sent;
|
|
7217
7562
|
_ref3 = currentGeoJSONLayer || {}, currentGeoJSON = _ref3.geojson, _ref3$selectedFeature = _ref3.selectedFeatureIndex, selectedFeatureIndex = _ref3$selectedFeature === void 0 ? 0 : _ref3$selectedFeature;
|
|
7218
7563
|
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 =
|
|
7564
|
+
newSelectionType = newDrawMode.selectionType;
|
|
7220
7565
|
isNewToolSelected = currentSelectionType !== newSelectionType;
|
|
7221
|
-
shouldUpdateNewShape = !((
|
|
7566
|
+
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
7567
|
if (!(shouldUpdateNewShape && shouldUpdateShape)) {
|
|
7223
|
-
_context2.next =
|
|
7568
|
+
_context2.next = 50;
|
|
7224
7569
|
break;
|
|
7225
7570
|
}
|
|
7226
|
-
|
|
7227
|
-
|
|
7571
|
+
shapeWithSelectionType = addSelectionTypeToGeoJSON(newDrawMode.shape, newDrawMode.selectionType);
|
|
7572
|
+
geoJSONFeatureCollection = getFeatureCollection(shapeWithSelectionType, shouldAllowMultipleShapes, currentGeoJSON);
|
|
7573
|
+
_newGeoJSON = getGeoJson(geoJSONFeatureCollection, shouldAllowMultipleShapes);
|
|
7228
7574
|
if (shouldAllowMultipleShapes) {
|
|
7229
|
-
moveFeature(currentGeoJSON,
|
|
7575
|
+
moveFeature(currentGeoJSON, _newGeoJSON, selectedFeatureIndex, '');
|
|
7230
7576
|
}
|
|
7231
|
-
_context2.next =
|
|
7577
|
+
_context2.next = 48;
|
|
7232
7578
|
return put(layerActions.setSelectedFeature({
|
|
7233
7579
|
layerId: drawingTool.geoJSONLayerId,
|
|
7234
|
-
selectedFeatureIndex:
|
|
7580
|
+
selectedFeatureIndex: _newGeoJSON.features.length - 1
|
|
7235
7581
|
}));
|
|
7236
|
-
case
|
|
7237
|
-
_context2.next =
|
|
7582
|
+
case 48:
|
|
7583
|
+
_context2.next = 50;
|
|
7238
7584
|
return put(layerActions.updateFeature(Object.assign(Object.assign({
|
|
7239
7585
|
layerId: drawingTool.geoJSONLayerId,
|
|
7240
|
-
geojson:
|
|
7586
|
+
geojson: _newGeoJSON
|
|
7241
7587
|
}, geoJSONIntersectionLayerId && {
|
|
7242
7588
|
geoJSONIntersectionLayerId: geoJSONIntersectionLayerId
|
|
7243
7589
|
}), geoJSONIntersectionBoundsLayerId && {
|
|
7244
7590
|
geoJSONIntersectionBoundsLayerId: geoJSONIntersectionBoundsLayerId
|
|
7245
7591
|
})));
|
|
7246
|
-
case
|
|
7247
|
-
_context2.next =
|
|
7592
|
+
case 50:
|
|
7593
|
+
_context2.next = 52;
|
|
7248
7594
|
return put(layerActions.toggleFeatureMode({
|
|
7249
7595
|
layerId: drawingTool.geoJSONLayerId,
|
|
7250
7596
|
isInEditMode: newDrawMode.isSelectable,
|
|
7251
7597
|
drawMode: newDrawMode.value
|
|
7252
7598
|
}));
|
|
7253
|
-
case
|
|
7254
|
-
_context2.next =
|
|
7599
|
+
case 52:
|
|
7600
|
+
_context2.next = 57;
|
|
7255
7601
|
break;
|
|
7256
|
-
case
|
|
7257
|
-
_context2.prev =
|
|
7602
|
+
case 54:
|
|
7603
|
+
_context2.prev = 54;
|
|
7258
7604
|
_context2.t0 = _context2["catch"](0);
|
|
7259
7605
|
// eslint-disable-next-line no-console
|
|
7260
7606
|
console.log('error changeDrawToolSaga', _context2.t0);
|
|
7261
|
-
case
|
|
7607
|
+
case 57:
|
|
7262
7608
|
case "end":
|
|
7263
7609
|
return _context2.stop();
|
|
7264
7610
|
}
|
|
7265
|
-
}, _callee2, null, [[0,
|
|
7611
|
+
}, _callee2, null, [[0, 54]]);
|
|
7266
7612
|
})();
|
|
7267
7613
|
}
|
|
7268
7614
|
function changeIntersectionSaga(_ref4) {
|
|
@@ -7317,7 +7663,7 @@ function drawingSaga() {
|
|
|
7317
7663
|
case "end":
|
|
7318
7664
|
return _context4.stop();
|
|
7319
7665
|
}
|
|
7320
|
-
}, _marked$
|
|
7666
|
+
}, _marked$1);
|
|
7321
7667
|
}
|
|
7322
7668
|
|
|
7323
7669
|
/* *
|
|
@@ -7386,17 +7732,26 @@ var createMultipleLayersState = function createMultipleLayersState(layers, mapId
|
|
|
7386
7732
|
byId: {}
|
|
7387
7733
|
}
|
|
7388
7734
|
};
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
mockState.
|
|
7735
|
+
var _iterator = _createForOfIteratorHelper(layers),
|
|
7736
|
+
_step;
|
|
7737
|
+
try {
|
|
7738
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
7739
|
+
var layer = _step.value;
|
|
7740
|
+
var layerState = createLayer(Object.assign(Object.assign({}, layer), {
|
|
7741
|
+
id: layer.id,
|
|
7742
|
+
mapId: mapId
|
|
7743
|
+
}));
|
|
7744
|
+
mockState.byId[layer.id] = Object.assign({}, layerState);
|
|
7745
|
+
mockState.allIds.push(layer.id);
|
|
7746
|
+
if (layer.layerType === LayerType.baseLayer) {
|
|
7747
|
+
mockState.availableBaseLayers.byId[layer.id] = Object.assign({}, layerState);
|
|
7748
|
+
mockState.availableBaseLayers.allIds.push(layer.id);
|
|
7749
|
+
}
|
|
7399
7750
|
}
|
|
7751
|
+
} catch (err) {
|
|
7752
|
+
_iterator.e(err);
|
|
7753
|
+
} finally {
|
|
7754
|
+
_iterator.f();
|
|
7400
7755
|
}
|
|
7401
7756
|
return mockState;
|
|
7402
7757
|
};
|
|
@@ -7408,12 +7763,13 @@ var createWebmapState = function createWebmapState() {
|
|
|
7408
7763
|
for (var _len = arguments.length, mapIds = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
7409
7764
|
mapIds[_key] = arguments[_key];
|
|
7410
7765
|
}
|
|
7411
|
-
for (var
|
|
7766
|
+
for (var _i = 0, _mapIds = mapIds; _i < _mapIds.length; _i++) {
|
|
7767
|
+
var mapId = _mapIds[_i];
|
|
7412
7768
|
var mapState = createMap({
|
|
7413
|
-
id:
|
|
7769
|
+
id: mapId
|
|
7414
7770
|
});
|
|
7415
|
-
mockState.byId[
|
|
7416
|
-
mockState.allIds.push(
|
|
7771
|
+
mockState.byId[mapId] = Object.assign({}, mapState);
|
|
7772
|
+
mockState.allIds.push(mapId);
|
|
7417
7773
|
}
|
|
7418
7774
|
return mockState;
|
|
7419
7775
|
};
|
|
@@ -7425,13 +7781,14 @@ var createMapDimensionsState = function createMapDimensionsState(dimensions) {
|
|
|
7425
7781
|
for (var _len2 = arguments.length, mapIds = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
7426
7782
|
mapIds[_key2 - 1] = arguments[_key2];
|
|
7427
7783
|
}
|
|
7428
|
-
for (var
|
|
7784
|
+
for (var _i2 = 0, _mapIds2 = mapIds; _i2 < _mapIds2.length; _i2++) {
|
|
7785
|
+
var mapId = _mapIds2[_i2];
|
|
7429
7786
|
var mapState = createMap({
|
|
7430
|
-
id:
|
|
7787
|
+
id: mapId
|
|
7431
7788
|
});
|
|
7432
|
-
mockState.byId[
|
|
7433
|
-
mockState.byId[
|
|
7434
|
-
mockState.allIds.push(
|
|
7789
|
+
mockState.byId[mapId] = Object.assign({}, mapState);
|
|
7790
|
+
mockState.byId[mapId].dimensions = dimensions;
|
|
7791
|
+
mockState.allIds.push(mapId);
|
|
7435
7792
|
}
|
|
7436
7793
|
return mockState;
|
|
7437
7794
|
};
|
|
@@ -7650,9 +8007,9 @@ var storeTestUtils = /*#__PURE__*/Object.freeze({
|
|
|
7650
8007
|
mockStateMapWithTimeStepWithoutLayers: mockStateMapWithTimeStepWithoutLayers
|
|
7651
8008
|
});
|
|
7652
8009
|
|
|
7653
|
-
var _marked
|
|
7654
|
-
_marked2
|
|
7655
|
-
_marked3
|
|
8010
|
+
var _marked = /*#__PURE__*/_regeneratorRuntime().mark(updateSourceValueWhenLinkingComponentToGroupSaga),
|
|
8011
|
+
_marked2 = /*#__PURE__*/_regeneratorRuntime().mark(updateViewStateSaga),
|
|
8012
|
+
_marked3 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga);
|
|
7656
8013
|
function updateSourceValueWhenLinkingComponentToGroupSaga(groupId, targetToUpdate) {
|
|
7657
8014
|
var group;
|
|
7658
8015
|
return _regeneratorRuntime().wrap(function updateSourceValueWhenLinkingComponentToGroupSaga$(_context) {
|
|
@@ -7704,7 +8061,7 @@ function updateSourceValueWhenLinkingComponentToGroupSaga(groupId, targetToUpdat
|
|
|
7704
8061
|
case "end":
|
|
7705
8062
|
return _context.stop();
|
|
7706
8063
|
}
|
|
7707
|
-
}, _marked
|
|
8064
|
+
}, _marked);
|
|
7708
8065
|
}
|
|
7709
8066
|
function addGroupTargetSaga(_ref) {
|
|
7710
8067
|
var payload = _ref.payload;
|
|
@@ -7765,9 +8122,9 @@ function updateViewStateSaga() {
|
|
|
7765
8122
|
case "end":
|
|
7766
8123
|
return _context4.stop();
|
|
7767
8124
|
}
|
|
7768
|
-
}, _marked2
|
|
8125
|
+
}, _marked2);
|
|
7769
8126
|
}
|
|
7770
|
-
function rootSaga
|
|
8127
|
+
function rootSaga() {
|
|
7771
8128
|
return _regeneratorRuntime().wrap(function rootSaga$(_context5) {
|
|
7772
8129
|
while (1) switch (_context5.prev = _context5.next) {
|
|
7773
8130
|
case 0:
|
|
@@ -7801,7 +8158,7 @@ function rootSaga$1() {
|
|
|
7801
8158
|
case "end":
|
|
7802
8159
|
return _context5.stop();
|
|
7803
8160
|
}
|
|
7804
|
-
}, _marked3
|
|
8161
|
+
}, _marked3);
|
|
7805
8162
|
}
|
|
7806
8163
|
|
|
7807
8164
|
var synchronizationGroupConfig = {
|
|
@@ -7809,99 +8166,67 @@ var synchronizationGroupConfig = {
|
|
|
7809
8166
|
reducersMap: {
|
|
7810
8167
|
syncronizationGroupStore: reducer$4
|
|
7811
8168
|
},
|
|
7812
|
-
sagas: [rootSaga$
|
|
8169
|
+
sagas: [rootSaga$2, rootSaga]
|
|
7813
8170
|
};
|
|
7814
8171
|
|
|
7815
|
-
var
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
function
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
type: 'legend',
|
|
7838
|
-
mapId: fields[0],
|
|
7839
|
-
setOpen: true,
|
|
7840
|
-
source: source
|
|
7841
|
-
}));
|
|
7842
|
-
case 9:
|
|
7843
|
-
case "end":
|
|
7844
|
-
return _context.stop();
|
|
7845
|
-
}
|
|
7846
|
-
}, _marked);
|
|
7847
|
-
}
|
|
7848
|
-
function unregisterUIMapSaga() {
|
|
7849
|
-
var fields, activeUI;
|
|
7850
|
-
return _regeneratorRuntime().wrap(function unregisterUIMapSaga$(_context2) {
|
|
7851
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
7852
|
-
case 0:
|
|
7853
|
-
_context2.next = 2;
|
|
7854
|
-
return select(getAllMapIds);
|
|
7855
|
-
case 2:
|
|
7856
|
-
fields = _context2.sent;
|
|
7857
|
-
_context2.next = 5;
|
|
7858
|
-
return select(getDialogDetailsByType, 'legend');
|
|
7859
|
-
case 5:
|
|
7860
|
-
activeUI = _context2.sent;
|
|
7861
|
-
if (!(fields.length && activeUI && !fields.includes(activeUI.activeMapId))) {
|
|
7862
|
-
_context2.next = 11;
|
|
7863
|
-
break;
|
|
8172
|
+
var uiListener = createListenerMiddleware();
|
|
8173
|
+
uiListener.startListening({
|
|
8174
|
+
actionCreator: mapActions.registerMap,
|
|
8175
|
+
effect: function effect(_, listenerApi) {
|
|
8176
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8177
|
+
var fields, source;
|
|
8178
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8179
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8180
|
+
case 0:
|
|
8181
|
+
fields = getAllMapIds(listenerApi.getState());
|
|
8182
|
+
if (fields.length === 1) {
|
|
8183
|
+
source = getDialogSource(listenerApi.getState(), 'legend');
|
|
8184
|
+
listenerApi.dispatch(uiActions.setActiveMapIdForDialog({
|
|
8185
|
+
type: 'legend',
|
|
8186
|
+
mapId: fields[0],
|
|
8187
|
+
setOpen: true,
|
|
8188
|
+
source: source
|
|
8189
|
+
}));
|
|
8190
|
+
}
|
|
8191
|
+
case 2:
|
|
8192
|
+
case "end":
|
|
8193
|
+
return _context.stop();
|
|
7864
8194
|
}
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
8195
|
+
}, _callee);
|
|
8196
|
+
}));
|
|
8197
|
+
}
|
|
8198
|
+
});
|
|
8199
|
+
uiListener.startListening({
|
|
8200
|
+
actionCreator: mapActions.unregisterMap,
|
|
8201
|
+
effect: function effect(_, listenerApi) {
|
|
8202
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
8203
|
+
var fields, activeUI;
|
|
8204
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8205
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
8206
|
+
case 0:
|
|
8207
|
+
fields = getAllMapIds(listenerApi.getState());
|
|
8208
|
+
activeUI = getDialogDetailsByType(listenerApi.getState(), 'legend');
|
|
8209
|
+
if (fields.length && activeUI && !fields.includes(activeUI.activeMapId)) {
|
|
8210
|
+
listenerApi.dispatch(uiActions.setActiveMapIdForDialog({
|
|
8211
|
+
type: 'legend',
|
|
8212
|
+
mapId: fields[0],
|
|
8213
|
+
setOpen: activeUI.isOpen
|
|
8214
|
+
}));
|
|
8215
|
+
} else if (!fields.length) {
|
|
8216
|
+
// if no more maps, we hide the legend
|
|
8217
|
+
listenerApi.dispatch(uiActions.setToggleOpenDialog({
|
|
8218
|
+
type: 'legend',
|
|
8219
|
+
setOpen: false
|
|
8220
|
+
}));
|
|
8221
|
+
}
|
|
8222
|
+
case 3:
|
|
8223
|
+
case "end":
|
|
8224
|
+
return _context2.stop();
|
|
7878
8225
|
}
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
}));
|
|
7884
|
-
case 14:
|
|
7885
|
-
case "end":
|
|
7886
|
-
return _context2.stop();
|
|
7887
|
-
}
|
|
7888
|
-
}, _marked2);
|
|
7889
|
-
}
|
|
7890
|
-
function rootSaga() {
|
|
7891
|
-
return _regeneratorRuntime().wrap(function rootSaga$(_context3) {
|
|
7892
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
7893
|
-
case 0:
|
|
7894
|
-
_context3.next = 2;
|
|
7895
|
-
return takeLatest(mapActions.registerMap.type, registerMapUISaga);
|
|
7896
|
-
case 2:
|
|
7897
|
-
_context3.next = 4;
|
|
7898
|
-
return takeLatest(mapActions.unregisterMap.type, unregisterUIMapSaga);
|
|
7899
|
-
case 4:
|
|
7900
|
-
case "end":
|
|
7901
|
-
return _context3.stop();
|
|
7902
|
-
}
|
|
7903
|
-
}, _marked3);
|
|
7904
|
-
}
|
|
8226
|
+
}, _callee2);
|
|
8227
|
+
}));
|
|
8228
|
+
}
|
|
8229
|
+
});
|
|
7905
8230
|
|
|
7906
8231
|
/* *
|
|
7907
8232
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -7924,7 +8249,7 @@ var uiModuleConfig = {
|
|
|
7924
8249
|
reducersMap: {
|
|
7925
8250
|
ui: reducer$6
|
|
7926
8251
|
},
|
|
7927
|
-
|
|
8252
|
+
middlewares: [uiListener.middleware]
|
|
7928
8253
|
};
|
|
7929
8254
|
|
|
7930
8255
|
/* *
|
|
@@ -7966,12 +8291,9 @@ var createStore = function createStore() {
|
|
|
7966
8291
|
extensions: [getSagaExtension({})]
|
|
7967
8292
|
});
|
|
7968
8293
|
};
|
|
7969
|
-
var
|
|
7970
|
-
var
|
|
7971
|
-
|
|
7972
|
-
return /*#__PURE__*/React.createElement(ThemeWrapper, {
|
|
7973
|
-
theme: theme
|
|
7974
|
-
}, children, " ");
|
|
8294
|
+
var WrapperWithModules = withEggs(coreModuleConfig)(function (_ref) {
|
|
8295
|
+
var children = _ref.children;
|
|
8296
|
+
return children;
|
|
7975
8297
|
});
|
|
7976
8298
|
/**
|
|
7977
8299
|
* A Provider component which provides the GeoWeb theme and store for the core.
|
|
@@ -7979,16 +8301,12 @@ var ThemeWrapperWithModules = withEggs(coreModuleConfig)(function (_ref) {
|
|
|
7979
8301
|
* @param children
|
|
7980
8302
|
* @returns
|
|
7981
8303
|
*/
|
|
7982
|
-
var
|
|
8304
|
+
var StoreProvider = function StoreProvider(_ref2) {
|
|
7983
8305
|
var children = _ref2.children,
|
|
7984
|
-
_ref2$theme = _ref2.theme,
|
|
7985
|
-
theme = _ref2$theme === void 0 ? lightTheme : _ref2$theme,
|
|
7986
8306
|
store = _ref2.store;
|
|
7987
8307
|
return /*#__PURE__*/React.createElement(Provider, {
|
|
7988
8308
|
store: store
|
|
7989
|
-
}, /*#__PURE__*/React.createElement(
|
|
7990
|
-
theme: theme
|
|
7991
|
-
}, children));
|
|
8309
|
+
}, /*#__PURE__*/React.createElement(WrapperWithModules, null, children));
|
|
7992
8310
|
};
|
|
7993
8311
|
|
|
7994
8312
|
/* *
|
|
@@ -8092,4 +8410,4 @@ var useSetupDialog = function useSetupDialog(dialogType) {
|
|
|
8092
8410
|
};
|
|
8093
8411
|
};
|
|
8094
8412
|
|
|
8095
|
-
export {
|
|
8413
|
+
export { StoreProvider, appActions, appModuleConfig, coreModuleConfig, createStore, drawtoolActions, drawtoolModuleConfig, reducer as drawtoolReducer, selectors as drawtoolSelectors, filterLayers$1 as filterLayers, genericActions, rootSaga$2 as genericSaga, selectors$3 as genericSelectors, types$1 as genericTypes, getSingularDrawtoolDrawLayerId, initialState$4 as initialState, layerActions, reducer$7 as layerReducer, selectors$6 as layerSelectors, types$5 as layerTypes, utils$2 as layerUtils, mapActions, constants$1 as mapConstants, enums as mapEnums, rootSaga$4 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, storeTestSettings, storeTestUtils, utils$1 as storeUtils, constants as syncConstants, actions as syncGroupsActions, reducer$4 as syncGroupsReducer, selector as syncGroupsSelector, selectors$4 as syncGroupsSelectors, types$2 as syncGroupsTypes, types$2 as types, uiActions, uiModuleConfig, reducer$6 as uiReducer, selectors$5 as uiSelectors, types$3 as uiTypes, useSetupDialog, reducer$5 as webmapReducer };
|