qwc2 2025.10.9 → 2025.10.14
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/actions/display.js +30 -1
- package/actions/editing.js +22 -1
- package/actions/layerinfo.js +13 -1
- package/actions/layers.js +213 -3
- package/actions/localConfig.js +58 -1
- package/actions/locale.js +21 -1
- package/actions/locate.js +26 -1
- package/actions/logging.js +10 -1
- package/actions/map.js +105 -2
- package/actions/measurement.js +12 -1
- package/actions/processNotifications.js +37 -1
- package/actions/redlining.js +18 -1
- package/actions/redliningPick.js +12 -1
- package/actions/search.js +12 -1
- package/actions/serviceinfo.js +12 -1
- package/actions/task.js +55 -3
- package/actions/theme.js +339 -19
- package/actions/windows.js +164 -5
- package/components/AppMenu.js +435 -3
- package/components/AttributeForm.js +928 -32
- package/components/AttributeTableWidget.js +1105 -13
- package/components/AutoEditForm.js +189 -3
- package/components/CoordinateDisplayer.js +78 -2
- package/components/EditComboField.js +190 -6
- package/components/EditUploadField.js +315 -3
- package/components/ExportSelection.js +203 -2
- package/components/FullscreenSwitcher.js +90 -3
- package/components/Icon.js +81 -2
- package/components/IdentifyViewer.js +1161 -6
- package/components/ImportLayer.js +718 -20
- package/components/LayerInfoWindow.js +145 -2
- package/components/LinkFeatureForm.js +246 -5
- package/components/MapButton.js +88 -2
- package/components/MapSelection.js +287 -8
- package/components/MessageBar.js +68 -2
- package/components/NumericInputWindow.js +359 -2
- package/components/PickFeature.js +266 -2
- package/components/PluginsContainer.js +227 -8
- package/components/PrintSelection.js +620 -49
- package/components/ProcessNotifications.js +104 -2
- package/components/QtDesignerForm.js +1137 -18
- package/components/ResizeableWindow.js +591 -8
- package/components/SearchBox.js +1307 -20
- package/components/ServiceInfoWindow.js +107 -2
- package/components/SideBar.js +204 -4
- package/components/StandardApp.js +381 -20
- package/components/Swipeable.js +15 -1
- package/components/TaskBar.js +85 -2
- package/components/ThemeLayersListWindow.js +216 -4
- package/components/ThemeList.js +381 -7
- package/components/Toolbar.js +106 -2
- package/components/WindowManager.js +178 -2
- package/components/map/OlLayer.js +257 -6
- package/components/map/OlMap.js +405 -5
- package/components/map/layers/BingLayer.js +31 -2
- package/components/map/layers/GoogleLayer.js +222 -19
- package/components/map/layers/GraticuleLayer.js +21 -1
- package/components/map/layers/ImageLayer.js +15 -1
- package/components/map/layers/MVTLayer.js +52 -2
- package/components/map/layers/OSMLayer.js +24 -2
- package/components/map/layers/OverlayLayer.js +55 -3
- package/components/map/layers/VectorLayer.js +173 -8
- package/components/map/layers/WFSLayer.js +220 -6
- package/components/map/layers/WMSLayer.js +180 -6
- package/components/map/layers/WMTSLayer.js +67 -3
- package/components/map/layers/XYZLayer.js +24 -2
- package/components/map/layers/index.js +28 -1
- package/components/map3d/EditDataset3D.js +190 -3
- package/components/map3d/HeightProfile3D.js +402 -3
- package/components/map3d/ImportObjects3D.js +162 -2
- package/components/map3d/Map3D.js +1304 -38
- package/components/map3d/MapControls3D.js +392 -7
- package/components/map3d/SearchField3D.js +183 -11
- package/components/map3d/View3DSwitcher.js +98 -2
- package/components/map3d/drawtool/CreateTool3D.js +174 -4
- package/components/map3d/drawtool/EditTool3D.js +590 -6
- package/components/map3d/drawtool/NumericInput3D.js +336 -4
- package/components/map3d/layers/GeoTIFFLayer3D.js +15 -1
- package/components/map3d/layers/VectorLayer3D.js +53 -2
- package/components/map3d/layers/WFSLayer3D.js +109 -3
- package/components/map3d/layers/WMSLayer3D.js +70 -2
- package/components/map3d/layers/WMTSLayer3D.js +27 -3
- package/components/map3d/layers/index.js +14 -1
- package/components/map3d/utils/FirstPersonControls3D.js +423 -16
- package/components/map3d/utils/MiscUtils3D.js +221 -13
- package/components/map3d/utils/OrbitControls3D.js +176 -5
- package/components/map3d/utils/Tiles3DStyle.js +238 -9
- package/components/share/ShareLink.js +54 -2
- package/components/share/ShareQRCode.js +62 -2
- package/components/share/ShareSocials.js +125 -3
- package/components/timeline/FixedTimeline.js +236 -5
- package/components/timeline/InfiniteTimeline.js +347 -8
- package/components/timeline/TimelineFeaturesSlider.js +439 -5
- package/components/widgets/AccordeonWidget.js +96 -2
- package/components/widgets/ButtonBar.js +124 -2
- package/components/widgets/ColorButton.js +201 -3
- package/components/widgets/ComboBox.js +166 -2
- package/components/widgets/CopyButton.js +110 -2
- package/components/widgets/DateTimeInput.js +100 -3
- package/components/widgets/EditableSelect.js +230 -3
- package/components/widgets/FileSelector.js +128 -4
- package/components/widgets/Input.js +124 -2
- package/components/widgets/InputContainer.js +96 -2
- package/components/widgets/LayerCatalogWidget.js +219 -3
- package/components/widgets/MenuButton.js +157 -1
- package/components/widgets/ModalDialog.js +64 -2
- package/components/widgets/NavBar.js +119 -2
- package/components/widgets/NumberInput.js +226 -4
- package/components/widgets/PopupMenu.js +72 -1
- package/components/widgets/Primitives.js +6 -1
- package/components/widgets/ReCaptchaWidget.js +55 -1
- package/components/widgets/SearchWidget.js +255 -2
- package/components/widgets/Spinner.js +44 -2
- package/components/widgets/SuggestionInput.js +77 -2
- package/components/widgets/TextInput.js +308 -2
- package/components/widgets/ToggleSwitch.js +85 -2
- package/components/widgets/VectorLayerPicker.js +85 -3
- package/libs/openlayers.js +225 -5
- package/package.json +1 -1
- package/plugins/API.js +358 -15
- package/plugins/AttributeTable.js +109 -3
- package/plugins/Authentication.js +130 -5
- package/plugins/BackgroundSwitcher.js +218 -4
- package/plugins/Bookmark.js +289 -3
- package/plugins/BottomBar.js +298 -4
- package/plugins/CookiePopup.js +67 -3
- package/plugins/Cyclomedia.js +442 -5
- package/plugins/Editing.js +497 -9
- package/plugins/FeatureForm.js +366 -4
- package/plugins/FeatureSearch.js +458 -3
- package/plugins/GeometryDigitizer.js +664 -7
- package/plugins/HeightProfile.js +763 -15
- package/plugins/Help.js +102 -3
- package/plugins/HomeButton.js +80 -3
- package/plugins/Identify.js +543 -5
- package/plugins/LayerCatalog.js +215 -4
- package/plugins/LayerTree.js +1194 -6
- package/plugins/LocateButton.js +94 -3
- package/plugins/Map.js +320 -16
- package/plugins/MapCompare.js +94 -3
- package/plugins/MapCopyright.js +127 -5
- package/plugins/MapExport.js +613 -20
- package/plugins/MapFilter.js +868 -12
- package/plugins/MapInfoTooltip.js +277 -3
- package/plugins/MapLegend.js +253 -4
- package/plugins/MapTip.js +290 -4
- package/plugins/Measure.js +220 -4
- package/plugins/NewsPopup.js +137 -3
- package/plugins/OverviewMap.js +167 -7
- package/plugins/Panoramax.js +340 -2
- package/plugins/Portal.js +199 -4
- package/plugins/Print.js +1231 -15
- package/plugins/Redlining.js +750 -6
- package/plugins/Reports.js +332 -3
- package/plugins/Routing.js +1278 -15
- package/plugins/ScratchDrawing.js +173 -5
- package/plugins/Settings.js +241 -4
- package/plugins/Share.js +198 -3
- package/plugins/StartupMarker.js +84 -4
- package/plugins/TaskButton.js +88 -3
- package/plugins/ThemeSwitcher.js +164 -4
- package/plugins/TimeManager.js +971 -10
- package/plugins/TopBar.js +300 -7
- package/plugins/TourGuide.js +213 -2
- package/plugins/ValueTool.js +419 -4
- package/plugins/View3D.js +519 -14
- package/plugins/ZoomButtons.js +165 -3
- package/plugins/map/EditingSupport.js +199 -7
- package/plugins/map/LocateSupport.js +260 -4
- package/plugins/map/MeasurementSupport.js +216 -8
- package/plugins/map/RedliningPickSupport.js +201 -7
- package/plugins/map/RedliningSupport.js +726 -17
- package/plugins/map/SnapInteraction.js +101 -1
- package/plugins/map/SnapSupport.js +210 -2
- package/plugins/map/SnappingSupport.js +356 -17
- package/plugins/map3d/BackgroundSwitcher3D.js +44 -3
- package/plugins/map3d/BottomBar3D.js +118 -3
- package/plugins/map3d/Compare3D.js +422 -8
- package/plugins/map3d/Draw3D.js +353 -6
- package/plugins/map3d/ExportObjects3D.js +393 -18
- package/plugins/map3d/HideObjects3D.js +313 -12
- package/plugins/map3d/Identify3D.js +283 -12
- package/plugins/map3d/LayerTree3D.js +323 -3
- package/plugins/map3d/MapCopyright3D.js +128 -5
- package/plugins/map3d/MapExport3D.js +590 -10
- package/plugins/map3d/MapLight3D.js +553 -6
- package/plugins/map3d/Measure3D.js +571 -20
- package/plugins/map3d/OverviewMap3D.js +169 -3
- package/plugins/map3d/Settings3D.js +73 -3
- package/plugins/map3d/TopBar3D.js +207 -9
- package/plugins/redlining/RedliningBufferSupport.js +206 -3
- package/reducers/display.js +34 -2
- package/reducers/editing.js +68 -3
- package/reducers/index.js +9 -1
- package/reducers/layerinfo.js +26 -2
- package/reducers/layers.js +456 -9
- package/reducers/localConfig.js +122 -2
- package/reducers/locale.js +38 -2
- package/reducers/locate.js +40 -2
- package/reducers/map.js +176 -5
- package/reducers/measurement.js +42 -2
- package/reducers/processNotifications.js +49 -2
- package/reducers/redlining.js +50 -2
- package/reducers/redliningPick.js +27 -2
- package/reducers/search.js +20 -1
- package/reducers/serviceinfo.js +25 -2
- package/reducers/task.js +45 -2
- package/reducers/theme.js +51 -2
- package/reducers/windows.js +203 -2
- package/scripts/dist.sh +1 -1
- package/scripts/gen-plugin-docs.js +152 -2
- package/scripts/makeIconkit.js +85 -6
- package/scripts/themesConfig.js +742 -40
- package/scripts/updateTranslations.js +251 -10
- package/selectors/searchproviders.js +44 -2
- package/stores/StandardStore.js +42 -2
- package/utils/ConfigUtils.js +84 -3
- package/utils/CoordinatesUtils.js +234 -23
- package/utils/DxfUtils.js +237 -11
- package/utils/EditingInterface.js +421 -87
- package/utils/EditingUtils.js +357 -13
- package/utils/ElevationInterface.js +83 -22
- package/utils/FeatureStyles.js +429 -5
- package/utils/IdentifyUtils.js +443 -7
- package/utils/ImageEditor.js +79 -9
- package/utils/LayerUtils.js +1516 -50
- package/utils/LocaleUtils.js +117 -7
- package/utils/MapUtils.js +241 -59
- package/utils/MeasureUtils.js +323 -2
- package/utils/MiscUtils.js +189 -11
- package/utils/PermaLinkUtils.js +429 -6
- package/utils/PluginStore.js +27 -1
- package/utils/ResourceRegistry.js +15 -1
- package/utils/RoutingInterface.js +307 -7
- package/utils/SearchProviders.js +722 -19
- package/utils/ServiceLayerUtils.js +669 -14
- package/utils/Signal.js +32 -2
- package/utils/ThemeUtils.js +341 -7
- package/utils/VectorLayerUtils.js +589 -15
- package/utils/expr_grammar/grammar.js +2239 -2
- package/utils/expr_grammar/test.js +65 -3
package/plugins/TimeManager.js
CHANGED
|
@@ -1,21 +1,982 @@
|
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
5
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
13
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
14
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
15
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
16
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
17
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
18
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
22
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
23
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
24
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
25
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
26
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
27
|
+
/**
|
|
2
28
|
* Copyright 2024 Sourcepole AG
|
|
3
29
|
* All rights reserved.
|
|
4
30
|
*
|
|
5
31
|
* This source code is licensed under the BSD-style license found in the
|
|
6
32
|
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
import React from 'react';
|
|
36
|
+
import { connect } from 'react-redux';
|
|
37
|
+
import dateParser, { Format } from 'any-date-parser';
|
|
38
|
+
import dayjs from 'dayjs';
|
|
39
|
+
import utc from 'dayjs/plugin/utc';
|
|
40
|
+
import isEmpty from 'lodash.isempty';
|
|
41
|
+
import isEqual from 'lodash.isequal';
|
|
42
|
+
import ol from 'openlayers';
|
|
43
|
+
import PropTypes from 'prop-types';
|
|
44
|
+
import { createSelector } from 'reselect';
|
|
45
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
46
|
+
import { setLayerDimensions, addLayerFeatures, refreshLayer, removeLayer, LayerRole } from '../actions/layers';
|
|
47
|
+
import { setCurrentTask, setCurrentTaskBlocked } from '../actions/task';
|
|
48
|
+
import Icon from '../components/Icon';
|
|
49
|
+
import ResizeableWindow from '../components/ResizeableWindow';
|
|
50
|
+
import FixedTimeline from '../components/timeline/FixedTimeline';
|
|
51
|
+
import InfiniteTimeline from '../components/timeline/InfiniteTimeline';
|
|
52
|
+
import TimelineFeaturesSlider from '../components/timeline/TimelineFeaturesSlider';
|
|
53
|
+
import ButtonBar from '../components/widgets/ButtonBar';
|
|
54
|
+
import NumberInput from '../components/widgets/NumberInput';
|
|
55
|
+
import ToggleSwitch from '../components/widgets/ToggleSwitch';
|
|
56
|
+
import IdentifyUtils from '../utils/IdentifyUtils';
|
|
57
|
+
import LayerUtils from '../utils/LayerUtils';
|
|
58
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
59
|
+
import VectorLayerUtils from '../utils/VectorLayerUtils';
|
|
60
|
+
import markerIcon from '../utils/img/marker-icon.png';
|
|
61
|
+
import './style/TimeManager.css';
|
|
62
|
+
dayjs.extend(utc);
|
|
63
|
+
var DateUnitLabels = {
|
|
64
|
+
"ms": LocaleUtils.trmsg("timemanager.unit.milliseconds"),
|
|
65
|
+
"s": LocaleUtils.trmsg("timemanager.unit.seconds"),
|
|
66
|
+
"m": LocaleUtils.trmsg("timemanager.unit.minutes"),
|
|
67
|
+
"h": LocaleUtils.trmsg("timemanager.unit.hours"),
|
|
68
|
+
"d": LocaleUtils.trmsg("timemanager.unit.days"),
|
|
69
|
+
"M": LocaleUtils.trmsg("timemanager.unit.months"),
|
|
70
|
+
"y": LocaleUtils.trmsg("timemanager.unit.years"),
|
|
71
|
+
"10y": LocaleUtils.trmsg("timemanager.unit.decade"),
|
|
72
|
+
"100y": LocaleUtils.trmsg("timemanager.unit.century")
|
|
73
|
+
};
|
|
74
|
+
var qgisDateFormat = new Format({
|
|
75
|
+
// $dateExpr $hour $minute $second $millisecond $zone $offset
|
|
76
|
+
matcher: /^(.*?)[\s,-]*([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d|60)(?:[.,](\d{9}|\d{6}|\d{1,3}))?)?[\s,-]*\(?(UTC)?[\s,-]*([+-]0\d?:?(?:[0-5]\d)?)?[\s,-]*\)?$/i,
|
|
77
|
+
// eslint-disable-next-line
|
|
78
|
+
handler: function handler(_ref) {
|
|
79
|
+
var _ref2 = _slicedToArray(_ref, 8),
|
|
80
|
+
match = _ref2[0],
|
|
81
|
+
dateExpr = _ref2[1],
|
|
82
|
+
hour = _ref2[2],
|
|
83
|
+
minute = _ref2[3],
|
|
84
|
+
second = _ref2[4],
|
|
85
|
+
millisecond = _ref2[5],
|
|
86
|
+
zone = _ref2[6],
|
|
87
|
+
offset = _ref2[7];
|
|
88
|
+
var result = {};
|
|
89
|
+
if (dateExpr) {
|
|
90
|
+
result = this.parser.attempt(dateExpr);
|
|
91
|
+
if (result.invalid) {
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
result.hour = hour;
|
|
96
|
+
result.minute = minute;
|
|
97
|
+
if (second) {
|
|
98
|
+
result.second = second;
|
|
99
|
+
}
|
|
100
|
+
if (millisecond && millisecond.length > 3) {
|
|
101
|
+
result.millisecond = millisecond.slice(0, 3);
|
|
102
|
+
} else if (millisecond) {
|
|
103
|
+
result.millisecond = millisecond;
|
|
104
|
+
}
|
|
105
|
+
if (offset) {
|
|
106
|
+
result.offset = offset;
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
dateParser.addFormat(qgisDateFormat);
|
|
112
|
+
|
|
113
|
+
// QGIS server does not return any feature that does not have "enddate" set.
|
|
10
114
|
// To workaround this limitation, a placeholder date is used to make features
|
|
11
115
|
// with no "enddate" visible. This variable represents that placeholder date.
|
|
12
116
|
// This information is needed in the QWC2 so that features with no "enddate"
|
|
13
117
|
// are represented correctly. It is also used to differentiate them from features with
|
|
14
118
|
// a valid "enddate".
|
|
15
|
-
var DUMMY_END_DATE=new Date(
|
|
119
|
+
var DUMMY_END_DATE = new Date('9999-01-01 00:00:00');
|
|
120
|
+
|
|
121
|
+
/**
|
|
16
122
|
* Allows controling the time dimension of temporal WMS layers.
|
|
17
|
-
*/var TimeManager=/*#__PURE__*/function(_React$Component){function TimeManager(props){var _this;_classCallCheck(this,TimeManager);_this=_callSuper(this,TimeManager,[props]);_defineProperty(_this,"renderBody",function(){var timeButtons=[{key:"rewind",tooltip:LocaleUtils.tr("timemanager.rewind"),icon:"nav-start"},{key:"now",tooltip:LocaleUtils.tr("timemanager.now"),icon:"today"},{key:"prev",tooltip:LocaleUtils.tr("timemanager.stepback"),icon:"nav-left"},{key:"playrev",tooltip:LocaleUtils.tr("timemanager.playrev"),icon:"triangle-left",disabled:_this.state.animationActive},{key:"stop",tooltip:LocaleUtils.tr("timemanager.stop"),icon:"square",disabled:!_this.state.animationActive},{key:"play",tooltip:LocaleUtils.tr("timemanager.play"),icon:"triangle-right",disabled:_this.state.animationActive},{key:"next",tooltip:LocaleUtils.tr("timemanager.stepfwd"),icon:"nav-right"},{key:"loop",tooltip:LocaleUtils.tr("timemanager.loop"),icon:"refresh",pressed:_this.state.animationLoop}];var markerConfiguration=_objectSpread(_objectSpread({},TimeManager.defaultProps.markerConfiguration),_this.props.markerConfiguration);var options=/*#__PURE__*/React.createElement("div",{className:"time-manager-options"},/*#__PURE__*/React.createElement("table",null,/*#__PURE__*/React.createElement("tbody",null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("timemanager.stepsize"),":"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{max:100,min:1,mobile:true,onChange:function onChange(value){return _this.setState({stepSize:value})},value:_this.state.stepSize})),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.setState({stepSizeUnit:ev.target.value})},value:_this.state.stepSizeUnit},_this.props.stepUnits.map(function(unit){return/*#__PURE__*/React.createElement("option",{key:unit,value:unit},LocaleUtils.tr(DateUnitLabels[unit]))})))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("timemanager.animationinterval"),":"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{max:10,min:1,mobile:true,onChange:function onChange(value){return _this.setState({animationInterval:value})},value:_this.state.animationInterval})),/*#__PURE__*/React.createElement("td",null,"\xA0",LocaleUtils.tr("timemanager.unit.seconds"))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("timemanager.timeline"),":"),/*#__PURE__*/React.createElement("td",{colSpan:"2"},/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.setState({timelineMode:ev.target.value})},value:_this.state.timelineMode},/*#__PURE__*/React.createElement("option",{value:"fixed"},LocaleUtils.tr("timemanager.timeline_fixed")),/*#__PURE__*/React.createElement("option",{value:"infinite"},LocaleUtils.tr("timemanager.timeline_infinite"))))),_this.state.timelineDisplay!=="hidden"?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("timemanager.timelinedisplay"),":"),/*#__PURE__*/React.createElement("td",{colSpan:"2"},/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.setState({timelineDisplay:ev.target.value})},value:_this.state.timelineDisplay},/*#__PURE__*/React.createElement("option",{value:"minimal"},LocaleUtils.tr("timemanager.displayminimal")),/*#__PURE__*/React.createElement("option",{value:"features"},LocaleUtils.tr("timemanager.displayfeatures")),/*#__PURE__*/React.createElement("option",{value:"layers"},LocaleUtils.tr("timemanager.displaylayers"))))):null)));var timeSpan=_this.state.endTime!==null?_this.state.endTime.diff(_this.state.startTime):dayjs().diff(_this.state.startTime);var Timeline=_this.state.timelineMode==="infinite"?InfiniteTimeline:FixedTimeline;var filterActive=!isEmpty(_this.props.filter.filterParams)||!!_this.props.filter.filterGeom;var startdate=_this.state.timeData.values.length>0?_this.state.timeData.values[0].hour(0).minute(0).second(0):null;var enddate=_this.state.timeData.values.length>0?_this.state.timeData.values[_this.state.timeData.values.length-1].hour(23).minute(59).second(59):null;if(startdate&&_this.props.filter.timeRange&&dayjs(_this.props.filter.timeRange.tstart)>startdate){startdate=dayjs(_this.props.filter.timeRange.tstart)}if(enddate&&_this.props.filter.timeRange&&dayjs(_this.props.filter.timeRange.tend)<enddate){enddate=dayjs(_this.props.filter.timeRange.tend)}return/*#__PURE__*/React.createElement("div",{className:"time-manager-body",role:"body"},/*#__PURE__*/React.createElement("div",{className:"time-manager-toolbar"},/*#__PURE__*/React.createElement("div",{className:"time-manager-toolbar-controls"},/*#__PURE__*/React.createElement("span",{className:"time-manager-toolbar-block"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("timemanager.toggle")),/*#__PURE__*/React.createElement(ToggleSwitch,{active:_this.state.timeEnabled,onChange:_this.toggleTimeEnabled})),/*#__PURE__*/React.createElement(ButtonBar,{buttons:timeButtons,disabled:!_this.state.timeEnabled,onClick:_this.animationButtonClicked}),_this.props.markerConfiguration.markersAvailable?/*#__PURE__*/React.createElement("span",{className:"time-manager-toolbar-block"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("timemanager.markers"),": \xA0"),/*#__PURE__*/React.createElement(ToggleSwitch,{active:_this.state.markersEnabled,onChange:function onChange(value){return _this.setState({markersEnabled:value})},readOnly:!_this.state.markersCanBeEnabled})):null),/*#__PURE__*/React.createElement("div",{className:"time-manager-options-menubutton"},/*#__PURE__*/React.createElement("button",{className:"button"+(_this.state.settingsPopup?" pressed":""),onClick:function onClick(){return _this.setState(function(state){return{settingsPopup:!state.settingsPopup}})}},/*#__PURE__*/React.createElement(Icon,{icon:"cog"})),_this.state.settingsPopup?options:null)),filterActive?/*#__PURE__*/React.createElement("div",{className:"time-manager-filter-warning"},/*#__PURE__*/React.createElement(Icon,{icon:"warning"})," ",LocaleUtils.tr("timemanager.filterwarning")," ",/*#__PURE__*/React.createElement("button",{className:"button",onClick:function onClick(){return _this.props.setCurrentTask("MapFilter")},type:"button"},LocaleUtils.tr("timemanager.edit"))):null,/*#__PURE__*/React.createElement("div",{className:"time-manager-timeline"},/*#__PURE__*/React.createElement(Timeline,{currentTimestamp:_this.state.currentTimestamp,dataEndTime:enddate,dataStartTime:startdate,dateFormat:_this.props.dateFormat,dialogWidth:_this.state.dialogWidth,endTime:_this.state.endTime,setEndTime:_this.setEndTime,setMarkersCanBeEnabled:function setMarkersCanBeEnabled(value){return _this.setState({markersCanBeEnabled:value,markersEnabled:false})},setStartTime:_this.setStartTime,startTime:_this.state.startTime,timeSpan:timeSpan},function(computePixelFromTime,computeTimeFromPixel){return/*#__PURE__*/React.createElement(TimelineFeaturesSlider,{computePixelFromTime:computePixelFromTime,computeTimeFromPixel:computeTimeFromPixel,currentTimestamp:_this.state.currentTimestamp,cursorFormat:_this.props.cursorFormat,dateFormat:_this.props.dateFormat,displayMode:_this.state.timelineDisplay,endTime:_this.state.endTime,markerConfiguration:markerConfiguration,markersEnabled:_this.state.markersEnabled,startTime:_this.state.startTime,stepSizeUnit:_this.state.stepSizeUnit,timeEnabled:_this.state.timeEnabled,timeFeatures:_this.state.timeFeatures,timestampChanged:function timestampChanged(timestamp){return _this.setState({currentTimestamp:timestamp})}})})))});_defineProperty(_this,"dialogGeomChanged",function(geom){_this.setState({dialogWidth:geom.docked?document.body.offsetWidth:geom.width})});_defineProperty(_this,"toggleTimeEnabled",function(enabled){clearInterval(_this.animationTimer);clearTimeout(_this.updateMapMarkersTimeout);_this.animationTimer=null;_this.updateMapMarkersTimeout=null;_this.setState(function(state){return{timeEnabled:enabled,currentTimestamp:+state.startTime,animationActive:false,timeMarkers:null}})});_defineProperty(_this,"animationButtonClicked",function(action){_this.stopAnimation();if(action==="rewind"){_this.setState(function(state){return{currentTimestamp:+state.startTime,animationActive:false}})}else if(action==="now"){_this.setState({currentTimestamp:+dayjs(),animationActive:false})}else if(action==="prev"){var newday=_this.step(-1);_this.setState(function(state){return{currentTimestamp:+Math.max(newday,state.startTime)}})}else if(action==="next"){var _newday=_this.step(+1);_this.setState(function(state){return{currentTimestamp:+Math.min(_newday,state.endTime)}})}else if(action==="stop"){/* Already stopped above, pass */}else if(action==="play"){var curday=dayjs(_this.state.currentTimestamp);var lastday=_this.state.endTime;if(curday>=lastday){_this.setState(function(state){return{currentTimestamp:+state.startTime}})}_this.animationTimer=setInterval(function(){_this.advanceAnimation(+1)},1000*_this.state.animationInterval);_this.setState({animationActive:true})}else if(action==="playrev"){var _curday=dayjs(_this.state.currentTimestamp);var firstday=_this.state.startTime;if(_curday<=firstday){_this.setState(function(state){return{currentTimestamp:+state.endTime}})}_this.animationTimer=setInterval(function(){_this.advanceAnimation(-1)},1000*_this.state.animationInterval);_this.setState({animationActive:true})}else if(action==="loop"){_this.setState(function(state){return{animationLoop:!state.animationLoop}})}});_defineProperty(_this,"advanceAnimation",function(stepdir){var newday=_this.step(stepdir);var firstday=_this.state.startTime;var lastday=_this.state.endTime;if(newday>lastday){if(stepdir>0&&_this.state.animationLoop){_this.setState(function(state){return{currentTimestamp:+state.startTime}})}else{_this.setState({currentTimestamp:+lastday,animationActive:false});clearInterval(_this.animationTimer);_this.animationTimer=null}}else if(newday<firstday){if(stepdir<0&&_this.state.animationLoop){_this.setState(function(state){return{currentTimestamp:+state.endTime}})}else{_this.setState({currentTimestamp:+firstday,animationActive:false});clearInterval(_this.animationTimer);_this.animationTimer=null}}else{_this.setState({currentTimestamp:+newday})}});_defineProperty(_this,"stopAnimation",function(){if(_this.state.animationActive){clearInterval(_this.animationTimer);_this.animationTimer=null;_this.setState({animationActive:false})}});_defineProperty(_this,"onClose",function(){_this.toggleTimeEnabled(false);_this.setState({visible:false});_this.props.removeLayer("timemarkers")});_defineProperty(_this,"step",function(direction){var day=dayjs(_this.state.currentTimestamp);var num=parseInt(_this.state.stepSizeUnit.slice(0,-1),10)||1;var newday=day.add(direction*_this.state.stepSize*num,_this.state.stepSizeUnit.slice(-1));if(_this.state.stepSizeUnit.endsWith("m")){return newday.second(0)}else if(_this.state.stepSizeUnit.endsWith("h")){return newday.second(0).minute(0)}else if(_this.state.stepSizeUnit.endsWith("d")){return newday.second(0).minute(0).hour(0)}else if(_this.state.stepSizeUnit.endsWith("M")){return newday.second(0).minute(0).hour(0).date(1)}else if(_this.state.stepSizeUnit.endsWith("y")){return newday.second(0).minute(0).hour(0).date(1).month(0)}return newday});_defineProperty(_this,"updateLayerTimeDimensions",function(timeData,currentTimestamp){var currentTime=_this.state.timeEnabled?new Date(currentTimestamp).toISOString():undefined;timeData.layers.forEach(function(layer){var dimensions=timeData.layerDimensions[layer.id].reduce(function(res,dimension){res[dimension.toUpperCase()]=currentTime;return res},_objectSpread({},layer.dimensionValues||{}));_this.props.setLayerDimensions(layer.id,dimensions)})});_defineProperty(_this,"setStartTime",function(value){var date=(value?dayjs.utc(value):_this.state.timeData.values[0]).hour(0).minute(0).second(0);if(_this.props.filter.timeRange&&_this.props.filter.timeRange.tstart>date){date=_this.props.filter.timeRange.tstart}if(date<_this.state.endTime){_this.setState({startTime:date})}if(dayjs(_this.state.currentTimestamp)<date){_this.setState({currentTimestamp:+date})}});_defineProperty(_this,"setEndTime",function(value){var date=(value?dayjs.utc(value):_this.state.timeData.values[_this.state.timeData.values.length-1]).hour(23).minute(59).second(59);if(_this.props.filter.timeRange&&_this.props.filter.timeRange.tend<date){date=_this.props.filter.timeRange.tstart}if(date>_this.state.startTime){_this.setState({endTime:date});if(dayjs(_this.state.currentTimestamp)>date){_this.setState({currentTimestamp:+date})}}});_defineProperty(_this,"updateTimeFeatures",function(timeData){// Query all features in extent
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
123
|
+
*/
|
|
124
|
+
var TimeManager = /*#__PURE__*/function (_React$Component) {
|
|
125
|
+
function TimeManager(props) {
|
|
126
|
+
var _this;
|
|
127
|
+
_classCallCheck(this, TimeManager);
|
|
128
|
+
_this = _callSuper(this, TimeManager, [props]);
|
|
129
|
+
_defineProperty(_this, "renderBody", function () {
|
|
130
|
+
var timeButtons = [{
|
|
131
|
+
key: "rewind",
|
|
132
|
+
tooltip: LocaleUtils.tr("timemanager.rewind"),
|
|
133
|
+
icon: "nav-start"
|
|
134
|
+
}, {
|
|
135
|
+
key: "now",
|
|
136
|
+
tooltip: LocaleUtils.tr("timemanager.now"),
|
|
137
|
+
icon: "today"
|
|
138
|
+
}, {
|
|
139
|
+
key: "prev",
|
|
140
|
+
tooltip: LocaleUtils.tr("timemanager.stepback"),
|
|
141
|
+
icon: "nav-left"
|
|
142
|
+
}, {
|
|
143
|
+
key: "playrev",
|
|
144
|
+
tooltip: LocaleUtils.tr("timemanager.playrev"),
|
|
145
|
+
icon: "triangle-left",
|
|
146
|
+
disabled: _this.state.animationActive
|
|
147
|
+
}, {
|
|
148
|
+
key: "stop",
|
|
149
|
+
tooltip: LocaleUtils.tr("timemanager.stop"),
|
|
150
|
+
icon: "square",
|
|
151
|
+
disabled: !_this.state.animationActive
|
|
152
|
+
}, {
|
|
153
|
+
key: "play",
|
|
154
|
+
tooltip: LocaleUtils.tr("timemanager.play"),
|
|
155
|
+
icon: "triangle-right",
|
|
156
|
+
disabled: _this.state.animationActive
|
|
157
|
+
}, {
|
|
158
|
+
key: "next",
|
|
159
|
+
tooltip: LocaleUtils.tr("timemanager.stepfwd"),
|
|
160
|
+
icon: "nav-right"
|
|
161
|
+
}, {
|
|
162
|
+
key: "loop",
|
|
163
|
+
tooltip: LocaleUtils.tr("timemanager.loop"),
|
|
164
|
+
icon: "refresh",
|
|
165
|
+
pressed: _this.state.animationLoop
|
|
166
|
+
}];
|
|
167
|
+
var markerConfiguration = _objectSpread(_objectSpread({}, TimeManager.defaultProps.markerConfiguration), _this.props.markerConfiguration);
|
|
168
|
+
var options = /*#__PURE__*/React.createElement("div", {
|
|
169
|
+
className: "time-manager-options"
|
|
170
|
+
}, /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("timemanager.stepsize"), ":"), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(NumberInput, {
|
|
171
|
+
max: 100,
|
|
172
|
+
min: 1,
|
|
173
|
+
mobile: true,
|
|
174
|
+
onChange: function onChange(value) {
|
|
175
|
+
return _this.setState({
|
|
176
|
+
stepSize: value
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
value: _this.state.stepSize
|
|
180
|
+
})), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("select", {
|
|
181
|
+
onChange: function onChange(ev) {
|
|
182
|
+
return _this.setState({
|
|
183
|
+
stepSizeUnit: ev.target.value
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
value: _this.state.stepSizeUnit
|
|
187
|
+
}, _this.props.stepUnits.map(function (unit) {
|
|
188
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
189
|
+
key: unit,
|
|
190
|
+
value: unit
|
|
191
|
+
}, LocaleUtils.tr(DateUnitLabels[unit]));
|
|
192
|
+
})))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("timemanager.animationinterval"), ":"), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(NumberInput, {
|
|
193
|
+
max: 10,
|
|
194
|
+
min: 1,
|
|
195
|
+
mobile: true,
|
|
196
|
+
onChange: function onChange(value) {
|
|
197
|
+
return _this.setState({
|
|
198
|
+
animationInterval: value
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
value: _this.state.animationInterval
|
|
202
|
+
})), /*#__PURE__*/React.createElement("td", null, "\xA0", LocaleUtils.tr("timemanager.unit.seconds"))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("timemanager.timeline"), ":"), /*#__PURE__*/React.createElement("td", {
|
|
203
|
+
colSpan: "2"
|
|
204
|
+
}, /*#__PURE__*/React.createElement("select", {
|
|
205
|
+
onChange: function onChange(ev) {
|
|
206
|
+
return _this.setState({
|
|
207
|
+
timelineMode: ev.target.value
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
value: _this.state.timelineMode
|
|
211
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
212
|
+
value: "fixed"
|
|
213
|
+
}, LocaleUtils.tr("timemanager.timeline_fixed")), /*#__PURE__*/React.createElement("option", {
|
|
214
|
+
value: "infinite"
|
|
215
|
+
}, LocaleUtils.tr("timemanager.timeline_infinite"))))), _this.state.timelineDisplay !== "hidden" ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("timemanager.timelinedisplay"), ":"), /*#__PURE__*/React.createElement("td", {
|
|
216
|
+
colSpan: "2"
|
|
217
|
+
}, /*#__PURE__*/React.createElement("select", {
|
|
218
|
+
onChange: function onChange(ev) {
|
|
219
|
+
return _this.setState({
|
|
220
|
+
timelineDisplay: ev.target.value
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
value: _this.state.timelineDisplay
|
|
224
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
225
|
+
value: "minimal"
|
|
226
|
+
}, LocaleUtils.tr("timemanager.displayminimal")), /*#__PURE__*/React.createElement("option", {
|
|
227
|
+
value: "features"
|
|
228
|
+
}, LocaleUtils.tr("timemanager.displayfeatures")), /*#__PURE__*/React.createElement("option", {
|
|
229
|
+
value: "layers"
|
|
230
|
+
}, LocaleUtils.tr("timemanager.displaylayers"))))) : null)));
|
|
231
|
+
var timeSpan = _this.state.endTime !== null ? _this.state.endTime.diff(_this.state.startTime) : dayjs().diff(_this.state.startTime);
|
|
232
|
+
var Timeline = _this.state.timelineMode === 'infinite' ? InfiniteTimeline : FixedTimeline;
|
|
233
|
+
var filterActive = !isEmpty(_this.props.filter.filterParams) || !!_this.props.filter.filterGeom;
|
|
234
|
+
var startdate = _this.state.timeData.values.length > 0 ? _this.state.timeData.values[0].hour(0).minute(0).second(0) : null;
|
|
235
|
+
var enddate = _this.state.timeData.values.length > 0 ? _this.state.timeData.values[_this.state.timeData.values.length - 1].hour(23).minute(59).second(59) : null;
|
|
236
|
+
if (startdate && _this.props.filter.timeRange && dayjs(_this.props.filter.timeRange.tstart) > startdate) {
|
|
237
|
+
startdate = dayjs(_this.props.filter.timeRange.tstart);
|
|
238
|
+
}
|
|
239
|
+
if (enddate && _this.props.filter.timeRange && dayjs(_this.props.filter.timeRange.tend) < enddate) {
|
|
240
|
+
enddate = dayjs(_this.props.filter.timeRange.tend);
|
|
241
|
+
}
|
|
242
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
243
|
+
className: "time-manager-body",
|
|
244
|
+
role: "body"
|
|
245
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
246
|
+
className: "time-manager-toolbar"
|
|
247
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
248
|
+
className: "time-manager-toolbar-controls"
|
|
249
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
250
|
+
className: "time-manager-toolbar-block"
|
|
251
|
+
}, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("timemanager.toggle")), /*#__PURE__*/React.createElement(ToggleSwitch, {
|
|
252
|
+
active: _this.state.timeEnabled,
|
|
253
|
+
onChange: _this.toggleTimeEnabled
|
|
254
|
+
})), /*#__PURE__*/React.createElement(ButtonBar, {
|
|
255
|
+
buttons: timeButtons,
|
|
256
|
+
disabled: !_this.state.timeEnabled,
|
|
257
|
+
onClick: _this.animationButtonClicked
|
|
258
|
+
}), _this.props.markerConfiguration.markersAvailable ? /*#__PURE__*/React.createElement("span", {
|
|
259
|
+
className: "time-manager-toolbar-block"
|
|
260
|
+
}, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("timemanager.markers"), ": \xA0"), /*#__PURE__*/React.createElement(ToggleSwitch, {
|
|
261
|
+
active: _this.state.markersEnabled,
|
|
262
|
+
onChange: function onChange(value) {
|
|
263
|
+
return _this.setState({
|
|
264
|
+
markersEnabled: value
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
readOnly: !_this.state.markersCanBeEnabled
|
|
268
|
+
})) : null), /*#__PURE__*/React.createElement("div", {
|
|
269
|
+
className: "time-manager-options-menubutton"
|
|
270
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
271
|
+
className: "button" + (_this.state.settingsPopup ? " pressed" : ""),
|
|
272
|
+
onClick: function onClick() {
|
|
273
|
+
return _this.setState(function (state) {
|
|
274
|
+
return {
|
|
275
|
+
settingsPopup: !state.settingsPopup
|
|
276
|
+
};
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
280
|
+
icon: "cog"
|
|
281
|
+
})), _this.state.settingsPopup ? options : null)), filterActive ? /*#__PURE__*/React.createElement("div", {
|
|
282
|
+
className: "time-manager-filter-warning"
|
|
283
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
284
|
+
icon: "warning"
|
|
285
|
+
}), " ", LocaleUtils.tr("timemanager.filterwarning"), " ", /*#__PURE__*/React.createElement("button", {
|
|
286
|
+
className: "button",
|
|
287
|
+
onClick: function onClick() {
|
|
288
|
+
return _this.props.setCurrentTask("MapFilter");
|
|
289
|
+
},
|
|
290
|
+
type: "button"
|
|
291
|
+
}, LocaleUtils.tr("timemanager.edit"))) : null, /*#__PURE__*/React.createElement("div", {
|
|
292
|
+
className: "time-manager-timeline"
|
|
293
|
+
}, /*#__PURE__*/React.createElement(Timeline, {
|
|
294
|
+
currentTimestamp: _this.state.currentTimestamp,
|
|
295
|
+
dataEndTime: enddate,
|
|
296
|
+
dataStartTime: startdate,
|
|
297
|
+
dateFormat: _this.props.dateFormat,
|
|
298
|
+
dialogWidth: _this.state.dialogWidth,
|
|
299
|
+
endTime: _this.state.endTime,
|
|
300
|
+
setEndTime: _this.setEndTime,
|
|
301
|
+
setMarkersCanBeEnabled: function setMarkersCanBeEnabled(value) {
|
|
302
|
+
return _this.setState({
|
|
303
|
+
markersCanBeEnabled: value,
|
|
304
|
+
markersEnabled: false
|
|
305
|
+
});
|
|
306
|
+
},
|
|
307
|
+
setStartTime: _this.setStartTime,
|
|
308
|
+
startTime: _this.state.startTime,
|
|
309
|
+
timeSpan: timeSpan
|
|
310
|
+
}, function (computePixelFromTime, computeTimeFromPixel) {
|
|
311
|
+
return /*#__PURE__*/React.createElement(TimelineFeaturesSlider, {
|
|
312
|
+
computePixelFromTime: computePixelFromTime,
|
|
313
|
+
computeTimeFromPixel: computeTimeFromPixel,
|
|
314
|
+
currentTimestamp: _this.state.currentTimestamp,
|
|
315
|
+
cursorFormat: _this.props.cursorFormat,
|
|
316
|
+
dateFormat: _this.props.dateFormat,
|
|
317
|
+
displayMode: _this.state.timelineDisplay,
|
|
318
|
+
endTime: _this.state.endTime,
|
|
319
|
+
markerConfiguration: markerConfiguration,
|
|
320
|
+
markersEnabled: _this.state.markersEnabled,
|
|
321
|
+
startTime: _this.state.startTime,
|
|
322
|
+
stepSizeUnit: _this.state.stepSizeUnit,
|
|
323
|
+
timeEnabled: _this.state.timeEnabled,
|
|
324
|
+
timeFeatures: _this.state.timeFeatures,
|
|
325
|
+
timestampChanged: function timestampChanged(timestamp) {
|
|
326
|
+
return _this.setState({
|
|
327
|
+
currentTimestamp: timestamp
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
})));
|
|
332
|
+
});
|
|
333
|
+
_defineProperty(_this, "dialogGeomChanged", function (geom) {
|
|
334
|
+
_this.setState({
|
|
335
|
+
dialogWidth: geom.docked ? document.body.offsetWidth : geom.width
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
_defineProperty(_this, "toggleTimeEnabled", function (enabled) {
|
|
339
|
+
clearInterval(_this.animationTimer);
|
|
340
|
+
clearTimeout(_this.updateMapMarkersTimeout);
|
|
341
|
+
_this.animationTimer = null;
|
|
342
|
+
_this.updateMapMarkersTimeout = null;
|
|
343
|
+
_this.setState(function (state) {
|
|
344
|
+
return {
|
|
345
|
+
timeEnabled: enabled,
|
|
346
|
+
currentTimestamp: +state.startTime,
|
|
347
|
+
animationActive: false,
|
|
348
|
+
timeMarkers: null
|
|
349
|
+
};
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
_defineProperty(_this, "animationButtonClicked", function (action) {
|
|
353
|
+
_this.stopAnimation();
|
|
354
|
+
if (action === "rewind") {
|
|
355
|
+
_this.setState(function (state) {
|
|
356
|
+
return {
|
|
357
|
+
currentTimestamp: +state.startTime,
|
|
358
|
+
animationActive: false
|
|
359
|
+
};
|
|
360
|
+
});
|
|
361
|
+
} else if (action === "now") {
|
|
362
|
+
_this.setState({
|
|
363
|
+
currentTimestamp: +dayjs(),
|
|
364
|
+
animationActive: false
|
|
365
|
+
});
|
|
366
|
+
} else if (action === "prev") {
|
|
367
|
+
var newday = _this.step(-1);
|
|
368
|
+
_this.setState(function (state) {
|
|
369
|
+
return {
|
|
370
|
+
currentTimestamp: +Math.max(newday, state.startTime)
|
|
371
|
+
};
|
|
372
|
+
});
|
|
373
|
+
} else if (action === "next") {
|
|
374
|
+
var _newday = _this.step(+1);
|
|
375
|
+
_this.setState(function (state) {
|
|
376
|
+
return {
|
|
377
|
+
currentTimestamp: +Math.min(_newday, state.endTime)
|
|
378
|
+
};
|
|
379
|
+
});
|
|
380
|
+
} else if (action === "stop") {
|
|
381
|
+
/* Already stopped above, pass */
|
|
382
|
+
} else if (action === "play") {
|
|
383
|
+
var curday = dayjs(_this.state.currentTimestamp);
|
|
384
|
+
var lastday = _this.state.endTime;
|
|
385
|
+
if (curday >= lastday) {
|
|
386
|
+
_this.setState(function (state) {
|
|
387
|
+
return {
|
|
388
|
+
currentTimestamp: +state.startTime
|
|
389
|
+
};
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
_this.animationTimer = setInterval(function () {
|
|
393
|
+
_this.advanceAnimation(+1);
|
|
394
|
+
}, 1000 * _this.state.animationInterval);
|
|
395
|
+
_this.setState({
|
|
396
|
+
animationActive: true
|
|
397
|
+
});
|
|
398
|
+
} else if (action === "playrev") {
|
|
399
|
+
var _curday = dayjs(_this.state.currentTimestamp);
|
|
400
|
+
var firstday = _this.state.startTime;
|
|
401
|
+
if (_curday <= firstday) {
|
|
402
|
+
_this.setState(function (state) {
|
|
403
|
+
return {
|
|
404
|
+
currentTimestamp: +state.endTime
|
|
405
|
+
};
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
_this.animationTimer = setInterval(function () {
|
|
409
|
+
_this.advanceAnimation(-1);
|
|
410
|
+
}, 1000 * _this.state.animationInterval);
|
|
411
|
+
_this.setState({
|
|
412
|
+
animationActive: true
|
|
413
|
+
});
|
|
414
|
+
} else if (action === "loop") {
|
|
415
|
+
_this.setState(function (state) {
|
|
416
|
+
return {
|
|
417
|
+
animationLoop: !state.animationLoop
|
|
418
|
+
};
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
_defineProperty(_this, "advanceAnimation", function (stepdir) {
|
|
423
|
+
var newday = _this.step(stepdir);
|
|
424
|
+
var firstday = _this.state.startTime;
|
|
425
|
+
var lastday = _this.state.endTime;
|
|
426
|
+
if (newday > lastday) {
|
|
427
|
+
if (stepdir > 0 && _this.state.animationLoop) {
|
|
428
|
+
_this.setState(function (state) {
|
|
429
|
+
return {
|
|
430
|
+
currentTimestamp: +state.startTime
|
|
431
|
+
};
|
|
432
|
+
});
|
|
433
|
+
} else {
|
|
434
|
+
_this.setState({
|
|
435
|
+
currentTimestamp: +lastday,
|
|
436
|
+
animationActive: false
|
|
437
|
+
});
|
|
438
|
+
clearInterval(_this.animationTimer);
|
|
439
|
+
_this.animationTimer = null;
|
|
440
|
+
}
|
|
441
|
+
} else if (newday < firstday) {
|
|
442
|
+
if (stepdir < 0 && _this.state.animationLoop) {
|
|
443
|
+
_this.setState(function (state) {
|
|
444
|
+
return {
|
|
445
|
+
currentTimestamp: +state.endTime
|
|
446
|
+
};
|
|
447
|
+
});
|
|
448
|
+
} else {
|
|
449
|
+
_this.setState({
|
|
450
|
+
currentTimestamp: +firstday,
|
|
451
|
+
animationActive: false
|
|
452
|
+
});
|
|
453
|
+
clearInterval(_this.animationTimer);
|
|
454
|
+
_this.animationTimer = null;
|
|
455
|
+
}
|
|
456
|
+
} else {
|
|
457
|
+
_this.setState({
|
|
458
|
+
currentTimestamp: +newday
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
_defineProperty(_this, "stopAnimation", function () {
|
|
463
|
+
if (_this.state.animationActive) {
|
|
464
|
+
clearInterval(_this.animationTimer);
|
|
465
|
+
_this.animationTimer = null;
|
|
466
|
+
_this.setState({
|
|
467
|
+
animationActive: false
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
_defineProperty(_this, "onClose", function () {
|
|
472
|
+
_this.toggleTimeEnabled(false);
|
|
473
|
+
_this.setState({
|
|
474
|
+
visible: false
|
|
475
|
+
});
|
|
476
|
+
_this.props.removeLayer("timemarkers");
|
|
477
|
+
});
|
|
478
|
+
_defineProperty(_this, "step", function (direction) {
|
|
479
|
+
var day = dayjs(_this.state.currentTimestamp);
|
|
480
|
+
var num = parseInt(_this.state.stepSizeUnit.slice(0, -1), 10) || 1;
|
|
481
|
+
var newday = day.add(direction * _this.state.stepSize * num, _this.state.stepSizeUnit.slice(-1));
|
|
482
|
+
if (_this.state.stepSizeUnit.endsWith("m")) {
|
|
483
|
+
return newday.second(0);
|
|
484
|
+
} else if (_this.state.stepSizeUnit.endsWith("h")) {
|
|
485
|
+
return newday.second(0).minute(0);
|
|
486
|
+
} else if (_this.state.stepSizeUnit.endsWith("d")) {
|
|
487
|
+
return newday.second(0).minute(0).hour(0);
|
|
488
|
+
} else if (_this.state.stepSizeUnit.endsWith("M")) {
|
|
489
|
+
return newday.second(0).minute(0).hour(0).date(1);
|
|
490
|
+
} else if (_this.state.stepSizeUnit.endsWith("y")) {
|
|
491
|
+
return newday.second(0).minute(0).hour(0).date(1).month(0);
|
|
492
|
+
}
|
|
493
|
+
return newday;
|
|
494
|
+
});
|
|
495
|
+
_defineProperty(_this, "updateLayerTimeDimensions", function (timeData, currentTimestamp) {
|
|
496
|
+
var currentTime = _this.state.timeEnabled ? new Date(currentTimestamp).toISOString() : undefined;
|
|
497
|
+
timeData.layers.forEach(function (layer) {
|
|
498
|
+
var dimensions = timeData.layerDimensions[layer.id].reduce(function (res, dimension) {
|
|
499
|
+
res[dimension.toUpperCase()] = currentTime;
|
|
500
|
+
return res;
|
|
501
|
+
}, _objectSpread({}, layer.dimensionValues || {}));
|
|
502
|
+
_this.props.setLayerDimensions(layer.id, dimensions);
|
|
503
|
+
});
|
|
504
|
+
});
|
|
505
|
+
_defineProperty(_this, "setStartTime", function (value) {
|
|
506
|
+
var date = (value ? dayjs.utc(value) : _this.state.timeData.values[0]).hour(0).minute(0).second(0);
|
|
507
|
+
if (_this.props.filter.timeRange && _this.props.filter.timeRange.tstart > date) {
|
|
508
|
+
date = _this.props.filter.timeRange.tstart;
|
|
509
|
+
}
|
|
510
|
+
if (date < _this.state.endTime) {
|
|
511
|
+
_this.setState({
|
|
512
|
+
startTime: date
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
if (dayjs(_this.state.currentTimestamp) < date) {
|
|
516
|
+
_this.setState({
|
|
517
|
+
currentTimestamp: +date
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
_defineProperty(_this, "setEndTime", function (value) {
|
|
522
|
+
var date = (value ? dayjs.utc(value) : _this.state.timeData.values[_this.state.timeData.values.length - 1]).hour(23).minute(59).second(59);
|
|
523
|
+
if (_this.props.filter.timeRange && _this.props.filter.timeRange.tend < date) {
|
|
524
|
+
date = _this.props.filter.timeRange.tstart;
|
|
525
|
+
}
|
|
526
|
+
if (date > _this.state.startTime) {
|
|
527
|
+
_this.setState({
|
|
528
|
+
endTime: date
|
|
529
|
+
});
|
|
530
|
+
if (dayjs(_this.state.currentTimestamp) > date) {
|
|
531
|
+
_this.setState({
|
|
532
|
+
currentTimestamp: +date
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
_defineProperty(_this, "updateTimeFeatures", function (timeData) {
|
|
538
|
+
// Query all features in extent
|
|
539
|
+
var xmin = _this.props.map.bbox.bounds[0];
|
|
540
|
+
var ymin = _this.props.map.bbox.bounds[1];
|
|
541
|
+
var xmax = _this.props.map.bbox.bounds[2];
|
|
542
|
+
var ymax = _this.props.map.bbox.bounds[3];
|
|
543
|
+
var filterGeom = VectorLayerUtils.geoJSONGeomToWkt({
|
|
544
|
+
type: 'Polygon',
|
|
545
|
+
coordinates: [[[xmin, ymin], [xmax, ymin], [xmax, ymax], [xmin, ymax], [xmin, ymin]]]
|
|
546
|
+
});
|
|
547
|
+
var pending = 0;
|
|
548
|
+
var reqUUID = uuidv4();
|
|
549
|
+
timeData.layers.forEach(function (layer) {
|
|
550
|
+
var sublayerattrs = timeData.attributes[layer.id];
|
|
551
|
+
var queryLayers = Object.keys(sublayerattrs).join(",");
|
|
552
|
+
var options = {
|
|
553
|
+
GEOMCENTROID: true,
|
|
554
|
+
with_htmlcontent: false,
|
|
555
|
+
feature_count: _this.state.featureCount
|
|
556
|
+
};
|
|
557
|
+
var request = IdentifyUtils.buildFilterRequest(layer, queryLayers, filterGeom, _this.props.map, options);
|
|
558
|
+
IdentifyUtils.sendRequest(request, function (response) {
|
|
559
|
+
if (_this.state.timeFeatures && _this.state.timeFeatures.reqUUID === reqUUID && response) {
|
|
560
|
+
var layerFeatures = IdentifyUtils.parseXmlResponse(response, _this.props.map.projection, layer);
|
|
561
|
+
_this.setState(function (state) {
|
|
562
|
+
return {
|
|
563
|
+
timeFeatures: {
|
|
564
|
+
features: _objectSpread(_objectSpread({}, state.timeFeatures.features), Object.entries(layerFeatures).reduce(function (res, _ref3) {
|
|
565
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
566
|
+
layername = _ref4[0],
|
|
567
|
+
features = _ref4[1];
|
|
568
|
+
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, layername, features.map(function (feature) {
|
|
569
|
+
var startdate = dateParser.fromString(feature.properties[sublayerattrs[feature.layername][0]]);
|
|
570
|
+
var enddate = dateParser.fromString(feature.properties[sublayerattrs[feature.layername][1]]);
|
|
571
|
+
if (enddate && !enddate.invalid && enddate.getFullYear() === DUMMY_END_DATE.getFullYear()) {
|
|
572
|
+
enddate = null;
|
|
573
|
+
}
|
|
574
|
+
return _objectSpread(_objectSpread({}, feature), {}, {
|
|
575
|
+
id: feature.layername + "::" + feature.id,
|
|
576
|
+
properties: _objectSpread(_objectSpread({}, feature.properties), {}, {
|
|
577
|
+
__startdate: dayjs.utc(startdate),
|
|
578
|
+
__enddate: dayjs.utc(enddate)
|
|
579
|
+
})
|
|
580
|
+
});
|
|
581
|
+
})));
|
|
582
|
+
}, {})),
|
|
583
|
+
attributes: _objectSpread(_objectSpread({}, state.timeFeatures.attributes), Object.entries(layerFeatures).reduce(function (res, _ref5) {
|
|
584
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
585
|
+
layername = _ref6[0],
|
|
586
|
+
features = _ref6[1];
|
|
587
|
+
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, layername, Object.keys((features[0] || {
|
|
588
|
+
properties: {}
|
|
589
|
+
}).properties)));
|
|
590
|
+
}, {})),
|
|
591
|
+
pendingRequests: state.timeFeatures.pendingRequests - 1
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
});
|
|
595
|
+
} else {
|
|
596
|
+
_this.setState(function (state) {
|
|
597
|
+
return {
|
|
598
|
+
timeFeatures: _objectSpread(_objectSpread({}, state.timeFeatures), {}, {
|
|
599
|
+
pendingRequests: state.timeFeatures.pendingRequests - 1
|
|
600
|
+
})
|
|
601
|
+
};
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
++pending;
|
|
606
|
+
});
|
|
607
|
+
_this.setState({
|
|
608
|
+
timeFeatures: {
|
|
609
|
+
features: {},
|
|
610
|
+
attributes: {},
|
|
611
|
+
pendingRequests: pending,
|
|
612
|
+
reqUUID: reqUUID
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
_defineProperty(_this, "markerStyle", function (feature) {
|
|
617
|
+
var style = [];
|
|
618
|
+
var currentTime = dayjs(_this.state.currentTimestamp);
|
|
619
|
+
var featprops = feature.getProperties();
|
|
620
|
+
if (_this.state.timeEnabled && (featprops.__startdate > currentTime || featprops.__enddate < currentTime)) {
|
|
621
|
+
return style;
|
|
622
|
+
}
|
|
623
|
+
var offset = _this.props.markerConfiguration.markerOffset;
|
|
624
|
+
if (_this.props.markerConfiguration.markerPins) {
|
|
625
|
+
style.push(new ol.style.Style({
|
|
626
|
+
image: new ol.style.Icon({
|
|
627
|
+
anchor: [0.5, 1],
|
|
628
|
+
anchorXUnits: 'fraction',
|
|
629
|
+
anchorYUnits: 'fraction',
|
|
630
|
+
displacement: offset,
|
|
631
|
+
src: markerIcon
|
|
632
|
+
})
|
|
633
|
+
}));
|
|
634
|
+
}
|
|
635
|
+
if (featprops.__startdate.isValid() && featprops.__enddate.isValid()) {
|
|
636
|
+
var deltaT = _this.state.endTime.diff(_this.state.startTime);
|
|
637
|
+
var markerStartTime = dayjs(Math.max(_this.state.startTime, featprops.__startdate));
|
|
638
|
+
var markerEndTime = dayjs(Math.min(_this.state.endTime, featprops.__enddate));
|
|
639
|
+
var markerMidTime = 0.5 * (markerStartTime + markerEndTime);
|
|
640
|
+
var gradBarMaxWidth = 192;
|
|
641
|
+
var gradBarHeight = 16;
|
|
642
|
+
var gradBarWidth = gradBarMaxWidth * markerEndTime.diff(markerStartTime) / deltaT;
|
|
643
|
+
var canvas = document.createElement('canvas');
|
|
644
|
+
var context = canvas.getContext('2d');
|
|
645
|
+
var gradient = context.createLinearGradient(-gradBarWidth * (markerMidTime - _this.state.startTime) / (markerMidTime - markerStartTime), 0, gradBarWidth * (_this.state.endTime - markerMidTime) / (markerEndTime - markerMidTime), 0);
|
|
646
|
+
var nStops = _this.props.markerConfiguration.gradient.length;
|
|
647
|
+
_this.props.markerConfiguration.gradient.forEach(function (stop, idx) {
|
|
648
|
+
gradient.addColorStop(idx / (nStops - 1), stop);
|
|
649
|
+
});
|
|
650
|
+
style.push(new ol.style.Style({
|
|
651
|
+
image: new ol.style.RegularShape({
|
|
652
|
+
fill: new ol.style.Fill({
|
|
653
|
+
color: gradient
|
|
654
|
+
}),
|
|
655
|
+
stroke: new ol.style.Stroke({
|
|
656
|
+
color: 'black',
|
|
657
|
+
width: 1
|
|
658
|
+
}),
|
|
659
|
+
points: 4,
|
|
660
|
+
radius: gradBarWidth / Math.SQRT2,
|
|
661
|
+
radius2: gradBarWidth,
|
|
662
|
+
angle: 0,
|
|
663
|
+
scale: [1, 1 / gradBarWidth * gradBarHeight],
|
|
664
|
+
displacement: [offset[0], offset[1] * gradBarHeight / gradBarWidth - gradBarHeight]
|
|
665
|
+
})
|
|
666
|
+
}));
|
|
667
|
+
}
|
|
668
|
+
return style;
|
|
669
|
+
});
|
|
670
|
+
_this.animationTimer = null;
|
|
671
|
+
_this.updateMapMarkersTimeout = null;
|
|
672
|
+
TimeManager.defaultState.stepSize = props.defaultStepSize;
|
|
673
|
+
TimeManager.defaultState.stepSizeUnit = props.defaultStepUnit;
|
|
674
|
+
TimeManager.defaultState.timelineDisplay = props.defaultTimelineDisplay;
|
|
675
|
+
TimeManager.defaultState.timeEnabled = props.defaultEnabled;
|
|
676
|
+
if (!props.stepUnits.includes(TimeManager.defaultState.stepSizeUnit)) {
|
|
677
|
+
TimeManager.defaultState.stepSizeUnit = props.stepUnits[0];
|
|
678
|
+
}
|
|
679
|
+
TimeManager.defaultState.animationInterval = props.defaultAnimationInterval;
|
|
680
|
+
TimeManager.defaultState.featureCount = props.defaultFeatureCount;
|
|
681
|
+
TimeManager.defaultState.timelineMode = props.defaultTimelineMode;
|
|
682
|
+
TimeManager.defaultState.timelineDisplay = props.defaultTimelineDisplay;
|
|
683
|
+
_this.state = _objectSpread(_objectSpread({}, _this.state), TimeManager.defaultState);
|
|
684
|
+
return _this;
|
|
685
|
+
}
|
|
686
|
+
_inherits(TimeManager, _React$Component);
|
|
687
|
+
return _createClass(TimeManager, [{
|
|
688
|
+
key: "componentDidUpdate",
|
|
689
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
690
|
+
var _this2 = this;
|
|
691
|
+
var activated = !prevProps.active && this.props.active;
|
|
692
|
+
if (activated) {
|
|
693
|
+
this.setState({
|
|
694
|
+
visible: true
|
|
695
|
+
});
|
|
696
|
+
// Clear task immediately after showing, visibility is controlled by internal state
|
|
697
|
+
this.props.setCurrentTask(null);
|
|
698
|
+
}
|
|
699
|
+
if (!this.state.visible && prevState.visible) {
|
|
700
|
+
this.updateLayerTimeDimensions(this.state.timeData, this.state.currentTimestamp);
|
|
701
|
+
this.setState(TimeManager.defaultState);
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
if (!activated && !this.state.visible) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
if (this.props.theme !== prevProps.theme) {
|
|
708
|
+
this.setState({
|
|
709
|
+
currentTimestamp: null
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
if (activated || !isEqual(this.props.layerVisibilities, prevProps.layerVisibilities)) {
|
|
713
|
+
this.stopAnimation();
|
|
714
|
+
var timeData = {
|
|
715
|
+
layerDimensions: {},
|
|
716
|
+
values: new Set(),
|
|
717
|
+
attributes: {},
|
|
718
|
+
layers: []
|
|
719
|
+
};
|
|
720
|
+
this.props.layers.forEach(function (layer) {
|
|
721
|
+
if (layer.type === "wms") {
|
|
722
|
+
var layertimeData = LayerUtils.getTimeDimensionValues(layer);
|
|
723
|
+
if (layertimeData.names.size > 0) {
|
|
724
|
+
timeData.layerDimensions[layer.id] = _toConsumableArray(layertimeData.names);
|
|
725
|
+
layertimeData.values.forEach(function (x) {
|
|
726
|
+
return timeData.values.add(x);
|
|
727
|
+
});
|
|
728
|
+
timeData.attributes[layer.id] = _objectSpread(_objectSpread({}, timeData.attributes[layer.id]), layertimeData.attributes);
|
|
729
|
+
// Filter time dimension from layer - object cache in updateTimeFeatures below should query all objects regardless of time
|
|
730
|
+
var layerNoTimeDims = _objectSpread({}, layer);
|
|
731
|
+
var layerDimsUC = timeData.layerDimensions[layer.id].map(function (name) {
|
|
732
|
+
return name.toUpperCase();
|
|
733
|
+
});
|
|
734
|
+
layerNoTimeDims.dimensionValues = Object.entries(layerNoTimeDims.dimensionValues || {}).reduce(function (res, _ref7) {
|
|
735
|
+
var _ref8 = _slicedToArray(_ref7, 2),
|
|
736
|
+
key = _ref8[0],
|
|
737
|
+
value = _ref8[1];
|
|
738
|
+
if (layerDimsUC.includes(key)) {
|
|
739
|
+
return res;
|
|
740
|
+
} else {
|
|
741
|
+
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, value));
|
|
742
|
+
}
|
|
743
|
+
}, {});
|
|
744
|
+
timeData.layers.push(layerNoTimeDims);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
timeData.values = _toConsumableArray(timeData.values).sort().map(function (d) {
|
|
749
|
+
return dayjs.utc(d);
|
|
750
|
+
});
|
|
751
|
+
var startdate = timeData.values.length > 0 ? timeData.values[0].hour(0).minute(0).second(0) : null;
|
|
752
|
+
var enddate = timeData.values.length > 0 ? timeData.values[timeData.values.length - 1].hour(23).minute(59).second(59) : null;
|
|
753
|
+
if (startdate && this.props.filter.timeRange && dayjs(this.props.filter.timeRange.tstart) > startdate) {
|
|
754
|
+
startdate = dayjs(this.props.filter.timeRange.tstart);
|
|
755
|
+
}
|
|
756
|
+
if (enddate && this.props.filter.timeRange && dayjs(this.props.filter.timeRange.tend) < enddate) {
|
|
757
|
+
enddate = dayjs(this.props.filter.timeRange.tend);
|
|
758
|
+
}
|
|
759
|
+
this.setState(function (state) {
|
|
760
|
+
var _state$currentTimesta;
|
|
761
|
+
return {
|
|
762
|
+
timeData: timeData,
|
|
763
|
+
currentTimestamp: (_state$currentTimesta = state.currentTimestamp) !== null && _state$currentTimesta !== void 0 ? _state$currentTimesta : timeData.values.length > 0 ? +timeData.values[0] : null,
|
|
764
|
+
startTime: startdate,
|
|
765
|
+
endTime: enddate && enddate.year() !== DUMMY_END_DATE.getFullYear() ? enddate : null
|
|
766
|
+
};
|
|
767
|
+
});
|
|
768
|
+
this.updateTimeFeatures(timeData);
|
|
769
|
+
} else {
|
|
770
|
+
if (this.state.currentTimestamp !== prevState.currentTimestamp || this.state.timeEnabled !== prevState.timeEnabled) {
|
|
771
|
+
this.updateLayerTimeDimensions(this.state.timeData, this.state.currentTimestamp);
|
|
772
|
+
}
|
|
773
|
+
if (this.state.visible && this.props.map.bbox !== prevProps.map.bbox) {
|
|
774
|
+
this.updateTimeFeatures(this.state.timeData);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
if (this.props.filter.timeRange !== prevProps.filter.timeRange) {
|
|
778
|
+
this.setState(function (state) {
|
|
779
|
+
var startdate = state.timeData.values.length > 0 ? state.timeData.values[0].hour(0).minute(0).second(0) : null;
|
|
780
|
+
var enddate = state.timeData.values.length > 0 ? state.timeData.values[state.timeData.values.length - 1].hour(23).minute(59).second(59) : null;
|
|
781
|
+
if (startdate && _this2.props.filter.timeRange && dayjs(_this2.props.filter.timeRange.tstart) > startdate) {
|
|
782
|
+
startdate = dayjs(_this2.props.filter.timeRange.tstart);
|
|
783
|
+
}
|
|
784
|
+
if (enddate && _this2.props.filter.timeRange && dayjs(_this2.props.filter.timeRange.tend) < enddate) {
|
|
785
|
+
enddate = dayjs(_this2.props.filter.timeRange.tend);
|
|
786
|
+
}
|
|
787
|
+
return {
|
|
788
|
+
startTime: startdate,
|
|
789
|
+
endTime: enddate && enddate.year() !== DUMMY_END_DATE.getFullYear() ? enddate : null
|
|
790
|
+
};
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
if (this.state.animationActive && this.state.animationInterval !== prevState.animationInterval) {
|
|
794
|
+
this.stopAnimation();
|
|
795
|
+
}
|
|
796
|
+
if (!this.state.markersEnabled && prevState.markersEnabled) {
|
|
797
|
+
this.props.removeLayer("timemarkers");
|
|
798
|
+
} else if (this.state.markersEnabled && this.state.timeFeatures) {
|
|
799
|
+
if (this.state.markersEnabled !== prevState.markersEnabled || this.state.timeFeatures !== prevState.timeFeatures) {
|
|
800
|
+
var layer = {
|
|
801
|
+
id: "timemarkers",
|
|
802
|
+
role: LayerRole.MARKER,
|
|
803
|
+
styleFunction: this.markerStyle,
|
|
804
|
+
rev: +new Date()
|
|
805
|
+
};
|
|
806
|
+
var features = Object.values(this.state.timeFeatures.features).flat();
|
|
807
|
+
this.props.addLayerFeatures(layer, features, true);
|
|
808
|
+
} else if (this.state.currentTimestamp !== prevState.currentTimestamp || this.state.timeEnabled !== prevState.timeEnabled) {
|
|
809
|
+
this.props.refreshLayer(function (layer) {
|
|
810
|
+
return layer.id === "timemarkers";
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}, {
|
|
816
|
+
key: "render",
|
|
817
|
+
value: function render() {
|
|
818
|
+
if (!this.state.visible) {
|
|
819
|
+
return null;
|
|
820
|
+
}
|
|
821
|
+
var timeValues = this.state.timeData.values;
|
|
822
|
+
var body = null;
|
|
823
|
+
if (timeValues.length < 2) {
|
|
824
|
+
body = /*#__PURE__*/React.createElement("div", {
|
|
825
|
+
role: "body"
|
|
826
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
827
|
+
className: "time-manager-notemporaldata"
|
|
828
|
+
}, LocaleUtils.tr("timemanager.notemporaldata")));
|
|
829
|
+
} else {
|
|
830
|
+
body = this.renderBody(timeValues);
|
|
831
|
+
}
|
|
832
|
+
return /*#__PURE__*/React.createElement(ResizeableWindow, {
|
|
833
|
+
dockable: "bottom",
|
|
834
|
+
icon: "clock",
|
|
835
|
+
initialHeight: this.props.geometry.initialHeight,
|
|
836
|
+
initialWidth: this.props.geometry.initialWidth,
|
|
837
|
+
initialX: this.props.geometry.initialX,
|
|
838
|
+
initialY: this.props.geometry.initialY,
|
|
839
|
+
initiallyDocked: this.props.geometry.initiallyDocked,
|
|
840
|
+
onClose: this.onClose,
|
|
841
|
+
onGeometryChanged: this.dialogGeomChanged,
|
|
842
|
+
scrollable: true,
|
|
843
|
+
splitScreenWhenDocked: true,
|
|
844
|
+
title: LocaleUtils.tr("timemanager.title")
|
|
845
|
+
}, body);
|
|
846
|
+
}
|
|
847
|
+
}]);
|
|
848
|
+
}(React.Component);
|
|
849
|
+
_defineProperty(TimeManager, "propTypes", {
|
|
850
|
+
active: PropTypes.bool,
|
|
851
|
+
addLayerFeatures: PropTypes.func,
|
|
852
|
+
/** The format of the time cursor label. Either `date`, `time` or `datetime`. */
|
|
853
|
+
cursorFormat: PropTypes.string,
|
|
854
|
+
/** The date format in the time controls, i.e. YYYY-MM-DD. */
|
|
855
|
+
dateFormat: PropTypes.string,
|
|
856
|
+
/** The default interval for the temporal animation, in seconds. */
|
|
857
|
+
defaultAnimationInterval: PropTypes.number,
|
|
858
|
+
/** Default for TimeManager enabled when loading application. `true` or `false` */
|
|
859
|
+
defaultEnabled: PropTypes.bool,
|
|
860
|
+
/** The default number of features that will be requested. */
|
|
861
|
+
defaultFeatureCount: PropTypes.number,
|
|
862
|
+
/** The default step size for the temporal animation, in step units. */
|
|
863
|
+
defaultStepSize: PropTypes.number,
|
|
864
|
+
/** The default step unit for the temporal animation, one of `ms`, `s`, `m`, `d`, `M`, `y`, `10y`, `100y` */
|
|
865
|
+
defaultStepUnit: PropTypes.string,
|
|
866
|
+
/** The default timeline display mode. One of `hidden`, `minimal`, `features`, `layers`. */
|
|
867
|
+
defaultTimelineDisplay: PropTypes.string,
|
|
868
|
+
/** The default timeline mode. One of `fixed`, `infinite`. */
|
|
869
|
+
defaultTimelineMode: PropTypes.string,
|
|
870
|
+
filter: PropTypes.object,
|
|
871
|
+
/** Default window geometry with size, position and docking status. Positive position values (including '0') are related to top (InitialY) and left (InitialX), negative values (including '-0') to bottom (InitialY) and right (InitialX). */
|
|
872
|
+
geometry: PropTypes.shape({
|
|
873
|
+
initialWidth: PropTypes.number,
|
|
874
|
+
initialHeight: PropTypes.number,
|
|
875
|
+
initialX: PropTypes.number,
|
|
876
|
+
initialY: PropTypes.number,
|
|
877
|
+
initiallyDocked: PropTypes.bool
|
|
878
|
+
}),
|
|
879
|
+
layerVisibilities: PropTypes.object,
|
|
880
|
+
layers: PropTypes.array,
|
|
881
|
+
map: PropTypes.object,
|
|
882
|
+
/** The feature marker configuration. */
|
|
883
|
+
markerConfiguration: PropTypes.shape({
|
|
884
|
+
markersAvailable: PropTypes.bool,
|
|
885
|
+
gradient: PropTypes.arrayOf(PropTypes.string),
|
|
886
|
+
markerOffset: PropTypes.array,
|
|
887
|
+
markerPins: PropTypes.bool
|
|
888
|
+
}),
|
|
889
|
+
refreshLayer: PropTypes.func,
|
|
890
|
+
removeLayer: PropTypes.func,
|
|
891
|
+
setCurrentTask: PropTypes.func,
|
|
892
|
+
setLayerDimensions: PropTypes.func,
|
|
893
|
+
/** The available temporal animation step units. */
|
|
894
|
+
stepUnits: PropTypes.arrayOf(PropTypes.string),
|
|
895
|
+
theme: PropTypes.object
|
|
896
|
+
});
|
|
897
|
+
_defineProperty(TimeManager, "defaultProps", {
|
|
898
|
+
cursorFormat: "datetime",
|
|
899
|
+
dateFormat: "YYYY-MM-DD[\n]HH:mm:ss",
|
|
900
|
+
defaultAnimationInterval: 1,
|
|
901
|
+
defaultEnabled: false,
|
|
902
|
+
defaultStepSize: 1,
|
|
903
|
+
defaultStepUnit: "d",
|
|
904
|
+
defaultFeatureCount: 100,
|
|
905
|
+
defaultTimelineMode: "fixed",
|
|
906
|
+
markerConfiguration: {
|
|
907
|
+
markersAvailable: true,
|
|
908
|
+
gradient: ["#f7af7d", "#eacc6e", "#fef89a", "#c5e09b", "#a3d29c", "#7cc096", "#79c8c5", "#34afce"],
|
|
909
|
+
markerOffset: [0, 0],
|
|
910
|
+
markerPins: true
|
|
911
|
+
},
|
|
912
|
+
featureTimelineAvailable: true,
|
|
913
|
+
stepUnits: ["s", "m", "h", "d", "M", "y"],
|
|
914
|
+
geometry: {
|
|
915
|
+
initialWidth: 800,
|
|
916
|
+
initialHeight: 320,
|
|
917
|
+
initiallyDocked: true
|
|
918
|
+
}
|
|
919
|
+
});
|
|
920
|
+
_defineProperty(TimeManager, "defaultState", {
|
|
921
|
+
timeEnabled: false,
|
|
922
|
+
startTime: null,
|
|
923
|
+
endTime: null,
|
|
924
|
+
currentTimestamp: null,
|
|
925
|
+
animationActive: false,
|
|
926
|
+
animationLoop: false,
|
|
927
|
+
animationInterval: 1,
|
|
928
|
+
stepSize: 1,
|
|
929
|
+
stepSizeUnit: 'd',
|
|
930
|
+
// 1 day
|
|
931
|
+
dialogWidth: 0,
|
|
932
|
+
markersEnabled: false,
|
|
933
|
+
markersCanBeEnabled: true,
|
|
934
|
+
timelineDisplay: 'layers',
|
|
935
|
+
featureCount: 100,
|
|
936
|
+
timelineMode: 'continuous',
|
|
937
|
+
timeData: {
|
|
938
|
+
layerDimensions: {},
|
|
939
|
+
values: [],
|
|
940
|
+
attributes: {},
|
|
941
|
+
layers: []
|
|
942
|
+
},
|
|
943
|
+
timeFeatures: null,
|
|
944
|
+
settingsPopup: false,
|
|
945
|
+
visible: false,
|
|
946
|
+
geometry: {
|
|
947
|
+
initialWidth: 900,
|
|
948
|
+
initialHeight: 320,
|
|
949
|
+
initialX: null,
|
|
950
|
+
initialY: null,
|
|
951
|
+
initiallyDocked: false
|
|
952
|
+
}
|
|
953
|
+
});
|
|
954
|
+
var layerVisiblitiesSelector = createSelector([function (state) {
|
|
955
|
+
return state.layers.flat;
|
|
956
|
+
}], function (layers) {
|
|
957
|
+
return layers.filter(function (layer) {
|
|
958
|
+
return layer.type === "wms";
|
|
959
|
+
}).reduce(function (res, layer) {
|
|
960
|
+
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, layer.id, LayerUtils.computeLayerVisibility(layer)));
|
|
961
|
+
}, {});
|
|
962
|
+
});
|
|
963
|
+
var selector = createSelector([function (state) {
|
|
964
|
+
return state;
|
|
965
|
+
}, layerVisiblitiesSelector], function (state, layerVisibilities) {
|
|
966
|
+
return {
|
|
967
|
+
active: state.task.id === "TimeManager",
|
|
968
|
+
layers: state.layers.flat,
|
|
969
|
+
filter: state.layers.filter,
|
|
970
|
+
layerVisibilities: layerVisibilities,
|
|
971
|
+
map: state.map,
|
|
972
|
+
theme: state.theme.current
|
|
973
|
+
};
|
|
974
|
+
});
|
|
975
|
+
export default connect(selector, {
|
|
976
|
+
addLayerFeatures: addLayerFeatures,
|
|
977
|
+
refreshLayer: refreshLayer,
|
|
978
|
+
removeLayer: removeLayer,
|
|
979
|
+
setLayerDimensions: setLayerDimensions,
|
|
980
|
+
setCurrentTask: setCurrentTask,
|
|
981
|
+
setCurrentTaskBlocked: setCurrentTaskBlocked
|
|
982
|
+
})(TimeManager);
|