qwc2 2025.3.31

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 (528) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +68 -0
  3. package/actions/display.js +7 -0
  4. package/actions/editing.js +7 -0
  5. package/actions/layerinfo.js +7 -0
  6. package/actions/layers.js +8 -0
  7. package/actions/localConfig.js +7 -0
  8. package/actions/locale.js +10 -0
  9. package/actions/locate.js +8 -0
  10. package/actions/logging.js +7 -0
  11. package/actions/map.js +15 -0
  12. package/actions/measurement.js +8 -0
  13. package/actions/processNotifications.js +7 -0
  14. package/actions/redlining.js +7 -0
  15. package/actions/redliningPick.js +7 -0
  16. package/actions/serviceinfo.js +7 -0
  17. package/actions/task.js +9 -0
  18. package/actions/theme.js +24 -0
  19. package/actions/windows.js +10 -0
  20. package/components/AppMenu.js +8 -0
  21. package/components/AttributeForm.js +34 -0
  22. package/components/AutoEditForm.js +8 -0
  23. package/components/CoordinateDisplayer.js +7 -0
  24. package/components/EditComboField.js +10 -0
  25. package/components/EditUploadField.js +8 -0
  26. package/components/FullscreenSwitcher.js +8 -0
  27. package/components/Icon.js +7 -0
  28. package/components/IdentifyViewer.js +16 -0
  29. package/components/ImportLayer.js +25 -0
  30. package/components/LayerInfoWindow.js +7 -0
  31. package/components/LinkFeatureForm.js +10 -0
  32. package/components/MapSelection.js +13 -0
  33. package/components/NumericInputWindow.js +7 -0
  34. package/components/PickFeature.js +7 -0
  35. package/components/PluginsContainer.js +8 -0
  36. package/components/PrintSelection.js +54 -0
  37. package/components/QtDesignerForm.js +30 -0
  38. package/components/ResizeableWindow.js +12 -0
  39. package/components/SearchBox.js +26 -0
  40. package/components/ServiceInfoWindow.js +7 -0
  41. package/components/SideBar.js +9 -0
  42. package/components/StandardApp.js +35 -0
  43. package/components/Swipeable.js +1 -0
  44. package/components/TaskBar.js +7 -0
  45. package/components/ThemeLayersListWindow.js +9 -0
  46. package/components/ThemeList.js +12 -0
  47. package/components/Toolbar.js +7 -0
  48. package/components/WindowManager.js +7 -0
  49. package/components/map/OlLayer.js +12 -0
  50. package/components/map/OlLocate.css +56 -0
  51. package/components/map/OlLocate.js +17 -0
  52. package/components/map/OlMap.js +11 -0
  53. package/components/map/layers/BingLayer.js +8 -0
  54. package/components/map/layers/GoogleLayer.js +27 -0
  55. package/components/map/layers/GraticuleLayer.js +8 -0
  56. package/components/map/layers/ImageLayer.js +8 -0
  57. package/components/map/layers/MVTLayer.js +7 -0
  58. package/components/map/layers/OSMLayer.js +8 -0
  59. package/components/map/layers/OverlayLayer.js +10 -0
  60. package/components/map/layers/VectorLayer.js +14 -0
  61. package/components/map/layers/WFSLayer.js +11 -0
  62. package/components/map/layers/WMSLayer.js +11 -0
  63. package/components/map/layers/WMTSLayer.js +9 -0
  64. package/components/map/layers/XYZLayer.js +7 -0
  65. package/components/map/layers/index.js +8 -0
  66. package/components/map3d/BottomBar3D.js +7 -0
  67. package/components/map3d/Compare3D.js +12 -0
  68. package/components/map3d/Draw3D.js +10 -0
  69. package/components/map3d/ExportObjects3D.js +17 -0
  70. package/components/map3d/HeightProfile3D.js +8 -0
  71. package/components/map3d/HideObjects3D.js +12 -0
  72. package/components/map3d/Identify3D.js +13 -0
  73. package/components/map3d/LayerTree3D.js +8 -0
  74. package/components/map3d/Map3D.js +29 -0
  75. package/components/map3d/Map3DLight.js +10 -0
  76. package/components/map3d/MapControls3D.js +20 -0
  77. package/components/map3d/MapExport3D.js +11 -0
  78. package/components/map3d/Measure3D.js +23 -0
  79. package/components/map3d/OverviewMap3D.js +9 -0
  80. package/components/map3d/SearchField3D.js +16 -0
  81. package/components/map3d/TopBar3D.js +7 -0
  82. package/components/map3d/View3DSwitcher.js +7 -0
  83. package/components/map3d/drawtool/CreateTool3D.js +9 -0
  84. package/components/map3d/drawtool/EditTool3D.js +9 -0
  85. package/components/map3d/drawtool/NumericInput3D.js +7 -0
  86. package/components/map3d/img/viewcone.svg +124 -0
  87. package/components/map3d/layers/VectorLayer3D.js +7 -0
  88. package/components/map3d/layers/WFSLayer3D.js +8 -0
  89. package/components/map3d/layers/WMSLayer3D.js +7 -0
  90. package/components/map3d/layers/WMTSLayer3D.js +9 -0
  91. package/components/map3d/layers/index.js +8 -0
  92. package/components/map3d/models/arrow.glb +0 -0
  93. package/components/map3d/models/pin.glb +0 -0
  94. package/components/map3d/slices/map3d.js +1 -0
  95. package/components/map3d/style/BottomBar3D.css +67 -0
  96. package/components/map3d/style/Compare3D.css +57 -0
  97. package/components/map3d/style/Draw3D.css +7 -0
  98. package/components/map3d/style/HideObjects3D.css +29 -0
  99. package/components/map3d/style/LayerTree3D.css +126 -0
  100. package/components/map3d/style/Map3D.css +42 -0
  101. package/components/map3d/style/Map3DLight.css +72 -0
  102. package/components/map3d/style/MapControls3D.css +56 -0
  103. package/components/map3d/style/MapExport3D.css +25 -0
  104. package/components/map3d/style/OverviewMap3D.css +37 -0
  105. package/components/map3d/style/SearchField3D.css +7 -0
  106. package/components/map3d/style/View3DSwitcher.css +27 -0
  107. package/components/map3d/utils/Tiles3DStyle.js +1 -0
  108. package/components/share/ShareLink.js +7 -0
  109. package/components/share/ShareQRCode.js +8 -0
  110. package/components/share/ShareSocials.js +9 -0
  111. package/components/share/style/ShareLink.css +13 -0
  112. package/components/share/style/ShareSocials.css +9 -0
  113. package/components/style/App.css +229 -0
  114. package/components/style/AppMenu.css +162 -0
  115. package/components/style/AttributeForm.css +57 -0
  116. package/components/style/AutoEditForm.css +64 -0
  117. package/components/style/DefaultColorScheme.css +60 -0
  118. package/components/style/EditUploadField.css +103 -0
  119. package/components/style/FullscreenSwitcher.css +25 -0
  120. package/components/style/Icon.css +26 -0
  121. package/components/style/IdentifyViewer.css +249 -0
  122. package/components/style/ImportLayer.css +28 -0
  123. package/components/style/LayerInfoWindow.css +46 -0
  124. package/components/style/LinkFeatureForm.css +48 -0
  125. package/components/style/NumericInputWindow.css +11 -0
  126. package/components/style/PickFeature.css +25 -0
  127. package/components/style/PluginsContainer.css +4 -0
  128. package/components/style/QtDesignerForm.css +225 -0
  129. package/components/style/ResizeableWindow.css +178 -0
  130. package/components/style/SearchBox.css +159 -0
  131. package/components/style/ServiceInfoWindow.css +34 -0
  132. package/components/style/SideBar.css +100 -0
  133. package/components/style/TaskBar.css +35 -0
  134. package/components/style/ThemeLayersListWindow.css +47 -0
  135. package/components/style/ThemeList.css +200 -0
  136. package/components/style/Toolbar.css +20 -0
  137. package/components/style/WindowManager.css +50 -0
  138. package/components/timeline/FixedTimeline.js +10 -0
  139. package/components/timeline/InfiniteTimeline.js +13 -0
  140. package/components/timeline/TimelineFeaturesSlider.js +10 -0
  141. package/components/timeline/style/FixedTimeline.css +76 -0
  142. package/components/timeline/style/InfiniteTimeline.css +94 -0
  143. package/components/timeline/style/TimelineFeaturesSlider.css +131 -0
  144. package/components/widgets/AccordeonWidget.js +7 -0
  145. package/components/widgets/ButtonBar.js +7 -0
  146. package/components/widgets/ColorButton.js +8 -0
  147. package/components/widgets/ComboBox.js +7 -0
  148. package/components/widgets/CopyButton.js +7 -0
  149. package/components/widgets/DateTimeInput.js +8 -0
  150. package/components/widgets/EditableSelect.js +8 -0
  151. package/components/widgets/FileSelector.js +9 -0
  152. package/components/widgets/Input.js +7 -0
  153. package/components/widgets/InputContainer.js +7 -0
  154. package/components/widgets/LayerCatalogWidget.js +3 -0
  155. package/components/widgets/MenuButton.js +1 -0
  156. package/components/widgets/ModalDialog.js +7 -0
  157. package/components/widgets/NavBar.js +7 -0
  158. package/components/widgets/NumberInput.js +9 -0
  159. package/components/widgets/PopupMenu.js +1 -0
  160. package/components/widgets/Primitives.js +7 -0
  161. package/components/widgets/ReCaptchaWidget.js +1 -0
  162. package/components/widgets/SearchWidget.js +7 -0
  163. package/components/widgets/Spinner.js +6 -0
  164. package/components/widgets/SuggestionInput.js +7 -0
  165. package/components/widgets/TextInput.js +7 -0
  166. package/components/widgets/ToggleSwitch.js +7 -0
  167. package/components/widgets/VectorLayerPicker.js +8 -0
  168. package/components/widgets/style/AccordeonWidget.css +22 -0
  169. package/components/widgets/style/ButtonBar.css +88 -0
  170. package/components/widgets/style/ColorButton.css +88 -0
  171. package/components/widgets/style/ComboBox.css +83 -0
  172. package/components/widgets/style/CopyButton.css +21 -0
  173. package/components/widgets/style/EditableSelect.css +47 -0
  174. package/components/widgets/style/FileSelector.css +14 -0
  175. package/components/widgets/style/InputContainer.css +34 -0
  176. package/components/widgets/style/LayerCatalogWidget.css +59 -0
  177. package/components/widgets/style/MenuButton.css +122 -0
  178. package/components/widgets/style/ModalDialog.css +50 -0
  179. package/components/widgets/style/NavBar.css +12 -0
  180. package/components/widgets/style/NumberInput.css +76 -0
  181. package/components/widgets/style/SearchWidget.css +43 -0
  182. package/components/widgets/style/Spinner.css +32 -0
  183. package/components/widgets/style/SuggestionInput.css +8 -0
  184. package/components/widgets/style/TextInput.css +94 -0
  185. package/components/widgets/style/ToggleSwitch.css +61 -0
  186. package/components/widgets/style/VectorLayerPicker.css +3 -0
  187. package/icons/2d.svg +70 -0
  188. package/icons/3d.svg +70 -0
  189. package/icons/3d2d.svg +92 -0
  190. package/icons/after.svg +76 -0
  191. package/icons/arrow-down.svg +60 -0
  192. package/icons/arrow-up.svg +60 -0
  193. package/icons/before.svg +76 -0
  194. package/icons/bglayer.svg +71 -0
  195. package/icons/bookmark.svg +170 -0
  196. package/icons/box.svg +63 -0
  197. package/icons/buffer.svg +67 -0
  198. package/icons/camera.svg +118 -0
  199. package/icons/catalog.svg +62 -0
  200. package/icons/checked.svg +80 -0
  201. package/icons/chevron-down.svg +60 -0
  202. package/icons/chevron-left.svg +59 -0
  203. package/icons/chevron-right.svg +60 -0
  204. package/icons/chevron-up.svg +60 -0
  205. package/icons/circle.svg +70 -0
  206. package/icons/clear.svg +62 -0
  207. package/icons/clock.svg +71 -0
  208. package/icons/cog.svg +60 -0
  209. package/icons/collapse.svg +73 -0
  210. package/icons/compare.svg +72 -0
  211. package/icons/cone.svg +58 -0
  212. package/icons/confirm.svg +62 -0
  213. package/icons/copy.svg +60 -0
  214. package/icons/cuboid.svg +58 -0
  215. package/icons/cyclomedia.svg +47 -0
  216. package/icons/cylinder.svg +58 -0
  217. package/icons/dataimport.svg +116 -0
  218. package/icons/detach.svg +79 -0
  219. package/icons/dock.svg +82 -0
  220. package/icons/dock_bottom.svg +82 -0
  221. package/icons/dock_left.svg +84 -0
  222. package/icons/dock_right.svg +84 -0
  223. package/icons/dock_top.svg +84 -0
  224. package/icons/draw.svg +78 -0
  225. package/icons/editdraw.svg +84 -0
  226. package/icons/edited.svg +78 -0
  227. package/icons/editing.svg +118 -0
  228. package/icons/ellipse.svg +72 -0
  229. package/icons/embed.svg +88 -0
  230. package/icons/expand.svg +73 -0
  231. package/icons/export.svg +126 -0
  232. package/icons/eye.svg +127 -0
  233. package/icons/featureform.svg +115 -0
  234. package/icons/fill.svg +62 -0
  235. package/icons/filter.svg +69 -0
  236. package/icons/folder-open.svg +60 -0
  237. package/icons/freehand.svg +82 -0
  238. package/icons/group.svg +76 -0
  239. package/icons/home.svg +60 -0
  240. package/icons/identify_radius.svg +71 -0
  241. package/icons/identify_region.svg +71 -0
  242. package/icons/import.svg +62 -0
  243. package/icons/info-sign.svg +60 -0
  244. package/icons/info.svg +80 -0
  245. package/icons/layers.svg +71 -0
  246. package/icons/light.svg +77 -0
  247. package/icons/line.svg +61 -0
  248. package/icons/line_buffer.svg +65 -0
  249. package/icons/link.svg +75 -0
  250. package/icons/list-alt.svg +111 -0
  251. package/icons/lock.svg +54 -0
  252. package/icons/login.svg +56 -0
  253. package/icons/logout.svg +56 -0
  254. package/icons/map3d.svg +51 -0
  255. package/icons/maximize.svg +84 -0
  256. package/icons/measure.svg +82 -0
  257. package/icons/measure_line.svg +87 -0
  258. package/icons/measure_polygon.svg +88 -0
  259. package/icons/menu-hamburger.svg +60 -0
  260. package/icons/minimize.svg +76 -0
  261. package/icons/minus-sign.svg +60 -0
  262. package/icons/minus.svg +61 -0
  263. package/icons/nav-end.svg +74 -0
  264. package/icons/nav-left.svg +74 -0
  265. package/icons/nav-right.svg +74 -0
  266. package/icons/nav-start.svg +73 -0
  267. package/icons/new.svg +84 -0
  268. package/icons/nodetool.svg +68 -0
  269. package/icons/numericinput.svg +86 -0
  270. package/icons/ok.svg +60 -0
  271. package/icons/open.svg +79 -0
  272. package/icons/open_link.svg +74 -0
  273. package/icons/paint.svg +75 -0
  274. package/icons/pen.svg +41 -0
  275. package/icons/person.svg +44 -0
  276. package/icons/pick.svg +67 -0
  277. package/icons/pick_point.svg +74 -0
  278. package/icons/pick_region.svg +71 -0
  279. package/icons/plus.svg +60 -0
  280. package/icons/point.svg +67 -0
  281. package/icons/point_buffer.svg +74 -0
  282. package/icons/polygon.svg +61 -0
  283. package/icons/print.svg +60 -0
  284. package/icons/pyramid.svg +58 -0
  285. package/icons/radio_checked.svg +78 -0
  286. package/icons/radio_tristate.svg +75 -0
  287. package/icons/radio_unchecked.svg +72 -0
  288. package/icons/rasterexport.svg +124 -0
  289. package/icons/rect.svg +63 -0
  290. package/icons/refresh.svg +44 -0
  291. package/icons/remove.svg +60 -0
  292. package/icons/report.svg +84 -0
  293. package/icons/routing-bicycle.svg +40 -0
  294. package/icons/routing-bus.svg +40 -0
  295. package/icons/routing-cablecar.svg +40 -0
  296. package/icons/routing-car.svg +40 -0
  297. package/icons/routing-ship.svg +40 -0
  298. package/icons/routing-train.svg +40 -0
  299. package/icons/routing-tram.svg +40 -0
  300. package/icons/routing-truck.svg +40 -0
  301. package/icons/routing-walking.svg +40 -0
  302. package/icons/routing.svg +68 -0
  303. package/icons/save.svg +190 -0
  304. package/icons/scale.svg +62 -0
  305. package/icons/screenshot.svg +60 -0
  306. package/icons/search.svg +60 -0
  307. package/icons/selectbox.svg +79 -0
  308. package/icons/share.svg +64 -0
  309. package/icons/snap_edge.svg +79 -0
  310. package/icons/snap_vertex.svg +79 -0
  311. package/icons/sphere.svg +58 -0
  312. package/icons/square.svg +68 -0
  313. package/icons/sync.svg +72 -0
  314. package/icons/text.svg +68 -0
  315. package/icons/themes.svg +81 -0
  316. package/icons/tilt-down.svg +67 -0
  317. package/icons/tilt-left.svg +48 -0
  318. package/icons/tilt-right.svg +48 -0
  319. package/icons/tilt-up.svg +67 -0
  320. package/icons/today.svg +45 -0
  321. package/icons/tools.svg +77 -0
  322. package/icons/transformtool.svg +74 -0
  323. package/icons/transparency.svg +132 -0
  324. package/icons/trash.svg +60 -0
  325. package/icons/tree_minus.svg +81 -0
  326. package/icons/tree_plus.svg +81 -0
  327. package/icons/triangle-down.svg +59 -0
  328. package/icons/triangle-left.svg +60 -0
  329. package/icons/triangle-right.svg +60 -0
  330. package/icons/triangle-up.svg +59 -0
  331. package/icons/tristate.svg +79 -0
  332. package/icons/unchecked.svg +74 -0
  333. package/icons/undock.svg +82 -0
  334. package/icons/undock_bottom.svg +82 -0
  335. package/icons/undock_left.svg +82 -0
  336. package/icons/undock_right.svg +84 -0
  337. package/icons/undock_top.svg +84 -0
  338. package/icons/unmaximize.svg +84 -0
  339. package/icons/unminimize.svg +76 -0
  340. package/icons/up-down-arrow.svg +66 -0
  341. package/icons/warning.svg +72 -0
  342. package/icons/wedge.svg +58 -0
  343. package/icons/zoom.svg +60 -0
  344. package/icons/zoomin.svg +71 -0
  345. package/icons/zoomout.svg +80 -0
  346. package/libs/openlayers.js +11 -0
  347. package/package.json +135 -0
  348. package/plugins/API.js +114 -0
  349. package/plugins/AttributeTable.js +25 -0
  350. package/plugins/Authentication.js +13 -0
  351. package/plugins/BackgroundSwitcher.js +10 -0
  352. package/plugins/Bookmark.js +13 -0
  353. package/plugins/BottomBar.js +10 -0
  354. package/plugins/CookiePopup.js +9 -0
  355. package/plugins/Cyclomedia.js +11 -0
  356. package/plugins/Editing.js +21 -0
  357. package/plugins/FeatureForm.js +21 -0
  358. package/plugins/FeatureSearch.js +11 -0
  359. package/plugins/GeometryDigitizer.js +43 -0
  360. package/plugins/HeightProfile.js +26 -0
  361. package/plugins/Help.js +11 -0
  362. package/plugins/HomeButton.js +9 -0
  363. package/plugins/Identify.js +18 -0
  364. package/plugins/LayerCatalog.js +45 -0
  365. package/plugins/LayerTree.js +15 -0
  366. package/plugins/LocateButton.js +10 -0
  367. package/plugins/Map.js +22 -0
  368. package/plugins/MapCompare.js +11 -0
  369. package/plugins/MapCopyright.js +11 -0
  370. package/plugins/MapExport.js +23 -0
  371. package/plugins/MapFilter.js +20 -0
  372. package/plugins/MapInfoTooltip.js +32 -0
  373. package/plugins/MapLegend.js +14 -0
  374. package/plugins/MapTip.js +15 -0
  375. package/plugins/Measure.js +10 -0
  376. package/plugins/NewsPopup.js +12 -0
  377. package/plugins/Panoramax.js +10 -0
  378. package/plugins/Portal.js +10 -0
  379. package/plugins/Print.js +22 -0
  380. package/plugins/ProcessNotifications.js +11 -0
  381. package/plugins/Redlining.js +12 -0
  382. package/plugins/Reports.js +15 -0
  383. package/plugins/Routing.js +23 -0
  384. package/plugins/ScratchDrawing.js +15 -0
  385. package/plugins/Settings.js +12 -0
  386. package/plugins/Share.js +11 -0
  387. package/plugins/StartupMarker.js +12 -0
  388. package/plugins/TaskButton.js +9 -0
  389. package/plugins/ThemeSwitcher.js +10 -0
  390. package/plugins/TimeManager.js +21 -0
  391. package/plugins/TopBar.js +13 -0
  392. package/plugins/ValueTool.js +11 -0
  393. package/plugins/View3D.js +34 -0
  394. package/plugins/ZoomButtons.js +11 -0
  395. package/plugins/map/EditingSupport.js +13 -0
  396. package/plugins/map/LocateSupport.js +14 -0
  397. package/plugins/map/MeasurementSupport.js +15 -0
  398. package/plugins/map/OverviewSupport.js +14 -0
  399. package/plugins/map/RedliningPickSupport.js +12 -0
  400. package/plugins/map/RedliningSupport.js +28 -0
  401. package/plugins/map/ScaleBarSupport.js +10 -0
  402. package/plugins/map/SnapInteraction.js +1 -0
  403. package/plugins/map/SnapSupport.js +7 -0
  404. package/plugins/map/SnappingSupport.js +23 -0
  405. package/plugins/map/style/OverviewSupport.css +42 -0
  406. package/plugins/map/style/ScaleBarSupport.css +18 -0
  407. package/plugins/map/style/SnappingSupport.css +33 -0
  408. package/plugins/redlining/RedliningBufferSupport.js +8 -0
  409. package/plugins/style/AttributeTable.css +220 -0
  410. package/plugins/style/Authentication.css +16 -0
  411. package/plugins/style/BackgroundSwitcher.css +99 -0
  412. package/plugins/style/Bookmark.css +62 -0
  413. package/plugins/style/BottomBar.css +53 -0
  414. package/plugins/style/Buttons.css +68 -0
  415. package/plugins/style/CookiePopup.css +24 -0
  416. package/plugins/style/Cyclomedia.css +66 -0
  417. package/plugins/style/Editing.css +40 -0
  418. package/plugins/style/FeatureForm.css +21 -0
  419. package/plugins/style/FeatureSearch.css +71 -0
  420. package/plugins/style/GeometryDigitizer.css +28 -0
  421. package/plugins/style/HeightProfile.css +26 -0
  422. package/plugins/style/Identify.css +4 -0
  423. package/plugins/style/LayerCatalog.css +8 -0
  424. package/plugins/style/LayerTree.css +316 -0
  425. package/plugins/style/Map.css +43 -0
  426. package/plugins/style/MapCompare.css +27 -0
  427. package/plugins/style/MapCopyright.css +17 -0
  428. package/plugins/style/MapExport.css +55 -0
  429. package/plugins/style/MapFilter.css +101 -0
  430. package/plugins/style/MapInfoTooltip.css +78 -0
  431. package/plugins/style/MapLegend.css +36 -0
  432. package/plugins/style/MapTip.css +22 -0
  433. package/plugins/style/Measure.css +23 -0
  434. package/plugins/style/NewsPopup.css +87 -0
  435. package/plugins/style/Panoramax.css +15 -0
  436. package/plugins/style/Portal.css +115 -0
  437. package/plugins/style/Print.css +116 -0
  438. package/plugins/style/ProcessNotifications.css +55 -0
  439. package/plugins/style/Redlining.css +101 -0
  440. package/plugins/style/Reports.css +11 -0
  441. package/plugins/style/Routing.css +243 -0
  442. package/plugins/style/ScratchDrawing.css +8 -0
  443. package/plugins/style/Settings.css +11 -0
  444. package/plugins/style/Share.css +59 -0
  445. package/plugins/style/ThemeSwitcher.css +7 -0
  446. package/plugins/style/TimeManager.css +91 -0
  447. package/plugins/style/TopBar.css +50 -0
  448. package/plugins/style/ValueTool.css +60 -0
  449. package/reducers/display.js +7 -0
  450. package/reducers/editing.js +8 -0
  451. package/reducers/index.js +7 -0
  452. package/reducers/layerinfo.js +7 -0
  453. package/reducers/layers.js +14 -0
  454. package/reducers/localConfig.js +8 -0
  455. package/reducers/locale.js +8 -0
  456. package/reducers/locate.js +8 -0
  457. package/reducers/map.js +11 -0
  458. package/reducers/measurement.js +8 -0
  459. package/reducers/processNotifications.js +7 -0
  460. package/reducers/redlining.js +7 -0
  461. package/reducers/redliningPick.js +7 -0
  462. package/reducers/serviceinfo.js +7 -0
  463. package/reducers/task.js +7 -0
  464. package/reducers/theme.js +7 -0
  465. package/reducers/windows.js +7 -0
  466. package/scripts/dist.sh +16 -0
  467. package/scripts/gen-plugin-docs.js +9 -0
  468. package/scripts/makeIconkit.js +7 -0
  469. package/scripts/package-commands.bat +8 -0
  470. package/scripts/package-commands.sh +22 -0
  471. package/scripts/themesConfig.js +48 -0
  472. package/scripts/themesConfig.py +659 -0
  473. package/scripts/translateui.sh +51 -0
  474. package/scripts/updateTranslations.js +17 -0
  475. package/scripts/wmts_config_generator.py +169 -0
  476. package/selectors/searchproviders.js +12 -0
  477. package/static/translations/bg-BG.json +709 -0
  478. package/static/translations/ca-ES.json +709 -0
  479. package/static/translations/cs-CZ.json +709 -0
  480. package/static/translations/de-CH.json +709 -0
  481. package/static/translations/de-DE.json +709 -0
  482. package/static/translations/en-US.json +709 -0
  483. package/static/translations/es-ES.json +709 -0
  484. package/static/translations/fi-FI.json +709 -0
  485. package/static/translations/fr-FR.json +709 -0
  486. package/static/translations/hu-HU.json +709 -0
  487. package/static/translations/it-IT.json +709 -0
  488. package/static/translations/ja-JP.json +709 -0
  489. package/static/translations/nl-NL.json +709 -0
  490. package/static/translations/no-NO.json +709 -0
  491. package/static/translations/pl-PL.json +709 -0
  492. package/static/translations/pt-BR.json +709 -0
  493. package/static/translations/pt-PT.json +709 -0
  494. package/static/translations/ro-RO.json +709 -0
  495. package/static/translations/ru-RU.json +709 -0
  496. package/static/translations/sv-SE.json +709 -0
  497. package/static/translations/tr-TR.json +709 -0
  498. package/static/translations/tsconfig.json +606 -0
  499. package/stores/StandardStore.js +8 -0
  500. package/utils/ConfigUtils.js +9 -0
  501. package/utils/CoordinatesUtils.js +29 -0
  502. package/utils/DxfUtils.js +10 -0
  503. package/utils/EditingInterface.js +67 -0
  504. package/utils/EditingUtils.js +11 -0
  505. package/utils/FeatureStyles.js +10 -0
  506. package/utils/IdentifyUtils.js +12 -0
  507. package/utils/ImageEditor.js +15 -0
  508. package/utils/LayerUtils.js +57 -0
  509. package/utils/LocaleUtils.js +9 -0
  510. package/utils/MapUtils.js +66 -0
  511. package/utils/MeasureUtils.js +9 -0
  512. package/utils/MiscUtils.js +15 -0
  513. package/utils/PermaLinkUtils.js +11 -0
  514. package/utils/ResourceRegistry.js +7 -0
  515. package/utils/RoutingInterface.js +12 -0
  516. package/utils/SearchProviders.js +19 -0
  517. package/utils/ServiceLayerUtils.js +20 -0
  518. package/utils/Signal.js +2 -0
  519. package/utils/ThemeUtils.js +12 -0
  520. package/utils/VectorLayerUtils.js +20 -0
  521. package/utils/expr_grammar/README.md +3 -0
  522. package/utils/expr_grammar/grammar.js +3 -0
  523. package/utils/expr_grammar/grammar.ne +118 -0
  524. package/utils/expr_grammar/test.js +13 -0
  525. package/utils/img/README.markers +1 -0
  526. package/utils/img/arrowhead.svg +4 -0
  527. package/utils/img/marker-icon.png +0 -0
  528. package/utils/img/measurehead.svg +4 -0
@@ -0,0 +1,7 @@
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)}/**
2
+ * Copyright 2024 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * 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{setBottombarHeight}from"../../actions/windows";import CoordinatesUtils from"../../utils/CoordinatesUtils";import"./style/BottomBar3D.css";var BottomBar3D=/*#__PURE__*/function(_React$Component){function BottomBar3D(){var _this;_classCallCheck(this,BottomBar3D);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,BottomBar3D,[].concat(args));_defineProperty(_this,"state",{cursorPosition:null,progress:0});_defineProperty(_this,"scheduleGetCursorPosition",function(ev){var rect=ev.currentTarget.getBoundingClientRect();var x=(ev.clientX-rect.left)/rect.width*2-1;var y=-(ev.clientY-rect.top)/rect.height*2+1;clearTimeout(_this.cursorPositionTimeout);_this.cursorPositionTimeout=setTimeout(function(){return _this.getCursorPosition(x,y)},150)});_defineProperty(_this,"getCursorPosition",function(x,y){var intersection=_this.props.sceneContext.getSceneIntersection(x,y);if(intersection){var p=intersection.point;_this.setState({cursorPosition:[p.x,p.y,p.z]})}});_defineProperty(_this,"storeHeight",function(el){if(el){_this.props.setBottombarHeight(el.clientHeight)}});return _this}_inherits(BottomBar3D,_React$Component);return _createClass(BottomBar3D,[{key:"componentDidMount",value:function componentDidMount(){var _this2=this;this.props.sceneContext.scene.viewport.addEventListener("mousemove",this.scheduleGetCursorPosition);this.props.sceneContext.scene.addEventListener("update-end",function(){_this2.setState({progress:Math.round(_this2.props.sceneContext.scene.progress*100)+"%"})})}},{key:"componentWillUnmount",value:function componentWillUnmount(){clearTimeout(this.cursorPositionTimeout)}},{key:"render",value:function render(){return/*#__PURE__*/React.createElement("div",{className:"map3d-bottombar",ref:this.storeHeight},/*#__PURE__*/React.createElement("div",{className:"map3d-bottombar-progress"},/*#__PURE__*/React.createElement("div",{className:"map3d-bottombar-progressbar",style:{width:this.state.progress}}),/*#__PURE__*/React.createElement("div",{className:"map3d-bottombar-progress-label"},this.state.progress)),/*#__PURE__*/React.createElement("div",{className:"map3d-bottombar-spacer"}),/*#__PURE__*/React.createElement("div",{className:"map3d-bottombar-position"},(this.state.cursorPosition||[]).map(function(x){return x.toFixed(0)}).join(" ")),/*#__PURE__*/React.createElement("div",{className:"map3d-bottombar-projection"},this.props.sceneContext.mapCrs?CoordinatesUtils.getAvailableCRS()[this.props.sceneContext.mapCrs].label:""),/*#__PURE__*/React.createElement("div",{className:"map3d-bottombar-spacer"}))}}])}(React.Component);_defineProperty(BottomBar3D,"propTypes",{sceneContext:PropTypes.object,setBottombarHeight:PropTypes.func});export default connect(function(){return{}},{setBottombarHeight:setBottombarHeight})(BottomBar3D);
@@ -0,0 +1,12 @@
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 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 _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}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)}/**
2
+ * Copyright 2024 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * 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{Group,Plane,Raycaster,Vector2,Vector3}from"three";import{GLTFLoader}from"three/addons/loaders/GLTFLoader";import LocaleUtils from"../../utils/LocaleUtils";import Icon from"../Icon";import SideBar from"../SideBar";import NumberInput from"../widgets/NumberInput";import arrowModel from"./models/arrow.glb";import"./style/Compare3D.css";var Compare3D=/*#__PURE__*/function(_React$Component){function Compare3D(){var _this;_classCallCheck(this,Compare3D);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,Compare3D,[].concat(args));_defineProperty(_this,"state",{enabled:false,clippedObjects:{},planeX:0,planeY:0,planeA:0});_defineProperty(_this,"updateClippingPlane",function(){var point=new Vector3(_this.state.planeX,_this.state.planeY,0);var alpha=_this.state.planeA/180*Math.PI;var normal=new Vector3(Math.sin(alpha),Math.cos(alpha),0);var leftPlane=new Plane;var rightPlane=new Plane;leftPlane.setFromNormalAndCoplanarPoint(normal,point);rightPlane.setFromNormalAndCoplanarPoint(normal.multiplyScalar(-1),point);Object.entries(_this.state.clippedObjects).forEach(function(_ref){var _ref2=_slicedToArray(_ref,2),objectId=_ref2[0],config=_ref2[1];var planes=[];if(config.left){planes.push(leftPlane)}if(config.right){planes.push(rightPlane)}if(objectId==="__terrain"){_this.props.sceneContext.map.clippingPlanes=planes}else{var object=_this.props.sceneContext.getSceneObject(objectId);object.clippingPlanes=planes;object.traverse(function(child){if(child.material){child.material.clippingPlanes=planes}})}});_this.props.sceneContext.scene.notifyChange();_this.positionArrows(_this.state.planeX,_this.state.planeY,_this.state.planeA)});_defineProperty(_this,"clearClippingPlane",function(){Object.keys(_this.state.clippedObjects).forEach(function(objectId){if(objectId==="__terrain"){_this.props.sceneContext.map.clippingPlanes=[]}else{var object=_this.props.sceneContext.getSceneObject(objectId);object.clippingPlanes=[];object.traverse(function(child){if(child.material){child.material.clippingPlanes=[]}})}});if(_this.props.active){_this.disableArrows()}_this.props.sceneContext.scene.notifyChange()});_defineProperty(_this,"enableArrows",function(){_this.props.sceneContext.addSceneObject("__compareArrows",_this.arrows);_this.props.sceneContext.scene.view.controls.addEventListener("change",_this.centerArrowsInView);var renderer=_this.props.sceneContext.scene.renderer;renderer.domElement.addEventListener("pointerdown",_this.dragArrows)});_defineProperty(_this,"disableArrows",function(){var _this$props$sceneCont,_this$props$sceneCont2;(_this$props$sceneCont=_this.props.sceneContext.scene.view.controls)===null||_this$props$sceneCont===void 0||(_this$props$sceneCont2=_this$props$sceneCont.removeEventListener)===null||_this$props$sceneCont2===void 0||_this$props$sceneCont2.call(_this$props$sceneCont,"change",_this.centerArrowsInView);_this.props.sceneContext.removeSceneObject("__compareArrows");_this.props.sceneContext.scene.renderer.domElement.removeEventListener("pointerdown",_this.dragArrows)});_defineProperty(_this,"dragArrows",function(ev){var mousePos=function mousePos(event){var rect=event.target.getBoundingClientRect();var x=(event.clientX-rect.left)/rect.width*2-1;var y=-((event.clientY-rect.top)/rect.height)*2+1;return new Vector2(x,y)};var camera=_this.props.sceneContext.scene.view.camera;var raycaster=new Raycaster;raycaster.setFromCamera(mousePos(ev),camera);var intersects=raycaster.intersectObject(_this.arrows).length>0;if(!intersects){return}var plane=new Plane().setFromNormalAndCoplanarPoint(new Vector3(0,0,1),_this.arrows.position);var startPos=raycaster.ray.intersectPlane(plane,new Vector3);var planePos=new Vector2(_this.state.planeX,_this.state.planeY);var alpha=_this.state.planeA/180*Math.PI;var planeNormal=new Vector3(Math.sin(alpha),Math.cos(alpha),0);var moveArrows=function moveArrows(event){raycaster.setFromCamera(mousePos(event),camera);plane.setFromNormalAndCoplanarPoint(new Vector3(0,0,1),_this.arrows.position);var pos=raycaster.ray.intersectPlane(plane,new Vector3);var delta=planeNormal.clone().multiplyScalar(new Vector3().copy(pos.sub(startPos)).dot(planeNormal));_this.setState({planeX:planePos.x+delta.x,planeY:planePos.y+delta.y});_this.positionArrows(planePos.x+delta.x,planePos.y+delta.y,_this.state.planeA)};_this.props.sceneContext.scene.view.controls.enabled=false;ev.view.addEventListener("pointermove",moveArrows);ev.view.addEventListener("pointerup",function(){_this.props.sceneContext.scene.view.controls.enabled=true;ev.view.removeEventListener("pointermove",moveArrows)},{once:true})});_defineProperty(_this,"centerArrowsInView",function(){var cameraTarget=_this.props.sceneContext.scene.view.controls.target.clone();var alpha=_this.state.planeA/180*Math.PI;var dir=new Vector3(Math.cos(alpha),-Math.sin(alpha),0);var curPos=new Vector3(_this.state.planeX,_this.state.planeY,0);var newPos=curPos.add(dir.multiplyScalar(cameraTarget.sub(curPos).dot(dir)));_this.setState({planeX:newPos.x,planeY:newPos.y});_this.positionArrows(newPos.x,newPos.y,_this.state.planeA)});_defineProperty(_this,"positionArrows",function(x,y,alpha){var _this$props$sceneCont3;var target=new Vector3(x,y,0);var distance=_this.props.sceneContext.scene.view.camera.position.distanceTo(target);var scale=Math.max(1,distance/200);var z=(_this$props$sceneCont3=_this.props.sceneContext.getTerrainHeightFromMap([x,y]))!==null&&_this$props$sceneCont3!==void 0?_this$props$sceneCont3:0;_this.arrows.position.x=target.x;_this.arrows.position.y=target.y;_this.arrows.position.z=z;_this.arrows.rotation.z=-alpha/180*Math.PI;_this.arrows.scale.set(scale,scale,scale);_this.arrows.updateMatrixWorld()});_defineProperty(_this,"renderBody",function(){var sceneContext=_this.props.sceneContext;var objects=_objectSpread({__terrain:{layertree:true,title:LocaleUtils.tr("map3d.terrain")}},sceneContext.sceneObjects);var objectIds=Object.keys(objects).filter(function(objectId){return objects[objectId].layertree});return/*#__PURE__*/React.createElement("div",{className:"compare3d-body",role:"body"},/*#__PURE__*/React.createElement("div",{className:"compare3d-title",onClick:_this.toggleCompare},/*#__PURE__*/React.createElement(Icon,{icon:_this.state.enabled?"checked":"unchecked"}),/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("compare3d.compare_objects"))),/*#__PURE__*/React.createElement("div",{className:"compare3d-objects"},["left","right"].map(function(section){var clipState=_this.state.clippedObjects;var toggleAllIcon="checked";var toggleAllValue=true;var toggleAllState=objectIds.reduce(function(res,id){var _clipState$id;return res+((_clipState$id=clipState[id])===null||_clipState$id===void 0?void 0:_clipState$id[section])},0);if(toggleAllState===objectIds.length){toggleAllIcon="unchecked";toggleAllValue=false}else if(toggleAllState>0){toggleAllIcon="tristate"}return/*#__PURE__*/React.createElement("div",{className:"compare3d-section",key:"compare-"+section},/*#__PURE__*/React.createElement("div",{className:"compare3d-item compare3d-item-toggleall",onClick:_this.state.enabled?function(){return _this.toggleAllObjects(section,objectIds,toggleAllValue)}:null,title:LocaleUtils.tr("compare3d.toggleall")},/*#__PURE__*/React.createElement(Icon,{className:"compare3d-item-checkbox",disabled:!_this.state.enabled,icon:toggleAllIcon}),/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("compare3d.toggleall"))),objectIds.map(function(objectId){var _objects$objectId$tit,_clipState$objectId,_objects$objectId$tit2;return/*#__PURE__*/React.createElement("div",{className:"compare3d-item",key:objectId,onClick:_this.state.enabled?function(){return _this.toggleObject(section,objectId)}:null,title:(_objects$objectId$tit=objects[objectId].title)!==null&&_objects$objectId$tit!==void 0?_objects$objectId$tit:objectId},/*#__PURE__*/React.createElement(Icon,{className:"compare3d-item-checkbox",disabled:!_this.state.enabled,icon:(_clipState$objectId=clipState[objectId])!==null&&_clipState$objectId!==void 0&&_clipState$objectId[section]?"unchecked":"checked"}),/*#__PURE__*/React.createElement("span",null,(_objects$objectId$tit2=objects[objectId].title)!==null&&_objects$objectId$tit2!==void 0?_objects$objectId$tit2:objectId))}))})),/*#__PURE__*/React.createElement("div",{className:"compare3d-title"},LocaleUtils.tr("compare3d.clipplane")),/*#__PURE__*/React.createElement("table",{className:"compare3d-planeconfig"},/*#__PURE__*/React.createElement("tbody",null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,"x"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{disabled:!_this.state.enabled,onChange:function onChange(x){return _this.setState({planeX:x})},value:_this.state.planeX}))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,"y"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{disabled:!_this.state.enabled,onChange:function onChange(y){return _this.setState({planeY:y})},value:_this.state.planeY}))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,"\u03B1"),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{disabled:!_this.state.enabled,onChange:function onChange(a){return _this.setState({planeA:a})},suffix:"\xB0",value:_this.state.planeA}))))))});_defineProperty(_this,"toggleCompare",function(){_this.setState(function(state){var newState={enabled:!state.enabled};if(newState.enabled){// Position plane in current view
8
+ newState.planeX=_this.props.sceneContext.scene.view.controls.target.x;newState.planeY=_this.props.sceneContext.scene.view.controls.target.y;newState.planeA=-_this.props.sceneContext.scene.view.controls.getAzimuthalAngle()/Math.PI*180+90}return newState})});_defineProperty(_this,"toggleObject",function(section,objectId){_this.setState(function(state){var _state$clippedObjects;return{clippedObjects:_objectSpread(_objectSpread({},state.clippedObjects),{},_defineProperty({},objectId,_objectSpread(_objectSpread({},state.clippedObjects[objectId]),{},_defineProperty({},section,!((_state$clippedObjects=state.clippedObjects[objectId])!==null&&_state$clippedObjects!==void 0&&_state$clippedObjects[section])))))}})});_defineProperty(_this,"toggleAllObjects",function(section,objectIds,value){_this.setState(function(state){return{clippedObjects:objectIds.reduce(function(res,objectId){return _objectSpread(_objectSpread({},res),{},_defineProperty({},objectId,_objectSpread(_objectSpread({},state.clippedObjects[objectId]),{},_defineProperty({},section,value))))},{})}})});return _this}_inherits(Compare3D,_React$Component);return _createClass(Compare3D,[{key:"componentDidMount",value:function componentDidMount(){var _this2=this;var loader=new GLTFLoader;loader.load(arrowModel,function(gltf){gltf.scene.traverse(function(object){if(object.isMesh){object.material.depthTest=false;// Ignores depth buffer
9
+ object.material.depthWrite=false;// Prevents modifying depth buffer
10
+ }});gltf.scene.renderOrder=9999999;// Ensures it is rendered last
11
+ var leftArrow=gltf.scene.clone();leftArrow.position.y=-4;leftArrow.rotation.z=-0.5*Math.PI;var rightArrow=gltf.scene.clone();rightArrow.position.y=4;rightArrow.rotation.z=0.5*Math.PI;_this2.arrows=new Group;_this2.arrows.add(leftArrow);_this2.arrows.add(rightArrow)})}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.clearClippingPlane();if(this.arrows){this.arrows.traverse(function(obj){var _obj$dispose;return(_obj$dispose=obj.dispose)===null||_obj$dispose===void 0?void 0:_obj$dispose.call(obj)})}}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){if(this.state.enabled&&this.props.active&&!prevProps.active){this.enableArrows()}else if(this.state.enabled&&!this.props.active&&prevProps.active){this.disableArrows()}if(this.state.enabled&&this.state!==prevState){if(this.props.active&&!prevState.enabled){this.enableArrows()}// Recompute clipping plane
12
+ this.updateClippingPlane()}else if(!this.state.enabled&&prevState.enabled){this.clearClippingPlane()}}},{key:"render",value:function render(){var _this3=this;return/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement(SideBar,{icon:"layers",id:"Compare3D",title:LocaleUtils.tr("appmenu.items.Compare3D"),width:"20em"},function(){return{body:_this3.renderBody()}}))}}])}(React.Component);_defineProperty(Compare3D,"propTypes",{active:PropTypes.bool,sceneContext:PropTypes.object});export default connect(function(state){return{active:state.task.id==="Compare3D"}},{})(Compare3D);
@@ -0,0 +1,10 @@
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 _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}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)}/**
2
+ * Copyright 2025 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */import React from"react";import PropTypes from"prop-types";import{Group}from"three";import{v4 as uuidv4}from"uuid";import LocaleUtils from"../../utils/LocaleUtils";import Icon from"../Icon";import TaskBar from"../TaskBar";import ButtonBar from"../widgets/ButtonBar";import CreateTool3D from"./drawtool/CreateTool3D";import EditTool3D from"./drawtool/EditTool3D";import"./style/Draw3D.css";var Draw3D=/*#__PURE__*/function(_React$Component){function Draw3D(){var _this;_classCallCheck(this,Draw3D);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,Draw3D,[].concat(args));_defineProperty(_this,"state",{action:null,baseSize:10,color:[255,105,0,1],geomType:null,drawGroupId:"",selectedObject:null});_defineProperty(_this,"onShow",function(){// Ensure a draw group is present
8
+ var drawGroup=Object.entries(_this.props.sceneContext.sceneObjects).find(function(_ref){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],options=_ref2[1];return options.drawGroup===true});if(drawGroup===undefined){_this.addDrawGroup(LocaleUtils.tr("draw3d.drawings"))}else{_this.setState({drawGroupId:drawGroup[0]})}_this.setState({action:"Pick"})});_defineProperty(_this,"onHide",function(){// Remove empty draw groups
9
+ Object.entries(_this.props.sceneContext.sceneObjects).filter(function(_ref3){var _ref4=_slicedToArray(_ref3,2),objectId=_ref4[0],options=_ref4[1];return options.drawGroup===true}).forEach(function(_ref5){var _ref6=_slicedToArray(_ref5,2),objectId=_ref6[0],options=_ref6[1];var object=_this.props.sceneContext.getSceneObject(objectId);if(object.children.length===0){_this.props.sceneContext.removeSceneObject(objectId)}});_this.setState({selectedObject:null})});_defineProperty(_this,"createDrawGroup",function(){var message=LocaleUtils.tr("draw3d.newgroupprompt");// eslint-disable-next-line
10
+ var name=prompt(message);if(name){_this.addDrawGroup(name)}});_defineProperty(_this,"addDrawGroup",function(name){var objectId=uuidv4();var options={drawGroup:true,layertree:true,title:name};_this.props.sceneContext.addSceneObject(objectId,new Group,options);_this.setState({drawGroupId:objectId})});_defineProperty(_this,"renderBody",function(){var activeButton=_this.state.action==="Create"?_this.state.geomType:_this.state.action;var drawButtons=[{key:"Cuboid",tooltip:LocaleUtils.tr("draw3d.cuboid"),icon:"cuboid",data:{action:"Create",geomType:"Cuboid"}},{key:"Wedge",tooltip:LocaleUtils.tr("draw3d.wedge"),icon:"wedge",data:{action:"Create",geomType:"Wedge"}},{key:"Cylinder",tooltip:LocaleUtils.tr("draw3d.cylinder"),icon:"cylinder",data:{action:"Create",geomType:"Cylinder"}},[{key:"Pyramid",tooltip:LocaleUtils.tr("draw3d.pyramid"),icon:"pyramid",data:{action:"Create",geomType:"Pyramid"}},{key:"Sphere",tooltip:LocaleUtils.tr("draw3d.sphere"),icon:"sphere",data:{action:"Create",geomType:"Sphere"}},{key:"Cone",tooltip:LocaleUtils.tr("draw3d.cone"),icon:"cone",data:{action:"Create",geomType:"Cone"}}]];var editButtons=[{key:"Pick",tooltip:LocaleUtils.tr("draw3d.pick"),icon:"nodetool",data:{action:"Pick",geomType:null}},{key:"Delete",tooltip:LocaleUtils.tr("draw3d.delete"),icon:"trash",data:{action:"Delete",geomType:null},disabled:!_this.state.selectedObject}];var drawGroups=Object.entries(_this.props.sceneContext.sceneObjects).filter(function(_ref7){var _ref8=_slicedToArray(_ref7,2),key=_ref8[0],entry=_ref8[1];return entry.drawGroup===true});return/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("div",{className:"redlining-buttongroups"},/*#__PURE__*/React.createElement("div",{className:"redlining-group"},/*#__PURE__*/React.createElement("div",null,LocaleUtils.tr("redlining.layer")),/*#__PURE__*/React.createElement("div",{className:"controlgroup"},/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.setState({drawGroupId:ev.target.value})},value:_this.state.drawGroupId},drawGroups.map(function(_ref9){var _ref10=_slicedToArray(_ref9,2),objectId=_ref10[0],options=_ref10[1];return/*#__PURE__*/React.createElement("option",{key:objectId,value:objectId},options.title)})),/*#__PURE__*/React.createElement("button",{className:"button",onClick:_this.createDrawGroup},/*#__PURE__*/React.createElement(Icon,{icon:"plus"})))),/*#__PURE__*/React.createElement("div",{className:"redlining-group"},/*#__PURE__*/React.createElement("div",null,LocaleUtils.tr("redlining.draw")),/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement(ButtonBar,{active:activeButton,buttons:drawButtons,onClick:function onClick(key,data){return _this.actionChanged(data)}}))),/*#__PURE__*/React.createElement("div",{className:"redlining-group"},/*#__PURE__*/React.createElement("div",null,LocaleUtils.tr("redlining.edit")),/*#__PURE__*/React.createElement(ButtonBar,{active:activeButton,buttons:editButtons,onClick:function onClick(key,data){return _this.actionChanged(data)}}))),_this.renderControl())});_defineProperty(_this,"renderControl",function(){if(_this.state.action==="Create"){return/*#__PURE__*/React.createElement(CreateTool3D,{baseSize:_this.state.baseSize,baseSizeChanged:function baseSizeChanged(baseSize){return _this.setState({baseSize:baseSize})},color:_this.state.color,colorChanged:function colorChanged(color){return _this.setState({color:color})},drawGroupId:_this.state.drawGroupId,geomType:_this.state.geomType,objectCreated:_this.objectCreated,sceneContext:_this.props.sceneContext})}else if(_this.state.action==="Pick"){return/*#__PURE__*/React.createElement(EditTool3D,{color:_this.state.color,colorChanged:function colorChanged(color){return _this.setState({color:color})},drawGroupId:_this.state.drawGroupId,objectPicked:_this.objectPicked,sceneContext:_this.props.sceneContext,selectedObject:_this.state.selectedObject})}return null});_defineProperty(_this,"actionChanged",function(data){if(data.action==="Delete"){_this.deleteSelectedObject()}else{_this.setState({action:data.action,geomType:data.geomType,selectedObject:null})}});_defineProperty(_this,"deleteSelectedObject",function(){var group=_this.props.sceneContext.getSceneObject(_this.state.drawGroupId);var parent=null;group.traverse(function(c){if(c===_this.state.selectedObject){parent=c.parent}});if(parent){parent.remove(_this.state.selectedObject);while(parent.parent&&!parent.isMesh&&parent.children.length===0&&parent!==group){var grandparent=parent.parent;grandparent.remove(parent);parent=grandparent}_this.setState({action:"Pick",geomType:null,selectedObject:null});_this.props.sceneContext.scene.notifyChange()}});_defineProperty(_this,"objectCreated",function(object){_this.setState({action:"Pick",geomType:null,selectedObject:object})});_defineProperty(_this,"objectPicked",function(object){_this.setState({selectedObject:object})});return _this}_inherits(Draw3D,_React$Component);return _createClass(Draw3D,[{key:"render",value:function render(){var _this2=this;return/*#__PURE__*/React.createElement(TaskBar,{onHide:this.onHide,onShow:this.onShow,task:"Draw3D"},function(){return{body:_this2.renderBody()}})}}])}(React.Component);_defineProperty(Draw3D,"propTypes",{sceneContext:PropTypes.object});export{Draw3D as default};
@@ -0,0 +1,17 @@
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 _construct(t,e,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o));return r&&_setPrototypeOf(p,r.prototype),p}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 _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}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)}/**
2
+ * Copyright 2025 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */import React from"react";import{connect}from"react-redux";import ColorLayer from"@giro3d/giro3d/core/layer/ColorLayer";import DrawTool,{conditions}from"@giro3d/giro3d/interactions/DrawTool";import VectorSource from"@giro3d/giro3d/sources/VectorSource";import FileSaver from"file-saver";import ol from"openlayers";import pointInPolygon from"point-in-polygon";import PropTypes from"prop-types";import{Box3,BufferGeometry,Float32BufferAttribute,Group,Matrix4,Mesh,MeshStandardMaterial,Quaternion,Scene,Vector3}from"three";import{GLTFExporter}from"three/addons/exporters/GLTFExporter.js";import{setCurrentTask}from"../../actions/task";import LocaleUtils from"../../utils/LocaleUtils";import VectorLayerUtils from"../../utils/VectorLayerUtils";import SideBar from"../SideBar";import Spinner from"../widgets/Spinner";import Tiles3DStyle from"./utils/Tiles3DStyle";var ExportObjects3D=/*#__PURE__*/function(_React$Component){function ExportObjects3D(props){var _this;_classCallCheck(this,ExportObjects3D);_this=_callSuper(this,ExportObjects3D,[props]);_defineProperty(_this,"state",{selectedFormat:"model/gltf+json",minimized:false,exporting:false,exportPolygon:null});_defineProperty(_this,"onShow",function(){_this.abortController=new AbortController;_this.measureTool=new DrawTool({instance:_this.props.sceneContext.scene});_this.drawLayer=new ColorLayer({source:new VectorSource({data:[],format:new ol.format.GeoJSON,style:_this.featureStyleFunction})});_this.props.sceneContext.map.addLayer(_this.drawLayer);_this.restart()});_defineProperty(_this,"onHide",function(){_this.abortController.abort();_this.abortController=null;_this.measureTool.dispose();_this.measureTool=null;_this.props.sceneContext.map.removeLayer(_this.drawLayer,{dispose:true});_this.drawLayer=null});_defineProperty(_this,"formatChanged",function(ev){_this.setState({selectedFormat:ev.target.value})});_defineProperty(_this,"renderBody",function(){var exportDisabled=_this.state.exporting||_this.state.exportPolygon===null;var formatMap={"model/gltf+json":"GLTF"};return/*#__PURE__*/React.createElement("div",{className:"mapexport-body"},/*#__PURE__*/React.createElement("form",{onSubmit:_this.exportArea},/*#__PURE__*/React.createElement("table",{className:"options-table"},/*#__PURE__*/React.createElement("tbody",null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("mapexport.format")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("select",{name:"FORMAT",onChange:_this.formatChanged,value:_this.state.selectedFormat},Object.entries(formatMap).map(function(_ref){var _ref2=_slicedToArray(_ref,2),format=_ref2[0],label=_ref2[1];return/*#__PURE__*/React.createElement("option",{key:format,value:format},label)})))))),/*#__PURE__*/React.createElement("div",{className:"button-bar"},/*#__PURE__*/React.createElement("button",{className:"button",disabled:exportDisabled,type:"submit"},_this.state.exporting?/*#__PURE__*/React.createElement("span",{className:"mapexport-wait"},/*#__PURE__*/React.createElement(Spinner,null)," ",LocaleUtils.tr("mapexport.wait")):LocaleUtils.tr("mapexport.submit")))))});_defineProperty(_this,"restart",function(){if(_this.abortController){_this.abortController.abort()}_this.abortController=new AbortController;var pick=function pick(e){return _this.props.sceneContext.scene.pickObjectsAt(e,{sortByDistance:true,where:[_this.props.sceneContext.getMap()]})};var options={signal:_this.abortController.signal,endCondition:conditions.doubleClick,pick:pick};_this.measureTool.createPolygon(options).then(_this.selectArea)["catch"](function(){})});_defineProperty(_this,"selectArea",function(polygon){if(polygon===null){_this.restart();return}_this.drawLayer.source.clear();var polyGeoJson=polygon.toGeoJSON();var feature=new ol.format.GeoJSON().readFeature(polyGeoJson,{dataProjection:"EPSG:4326",featureProjection:_this.props.sceneContext.mapCrs});_this.drawLayer.source.addFeature(feature);_this.props.sceneContext.scene.remove(polygon);_this.setState({exportPolygon:feature.getGeometry().getCoordinates()});// Setup for next selection
8
+ _this.restart()});_defineProperty(_this,"featureStyleFunction",function(){return[new ol.style.Style({fill:new ol.style.Fill({color:[41,120,180,0.5]})}),new ol.style.Style({stroke:new ol.style.Stroke({color:[255,255,255],width:4})}),new ol.style.Style({stroke:new ol.style.Stroke({color:[41,120,180],width:1.5})})]});_defineProperty(_this,"exportArea",function(ev){ev.preventDefault();if(_this.state.selectedFormat==="model/gltf+json"){_this.exportToGltf()}});_defineProperty(_this,"exportToGltf",function(){_this.setState({exporting:true});var bbox=VectorLayerUtils.computeFeatureBBox({type:"Polygon",coordinates:_this.state.exportPolygon});// Create a bounding box in world space
9
+ var selectionBox=new Box3().setFromPoints([new Vector3(bbox[0],bbox[1],0),new Vector3(bbox[2],bbox[3],8000)]);var exportGroup=new Group;exportGroup.rotation.set(-Math.PI/2,0,0);// GLTF is Y-UP
10
+ Object.entries(_this.props.sceneContext.sceneObjects).forEach(function(_ref3){var _ref4=_slicedToArray(_ref3,2),objectId=_ref4[0],options=_ref4[1];if(!options.layertree||!options.visibility){return}var object=_this.props.sceneContext.getSceneObject(objectId);if(object.tiles){_this.addTileToExportGroup(object.tiles,exportGroup,selectionBox)}else{_this.addObjectToExportGroup(object,exportGroup,selectionBox)}});var exportScene=new Scene;exportScene.add(exportGroup);var exporter=new GLTFExporter;exporter.parse(exportScene,function(gltf){var blob=new Blob([JSON.stringify(gltf)],{type:"application/json"});FileSaver.saveAs(blob,"scene.gltf");_this.setState({exporting:false})})});_defineProperty(_this,"addTileToExportGroup",function(tiles,exportGroup,selectionBox){tiles.group.traverse(function(c){if(c.geometry){var bbox=c.geometry.boundingBox.applyMatrix4(c.matrixWorld);if(!selectionBox.intersectsBox(bbox)){return}var batchidAttr=c.geometry.getAttribute("_batchid");var posAttr=c.geometry.getAttribute("position");var norAttr=c.geometry.getAttribute("normal");var batches={};batchidAttr.array.forEach(function(batchId,idx){var _batches$batchId$posi,_batches$batchId$norm;if(!batches[batchId]){batches[batchId]={position:[],normal:[],bbox:new Box3}}var pos=posAttr.array.slice(3*idx,3*idx+3);var nor=norAttr.array.slice(3*idx,3*idx+3);(_batches$batchId$posi=batches[batchId].position).push.apply(_batches$batchId$posi,_toConsumableArray(pos));(_batches$batchId$norm=batches[batchId].normal).push.apply(_batches$batchId$norm,_toConsumableArray(nor));batches[batchId].bbox.expandByPoint(_construct(Vector3,_toConsumableArray(pos)).applyMatrix4(c.matrixWorld))});Object.entries(batches).forEach(function(_ref5){var _ref6=_slicedToArray(_ref5,2),batchId=_ref6[0],batch=_ref6[1];if(selectionBox.intersectsBox(batch.bbox)&&_this.bboxInExportPolygon(batch.bbox)){// Get batch table object
11
+ var batchTableObject=c;while(!batchTableObject.batchTable){batchTableObject=batchTableObject.parent}// Express coordinates wrt center of batch object bbox
12
+ var prevPosition=new Vector3;c.matrixWorld.decompose(prevPosition,new Quaternion,new Vector3);var newPosition=new Vector3;batch.bbox.getCenter(newPosition);var offset=new Vector3().subVectors(newPosition,prevPosition);for(var i=0;i<batch.position.length/3;++i){batch.position[3*i+0]-=offset.x;batch.position[3*i+1]-=offset.y;batch.position[3*i+2]-=offset.z}// Construct mesh
13
+ var material=new MeshStandardMaterial({color:Tiles3DStyle.getBatchColor(batchTableObject,batchId)});var geometry=new BufferGeometry;geometry.setAttribute("position",new Float32BufferAttribute(batch.position,3));geometry.setAttribute("normal",new Float32BufferAttribute(batch.normal,3));var mesh=new Mesh(geometry,material);mesh.applyMatrix4(c.matrixWorld.clone().multiply(new Matrix4().makeTranslation(offset)));// Include attribute from batch table
14
+ Object.assign(mesh.userData,batchTableObject.batchTable.getDataFromId(batchId));exportGroup.add(mesh)}})}})});_defineProperty(_this,"addObjectToExportGroup",function(object,exportGroup,selectionBox){object.children.forEach(function(child){var objBox=new Box3().setFromObject(child);if(selectionBox.intersectsBox(objBox)&&_this.bboxInExportPolygon(objBox)){exportGroup.add(child.clone())}})});_defineProperty(_this,"bboxInExportPolygon",function(box3){var polygon=_this.state.exportPolygon[0];var _ref7=[box3.min.x,box3.min.y,box3.max.x,box3.max.y],xmin=_ref7[0],ymin=_ref7[1],xmax=_ref7[2],ymax=_ref7[3];function doLinesIntersect(p1,p2,p3,p4){// Helper function to check if two line segments (p1-p2 and p3-p4) intersect
15
+ function ccw(A,B,C){return(C[1]-A[1])*(B[0]-A[0])>(B[1]-A[1])*(C[0]-A[0])}return ccw(p1,p3,p4)!==ccw(p2,p3,p4)&&ccw(p1,p2,p3)!==ccw(p1,p2,p4)}// Check if any bbox vertex is inside the polygon
16
+ if(pointInPolygon([xmin,ymin],polygon)||pointInPolygon([xmax,ymin],polygon)||pointInPolygon([xmax,ymax],polygon)||pointInPolygon([xmax,ymin],polygon)){return true}// Check if any edge of the polygon intersects the bbox
17
+ for(var i=0;i<polygon.length-1;i++){var _polygon$i=_slicedToArray(polygon[i],2),x1=_polygon$i[0],y1=_polygon$i[1];var _polygon=_slicedToArray(polygon[i+1],2),x2=_polygon[0],y2=_polygon[1];if(doLinesIntersect([x1,y1],[x2,y2],[xmin,ymin],[xmin,ymax])||doLinesIntersect([x1,y1],[x2,y2],[xmin,ymax],[xmax,ymax])||doLinesIntersect([x1,y1],[x2,y2],[xmax,ymax],[xmax,ymin])||doLinesIntersect([x1,y1],[x2,y2],[xmax,ymin],[xmin,ymin])){return true}}return false});_this.measureTool=null;_this.drawLayer=null;return _this}_inherits(ExportObjects3D,_React$Component);return _createClass(ExportObjects3D,[{key:"render",value:function render(){var _this2=this;return/*#__PURE__*/React.createElement(SideBar,{extraClasses:"MapExport",icon:"export",id:"ExportObjects3D",onHide:this.onHide,onShow:this.onShow,title:LocaleUtils.tr("appmenu.items.ExportObjects3D"),width:"20em"},function(){return{body:_this2.renderBody()}})}}])}(React.Component);_defineProperty(ExportObjects3D,"propTypes",{sceneContext:PropTypes.object,setCurrentTask:PropTypes.func});export default connect(function(state){return{theme:state.theme.current}},{setCurrentTask:setCurrentTask})(ExportObjects3D);
@@ -0,0 +1,8 @@
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 _construct(t,e,r){if(_isNativeReflectConstruct())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,e);var p=new(t.bind.apply(t,o));return r&&_setPrototypeOf(p,r.prototype),p}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 _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 _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 _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 _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)}/**
2
+ * Copyright 2017-2024 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */import React from"react";import{Line}from"react-chartjs-2";import ReactDOM from"react-dom";import Shape from"@giro3d/giro3d/entities/Shape.js";import{Chart as ChartJS,CategoryScale,LinearScale,PointElement,LineElement,Title,Tooltip,Filler}from"chart.js";import FileSaver from"file-saver";import PropTypes from"prop-types";import{Vector3}from"three";import LocaleUtils from"../../utils/LocaleUtils";import MeasureUtils from"../../utils/MeasureUtils";import MiscUtils from"../../utils/MiscUtils";import ResizeableWindow from"../ResizeableWindow";import"../../plugins/style/HeightProfile.css";ChartJS.register(CategoryScale,LinearScale,PointElement,LineElement,Title,Tooltip,Filler);var HeightProfilePrintDialog=/*#__PURE__*/function(_React$PureComponent){function HeightProfilePrintDialog(props){var _this;_classCallCheck(this,HeightProfilePrintDialog);_this=_callSuper(this,HeightProfilePrintDialog,[props]);_defineProperty(_this,"state",{initialized:false,imageUrl:""});_defineProperty(_this,"closePrintWindow",function(){_this.externalWindow.close()});_defineProperty(_this,"setWindowContent",function(){_this.externalWindow.addEventListener("beforeunload",_this.props.onClose,false);var container=_this.externalWindow.document.getElementById("heightprofilecontainer");if(container){var printBtn=_this.externalWindow.document.createElement("div");printBtn.id="print";printBtn.style.marginBottom="1em";printBtn.innerHTML="<style type=\"text/css\">@media print{ #print { display: none; }}</style>"+"<button onClick=\"(function(){window.print();})()\">"+LocaleUtils.tr("heightprofile.print")+"</button>";container.appendChild(printBtn);_this.imageEl=_this.externalWindow.document.createElement("div");_this.imageEl.innerHTML=LocaleUtils.tr("heightprofile.loadingimage");container.appendChild(_this.imageEl);_this.portalEl=_this.externalWindow.document.createElement("div");_this.portalEl.id="profile";container.appendChild(_this.portalEl);_this.setState({initialized:true});_this.externalWindow.document.body.style.overflowX="hidden"}else{_this.externalWindow.document.body.innerHTML="Broken template. An element with id=heightprofilecontainer must exist."}});_defineProperty(_this,"scheduleRefreshImage",function(){clearTimeout(_this.refreshTimeout);_this.refreshTimeout=setTimeout(_this.refreshImage,500)});_defineProperty(_this,"refreshImage",function(){var src=_this.props.sceneContext.scene.renderer.domElement.toDataURL("image/png");var width=_this.props.sceneContext.scene.renderer.domElement.offsetWidth;_this.imageEl.innerHTML="<img src=\"".concat(src,"\" style=\"width: 100%; max-width: ").concat(width,"px\" />")});_defineProperty(_this,"windowResized",function(){if(_this.chart){_this.chart.resize()}});_this.externalWindow=null;_this.chart=null;_this.portalEl=null;_this.imageEl=null;return _this}_inherits(HeightProfilePrintDialog,_React$PureComponent);return _createClass(HeightProfilePrintDialog,[{key:"componentDidMount",value:function componentDidMount(){var templatePath=MiscUtils.resolveAssetsPath(this.props.templatePath);this.externalWindow=window.open(templatePath,LocaleUtils.tr("heightprofile.title"),"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes");this.externalWindow.addEventListener("load",this.setWindowContent,false);this.externalWindow.addEventListener("resize",this.windowResized,false);window.addEventListener("beforeunload",this.closePrintWindow);this.props.sceneContext.scene.view.controls.addEventListener("change",this.scheduleRefreshImage)}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){if(this.state.initialized&&!prevState.initialized){this.refreshImage()}}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.closePrintWindow();window.removeEventListener("beforeunload",this.closePrintWindow);this.props.sceneContext.scene.view.controls.removeEventListener("change",this.scheduleRefreshImage)}},{key:"render",value:function render(){var _this2=this;if(!this.state.initialized){return null}return/*#__PURE__*/ReactDOM.createPortal(this.props.children(function(el){_this2.chart=el},false),this.portalEl)}}])}(React.PureComponent);_defineProperty(HeightProfilePrintDialog,"propTypes",{children:PropTypes.func,onClose:PropTypes.func,sceneContext:PropTypes.object,templatePath:PropTypes.string});var HeightProfile=/*#__PURE__*/function(_React$Component){function HeightProfile(props){var _this3;_classCallCheck(this,HeightProfile);_this3=_callSuper(this,HeightProfile,[props]);_defineProperty(_this3,"state",{printdialog:false,visible:true});_defineProperty(_this3,"onClose",function(){_this3.setState({visible:false,printdialog:false});_this3.marker.visible=false});_defineProperty(_this3,"renderHeightProfile",function(saveRef,interactive){var distanceStr=LocaleUtils.tr("heightprofile.distance");var heightStr=LocaleUtils.tr("heightprofile.height");var aslStr=LocaleUtils.tr("heightprofile.asl");var data={labels:_this3.props.data.map(function(entry){return entry[3]}),datasets:[{data:_this3.props.data.map(function(entry){return entry[2]}),fill:true,backgroundColor:"rgba(255,0,0,0.5)",borderColor:"rgb(255,0,0)",borderWidth:2,pointRadius:0,order:1}]};// Approx 10 ticks
8
+ var totLength=_this3.props.data[_this3.props.data.length-1][3];var maxHeight=Math.max.apply(Math,_toConsumableArray(_this3.props.data.map(function(x){return x[2]})));var stepSizeFact=Math.pow(10,Math.ceil(Math.log10(totLength/10)));var stepSize=Math.round(totLength/stepSizeFact)*stepSizeFact/10;var prec=_this3.props.heightProfilePrecision;var options={responsive:true,maintainAspectRatio:false,animation:{duration:0},plugins:{legend:{display:false},tooltip:{enabled:interactive,intersect:false,displayColors:false,bodyFont:{weight:"bold"},callbacks:{title:function title(ctx){return distanceStr+": "+MeasureUtils.formatMeasurement(ctx[0].parsed.x,false,"metric")},label:function label(ctx){return heightStr+": "+MeasureUtils.formatMeasurement(ctx.parsed.y,false,"m")+" "+aslStr}}}},scales:{x:{type:"linear",ticks:{stepSize:stepSize,font:{size:10},callback:function callback(value){return value}},title:{display:true,text:distanceStr+" [m]",padding:0},max:Math.ceil(totLength)},y:{ticks:{font:{size:10},callback:function callback(value){return value.toFixed(prec)}},title:{display:true,text:heightStr+" [m "+aslStr+"]"},max:Math.ceil(maxHeight)}},onHover:interactive?function(evt,activeEls,chart){var chartArea=chart.chartArea;var chartX=Math.min(Math.max(evt.x-chartArea.left),chartArea.width);_this3.updateMarker(chartX/chartArea.width*totLength)}:undefined};return/*#__PURE__*/React.createElement("div",{className:"height-profile-chart-container",onMouseLeave:_this3.hideMarker,role:"body",style:{position:"relative"}},/*#__PURE__*/React.createElement(Line,{data:data,options:options,ref:saveRef}))});_defineProperty(_this3,"resizeChart",function(){if(_this3.chart){_this3.chart.resize()}});_defineProperty(_this3,"updateMarker",function(dist){var data=_this3.props.data;var i=data.findIndex(function(x){return x[3]>=dist});if(i===0){_this3.marker.setPoints([_construct(Vector3,_toConsumableArray(data[0]))])}else{var lambda=(dist-data[i-1][3])/(data[i][3]-data[i-1][3]);var p=new Vector3(data[i-1][0]+lambda*(data[i][0]-data[i][0]),data[i-1][1]+lambda*(data[i][1]-data[i][1]),data[i-1][2]+lambda*(data[i][2]-data[i][2]));_this3.marker.setPoints([p])}_this3.marker.visible=true});_defineProperty(_this3,"hideMarker",function(){_this3.marker.visible=false});_defineProperty(_this3,"exportProfile",function(){var csv="";csv+="index"+"\t"+"distance"+"\t"+"elevation"+"\n";_this3.props.data.forEach(function(entry,idx){var sample={x:entry[3],y:entry[2]};var prec=_this3.props.heightProfilePrecision;var distance=Math.round(sample.x*Math.pow(10,prec))/Math.pow(10,prec);var height=Math.round(sample.y*Math.pow(10,prec))/Math.pow(10,prec);csv+=String(idx).replace("\"","\"\"")+"\t"+String(distance)+"\t"+String(height)+"\n"});FileSaver.saveAs(new Blob([csv],{type:"text/plain;charset=utf-8"}),"heightprofile.csv")});_this3.chart=null;_this3.profilePrintWindow=null;return _this3}_inherits(HeightProfile,_React$Component);return _createClass(HeightProfile,[{key:"componentDidMount",value:function componentDidMount(){this.marker=new Shape({showVertexLabels:true,showLine:false,showVertices:true,vertexLabelFormatter:function vertexLabelFormatter(_ref){var position=_ref.position;return MeasureUtils.formatMeasurement(position.z,false,"m")}});this.marker.visible=false;this.props.sceneContext.scene.add(this.marker)}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.props.sceneContext.scene.remove(this.marker)}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(this.props.data!==prevProps.data){this.setState({visible:true})}}},{key:"render",value:function render(){var _this4=this;if(!this.state.visible){return null}var extraControls=[{icon:"export",callback:this.exportProfile,title:LocaleUtils.tr("heightprofile.export")},{icon:"print",active:this.state.printdialog,callback:function callback(){return _this4.setState(function(state){return{printdialog:!state.printdialog}})},title:LocaleUtils.tr("heightprofile.print")}];return[/*#__PURE__*/React.createElement(ResizeableWindow,{dockable:"bottom",extraControls:extraControls,icon:"line",initialHeight:this.props.height,initialWidth:600,initiallyDocked:true,key:"ProfileDialog",onClose:this.onClose,onExternalWindowResized:this.resizeChart,splitScreenWhenDocked:true,title:LocaleUtils.tr("heightprofile.title"),usePortal:false},this.renderHeightProfile(function(el){_this4.chart=el},true)),this.state.printdialog?/*#__PURE__*/React.createElement(HeightProfilePrintDialog,{key:"ProfilePrintDialog",onClose:function onClose(){return _this4.setState({printdialog:false})},sceneContext:this.props.sceneContext,templatePath:this.props.templatePath},this.renderHeightProfile):null]}}])}(React.Component);_defineProperty(HeightProfile,"propTypes",{data:PropTypes.array,/** The height of the height profile widget in pixels. */height:PropTypes.number,/** The precision of displayed and exported values (0: no decimals, 1: 1 decimal position, etc). */heightProfilePrecision:PropTypes.number,sceneContext:PropTypes.object,/** Template location for the height profile print functionality */templatePath:PropTypes.string});_defineProperty(HeightProfile,"defaultProps",{heightProfilePrecision:0,height:150,templatePath:":/templates/heightprofileprint.html"});export{HeightProfile as default};
@@ -0,0 +1,12 @@
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 _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}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)}/**
2
+ * Copyright 2025 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */import React from"react";import{connect}from"react-redux";import isEmpty from"lodash.isempty";import PropTypes from"prop-types";import{BufferGeometry,Float32BufferAttribute,Mesh,MeshStandardMaterial,Raycaster,Vector2}from"three";import LocaleUtils from"../../utils/LocaleUtils";import Icon from"../Icon";import SideBar from"../SideBar";import"./style/HideObjects3D.css";var HideObjects3D=/*#__PURE__*/function(_React$Component){function HideObjects3D(){var _this;_classCallCheck(this,HideObjects3D);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,HideObjects3D,[].concat(args));_defineProperty(_this,"state",{hiddenObjects:[]});_defineProperty(_this,"renderBody",function(){return/*#__PURE__*/React.createElement("div",{className:"hideobjects3d-body"},isEmpty(_this.state.hiddenObjects)?/*#__PURE__*/React.createElement("i",null,LocaleUtils.tr("hideobjects3d.clickonmap")):/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("div",{className:"hideobjects3d-list"},_this.state.hiddenObjects.map(function(entry){return/*#__PURE__*/React.createElement("div",{key:entry.object.uuid,onMouseEnter:function onMouseEnter(){return _this.showHighlight(entry)},onMouseLeave:function onMouseLeave(){return _this.hideHighlight(entry)}},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("hideobjects3d.object")),/*#__PURE__*/React.createElement(Icon,{icon:"eye",onClick:function onClick(){return _this.restoreObject(entry)},title:LocaleUtils.tr("hideobjects3d.restore")}))})),/*#__PURE__*/React.createElement("div",{className:"hideobjects3d-restorebutton"},/*#__PURE__*/React.createElement("button",{className:"button",onClick:_this.restoreAll},LocaleUtils.tr("hideobjects3d.restoreall")))))});_defineProperty(_this,"clear",function(){_this.setState({pickAttrs:null});_this.props.sceneContext.removeSceneObject("__identify3d_highlight")});_defineProperty(_this,"pickOnRelease",function(ev){if(ev.button!==0){return}ev.view.addEventListener("mouseup",_this.pick,{once:true});ev.view.addEventListener("mousemove",function(){ev.view.removeEventListener("mouseup",_this.pick)},{once:true})});_defineProperty(_this,"pick",function(ev){if(_this.props.enabled!==true){return}_this.clear();// Setup raycaster
8
+ var raycaster=new Raycaster;raycaster.firstHitOnly=true;var camera=_this.props.sceneContext.scene.view.camera;var rect=ev.target.getBoundingClientRect();var x=(ev.clientX-rect.left)/rect.width*2-1;var y=-((ev.clientY-rect.top)/rect.height)*2+1;raycaster.setFromCamera(new Vector2(x,y),camera);var picks=[];Object.entries(_this.props.sceneContext.sceneObjects).forEach(function(_ref){var _object$tiles;var _ref2=_slicedToArray(_ref,2),objId=_ref2[0],options=_ref2[1];if(!options.layertree||!options.visibility){return}var object=_this.props.sceneContext.getSceneObject(objId);if((_object$tiles=object.tiles)!==null&&_object$tiles!==void 0&&_object$tiles.raycast){var intersections=[];object.tiles.raycast(raycaster,intersections);intersections.forEach(function(entry){entry.isTilePick=true});picks.push.apply(picks,intersections)}else{picks.push.apply(picks,_toConsumableArray(raycaster.intersectObjects([object],true)))}});picks.sort(function(a,b){return a.distance-b.distance});if(isEmpty(picks)){return}else if(picks[0].isTilePick){_this.hideTilePick(picks[0])}else{_this.hideObjectPick(picks[0])}});_defineProperty(_this,"hideTilePick",function(pick){var batchidAttr=pick.object.geometry.getAttribute("_batchid");var posAttr=pick.object.geometry.getAttribute("position");var norAttr=pick.object.geometry.getAttribute("normal");var pickBatchId=batchidAttr.getX(pick.face.a);// Extract/shift batch geometry
9
+ var pickPosition=[];var pickNormal=[];batchidAttr.array.forEach(function(batchId,idx){if(batchId===pickBatchId){pickPosition.push.apply(pickPosition,_toConsumableArray(posAttr.array.slice(3*idx,3*idx+3)));pickNormal.push.apply(pickNormal,_toConsumableArray(norAttr.array.slice(3*idx,3*idx+3)));posAttr.array[3*idx+2]-=100000}});posAttr.needsUpdate=true;_this.props.sceneContext.scene.notifyChange();// Create highlight geometry
10
+ _this.storeHiddenObject(pick,pickPosition,pickNormal,null,pickBatchId)});_defineProperty(_this,"hideObjectPick",function(pick){pick.object.visible=false;_this.props.sceneContext.scene.notifyChange();var posAttr=pick.object.geometry.getAttribute("position");var norAttr=pick.object.geometry.getAttribute("normal");var index=pick.object.geometry.getIndex();// Create highlight geometry
11
+ _this.storeHiddenObject(pick,posAttr.array,norAttr.array,index)});_defineProperty(_this,"storeHiddenObject",function(pick,position,normal){var index=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var batchId=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;var material=new MeshStandardMaterial({color:16711680});var geometry=new BufferGeometry;geometry.setAttribute("position",new Float32BufferAttribute(position,3));geometry.setAttribute("normal",new Float32BufferAttribute(normal,3));geometry.setIndex(index);var mesh=new Mesh(geometry,material);mesh.receiveShadow=true;mesh.applyMatrix4(pick.object.matrixWorld);mesh.updateMatrixWorld();_this.setState(function(state){return{hiddenObjects:[].concat(_toConsumableArray(state.hiddenObjects),[{object:pick.object,isTileObject:pick.isTilePick,batchId:batchId,highlight:mesh}])}})});_defineProperty(_this,"showHighlight",function(entry){_this.props.sceneContext.addSceneObject(entry.highlight.uuid,entry.highlight)});_defineProperty(_this,"hideHighlight",function(entry){_this.props.sceneContext.removeSceneObject(entry.highlight.uuid)});_defineProperty(_this,"restoreObject",function(entry){if(entry.isTileObject){var batchidAttr=entry.object.geometry.getAttribute("_batchid");var posAttr=entry.object.geometry.getAttribute("position");// Unshift batch geometry
12
+ batchidAttr.array.forEach(function(batchId,idx){if(batchId===entry.batchId){posAttr.array[3*idx+2]+=100000}});posAttr.needsUpdate=true}else{entry.object.visible=true}_this.hideHighlight(entry);_this.props.sceneContext.scene.notifyChange();_this.setState(function(state){return{hiddenObjects:state.hiddenObjects.filter(function(x){return x!==entry})}})});_defineProperty(_this,"restoreAll",function(){_toConsumableArray(_this.state.hiddenObjects).forEach(_this.restoreObject)});return _this}_inherits(HideObjects3D,_React$Component);return _createClass(HideObjects3D,[{key:"componentDidMount",value:function componentDidMount(){this.props.sceneContext.scene.viewport.addEventListener("mousedown",this.pickOnRelease)}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){var _prevProps$sceneConte;if(this.props.sceneContext.scene!==((_prevProps$sceneConte=prevProps.sceneContext)===null||_prevProps$sceneConte===void 0?void 0:_prevProps$sceneConte.scene)){this.setState({hiddenObjects:[]})}}},{key:"render",value:function render(){var _this2=this;return/*#__PURE__*/React.createElement(SideBar,{icon:"eye",id:"HideObjects3D",title:LocaleUtils.tr("appmenu.items.HideObjects3D"),width:"20em"},function(){return{body:_this2.renderBody()}})}}])}(React.Component);_defineProperty(HideObjects3D,"propTypes",{enabled:PropTypes.bool,sceneContext:PropTypes.object});export default connect(function(state){return{enabled:state.task.id==="HideObjects3D"}},{})(HideObjects3D);
@@ -0,0 +1,13 @@
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 _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}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)}/**
2
+ * Copyright 2024 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */import React from"react";import{connect}from"react-redux";import isEmpty from"lodash.isempty";import PropTypes from"prop-types";import{BufferGeometry,Float32BufferAttribute,Mesh,MeshStandardMaterial,Raycaster,Vector2}from"three";import LocaleUtils from"../../utils/LocaleUtils";import ResizeableWindow from"../ResizeableWindow";import"../style/IdentifyViewer.css";var Identify3D=/*#__PURE__*/function(_React$Component){function Identify3D(){var _this;_classCallCheck(this,Identify3D);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,Identify3D,[].concat(args));_defineProperty(_this,"state",{pickAttrs:null});_defineProperty(_this,"clear",function(){_this.setState({pickAttrs:null});_this.props.sceneContext.removeSceneObject("__identify3d_highlight")});_defineProperty(_this,"identifyOnRelease",function(ev){if(ev.button!==0){return}ev.view.addEventListener("mouseup",_this.identify,{once:true});ev.view.addEventListener("mousemove",function(){ev.view.removeEventListener("mouseup",_this.identify)},{once:true})});_defineProperty(_this,"identify",function(ev){if(_this.props.identifyEnabled!==true){return}_this.clear();// Setup raycaster
8
+ var raycaster=new Raycaster;raycaster.firstHitOnly=true;var camera=_this.props.sceneContext.scene.view.camera;var rect=ev.target.getBoundingClientRect();var x=(ev.clientX-rect.left)/rect.width*2-1;var y=-((ev.clientY-rect.top)/rect.height)*2+1;raycaster.setFromCamera(new Vector2(x,y),camera);var picks=[];Object.entries(_this.props.sceneContext.sceneObjects).forEach(function(_ref){var _object$tiles;var _ref2=_slicedToArray(_ref,2),objId=_ref2[0],options=_ref2[1];if(!options.layertree||!options.visibility){return}var object=_this.props.sceneContext.getSceneObject(objId);if((_object$tiles=object.tiles)!==null&&_object$tiles!==void 0&&_object$tiles.raycast){var intersections=[];object.tiles.raycast(raycaster,intersections);intersections.forEach(function(entry){entry.isTilePick=true});picks.push.apply(picks,intersections)}else{picks.push.apply(picks,_toConsumableArray(raycaster.intersectObjects([object],true)))}});picks.sort(function(a,b){return a.distance-b.distance});if(isEmpty(picks)){return}else if(picks[0].isTilePick){_this.identifyTilePick(picks[0])}else{_this.identifyObjectPick(picks[0])}});_defineProperty(_this,"identifyTilePick",function(pick){var batchidAttr=pick.object.geometry.getAttribute("_batchid");var posAttr=pick.object.geometry.getAttribute("position");var norAttr=pick.object.geometry.getAttribute("normal");var pickBatchId=batchidAttr.getX(pick.face.a);// Extract batch geometry
9
+ var pickPosition=[];var pickNormal=[];batchidAttr.array.forEach(function(batchId,idx){if(batchId===pickBatchId){pickPosition.push.apply(pickPosition,_toConsumableArray(posAttr.array.slice(3*idx,3*idx+3)));pickNormal.push.apply(pickNormal,_toConsumableArray(norAttr.array.slice(3*idx,3*idx+3)))}});// Add selection object
10
+ _this.addHiglightGeometry(pick.object.matrixWorld,pickPosition,pickNormal);// Extract attributes from batch table and set pick attrs
11
+ var batchTableObject=pick.object;while(!batchTableObject.batchTable){batchTableObject=batchTableObject.parent}var batchTable=batchTableObject.batchTable;_this.setState({pickAttrs:batchTable.getDataFromId(pickBatchId)})});_defineProperty(_this,"identifyObjectPick",function(pick){var posAttr=pick.object.geometry.getAttribute("position");var norAttr=pick.object.geometry.getAttribute("normal");var index=pick.object.geometry.getIndex();// Add selection object
12
+ _this.addHiglightGeometry(pick.object.matrixWorld,posAttr.array,norAttr.array,index);// Set pick attrs
13
+ _this.setState({pickAttrs:pick.object.userData})});_defineProperty(_this,"addHiglightGeometry",function(matrixWorld,position,normal){var index=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;var material=new MeshStandardMaterial({color:16711680});var geometry=new BufferGeometry;geometry.setAttribute("position",new Float32BufferAttribute(position,3));geometry.setAttribute("normal",new Float32BufferAttribute(normal,3));geometry.setIndex(index);var mesh=new Mesh(geometry,material);mesh.applyMatrix4(matrixWorld);mesh.updateMatrixWorld();mesh.receiveShadow=true;_this.props.sceneContext.addSceneObject("__identify3d_highlight",mesh)});return _this}_inherits(Identify3D,_React$Component);return _createClass(Identify3D,[{key:"componentDidMount",value:function componentDidMount(){this.props.sceneContext.scene.viewport.addEventListener("mousedown",this.identifyOnRelease)}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps){if(!this.props.identifyEnabled&&prevProps.identifyEnabled){this.clear()}}},{key:"render",value:function render(){if(this.state.pickAttrs===null){return null}return/*#__PURE__*/React.createElement(ResizeableWindow,{dockable:"left",icon:"info-sign",initialHeight:320,initialWidth:240,initialX:0,initialY:0,initiallyDocked:true,onClose:this.clear,title:LocaleUtils.tr("identify.title")},/*#__PURE__*/React.createElement("div",{className:"identify-body",role:"body"},isEmpty(this.state.pickAttrs)?/*#__PURE__*/React.createElement("span",null,/*#__PURE__*/React.createElement("i",null,LocaleUtils.tr("identify.noattributes"))):/*#__PURE__*/React.createElement("div",{className:"identify-result-box"},/*#__PURE__*/React.createElement("table",{className:"attribute-list"},/*#__PURE__*/React.createElement("tbody",null,Object.entries(this.state.pickAttrs).map(function(_ref3){var _ref4=_slicedToArray(_ref3,2),key=_ref4[0],value=_ref4[1];return/*#__PURE__*/React.createElement("tr",{key:key},/*#__PURE__*/React.createElement("td",{className:"identify-attr-title"},/*#__PURE__*/React.createElement("i",null,key)),/*#__PURE__*/React.createElement("td",{className:"identify-attr-value"},value))}))))))}}])}(React.Component);_defineProperty(Identify3D,"propTypes",{identifyEnabled:PropTypes.bool,sceneContext:PropTypes.object});export default connect(function(state){return{identifyEnabled:state.task.identifyEnabled}},{})(Identify3D);
@@ -0,0 +1,8 @@
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 _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}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)}/**
2
+ * Copyright 2024 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */import React from"react";import classNames from"classnames";import PropTypes from"prop-types";import{Box3,Group}from"three";import{GLTFLoader}from"three/addons/loaders/GLTFLoader";import{v4 as uuidv4}from"uuid";import ConfigUtils from"../../utils/ConfigUtils";import LocaleUtils from"../../utils/LocaleUtils";import Icon from"../Icon";import SideBar from"../SideBar";import FileSelector from"../widgets/FileSelector";import NumberInput from"../widgets/NumberInput";import Spinner from"../widgets/Spinner";import"./style/LayerTree3D.css";var LayerTree3D=/*#__PURE__*/function(_React$Component){function LayerTree3D(){var _this;_classCallCheck(this,LayerTree3D);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,LayerTree3D,[].concat(args));_defineProperty(_this,"state",{activemenu:null,importvisible:false,selectedfile:null,importing:false});_defineProperty(_this,"renderBody",function(){var sceneContext=_this.props.sceneContext;return/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("div",{className:"layertree3d-section"},LocaleUtils.tr("layertree3d.objects")),Object.entries(sceneContext.sceneObjects).map(function(_ref){var _ref2=_slicedToArray(_ref,2),objectId=_ref2[0],entry=_ref2[1];return _this.renderLayerEntry(objectId,entry,sceneContext.updateSceneObject,true)}),/*#__PURE__*/React.createElement("div",{className:"layertree3d-section"},LocaleUtils.tr("layertree3d.layers")),Object.entries(sceneContext.colorLayers).map(function(_ref3){var _ref4=_slicedToArray(_ref3,2),layerId=_ref4[0],entry=_ref4[1];return _this.renderLayerEntry(layerId,entry,sceneContext.updateColorLayer,false)}),/*#__PURE__*/React.createElement("div",{className:"layertree3d-option",onClick:function onClick(){return _this.setState(function(state){return{importvisible:!state.importvisible}})}},/*#__PURE__*/React.createElement(Icon,{icon:_this.state.importvisible?"collapse":"expand"})," ",LocaleUtils.tr("layertree3d.importobjects")),_this.state.importvisible?_this.renderImportForm():null)});_defineProperty(_this,"renderLayerEntry",function(entryId,entry,updateCallback,isObject){var _entry$title,_entry$title2;if(entry.layertree===false){return null}var classes=classNames({"layertree3d-item":true,"layertree3d-item-disabled":!entry.visibility});var optMenuClasses=classNames({"layertree3d-item-menubutton":true,"layertree3d-item-menubutton-active":_this.state.activemenu===entryId});return/*#__PURE__*/React.createElement("div",{className:"layertree3d-item-container",key:entryId},/*#__PURE__*/React.createElement("div",{className:classes},/*#__PURE__*/React.createElement(Icon,{className:"layertree3d-item-checkbox",icon:entry.visibility?"checked":"unchecked",onClick:function onClick(){return updateCallback(entryId,{visibility:!entry.visibility})}}),/*#__PURE__*/React.createElement("span",{className:"layertree3d-item-title",title:(_entry$title=entry.title)!==null&&_entry$title!==void 0?_entry$title:entryId},(_entry$title2=entry.title)!==null&&_entry$title2!==void 0?_entry$title2:entryId),entry.drawGroup?/*#__PURE__*/React.createElement(Icon,{className:"layertree3d-item-remove",icon:"trash",onClick:function onClick(){return _this.props.sceneContext.removeSceneObject(entryId)}}):null,/*#__PURE__*/React.createElement(Icon,{className:optMenuClasses,icon:"cog",onClick:function onClick(){return _this.layerMenuToggled(entryId)}})),_this.state.activemenu===entryId?/*#__PURE__*/React.createElement("div",{className:"layertree3d-item-optionsmenu"},/*#__PURE__*/React.createElement("div",{className:"layertree3d-item-optionsmenu-row"},isObject?/*#__PURE__*/React.createElement(Icon,{icon:"zoom",onClick:function onClick(){return _this.zoomToObject(entryId)},title:LocaleUtils.tr("layertree3d.zoomtoobject")}):null,/*#__PURE__*/React.createElement(Icon,{icon:"transparency"}),/*#__PURE__*/React.createElement("input",{className:"layertree3d-item-transparency-slider",max:"255",min:"0",onChange:function onChange(ev){return updateCallback(entryId,{opacity:parseInt(ev.target.value,10)})},step:"1",type:"range",value:entry.opacity})),entry.extrusionHeight!==undefined?/*#__PURE__*/React.createElement("div",{className:"layertree3d-item-optionsmenu-row"},/*#__PURE__*/React.createElement("span",null,"Extrude: "),/*#__PURE__*/React.createElement(NumberInput,{max:500,min:0,onChange:function onChange(h){return updateCallback(entryId,{extrusionHeight:h})},value:entry.extrusionHeight})):null):null)});_defineProperty(_this,"renderImportForm",function(){return/*#__PURE__*/React.createElement("div",{className:"layertree3d-import-widget"},/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement(FileSelector,{accept:".gltf",file:_this.state.selectedfile,onFileSelected:function onFileSelected(file){return _this.setState({selectedfile:file})},title:LocaleUtils.tr("layertree3d.supportedformats")})),/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("button",{className:"button importlayer-addbutton",disabled:_this.state.selectedfile===null||_this.state.importing,onClick:_this.importFile,type:"button"},_this.state.importing?/*#__PURE__*/React.createElement(Spinner,null):null,LocaleUtils.tr("layertree3d.import"))))});_defineProperty(_this,"layerMenuToggled",function(entryId){_this.setState(function(state){return{activemenu:state.activemenu===entryId?null:entryId}})});_defineProperty(_this,"zoomToObject",function(objectId){var _obj$tiles;var obj=_this.props.sceneContext.getSceneObject(objectId);var bbox=new Box3;if(obj!==null&&obj!==void 0&&(_obj$tiles=obj.tiles)!==null&&_obj$tiles!==void 0&&_obj$tiles.root){obj.tiles.root.cached.boundingVolume.getAABB(bbox)}else{bbox.setFromObject(obj)}if(!bbox.isEmpty()){var bounds=[bbox.min.x,bbox.min.y,bbox.max.x,bbox.max.y];_this.props.sceneContext.setViewToExtent(bounds,0)}});_defineProperty(_this,"importFile",function(){if(!_this.state.selectedfile){return}_this.setState({importing:true});var file=_this.state.selectedfile;var reader=new FileReader;reader.onload=function(ev){var loader=new GLTFLoader;loader.parse(ev.target.result,ConfigUtils.getAssetsPath(),function(gltf){// GLTF is Y-UP, we need Z-UP
8
+ gltf.scene.rotation.x=Math.PI/2;gltf.scene.updateMatrixWorld();var objectId=uuidv4();var options={drawGroup:true,layertree:true,title:file.name};var group=new Group;group.add(gltf.scene);gltf.scene.traverse(function(c){if(c.geometry){c.castShadow=true;c.receiveShadow=true}});_this.props.sceneContext.addSceneObject(objectId,group,options)},function(err){/* eslint-disable-next-line */console.warn(err)});_this.setState({selectedfile:null,importing:false})};reader.readAsArrayBuffer(_this.state.selectedfile)});return _this}_inherits(LayerTree3D,_React$Component);return _createClass(LayerTree3D,[{key:"render",value:function render(){var _this2=this;return/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement(SideBar,{icon:"layers",id:"LayerTree3D",title:LocaleUtils.tr("appmenu.items.LayerTree3D"),width:"20em"},function(){return{body:_this2.renderBody()}}))}}])}(React.Component);_defineProperty(LayerTree3D,"propTypes",{sceneContext:PropTypes.object});export{LayerTree3D as default};
@@ -0,0 +1,29 @@
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 _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}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)}/**
2
+ * Copyright 2024 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */import React from"react";import{connect}from"react-redux";import Instance from"@giro3d/giro3d/core/Instance.js";import Coordinates from"@giro3d/giro3d/core/geographic/Coordinates";import Extent from"@giro3d/giro3d/core/geographic/Extent.js";import ElevationLayer from"@giro3d/giro3d/core/layer/ElevationLayer.js";import FeatureCollection from"@giro3d/giro3d/entities/FeatureCollection.js";import Map from"@giro3d/giro3d/entities/Map.js";import Tiles3D from"@giro3d/giro3d/entities/Tiles3D.js";import Inspector from"@giro3d/giro3d/gui/Inspector.js";import GeoTIFFSource from"@giro3d/giro3d/sources/GeoTIFFSource.js";import{fromUrl}from"geotiff";import isEmpty from"lodash.isempty";import PropTypes from"prop-types";import{Vector2,CubeTextureLoader,Group,Raycaster,Mesh}from"three";import{GLTFExporter}from"three/addons/exporters/GLTFExporter.js";import{GLTFLoader}from"three/addons/loaders/GLTFLoader";import{v4 as uuidv4}from"uuid";import{LayerRole}from"../../actions/layers";import{setCurrentTask}from"../../actions/task";import{BackgroundSwitcher}from"../../plugins/BackgroundSwitcher";import ConfigUtils from"../../utils/ConfigUtils";import CoordinatesUtils from"../../utils/CoordinatesUtils";import{registerPermalinkDataStoreHook,unregisterPermalinkDataStoreHook,UrlParams}from"../../utils/PermaLinkUtils";import BottomBar3D from"./BottomBar3D";import Compare3D from"./Compare3D";import Draw3D from"./Draw3D";import ExportObjects3D from"./ExportObjects3D";import HideObjects3D from"./HideObjects3D";import Identify3D from"./Identify3D";import LayerTree3D from"./LayerTree3D";import Map3DLight from"./Map3DLight";import MapControls3D from"./MapControls3D";import MapExport3D from"./MapExport3D";import Measure3D from"./Measure3D";import OverviewMap3D from"./OverviewMap3D";import TopBar3D from"./TopBar3D";import View3DSwitcher from"./View3DSwitcher";import LayerRegistry from"./layers/index";import Tiles3DStyle from"./utils/Tiles3DStyle";import"./style/Map3D.css";var UnloadWrapper=/*#__PURE__*/function(_React$Component){function UnloadWrapper(){var _this;_classCallCheck(this,UnloadWrapper);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,UnloadWrapper,[].concat(args));_defineProperty(_this,"onUnload",function(el){if(!el){_this.props.onUnload(_this.props.sceneId)}});return _this}_inherits(UnloadWrapper,_React$Component);return _createClass(UnloadWrapper,[{key:"render",value:function render(){return/*#__PURE__*/React.createElement("div",null,this.props.children,/*#__PURE__*/React.createElement("span",{ref:this.onUnload}))}}])}(React.Component);_defineProperty(UnloadWrapper,"propTypes",{children:PropTypes.oneOfType([PropTypes.node,PropTypes.func]),onUnload:PropTypes.func,sceneId:PropTypes.string});var Map3D=/*#__PURE__*/function(_React$Component2){function Map3D(props){var _this2;_classCallCheck(this,Map3D);_this2=_callSuper(this,Map3D,[props]);_defineProperty(_this2,"state",{sceneContext:_objectSpread(_objectSpread({},Map3D.defaultSceneState),{},{addLayer:function addLayer(layer){},getLayer:function getLayer(layerId){},removeLayer:function removeLayer(layerId){},updateColorLayer:function updateColorLayer(layerId,options){},addSceneObject:function addSceneObject(objectId,object){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{}},getSceneObject:function getSceneObject(objectId){},removeSceneObject:function removeSceneObject(objectId){},updateSceneObject:function updateSceneObject(objectId,options){},getMap:function getMap(){},setViewToExtent:function setViewToExtent(bounds,angle){},getTerrainHeightFromDTM:function getTerrainHeightFromDTM(scenePos){},getTerrainHeightFromMap:function getTerrainHeightFromMap(scenePos){},getSceneIntersection:function getSceneIntersection(x,y){}}),sceneId:null});_defineProperty(_this2,"applyBaseLayer",function(){var baseLayer=_this2.state.sceneContext.baseLayers.find(function(e){return e.visibility===true});_this2.removeLayer("__baselayer");if(!baseLayer){return}var layerCreator=LayerRegistry[baseLayer.type];if(layerCreator!==null&&layerCreator!==void 0&&layerCreator.create3d){var layer3d=layerCreator.create3d(baseLayer,_this2.state.sceneContext.mapCrs);_this2.addLayer("__baselayer",layer3d);_this2.map.insertLayerAfter(layer3d,null)}});_defineProperty(_this2,"setBaseLayer",function(layer,visibility){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{baseLayers:state.sceneContext.baseLayers.map(function(entry){return _objectSpread(_objectSpread({},entry),{},{visibility:entry.name===layer.name?visibility:false})})})}})});_defineProperty(_this2,"collectColorLayers",function(prevColorLayers){return _this2.props.layers.reduce(function(colorLayers,layer){var _prevOptions$visibili,_prevOptions$opacity,_prevOptions$extrusio;if(layer.role!==LayerRole.THEME&&layer.role!==LayerRole.USERLAYER){return colorLayers}var layerCreator=LayerRegistry[layer.type];if(!layerCreator||!layerCreator.create3d){return colorLayers}var prevOptions=prevColorLayers[layer.uuid];colorLayers[layer.uuid]=_objectSpread(_objectSpread({},layer),{},{visibility:(_prevOptions$visibili=prevOptions===null||prevOptions===void 0?void 0:prevOptions.visibility)!==null&&_prevOptions$visibili!==void 0?_prevOptions$visibili:false,opacity:(_prevOptions$opacity=prevOptions===null||prevOptions===void 0?void 0:prevOptions.opacity)!==null&&_prevOptions$opacity!==void 0?_prevOptions$opacity:255,extrusionHeight:(_prevOptions$extrusio=prevOptions===null||prevOptions===void 0?void 0:prevOptions.extrusionHeight)!==null&&_prevOptions$extrusio!==void 0?_prevOptions$extrusio:["vector","wfs"].includes(layer.type)?0:undefined});return colorLayers},{})});_defineProperty(_this2,"applyColorLayerUpdates",function(colorLayers,prevColorLayers){// Add-update new layers
8
+ var layerBelow=_this2.getLayer("__baselayer");Object.entries(colorLayers).reverse().forEach(function(_ref){var _ref2=_slicedToArray(_ref,2),layerId=_ref2[0],options=_ref2[1];var prevOptions=prevColorLayers[layerId];var layerCreator=LayerRegistry[options.type];var mapLayer=_this2.getLayer(layerId);if(mapLayer){layerCreator.update3d(mapLayer.source,options,prevOptions,_this2.state.sceneContext.mapCrs)}else{mapLayer=layerCreator.create3d(options,_this2.state.sceneContext.mapCrs);_this2.addLayer(layerId,mapLayer)}_this2.map.insertLayerAfter(mapLayer,layerBelow);mapLayer.visible=options.visibility;mapLayer.opacity=options.opacity/255;layerBelow=mapLayer;if(options.extrusionHeight>0){_this2.createUpdateExtrudedLayer(mapLayer,options,options.features!==(prevOptions===null||prevOptions===void 0?void 0:prevOptions.features))}else if((prevOptions===null||prevOptions===void 0?void 0:prevOptions.extrusionHeight)>0){_this2.removeExtrudedLayer(options.uuid)}});// Remove old layers
9
+ Object.entries(prevColorLayers).forEach(function(_ref3){var _ref4=_slicedToArray(_ref3,2),layerId=_ref4[0],options=_ref4[1];if(!(layerId in colorLayers)){if(options.extrusionHeight){_this2.removeExtrudedLayer(options.uuid)}_this2.removeLayer(layerId)}});_this2.instance.notifyChange(_this2.map)});_defineProperty(_this2,"createUpdateExtrudedLayer",function(mapLayer,options){var _options$features,_options$features$red;var forceCreate=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var bounds=options.bbox.bounds;var extent=new Extent(options.bbox.crs,bounds[0],bounds[2],bounds[1],bounds[3]);var objId=options.uuid+":extruded";var makeColor=function makeColor(c){if(Array.isArray(c)){return c[0]<<16|c[1]<<8|c[2]}else if(typeof c==="string"){return parseInt(c.replace("#",""),16)}else{return c}};var obj=_this2.objectMap[objId];if(!obj||forceCreate){var _options$color;if(obj){_this2.instance.remove(obj)}var layercolor=makeColor((_options$color=options.color)!==null&&_options$color!==void 0?_options$color:"#FF0000");obj=new FeatureCollection({source:mapLayer.source.source,extent:extent,ignoreZ:true,elevation:function elevation(feature){var coordinates=feature.getGeometry().getCoordinates();while(Array.isArray(coordinates[0])){coordinates=coordinates[0]}return coordinates[2]||_this2.getTerrainHeightFromMap(coordinates)||0},extrusionOffset:function extrusionOffset(){return obj.userData.extrusionHeight},style:function style(feature){var _obj$userData$feature,_obj$userData$feature2;return(_obj$userData$feature=(_obj$userData$feature2=obj.userData.featureStyles)===null||_obj$userData$feature2===void 0?void 0:_obj$userData$feature2[feature.getId()])!==null&&_obj$userData$feature!==void 0?_obj$userData$feature:{fill:{color:layercolor,shading:true}}}});obj.castShadow=true;obj.receiveShadow=true;_this2.instance.add(obj);_this2.objectMap[objId]=obj}obj.userData.extrusionHeight=options.extrusionHeight;obj.userData.featureStyles=(_options$features=options.features)===null||_options$features===void 0||(_options$features$red=_options$features.reduce)===null||_options$features$red===void 0?void 0:_options$features$red.call(_options$features,function(res,feature){return _objectSpread(_objectSpread({},res),{},_defineProperty({},feature.id,{fill:{color:makeColor(feature.styleOptions.fillColor),shading:true}}))},{});obj.opacity=mapLayer.opacity;obj.visible=mapLayer.visible;obj.updateStyles()});_defineProperty(_this2,"removeExtrudedLayer",function(layerId){var objId=layerId+":extruded";if(_this2.objectMap[objId]){_this2.instance.remove(_this2.objectMap[objId]);delete _this2.objectMap[objId]}_this2.instance.notifyChange()});_defineProperty(_this2,"applySceneObjectUpdates",function(sceneObjects){Object.entries(sceneObjects).forEach(function(_ref5){var _ref6=_slicedToArray(_ref5,2),objectId=_ref6[0],options=_ref6[1];var object=_this2.objectMap[objectId];object.visible=options.visibility&&options.opacity>0;if(object.opacity!==undefined){object.opacity=options.opacity/255}else{object.traverse(function(child){if(child instanceof Mesh){child.material.transparent=options.opacity<255;child.material.opacity=options.opacity/255;child.material.needsUpdate=true}})}_this2.instance.notifyChange(object)})});_defineProperty(_this2,"addLayer",function(layerId,layer){layer.userData.layerId=layerId;_this2.map.addLayer(layer)});_defineProperty(_this2,"getLayer",function(layerId){var _this2$map$getLayers$;return(_this2$map$getLayers$=_this2.map.getLayers(function(l){return l.userData.layerId===layerId})[0])!==null&&_this2$map$getLayers$!==void 0?_this2$map$getLayers$:null});_defineProperty(_this2,"removeLayer",function(layerId){_this2.map.getLayers(function(l){return l.userData.layerId===layerId}).forEach(function(layer){_this2.map.removeLayer(layer,{dispose:true})})});_defineProperty(_this2,"updateColorLayer",function(layerId,options){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{colorLayers:_objectSpread(_objectSpread({},state.sceneContext.colorLayers),{},_defineProperty({},layerId,_objectSpread(_objectSpread({},state.sceneContext.colorLayers[layerId]),options)))})}})});_defineProperty(_this2,"addSceneObject",function(objectId,object){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};_this2.sceneObjectGroup.add(object);_this2.objectMap[objectId]=object;_this2.setState(function(state){var objectState=_objectSpread({visibility:true,opacity:255,layertree:false},options);return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{sceneObjects:_objectSpread(_objectSpread({},state.sceneContext.sceneObjects),{},_defineProperty({},objectId,objectState))})}})});_defineProperty(_this2,"getSceneObject",function(objectId){return _this2.objectMap[objectId]});_defineProperty(_this2,"removeSceneObject",function(objectId){if(!_this2.objectMap[objectId]){return}_this2.sceneObjectGroup.remove(_this2.objectMap[objectId]);delete _this2.objectMap[objectId];_this2.setState(function(state){var newSceneObjects=_objectSpread({},state.sceneContext.sceneObjects);delete newSceneObjects[objectId];return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{sceneObjects:newSceneObjects})}})});_defineProperty(_this2,"updateSceneObject",function(objectId,options){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{sceneObjects:_objectSpread(_objectSpread({},state.sceneContext.sceneObjects),{},_defineProperty({},objectId,_objectSpread(_objectSpread({},state.sceneContext.sceneObjects[objectId]),options)))})}})});_defineProperty(_this2,"getMap",function(){return _this2.map});_defineProperty(_this2,"setupContainer",function(el){if(el){_this2.container=el;_this2.setupInstance()}});_defineProperty(_this2,"setupInstance",function(){var _this2$props$theme$ma,_this2$props$theme$ma2,_this2$props$theme$ma3,_this2$props$theme$ma6,_this2$props$theme$ma7;if(_this2.instance){_this2.disposeInstance()}var projection=_this2.props.theme.mapCrs;// Setup instance
10
+ _this2.instance=new Instance({target:_this2.container,crs:projection,renderer:{clearColor:0,preserveDrawingBuffer:true}});_this2.sceneObjectGroup=new Group;_this2.instance.add(_this2.sceneObjectGroup);// Setup map
11
+ var bounds=CoordinatesUtils.reprojectBbox(_this2.props.theme.initialBbox.bounds,_this2.props.theme.initialBbox.crs,projection);var extent=new Extent(projection,bounds[0],bounds[2],bounds[1],bounds[3]);_this2.map=new Map({extent:extent,backgroundColor:"white"});_this2.instance.add(_this2.map);// Setup camera
12
+ var center=extent.center();_this2.instance.view.camera.position.set(center.x,center.y,0.5*(extent.east-extent.west));// Skybox
13
+ var cubeTextureLoader=new CubeTextureLoader;cubeTextureLoader.setPath(ConfigUtils.getAssetsPath()+"/3d/skybox/");var cubeTexture=cubeTextureLoader.load(["px.jpg","nx.jpg","py.jpg","ny.jpg","pz.jpg","nz.jpg"]);_this2.instance.scene.background=cubeTexture;// Setup elevation
14
+ var demUrl=(_this2$props$theme$ma=(_this2$props$theme$ma2=_this2.props.theme.map3d)===null||_this2$props$theme$ma2===void 0||(_this2$props$theme$ma2=_this2$props$theme$ma2.dtm)===null||_this2$props$theme$ma2===void 0?void 0:_this2$props$theme$ma2.url)!==null&&_this2$props$theme$ma!==void 0?_this2$props$theme$ma:"";if(demUrl.startsWith(":")){demUrl=location.href.split("?")[0]+ConfigUtils.getAssetsPath()+demUrl.substr(1)}var demCrs=((_this2$props$theme$ma3=_this2.props.theme.map3d)===null||_this2$props$theme$ma3===void 0||(_this2$props$theme$ma3=_this2$props$theme$ma3.dtm)===null||_this2$props$theme$ma3===void 0?void 0:_this2$props$theme$ma3.crs)||"EPSG:3857";if(demUrl){var _this2$props$theme$ma4,_this2$props$theme$ma5;var demSource=new GeoTIFFSource({url:demUrl,crs:demCrs});var demMin=(_this2$props$theme$ma4=_this2.props.theme.map3d.dtm.min)!==null&&_this2$props$theme$ma4!==void 0?_this2$props$theme$ma4:undefined;var demMax=(_this2$props$theme$ma5=_this2.props.theme.map3d.dtm.max)!==null&&_this2$props$theme$ma5!==void 0?_this2$props$theme$ma5:undefined;var elevationLayer=new ElevationLayer({name:"dem",extent:extent,source:demSource,minmax:demMin!==undefined&&demMax!==undefined?{demMin:demMin,demMax:demMax}:undefined});_this2.addLayer("__dtm",elevationLayer)}// Collect baselayers
15
+ var visibleBaseLayer=null;var baseLayers=(((_this2$props$theme$ma6=_this2.props.theme.map3d)===null||_this2$props$theme$ma6===void 0?void 0:_this2$props$theme$ma6.basemaps)||[]).map(function(e){var baseLayer=_objectSpread(_objectSpread({},_this2.props.layers.find(function(bl){return bl.name===e.name})),{},{visibility:e.visibility===true});if(baseLayer.visibility){visibleBaseLayer=baseLayer}return baseLayer});if(visibleBaseLayer){_this2.setBaseLayer(visibleBaseLayer,true)}// Collect color layers
16
+ var colorLayers=_this2.collectColorLayers([]);// Add 3d tiles
17
+ _this2.objectMap={};var sceneObjects={};(((_this2$props$theme$ma7=_this2.props.theme.map3d)===null||_this2$props$theme$ma7===void 0?void 0:_this2$props$theme$ma7.tiles3d)||[]).forEach(function(entry){var _entry$title;var tilesUrl=entry.url;if(tilesUrl.startsWith(":")){tilesUrl=location.href.split("?")[0]+ConfigUtils.getAssetsPath()+tilesUrl.substr(1)}var tiles=new Tiles3D({url:tilesUrl});tiles.tiles.addEventListener("load-model",function(_ref7){var scene=_ref7.scene;return Tiles3DStyle.applyDeclarativeStyle(scene,entry)});tiles.castShadow=true;tiles.receiveShadow=true;tiles.userData.layertree=true;_this2.instance.add(tiles);_this2.objectMap[entry.name]=tiles;sceneObjects[entry.name]={visibility:true,opacity:255,layertree:true,title:(_entry$title=entry.title)!==null&&_entry$title!==void 0?_entry$title:entry.name}});_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{scene:_this2.instance,map:_this2.map,mapCrs:projection,dtmUrl:demUrl,dtmCrs:demCrs,baseLayers:baseLayers,colorLayers:colorLayers,sceneObjects:sceneObjects}),sceneId:uuidv4()}});// Inspector
18
+ if(["1","true"].includes((UrlParams.getParam("inspector")||"").toLowerCase())){_this2.inspector=new Inspector(_this2.container.previousElementSibling,_this2.instance)}});_defineProperty(_this2,"disposeInstance",function(){if(_this2.inspector){_this2.inspector.detach()}_this2.map.dispose({disposeLayers:true});Object.values(_this2.objectMap).forEach(function(object){_this2.instance.remove(object)});_this2.instance.dispose();_this2.inspector=null;_this2.map=null;_this2.objectMap={};_this2.sceneObjectGroup=null;_this2.instance=null;_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),Map3D.defaultSceneState)}});_this2.props.setCurrentTask(null)});_defineProperty(_this2,"onUnload",function(key){// Ensure scene has not already been disposed
19
+ if(_this2.state.sceneId===key){_this2.disposeInstance()}});_defineProperty(_this2,"setupControls",function(instance){_this2.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{setViewToExtent:instance===null||instance===void 0?void 0:instance.setViewToExtent})}},_this2.props.onMapInitialized)});_defineProperty(_this2,"getTerrainHeightFromDTM",function(scenePos){var returnArray=true;if(!Array.isArray(scenePos[0])){returnArray=false;scenePos=[scenePos]}var dtmPos=scenePos.map(function(p){return CoordinatesUtils.reproject(p,_this2.state.sceneContext.mapCrs,_this2.state.sceneContext.dtmCrs)});var dtmExt=[Infinity,Infinity,-Infinity,-Infinity];dtmPos.forEach(function(p){dtmExt[0]=Math.min(dtmExt[0],p[0]);dtmExt[1]=Math.min(dtmExt[1],p[1]);dtmExt[2]=Math.max(dtmExt[2],p[0]);dtmExt[3]=Math.max(dtmExt[3],p[1])});return new Promise(function(resolve){fromUrl(_this2.state.sceneContext.dtmUrl).then(function(tiff){tiff.getImage().then(function(image){var _image$fileDirectory=image.fileDirectory,ModelTiepoint=_image$fileDirectory.ModelTiepoint,ModelPixelScale=_image$fileDirectory.ModelPixelScale;// Extract scale and tiepoint values
20
+ var _ref8=[ModelPixelScale[0],ModelPixelScale[1]],scaleX=_ref8[0],scaleY=_ref8[1];var _ref9=[ModelTiepoint[3],ModelTiepoint[4]],tiepointX=_ref9[0],tiepointY=_ref9[1];// Tiepoint world coordinates
21
+ // Calculate pixel indices (rounded to nearest integers)
22
+ var minPixelX=Math.round((dtmExt[0]-tiepointX)/scaleX);var minPixelY=Math.round((tiepointY-dtmExt[3])/scaleY);// Inverted Y-axis in image
23
+ var maxPixelY=Math.round((tiepointY-dtmExt[1])/scaleY)+1;// Inverted Y-axis in image
24
+ var maxPixelX=Math.round((dtmExt[2]-tiepointX)/scaleX)+1;var width=maxPixelX-minPixelX;var height=maxPixelY-minPixelY;image.readRasters({window:[minPixelX,minPixelY,maxPixelX,maxPixelY]}).then(function(raster){if(!returnArray){resolve(raster[0][0])}else{var h=dtmPos.map(function(p){var x=Math.round((p[0]-dtmExt[0])/(dtmExt[2]-dtmExt[0])*(width-1));var y=Math.round((1-(p[1]-dtmExt[1])/(dtmExt[3]-dtmExt[1]))*(height-1));return raster[0][x+y*width]});resolve(h)}})})})})});_defineProperty(_this2,"getTerrainHeightFromMap",function(scenePos){var _elevationResult$samp;var coordinates=new Coordinates(_this2.state.sceneContext.mapCrs,scenePos[0],scenePos[1],0);var elevationResult=_this2.state.sceneContext.map.getElevation({coordinates:coordinates});elevationResult.samples.sort(function(a,b){return b.resolution-a.resolution});return(_elevationResult$samp=elevationResult.samples[0])===null||_elevationResult$samp===void 0?void 0:_elevationResult$samp.elevation});_defineProperty(_this2,"getSceneIntersection",function(x,y){var objects=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var raycaster=new Raycaster;var camera=_this2.instance.view.camera;raycaster.setFromCamera(new Vector2(x,y),camera);// Query object intersection
25
+ var intersectionObjects=objects?Object.entries(_this2.state.sceneContext.sceneObjects).map(function(_ref10){var _ref11=_slicedToArray(_ref10,2),objId=_ref11[0],options=_ref11[1];if(options.layertree&&options.visibility){var _obj$tiles$group,_obj$tiles;var obj=_this2.objectMap[objId];return(_obj$tiles$group=(_obj$tiles=obj.tiles)===null||_obj$tiles===void 0?void 0:_obj$tiles.group)!==null&&_obj$tiles$group!==void 0?_obj$tiles$group:obj}return null}).filter(Boolean):null;var objInter=objects?raycaster.intersectObjects(intersectionObjects,true)[0]:undefined;// Query highest resolution terrain tile (i.e. tile with no children)
26
+ var terrInter=raycaster.intersectObjects([_this2.map.object3d]).filter(function(result){return result.object.children.length===0})[0];// Return closest result
27
+ if(objInter&&terrInter){return objInter.distance<terrInter.distance?objInter:terrInter}return objInter!==null&&objInter!==void 0?objInter:terrInter});_defineProperty(_this2,"redrawScene",function(ev){var width=ev.target.innerWidth;var height=ev.target.innerHeight;_this2.instance.renderer.setSize(width,height);_this2.instance.view.camera.aspect=width/height;_this2.instance.view.camera.updateProjectionMatrix();_this2.instance.renderer.render(_this2.instance.scene,_this2.instance.view.camera)});_defineProperty(_this2,"setViewToExtent",function(bounds,rotation){_this2.state.sceneContext.setViewToExtent(bounds,rotation)});_defineProperty(_this2,"store3dState",function(){var promises=Object.entries(_this2.state.sceneContext.sceneObjects).map(function(_ref12){var _ref13=_slicedToArray(_ref12,2),objectId=_ref13[0],entry=_ref13[1];if(!entry.layertree){return null}return new Promise(function(resolve){if(entry.drawGroup){var exporter=new GLTFExporter;exporter.parse(_this2.state.sceneContext.getSceneObject(objectId),function(result){resolve({id:objectId,options:entry,data:result})})}else{resolve({id:objectId,options:entry})}})}).filter(Boolean);return new Promise(function(resolve){Promise.all(promises).then(function(objects){var cameraPos=_this2.state.sceneContext.scene.view.camera.position;var target=_this2.state.sceneContext.scene.view.controls.target;var layers=Object.entries(_this2.state.sceneContext.colorLayers).map(function(_ref14){var _ref15=_slicedToArray(_ref14,2),layerId=_ref15[0],options=_ref15[1];return{id:layerId,options:{visibility:options.visibility,opacity:options.opacity,extrusionHeight:options.extrusionHeight}}});resolve({objects:objects,colorLayers:layers,cameraPos:[cameraPos.x,cameraPos.y,cameraPos.z],center:[target.x,target.y,target.z]})})})});_defineProperty(_this2,"restore3dState",function(data){if(isEmpty(data)){return}(data.objects||[]).forEach(function(item){if(item.data){var loader=new GLTFLoader;loader.parse(item.data,ConfigUtils.getAssetsPath(),function(gltf){gltf.scene.traverse(function(obj){if(obj.isMesh){obj.castShadow=true;obj.receiveShadow=true}});_this2.state.sceneContext.addSceneObject(item.id,gltf.scene,item.options)})}else if(item.id in _this2.state.sceneContext.sceneObjects){_this2.state.sceneContext.updateSceneObject(item.id,item.options)}});(data.colorLayers||[]).forEach(function(item){if(item.id in _this2.state.sceneContext.colorLayers){_this2.state.sceneContext.updateColorLayer(item.id,item.options)}});if(data.cameraPos&&data.center){var cameraPos=_this2.state.sceneContext.scene.view.camera.position;cameraPos.x=data.cameraPos[0];cameraPos.y=data.cameraPos[1];cameraPos.z=data.cameraPos[2];var controlsTarget=_this2.state.sceneContext.scene.view.controls.target;controlsTarget.x=data.center[0];controlsTarget.y=data.center[1];controlsTarget.z=data.center[2]}_this2.state.sceneContext.scene.notifyChange()});_this2.container=null;_this2.inspector=null;_this2.instance=null;_this2.map=null;_this2.sceneObjectGroup=null;_this2.objectMap={};_this2.state.sceneContext.addLayer=_this2.addLayer;_this2.state.sceneContext.getLayer=_this2.getLayer;_this2.state.sceneContext.removeLayer=_this2.removeLayer;_this2.state.sceneContext.updateColorLayer=_this2.updateColorLayer;_this2.state.sceneContext.addSceneObject=_this2.addSceneObject;_this2.state.sceneContext.getSceneObject=_this2.getSceneObject;_this2.state.sceneContext.removeSceneObject=_this2.removeSceneObject;_this2.state.sceneContext.updateSceneObject=_this2.updateSceneObject;_this2.state.sceneContext.getMap=_this2.getMap;_this2.state.sceneContext.getTerrainHeightFromDTM=_this2.getTerrainHeightFromDTM;_this2.state.sceneContext.getTerrainHeightFromMap=_this2.getTerrainHeightFromMap;_this2.state.sceneContext.getSceneIntersection=_this2.getSceneIntersection;registerPermalinkDataStoreHook("map3d",_this2.store3dState);return _this2}_inherits(Map3D,_React$Component2);return _createClass(Map3D,[{key:"componentDidMount",value:function componentDidMount(){this.props.innerRef(this)}},{key:"componentWillUnmount",value:function componentWillUnmount(){unregisterPermalinkDataStoreHook("map3d")}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){var _this3=this;if(this.props.theme!==prevProps.theme){this.setupInstance()}else if(this.props.layers!==prevProps.layers){this.setState(function(state){return{sceneContext:_objectSpread(_objectSpread({},state.sceneContext),{},{colorLayers:_this3.collectColorLayers(state.sceneContext.colorLayers)})}})}// Update map layers
28
+ if(this.state.sceneContext.baseLayers!==prevState.sceneContext.baseLayers){this.applyBaseLayer()}if(this.state.sceneContext.colorLayers!==prevState.sceneContext.colorLayers){this.applyColorLayerUpdates(this.state.sceneContext.colorLayers,prevState.sceneContext.colorLayers)}// Update scene objects
29
+ if(this.state.sceneContext.sceneObjects!==prevState.sceneContext.sceneObjects){this.applySceneObjectUpdates(this.state.sceneContext.sceneObjects)}}},{key:"render",value:function render(){var baseLayer=this.state.sceneContext.baseLayers.find(function(l){return l.visibility===true});var style={marginTop:this.props.mapMargins.top,marginRight:this.props.mapMargins.right,marginBottom:this.props.mapMargins.bottom,marginLeft:this.props.mapMargins.left};return/*#__PURE__*/React.createElement("div",{className:"map3d-body"},/*#__PURE__*/React.createElement("div",{className:"map3d-inspector"}),/*#__PURE__*/React.createElement("div",{className:"map3d-map",onMouseDown:this.stopAnimations,ref:this.setupContainer,style:style}),/*#__PURE__*/React.createElement(View3DSwitcher,{position:2}),this.state.sceneContext.scene?/*#__PURE__*/React.createElement(UnloadWrapper,{key:this.state.sceneId,onUnload:this.onUnload,sceneId:this.state.sceneId},/*#__PURE__*/React.createElement(MapControls3D,{onControlsSet:this.setupControls,sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(BackgroundSwitcher,{changeLayerVisibility:this.setBaseLayer,layers:this.state.sceneContext.baseLayers,mapMargins:this.props.mapMargins}),/*#__PURE__*/React.createElement(TopBar3D,{options:this.props.options,sceneContext:this.state.sceneContext,searchProviders:this.props.searchProviders}),/*#__PURE__*/React.createElement(LayerTree3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(BottomBar3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(OverviewMap3D,{baseLayer:baseLayer,sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Map3DLight,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Measure3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Identify3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Compare3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(Draw3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(MapExport3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(ExportObjects3D,{sceneContext:this.state.sceneContext}),/*#__PURE__*/React.createElement(HideObjects3D,{sceneContext:this.state.sceneContext})):null)}}])}(React.Component);_defineProperty(Map3D,"propTypes",{innerRef:PropTypes.func,layers:PropTypes.array,mapMargins:PropTypes.object,onMapInitialized:PropTypes.func,options:PropTypes.object,searchProviders:PropTypes.object,setCurrentTask:PropTypes.func,theme:PropTypes.object});_defineProperty(Map3D,"defaultProps",{geometry:{initialWidth:600,initialHeight:800,initialX:0,initialY:0,initiallyDocked:true},options:{searchMinScaleDenom:1000}});_defineProperty(Map3D,"defaultSceneState",{scene:null,map:null,mapCrs:null,dtmUrl:null,dtmCrs:null,baseLayers:[],colorLayers:{},sceneObjects:{}});export default connect(function(state){return{mapMargins:state.windows.mapMargins,theme:state.theme.current,layers:state.layers.flat}},{setCurrentTask:setCurrentTask})(Map3D);
@@ -0,0 +1,10 @@
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 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)}/**
2
+ * Copyright 2024 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */import React from"react";import Sun from"@giro3d/giro3d/core/geographic/Sun.js";import{MapLightingMode}from"@giro3d/giro3d/entities/MapLightingOptions";import PropTypes from"prop-types";import suncalc from"suncalc";import{AmbientLight,BasicShadowMap,CameraHelper,DirectionalLight,DirectionalLightHelper,PCFShadowMap,PCFSoftShadowMap,VSMShadowMap}from"three";import CoordinatesUtils from"../../utils/CoordinatesUtils";import LocaleUtils from"../../utils/LocaleUtils";import Icon from"../Icon";import SideBar from"../SideBar";import NumberInput from"../widgets/NumberInput";import ToggleSwitch from"../widgets/ToggleSwitch";import"./style/Map3DLight.css";var Map3DLight=/*#__PURE__*/function(_React$Component){function Map3DLight(){var _this;_classCallCheck(this,Map3DLight);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key]}_this=_callSuper(this,Map3DLight,[].concat(args));_defineProperty(_this,"state",{showAdvanced:false,lightParams:{day:182,time:720,helpersVisible:false,ambientLightIntensity:2.1,directionalLightIntensity:1.8,zFactor:1,lightElevationLayersOnly:false,shadowsEnabled:true,shadowType:PCFShadowMap,shadowMapSize:4096,shadowBias:-0.0001,sunDistance:80000,normalBias:0,shadowIntensity:0.9,shadowVolumeNear:60000,shadowVolumeFar:100000},dayAnimation:false,dayAnimationSettings:false,dayStep:30,timeAnimation:false,timeAnimationSettings:false,timeStep:30});_defineProperty(_this,"onHide",function(){clearInterval(_this.animationInterval);_this.setState({dayAnimation:false,timeAnimation:false})});_defineProperty(_this,"renderBody",function(){var lightParams=_this.state.lightParams;var dateFormatter=function dateFormatter(day){var date=new Date(new Date().getFullYear(),0,day);return"".concat(String(date.getDate()).padStart(2,"0"),".").concat(String(date.getMonth()+1).padStart(2,"0"))};var timeFormatter=function timeFormatter(time){return"".concat(String(Math.trunc(time/60)).padStart(2,"0"),":").concat(String(time%60).padStart(2,"0"))};return/*#__PURE__*/React.createElement("div",{className:"maplight3d-body"},/*#__PURE__*/React.createElement("table",null,/*#__PURE__*/React.createElement("tbody",null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.date")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("div",{className:"map3d-animation-slider"},/*#__PURE__*/React.createElement(Icon,{icon:_this.state.dayAnimation?"square":"triangle-right",onClick:_this.toggleDayAnimation}),_this.renderSlider("day",1,365,1,dateFormatter),/*#__PURE__*/React.createElement(Icon,{className:_this.state.dayAnimationSettings?"map3d-animation-settings-active":"",icon:"cog",onClick:function onClick(){return _this.setState(function(state){return{dayAnimationSettings:!state.dayAnimationSettings}})}})))),_this.state.dayAnimationSettings?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",{colSpan:"2"},/*#__PURE__*/React.createElement("div",{className:"maplight3d-animation-settings"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("maplight3d.animationstep"),":"),/*#__PURE__*/React.createElement(NumberInput,{max:60,min:1,onChange:function onChange(dayStep){return _this.setState({dayStep:dayStep})},suffix:" "+LocaleUtils.tr("maplight3d.dayspersec"),value:_this.state.dayStep})))):null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.time")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("div",{className:"map3d-animation-slider"},/*#__PURE__*/React.createElement(Icon,{icon:_this.state.timeAnimation?"square":"triangle-right",onClick:_this.toggleTimeAnimation}),_this.renderSlider("time",0,1439,1,timeFormatter),/*#__PURE__*/React.createElement(Icon,{className:_this.state.timeAnimationSettings?"map3d-animation-settings-active":"",icon:"cog",onClick:function onClick(){return _this.setState(function(state){return{timeAnimationSettings:!state.timeAnimationSettings}})}})))),_this.state.timeAnimationSettings?/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",{colSpan:"2"},/*#__PURE__*/React.createElement("div",{className:"maplight3d-animation-settings"},/*#__PURE__*/React.createElement("span",null,LocaleUtils.tr("maplight3d.animationstep"),":"),/*#__PURE__*/React.createElement(NumberInput,{max:60,min:1,onChange:function onChange(timeStep){return _this.setState({timeStep:timeStep})},suffix:" "+LocaleUtils.tr("maplight3d.minspersec"),value:_this.state.timeStep})))):null,/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.ambientLightIntensity")),/*#__PURE__*/React.createElement("td",null,_this.renderSlider("ambientLightIntensity",0,5,0.1))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.directionalLightIntensity")),/*#__PURE__*/React.createElement("td",null,_this.renderSlider("directionalLightIntensity",0,10,0.1))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadows")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:lightParams.shadowsEnabled,onChange:function onChange(value){return _this.updateLightParams("shadowsEnabled",value)}}))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadowintensity")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{decimals:1,disabled:!lightParams.shadowsEnabled,max:2,min:0,onChange:function onChange(value){return _this.updateLightParams("shadowIntensity",value)},value:lightParams.shadowIntensity}))),/*#__PURE__*/React.createElement("tr",null,/*#__PURE__*/React.createElement("td",{className:"maplight3d-advanced",colSpan:"2"},/*#__PURE__*/React.createElement("label",null,/*#__PURE__*/React.createElement("input",{checked:_this.state.showAdvanced,onChange:function onChange(ev){return _this.setState(function(state){return{showAdvanced:!state.showAdvanced}})},type:"checkbox"})," ",LocaleUtils.tr("maplight3d.showadvanced")))),_this.state.showAdvanced?[/*#__PURE__*/React.createElement("tr",{key:"helpersVisible"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.helpersVisible")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(ToggleSwitch,{active:lightParams.helpersVisible,onChange:function onChange(value){return _this.updateLightParams("helpersVisible",value)}}))),/*#__PURE__*/React.createElement("tr",{key:"zFactor"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.zFactor")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("input",{max:10,min:0,onChange:function onChange(ev){return _this.updateLightParams("zFactor",ev.target.value)},step:0.1,type:"range",value:lightParams.zFactor}))),/*#__PURE__*/React.createElement("tr",{key:"shadowType"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadowType")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement("select",{onChange:function onChange(ev){return _this.updateLightParams("shadowType",parseInt(ev.target.value,10))},value:lightParams.shadowType},/*#__PURE__*/React.createElement("option",{value:BasicShadowMap},"BasicShadowMap"),/*#__PURE__*/React.createElement("option",{value:PCFShadowMap},"PCFShadowMap"),/*#__PURE__*/React.createElement("option",{value:PCFSoftShadowMap},"PCFSoftShadowMap"),/*#__PURE__*/React.createElement("option",{value:VSMShadowMap},"VSMShadowMap")))),/*#__PURE__*/React.createElement("tr",{key:"shadowMapSize"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadowMapSize")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{decimals:0,max:8192,min:64,onChange:function onChange(value){return _this.updateLightParams("shadowMapSize",value)},value:lightParams.shadowMapSize}))),/*#__PURE__*/React.createElement("tr",{key:"shadowBias"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadowBias")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{decimals:5,max:0.01,min:-0.01,onChange:function onChange(value){return _this.updateLightParams("shadowBias",value)},value:lightParams.shadowBias}))),/*#__PURE__*/React.createElement("tr",{key:"normalBias"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.normalBias")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{decimals:1,max:10,min:-10,onChange:function onChange(value){return _this.updateLightParams("normalBias",value)},value:lightParams.normalBias}))),/*#__PURE__*/React.createElement("tr",{key:"shadowVolumeNear"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadowVolumeNear")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{decimals:0,max:100000,min:100,onChange:function onChange(value){return _this.updateLightParams("shadowVolumeNear",value)},value:lightParams.shadowVolumeNear}))),/*#__PURE__*/React.createElement("tr",{key:"shadowVolumeFar"},/*#__PURE__*/React.createElement("td",null,LocaleUtils.tr("maplight3d.shadowVolumeFar")),/*#__PURE__*/React.createElement("td",null,/*#__PURE__*/React.createElement(NumberInput,{decimals:0,max:100000,min:100,onChange:function onChange(value){return _this.updateLightParams("shadowVolumeFar",value)},value:lightParams.shadowVolumeFar})))]:null)))});_defineProperty(_this,"toggleDayAnimation",function(){_this.setState(function(state){return{dayAnimation:!state.dayAnimation,timeAnimation:false}},function(){clearInterval(_this.animationInterval);if(_this.state.dayAnimation){_this.animationInterval=setInterval(function(){_this.updateLightParams("day",(_this.state.lightParams.day+_this.state.dayStep/10)%365)},100)}})});_defineProperty(_this,"toggleTimeAnimation",function(){_this.setState(function(state){return{timeAnimation:!state.timeAnimation,dayAnimation:false}},function(){clearInterval(_this.animationInterval);if(_this.state.timeAnimation){_this.animationInterval=setInterval(function(){_this.updateLightParams("time",(_this.state.lightParams.time+_this.state.timeStep/10)%1440)},100)}})});_defineProperty(_this,"renderSlider",function(key,min,max,step){var labelFormatter=arguments.length>4&&arguments[4]!==undefined?arguments[4]:undefined;var value=_this.state.lightParams[key];var parseValue=function parseValue(x){return Number.isInteger(step)?parseInt(x,10):parseFloat(x)};labelFormatter=labelFormatter!==null&&labelFormatter!==void 0?labelFormatter:function(x){return x.toFixed(-Math.log10(step))};return/*#__PURE__*/React.createElement("div",{className:"maplight3d-slider"},/*#__PURE__*/React.createElement("input",{max:max,min:min,onChange:function onChange(ev){return _this.updateLightParams(key,parseValue(ev.target.value))},step:step,type:"range",value:value}),/*#__PURE__*/React.createElement("div",{className:"maplight3d-slider-label"},/*#__PURE__*/React.createElement("span",{style:{left:(value-min)*100/(max-min)+"%"}},labelFormatter(value))))});_defineProperty(_this,"updateLightParams",function(key,value){_this.setState(function(state){return{lightParams:_objectSpread(_objectSpread({},state.lightParams),{},_defineProperty({},key,value))}})});_defineProperty(_this,"computeShadowVolume",function(directionalLight,lightParams){if(!lightParams.shadowsEnabled){_this.props.sceneContext.scene.renderer.shadowMap.enabled=false;return}var cameraHeight=_this.props.sceneContext.scene.view.camera.position.z;var targetHeight=_this.props.sceneContext.scene.view.controls.target.z;var volumeSize=Math.min(20000,Math.max(1000,cameraHeight-targetHeight));directionalLight.shadow.camera.top=volumeSize;directionalLight.shadow.camera.bottom=-volumeSize;directionalLight.shadow.camera.left=-volumeSize;directionalLight.shadow.camera.right=volumeSize;directionalLight.shadow.camera.near=lightParams.shadowVolumeNear;directionalLight.shadow.camera.far=lightParams.shadowVolumeFar;_this.props.sceneContext.scene.renderer.shadowMap.enabled=true});_defineProperty(_this,"setLighting",function(){var sceneContext=_this.props.sceneContext;var lightParams=_this.state.lightParams;var ambientLight=sceneContext.getSceneObject("__ambientLight");var directionalLight=sceneContext.getSceneObject("__directionalLight");var directionalLightHelper=sceneContext.getSceneObject("__directionalLightHelper");var shadowCameraHelper=sceneContext.getSceneObject("__shadowCameraHelper");var lightTarget=sceneContext.scene.view.controls.target.clone();lightTarget.z=0;// Compute azimuth / zenith and sun position
8
+ var date=new Date(new Date().getFullYear(),0,lightParams.day,Math.trunc(lightParams.time/60),lightParams.time%60);var latlon=CoordinatesUtils.reproject([lightTarget.x,lightTarget.y],sceneContext.mapCrs,"EPSG:4326");var sunPos=suncalc.getPosition(date,latlon[1],latlon[0]);var zenith=90-sunPos.altitude/Math.PI*180;var azimuth=180+sunPos.azimuth/Math.PI*180;var sunLocalPos=Sun.getLocalPosition({point:lightTarget,zenith:zenith,azimuth:azimuth,distance:lightParams.sunDistance});directionalLight.position.copy(sunLocalPos);// Set lighting params
9
+ sceneContext.map.lighting.enabled=true;sceneContext.map.lighting.mode=lightParams.shadowsEnabled?MapLightingMode.LightBased:MapLightingMode.Hillshade;sceneContext.map.lighting.elevationLayersOnly=lightParams.lightElevationLayersOnly;sceneContext.map.lighting.hillshadeAzimuth=azimuth;sceneContext.map.lighting.hillshadeZenith=zenith;sceneContext.map.lighting.zFactor=lightParams.zFactor;sceneContext.scene.notifyChange(sceneContext.map);sceneContext.scene.renderer.shadowMap.type=lightParams.shadowType;var zenithAttenuation=Math.pow(zenith/90,4);ambientLight.intensity=lightParams.ambientLightIntensity-3*zenithAttenuation;directionalLight.intensity=lightParams.directionalLightIntensity-0.5*zenithAttenuation;directionalLight.shadow.mapSize.set(lightParams.shadowMapSize,lightParams.shadowMapSize);directionalLight.shadow.bias=lightParams.shadowBias;directionalLight.shadow.normalBias=lightParams.normalBias;directionalLight.shadow.intensity=lightParams.shadowIntensity;directionalLight.target.position.copy(lightTarget);_this.computeShadowVolume(directionalLight,lightParams);// Update scene
10
+ directionalLight.updateMatrixWorld(true);directionalLight.target.updateMatrixWorld(true);directionalLight.shadow.updateMatrices(directionalLight);directionalLight.shadow.camera.updateProjectionMatrix();directionalLight.shadow.camera.updateMatrix();directionalLightHelper.visible=lightParams.helpersVisible;directionalLightHelper.update();directionalLightHelper.updateMatrixWorld(true);shadowCameraHelper.visible=lightParams.helpersVisible;shadowCameraHelper.update();shadowCameraHelper.updateMatrixWorld(true);sceneContext.scene.notifyChange()});return _this}_inherits(Map3DLight,_React$Component);return _createClass(Map3DLight,[{key:"componentDidMount",value:function componentDidMount(){this.animationInterval=null;this.componentDidUpdate({})}},{key:"componentDidUpdate",value:function componentDidUpdate(prevProps,prevState){var _prevProps$sceneConte;if(this.props.sceneContext.scene!==((_prevProps$sceneConte=prevProps.sceneContext)===null||_prevProps$sceneConte===void 0?void 0:_prevProps$sceneConte.scene)){var ambientLight=new AmbientLight(16777215,this.state.ambientLightIntensity);this.props.sceneContext.addSceneObject("__ambientLight",ambientLight);var directionalLight=new DirectionalLight(16777215,this.state.directionalLightIntensity);directionalLight.castShadow=true;this.props.sceneContext.addSceneObject("__directionalLight",directionalLight);var directionalLightHelper=new DirectionalLightHelper(directionalLight,200,"white");this.props.sceneContext.addSceneObject("__directionalLightHelper",directionalLightHelper);directionalLightHelper.visible=this.state.lightParams.helpersVisible;var shadowCameraHelper=new CameraHelper(directionalLight.shadow.camera);this.props.sceneContext.addSceneObject("__shadowCameraHelper",shadowCameraHelper);shadowCameraHelper.visible=this.state.lightParams.helpersVisible;this.props.sceneContext.scene.view.controls.addEventListener("change",this.setLighting);this.setLighting()}else if(this.state.lightParams!==prevState.lightParams){this.setLighting()}}},{key:"componentWillUnmount",value:function componentWillUnmount(){clearInterval(this.lightPositionInterval)}},{key:"render",value:function render(){var _this2=this;return/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement(SideBar,{icon:"light",id:"MapLight3D",onHide:this.onHide,title:LocaleUtils.tr("appmenu.items.MapLight3D"),width:"25em"},function(){return{body:_this2.renderBody()}}))}}])}(React.Component);_defineProperty(Map3DLight,"propTypes",{sceneContext:PropTypes.object});export{Map3DLight as default};
@@ -0,0 +1,20 @@
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)}/**
2
+ * Copyright 2024 Sourcepole AG
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */import React from"react";import{connect}from"react-redux";import classNames from"classnames";import PropTypes from"prop-types";import{Raycaster,Vector2,Vector3}from"three";import{MapControls}from"three/addons/controls/MapControls";import{UrlParams}from"../../utils/PermaLinkUtils";import Icon from"../Icon";import{setCenter}from"./slices/map3d";import"./style/MapControls3D.css";var MapControls3D=/*#__PURE__*/function(_React$Component){function MapControls3D(props){var _this;_classCallCheck(this,MapControls3D);_this=_callSuper(this,MapControls3D,[props]);_defineProperty(_this,"state",{firstPerson:false});_defineProperty(_this,"keyHandler",function(event){if(event.repeat){return}else if(event.key==="ArrowUp"){if(event.ctrlKey)_this.tilt(event,0,1,true);else _this.pan(event,0,1,true)}else if(event.key==="ArrowDown"){if(event.ctrlKey)_this.tilt(event,0,-1,true);else _this.pan(event,0,-1,true)}else if(event.key==="ArrowLeft"){if(event.ctrlKey)_this.tilt(event,1,0,true);else _this.pan(event,1,0,true)}else if(event.key==="ArrowRight"){if(event.ctrlKey)_this.tilt(event,-1,0,true);else _this.pan(event,-1,0,true)}});_defineProperty(_this,"home",function(){_this.leaveFirstPerson();var extent=_this.props.sceneContext.map.extent;var bounds=[extent.west,extent.south,extent.east,extent.north];_this.setViewToExtent(bounds)});_defineProperty(_this,"pan",function(ev,dx,dy){var keyboard=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;// Pan faster the heigher one is above the terrain
8
+ var d=_this.state.firstPerson?200000:300+(_this.props.sceneContext.scene.view.camera.position.z-_this.props.sceneContext.scene.view.controls.target.z)/250;var delta=new Vector2(dx,dy).multiplyScalar(d);_this.animationInterrupted=false;var lastTimestamp=new Date/1000;var _animate=function animate(){if(_this.animationInterrupted){return}// Pan <delta> distance per second
9
+ var timestamp=new Date/1000;var k=timestamp-lastTimestamp;lastTimestamp=timestamp;_this.props.sceneContext.scene.view.controls._pan(delta.x*k,delta.y*k);_this.props.sceneContext.scene.notifyChange();requestAnimationFrame(_animate)};requestAnimationFrame(_animate);var element=keyboard?ev.target:ev.view;var event=keyboard?"keyup":"mouseup";element.addEventListener(event,function(){_this.animationInterrupted=true},{once:true})});_defineProperty(_this,"tilt",function(ev,yaw,az){var keyboard=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(_this.state.firstPerson){az*=-1;yaw*=-1}// Pan faster the heigher one is above the terrain
10
+ _this.animationInterrupted=false;var lastTimestamp=new Date/1000;var _animate2=function animate(){if(_this.animationInterrupted){return}// Pan <delta> distance per second
11
+ var timestamp=new Date/1000;var k=timestamp-lastTimestamp;lastTimestamp=timestamp;if(az){_this.props.sceneContext.scene.view.controls._rotateUp(az*k)}if(yaw){_this.props.sceneContext.scene.view.controls._rotateLeft(yaw*k)}_this.props.sceneContext.scene.notifyChange();requestAnimationFrame(_animate2)};requestAnimationFrame(_animate2);var element=keyboard?ev.target:ev.view;var event=keyboard?"keyup":"mouseup";element.addEventListener(event,function(){_this.animationInterrupted=true},{once:true})});_defineProperty(_this,"resetTilt",function(){if(_this.state.firstPerson){var target=_this.props.sceneContext.scene.view.controls.target;var camerapos=_this.props.sceneContext.scene.view.camera.position;_this.props.sceneContext.scene.view.controls.target.set(target.x,target.y,camerapos.z)}else{// Animate from old to new position
12
+ var _target=_this.props.sceneContext.scene.view.controls.target;var oldPosition=_this.props.sceneContext.scene.view.camera.position.clone();var oldYaw=_this.props.sceneContext.scene.view.controls.getAzimuthalAngle();var newPosition=new Vector3(_target.x,_target.y,_target.distanceTo(oldPosition));var startTime=new Date/1000;_this.animationInterrupted=false;var _animate3=function animate(){if(!_this.props.sceneContext.scene||_this.animationInterrupted){return}var duration=2;var elapsed=new Date/1000-startTime;var x=elapsed/duration;var k=0.5*(1-Math.cos(x*Math.PI));var currentPosition=new Vector3().lerpVectors(oldPosition,newPosition,k);currentPosition.x-=_target.x;currentPosition.y-=_target.y;currentPosition.applyAxisAngle(new Vector3(0,0,1),-oldYaw*k);currentPosition.x+=_target.x;currentPosition.y+=_target.y;_this.props.sceneContext.scene.view.camera.position.copy(currentPosition);_this.props.sceneContext.scene.notifyChange();if(elapsed<duration){requestAnimationFrame(_animate3)}else{_this.props.sceneContext.scene.view.camera.position.copy(newPosition);_this.props.sceneContext.scene.notifyChange()}};requestAnimationFrame(_animate3)}});_defineProperty(_this,"setViewToExtent",function(bounds){var _this$props$sceneCont;var angle=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;if(_this.state.firstPerson){_this.leaveFirstPerson()}var center={x:0.5*(bounds[0]+bounds[2]),y:0.5*(bounds[1]+bounds[3])};center.z=(_this$props$sceneCont=_this.props.sceneContext.getTerrainHeightFromMap([center.x,center.y]))!==null&&_this$props$sceneCont!==void 0?_this$props$sceneCont:0;// Camera height to width bbox width
13
+ var fov=35/180*Math.PI;var cameraHeight=(bounds[2]-bounds[0])/(2*Math.tan(fov/2));// Animate from old to new position/target
14
+ var oldPosition=_this.props.sceneContext.scene.view.camera.position.clone();var oldTarget=_this.props.sceneContext.scene.view.controls.target.clone();var oldYaw=_this.props.sceneContext.scene.view.controls.getAzimuthalAngle();var newPosition=new Vector3(center.x,center.y,center.z+cameraHeight);var newTarget=new Vector3(center.x,center.y,center.z);var rotateAngle=-oldYaw+angle;while(rotateAngle>Math.PI){rotateAngle-=2*Math.PI}while(rotateAngle<-Math.PI){rotateAngle+=2*Math.PI}var startTime=new Date/1000;_this.animationInterrupted=false;var _animate4=function animate(){if(!_this.props.sceneContext.scene||_this.animationInterrupted){return}var duration=2;var elapsed=new Date/1000-startTime;var x=elapsed/duration;var k=0.5*(1-Math.cos(x*Math.PI));var currentPosition=new Vector3().lerpVectors(oldPosition,newPosition,k);var currentTarget=new Vector3().lerpVectors(oldTarget,newTarget,k);currentPosition.x-=currentTarget.x;currentPosition.y-=currentTarget.y;currentPosition.applyAxisAngle(new Vector3(0,0,1),rotateAngle*k);currentPosition.x+=currentTarget.x;currentPosition.y+=currentTarget.y;_this.props.sceneContext.scene.view.camera.position.copy(currentPosition);_this.props.sceneContext.scene.view.controls.target.copy(currentTarget);_this.props.sceneContext.scene.notifyChange();if(elapsed<duration){requestAnimationFrame(_animate4)}else{_this.props.sceneContext.scene.view.camera.position.copy(newPosition);_this.props.sceneContext.scene.view.controls.target.copy(newTarget);_this.props.sceneContext.scene.view.controls._rotateLeft(-angle);_this.props.sceneContext.scene.notifyChange()}};requestAnimationFrame(_animate4)});_defineProperty(_this,"updateControlsTarget",function(){var _raycaster$intersectO,_terrInter$z;var controls=_this.props.sceneContext.scene.view.controls;var camera=_this.props.sceneContext.scene.view.camera;var target=controls.target;var raycaster=new Raycaster;// Query highest resolution terrain tile (i.e. tile with no children)
15
+ var x=target.x;var y=target.y;raycaster.set(new Vector3(x,y,target.z+100000),new Vector3(0,0,-1));var terrInter=(_raycaster$intersectO=raycaster.intersectObjects([_this.props.sceneContext.map.object3d]).filter(function(result){return result.object.children.length===0})[0])===null||_raycaster$intersectO===void 0?void 0:_raycaster$intersectO.point;// FIXME: Why does raycaster.intersectObjects on terrain return 0-ish even when above terrain?
16
+ if(((_terrInter$z=terrInter===null||terrInter===void 0?void 0:terrInter.z)!==null&&_terrInter$z!==void 0?_terrInter$z:0)<=1){return}if(_this.state.firstPerson){var delta=terrInter.z+_this.personHeight-camera.position.z;camera.position.z+=delta;target.z+=delta}else{var cameraHeight=camera.position.z;// If camera height is at terrain height, target height should be at terrain height
17
+ // If camera height is at twice the terrain height or further, target height should be zero
18
+ var k=Math.max(0,1-(cameraHeight-terrInter.z)/terrInter.z);target.lerpVectors(new Vector3(x,y,0),terrInter,k)}_this.props.setCenter([target.x,target.y,target.z]);var cpos=camera.position;UrlParams.updateParams({v3d:[target.x,target.y,target.z,cpos.x,cpos.y,cpos.z].map(function(v){return v.toFixed(0)}).join(",")})});_defineProperty(_this,"stopAnimations",function(){_this.animationInterrupted=true});_defineProperty(_this,"switchToFirstPersonView",function(ev){// Don't do anything if a task is set, may interfere
19
+ if(_this.props.currentTask){return}if(!_this.state.firstPerson){_this.setupFirstPerson(ev)}});_defineProperty(_this,"toggleFirstPersonControls",function(){if(_this.state.firstPerson){_this.leaveFirstPerson()}else{_this.props.sceneContext.scene.domElement.addEventListener("click",_this.setupFirstPerson,{once:true})}});_defineProperty(_this,"setupFirstPerson",function(ev){var rect=ev.target.getBoundingClientRect();var mouseX=(ev.clientX-rect.left)/rect.width*2-1;var mouseY=-((ev.clientY-rect.top)/rect.height)*2+1;var intersection=_this.props.sceneContext.getSceneIntersection(mouseX,mouseY,false);if(!intersection){return}var pos=intersection.point;_this.props.sceneContext.getTerrainHeightFromDTM([pos.x,pos.y]).then(function(z){// Animate from old to new position/target
20
+ var oldPosition=_this.props.sceneContext.scene.view.camera.position.clone();var oldTarget=_this.props.sceneContext.scene.view.controls.target.clone();var newPosition=new Vector3(pos.x,pos.y,z+_this.personHeight);var newTarget=new Vector3(pos.x,pos.y+300,z+_this.personHeight);var startTime=new Date/1000;_this.animationInterrupted=false;var _animate5=function animate(){if(!_this.props.sceneContext.scene||_this.animationInterrupted){return}var duration=2;var elapsed=new Date/1000-startTime;var x=elapsed/duration;var k=0.5*(1-Math.cos(x*Math.PI));var currentPosition=new Vector3().lerpVectors(oldPosition,newPosition,k);var currentTarget=new Vector3().lerpVectors(oldTarget,newTarget,k);_this.props.sceneContext.scene.view.camera.position.copy(currentPosition);_this.props.sceneContext.scene.view.controls.target.copy(currentTarget);_this.props.sceneContext.scene.notifyChange();if(elapsed<duration){requestAnimationFrame(_animate5)}else{_this.props.sceneContext.scene.view.camera.position.copy(newPosition);_this.props.sceneContext.scene.view.controls.target.set(pos.x,pos.y+0.1,z+_this.personHeight);_this.props.sceneContext.scene.notifyChange();_this.controls.maxPolarAngle=0.8*Math.PI;_this.controls.panSpeed=600;_this.controls.enableZoom=false;_this.setState({firstPerson:true})}};requestAnimationFrame(_animate5)})});_defineProperty(_this,"leaveFirstPerson",function(){_this.controls.maxPolarAngle=Math.PI*0.5;_this.controls.panSpeed=1;_this.controls.enableZoom=true;_this.setState({firstPerson:false},function(){var cameraPos=_this.props.sceneContext.scene.view.camera.position;var bounds=[cameraPos.x-1000,cameraPos.y-1000,cameraPos.x+1000,cameraPos.y+1000];_this.setViewToExtent(bounds)})});_this.animationInterrupted=false;_this.personHeight=2;_this.prevTarget=null;return _this}_inherits(MapControls3D,_React$Component);return _createClass(MapControls3D,[{key:"componentDidMount",value:function componentDidMount(){var sceneElement=this.props.sceneContext.scene.domElement;sceneElement.tabIndex=0;this.controls=new MapControls(this.props.sceneContext.scene.view.camera,sceneElement);this.controls.zoomToCursor=true;this.controls.enableDamping=true;this.controls.dampingFactor=0.2;this.controls.maxPolarAngle=Math.PI*0.5;sceneElement.addEventListener("keydown",this.keyHandler);this.props.sceneContext.scene.view.setControls(this.controls);var targetPos=this.props.sceneContext.scene.view.camera.position.clone();targetPos.z=0;this.controls.target=targetPos;this.controls.addEventListener("change",this.updateControlsTarget);sceneElement.addEventListener("dblclick",this.switchToFirstPersonView);this.props.onControlsSet(this)}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.animationInterrupted=true;var sceneElement=this.props.sceneContext.scene.domElement;sceneElement.addEventListener("keydown",this.keyHandler);this.controls.removeEventListener("change",this.updateControlsTarget);this.props.sceneContext.scene.view.setControls(null);this.controls.dispose();this.controls=null;this.props.sceneContext.scene.domElement.removeEventListener("dblclick",this.switchToFirstPersonView)}},{key:"render",value:function render(){var _this2=this;var firstPersonButtonClasses=classNames({"map3d-firstperson-button":true,"map3d-firstperson-button-active":this.state.firstPerson});return[/*#__PURE__*/React.createElement("div",{className:"map3d-nav-pan",key:"MapPanWidget"},/*#__PURE__*/React.createElement("span",null),/*#__PURE__*/React.createElement(Icon,{icon:"chevron-up",onMouseDown:function onMouseDown(ev){return _this2.pan(ev,0,1)}}),/*#__PURE__*/React.createElement("span",null),/*#__PURE__*/React.createElement(Icon,{icon:"chevron-left",onMouseDown:function onMouseDown(ev){return _this2.pan(ev,1,0)}}),/*#__PURE__*/React.createElement(Icon,{icon:"home",onClick:function onClick(){return _this2.home()}}),/*#__PURE__*/React.createElement(Icon,{icon:"chevron-right",onMouseDown:function onMouseDown(ev){return _this2.pan(ev,-1,0)}}),/*#__PURE__*/React.createElement("span",null),/*#__PURE__*/React.createElement(Icon,{icon:"chevron-down",onMouseDown:function onMouseDown(ev){return _this2.pan(ev,0,-1)}}),/*#__PURE__*/React.createElement("span",null)),/*#__PURE__*/React.createElement("div",{className:"map3d-nav-rotate",key:"MapRotateWidget"},/*#__PURE__*/React.createElement("span",null),/*#__PURE__*/React.createElement(Icon,{icon:"tilt-up",onMouseDown:function onMouseDown(ev){return _this2.tilt(ev,0,1)}}),/*#__PURE__*/React.createElement("span",null),/*#__PURE__*/React.createElement(Icon,{icon:"tilt-left",onMouseDown:function onMouseDown(ev){return _this2.tilt(ev,1,0)}}),/*#__PURE__*/React.createElement(Icon,{icon:"point",onClick:function onClick(){return _this2.resetTilt()}}),/*#__PURE__*/React.createElement(Icon,{icon:"tilt-right",onMouseDown:function onMouseDown(ev){return _this2.tilt(ev,-1,0)}}),/*#__PURE__*/React.createElement("span",null),/*#__PURE__*/React.createElement(Icon,{icon:"tilt-down",onMouseDown:function onMouseDown(ev){return _this2.tilt(ev,0,-1)}}),/*#__PURE__*/React.createElement("span",null)),/*#__PURE__*/React.createElement("div",{className:firstPersonButtonClasses,key:"FirstPersonButton",onClick:this.toggleFirstPersonControls},/*#__PURE__*/React.createElement(Icon,{icon:"person"}))]}}])}(React.Component);_defineProperty(MapControls3D,"propTypes",{currentTask:PropTypes.string,onControlsSet:PropTypes.func,sceneContext:PropTypes.object,setCenter:PropTypes.func});export default connect(function(state){return{currentTask:state.task.id}},{setCenter:setCenter})(MapControls3D);