@mapcomponents/react-maplibre 0.1.63 → 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 (294) hide show
  1. package/.editorconfig +1 -1
  2. package/.eslintrc.js +9 -6
  3. package/.github/workflows/check-catalogue-metadata-schema.yml +19 -0
  4. package/CHANGELOG.md +27 -2
  5. package/coverage/clover.xml +671 -1032
  6. package/coverage/coverage-final.json +24 -21
  7. package/coverage/lcov-report/index.html +112 -82
  8. package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +24 -24
  9. package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
  10. package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +5 -5
  11. package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
  12. package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +2 -2
  13. package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
  14. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +1 -1
  15. package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +1 -1
  16. package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +1 -1
  17. package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +2 -5
  18. package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
  19. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
  20. package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
  21. package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +1 -1
  22. package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
  23. package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +40 -19
  24. package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
  25. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html +1 -1
  26. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +1 -1
  27. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx.html +112 -0
  28. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx.html +115 -0
  29. package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +34 -4
  30. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +1 -1
  31. package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +1 -1
  32. package/coverage/lcov-report/src/components/MlGpxViewer/MlGpxViewer.tsx.html +394 -0
  33. package/coverage/lcov-report/src/components/{MlGPXViewer → MlGpxViewer}/index.html +23 -38
  34. package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +63 -285
  35. package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +21 -21
  36. package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
  37. package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
  38. package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +58 -76
  39. package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
  40. package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +58 -61
  41. package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +11 -11
  42. package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
  43. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +30 -21
  44. package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
  45. package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
  46. package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
  47. package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
  48. package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
  49. package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
  50. package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
  51. package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
  52. package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +1 -1
  53. package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
  54. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
  55. package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
  56. package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
  57. package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
  58. package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
  59. package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
  60. package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
  61. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/ColorPicker.tsx.html +1 -1
  62. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +1 -1
  63. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +1 -1
  64. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +1 -1
  65. package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +1 -1
  66. package/coverage/lcov-report/src/components/MlSketchTool/MlSketchTool.tsx.html +1 -1
  67. package/coverage/lcov-report/src/components/MlSketchTool/index.html +1 -1
  68. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx.html +514 -0
  69. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +21 -21
  70. package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
  71. package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
  72. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +20 -206
  73. package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
  74. package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
  75. package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
  76. package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +10 -7
  77. package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +5 -5
  78. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
  79. package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
  80. package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +111 -57
  81. package/coverage/lcov-report/src/components/MlWmsLayer/index.html +19 -19
  82. package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +201 -144
  83. package/coverage/lcov-report/src/components/MlWmsLoader/index.html +9 -9
  84. package/coverage/lcov-report/src/contexts/MapContext.tsx.html +23 -23
  85. package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
  86. package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
  87. package/coverage/lcov-report/src/contexts/index.html +1 -1
  88. package/coverage/lcov-report/src/hooks/index.html +50 -50
  89. package/coverage/lcov-report/src/hooks/useCameraFollowPath/index.html +1 -1
  90. package/coverage/lcov-report/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx.html +1 -1
  91. package/coverage/lcov-report/src/hooks/useExportMap/index.html +1 -1
  92. package/coverage/lcov-report/src/hooks/useExportMap/index.ts.html +1 -1
  93. package/coverage/lcov-report/src/hooks/useExportMap/lib.ts.html +1 -1
  94. package/coverage/lcov-report/src/hooks/useGpx/index.html +116 -0
  95. package/coverage/lcov-report/src/hooks/useGpx/useGpx.tsx.html +295 -0
  96. package/coverage/lcov-report/src/hooks/useLayer.ts.html +132 -66
  97. package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +1 -1
  98. package/coverage/lcov-report/src/hooks/useLayerHoverPopup/index.html +116 -0
  99. package/coverage/lcov-report/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx.html +331 -0
  100. package/coverage/lcov-report/src/hooks/useMap.ts.html +47 -47
  101. package/coverage/lcov-report/src/hooks/useMapState.ts.html +54 -54
  102. package/coverage/lcov-report/src/hooks/useSource.ts.html +57 -57
  103. package/coverage/lcov-report/src/hooks/{useWms.js.html → useWms.ts.html} +54 -15
  104. package/coverage/lcov-report/src/index.html +1 -1
  105. package/coverage/lcov-report/src/index.ts.html +6 -6
  106. package/coverage/lcov.info +1284 -1959
  107. package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +51 -25
  108. package/dist/components/MlCenterPosition/MlCenterPosition.d.ts +3 -2
  109. package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +35 -16
  110. package/dist/components/MlComponentTemplate/MlComponentTemplate.d.ts +1 -1
  111. package/dist/components/MlComponentTemplate/MlComponentTemplate.stories.d.ts +12 -9
  112. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.d.ts +1 -1
  113. package/dist/components/MlCreatePdfButton/MlCreatePdfButton.stories.d.ts +12 -9
  114. package/dist/components/MlGPXViewer/util/GeoJsonContext.d.ts +1 -1
  115. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +22 -11
  116. package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +4 -95
  117. package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.d.ts +3 -0
  118. package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.d.ts +3 -0
  119. package/dist/components/MlGpxViewer/MlGpxViewer.d.ts +30 -0
  120. package/dist/components/MlGpxViewer/MlGpxViewer.stories.d.ts +17 -0
  121. package/dist/components/MlGpxViewer/MlGpxViewer.test.d.ts +1 -0
  122. package/dist/components/MlGpxViewer/util/GeoJsonContext.d.ts +10 -0
  123. package/dist/components/MlGpxViewer/util/GeoJsonProvider.d.ts +4 -0
  124. package/dist/components/MlGpxViewer/util/MetadataDrawer.d.ts +7 -0
  125. package/dist/components/MlGpxViewer/util/MlGpxDemoLoader.d.ts +10 -0
  126. package/dist/components/MlGpxViewer/util/MlGpxViewerInstructions.d.ts +3 -0
  127. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +11 -2
  128. package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.d.ts +7 -9
  129. package/dist/components/MlLayerMagnify/MlLayerMagnify.d.ts +8 -2
  130. package/dist/components/MlLayerMagnify/MlLayerMagnify.stories.d.ts +13 -9
  131. package/dist/components/MlLayerSwipe/MlLayerSwipe.d.ts +13 -3
  132. package/dist/components/MlLayerSwipe/MlLayerSwipe.stories.d.ts +12 -10
  133. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +33 -14
  134. package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.d.ts +18 -15
  135. package/dist/components/MlSpatialElevationProfile/util/getElevationData.d.ts +14 -0
  136. package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +3 -67
  137. package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +7 -4
  138. package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +17 -10
  139. package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +23 -12
  140. package/dist/components/MlWmsLoader/utils/MlWmsLoaderInstructions.d.ts +3 -0
  141. package/dist/components/MlWmsLoader/utils/WMSLinks.d.ts +6 -0
  142. package/dist/decorators/ThemeWrapper.d.ts +3 -1
  143. package/dist/hooks/useGpx/lib/gpxConverter.d.ts +11 -0
  144. package/dist/hooks/useGpx/useGpx.d.ts +26 -0
  145. package/dist/hooks/useGpx/useGpx.stories.d.ts +10 -0
  146. package/dist/hooks/useLayer.d.ts +13 -7
  147. package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.d.ts +23 -0
  148. package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.d.ts +10 -0
  149. package/dist/hooks/useMap.d.ts +1 -1
  150. package/dist/hooks/useMap.test.d.ts +1 -0
  151. package/dist/hooks/useSource.d.ts +2 -2
  152. package/dist/hooks/useWms.d.ts +24 -16
  153. package/dist/index.d.ts +5 -5
  154. package/dist/index.esm.js +9310 -14006
  155. package/dist/index.esm.js.map +1 -1
  156. package/dist/setupTests.d.ts +6 -5
  157. package/dist/ui_components/Dropzone.d.ts +5 -0
  158. package/dist/ui_components/ImageLoader.d.ts +8 -1
  159. package/dist/ui_components/LoadingOverlayContext.d.ts +11 -11
  160. package/dist/ui_components/Sidebar.d.ts +7 -6
  161. package/dist/ui_components/Tooltip.d.ts +1 -1
  162. package/dist/ui_components/TopToolbar.d.ts +4 -3
  163. package/dist/ui_components/UploadButton.d.ts +6 -0
  164. package/dist/util/BubbleForInstructions.d.ts +2 -0
  165. package/dist/util/Instructions.d.ts +13 -0
  166. package/package.json +195 -191
  167. package/{src/components/MlImageMarkerLayer → public}/assets/wg-marker.png +0 -0
  168. package/scripts/build-catalogue-meta.js +35 -11
  169. package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +230 -188
  170. package/src/components/MlCenterPosition/MlCenterPosition.meta_.json +1 -2
  171. package/src/components/MlCenterPosition/MlCenterPosition.stories.tsx +20 -0
  172. package/src/components/MlCenterPosition/MlCenterPosition.tsx +4 -4
  173. package/src/components/MlComponentTemplate/MlComponentTemplate.meta_.json +1 -2
  174. package/src/components/MlComponentTemplate/{MlComponentTemplate.stories.js → MlComponentTemplate.stories.tsx} +2 -2
  175. package/src/components/MlComponentTemplate/MlComponentTemplate.tsx +1 -1
  176. package/src/components/MlCreatePdfButton/MlCreatePdfButton.meta_.json +1 -2
  177. package/src/components/MlCreatePdfButton/{MlCreatePdfButton.stories.js → MlCreatePdfButton.stories.tsx} +1 -1
  178. package/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx +1 -1
  179. package/src/components/MlCreatePdfForm/MlCreatePdfForm.meta.json +1 -2
  180. package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +25 -2
  181. package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +1 -2
  182. package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +0 -1
  183. package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.meta.json +1 -2
  184. package/src/components/MlFollowGps/MlFollowGps.meta.json +1 -2
  185. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.meta.json +1 -2
  186. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.tsx +89 -0
  187. package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +24 -17
  188. package/src/components/MlGeoJsonLayer/assets/earthquake.json +109937 -0
  189. package/src/components/MlGeoJsonLayer/assets/wg_locations.json +65 -0
  190. package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx +9 -0
  191. package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx +10 -0
  192. package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.meta_.json +1 -2
  193. package/src/components/{MlGPXViewer/MlGPXViewer.doc.de.md → MlGpxViewer/MlGpxViewer.doc.de.md} +0 -0
  194. package/src/components/{MlGPXViewer/MlGPXViewer.doc.en.md → MlGpxViewer/MlGpxViewer.doc.en.md} +0 -0
  195. package/src/components/{MlGPXViewer/MlGPXViewer.meta.json → MlGpxViewer/MlGpxViewer.meta.json} +2 -3
  196. package/src/components/MlGpxViewer/MlGpxViewer.stories.tsx +109 -0
  197. package/src/components/MlGpxViewer/MlGpxViewer.test.js +53 -0
  198. package/src/components/MlGpxViewer/MlGpxViewer.tsx +103 -0
  199. package/src/components/{MlGPXViewer → MlGpxViewer}/util/GeoJsonContext.ts +0 -0
  200. package/src/components/{MlGPXViewer → MlGpxViewer}/util/GeoJsonProvider.tsx +0 -0
  201. package/src/components/MlGpxViewer/util/MetadataDrawer.tsx +38 -0
  202. package/src/components/MlGpxViewer/util/MlGpxDemoLoader.tsx +128 -0
  203. package/src/components/MlGpxViewer/util/MlGpxViewerInstructions.tsx +68 -0
  204. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.meta_.json +1 -2
  205. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.tsx +41 -0
  206. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +27 -8
  207. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx +41 -115
  208. package/src/components/MlLayer/MlLayer.meta_.json +1 -2
  209. package/src/components/MlLayerMagnify/MlLayerMagnify.meta.json +1 -2
  210. package/src/components/MlLayerMagnify/MlLayerMagnify.stories.tsx +44 -0
  211. package/src/components/MlLayerMagnify/{MlLayerMagnify.test.js → MlLayerMagnify.test.tsx} +15 -18
  212. package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +55 -61
  213. package/src/components/MlLayerSwipe/MlLayerSwipe.meta.json +1 -2
  214. package/src/components/MlLayerSwipe/{MlLayerSwipe.stories.js → MlLayerSwipe.stories.tsx} +9 -11
  215. package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +47 -48
  216. package/src/components/MlLayerSwitcher/MlLayerSwitcher.meta_.json +1 -2
  217. package/src/components/MlLayerSwitcher/components/LayerBox.js +22 -19
  218. package/src/components/MlMarker/MlMarker.meta_.json +1 -2
  219. package/src/components/MlMeasureTool/MlMeasureTool.meta.json +1 -2
  220. package/src/components/MlNavigationCompass/MlNavigationCompass.meta.json +1 -2
  221. package/src/components/MlNavigationTools/MlNavigationTools.meta.json +1 -2
  222. package/src/components/MlScaleReference/MlScaleReference.meta.json +1 -2
  223. package/src/components/MlShareMapState/MlShareMapState.meta_.json +1 -2
  224. package/src/components/MlSketchTool/MlSketchTool.meta.json +1 -2
  225. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.meta.json +1 -2
  226. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.tsx +121 -0
  227. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.test.js +30 -1
  228. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx +143 -0
  229. package/src/components/MlSpatialElevationProfile/util/getElevationData.tsx +103 -0
  230. package/src/components/MlThreeJsLayer/MlThreeJsLayer.meta.json +1 -2
  231. package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.meta.json +1 -2
  232. package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.stories.js +2 -3
  233. package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx +17 -79
  234. package/src/components/MlUseMapDebugger/MlUseMapDebugger.meta_.json +1 -2
  235. package/src/components/MlVectorTileLayer/MlVectorTileLayer.meta.json +1 -2
  236. package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +3 -2
  237. package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.meta_.json +1 -2
  238. package/src/components/MlWmsLayer/MlWmsLayer.tsx +59 -41
  239. package/src/components/MlWmsLoader/MlWmsLoader.meta.json +1 -2
  240. package/src/components/MlWmsLoader/MlWmsLoader.stories.tsx +89 -0
  241. package/src/components/MlWmsLoader/MlWmsLoader.tsx +141 -122
  242. package/src/components/MlWmsLoader/utils/MlWmsLoaderInstructions.tsx +50 -0
  243. package/src/components/MlWmsLoader/utils/WMSLinks.tsx +128 -0
  244. package/src/decorators/MapContextDecorator.js +1 -1
  245. package/src/decorators/MapContextDecoratorHooks.js +1 -1
  246. package/src/decorators/ThemeWrapper.tsx +9 -0
  247. package/src/hooks/useCameraFollowPath/useCameraFollowPath.meta.json +1 -2
  248. package/src/{components/MlGPXViewer → hooks/useGpx/lib}/gpxConverter.js +1 -0
  249. package/src/hooks/useGpx/useGpx.doc.de.md +3 -0
  250. package/src/hooks/useGpx/useGpx.meta_.json +15 -0
  251. package/src/{components/MlCenterPosition/MlCenterPosition.stories.js → hooks/useGpx/useGpx.stories.js} +4 -5
  252. package/src/hooks/useGpx/useGpx.tsx +70 -0
  253. package/src/hooks/useLayer.ts +32 -10
  254. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.doc.de.md +3 -0
  255. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.meta_.json +15 -0
  256. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.js +20 -0
  257. package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx +82 -0
  258. package/src/hooks/useMap.test.tsx +48 -0
  259. package/src/hooks/useMap.ts +8 -8
  260. package/src/hooks/useSource.ts +4 -4
  261. package/src/hooks/{useWms.js → useWms.ts} +24 -11
  262. package/src/index.ts +5 -5
  263. package/src/setupTests.js +18 -15
  264. package/src/ui_components/Dropzone.tsx +104 -0
  265. package/src/ui_components/{ImageLoader.js → ImageLoader.tsx} +30 -25
  266. package/src/ui_components/{LoadingOverlayContext.js → LoadingOverlayContext.tsx} +12 -15
  267. package/src/ui_components/Sidebar.tsx +12 -10
  268. package/src/ui_components/Tooltip.tsx +17 -0
  269. package/src/ui_components/TopToolbar.tsx +5 -3
  270. package/src/ui_components/UploadButton.tsx +57 -0
  271. package/src/util/BubbleForInstructions.js +46 -0
  272. package/src/util/Instructions.tsx +60 -0
  273. package/tsconfig.json +1 -1
  274. package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.tsx.html +0 -1222
  275. package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +0 -1645
  276. package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +0 -757
  277. package/dist/components/MlGPXViewer/util/MlGPXViewerInstructions.d.ts +0 -1
  278. package/dist/components/MlGPXViewer/util/SampleLayer.d.ts +0 -0
  279. package/dist/components/MlGPXViewer/util/demoViewer.d.ts +0 -5
  280. package/src/components/MlGPXViewer/MlGPXViewer.stories.js +0 -91
  281. package/src/components/MlGPXViewer/MlGPXViewer.test.js +0 -28
  282. package/src/components/MlGPXViewer/MlGPXViewer.tsx +0 -379
  283. package/src/components/MlGPXViewer/util/MlGPXViewerInstructions.js +0 -145
  284. package/src/components/MlGPXViewer/util/SampleLayer.js +0 -2
  285. package/src/components/MlGPXViewer/util/demoViewer.js +0 -254
  286. package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.js +0 -45
  287. package/src/components/MlLayerMagnify/MlLayerMagnify.stories.js +0 -41
  288. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js +0 -224
  289. package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +0 -57
  290. package/src/components/MlWmsLoader/MlWmsLoader.stories.js +0 -47
  291. package/src/decorators/ThemeWrapper.jsx +0 -9
  292. package/src/ui_components/Legend.js +0 -44
  293. package/src/ui_components/LoadingOverlay.js +0 -41
  294. package/src/ui_components/Tooltip.js +0 -21
@@ -1,16 +1,11 @@
1
- import React, {
2
- useContext,
3
- useCallback,
4
- useRef,
5
- useEffect,
6
- useState,
7
- } from "react";
1
+ import React, { useContext, useCallback, useRef, useEffect, useState } from 'react';
2
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
8
3
  // @ts-ignore
9
- import syncMove from "@mapbox/mapbox-gl-sync-move";
10
- import "./style.css";
11
- import MapContext from "../../contexts/MapContext";
4
+ import syncMove from '@mapbox/mapbox-gl-sync-move';
5
+ import './style.css';
6
+ import MapContext from '../../contexts/MapContext';
12
7
 
13
- interface MlLayerSwipeProps {
8
+ export interface MlLayerSwipeProps {
14
9
  /**
15
10
  * Id of the first MapLibre instance.
16
11
  */
@@ -19,6 +14,10 @@ interface MlLayerSwipeProps {
19
14
  * Id of the second MapLibre instance.
20
15
  */
21
16
  map2Id: string;
17
+ /**
18
+ * object (React.CSSProperties) that is added to the button default style
19
+ */
20
+ buttonStyle: React.CSSProperties | undefined;
22
21
  }
23
22
 
24
23
  /**
@@ -45,33 +44,28 @@ const MlLayerSwipe = (props: MlLayerSwipeProps) => {
45
44
  }, [mapContext, props.map1Id, props.map2Id]);
46
45
 
47
46
  const cleanup = () => {
48
- syncCleanupFunctionRef.current();
47
+ syncCleanupFunctionRef.current();
49
48
  };
50
49
 
51
50
  const onMove = useCallback(
52
51
  (e) => {
53
52
  if (!mapExists()) return;
54
53
 
55
- let bounds = mapContext.maps[props.map1Id]
56
- .getCanvas()
57
- .getBoundingClientRect();
54
+ const bounds = mapContext.maps[props.map1Id].getCanvas().getBoundingClientRect();
58
55
  let clientX =
59
56
  e.clientX ||
60
- (typeof e.touches !== "undefined" && typeof e.touches[0] !== "undefined"
57
+ (typeof e.touches !== 'undefined' && typeof e.touches[0] !== 'undefined'
61
58
  ? e.touches[0].clientX
62
59
  : 0);
63
60
 
64
61
  clientX -= bounds.x;
65
- let swipeX_tmp = parseFloat(((clientX / bounds.width) * 100).toFixed(2));
62
+ const swipeX_tmp = parseFloat(((clientX / bounds.width) * 100).toFixed(2));
66
63
 
67
64
  if (swipeXRef.current !== swipeX_tmp) {
68
65
  setSwipeX(swipeX_tmp);
69
66
  swipeXRef.current = swipeX_tmp;
70
67
 
71
- var clipA =
72
- "rect(0, " +
73
- (swipeXRef.current * bounds.width) / 100 +
74
- "px, 999em, 0)";
68
+ const clipA = 'rect(0, ' + (swipeXRef.current * bounds.width) / 100 + 'px, 999em, 0)';
75
69
 
76
70
  mapContext.maps[props.map2Id].getContainer().style.clip = clipA;
77
71
  }
@@ -96,46 +90,47 @@ const MlLayerSwipe = (props: MlLayerSwipeProps) => {
96
90
  });
97
91
  }, [mapContext.mapIds, mapContext, props, onMove, mapExists]);
98
92
 
99
- const onDown = (e: any) => {
100
- if (e.touches) {
101
- document.addEventListener("touchmove", onMove);
102
- document.addEventListener("touchend", onTouchEnd);
93
+ const onDown = (e: React.MouseEvent | React.TouchEvent) => {
94
+ if (e.nativeEvent instanceof TouchEvent) {
95
+ document.addEventListener('touchmove', onMove);
96
+ document.addEventListener('touchend', onTouchEnd);
103
97
  } else {
104
- document.addEventListener("mousemove", onMove);
105
- document.addEventListener("mouseup", onMouseUp);
98
+ document.addEventListener('mousemove', onMove);
99
+ document.addEventListener('mouseup', onMouseUp);
106
100
  }
107
101
  };
108
102
 
109
103
  const onTouchEnd = () => {
110
- document.removeEventListener("touchmove", onMove);
111
- document.removeEventListener("touchend", onTouchEnd);
104
+ document.removeEventListener('touchmove', onMove);
105
+ document.removeEventListener('touchend', onTouchEnd);
112
106
  };
113
107
 
114
108
  const onMouseUp = () => {
115
- document.removeEventListener("mousemove", onMove);
116
- document.removeEventListener("mouseup", onMouseUp);
109
+ document.removeEventListener('mousemove', onMove);
110
+ document.removeEventListener('mouseup', onMouseUp);
117
111
  };
118
112
 
119
113
  return (
120
114
  <div
121
115
  style={{
122
- position: "absolute",
123
- left: swipeX + "%",
124
- top: "50%",
125
- borderRadius: "50%",
126
- width: "100px",
127
- height: "100px",
128
- background: "#0066ff",
129
- border: "3px solid #eaebf1",
130
- cursor: "pointer",
131
- zIndex: "110",
132
- marginLeft: "-50px",
133
- marginTop: "-50px",
134
- textAlign: "center",
135
- lineHeight: "91px",
136
- fontSize: "2em",
137
- color: "#fafafa",
138
- userSelect: "none",
116
+ position: 'absolute',
117
+ left: swipeX + '%',
118
+ top: '50%',
119
+ borderRadius: '50%',
120
+ width: '100px',
121
+ height: '100px',
122
+ background: '#0066ff',
123
+ border: '3px solid #eaebf1',
124
+ cursor: 'pointer',
125
+ zIndex: '110',
126
+ marginLeft: '-50px',
127
+ marginTop: '-50px',
128
+ textAlign: 'center',
129
+ lineHeight: '91px',
130
+ fontSize: '2em',
131
+ color: '#fafafa',
132
+ userSelect: 'none',
133
+ ...props.buttonStyle,
139
134
  }}
140
135
  onTouchStart={onDown}
141
136
  onMouseDown={onDown}
@@ -143,4 +138,8 @@ const MlLayerSwipe = (props: MlLayerSwipeProps) => {
143
138
  );
144
139
  };
145
140
 
141
+ MlLayerSwipe.defaultProps = {
142
+ buttonStyle: {},
143
+ };
144
+
146
145
  export default MlLayerSwipe;
@@ -10,6 +10,5 @@
10
10
  },
11
11
  "tags": [],
12
12
  "category": "",
13
- "type": "component",
14
- "price": 0
13
+ "type": "component"
15
14
  }
@@ -1,8 +1,8 @@
1
- import React from "react";
2
- import { css } from "@emotion/css";
3
- import { Box } from "@mui/system";
4
- import ImageLoader from "../../../ui_components/ImageLoader";
5
- import useMapState from "../../../hooks/useMapState";
1
+ import React from 'react';
2
+ import { css } from '@emotion/css';
3
+ import { Box } from '@mui/system';
4
+ import ImageLoader from '../../../ui_components/ImageLoader';
5
+ import useMapState from '../../../hooks/useMapState';
6
6
 
7
7
  /**
8
8
  * @component
@@ -20,7 +20,7 @@ const LayerBox = (props) => {
20
20
  matchLayerIds: props.layerId,
21
21
  },
22
22
  });
23
- const width = "40px";
23
+ const width = '40px';
24
24
 
25
25
  const defaultClass = css`
26
26
  & img:hover {
@@ -34,22 +34,25 @@ const LayerBox = (props) => {
34
34
  className={defaultClass}
35
35
  sx={{
36
36
  width,
37
- height: "53px",
38
- justifyContent: "center",
37
+ height: '53px',
38
+ justifyContent: 'center',
39
39
  py: 0.25,
40
- px: "1rem",
41
- cursor: "pointer",
40
+ px: '1rem',
41
+ cursor: 'pointer',
42
+ display: 'flex',
43
+ flexDirection: 'column',
44
+ alignItems: 'stretch',
42
45
  }}
43
46
  onClick={() => {
44
47
  props?.handleLayerBoxClick?.(props.layerId);
45
48
  }}
46
49
  >
47
50
  <ImageLoader
48
- style={{
49
- border: "2px solid " + (layers?.[0]?.visible ? "#64c864" : "#fd720f"),
50
- borderRadius: "8px",
51
- height: "40px",
52
- width: "40px",
51
+ sx={{
52
+ border: '2px solid ' + (layers?.[0]?.visible ? '#64c864' : '#fd720f'),
53
+ borderRadius: '8px',
54
+ height: '40px',
55
+ width: '40px',
53
56
  }}
54
57
  src={props.thumbnail}
55
58
  />
@@ -57,11 +60,11 @@ const LayerBox = (props) => {
57
60
  <div
58
61
  className="mllayerswitcher-layer-text"
59
62
  style={{
60
- textAlign: "center",
61
- color: "rgb(112, 117, 122)",
62
- fontFamily: "Roboto, Arial",
63
+ textAlign: 'center',
64
+ color: 'rgb(112, 117, 122)',
65
+ fontFamily: 'Roboto, Arial',
63
66
  width,
64
- fontSize: "0.60rem",
67
+ fontSize: '0.60rem',
65
68
  }}
66
69
  >
67
70
  {props.label}
@@ -10,6 +10,5 @@
10
10
  },
11
11
  "tags": [],
12
12
  "category": "",
13
- "type": "component",
14
- "price": 0
13
+ "type": "component"
15
14
  }
@@ -10,6 +10,5 @@
10
10
  },
11
11
  "tags": [],
12
12
  "category": "",
13
- "type": "component",
14
- "price": 0
13
+ "type": "component"
15
14
  }
@@ -10,6 +10,5 @@
10
10
  },
11
11
  "tags": [],
12
12
  "category": "",
13
- "type": "component",
14
- "price": 0
13
+ "type": "component"
15
14
  }
@@ -10,6 +10,5 @@
10
10
  },
11
11
  "tags": [],
12
12
  "category": "",
13
- "type": "component",
14
- "price": 0
13
+ "type": "component"
15
14
  }
@@ -10,6 +10,5 @@
10
10
  },
11
11
  "tags": [],
12
12
  "category": "",
13
- "type": "component",
14
- "price": 0
13
+ "type": "component"
15
14
  }
@@ -10,6 +10,5 @@
10
10
  },
11
11
  "tags": [],
12
12
  "category": "",
13
- "type": "component",
14
- "price": 0
13
+ "type": "component"
15
14
  }
@@ -10,6 +10,5 @@
10
10
  },
11
11
  "tags": [],
12
12
  "category": "",
13
- "type": "component",
14
- "price": 0
13
+ "type": "component"
15
14
  }
@@ -10,6 +10,5 @@
10
10
  },
11
11
  "tags": ["Map add-on"],
12
12
  "category": "add-ons",
13
- "type": "component",
14
- "price": 5000
13
+ "type": "component"
15
14
  }
@@ -0,0 +1,121 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import MlSpatialElevationProfile from './MlSpatialElevationProfile';
3
+ import MlGpxViewer from '../MlGpxViewer/MlGpxViewer';
4
+ import InfoIcon from '@mui/icons-material/Info';
5
+ import useGpx, { MetadataType } from '../../hooks/useGpx/useGpx';
6
+ import FileCopy from '@mui/icons-material/FileCopy';
7
+ import Dropzone from '../../ui_components/Dropzone';
8
+ import UploadButton from '../../ui_components/UploadButton';
9
+ import MetadataDrawer from '../MlGpxViewer/util/MetadataDrawer';
10
+ import mapContextDecorator from '../../decorators/MapContextDecorator';
11
+ import IconButton from '@mui/material/IconButton';
12
+ import useMediaQuery from '@mui/material/useMediaQuery';
13
+ import TopToolbar from '../../ui_components/TopToolbar';
14
+ import useMap from '../../hooks/useMap';
15
+ import MlGpxViewerInstructions from '../MlGpxViewer/util/MlGpxViewerInstructions';
16
+ import { Button } from '@mui/material';
17
+ import MlGpxDemoLoader from '../MlGpxViewer/util/MlGpxDemoLoader';
18
+
19
+ const storyoptions = {
20
+ title: 'MapComponents/MlSpatialElevationProfile',
21
+ component: MlSpatialElevationProfile,
22
+ argTypes: {
23
+ options: {
24
+ control: {
25
+ type: 'object',
26
+ },
27
+ },
28
+ },
29
+ decorators: mapContextDecorator,
30
+ };
31
+ export default storyoptions;
32
+
33
+ const Template = () => {
34
+ const [gpxData, setGpxData] = useState<string | undefined>();
35
+ const parsedGpx = useGpx({ data: gpxData });
36
+ const mediaIsMobile = useMediaQuery('(max-width:900px)');
37
+ const [demoLoaderOpen, setDemoLoaderOpen] = useState(false);
38
+ const [guide, setGuide] = useState(false);
39
+ const [metadataDrawerOpen, setMetadataDrawerOpen] = useState(false);
40
+ const [metadata, setMetadata] = useState<MetadataType[]>([]);
41
+ const mapHook = useMap({ mapId: 'map_1' });
42
+
43
+ const handleClick1 = () => {
44
+ setDemoLoaderOpen(!demoLoaderOpen);
45
+ };
46
+
47
+ const handleClick2 = () => {
48
+ setGuide(true);
49
+ setTimeout(() => {
50
+ setGuide(false);
51
+ }, 9000);
52
+ };
53
+ useEffect(() => {
54
+ if (!mapHook.map) return;
55
+ if (mapHook.map.map.getPitch() != 60) {
56
+ mapHook.map.map.setPitch(60);
57
+ }
58
+ }, [mapHook.map]);
59
+
60
+ return (
61
+ <>
62
+ <TopToolbar>
63
+ <MlGpxViewerInstructions open={guide} />
64
+ <Button variant="contained" onClick={handleClick2} sx={{ marginRight: '10px' }}>
65
+ Guide me through
66
+ </Button>
67
+ <Button variant="contained" onClick={handleClick1}>
68
+ Demo Mode
69
+ </Button>
70
+ </TopToolbar>
71
+ <MlGpxDemoLoader open={demoLoaderOpen} setOpen={setDemoLoaderOpen} setGpx={setGpxData} />
72
+
73
+ <div
74
+ style={{
75
+ position: 'fixed',
76
+ right: '5px',
77
+ bottom: mediaIsMobile ? '40px' : '25px',
78
+ display: 'flex',
79
+ flexDirection: 'column',
80
+ gap: '5px',
81
+ zIndex: 1000,
82
+ }}
83
+ >
84
+ <UploadButton
85
+ setData={setGpxData}
86
+ buttonComponent={
87
+ <IconButton
88
+ style={{
89
+ backgroundColor: 'rgba(255,255,255,1)',
90
+ }}
91
+ size="large"
92
+ >
93
+ <FileCopy />
94
+ </IconButton>
95
+ }
96
+ />
97
+ <IconButton
98
+ onClick={() => {
99
+ setMetadataDrawerOpen((prevState) => !prevState);
100
+ }}
101
+ style={{
102
+ backgroundColor: 'rgba(255,255,255,1)',
103
+ }}
104
+ size="large"
105
+ >
106
+ <InfoIcon />
107
+ </IconButton>
108
+ </div>
109
+ <MetadataDrawer metadata={metadata} open={metadataDrawerOpen} />
110
+ <Dropzone setData={(data) => setGpxData(data)} />
111
+ <MlGpxViewer
112
+ gpxData={gpxData}
113
+ onParseGpxData={(parsedGpx) => setMetadata(parsedGpx.metadata ? parsedGpx.metadata : [])}
114
+ />
115
+ <MlSpatialElevationProfile geojson={parsedGpx.geojson} />
116
+ </>
117
+ );
118
+ };
119
+
120
+ export const ExampleConfig = Template.bind({});
121
+ ExampleConfig.parameters = {};
@@ -2,8 +2,37 @@ import { layerRemovalTest, sourceRemovalTest } from "../../util";
2
2
 
3
3
  import MlSpatialElevationProfile from "./MlSpatialElevationProfile";
4
4
  import { uuid_regex } from "../../setupTests";
5
+ const sampleGeojson = {
6
+ "type": "FeatureCollection",
7
+ "features": [
8
+ {
9
+ "type": "Feature",
10
+ "properties": {
11
+ "name": "Rundwanderung auf dem Wiedweg zwischen Seelbach und Oberlahr",
12
+ "desc": "Diese Rundtour gibt mir viele historische Einblicke und zeigt mir einzigartige und mir bisher verborgene Kultur- und Naturschönheiten. Eine rundum spannende und erlebnisreiche Tour.",
13
+ "type": "hikingTourTrail"
14
+ },
15
+ "geometry": {
16
+ "type": "LineString",
17
+ "coordinates": [
18
+ [
19
+ 7.526536,
20
+ 50.647383,
21
+ 267.71535
22
+ ],
23
+ [
24
+ 7.526617,
25
+ 50.647247,
26
+ 267.83347
27
+ ],
28
+ ]
29
+ }
30
+ }
31
+ ]
32
+ }
5
33
 
6
- const testComponent = <MlSpatialElevationProfile />;
34
+ // eslint-disable-next-line react/react-in-jsx-scope
35
+ const testComponent = <MlSpatialElevationProfile geojson={sampleGeojson} />;
7
36
 
8
37
  layerRemovalTest(
9
38
  "<MlSpatialElevationProfile />",
@@ -0,0 +1,143 @@
1
+ import React, { useRef, useMemo } from 'react';
2
+ import { featureCollection } from '@turf/helpers';
3
+ import { Feature, FeatureCollection } from '@turf/turf';
4
+ import { v4 as uuidv4 } from 'uuid';
5
+ import useSource from '../../hooks/useSource';
6
+ import useLayer from '../../hooks/useLayer';
7
+ import getElevationData from './util/getElevationData';
8
+ import { Coordinates, DataDrivenPropertyValueSpecification } from 'maplibre-gl';
9
+
10
+ const defaultFillExtrusionColor: (string | number | string[])[] = [
11
+ 'interpolate',
12
+ ['linear'],
13
+ ['get', 'height'],
14
+ 0,
15
+ 'rgba(0, 0, 255, 0)',
16
+ 0.1,
17
+ 'royalblue',
18
+ 0.3,
19
+ 'cyan',
20
+ 0.5,
21
+ 'lime',
22
+ 0.7,
23
+ 'yellow',
24
+ 1,
25
+ 'yellow',
26
+ ];
27
+ /**
28
+ * MlSpatialElevationProfile returns a Button that will add a standard OSM tile layer to the maplibre-gl instance.
29
+ *
30
+ * @component
31
+ */
32
+
33
+ interface geojson {
34
+ features: Feature | FeatureCollection | undefined;
35
+ }
36
+
37
+ export interface MlSpatialElevationProfileProps {
38
+ /**
39
+ * Id of the target MapLibre instance in mapContext
40
+ */
41
+ mapId?: string;
42
+ /**
43
+ * GeoJSON data that is supposed to be rendered by this component.
44
+ */
45
+ //geojson: {features: Feature | FeatureCollection | undefined };
46
+ geojson: geojson | FeatureCollection | undefined;
47
+ /**
48
+ * Prefix of the component id this component uses when adding elements to the MapLibreGl-instance
49
+ */
50
+ idPrefix?: string;
51
+ /**
52
+ * Number describes the factor of the height of the elevation
53
+ */
54
+ elevationFactor?: number;
55
+ /**
56
+ * The layerId of an existing layer this layer should be rendered visually beneath
57
+ * https://maplibre.org/maplibre-gl-js-docs/api/map/#map#addlayer - see "beforeId" property
58
+ */
59
+ insertBeforeLayer?: string;
60
+ }
61
+
62
+ const MlSpatialElevationProfile = (props: MlSpatialElevationProfileProps) => {
63
+ const sourceName = useRef('elevationprofile-' + uuidv4());
64
+ const layerName = useRef('elevationprofile-layer-' + uuidv4());
65
+ const elevationFactor =
66
+ props.elevationFactor || MlSpatialElevationProfile.defaultProps.elevationFactor;
67
+
68
+ const _geojsonInfo = useMemo(() => {
69
+ if (!props?.geojson?.features) return;
70
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
71
+ // @ts-ignore
72
+ const line = props.geojson.features?.find((element: Feature) => {
73
+ return element.geometry.type === 'LineString';
74
+ });
75
+
76
+ if (!line || !line.geometry) return;
77
+
78
+ const heights = line.geometry.coordinates.map((coordinate: Coordinates) => {
79
+ return coordinate[2];
80
+ });
81
+
82
+ const min = Math.min(...heights);
83
+
84
+ let max = Math.max(...heights) - min;
85
+
86
+ max = max === 0 ? 1 : max;
87
+
88
+ return { max, min, line };
89
+ }, [props.geojson]);
90
+
91
+ const _fillExtrusionColor: (string | number | string[])[] = useMemo(() => {
92
+ if (!_geojsonInfo) return defaultFillExtrusionColor;
93
+
94
+ return [
95
+ 'interpolate',
96
+ ['linear'],
97
+ ['get', 'height'],
98
+ 0,
99
+ 'rgb(0,255,55)',
100
+ _geojsonInfo.max * elevationFactor,
101
+ 'rgb(255,0,0)',
102
+ ];
103
+ }, [_geojsonInfo, props.elevationFactor]);
104
+
105
+ const _geojson = useMemo(() => {
106
+ if (!props.geojson?.features || !_geojsonInfo) return;
107
+
108
+ const newData = getElevationData(_geojsonInfo, elevationFactor);
109
+ return newData;
110
+ }, [_geojsonInfo, elevationFactor]);
111
+
112
+ useSource({
113
+ mapId: props.mapId,
114
+ sourceId: sourceName.current,
115
+ source: {
116
+ type: 'geojson',
117
+ data: _geojson || featureCollection([]),
118
+ },
119
+ });
120
+
121
+ useLayer({
122
+ layerId: layerName.current,
123
+ source: sourceName.current,
124
+
125
+ options: {
126
+ type: 'fill-extrusion',
127
+ paint: {
128
+ 'fill-extrusion-height': ['get', 'height'],
129
+ 'fill-extrusion-opacity': 0.9,
130
+ 'fill-extrusion-color': (_fillExtrusionColor || defaultFillExtrusionColor) as (DataDrivenPropertyValueSpecification<string>),
131
+ },
132
+ },
133
+ insertBeforeLayer: props.insertBeforeLayer,
134
+ });
135
+
136
+ return <></>;
137
+ };
138
+
139
+ MlSpatialElevationProfile.defaultProps = {
140
+ elevationFactor: 1,
141
+ };
142
+
143
+ export default MlSpatialElevationProfile;