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,11 +1,448 @@
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 _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)}/**
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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
+ 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); } }
4
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
5
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
6
+ 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); }
7
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
8
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
10
+ 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); }
11
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
12
+ 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; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
+ 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); }
15
+ /**
2
16
  * Copyright 2024 Sourcepole AG
3
17
  * All rights reserved.
4
18
  *
5
19
  * This source code is licensed under the BSD-style license found in the
6
20
  * LICENSE file in the root directory of this source tree.
7
- */import React from"react";import{connect}from"react-redux";import PropTypes from"prop-types";import{addLayer,addLayerFeatures,changeLayerProperty,removeLayer,LayerRole}from"../actions/layers";import{setCurrentTask}from"../actions/task";import ResizeableWindow from"../components/ResizeableWindow";import Spinner from"../components/widgets/Spinner";import CoordinatesUtils from"../utils/CoordinatesUtils";import LocaleUtils from"../utils/LocaleUtils";import MapUtils from"../utils/MapUtils";import ResourceRegistry from"../utils/ResourceRegistry";import"./style/Cyclomedia.css";var Status={LOGIN:0,INITIALIZING:1,INITIALIZED:2,ERROR:3,LOADPOS:4,HAVEPOS:5};/**
21
+ */
22
+
23
+ import React from 'react';
24
+ import { connect } from 'react-redux';
25
+ import PropTypes from 'prop-types';
26
+ import { addLayer, addLayerFeatures, changeLayerProperty, removeLayer, LayerRole } from '../actions/layers';
27
+ import { setCurrentTask } from '../actions/task';
28
+ import ResizeableWindow from '../components/ResizeableWindow';
29
+ import Spinner from '../components/widgets/Spinner';
30
+ import CoordinatesUtils from '../utils/CoordinatesUtils';
31
+ import LocaleUtils from '../utils/LocaleUtils';
32
+ import MapUtils from '../utils/MapUtils';
33
+ import ResourceRegistry from '../utils/ResourceRegistry';
34
+ import './style/Cyclomedia.css';
35
+ var Status = {
36
+ LOGIN: 0,
37
+ INITIALIZING: 1,
38
+ INITIALIZED: 2,
39
+ ERROR: 3,
40
+ LOADPOS: 4,
41
+ HAVEPOS: 5
42
+ };
43
+
44
+ /**
8
45
  * Cyclomedia integration for QWC2.
9
- */var Cyclomedia=/*#__PURE__*/function(_React$Component){function Cyclomedia(props){var _this;_classCallCheck(this,Cyclomedia);_this=_callSuper(this,Cyclomedia,[props]);_defineProperty(_this,"state",{status:Status.LOGIN,message:"",username:"",password:"",loginFailed:false});_defineProperty(_this,"onClose",function(){_this.props.setCurrentTask(null);_this.setState({status:Status.LOGIN,loginFailed:false});_this.iframe=null});_defineProperty(_this,"setIframeRef",function(iframe){if(iframe&&iframe!==_this.iframe){_this.iframe=iframe;clearInterval(_this.iframePollIntervall);_this.iframePollIntervall=setInterval(function(){return _this.setupIframe(iframe)},500)}});_defineProperty(_this,"setupIframe",function(iframe){if(!iframe.getAttribute("content-set")){if(iframe.contentWindow&&iframe.contentWindow.document){iframe.setAttribute("content-set",true);iframe.contentWindow.document.open();iframe.contentWindow.document.write(_this.cyclomediaIndexHtml());iframe.contentWindow.document.close();_this.iframe=iframe}}else if(!iframe.getAttribute("callback-registered")){if(iframe.contentWindow&&iframe.contentWindow.registerCallbacks){iframe.setAttribute("callback-registered",true);iframe.contentWindow.registerCallbacks(_this.apiInitialized,_this.panoramaPositionChanged,_this.measurementChanged)}}else if(!iframe.getAttribute("init-called")){if(iframe.contentWindow&&iframe.contentWindow.StreetSmartApi){iframe.setAttribute("init-called",true);iframe.contentWindow.initApi()}}else{clearInterval(_this.iframePollIntervall)}});_defineProperty(_this,"apiInitialized",function(success){var message=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";_this.setState({status:success?Status.INITIALIZED:Status.LOGIN,message:message,loginFailed:!success})});_defineProperty(_this,"panoramaPositionChanged",function(posData){if(_this.state.status!==Status.HAVEPOS){_this.setState({status:Status.HAVEPOS})}var scale=50;var angle=posData.hFov/2;var width=Math.sin(angle);var length=Math.sqrt(1-width*width);var size=scale/Math.sqrt(width*length);var coordinates=[[0,0],[size*width*2,0],[size*width,size*length]];var dimensions=[coordinates[1][0]+0.5,coordinates[2][1]+0.5];var canvas=document.createElement("canvas");canvas.width=dimensions[0];canvas.height=dimensions[1];var context=canvas.getContext("2d");context.fillStyle="rgba(255, 0, 0, 0.5)";context.strokeStyle="#FF0000";context.lineWidth=1;context.beginPath();context.moveTo(coordinates[0][0],coordinates[0][1]);coordinates.slice(1).forEach(function(coo){return context.lineTo(coo[0],coo[1])});context.closePath();context.fill();ResourceRegistry.addResource("cyclomedia-cone",context.canvas.toDataURL());var feature={geometry:{type:"Point",coordinates:posData.pos},crs:posData.crs,styleName:"image",styleOptions:{img:"cyclomedia-cone",rotation:posData.yaw,size:dimensions}};var layer={id:"cyclomedia-cone",role:LayerRole.MARKER};_this.props.addLayerFeatures(layer,[feature],true)});_defineProperty(_this,"measurementChanged",function(measurement){if(_this.props.displayMeasurements){if(measurement){var layer={id:"cyclomedia-measurements",role:LayerRole.MARKER,crs:measurement.crs.properties.name,styleOptions:{strokeColor:"red",strokeWidth:4,fillColor:[255,0,0,0.25],strokeDash:[]}};_this.props.addLayerFeatures(layer,measurement.features,true)}else{_this.props.removeLayer("cyclomedia-measurements")}}});_defineProperty(_this,"cyclomediaIndexHtml",function(){var supportedLang=["de","en-GB","en-US","fi","fr","nl","tr","pl"];var lang=LocaleUtils.lang();if(supportedLang.indexOf(lang)<0){lang=lang.slice(0,2);if(supportedLang.indexOf(lang)<0){lang="en-US"}}var loginOauth=!!_this.props.clientId&&!_this.state.loginFailed;return"\n <!DOCTYPE html>\n <html>\n <head>\n <script type=\"text/javascript\" src=\"https://unpkg.com/react@16.12.0/umd/react.production.min.js\"></script>\n <script type=\"text/javascript\" src=\"https://unpkg.com/react-dom@16.12.0/umd/react-dom.production.min.js\"></script>\n <script type=\"text/javascript\" src=\"https://streetsmart.cyclomedia.com/api/v".concat(_this.props.cyclomediaVersion,"/StreetSmartApi.js\"></script>\n <script type=\"text/javascript\">\n let apiInitialized = false;\n let initCallback = null;\n let posCallback = null;\n let measureCallback = null;\n\n function initApi() {\n StreetSmartApi.init({\n targetElement: document.getElementById(\"streetsmartApi\"),\n username: \"").concat(_this.state.username||undefined,"\",\n password: \"").concat(_this.state.password||undefined,"\",\n apiKey: \"").concat(_this.props.apikey,"\",\n clientId: \"").concat(_this.props.clientId,"\",\n loginOauth: ").concat(loginOauth,",\n loginRedirectUri: \"").concat(_this.props.loginRedirectUri,"\",\n logoutRedirectUri: \"").concat(_this.props.logoutRedirectUri,"\",\n srs: \"").concat(_this.props.projection,"\",\n locale: \"").concat(lang,"\",\n configurationUrl: 'https://atlas.cyclomedia.com/configuration',\n addressSettings: {\n locale: \"us\",\n database: \"Nokia\"\n }\n }).then(() => {\n apiInitialized = true;\n if (initCallback) {\n initCallback(true);\n }\n }, (e) => {\n apiInitialized = false;\n if (initCallback) {\n initCallback(false, e.message);\n }\n });\n }\n function openImage(posStr, crs) {\n if (!apiInitialized) {\n return;\n }\n StreetSmartApi.open(posStr, {\n viewerType: StreetSmartApi.ViewerType.PANORAMA,\n srs: crs,\n panoramaViewer: {\n closable: false,\n maximizable: true,\n replace: true,\n recordingsVisible: true,\n navbarVisible: true,\n timeTravelVisible: true,\n measureTypeButtonVisible: true,\n measureTypeButtonStart: true,\n measureTypeButtonToggle: true,\n },\n }).then((result) => {\n if (result && result[0]){\n window.panoramaViewer = result[0];\n window.panoramaViewer.on(StreetSmartApi.Events.panoramaViewer.IMAGE_CHANGE, changeView);\n window.panoramaViewer.on(StreetSmartApi.Events.panoramaViewer.VIEW_CHANGE, changeView);\n StreetSmartApi.on(StreetSmartApi.Events.measurement.MEASUREMENT_CHANGED, changeMeasurement);\n StreetSmartApi.on(StreetSmartApi.Events.measurement.MEASUREMENT_STOPPED, stopMeasurement);\n }\n }).catch((reason) => {\n console.log('Failed to create component(s) through API: ' + reason);\n });\n }\n function changeView() {\n if (posCallback) {\n const recording = window.panoramaViewer.getRecording();\n const orientation = window.panoramaViewer.getOrientation();\n const pos = recording.xyz;\n const posData = {\n pos: [pos[0], pos[1]],\n crs: recording.srs,\n yaw: orientation.yaw * Math.PI / 180,\n hFov: orientation.hFov * Math.PI / 180.0\n }\n posCallback(posData);\n }\n }\n function changeMeasurement(e) {\n measureCallback(e.detail.activeMeasurement);\n }\n function stopMeasurement() {\n measureCallback(null);\n }\n function registerCallbacks(_initCallback, _posCallback, _measureCallback) {\n initCallback = _initCallback;\n posCallback = _posCallback;\n measureCallback = _measureCallback;\n }\n </script>\n <style>\n html, body, #streetsmartApi {height: 100%;}\n </style>\n </head>\n <body style=\"margin: 0\">\n <div id=\"streetsmartApi\">\n </div>\n </body>\n </html>\n ")});_defineProperty(_this,"addRecordingsWFS",function(){var layer={id:"cyclomedia-recordings",type:"wfs",loader:function loader(vectorSource,extent,resolution,projection,success,failure){var bbox=CoordinatesUtils.reprojectBbox(extent,projection.getCode(),_this.props.mapCrs);var bboxstr=bbox.join(",");var reqUrl="https://atlasapi.cyclomedia.com/api/recording/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=atlas:Recording&srsname=".concat(_this.props.mapCrs,"&bbox=").concat(bboxstr,"&maxFeatures=10000000");var xhr=new XMLHttpRequest;xhr.open("GET",reqUrl);xhr.setRequestHeader("Authorization","Basic "+btoa(_this.state.username+":"+_this.state.password));var onError=function onError(){vectorSource.removeLoadedExtent(extent);failure()};xhr.onerror=onError;xhr.onload=function(){if(xhr.status===200){var features=vectorSource.getFormat().readFeatures(xhr.responseText,{dataProjection:_this.props.mapCrs,featureProjection:projection.getCode()});vectorSource.addFeatures(features);success(features)}else{onError()}};xhr.send()},name:"atlas:Recording",version:"1.1.0",projection:_this.props.mapCrs,formats:["text/xml; subtype=gml/3.1.1"],invertAxisOrientation:true,role:LayerRole.SELECTION,color:"#6666FF",visibility:_this.props.mapScale<=_this.props.maxMapScale};_this.props.addLayer(layer)});_defineProperty(_this,"queryPoint",function(prevProps){if(_this.props.click===prevProps.click){return null}var cmFeature=_this.props.click.features.find(function(feature){return feature.layerId==="cyclomedia-recordings"});return cmFeature?cmFeature.geometry.coordinates:null});_this.iframe=null;_this.iframePollIntervall=null;if(props.credentialUserInfoFields){_this.state.username=props.userInfos[props.credentialUserInfoFields.username];_this.state.password=props.userInfos[props.credentialUserInfoFields.password]}return _this}_inherits(Cyclomedia,_React$Component);return _createClass(Cyclomedia,[{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){if(!prevProps.active&&this.props.active){this.setState({status:this.props.clientId?Status.INITIALIZING:Status.LOGIN,loginFailed:false})}else if(prevProps.active&&!this.props.active||prevProps.theme&&!this.props.theme){this.onClose()}// Load WFS when loading
10
- if(this.state.status===Status.INITIALIZING&&prevState.status<Status.INITIALIZING){this.addRecordingsWFS()}// Handle map click events
11
- if((this.state.status===Status.INITIALIZED||this.state.status===Status.HAVEPOS)&&this.iframe){var clickPoint=this.queryPoint(prevProps);if(clickPoint){var posStr=clickPoint[0]+","+clickPoint[1];this.iframe.contentWindow.openImage(posStr,this.props.mapCrs);if(this.state.status!==Status.LOADPOS){this.setState({status:Status.LOADPOS});this.props.removeLayer("cyclomedia-cone");this.props.removeLayer("cyclomedia-measurements");ResourceRegistry.removeResource("cyclomedia-cone")}}}if(this.props.active&&this.props.mapScale!==prevProps.mapScale){this.props.changeLayerProperty("cyclomedia-recordings","visibility",this.props.mapScale<=this.props.maxMapScale)}if(this.state.status===Status.LOGIN&&prevState.status>Status.LOGIN){this.props.removeLayer("cyclomedia-recordings");this.props.removeLayer("cyclomedia-cone");this.props.removeLayer("cyclomedia-measurements");ResourceRegistry.removeResource("cyclomedia-cone")}}},{key:"render",value:function render(){var _this2=this;if(!this.props.active){return null}var overlay=null;if(this.state.status===Status.LOGIN){overlay=/*#__PURE__*/React.createElement("div",{className:"cyclomedia-body-overlay"},/*#__PURE__*/React.createElement("div",{className:"cyclomedia-login"},/*#__PURE__*/React.createElement("table",null,/*#__PURE__*/React.createElement("tbody",null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,"Username:"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("input",{onChange:function onChange(ev){return _this2.setState({username:ev.target.value})},type:"text",value:this.state.username}))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,"Password:"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("input",{onChange:function onChange(ev){return _this2.setState({password:ev.target.value})},type:"password",value:this.state.password}))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",{colSpan:"2"},/*#__PURE__*/React.createElement("button",{className:"button",disabled:!this.state.username,onClick:function onClick(){return _this2.setState({status:Status.INITIALIZING})},type:"button"},LocaleUtils.tr("cyclomedia.login")))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",{className:"cyclomedia-login-message",colSpan:"2"},this.state.message))))))}else if(this.state.status===Status.INITIALIZING){overlay=/*#__PURE__*/React.createElement("div",{className:"cyclomedia-body-overlay"},/*#__PURE__*/React.createElement(Spinner,null),/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("cyclomedia.initializing")))}else if(this.state.status===Status.ERROR){overlay=/*#__PURE__*/React.createElement("div",{className:"cyclomedia-body-overlay"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("cyclomedia.loaderror")))}else if(this.state.status===Status.INITIALIZED){overlay=/*#__PURE__*/React.createElement("div",{className:"cyclomedia-body-overlay"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("cyclomedia.clickonmap")))}else if(this.state.status===Status.LOADPOS){overlay=/*#__PURE__*/React.createElement("div",{className:"cyclomedia-body-overlay"},/*#__PURE__*/React.createElement(Spinner,null),/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("cyclomedia.loading")))}return/*#__PURE__*/React.createElement(ResizeableWindow,{dockable:this.props.geometry.side,icon:"cyclomedia",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,splitScreenWhenDocked:true,title:LocaleUtils.tr("cyclomedia.title"),usePortal:false},/*#__PURE__*/React.createElement("div",{className:"cyclomedia-body",role:"body"},this.props.mapScale>this.props.maxMapScale&&this.state.status>Status.LOGIN?/*#__PURE__*/React.createElement("div",{className:"cyclomedia-scale-hint"},LocaleUtils.tr("cyclomedia.scalehint",this.props.maxMapScale)):null,this.state.status>Status.LOGIN?/*#__PURE__*/React.createElement("iframe",{className:"cyclomedia-frame",onLoad:function onLoad(ev){return _this2.setupIframe(ev.target)},ref:function ref(el){return _this2.setIframeRef(el)}}):null,overlay))}}])}(React.Component);_defineProperty(Cyclomedia,"propTypes",{active:PropTypes.bool,addLayer:PropTypes.func,addLayerFeatures:PropTypes.func,/** The Cyclomedia API key */apikey:PropTypes.string,changeLayerProperty:PropTypes.func,click:PropTypes.object,/** OAuth client ID. */clientId:PropTypes.string,/** Fields from user_infos which contain username and password which will be pre-inserted into the login form. */credentialUserInfoFields:PropTypes.shape({username:PropTypes.string,password:PropTypes.string}),/** The cyclomedia version. */cyclomediaVersion:PropTypes.string,/** Whether to display Cyclomedia measurement geometries on the map. */displayMeasurements:PropTypes.bool,/** 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,side:PropTypes.string}),/** The relative path to the redirect login handling of oauth. */loginRedirectUri:PropTypes.string,/** The relative path to the redirect logout handling of oauth. */logoutRedirectUri:PropTypes.string,mapCrs:PropTypes.string,mapScale:PropTypes.number,/** The maximum map scale above which the recordings WFS won't be displayed. */maxMapScale:PropTypes.number,/** The projection to use for Cyclomedia. */projection:PropTypes.string,removeLayer:PropTypes.func,setCurrentTask:PropTypes.func,theme:PropTypes.object,userInfos:PropTypes.object});_defineProperty(Cyclomedia,"defaultProps",{cyclomediaVersion:"24.1",displayMeasurements:true,geometry:{initialWidth:480,initialHeight:640,initialX:0,initialY:0,initiallyDocked:false,side:"left"},maxMapScale:5000,projection:"EPSG:3857"});export default connect(function(state){return{active:state.task.id==="Cyclomedia",click:state.map.click,mapCrs:state.map.projection,mapScale:MapUtils.computeForZoom(state.map.scales,state.map.zoom),theme:state.theme.current,userInfos:state.localConfig.user_infos}},{addLayer:addLayer,addLayerFeatures:addLayerFeatures,changeLayerProperty:changeLayerProperty,removeLayer:removeLayer,setCurrentTask:setCurrentTask})(Cyclomedia);
46
+ */
47
+ var Cyclomedia = /*#__PURE__*/function (_React$Component) {
48
+ function Cyclomedia(props) {
49
+ var _this;
50
+ _classCallCheck(this, Cyclomedia);
51
+ _this = _callSuper(this, Cyclomedia, [props]);
52
+ _defineProperty(_this, "state", {
53
+ status: Status.LOGIN,
54
+ message: "",
55
+ username: "",
56
+ password: "",
57
+ loginFailed: false
58
+ });
59
+ _defineProperty(_this, "onClose", function () {
60
+ _this.props.setCurrentTask(null);
61
+ _this.setState({
62
+ status: Status.LOGIN,
63
+ loginFailed: false
64
+ });
65
+ _this.iframe = null;
66
+ });
67
+ _defineProperty(_this, "setIframeRef", function (iframe) {
68
+ if (iframe && iframe !== _this.iframe) {
69
+ _this.iframe = iframe;
70
+ clearInterval(_this.iframePollIntervall);
71
+ _this.iframePollIntervall = setInterval(function () {
72
+ return _this.setupIframe(iframe);
73
+ }, 500);
74
+ }
75
+ });
76
+ _defineProperty(_this, "setupIframe", function (iframe) {
77
+ if (!iframe.getAttribute("content-set")) {
78
+ if (iframe.contentWindow && iframe.contentWindow.document) {
79
+ iframe.setAttribute("content-set", true);
80
+ iframe.contentWindow.document.open();
81
+ iframe.contentWindow.document.write(_this.cyclomediaIndexHtml());
82
+ iframe.contentWindow.document.close();
83
+ _this.iframe = iframe;
84
+ }
85
+ } else if (!iframe.getAttribute("callback-registered")) {
86
+ if (iframe.contentWindow && iframe.contentWindow.registerCallbacks) {
87
+ iframe.setAttribute("callback-registered", true);
88
+ iframe.contentWindow.registerCallbacks(_this.apiInitialized, _this.panoramaPositionChanged, _this.measurementChanged);
89
+ }
90
+ } else if (!iframe.getAttribute("init-called")) {
91
+ if (iframe.contentWindow && iframe.contentWindow.StreetSmartApi) {
92
+ iframe.setAttribute("init-called", true);
93
+ iframe.contentWindow.initApi();
94
+ }
95
+ } else {
96
+ clearInterval(_this.iframePollIntervall);
97
+ }
98
+ });
99
+ _defineProperty(_this, "apiInitialized", function (success) {
100
+ var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
101
+ _this.setState({
102
+ status: success ? Status.INITIALIZED : Status.LOGIN,
103
+ message: message,
104
+ loginFailed: !success
105
+ });
106
+ });
107
+ _defineProperty(_this, "panoramaPositionChanged", function (posData) {
108
+ if (_this.state.status !== Status.HAVEPOS) {
109
+ _this.setState({
110
+ status: Status.HAVEPOS
111
+ });
112
+ }
113
+ var scale = 50;
114
+ var angle = posData.hFov / 2.0;
115
+ var width = Math.sin(angle);
116
+ var length = Math.sqrt(1.0 - width * width);
117
+ var size = scale / Math.sqrt(width * length);
118
+ var coordinates = [[0, 0], [size * width * 2, 0], [size * width, size * length]];
119
+ var dimensions = [coordinates[1][0] + 0.5, coordinates[2][1] + 0.5];
120
+ var canvas = document.createElement('canvas');
121
+ canvas.width = dimensions[0];
122
+ canvas.height = dimensions[1];
123
+ var context = canvas.getContext('2d');
124
+ context.fillStyle = 'rgba(255, 0, 0, 0.5)';
125
+ context.strokeStyle = '#FF0000';
126
+ context.lineWidth = 1;
127
+ context.beginPath();
128
+ context.moveTo(coordinates[0][0], coordinates[0][1]);
129
+ coordinates.slice(1).forEach(function (coo) {
130
+ return context.lineTo(coo[0], coo[1]);
131
+ });
132
+ context.closePath();
133
+ context.fill();
134
+ ResourceRegistry.addResource("cyclomedia-cone", context.canvas.toDataURL());
135
+ var feature = {
136
+ geometry: {
137
+ type: 'Point',
138
+ coordinates: posData.pos
139
+ },
140
+ crs: posData.crs,
141
+ styleName: 'image',
142
+ styleOptions: {
143
+ img: "cyclomedia-cone",
144
+ rotation: posData.yaw,
145
+ size: dimensions
146
+ }
147
+ };
148
+ var layer = {
149
+ id: "cyclomedia-cone",
150
+ role: LayerRole.MARKER
151
+ };
152
+ _this.props.addLayerFeatures(layer, [feature], true);
153
+ });
154
+ _defineProperty(_this, "measurementChanged", function (measurement) {
155
+ if (_this.props.displayMeasurements) {
156
+ if (measurement) {
157
+ var layer = {
158
+ id: "cyclomedia-measurements",
159
+ role: LayerRole.MARKER,
160
+ crs: measurement.crs.properties.name,
161
+ styleOptions: {
162
+ strokeColor: 'red',
163
+ strokeWidth: 4,
164
+ fillColor: [255, 0, 0, 0.25],
165
+ strokeDash: []
166
+ }
167
+ };
168
+ _this.props.addLayerFeatures(layer, measurement.features, true);
169
+ } else {
170
+ _this.props.removeLayer("cyclomedia-measurements");
171
+ }
172
+ }
173
+ });
174
+ _defineProperty(_this, "cyclomediaIndexHtml", function () {
175
+ var supportedLang = ["de", "en-GB", "en-US", "fi", "fr", "nl", "tr", "pl"];
176
+ var lang = LocaleUtils.lang();
177
+ if (supportedLang.indexOf(lang) < 0) {
178
+ lang = lang.slice(0, 2);
179
+ if (supportedLang.indexOf(lang) < 0) {
180
+ lang = "en-US";
181
+ }
182
+ }
183
+ var loginOauth = !!_this.props.clientId && !_this.state.loginFailed;
184
+ return "\n <!DOCTYPE html>\n <html>\n <head>\n <script type=\"text/javascript\" src=\"https://unpkg.com/react@16.12.0/umd/react.production.min.js\"></script>\n <script type=\"text/javascript\" src=\"https://unpkg.com/react-dom@16.12.0/umd/react-dom.production.min.js\"></script>\n <script type=\"text/javascript\" src=\"https://streetsmart.cyclomedia.com/api/v".concat(_this.props.cyclomediaVersion, "/StreetSmartApi.js\"></script>\n <script type=\"text/javascript\">\n let apiInitialized = false;\n let initCallback = null;\n let posCallback = null;\n let measureCallback = null;\n\n function initApi() {\n StreetSmartApi.init({\n targetElement: document.getElementById(\"streetsmartApi\"),\n username: \"").concat(_this.state.username || undefined, "\",\n password: \"").concat(_this.state.password || undefined, "\",\n apiKey: \"").concat(_this.props.apikey, "\",\n clientId: \"").concat(_this.props.clientId, "\",\n loginOauth: ").concat(loginOauth, ",\n loginRedirectUri: \"").concat(_this.props.loginRedirectUri, "\",\n logoutRedirectUri: \"").concat(_this.props.logoutRedirectUri, "\",\n srs: \"").concat(_this.props.projection, "\",\n locale: \"").concat(lang, "\",\n configurationUrl: 'https://atlas.cyclomedia.com/configuration',\n addressSettings: {\n locale: \"us\",\n database: \"Nokia\"\n }\n }).then(() => {\n apiInitialized = true;\n if (initCallback) {\n initCallback(true);\n }\n }, (e) => {\n apiInitialized = false;\n if (initCallback) {\n initCallback(false, e.message);\n }\n });\n }\n function openImage(posStr, crs) {\n if (!apiInitialized) {\n return;\n }\n StreetSmartApi.open(posStr, {\n viewerType: StreetSmartApi.ViewerType.PANORAMA,\n srs: crs,\n panoramaViewer: {\n closable: false,\n maximizable: true,\n replace: true,\n recordingsVisible: true,\n navbarVisible: true,\n timeTravelVisible: true,\n measureTypeButtonVisible: true,\n measureTypeButtonStart: true,\n measureTypeButtonToggle: true,\n },\n }).then((result) => {\n if (result && result[0]){\n window.panoramaViewer = result[0];\n window.panoramaViewer.on(StreetSmartApi.Events.panoramaViewer.IMAGE_CHANGE, changeView);\n window.panoramaViewer.on(StreetSmartApi.Events.panoramaViewer.VIEW_CHANGE, changeView);\n StreetSmartApi.on(StreetSmartApi.Events.measurement.MEASUREMENT_CHANGED, changeMeasurement);\n StreetSmartApi.on(StreetSmartApi.Events.measurement.MEASUREMENT_STOPPED, stopMeasurement);\n }\n }).catch((reason) => {\n console.log('Failed to create component(s) through API: ' + reason);\n });\n }\n function changeView() {\n if (posCallback) {\n const recording = window.panoramaViewer.getRecording();\n const orientation = window.panoramaViewer.getOrientation();\n const pos = recording.xyz;\n const posData = {\n pos: [pos[0], pos[1]],\n crs: recording.srs,\n yaw: orientation.yaw * Math.PI / 180,\n hFov: orientation.hFov * Math.PI / 180.0\n }\n posCallback(posData);\n }\n }\n function changeMeasurement(e) {\n measureCallback(e.detail.activeMeasurement);\n }\n function stopMeasurement() {\n measureCallback(null);\n }\n function registerCallbacks(_initCallback, _posCallback, _measureCallback) {\n initCallback = _initCallback;\n posCallback = _posCallback;\n measureCallback = _measureCallback;\n }\n </script>\n <style>\n html, body, #streetsmartApi {height: 100%;}\n </style>\n </head>\n <body style=\"margin: 0\">\n <div id=\"streetsmartApi\">\n </div>\n </body>\n </html>\n ");
185
+ });
186
+ _defineProperty(_this, "addRecordingsWFS", function () {
187
+ var layer = {
188
+ id: 'cyclomedia-recordings',
189
+ type: 'wfs',
190
+ loader: function loader(vectorSource, extent, resolution, projection, success, failure) {
191
+ var bbox = CoordinatesUtils.reprojectBbox(extent, projection.getCode(), _this.props.mapCrs);
192
+ var bboxstr = bbox.join(",");
193
+ var reqUrl = "https://atlasapi.cyclomedia.com/api/recording/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=atlas:Recording&srsname=".concat(_this.props.mapCrs, "&bbox=").concat(bboxstr, "&maxFeatures=10000000");
194
+ var xhr = new XMLHttpRequest();
195
+ xhr.open('GET', reqUrl);
196
+ xhr.setRequestHeader("Authorization", "Basic " + btoa(_this.state.username + ":" + _this.state.password));
197
+ var onError = function onError() {
198
+ vectorSource.removeLoadedExtent(extent);
199
+ failure();
200
+ };
201
+ xhr.onerror = onError;
202
+ xhr.onload = function () {
203
+ if (xhr.status === 200) {
204
+ var features = vectorSource.getFormat().readFeatures(xhr.responseText, {
205
+ dataProjection: _this.props.mapCrs,
206
+ featureProjection: projection.getCode()
207
+ });
208
+ vectorSource.addFeatures(features);
209
+ success(features);
210
+ } else {
211
+ onError();
212
+ }
213
+ };
214
+ xhr.send();
215
+ },
216
+ name: 'atlas:Recording',
217
+ version: '1.1.0',
218
+ projection: _this.props.mapCrs,
219
+ formats: ['text/xml; subtype=gml/3.1.1'],
220
+ invertAxisOrientation: true,
221
+ role: LayerRole.SELECTION,
222
+ color: '#6666FF',
223
+ visibility: _this.props.mapScale <= _this.props.maxMapScale
224
+ };
225
+ _this.props.addLayer(layer);
226
+ });
227
+ _defineProperty(_this, "queryPoint", function (prevProps) {
228
+ if (_this.props.click === prevProps.click) {
229
+ return null;
230
+ }
231
+ var cmFeature = _this.props.click.features.find(function (feature) {
232
+ return feature.layerId === 'cyclomedia-recordings';
233
+ });
234
+ return cmFeature ? cmFeature.geometry.coordinates : null;
235
+ });
236
+ _this.iframe = null;
237
+ _this.iframePollIntervall = null;
238
+ if (props.credentialUserInfoFields) {
239
+ _this.state.username = props.userInfos[props.credentialUserInfoFields.username];
240
+ _this.state.password = props.userInfos[props.credentialUserInfoFields.password];
241
+ }
242
+ return _this;
243
+ }
244
+ _inherits(Cyclomedia, _React$Component);
245
+ return _createClass(Cyclomedia, [{
246
+ key: "componentDidUpdate",
247
+ value: function componentDidUpdate(prevProps, prevState) {
248
+ if (!prevProps.active && this.props.active) {
249
+ this.setState({
250
+ status: this.props.clientId ? Status.INITIALIZING : Status.LOGIN,
251
+ loginFailed: false
252
+ });
253
+ } else if (prevProps.active && !this.props.active || prevProps.theme && !this.props.theme) {
254
+ this.onClose();
255
+ }
256
+ // Load WFS when loading
257
+ if (this.state.status === Status.INITIALIZING && prevState.status < Status.INITIALIZING) {
258
+ this.addRecordingsWFS();
259
+ }
260
+ // Handle map click events
261
+ if ((this.state.status === Status.INITIALIZED || this.state.status === Status.HAVEPOS) && this.iframe) {
262
+ var clickPoint = this.queryPoint(prevProps);
263
+ if (clickPoint) {
264
+ var posStr = clickPoint[0] + "," + clickPoint[1];
265
+ this.iframe.contentWindow.openImage(posStr, this.props.mapCrs);
266
+ if (this.state.status !== Status.LOADPOS) {
267
+ this.setState({
268
+ status: Status.LOADPOS
269
+ });
270
+ this.props.removeLayer('cyclomedia-cone');
271
+ this.props.removeLayer('cyclomedia-measurements');
272
+ ResourceRegistry.removeResource("cyclomedia-cone");
273
+ }
274
+ }
275
+ }
276
+ if (this.props.active && this.props.mapScale !== prevProps.mapScale) {
277
+ this.props.changeLayerProperty('cyclomedia-recordings', 'visibility', this.props.mapScale <= this.props.maxMapScale);
278
+ }
279
+ if (this.state.status === Status.LOGIN && prevState.status > Status.LOGIN) {
280
+ this.props.removeLayer('cyclomedia-recordings');
281
+ this.props.removeLayer('cyclomedia-cone');
282
+ this.props.removeLayer('cyclomedia-measurements');
283
+ ResourceRegistry.removeResource("cyclomedia-cone");
284
+ }
285
+ }
286
+ }, {
287
+ key: "render",
288
+ value: function render() {
289
+ var _this2 = this;
290
+ if (!this.props.active) {
291
+ return null;
292
+ }
293
+ var overlay = null;
294
+ if (this.state.status === Status.LOGIN) {
295
+ overlay = /*#__PURE__*/React.createElement("div", {
296
+ className: "cyclomedia-body-overlay"
297
+ }, /*#__PURE__*/React.createElement("div", {
298
+ className: "cyclomedia-login"
299
+ }, /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "Username:"), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("input", {
300
+ onChange: function onChange(ev) {
301
+ return _this2.setState({
302
+ username: ev.target.value
303
+ });
304
+ },
305
+ type: "text",
306
+ value: this.state.username
307
+ }))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, "Password:"), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("input", {
308
+ onChange: function onChange(ev) {
309
+ return _this2.setState({
310
+ password: ev.target.value
311
+ });
312
+ },
313
+ type: "password",
314
+ value: this.state.password
315
+ }))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
316
+ colSpan: "2"
317
+ }, /*#__PURE__*/React.createElement("button", {
318
+ className: "button",
319
+ disabled: !this.state.username,
320
+ onClick: function onClick() {
321
+ return _this2.setState({
322
+ status: Status.INITIALIZING
323
+ });
324
+ },
325
+ type: "button"
326
+ }, LocaleUtils.tr("cyclomedia.login")))), /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
327
+ className: "cyclomedia-login-message",
328
+ colSpan: "2"
329
+ }, this.state.message))))));
330
+ } else if (this.state.status === Status.INITIALIZING) {
331
+ overlay = /*#__PURE__*/React.createElement("div", {
332
+ className: "cyclomedia-body-overlay"
333
+ }, /*#__PURE__*/React.createElement(Spinner, null), /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("cyclomedia.initializing")));
334
+ } else if (this.state.status === Status.ERROR) {
335
+ overlay = /*#__PURE__*/React.createElement("div", {
336
+ className: "cyclomedia-body-overlay"
337
+ }, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("cyclomedia.loaderror")));
338
+ } else if (this.state.status === Status.INITIALIZED) {
339
+ overlay = /*#__PURE__*/React.createElement("div", {
340
+ className: "cyclomedia-body-overlay"
341
+ }, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("cyclomedia.clickonmap")));
342
+ } else if (this.state.status === Status.LOADPOS) {
343
+ overlay = /*#__PURE__*/React.createElement("div", {
344
+ className: "cyclomedia-body-overlay"
345
+ }, /*#__PURE__*/React.createElement(Spinner, null), /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("cyclomedia.loading")));
346
+ }
347
+ return /*#__PURE__*/React.createElement(ResizeableWindow, {
348
+ dockable: this.props.geometry.side,
349
+ icon: "cyclomedia",
350
+ initialHeight: this.props.geometry.initialHeight,
351
+ initialWidth: this.props.geometry.initialWidth,
352
+ initialX: this.props.geometry.initialX,
353
+ initialY: this.props.geometry.initialY,
354
+ initiallyDocked: this.props.geometry.initiallyDocked,
355
+ onClose: this.onClose,
356
+ splitScreenWhenDocked: true,
357
+ title: LocaleUtils.tr("cyclomedia.title"),
358
+ usePortal: false
359
+ }, /*#__PURE__*/React.createElement("div", {
360
+ className: "cyclomedia-body",
361
+ role: "body"
362
+ }, this.props.mapScale > this.props.maxMapScale && this.state.status > Status.LOGIN ? /*#__PURE__*/React.createElement("div", {
363
+ className: "cyclomedia-scale-hint"
364
+ }, LocaleUtils.tr("cyclomedia.scalehint", this.props.maxMapScale)) : null, this.state.status > Status.LOGIN ? /*#__PURE__*/React.createElement("iframe", {
365
+ className: "cyclomedia-frame",
366
+ onLoad: function onLoad(ev) {
367
+ return _this2.setupIframe(ev.target);
368
+ },
369
+ ref: function ref(el) {
370
+ return _this2.setIframeRef(el);
371
+ }
372
+ }) : null, overlay));
373
+ }
374
+ }]);
375
+ }(React.Component);
376
+ _defineProperty(Cyclomedia, "propTypes", {
377
+ active: PropTypes.bool,
378
+ addLayer: PropTypes.func,
379
+ addLayerFeatures: PropTypes.func,
380
+ /** The Cyclomedia API key */
381
+ apikey: PropTypes.string,
382
+ changeLayerProperty: PropTypes.func,
383
+ click: PropTypes.object,
384
+ /** OAuth client ID. */
385
+ clientId: PropTypes.string,
386
+ /** Fields from user_infos which contain username and password which will be pre-inserted into the login form. */
387
+ credentialUserInfoFields: PropTypes.shape({
388
+ username: PropTypes.string,
389
+ password: PropTypes.string
390
+ }),
391
+ /** The cyclomedia version. */
392
+ cyclomediaVersion: PropTypes.string,
393
+ /** Whether to display Cyclomedia measurement geometries on the map. */
394
+ displayMeasurements: PropTypes.bool,
395
+ /** 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). */
396
+ geometry: PropTypes.shape({
397
+ initialWidth: PropTypes.number,
398
+ initialHeight: PropTypes.number,
399
+ initialX: PropTypes.number,
400
+ initialY: PropTypes.number,
401
+ initiallyDocked: PropTypes.bool,
402
+ side: PropTypes.string
403
+ }),
404
+ /** The relative path to the redirect login handling of oauth. */
405
+ loginRedirectUri: PropTypes.string,
406
+ /** The relative path to the redirect logout handling of oauth. */
407
+ logoutRedirectUri: PropTypes.string,
408
+ mapCrs: PropTypes.string,
409
+ mapScale: PropTypes.number,
410
+ /** The maximum map scale above which the recordings WFS won't be displayed. */
411
+ maxMapScale: PropTypes.number,
412
+ /** The projection to use for Cyclomedia. */
413
+ projection: PropTypes.string,
414
+ removeLayer: PropTypes.func,
415
+ setCurrentTask: PropTypes.func,
416
+ theme: PropTypes.object,
417
+ userInfos: PropTypes.object
418
+ });
419
+ _defineProperty(Cyclomedia, "defaultProps", {
420
+ cyclomediaVersion: '24.1',
421
+ displayMeasurements: true,
422
+ geometry: {
423
+ initialWidth: 480,
424
+ initialHeight: 640,
425
+ initialX: 0,
426
+ initialY: 0,
427
+ initiallyDocked: false,
428
+ side: 'left'
429
+ },
430
+ maxMapScale: 5000,
431
+ projection: 'EPSG:3857'
432
+ });
433
+ export default connect(function (state) {
434
+ return {
435
+ active: state.task.id === "Cyclomedia",
436
+ click: state.map.click,
437
+ mapCrs: state.map.projection,
438
+ mapScale: MapUtils.computeForZoom(state.map.scales, state.map.zoom),
439
+ theme: state.theme.current,
440
+ userInfos: state.localConfig.user_infos
441
+ };
442
+ }, {
443
+ addLayer: addLayer,
444
+ addLayerFeatures: addLayerFeatures,
445
+ changeLayerProperty: changeLayerProperty,
446
+ removeLayer: removeLayer,
447
+ setCurrentTask: setCurrentTask
448
+ })(Cyclomedia);