@mapcomponents/react-maplibre 0.1.62 → 0.1.64

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 (340) hide show
  1. package/.babelrc +21 -2
  2. package/.editorconfig +1 -1
  3. package/.eslintrc.js +11 -1
  4. package/.github/workflows/check-catalogue-metadata-schema.yml +19 -0
  5. package/.storybook/main.js +0 -1
  6. package/.storybook/preview.js +0 -2
  7. package/CHANGELOG.md +43 -0
  8. package/coverage/clover.xml +864 -1037
  9. package/coverage/coverage-final.json +32 -21
  10. package/coverage/lcov-report/favicon.png +0 -0
  11. package/coverage/lcov-report/index.html +170 -95
  12. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  13. package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +24 -24
  14. package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
  15. package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +5 -5
  16. package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
  17. package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +2 -2
  18. package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
  19. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +148 -0
  20. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +1 -1
  21. package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +22 -7
  22. package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +72 -42
  23. package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +15 -15
  24. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
  25. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
  26. package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +1 -1
  27. package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
  28. package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +86 -35
  29. package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
  30. package/coverage/lcov-report/src/components/{MlSpatialElevationProfile/MlSpatialElevationProfile.js.html → MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html} +215 -320
  31. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +649 -0
  32. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx.html +112 -0
  33. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx.html +115 -0
  34. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +161 -0
  35. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +1 -1
  36. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +1 -1
  37. package/coverage/lcov-report/src/components/MlGpxViewer/MlGpxViewer.tsx.html +394 -0
  38. package/coverage/lcov-report/src/components/MlGpxViewer/index.html +116 -0
  39. package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +63 -285
  40. package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +21 -21
  41. package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
  42. package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
  43. package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +58 -76
  44. package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
  45. package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +58 -61
  46. package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +11 -11
  47. package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
  48. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +30 -21
  49. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
  50. package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
  51. package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
  52. package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
  53. package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
  54. package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
  55. package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
  56. package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
  57. package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +1 -1
  58. package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
  59. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
  60. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
  61. package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
  62. package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
  63. package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
  64. package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
  65. package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
  66. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/ColorPicker.tsx.html +214 -0
  67. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +121 -0
  68. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +412 -0
  69. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +463 -0
  70. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +161 -0
  71. package/coverage/lcov-report/src/components/{MlGPXViewer/MlGPXViewer.tsx.html → MlSketchTool/MlSketchTool.tsx.html} +271 -589
  72. package/coverage/lcov-report/src/components/{MlGPXViewer → MlSketchTool}/index.html +22 -37
  73. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx.html +514 -0
  74. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +21 -21
  75. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
  76. package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
  77. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +20 -206
  78. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
  79. package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
  80. package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
  81. package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +10 -7
  82. package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +5 -5
  83. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
  84. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
  85. package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +111 -57
  86. package/coverage/lcov-report/src/components/MlWmsLayer/index.html +19 -19
  87. package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +201 -144
  88. package/coverage/lcov-report/src/components/MlWmsLoader/index.html +9 -9
  89. package/coverage/lcov-report/src/contexts/MapContext.tsx.html +23 -23
  90. package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
  91. package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
  92. package/coverage/lcov-report/src/contexts/index.html +1 -1
  93. package/coverage/lcov-report/src/hooks/index.html +50 -50
  94. package/coverage/lcov-report/src/hooks/useCameraFollowPath/index.html +1 -1
  95. package/coverage/lcov-report/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx.html +1 -1
  96. package/coverage/lcov-report/src/hooks/useExportMap/index.html +1 -1
  97. package/coverage/lcov-report/src/hooks/useExportMap/index.ts.html +1 -1
  98. package/coverage/lcov-report/src/hooks/useExportMap/lib.ts.html +1 -1
  99. package/coverage/lcov-report/src/hooks/useGpx/index.html +116 -0
  100. package/coverage/lcov-report/src/hooks/useGpx/useGpx.tsx.html +295 -0
  101. package/coverage/lcov-report/src/hooks/useLayer.ts.html +132 -66
  102. package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +1 -1
  103. package/coverage/lcov-report/src/hooks/useLayerHoverPopup/index.html +116 -0
  104. package/coverage/lcov-report/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx.html +331 -0
  105. package/coverage/lcov-report/src/hooks/useMap.ts.html +47 -47
  106. package/coverage/lcov-report/src/hooks/useMapState.ts.html +54 -54
  107. package/coverage/lcov-report/src/hooks/useSource.ts.html +57 -57
  108. package/coverage/lcov-report/src/hooks/{useWms.js.html → useWms.ts.html} +54 -15
  109. package/coverage/lcov-report/src/index.html +1 -1
  110. package/coverage/lcov-report/src/index.ts.html +6 -6
  111. package/coverage/lcov.info +1724 -1974
  112. package/cypress/support/commands.ts +37 -0
  113. package/cypress/support/component-index.html +12 -0
  114. package/cypress/support/component.ts +46 -0
  115. package/cypress.config.ts +101 -0
  116. package/dist/components/MapLibreMap/MapLibreMap.d.ts +1 -1
  117. package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +53 -27
  118. package/dist/components/MlCenterPosition/MlCenterPosition.d.ts +3 -2
  119. package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +35 -16
  120. package/dist/components/MlComponentTemplate/MlComponentTemplate.d.ts +1 -1
  121. package/dist/components/MlComponentTemplate/MlComponentTemplate.stories.d.ts +12 -9
  122. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.d.ts +1 -1
  123. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.stories.d.ts +12 -9
  124. package/dist/components/MlCreatePdfForm/MlCreatePdfForm.cy.d.ts +1 -0
  125. package/dist/components/MlCreatePdfForm/lib/PdfPreview.d.ts +1 -1
  126. package/dist/components/MlFeatureEditor/MlFeatureEditor.d.ts +10 -4
  127. package/dist/components/MlFeatureEditor/lib/double_click_zoom.d.ts +0 -2
  128. package/dist/components/MlFeatureEditor/lib/theme.d.ts +1 -1
  129. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +23 -12
  130. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +12 -11
  131. package/dist/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.d.ts +2 -0
  132. package/dist/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.d.ts +2 -0
  133. package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.d.ts +3 -0
  134. package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.d.ts +3 -0
  135. package/dist/components/MlGpxViewer/MlGpxViewer.d.ts +30 -0
  136. package/dist/components/MlGpxViewer/MlGpxViewer.stories.d.ts +17 -0
  137. package/dist/components/MlGpxViewer/MlGpxViewer.test.d.ts +1 -0
  138. package/dist/components/MlGpxViewer/util/GeoJsonContext.d.ts +10 -0
  139. package/dist/components/MlGpxViewer/util/GeoJsonProvider.d.ts +4 -0
  140. package/dist/components/MlGpxViewer/util/MetadataDrawer.d.ts +7 -0
  141. package/dist/components/MlGpxViewer/util/MlGpxDemoLoader.d.ts +10 -0
  142. package/dist/components/MlGpxViewer/util/MlGpxViewerInstructions.d.ts +3 -0
  143. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +11 -2
  144. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.d.ts +7 -9
  145. package/dist/components/MlLayerMagnify/MlLayerMagnify.d.ts +8 -2
  146. package/dist/components/MlLayerMagnify/MlLayerMagnify.stories.d.ts +13 -9
  147. package/dist/components/MlLayerSwipe/MlLayerSwipe.d.ts +13 -3
  148. package/dist/components/MlLayerSwipe/MlLayerSwipe.stories.d.ts +12 -10
  149. package/dist/components/MlSketchTool/LayerList/ColorPicker.d.ts +9 -0
  150. package/dist/components/MlSketchTool/LayerList/LayerList.d.ts +5 -0
  151. package/dist/components/MlSketchTool/LayerList/LayerListItem.d.ts +11 -0
  152. package/dist/components/MlSketchTool/LayerList/LayerPropertyForm.d.ts +9 -0
  153. package/dist/components/MlSketchTool/MlSketchTool.d.ts +29 -0
  154. package/dist/components/MlSketchTool/MlSketchTool.stories.d.ts +10 -0
  155. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +33 -14
  156. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.d.ts +18 -15
  157. package/dist/components/MlSpatialElevationProfile/util/getElevationData.d.ts +14 -0
  158. package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +3 -67
  159. package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +7 -4
  160. package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +17 -10
  161. package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +23 -12
  162. package/dist/components/MlWmsLoader/utils/MlWmsLoaderInstructions.d.ts +3 -0
  163. package/dist/components/MlWmsLoader/utils/WMSLinks.d.ts +6 -0
  164. package/dist/contexts/SimpleDataProvider.d.ts +1 -1
  165. package/dist/custom.d.d.ts +1 -1
  166. package/dist/decorators/ThemeWrapper.d.ts +3 -1
  167. package/dist/hooks/useGpx/lib/gpxConverter.d.ts +11 -0
  168. package/dist/hooks/useGpx/useGpx.d.ts +26 -0
  169. package/dist/hooks/useGpx/useGpx.stories.d.ts +10 -0
  170. package/dist/hooks/useLayer.d.ts +14 -8
  171. package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.d.ts +23 -0
  172. package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.d.ts +10 -0
  173. package/dist/hooks/useMap.d.ts +2 -2
  174. package/dist/hooks/useMap.test.d.ts +1 -0
  175. package/dist/hooks/useMapState.d.ts +3 -3
  176. package/dist/hooks/useSource.d.ts +3 -3
  177. package/dist/hooks/useWms.d.ts +24 -16
  178. package/dist/index.d.ts +5 -5
  179. package/dist/index.esm.css +1 -1
  180. package/dist/index.esm.js +9327 -14844
  181. package/dist/index.esm.js.map +1 -1
  182. package/dist/setupTests.d.ts +6 -5
  183. package/dist/ui_components/Dropzone.d.ts +5 -0
  184. package/dist/ui_components/ImageLoader.d.ts +8 -1
  185. package/dist/ui_components/LoadingOverlayContext.d.ts +11 -11
  186. package/dist/ui_components/Sidebar.d.ts +10 -1
  187. package/dist/ui_components/Tooltip.d.ts +1 -1
  188. package/dist/ui_components/TopToolbar.d.ts +7 -1
  189. package/dist/ui_components/UploadButton.d.ts +6 -0
  190. package/dist/util/BubbleForInstructions.d.ts +2 -0
  191. package/dist/util/Instructions.d.ts +13 -0
  192. package/package.json +195 -185
  193. package/public/assets/sample1.gpx +3003 -0
  194. package/public/assets/sample2.gpx +1264 -0
  195. package/public/assets/sample3.gpx +912 -0
  196. package/{src/components/MlImageMarkerLayer → public}/assets/wg-marker.png +0 -0
  197. package/public/index.html +0 -4
  198. package/public/thumbnails/MlSketchTool.png +0 -0
  199. package/public/thumbnails/useCameraFollowPath.png +0 -0
  200. package/scripts/build-catalogue-meta.js +35 -11
  201. package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +230 -188
  202. package/src/components/MlCenterPosition/MlCenterPosition.meta_.json +1 -2
  203. package/src/components/MlCenterPosition/MlCenterPosition.stories.tsx +20 -0
  204. package/src/components/MlCenterPosition/MlCenterPosition.tsx +4 -4
  205. package/src/components/MlComponentTemplate/MlComponentTemplate.meta_.json +1 -2
  206. package/src/components/MlComponentTemplate/{MlComponentTemplate.stories.js → MlComponentTemplate.stories.tsx} +2 -2
  207. package/src/components/MlComponentTemplate/MlComponentTemplate.tsx +1 -1
  208. package/src/components/MlCreatePdfButton/MlCreatePdfButton.meta_.json +1 -2
  209. package/src/components/MlCreatePdfButton/{MlCreatePdfButton.stories.js → MlCreatePdfButton.stories.tsx} +1 -1
  210. package/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx +1 -1
  211. package/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx +21 -0
  212. package/src/components/MlCreatePdfForm/MlCreatePdfForm.meta.json +1 -2
  213. package/src/components/MlCreatePdfForm/MlCreatePdfForm.stories.tsx +1 -3
  214. package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +25 -2
  215. package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +2 -3
  216. package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +39 -29
  217. package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.meta.json +1 -2
  218. package/src/components/MlFollowGps/MlFollowGps.meta.json +1 -2
  219. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.meta.json +1 -2
  220. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.tsx +191 -0
  221. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +47 -30
  222. package/src/components/MlGeoJsonLayer/assets/earthquake.json +109937 -0
  223. package/src/components/MlGeoJsonLayer/assets/sample_1.json +138 -24
  224. package/src/components/MlGeoJsonLayer/assets/sample_2.json +140 -20
  225. package/src/components/MlGeoJsonLayer/assets/wg_locations.json +65 -0
  226. package/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js +189 -0
  227. package/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js +188 -0
  228. package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx +9 -0
  229. package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx +10 -0
  230. package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.meta_.json +1 -2
  231. package/src/components/{MlGPXViewer/MlGPXViewer.doc.de.md → MlGpxViewer/MlGpxViewer.doc.de.md} +0 -0
  232. package/src/components/{MlGPXViewer/MlGPXViewer.doc.en.md → MlGpxViewer/MlGpxViewer.doc.en.md} +0 -0
  233. package/src/components/{MlGPXViewer/MlGPXViewer.meta.json → MlGpxViewer/MlGpxViewer.meta.json} +2 -3
  234. package/src/components/MlGpxViewer/MlGpxViewer.stories.tsx +109 -0
  235. package/src/components/MlGpxViewer/MlGpxViewer.test.js +53 -0
  236. package/src/components/MlGpxViewer/MlGpxViewer.tsx +103 -0
  237. package/src/components/{MlGPXViewer → MlGpxViewer}/util/GeoJsonContext.ts +0 -0
  238. package/src/components/{MlGPXViewer → MlGpxViewer}/util/GeoJsonProvider.tsx +0 -0
  239. package/src/components/MlGpxViewer/util/MetadataDrawer.tsx +38 -0
  240. package/src/components/MlGpxViewer/util/MlGpxDemoLoader.tsx +128 -0
  241. package/src/components/MlGpxViewer/util/MlGpxViewerInstructions.tsx +68 -0
  242. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.meta_.json +1 -2
  243. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.tsx +41 -0
  244. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +27 -8
  245. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx +41 -115
  246. package/src/components/MlLayer/MlLayer.meta_.json +1 -2
  247. package/src/components/MlLayerMagnify/MlLayerMagnify.meta.json +1 -2
  248. package/src/components/MlLayerMagnify/MlLayerMagnify.stories.tsx +44 -0
  249. package/src/components/MlLayerMagnify/{MlLayerMagnify.test.js → MlLayerMagnify.test.tsx} +15 -18
  250. package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +55 -61
  251. package/src/components/MlLayerSwipe/MlLayerSwipe.meta.json +1 -2
  252. package/src/components/MlLayerSwipe/{MlLayerSwipe.stories.js → MlLayerSwipe.stories.tsx} +9 -11
  253. package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +47 -48
  254. package/src/components/MlLayerSwitcher/MlLayerSwitcher.meta_.json +1 -2
  255. package/src/components/MlLayerSwitcher/components/LayerBox.js +22 -19
  256. package/src/components/MlMarker/MlMarker.meta_.json +1 -2
  257. package/src/components/MlMeasureTool/MlMeasureTool.meta.json +1 -2
  258. package/src/components/MlNavigationCompass/MlNavigationCompass.meta.json +1 -2
  259. package/src/components/MlNavigationTools/MlNavigationTools.meta.json +1 -2
  260. package/src/components/MlScaleReference/MlScaleReference.meta.json +1 -2
  261. package/src/components/MlShareMapState/MlShareMapState.meta_.json +1 -2
  262. package/src/components/MlSketchTool/LayerList/ColorPicker.tsx +43 -0
  263. package/src/components/MlSketchTool/LayerList/LayerList.tsx +12 -0
  264. package/src/components/MlSketchTool/LayerList/LayerListItem.tsx +109 -0
  265. package/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx +126 -0
  266. package/src/components/MlSketchTool/MlSketchTool.doc.de.md +3 -0
  267. package/src/components/MlSketchTool/MlSketchTool.meta.json +14 -0
  268. package/src/components/MlSketchTool/MlSketchTool.stories.js +26 -0
  269. package/src/components/MlSketchTool/MlSketchTool.tsx +271 -0
  270. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.meta.json +1 -2
  271. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.tsx +121 -0
  272. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.test.js +30 -1
  273. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx +143 -0
  274. package/src/components/MlSpatialElevationProfile/util/getElevationData.tsx +103 -0
  275. package/src/components/MlThreeJsLayer/MlThreeJsLayer.meta.json +1 -2
  276. package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.meta.json +3 -4
  277. package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.stories.js +2 -3
  278. package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx +17 -79
  279. package/src/components/MlUseMapDebugger/MlUseMapDebugger.meta_.json +1 -2
  280. package/src/components/MlVectorTileLayer/MlVectorTileLayer.meta.json +1 -2
  281. package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +3 -2
  282. package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.meta_.json +1 -2
  283. package/src/components/MlWmsLayer/MlWmsLayer.tsx +59 -41
  284. package/src/components/MlWmsLoader/MlWmsLoader.meta.json +1 -2
  285. package/src/components/MlWmsLoader/MlWmsLoader.stories.tsx +89 -0
  286. package/src/components/MlWmsLoader/MlWmsLoader.tsx +141 -122
  287. package/src/components/MlWmsLoader/utils/MlWmsLoaderInstructions.tsx +50 -0
  288. package/src/components/MlWmsLoader/utils/WMSLinks.tsx +128 -0
  289. package/src/decorators/MapContextDecorator.js +1 -1
  290. package/src/decorators/MapContextDecoratorHooks.js +1 -1
  291. package/src/decorators/ThemeWrapper.tsx +9 -0
  292. package/src/hooks/useCameraFollowPath/useCameraFollowPath.meta.json +1 -2
  293. package/src/{components/MlGPXViewer → hooks/useGpx/lib}/gpxConverter.js +1 -0
  294. package/src/hooks/useGpx/useGpx.doc.de.md +3 -0
  295. package/src/hooks/useGpx/useGpx.meta_.json +15 -0
  296. package/src/{components/MlCenterPosition/MlCenterPosition.stories.js → hooks/useGpx/useGpx.stories.js} +4 -5
  297. package/src/hooks/useGpx/useGpx.tsx +70 -0
  298. package/src/hooks/useLayer.ts +32 -10
  299. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.doc.de.md +3 -0
  300. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.meta_.json +15 -0
  301. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.js +20 -0
  302. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx +82 -0
  303. package/src/hooks/useMap.test.tsx +48 -0
  304. package/src/hooks/useMap.ts +8 -8
  305. package/src/hooks/useSource.ts +4 -4
  306. package/src/hooks/{useWms.js → useWms.ts} +24 -11
  307. package/src/index.ts +5 -5
  308. package/src/setupTests.js +18 -15
  309. package/src/ui_components/Dropzone.tsx +104 -0
  310. package/src/ui_components/{ImageLoader.js → ImageLoader.tsx} +30 -25
  311. package/src/ui_components/{LoadingOverlayContext.js → LoadingOverlayContext.tsx} +12 -15
  312. package/src/ui_components/Sidebar.tsx +82 -0
  313. package/src/ui_components/Tooltip.tsx +17 -0
  314. package/src/ui_components/TopToolbar.tsx +26 -0
  315. package/src/ui_components/UploadButton.tsx +57 -0
  316. package/src/util/BubbleForInstructions.js +46 -0
  317. package/src/util/Instructions.tsx +60 -0
  318. package/tsconfig.json +39 -58
  319. package/config/getHttpsConfig.js +0 -66
  320. package/config/modules.js +0 -134
  321. package/config/pnpTs.js +0 -35
  322. package/config/webpack.config.js +0 -757
  323. package/config/webpackDevServer.config.js +0 -130
  324. package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +0 -1645
  325. package/scripts/start.js +0 -166
  326. package/src/components/MlGPXViewer/MlGPXViewer.stories.js +0 -31
  327. package/src/components/MlGPXViewer/MlGPXViewer.test.js +0 -28
  328. package/src/components/MlGPXViewer/MlGPXViewer.tsx +0 -377
  329. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.js +0 -66
  330. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.js +0 -45
  331. package/src/components/MlLayerMagnify/MlLayerMagnify.stories.js +0 -41
  332. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js +0 -224
  333. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +0 -57
  334. package/src/components/MlWmsLoader/MlWmsLoader.stories.js +0 -47
  335. package/src/decorators/ThemeWrapper.jsx +0 -9
  336. package/src/ui_components/Legend.js +0 -44
  337. package/src/ui_components/LoadingOverlay.js +0 -41
  338. package/src/ui_components/Sidebar.js +0 -100
  339. package/src/ui_components/Tooltip.js +0 -21
  340. package/src/ui_components/TopToolbar.js +0 -29
package/scripts/start.js DELETED
@@ -1,166 +0,0 @@
1
- 'use strict';
2
-
3
- // Do this as the first thing so that any code reading it knows the right env.
4
- process.env.BABEL_ENV = 'development';
5
- process.env.NODE_ENV = 'development';
6
-
7
- // Makes the script crash on unhandled rejections instead of silently
8
- // ignoring them. In the future, promise rejections that are not handled will
9
- // terminate the Node.js process with a non-zero exit code.
10
- process.on('unhandledRejection', err => {
11
- throw err;
12
- });
13
-
14
- // Ensure environment variables are read.
15
- require('../config/env');
16
-
17
-
18
- const fs = require('fs');
19
- const chalk = require('react-dev-utils/chalk');
20
- const webpack = require('webpack');
21
- const WebpackDevServer = require('webpack-dev-server');
22
- const clearConsole = require('react-dev-utils/clearConsole');
23
- const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
24
- const {
25
- choosePort,
26
- createCompiler,
27
- prepareProxy,
28
- prepareUrls,
29
- } = require('react-dev-utils/WebpackDevServerUtils');
30
- const openBrowser = require('react-dev-utils/openBrowser');
31
- const semver = require('semver');
32
- const paths = require('../config/paths');
33
- const configFactory = require('../config/webpack.config');
34
- const createDevServerConfig = require('../config/webpackDevServer.config');
35
- const getClientEnvironment = require('../config/env');
36
- const react = require(require.resolve('react', { paths: [paths.appPath] }));
37
-
38
- const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
39
- const useYarn = fs.existsSync(paths.yarnLockFile);
40
- const isInteractive = process.stdout.isTTY;
41
-
42
- // Warn and crash if required files are missing
43
- if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
44
- process.exit(1);
45
- }
46
-
47
- // Tools like Cloud9 rely on this.
48
- const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
49
- const HOST = process.env.HOST || '0.0.0.0';
50
-
51
- if (process.env.HOST) {
52
- console.log(
53
- chalk.cyan(
54
- `Attempting to bind to HOST environment variable: ${chalk.yellow(
55
- chalk.bold(process.env.HOST)
56
- )}`
57
- )
58
- );
59
- console.log(
60
- `If this was unintentional, check that you haven't mistakenly set it in your shell.`
61
- );
62
- console.log(
63
- `Learn more here: ${chalk.yellow('https://cra.link/advanced-config')}`
64
- );
65
- console.log();
66
- }
67
-
68
- // We require that you explicitly set browsers and do not fall back to
69
- // browserslist defaults.
70
- const { checkBrowsers } = require('react-dev-utils/browsersHelper');
71
- checkBrowsers(paths.appPath, isInteractive)
72
- .then(() => {
73
- // We attempt to use the default port but if it is busy, we offer the user to
74
- // run on a different port. `choosePort()` Promise resolves to the next free port.
75
- return choosePort(HOST, DEFAULT_PORT);
76
- })
77
- .then(port => {
78
- if (port == null) {
79
- // We have not found a port.
80
- return;
81
- }
82
-
83
- const config = configFactory('development');
84
- const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
85
- const appName = require(paths.appPackageJson).name;
86
-
87
- const useTypeScript = fs.existsSync(paths.appTsConfig);
88
- const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
89
- const urls = prepareUrls(
90
- protocol,
91
- HOST,
92
- port,
93
- paths.publicUrlOrPath.slice(0, -1)
94
- );
95
- const devSocket = {
96
- warnings: warnings =>
97
- devServer.sockWrite(devServer.sockets, 'warnings', warnings),
98
- errors: errors =>
99
- devServer.sockWrite(devServer.sockets, 'errors', errors),
100
- };
101
- // Create a webpack compiler that is configured with custom messages.
102
- const compiler = createCompiler({
103
- appName,
104
- config,
105
- devSocket,
106
- urls,
107
- useYarn,
108
- useTypeScript,
109
- tscCompileOnError,
110
- webpack,
111
- });
112
- // Load proxy config
113
- const proxySetting = require(paths.appPackageJson).proxy;
114
- const proxyConfig = prepareProxy(
115
- proxySetting,
116
- paths.appPublic,
117
- paths.publicUrlOrPath
118
- );
119
- // Serve webpack assets generated by the compiler over a web server.
120
- const serverConfig = createDevServerConfig(
121
- proxyConfig,
122
- urls.lanUrlForConfig
123
- );
124
- const devServer = new WebpackDevServer(compiler, serverConfig);
125
- // Launch WebpackDevServer.
126
- devServer.listen(port, HOST, err => {
127
- if (err) {
128
- return console.log(err);
129
- }
130
- if (isInteractive) {
131
- clearConsole();
132
- }
133
-
134
- if (env.raw.FAST_REFRESH && semver.lt(react.version, '16.10.0')) {
135
- console.log(
136
- chalk.yellow(
137
- `Fast Refresh requires React 16.10 or higher. You are using React ${react.version}.`
138
- )
139
- );
140
- }
141
-
142
- console.log(chalk.cyan('Starting the development server...\n'));
143
- openBrowser(urls.localUrlForBrowser);
144
- });
145
-
146
- ['SIGINT', 'SIGTERM'].forEach(function (sig) {
147
- process.on(sig, function () {
148
- devServer.close();
149
- process.exit();
150
- });
151
- });
152
-
153
- if (process.env.CI !== 'true') {
154
- // Gracefully exit when stdin ends
155
- process.stdin.on('end', function () {
156
- devServer.close();
157
- process.exit();
158
- });
159
- }
160
- })
161
- .catch(err => {
162
- if (err && err.message) {
163
- console.log(err.message);
164
- }
165
- process.exit(1);
166
- });
@@ -1,31 +0,0 @@
1
- import React from "react";
2
-
3
- import MlGPXViewer from "./MlGPXViewer";
4
-
5
- import mapContextDecorator from "../../decorators/MapContextDecorator";
6
- import GeoJsonProvider from "./util/GeoJsonProvider";
7
-
8
- const storyoptions = {
9
- title: "MapComponents/MlGPXViewer",
10
- component: MlGPXViewer,
11
- argTypes: {
12
- options: {
13
- control: {
14
- type: "object",
15
- },
16
- },
17
- },
18
- decorators: mapContextDecorator,
19
- };
20
- export default storyoptions;
21
-
22
- const Template = (args) => (
23
- <>
24
- <GeoJsonProvider>
25
- <MlGPXViewer />
26
- </GeoJsonProvider>
27
- </>
28
- );
29
-
30
- export const ExampleConfig = Template.bind({});
31
- ExampleConfig.parameters = {};
@@ -1,28 +0,0 @@
1
- import { layerRemovalTest, sourceRemovalTest } from "../../util";
2
-
3
- import MlGPXViewer from "./MlGPXViewer";
4
-
5
- const testComponent = <MlGPXViewer />;
6
-
7
- let sourceTestParams = [
8
- "<MlGPXViewer />",
9
- testComponent,
10
- /^.*\"import\-source\".*$/,
11
- "import-source",
12
- ];
13
- let layer1TestParams = [
14
- "<MlGPXViewer />",
15
- testComponent,
16
- /^.*\"importer\-layer\-lines\".*$/,
17
- "importer-layer-lines",
18
- ];
19
- let layer2TestParams = [
20
- "<MlGPXViewer />",
21
- testComponent,
22
- /^.*\"importer\-layer\-points\".*$/,
23
- "importer-layer-points",
24
- ];
25
-
26
- layerRemovalTest(...layer1TestParams);
27
- layerRemovalTest(...layer2TestParams);
28
- sourceRemovalTest(...sourceTestParams);
@@ -1,377 +0,0 @@
1
- import React, { useContext, useRef, useEffect, useState } from "react";
2
- import { bbox } from '@turf/turf';
3
- import Divider from "@mui/material/Divider";
4
- import Typography from "@mui/material/Typography";
5
- import Drawer from "@mui/material/Drawer";
6
- import IconButton from "@mui/material/IconButton";
7
- import InfoIcon from "@mui/icons-material/Info";
8
- import FileCopy from "@mui/icons-material/FileCopy";
9
- import { Popup, LngLatBoundsLike, GeoJSONSource } from "maplibre-gl";
10
- import List from "@mui/material/List";
11
- import ListItem from "@mui/material/ListItem";
12
- import ListItemText from "@mui/material/ListItemText";
13
- import GeoJsonContext from "./util/GeoJsonContext";
14
- import toGeoJSON from "./gpxConverter";
15
- import useMediaQuery from "@mui/material/useMediaQuery";
16
- import useMap from "../../hooks/useMap";
17
-
18
- interface MlGPXViewerProps {
19
-
20
- /**
21
- * Id of the target MapLibre instance in mapHook
22
- */
23
- mapId?: string,
24
- /**
25
- * The layerId of an existing layer this layer should be rendered visually beneath
26
- * https://maplibre.org/maplibre-gl-js-docs/api/map/#map#addlayer - see "beforeId" property
27
- */
28
- insertBeforeLayer?: string,
29
- /**
30
- * Prefix of the component id this component uses when adding elements to the MapLibreGl-instance
31
- */
32
- idPrefix?: string,
33
- /**
34
- * Sets the layers layout-property "visibility" to "none" if false or "visible" if true
35
- */
36
- visible?: boolean,
37
- }
38
-
39
- /**
40
- * MlGPXViewer returns a dropzone and a button to load a GPX Track into the map.
41
- */
42
- const MlGPXViewer = (props:MlGPXViewerProps) => {
43
- const dataSource = useContext(GeoJsonContext);
44
- const initializedRef = useRef(false);
45
- const mapHook = useMap({ mapId: props.mapId, waitForLayer: props.insertBeforeLayer });
46
- const sourceName = "import-source";
47
- const layerNameLines = "importer-layer-lines";
48
- const layerNamePoints = "importer-layer-points";
49
-
50
- const [open, setIsOpen] = useState(false);
51
- const dropZone = useRef<HTMLDivElement>(null);
52
- const [zIndex, setZIndex] = useState(0);
53
- const [metaData, setMetaData] = useState<{ title: string; value: string; id: number; }[]>([]);
54
- const fileupload = useRef<HTMLInputElement>(null);
55
- const mediaIsMobile = useMediaQuery("(max-width:900px)");
56
-
57
- const popup = useRef(
58
- new Popup({
59
- closeButton: false,
60
- closeOnClick: true,
61
- })
62
- );
63
-
64
- useEffect(() => {
65
- if (!mapHook.map || initializedRef.current) return;
66
-
67
- initializedRef.current = true;
68
-
69
- mapHook.map.addSource(
70
- sourceName,
71
- {
72
- type: "geojson",
73
- data: dataSource.data,
74
- },
75
- mapHook.componentId
76
- );
77
- mapHook.map.addLayer(
78
- {
79
- id: layerNameLines,
80
- source: sourceName,
81
- type: "line",
82
- paint: {
83
- "line-width": 4,
84
- "line-color": "rgba(212, 55, 23,0.5)",
85
- },
86
- },
87
- props.insertBeforeLayer,
88
- mapHook.componentId
89
- );
90
- mapHook.map.addLayer(
91
- {
92
- id: layerNamePoints,
93
- source: sourceName,
94
- type: "circle",
95
- paint: {
96
- "circle-color": "rgba(72, 77, 99,0.5)",
97
- "circle-radius": 7,
98
- },
99
- filter: ["==", "$type", "Point"],
100
- },
101
- props.insertBeforeLayer,
102
- mapHook.componentId
103
- );
104
-
105
- [layerNameLines, layerNamePoints].forEach((layerName) => {
106
- if(!mapHook.map)return;
107
-
108
- mapHook.map.map.setLayoutProperty(layerName, "visibility", "visible");
109
- });
110
- mapHook.map.on(
111
- "mouseenter",
112
- layerNamePoints,
113
- (e:any) => {
114
- if(!mapHook.map)return;
115
- // Change the cursor style as a UI indicator.
116
-
117
- const coordinates = e.features[0].geometry.coordinates.slice();
118
- //const description = e.features[0].properties.desc;
119
- const name = e.features[0].properties.name;
120
-
121
- // Ensure that if the map is zoomed out such that multiple
122
- // copies of the feature are visible, the popup appears
123
- // over the copy being pointed to.
124
- while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {
125
- coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;
126
- }
127
-
128
- // Populate the popup and set its coordinates
129
-
130
- // based on the feature found.
131
- popup.current.setLngLat(coordinates).setHTML(name).addTo(mapHook.map.map);
132
- },
133
- mapHook.componentId
134
- );
135
-
136
- mapHook.map.on(
137
- "mouseleave",
138
- "places",
139
- function () {
140
- if(!mapHook.map)return;
141
-
142
- mapHook.map.map.getCanvas().style.cursor = "";
143
- popup.current.remove();
144
- },
145
- mapHook.componentId
146
- );
147
-
148
- mapHook.map.map.setZoom(10);
149
- }, [mapHook.map]);
150
-
151
- useEffect(() => {
152
- const _dropZone = dropZone.current;
153
- const raiseDropZoneAndStopDefault = (event:any) => {
154
- setZIndex(1000);
155
- stopDefault(event);
156
- };
157
- const lowerDropZone = () => {
158
- setZIndex(0);
159
- };
160
- const lowerDropZoneAndStopDefault = (event:any) => {
161
- setZIndex(0);
162
- stopDefault(event);
163
- };
164
-
165
- window.addEventListener("dragenter", raiseDropZoneAndStopDefault);
166
- window.addEventListener("dragover", stopDefault);
167
-
168
- _dropZone?.addEventListener("dragleave", lowerDropZone);
169
-
170
- window.addEventListener("drop", lowerDropZoneAndStopDefault);
171
-
172
- return () => {
173
- window.removeEventListener("dragenter", raiseDropZoneAndStopDefault);
174
- window.removeEventListener("dragover", stopDefault);
175
- _dropZone?.removeEventListener("dragleave", lowerDropZone);
176
- window.removeEventListener("drop", lowerDropZoneAndStopDefault);
177
- };
178
- });
179
-
180
- const stopDefault = (event:any) => {
181
- event.preventDefault();
182
- event.stopPropagation();
183
- };
184
-
185
- useEffect(() => {
186
- if (!mapHook.map) return;
187
-
188
- const visibility = props.visible ? "visible" : "none";
189
-
190
- [layerNameLines, layerNamePoints].forEach((layerName) => {
191
- if(!mapHook.map)return;
192
-
193
- mapHook.map.map.setLayoutProperty(layerName, "visibility", visibility);
194
- });
195
- }, [props.visible]);
196
-
197
- const dropHandler = (event:any) => {
198
- event.preventDefault();
199
-
200
- if (event.dataTransfer.items) {
201
- if (event.dataTransfer.items.length > 1) {
202
- return false;
203
- }
204
- // If dropped items aren't files, reject them
205
- if (event.dataTransfer.items[0].kind === "file") {
206
- const reader = new FileReader();
207
- reader.onload = (payload:any) => {
208
- if(!payload?.currentTarget?.result)return;
209
-
210
- addGPXToMap(payload.currentTarget.result);
211
- };
212
- const file = event.dataTransfer.items[0].getAsFile();
213
- reader.readAsText(file);
214
- }
215
- } else {
216
- // Use DataTransfer interface to access the file(s)
217
- }
218
- return;
219
- };
220
-
221
- const addGPXToMap = (gpxAsString:string) => {
222
- if (!mapHook.map || !dataSource.setData) return;
223
-
224
- try {
225
- setMetaData([]);
226
- const domParser = new DOMParser();
227
- const gpxDoc = domParser.parseFromString(gpxAsString, "application/xml");
228
- const metadata = gpxDoc.querySelector("metadata");
229
- metadata?.childNodes.forEach((node:Element) => {
230
- let value = node.textContent;
231
- const title = node.nodeName;
232
-
233
- if (node.nodeName === "link") {
234
- value = node.getAttribute("href");
235
- }
236
- if (!!value?.trim().length) {
237
- const metaDatEntry = {
238
- title: title,
239
- value: value,
240
- id: new Date().getTime(),
241
- };
242
- setMetaData((prevState) => [...prevState, metaDatEntry]);
243
- }
244
- });
245
- const data = toGeoJSON.gpx(gpxDoc);
246
- dataSource.setData(data);
247
- (mapHook.map.map.getSource(sourceName) as GeoJSONSource).setData(data as GeoJSON);
248
- const bounds = bbox(data);
249
- mapHook.map.map.fitBounds(bounds as LngLatBoundsLike);
250
- } catch (e) {
251
- console.log(e);
252
- }
253
- };
254
-
255
- const toogleDrawer = () => {
256
- setIsOpen((prevState) => !prevState);
257
- };
258
-
259
- const fileUploadOnChange = () => {
260
- if(!fileupload.current)return false;
261
-
262
- const file = fileupload.current?.files?.[0];
263
- if (!file) return false;
264
- const reader = new FileReader();
265
- reader.onload = (payload:any) => {
266
- if(!payload)return;
267
-
268
- addGPXToMap(payload.currentTarget.result);
269
- };
270
-
271
- reader.readAsText(file);
272
-
273
- return;
274
- };
275
-
276
- const manualUpload = () => {
277
- if(!fileupload.current)return;
278
-
279
- fileupload.current.click();
280
- };
281
- return (
282
- <>
283
- <div
284
- style={{
285
- position: "fixed",
286
- right: "5px",
287
- bottom: mediaIsMobile ? "40px" : "25px",
288
- display: "flex",
289
- flexDirection: "column",
290
- gap: "5px",
291
- zIndex: 1000,
292
- }}
293
- >
294
- <IconButton
295
- onClick={manualUpload}
296
- style={{
297
- backgroundColor: "rgba(255,255,255,1)",
298
- }}
299
- size="large"
300
- >
301
- <input
302
- ref={fileupload}
303
- onChange={fileUploadOnChange}
304
- type="file"
305
- id="input"
306
- multiple
307
- style={{ display: "none" }}
308
- ></input>
309
- <FileCopy />
310
- </IconButton>
311
- <IconButton
312
- onClick={toogleDrawer}
313
- style={{
314
- backgroundColor: "rgba(255,255,255,1)",
315
- }}
316
- size="large"
317
- >
318
- <InfoIcon />
319
- </IconButton>
320
- </div>
321
- <Drawer variant="persistent" anchor="left" open={open}>
322
- <Typography
323
- variant="h6"
324
- style={{
325
- textAlign: "center",
326
- padding: "1em",
327
- }}
328
- noWrap
329
- >
330
- Informationen zur Route
331
- </Typography>
332
- <Divider />
333
- <List>
334
- {metaData.map((item) => (
335
- <ListItem key={`item--${item.id}`}>
336
- <ListItemText primary={item.value} />
337
- </ListItem>
338
- ))}
339
- </List>
340
- </Drawer>
341
- <div
342
- onDrop={dropHandler}
343
- ref={dropZone}
344
- style={{
345
- position: "absolute",
346
- left: "0",
347
- top: "0",
348
- backgroundColor: "rgba(255,255,255,0.5)",
349
- width: "100%",
350
- height: "100%",
351
- zIndex: zIndex,
352
- }}
353
- >
354
- <Typography
355
- variant="h6"
356
- style={{
357
- top: "50%",
358
- position: "absolute",
359
- left: "50%",
360
- msTransform: "translate(-50%, -50%)",
361
- transform: " translate(-50%, -50%)",
362
- }}
363
- noWrap
364
- >
365
- Gpx-Datei ablegen
366
- </Typography>
367
- </div>
368
- </>
369
- );
370
- };
371
-
372
- MlGPXViewer.defaultProps = {
373
- visible: true,
374
- };
375
-
376
-
377
- export default MlGPXViewer;
@@ -1,66 +0,0 @@
1
- import React from "react";
2
-
3
- import MlGeoJsonLayer from "./MlGeoJsonLayer";
4
-
5
- import mapContextDecorator from "../../decorators/MapContextDecorator";
6
-
7
- import sample_geojson_1 from "./assets/sample_1.json";
8
- import sample_polygon_geojson_1 from "./assets/sample_polygon_1.json";
9
-
10
- console.log(sample_polygon_geojson_1);
11
- const storyoptions = {
12
- title: "MapComponents/MlGeoJsonLayer",
13
- component: MlGeoJsonLayer,
14
- argTypes: {
15
- },
16
- decorators: mapContextDecorator,
17
- };
18
- export default storyoptions;
19
-
20
- const Template = (props) => {
21
- return (
22
- <>
23
- <MlGeoJsonLayer {...props} />
24
- </>
25
- );
26
- };
27
- const LinestringTemplate = (props) => {
28
- return (
29
- <>
30
- <MlGeoJsonLayer type="line" geojson={sample_geojson_1} />
31
- </>
32
- );
33
- };
34
-
35
- export const Linestring = LinestringTemplate.bind({});
36
- Linestring.parameters = {};
37
- Linestring.args = {
38
- type:''
39
- };
40
-
41
- export const Polygon = Template.bind({});
42
- Polygon.parameters = {};
43
- Polygon.args = {
44
- geojson: sample_polygon_geojson_1,
45
- paint:{
46
- "fill-color": 'rgba(120,20,80,.5)'
47
- },
48
- type:''
49
- };
50
- export const DefaultPaintOverrides = Template.bind({});
51
- DefaultPaintOverrides.parameters = {};
52
- DefaultPaintOverrides.args = {
53
- defaultPaintOverrides: {
54
- fill: {
55
- "fill-color": "blue",
56
- },
57
- circle: {
58
- "circle-color": "red",
59
- },
60
- line: {
61
- "line-color": "black",
62
- },
63
- },
64
- geojson: sample_polygon_geojson_1,
65
- type:''
66
- };
@@ -1,45 +0,0 @@
1
- import React from "react";
2
-
3
- import MlImageMarkerLayer from "./MlImageMarkerLayer";
4
-
5
- import mapContextDecorator from "../../decorators/MapContextDecorator";
6
- import wgMarker from "./assets/wg-marker.png";
7
-
8
- const storyoptions = {
9
- title: "MapComponents/MlImageMarkerLayer",
10
- component: MlImageMarkerLayer,
11
- argTypes: { },
12
- decorators: mapContextDecorator,
13
- };
14
- export default storyoptions;
15
-
16
- const Template = (args) => (
17
- <MlImageMarkerLayer
18
- options={{
19
- type: "symbol",
20
- source: {
21
- type: "geojson",
22
- data: {
23
- type: "Feature",
24
- properties: {
25
- id: "test",
26
- },
27
- geometry: {
28
- type: "Point",
29
- coordinates: [7.0847929969609424, 50.73855193187643],
30
- },
31
- },
32
- },
33
- layout: {
34
- "icon-allow-overlap": true,
35
- "icon-size": 0.14,
36
- "icon-offset": [0, -180],
37
- },
38
- }}
39
- imgSrc={wgMarker}
40
- />
41
- );
42
-
43
- export const ExampleConfig = Template.bind({});
44
- ExampleConfig.parameters = {};
45
- ExampleConfig.args = {};