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.
Files changed (241) hide show
  1. package/actions/display.js +30 -1
  2. package/actions/editing.js +22 -1
  3. package/actions/layerinfo.js +13 -1
  4. package/actions/layers.js +213 -3
  5. package/actions/localConfig.js +58 -1
  6. package/actions/locale.js +21 -1
  7. package/actions/locate.js +26 -1
  8. package/actions/logging.js +10 -1
  9. package/actions/map.js +105 -2
  10. package/actions/measurement.js +12 -1
  11. package/actions/processNotifications.js +37 -1
  12. package/actions/redlining.js +18 -1
  13. package/actions/redliningPick.js +12 -1
  14. package/actions/search.js +12 -1
  15. package/actions/serviceinfo.js +12 -1
  16. package/actions/task.js +55 -3
  17. package/actions/theme.js +339 -19
  18. package/actions/windows.js +164 -5
  19. package/components/AppMenu.js +435 -3
  20. package/components/AttributeForm.js +928 -32
  21. package/components/AttributeTableWidget.js +1105 -13
  22. package/components/AutoEditForm.js +189 -3
  23. package/components/CoordinateDisplayer.js +78 -2
  24. package/components/EditComboField.js +190 -6
  25. package/components/EditUploadField.js +315 -3
  26. package/components/ExportSelection.js +203 -2
  27. package/components/FullscreenSwitcher.js +90 -3
  28. package/components/Icon.js +81 -2
  29. package/components/IdentifyViewer.js +1161 -6
  30. package/components/ImportLayer.js +718 -20
  31. package/components/LayerInfoWindow.js +145 -2
  32. package/components/LinkFeatureForm.js +246 -5
  33. package/components/MapButton.js +88 -2
  34. package/components/MapSelection.js +287 -8
  35. package/components/MessageBar.js +68 -2
  36. package/components/NumericInputWindow.js +359 -2
  37. package/components/PickFeature.js +266 -2
  38. package/components/PluginsContainer.js +227 -8
  39. package/components/PrintSelection.js +620 -49
  40. package/components/ProcessNotifications.js +104 -2
  41. package/components/QtDesignerForm.js +1137 -18
  42. package/components/ResizeableWindow.js +591 -8
  43. package/components/SearchBox.js +1307 -20
  44. package/components/ServiceInfoWindow.js +107 -2
  45. package/components/SideBar.js +204 -4
  46. package/components/StandardApp.js +381 -20
  47. package/components/Swipeable.js +15 -1
  48. package/components/TaskBar.js +85 -2
  49. package/components/ThemeLayersListWindow.js +216 -4
  50. package/components/ThemeList.js +381 -7
  51. package/components/Toolbar.js +106 -2
  52. package/components/WindowManager.js +178 -2
  53. package/components/map/OlLayer.js +257 -6
  54. package/components/map/OlMap.js +405 -5
  55. package/components/map/layers/BingLayer.js +31 -2
  56. package/components/map/layers/GoogleLayer.js +222 -19
  57. package/components/map/layers/GraticuleLayer.js +21 -1
  58. package/components/map/layers/ImageLayer.js +15 -1
  59. package/components/map/layers/MVTLayer.js +52 -2
  60. package/components/map/layers/OSMLayer.js +24 -2
  61. package/components/map/layers/OverlayLayer.js +55 -3
  62. package/components/map/layers/VectorLayer.js +173 -8
  63. package/components/map/layers/WFSLayer.js +220 -6
  64. package/components/map/layers/WMSLayer.js +180 -6
  65. package/components/map/layers/WMTSLayer.js +67 -3
  66. package/components/map/layers/XYZLayer.js +24 -2
  67. package/components/map/layers/index.js +28 -1
  68. package/components/map3d/EditDataset3D.js +190 -3
  69. package/components/map3d/HeightProfile3D.js +402 -3
  70. package/components/map3d/ImportObjects3D.js +162 -2
  71. package/components/map3d/Map3D.js +1304 -38
  72. package/components/map3d/MapControls3D.js +392 -7
  73. package/components/map3d/SearchField3D.js +183 -11
  74. package/components/map3d/View3DSwitcher.js +98 -2
  75. package/components/map3d/drawtool/CreateTool3D.js +174 -4
  76. package/components/map3d/drawtool/EditTool3D.js +590 -6
  77. package/components/map3d/drawtool/NumericInput3D.js +336 -4
  78. package/components/map3d/layers/GeoTIFFLayer3D.js +15 -1
  79. package/components/map3d/layers/VectorLayer3D.js +53 -2
  80. package/components/map3d/layers/WFSLayer3D.js +109 -3
  81. package/components/map3d/layers/WMSLayer3D.js +70 -2
  82. package/components/map3d/layers/WMTSLayer3D.js +27 -3
  83. package/components/map3d/layers/index.js +14 -1
  84. package/components/map3d/utils/FirstPersonControls3D.js +423 -16
  85. package/components/map3d/utils/MiscUtils3D.js +221 -13
  86. package/components/map3d/utils/OrbitControls3D.js +176 -5
  87. package/components/map3d/utils/Tiles3DStyle.js +238 -9
  88. package/components/share/ShareLink.js +54 -2
  89. package/components/share/ShareQRCode.js +62 -2
  90. package/components/share/ShareSocials.js +125 -3
  91. package/components/timeline/FixedTimeline.js +236 -5
  92. package/components/timeline/InfiniteTimeline.js +347 -8
  93. package/components/timeline/TimelineFeaturesSlider.js +439 -5
  94. package/components/widgets/AccordeonWidget.js +96 -2
  95. package/components/widgets/ButtonBar.js +124 -2
  96. package/components/widgets/ColorButton.js +201 -3
  97. package/components/widgets/ComboBox.js +166 -2
  98. package/components/widgets/CopyButton.js +110 -2
  99. package/components/widgets/DateTimeInput.js +100 -3
  100. package/components/widgets/EditableSelect.js +230 -3
  101. package/components/widgets/FileSelector.js +128 -4
  102. package/components/widgets/Input.js +124 -2
  103. package/components/widgets/InputContainer.js +96 -2
  104. package/components/widgets/LayerCatalogWidget.js +219 -3
  105. package/components/widgets/MenuButton.js +157 -1
  106. package/components/widgets/ModalDialog.js +64 -2
  107. package/components/widgets/NavBar.js +119 -2
  108. package/components/widgets/NumberInput.js +226 -4
  109. package/components/widgets/PopupMenu.js +72 -1
  110. package/components/widgets/Primitives.js +6 -1
  111. package/components/widgets/ReCaptchaWidget.js +55 -1
  112. package/components/widgets/SearchWidget.js +255 -2
  113. package/components/widgets/Spinner.js +44 -2
  114. package/components/widgets/SuggestionInput.js +77 -2
  115. package/components/widgets/TextInput.js +308 -2
  116. package/components/widgets/ToggleSwitch.js +85 -2
  117. package/components/widgets/VectorLayerPicker.js +85 -3
  118. package/libs/openlayers.js +225 -5
  119. package/package.json +1 -1
  120. package/plugins/API.js +358 -15
  121. package/plugins/AttributeTable.js +109 -3
  122. package/plugins/Authentication.js +130 -5
  123. package/plugins/BackgroundSwitcher.js +218 -4
  124. package/plugins/Bookmark.js +289 -3
  125. package/plugins/BottomBar.js +298 -4
  126. package/plugins/CookiePopup.js +67 -3
  127. package/plugins/Cyclomedia.js +442 -5
  128. package/plugins/Editing.js +497 -9
  129. package/plugins/FeatureForm.js +366 -4
  130. package/plugins/FeatureSearch.js +458 -3
  131. package/plugins/GeometryDigitizer.js +664 -7
  132. package/plugins/HeightProfile.js +763 -15
  133. package/plugins/Help.js +102 -3
  134. package/plugins/HomeButton.js +80 -3
  135. package/plugins/Identify.js +543 -5
  136. package/plugins/LayerCatalog.js +215 -4
  137. package/plugins/LayerTree.js +1194 -6
  138. package/plugins/LocateButton.js +94 -3
  139. package/plugins/Map.js +320 -16
  140. package/plugins/MapCompare.js +94 -3
  141. package/plugins/MapCopyright.js +127 -5
  142. package/plugins/MapExport.js +613 -20
  143. package/plugins/MapFilter.js +868 -12
  144. package/plugins/MapInfoTooltip.js +277 -3
  145. package/plugins/MapLegend.js +253 -4
  146. package/plugins/MapTip.js +290 -4
  147. package/plugins/Measure.js +220 -4
  148. package/plugins/NewsPopup.js +137 -3
  149. package/plugins/OverviewMap.js +167 -7
  150. package/plugins/Panoramax.js +340 -2
  151. package/plugins/Portal.js +199 -4
  152. package/plugins/Print.js +1231 -15
  153. package/plugins/Redlining.js +750 -6
  154. package/plugins/Reports.js +332 -3
  155. package/plugins/Routing.js +1278 -15
  156. package/plugins/ScratchDrawing.js +173 -5
  157. package/plugins/Settings.js +241 -4
  158. package/plugins/Share.js +198 -3
  159. package/plugins/StartupMarker.js +84 -4
  160. package/plugins/TaskButton.js +88 -3
  161. package/plugins/ThemeSwitcher.js +164 -4
  162. package/plugins/TimeManager.js +971 -10
  163. package/plugins/TopBar.js +300 -7
  164. package/plugins/TourGuide.js +213 -2
  165. package/plugins/ValueTool.js +419 -4
  166. package/plugins/View3D.js +519 -14
  167. package/plugins/ZoomButtons.js +165 -3
  168. package/plugins/map/EditingSupport.js +199 -7
  169. package/plugins/map/LocateSupport.js +260 -4
  170. package/plugins/map/MeasurementSupport.js +216 -8
  171. package/plugins/map/RedliningPickSupport.js +201 -7
  172. package/plugins/map/RedliningSupport.js +726 -17
  173. package/plugins/map/SnapInteraction.js +101 -1
  174. package/plugins/map/SnapSupport.js +210 -2
  175. package/plugins/map/SnappingSupport.js +356 -17
  176. package/plugins/map3d/BackgroundSwitcher3D.js +44 -3
  177. package/plugins/map3d/BottomBar3D.js +118 -3
  178. package/plugins/map3d/Compare3D.js +422 -8
  179. package/plugins/map3d/Draw3D.js +353 -6
  180. package/plugins/map3d/ExportObjects3D.js +393 -18
  181. package/plugins/map3d/HideObjects3D.js +313 -12
  182. package/plugins/map3d/Identify3D.js +283 -12
  183. package/plugins/map3d/LayerTree3D.js +323 -3
  184. package/plugins/map3d/MapCopyright3D.js +128 -5
  185. package/plugins/map3d/MapExport3D.js +590 -10
  186. package/plugins/map3d/MapLight3D.js +553 -6
  187. package/plugins/map3d/Measure3D.js +571 -20
  188. package/plugins/map3d/OverviewMap3D.js +169 -3
  189. package/plugins/map3d/Settings3D.js +73 -3
  190. package/plugins/map3d/TopBar3D.js +207 -9
  191. package/plugins/redlining/RedliningBufferSupport.js +206 -3
  192. package/reducers/display.js +34 -2
  193. package/reducers/editing.js +68 -3
  194. package/reducers/index.js +9 -1
  195. package/reducers/layerinfo.js +26 -2
  196. package/reducers/layers.js +456 -9
  197. package/reducers/localConfig.js +122 -2
  198. package/reducers/locale.js +38 -2
  199. package/reducers/locate.js +40 -2
  200. package/reducers/map.js +176 -5
  201. package/reducers/measurement.js +42 -2
  202. package/reducers/processNotifications.js +49 -2
  203. package/reducers/redlining.js +50 -2
  204. package/reducers/redliningPick.js +27 -2
  205. package/reducers/search.js +20 -1
  206. package/reducers/serviceinfo.js +25 -2
  207. package/reducers/task.js +45 -2
  208. package/reducers/theme.js +51 -2
  209. package/reducers/windows.js +203 -2
  210. package/scripts/dist.sh +1 -1
  211. package/scripts/gen-plugin-docs.js +152 -2
  212. package/scripts/makeIconkit.js +85 -6
  213. package/scripts/themesConfig.js +742 -40
  214. package/scripts/updateTranslations.js +251 -10
  215. package/selectors/searchproviders.js +44 -2
  216. package/stores/StandardStore.js +42 -2
  217. package/utils/ConfigUtils.js +84 -3
  218. package/utils/CoordinatesUtils.js +234 -23
  219. package/utils/DxfUtils.js +237 -11
  220. package/utils/EditingInterface.js +421 -87
  221. package/utils/EditingUtils.js +357 -13
  222. package/utils/ElevationInterface.js +83 -22
  223. package/utils/FeatureStyles.js +429 -5
  224. package/utils/IdentifyUtils.js +443 -7
  225. package/utils/ImageEditor.js +79 -9
  226. package/utils/LayerUtils.js +1516 -50
  227. package/utils/LocaleUtils.js +117 -7
  228. package/utils/MapUtils.js +241 -59
  229. package/utils/MeasureUtils.js +323 -2
  230. package/utils/MiscUtils.js +189 -11
  231. package/utils/PermaLinkUtils.js +429 -6
  232. package/utils/PluginStore.js +27 -1
  233. package/utils/ResourceRegistry.js +15 -1
  234. package/utils/RoutingInterface.js +307 -7
  235. package/utils/SearchProviders.js +722 -19
  236. package/utils/ServiceLayerUtils.js +669 -14
  237. package/utils/Signal.js +32 -2
  238. package/utils/ThemeUtils.js +341 -7
  239. package/utils/VectorLayerUtils.js +589 -15
  240. package/utils/expr_grammar/grammar.js +2239 -2
  241. package/utils/expr_grammar/test.js +65 -3
@@ -1,21 +1,982 @@
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)}function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread()}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.")}function _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r)}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}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}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}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)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e))}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)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t})()}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}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)}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}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}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}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)}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest()}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.")}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}}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}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}}function _arrayWithHoles(r){if(Array.isArray(r))return r}/**
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
- */import React from"react";import{connect}from"react-redux";import dateParser,{Format}from"any-date-parser";import dayjs from"dayjs";import utc from"dayjs/plugin/utc";import isEmpty from"lodash.isempty";import isEqual from"lodash.isequal";import ol from"openlayers";import PropTypes from"prop-types";import{createSelector}from"reselect";import{v4 as uuidv4}from"uuid";import{setLayerDimensions,addLayerFeatures,refreshLayer,removeLayer,LayerRole}from"../actions/layers";import{setCurrentTask,setCurrentTaskBlocked}from"../actions/task";import Icon from"../components/Icon";import ResizeableWindow from"../components/ResizeableWindow";import FixedTimeline from"../components/timeline/FixedTimeline";import InfiniteTimeline from"../components/timeline/InfiniteTimeline";import TimelineFeaturesSlider from"../components/timeline/TimelineFeaturesSlider";import ButtonBar from"../components/widgets/ButtonBar";import NumberInput from"../components/widgets/NumberInput";import ToggleSwitch from"../components/widgets/ToggleSwitch";import IdentifyUtils from"../utils/IdentifyUtils";import LayerUtils from"../utils/LayerUtils";import LocaleUtils from"../utils/LocaleUtils";import VectorLayerUtils from"../utils/VectorLayerUtils";import markerIcon from"../utils/img/marker-icon.png";import"./style/TimeManager.css";dayjs.extend(utc);var DateUnitLabels={"ms":LocaleUtils.trmsg("timemanager.unit.milliseconds"),"s":LocaleUtils.trmsg("timemanager.unit.seconds"),"m":LocaleUtils.trmsg("timemanager.unit.minutes"),"h":LocaleUtils.trmsg("timemanager.unit.hours"),"d":LocaleUtils.trmsg("timemanager.unit.days"),"M":LocaleUtils.trmsg("timemanager.unit.months"),"y":LocaleUtils.trmsg("timemanager.unit.years"),"10y":LocaleUtils.trmsg("timemanager.unit.decade"),"100y":LocaleUtils.trmsg("timemanager.unit.century")};var qgisDateFormat=new Format({// $dateExpr $hour $minute $second $millisecond $zone $offset
8
- 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,// eslint-disable-next-line
9
- handler:function handler(_ref){var _ref2=_slicedToArray(_ref,8),match=_ref2[0],dateExpr=_ref2[1],hour=_ref2[2],minute=_ref2[3],second=_ref2[4],millisecond=_ref2[5],zone=_ref2[6],offset=_ref2[7];var result={};if(dateExpr){result=this.parser.attempt(dateExpr);if(result.invalid){return result}}result.hour=hour;result.minute=minute;if(second){result.second=second}if(millisecond&&millisecond.length>3){result.millisecond=millisecond.slice(0,3)}else if(millisecond){result.millisecond=millisecond}if(offset){result.offset=offset}return result}});dateParser.addFormat(qgisDateFormat);// QGIS server does not return any feature that does not have "enddate" set.
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("9999-01-01 00:00:00");/**
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 xmin=_this.props.map.bbox.bounds[0];var ymin=_this.props.map.bbox.bounds[1];var xmax=_this.props.map.bbox.bounds[2];var ymax=_this.props.map.bbox.bounds[3];var filterGeom=VectorLayerUtils.geoJSONGeomToWkt({type:"Polygon",coordinates:[[[xmin,ymin],[xmax,ymin],[xmax,ymax],[xmin,ymax],[xmin,ymin]]]});var pending=0;var reqUUID=uuidv4();timeData.layers.forEach(function(layer){var sublayerattrs=timeData.attributes[layer.id];var queryLayers=Object.keys(sublayerattrs).join(",");var options={GEOMCENTROID:true,with_htmlcontent:false,feature_count:_this.state.featureCount};var request=IdentifyUtils.buildFilterRequest(layer,queryLayers,filterGeom,_this.props.map,options);IdentifyUtils.sendRequest(request,function(response){if(_this.state.timeFeatures&&_this.state.timeFeatures.reqUUID===reqUUID&&response){var layerFeatures=IdentifyUtils.parseXmlResponse(response,_this.props.map.projection,layer);_this.setState(function(state){return{timeFeatures:{features:_objectSpread(_objectSpread({},state.timeFeatures.features),Object.entries(layerFeatures).reduce(function(res,_ref3){var _ref4=_slicedToArray(_ref3,2),layername=_ref4[0],features=_ref4[1];return _objectSpread(_objectSpread({},res),{},_defineProperty({},layername,features.map(function(feature){var startdate=dateParser.fromString(feature.properties[sublayerattrs[feature.layername][0]]);var enddate=dateParser.fromString(feature.properties[sublayerattrs[feature.layername][1]]);if(enddate&&!enddate.invalid&&enddate.getFullYear()===DUMMY_END_DATE.getFullYear()){enddate=null}return _objectSpread(_objectSpread({},feature),{},{id:feature.layername+"::"+feature.id,properties:_objectSpread(_objectSpread({},feature.properties),{},{__startdate:dayjs.utc(startdate),__enddate:dayjs.utc(enddate)})})})))},{})),attributes:_objectSpread(_objectSpread({},state.timeFeatures.attributes),Object.entries(layerFeatures).reduce(function(res,_ref5){var _ref6=_slicedToArray(_ref5,2),layername=_ref6[0],features=_ref6[1];return _objectSpread(_objectSpread({},res),{},_defineProperty({},layername,Object.keys((features[0]||{properties:{}}).properties)))},{})),pendingRequests:state.timeFeatures.pendingRequests-1}}})}else{_this.setState(function(state){return{timeFeatures:_objectSpread(_objectSpread({},state.timeFeatures),{},{pendingRequests:state.timeFeatures.pendingRequests-1})}})}});++pending});_this.setState({timeFeatures:{features:{},attributes:{},pendingRequests:pending,reqUUID:reqUUID}})});_defineProperty(_this,"markerStyle",function(feature){var style=[];var currentTime=dayjs(_this.state.currentTimestamp);var featprops=feature.getProperties();if(_this.state.timeEnabled&&(featprops.__startdate>currentTime||featprops.__enddate<currentTime)){return style}var offset=_this.props.markerConfiguration.markerOffset;if(_this.props.markerConfiguration.markerPins){style.push(new ol.style.Style({image:new ol.style.Icon({anchor:[0.5,1],anchorXUnits:"fraction",anchorYUnits:"fraction",displacement:offset,src:markerIcon})}))}if(featprops.__startdate.isValid()&&featprops.__enddate.isValid()){var deltaT=_this.state.endTime.diff(_this.state.startTime);var markerStartTime=dayjs(Math.max(_this.state.startTime,featprops.__startdate));var markerEndTime=dayjs(Math.min(_this.state.endTime,featprops.__enddate));var markerMidTime=0.5*(markerStartTime+markerEndTime);var gradBarMaxWidth=192;var gradBarHeight=16;var gradBarWidth=gradBarMaxWidth*markerEndTime.diff(markerStartTime)/deltaT;var canvas=document.createElement("canvas");var context=canvas.getContext("2d");var gradient=context.createLinearGradient(-gradBarWidth*(markerMidTime-_this.state.startTime)/(markerMidTime-markerStartTime),0,gradBarWidth*(_this.state.endTime-markerMidTime)/(markerEndTime-markerMidTime),0);var nStops=_this.props.markerConfiguration.gradient.length;_this.props.markerConfiguration.gradient.forEach(function(stop,idx){gradient.addColorStop(idx/(nStops-1),stop)});style.push(new ol.style.Style({image:new ol.style.RegularShape({fill:new ol.style.Fill({color:gradient}),stroke:new ol.style.Stroke({color:"black",width:1}),points:4,radius:gradBarWidth/Math.SQRT2,radius2:gradBarWidth,angle:0,scale:[1,1/gradBarWidth*gradBarHeight],displacement:[offset[0],offset[1]*gradBarHeight/gradBarWidth-gradBarHeight]})}))}return style});_this.animationTimer=null;_this.updateMapMarkersTimeout=null;TimeManager.defaultState.stepSize=props.defaultStepSize;TimeManager.defaultState.stepSizeUnit=props.defaultStepUnit;TimeManager.defaultState.timelineDisplay=props.defaultTimelineDisplay;TimeManager.defaultState.timeEnabled=props.defaultEnabled;if(!props.stepUnits.includes(TimeManager.defaultState.stepSizeUnit)){TimeManager.defaultState.stepSizeUnit=props.stepUnits[0]}TimeManager.defaultState.animationInterval=props.defaultAnimationInterval;TimeManager.defaultState.featureCount=props.defaultFeatureCount;TimeManager.defaultState.timelineMode=props.defaultTimelineMode;TimeManager.defaultState.timelineDisplay=props.defaultTimelineDisplay;_this.state=_objectSpread(_objectSpread({},_this.state),TimeManager.defaultState);return _this}_inherits(TimeManager,_React$Component);return _createClass(TimeManager,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){var _this2=this;var activated=!prevProps.active&&this.props.active;if(activated){this.setState({visible:true});// Clear task immediately after showing, visibility is controlled by internal state
19
- this.props.setCurrentTask(null)}if(!this.state.visible&&prevState.visible){this.updateLayerTimeDimensions(this.state.timeData,this.state.currentTimestamp);this.setState(TimeManager.defaultState);return}if(!activated&&!this.state.visible){return}if(this.props.theme!==prevProps.theme){this.setState({currentTimestamp:null})}if(activated||!isEqual(this.props.layerVisibilities,prevProps.layerVisibilities)){this.stopAnimation();var timeData={layerDimensions:{},values:new Set,attributes:{},layers:[]};this.props.layers.forEach(function(layer){if(layer.type==="wms"){var layertimeData=LayerUtils.getTimeDimensionValues(layer);if(layertimeData.names.size>0){timeData.layerDimensions[layer.id]=_toConsumableArray(layertimeData.names);layertimeData.values.forEach(function(x){return timeData.values.add(x)});timeData.attributes[layer.id]=_objectSpread(_objectSpread({},timeData.attributes[layer.id]),layertimeData.attributes);// Filter time dimension from layer - object cache in updateTimeFeatures below should query all objects regardless of time
20
- var layerNoTimeDims=_objectSpread({},layer);var layerDimsUC=timeData.layerDimensions[layer.id].map(function(name){return name.toUpperCase()});layerNoTimeDims.dimensionValues=Object.entries(layerNoTimeDims.dimensionValues||{}).reduce(function(res,_ref7){var _ref8=_slicedToArray(_ref7,2),key=_ref8[0],value=_ref8[1];if(layerDimsUC.includes(key)){return res}else{return _objectSpread(_objectSpread({},res),{},_defineProperty({},key,value))}},{});timeData.layers.push(layerNoTimeDims)}}});timeData.values=_toConsumableArray(timeData.values).sort().map(function(d){return dayjs.utc(d)});var startdate=timeData.values.length>0?timeData.values[0].hour(0).minute(0).second(0):null;var enddate=timeData.values.length>0?timeData.values[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)}this.setState(function(state){var _state$currentTimesta;return{timeData:timeData,currentTimestamp:(_state$currentTimesta=state.currentTimestamp)!==null&&_state$currentTimesta!==void 0?_state$currentTimesta:timeData.values.length>0?+timeData.values[0]:null,startTime:startdate,endTime:enddate&&enddate.year()!==DUMMY_END_DATE.getFullYear()?enddate:null}});this.updateTimeFeatures(timeData)}else{if(this.state.currentTimestamp!==prevState.currentTimestamp||this.state.timeEnabled!==prevState.timeEnabled){this.updateLayerTimeDimensions(this.state.timeData,this.state.currentTimestamp)}if(this.state.visible&&this.props.map.bbox!==prevProps.map.bbox){this.updateTimeFeatures(this.state.timeData)}}if(this.props.filter.timeRange!==prevProps.filter.timeRange){this.setState(function(state){var startdate=state.timeData.values.length>0?state.timeData.values[0].hour(0).minute(0).second(0):null;var enddate=state.timeData.values.length>0?state.timeData.values[state.timeData.values.length-1].hour(23).minute(59).second(59):null;if(startdate&&_this2.props.filter.timeRange&&dayjs(_this2.props.filter.timeRange.tstart)>startdate){startdate=dayjs(_this2.props.filter.timeRange.tstart)}if(enddate&&_this2.props.filter.timeRange&&dayjs(_this2.props.filter.timeRange.tend)<enddate){enddate=dayjs(_this2.props.filter.timeRange.tend)}return{startTime:startdate,endTime:enddate&&enddate.year()!==DUMMY_END_DATE.getFullYear()?enddate:null}})}if(this.state.animationActive&&this.state.animationInterval!==prevState.animationInterval){this.stopAnimation()}if(!this.state.markersEnabled&&prevState.markersEnabled){this.props.removeLayer("timemarkers")}else if(this.state.markersEnabled&&this.state.timeFeatures){if(this.state.markersEnabled!==prevState.markersEnabled||this.state.timeFeatures!==prevState.timeFeatures){var layer={id:"timemarkers",role:LayerRole.MARKER,styleFunction:this.markerStyle,rev:+new Date};var features=Object.values(this.state.timeFeatures.features).flat();this.props.addLayerFeatures(layer,features,true)}else if(this.state.currentTimestamp!==prevState.currentTimestamp||this.state.timeEnabled!==prevState.timeEnabled){this.props.refreshLayer(function(layer){return layer.id==="timemarkers"})}}}},{key:"render",value:function render(){if(!this.state.visible){return null}var timeValues=this.state.timeData.values;var body=null;if(timeValues.length<2){body=/*#__PURE__*/React.createElement("div",{role:"body"},/*#__PURE__*/React.createElement("div",{className:"time-manager-notemporaldata"},LocaleUtils.tr("timemanager.notemporaldata")))}else{body=this.renderBody(timeValues)}return/*#__PURE__*/React.createElement(ResizeableWindow,{dockable:"bottom",icon:"clock",initialHeight:this.props.geometry.initialHeight,initialWidth:this.props.geometry.initialWidth,initialX:this.props.geometry.initialX,initialY:this.props.geometry.initialY,initiallyDocked:this.props.geometry.initiallyDocked,onClose:this.onClose,onGeometryChanged:this.dialogGeomChanged,scrollable:true,splitScreenWhenDocked:true,title:LocaleUtils.tr("timemanager.title")},body)}}])}(React.Component);_defineProperty(TimeManager,"propTypes",{active:PropTypes.bool,addLayerFeatures:PropTypes.func,/** The format of the time cursor label. Either `date`, `time` or `datetime`. */cursorFormat:PropTypes.string,/** The date format in the time controls, i.e. YYYY-MM-DD. */dateFormat:PropTypes.string,/** The default interval for the temporal animation, in seconds. */defaultAnimationInterval:PropTypes.number,/** Default for TimeManager enabled when loading application. `true` or `false` */defaultEnabled:PropTypes.bool,/** The default number of features that will be requested. */defaultFeatureCount:PropTypes.number,/** The default step size for the temporal animation, in step units. */defaultStepSize:PropTypes.number,/** The default step unit for the temporal animation, one of `ms`, `s`, `m`, `d`, `M`, `y`, `10y`, `100y` */defaultStepUnit:PropTypes.string,/** The default timeline display mode. One of `hidden`, `minimal`, `features`, `layers`. */defaultTimelineDisplay:PropTypes.string,/** The default timeline mode. One of `fixed`, `infinite`. */defaultTimelineMode:PropTypes.string,filter:PropTypes.object,/** 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). */geometry:PropTypes.shape({initialWidth:PropTypes.number,initialHeight:PropTypes.number,initialX:PropTypes.number,initialY:PropTypes.number,initiallyDocked:PropTypes.bool}),layerVisibilities:PropTypes.object,layers:PropTypes.array,map:PropTypes.object,/** The feature marker configuration. */markerConfiguration:PropTypes.shape({markersAvailable:PropTypes.bool,gradient:PropTypes.arrayOf(PropTypes.string),markerOffset:PropTypes.array,markerPins:PropTypes.bool}),refreshLayer:PropTypes.func,removeLayer:PropTypes.func,setCurrentTask:PropTypes.func,setLayerDimensions:PropTypes.func,/** The available temporal animation step units. */stepUnits:PropTypes.arrayOf(PropTypes.string),theme:PropTypes.object});_defineProperty(TimeManager,"defaultProps",{cursorFormat:"datetime",dateFormat:"YYYY-MM-DD[\n]HH:mm:ss",defaultAnimationInterval:1,defaultEnabled:false,defaultStepSize:1,defaultStepUnit:"d",defaultFeatureCount:100,defaultTimelineMode:"fixed",markerConfiguration:{markersAvailable:true,gradient:["#f7af7d","#eacc6e","#fef89a","#c5e09b","#a3d29c","#7cc096","#79c8c5","#34afce"],markerOffset:[0,0],markerPins:true},featureTimelineAvailable:true,stepUnits:["s","m","h","d","M","y"],geometry:{initialWidth:800,initialHeight:320,initiallyDocked:true}});_defineProperty(TimeManager,"defaultState",{timeEnabled:false,startTime:null,endTime:null,currentTimestamp:null,animationActive:false,animationLoop:false,animationInterval:1,stepSize:1,stepSizeUnit:"d",// 1 day
21
- dialogWidth:0,markersEnabled:false,markersCanBeEnabled:true,timelineDisplay:"layers",featureCount:100,timelineMode:"continuous",timeData:{layerDimensions:{},values:[],attributes:{},layers:[]},timeFeatures:null,settingsPopup:false,visible:false,geometry:{initialWidth:900,initialHeight:320,initialX:null,initialY:null,initiallyDocked:false}});var layerVisiblitiesSelector=createSelector([function(state){return state.layers.flat}],function(layers){return layers.filter(function(layer){return layer.type==="wms"}).reduce(function(res,layer){return _objectSpread(_objectSpread({},res),{},_defineProperty({},layer.id,LayerUtils.computeLayerVisibility(layer)))},{})});var selector=createSelector([function(state){return state},layerVisiblitiesSelector],function(state,layerVisibilities){return{active:state.task.id==="TimeManager",layers:state.layers.flat,filter:state.layers.filter,layerVisibilities:layerVisibilities,map:state.map,theme:state.theme.current}});export default connect(selector,{addLayerFeatures:addLayerFeatures,refreshLayer:refreshLayer,removeLayer:removeLayer,setLayerDimensions:setLayerDimensions,setCurrentTask:setCurrentTask,setCurrentTaskBlocked:setCurrentTaskBlocked})(TimeManager);
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);