@mapcomponents/react-maplibre 0.1.63 → 0.1.65
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.
- package/.editorconfig +1 -1
- package/.eslintrc.js +9 -6
- package/.github/workflows/check-catalogue-metadata-schema.yml +19 -0
- package/CHANGELOG.md +37 -2
- package/coverage/clover.xml +688 -1032
- package/coverage/coverage-final.json +25 -21
- package/coverage/lcov-report/index.html +127 -82
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +24 -24
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +5 -5
- package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +2 -2
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +2 -5
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +40 -19
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx.html +112 -0
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx.html +115 -0
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +34 -4
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +2 -2
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGpxViewer/MlGpxViewer.tsx.html +394 -0
- package/coverage/lcov-report/src/components/{MlGPXViewer → MlGpxViewer}/index.html +23 -38
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +63 -285
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +21 -21
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +58 -76
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +58 -61
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +11 -11
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +30 -21
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/ColorPicker.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSketchTool/MlSketchTool.tsx.html +2 -2
- package/coverage/lcov-report/src/components/MlSketchTool/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx.html +514 -0
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +21 -21
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +20 -206
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +10 -7
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +5 -5
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +111 -57
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +19 -19
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +201 -144
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +9 -9
- package/coverage/lcov-report/src/contexts/MapContext.tsx.html +23 -23
- package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
- package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
- package/coverage/lcov-report/src/contexts/index.html +1 -1
- package/coverage/lcov-report/src/hooks/index.html +50 -50
- package/coverage/lcov-report/src/hooks/useCameraFollowPath/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx.html +1 -1
- package/coverage/lcov-report/src/hooks/useExportMap/index.html +1 -1
- package/coverage/lcov-report/src/hooks/useExportMap/index.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useExportMap/lib.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useGpx/index.html +116 -0
- package/coverage/lcov-report/src/hooks/useGpx/useGpx.tsx.html +295 -0
- package/coverage/lcov-report/src/hooks/useLayer.ts.html +132 -66
- package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayerFilter/index.html +116 -0
- package/coverage/lcov-report/src/hooks/useLayerFilter/useLayerFilter.ts.html +184 -0
- package/coverage/lcov-report/src/hooks/useLayerHoverPopup/index.html +116 -0
- package/coverage/lcov-report/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx.html +331 -0
- package/coverage/lcov-report/src/hooks/useMap.ts.html +47 -47
- package/coverage/lcov-report/src/hooks/useMapState.ts.html +54 -54
- package/coverage/lcov-report/src/hooks/useSource.ts.html +57 -57
- package/coverage/lcov-report/src/hooks/{useWms.js.html → useWms.ts.html} +54 -15
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +6 -6
- package/coverage/lcov.info +1320 -1960
- package/dist/components/MapLibreMap/lib/MapLibreGlWrapper.d.ts +51 -25
- package/dist/components/MlCenterPosition/MlCenterPosition.d.ts +3 -2
- package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +35 -16
- package/dist/components/MlComponentTemplate/MlComponentTemplate.d.ts +1 -1
- package/dist/components/MlComponentTemplate/MlComponentTemplate.stories.d.ts +12 -9
- package/dist/components/MlCreatePdfButton/MlCreatePdfButton.d.ts +1 -1
- package/dist/components/MlCreatePdfButton/MlCreatePdfButton.stories.d.ts +12 -9
- package/dist/components/MlGPXViewer/util/GeoJsonContext.d.ts +1 -1
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +22 -11
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +4 -95
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.d.ts +3 -0
- package/dist/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.d.ts +3 -0
- package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.d.ts +1 -1
- package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.stories.d.ts +12 -9
- package/dist/components/MlGpxViewer/MlGpxViewer.d.ts +30 -0
- package/dist/components/MlGpxViewer/MlGpxViewer.stories.d.ts +17 -0
- package/dist/components/MlGpxViewer/MlGpxViewer.test.d.ts +1 -0
- package/dist/components/MlGpxViewer/util/GeoJsonContext.d.ts +10 -0
- package/dist/components/MlGpxViewer/util/GeoJsonProvider.d.ts +4 -0
- package/dist/components/MlGpxViewer/util/MetadataDrawer.d.ts +7 -0
- package/dist/components/MlGpxViewer/util/MlGpxDemoLoader.d.ts +10 -0
- package/dist/components/MlGpxViewer/util/MlGpxViewerInstructions.d.ts +3 -0
- package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +11 -2
- package/dist/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.d.ts +7 -9
- package/dist/components/MlLayerMagnify/MlLayerMagnify.d.ts +8 -2
- package/dist/components/MlLayerMagnify/MlLayerMagnify.stories.d.ts +13 -9
- package/dist/components/MlLayerSwipe/MlLayerSwipe.d.ts +13 -3
- package/dist/components/MlLayerSwipe/MlLayerSwipe.stories.d.ts +12 -10
- package/dist/components/MlSketchTool/MlSketchTool.d.ts +1 -1
- package/dist/components/MlSketchTool/MlSketchTool.stories.d.ts +13 -9
- package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +33 -14
- package/dist/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.d.ts +18 -15
- package/dist/components/MlSpatialElevationProfile/util/getElevationData.d.ts +14 -0
- package/dist/components/MlThreeJsLayer/MlThreeJsLayer.stories.d.ts +20 -15
- package/dist/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +3 -67
- package/dist/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.stories.d.ts +20 -12
- package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +7 -4
- package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +17 -10
- package/dist/components/MlWmsLoader/MlWmsLoader.stories.d.ts +23 -12
- package/dist/components/MlWmsLoader/utils/MlWmsLoaderInstructions.d.ts +3 -0
- package/dist/components/MlWmsLoader/utils/WMSLinks.d.ts +6 -0
- package/dist/decorators/ThemeWrapper.d.ts +3 -1
- package/dist/hooks/useGpx/lib/gpxConverter.d.ts +11 -0
- package/dist/hooks/useGpx/useGpx.d.ts +26 -0
- package/dist/hooks/useGpx/useGpx.stories.d.ts +10 -0
- package/dist/hooks/useLayer.d.ts +13 -7
- package/dist/hooks/useLayerFilter/useLayerFilter.d.ts +8 -0
- package/dist/hooks/useLayerFilter/useLayerFilter.stories.d.ts +9 -0
- package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.d.ts +23 -0
- package/dist/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.d.ts +10 -0
- package/dist/hooks/useMap.d.ts +1 -1
- package/dist/hooks/useMap.test.d.ts +1 -0
- package/dist/hooks/useSource.d.ts +2 -2
- package/dist/hooks/useWms.d.ts +24 -16
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +9310 -14006
- package/dist/index.esm.js.map +1 -1
- package/dist/setupTests.d.ts +6 -5
- package/dist/ui_components/Dropzone.d.ts +5 -0
- package/dist/ui_components/ImageLoader.d.ts +8 -1
- package/dist/ui_components/LoadingOverlayContext.d.ts +11 -11
- package/dist/ui_components/Sidebar.d.ts +7 -6
- package/dist/ui_components/Tooltip.d.ts +1 -1
- package/dist/ui_components/TopToolbar.d.ts +4 -3
- package/dist/ui_components/UploadButton.d.ts +6 -0
- package/dist/util/BubbleForInstructions.d.ts +2 -0
- package/dist/util/Instructions.d.ts +13 -0
- package/package.json +195 -191
- package/{src/components/MlImageMarkerLayer → public}/assets/wg-marker.png +0 -0
- package/scripts/build-catalogue-meta.js +35 -11
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +230 -188
- package/src/components/MlCenterPosition/MlCenterPosition.meta_.json +1 -2
- package/src/components/MlCenterPosition/MlCenterPosition.stories.tsx +20 -0
- package/src/components/MlCenterPosition/MlCenterPosition.tsx +4 -4
- package/src/components/MlComponentTemplate/MlComponentTemplate.meta_.json +1 -2
- package/src/components/MlComponentTemplate/{MlComponentTemplate.stories.js → MlComponentTemplate.stories.tsx} +2 -2
- package/src/components/MlComponentTemplate/MlComponentTemplate.tsx +1 -1
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.meta_.json +1 -2
- package/src/components/MlCreatePdfButton/{MlCreatePdfButton.stories.js → MlCreatePdfButton.stories.tsx} +1 -1
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx +1 -1
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.meta.json +1 -2
- package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +25 -2
- package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +1 -2
- package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +0 -1
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.meta.json +1 -2
- package/src/components/MlFollowGps/MlFollowGps.meta.json +1 -2
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.meta.json +1 -2
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.tsx +89 -0
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +24 -17
- package/src/components/MlGeoJsonLayer/assets/earthquake.json +109937 -0
- package/src/components/MlGeoJsonLayer/assets/wg_locations.json +65 -0
- package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx +9 -0
- package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx +10 -0
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.meta_.json +1 -2
- package/src/components/MlGeojsonLayerWithSource/{MlGeojsonLayerWithSource.stories.js → MlGeojsonLayerWithSource.stories.tsx} +0 -0
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx +1 -1
- package/src/components/{MlGPXViewer/MlGPXViewer.doc.de.md → MlGpxViewer/MlGpxViewer.doc.de.md} +0 -0
- package/src/components/{MlGPXViewer/MlGPXViewer.doc.en.md → MlGpxViewer/MlGpxViewer.doc.en.md} +0 -0
- package/src/components/{MlGPXViewer/MlGPXViewer.meta.json → MlGpxViewer/MlGpxViewer.meta.json} +2 -3
- package/src/components/MlGpxViewer/MlGpxViewer.stories.tsx +109 -0
- package/src/components/MlGpxViewer/MlGpxViewer.test.js +53 -0
- package/src/components/MlGpxViewer/MlGpxViewer.tsx +103 -0
- package/src/components/{MlGPXViewer → MlGpxViewer}/util/GeoJsonContext.ts +0 -0
- package/src/components/{MlGPXViewer → MlGpxViewer}/util/GeoJsonProvider.tsx +0 -0
- package/src/components/MlGpxViewer/util/MetadataDrawer.tsx +38 -0
- package/src/components/MlGpxViewer/util/MlGpxDemoLoader.tsx +128 -0
- package/src/components/MlGpxViewer/util/MlGpxViewerInstructions.tsx +71 -0
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.meta_.json +1 -2
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.tsx +41 -0
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +27 -8
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx +41 -115
- package/src/components/MlLayer/MlLayer.meta_.json +1 -2
- package/src/components/MlLayerMagnify/MlLayerMagnify.meta.json +1 -2
- package/src/components/MlLayerMagnify/MlLayerMagnify.stories.tsx +44 -0
- package/src/components/MlLayerMagnify/{MlLayerMagnify.test.js → MlLayerMagnify.test.tsx} +15 -18
- package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +55 -61
- package/src/components/MlLayerSwipe/MlLayerSwipe.meta.json +1 -2
- package/src/components/MlLayerSwipe/{MlLayerSwipe.stories.js → MlLayerSwipe.stories.tsx} +9 -11
- package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +47 -48
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.meta_.json +1 -2
- package/src/components/MlLayerSwitcher/components/LayerBox.js +22 -19
- package/src/components/MlMarker/MlMarker.meta_.json +1 -2
- package/src/components/MlMeasureTool/MlMeasureTool.meta.json +1 -2
- package/src/components/MlNavigationCompass/MlNavigationCompass.meta.json +1 -2
- package/src/components/MlNavigationTools/MlNavigationTools.meta.json +1 -2
- package/src/components/MlScaleReference/MlScaleReference.meta.json +1 -2
- package/src/components/MlShareMapState/MlShareMapState.meta_.json +1 -2
- package/src/components/MlSketchTool/MlSketchTool.meta.json +1 -2
- package/src/components/MlSketchTool/{MlSketchTool.stories.js → MlSketchTool.stories.tsx} +1 -1
- package/src/components/MlSketchTool/MlSketchTool.tsx +1 -1
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.meta.json +1 -2
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.tsx +121 -0
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.test.js +30 -1
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx +143 -0
- package/src/components/MlSpatialElevationProfile/util/getElevationData.tsx +103 -0
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.meta.json +1 -2
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.stories.tsx +37 -0
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.meta.json +1 -2
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.stories.js +2 -3
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx +17 -79
- package/src/components/MlUseMapDebugger/MlUseMapDebugger.meta_.json +1 -2
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.meta.json +1 -2
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +3 -2
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.meta_.json +1 -2
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.stories.tsx +22 -0
- package/src/components/MlWmsLayer/MlWmsLayer.tsx +59 -41
- package/src/components/MlWmsLoader/MlWmsLoader.meta.json +1 -2
- package/src/components/MlWmsLoader/MlWmsLoader.stories.tsx +89 -0
- package/src/components/MlWmsLoader/MlWmsLoader.tsx +141 -122
- package/src/components/MlWmsLoader/utils/MlWmsLoaderInstructions.tsx +50 -0
- package/src/components/MlWmsLoader/utils/WMSLinks.tsx +128 -0
- package/src/decorators/MapContextDecorator.js +1 -1
- package/src/decorators/MapContextDecoratorHooks.js +1 -1
- package/src/decorators/ThemeWrapper.tsx +9 -0
- package/src/hooks/useCameraFollowPath/useCameraFollowPath.meta.json +1 -2
- package/src/{components/MlGPXViewer → hooks/useGpx/lib}/gpxConverter.js +1 -0
- package/src/hooks/useGpx/useGpx.doc.de.md +3 -0
- package/src/hooks/useGpx/useGpx.meta_.json +15 -0
- package/src/{components/MlLayer/MlLayer.stories.js → hooks/useGpx/useGpx.stories.js} +4 -4
- package/src/hooks/useGpx/useGpx.tsx +70 -0
- package/src/hooks/useLayer.ts +32 -10
- package/src/hooks/useLayerFilter/useLayerFilter.doc.de.md +3 -0
- package/src/hooks/useLayerFilter/useLayerFilter.meta_.json +14 -0
- package/src/hooks/useLayerFilter/useLayerFilter.stories.tsx +40 -0
- package/src/hooks/useLayerFilter/useLayerFilter.ts +33 -0
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.doc.de.md +3 -0
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.meta_.json +15 -0
- package/src/{components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.stories.js → hooks/useLayerHoverPopup/useLayerHoverPopup.stories.js} +4 -6
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx +82 -0
- package/src/hooks/useMap.test.tsx +48 -0
- package/src/hooks/useMap.ts +8 -8
- package/src/hooks/useSource.ts +4 -4
- package/src/hooks/{useWms.js → useWms.ts} +24 -11
- package/src/index.ts +5 -5
- package/src/setupTests.js +18 -15
- package/src/ui_components/Dropzone.tsx +104 -0
- package/src/ui_components/{ImageLoader.js → ImageLoader.tsx} +30 -25
- package/src/ui_components/{LoadingOverlayContext.js → LoadingOverlayContext.tsx} +12 -15
- package/src/ui_components/Sidebar.tsx +12 -10
- package/src/ui_components/Tooltip.tsx +17 -0
- package/src/ui_components/TopToolbar.tsx +5 -3
- package/src/ui_components/UploadButton.tsx +57 -0
- package/src/util/BubbleForInstructions.js +46 -0
- package/src/util/Instructions.tsx +60 -0
- package/tsconfig.json +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.tsx.html +0 -1222
- package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +0 -1645
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +0 -757
- package/dist/components/MlGPXViewer/util/MlGPXViewerInstructions.d.ts +0 -1
- package/dist/components/MlGPXViewer/util/SampleLayer.d.ts +0 -0
- package/dist/components/MlGPXViewer/util/demoViewer.d.ts +0 -5
- package/src/components/MlCenterPosition/MlCenterPosition.stories.js +0 -21
- package/src/components/MlGPXViewer/MlGPXViewer.stories.js +0 -91
- package/src/components/MlGPXViewer/MlGPXViewer.test.js +0 -28
- package/src/components/MlGPXViewer/MlGPXViewer.tsx +0 -379
- package/src/components/MlGPXViewer/util/MlGPXViewerInstructions.js +0 -145
- package/src/components/MlGPXViewer/util/SampleLayer.js +0 -2
- package/src/components/MlGPXViewer/util/demoViewer.js +0 -254
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.js +0 -45
- package/src/components/MlLayerMagnify/MlLayerMagnify.stories.js +0 -41
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js +0 -224
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +0 -57
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.stories.js +0 -39
- package/src/components/MlWmsLoader/MlWmsLoader.stories.js +0 -47
- package/src/decorators/ThemeWrapper.jsx +0 -9
- package/src/ui_components/Legend.js +0 -44
- package/src/ui_components/LoadingOverlay.js +0 -41
- package/src/ui_components/Tooltip.js +0 -21
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function MlGPXViewerInstructions(props: any): JSX.Element;
|
|
File without changes
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import MlCenterPosition from "./MlCenterPosition";
|
|
4
|
-
|
|
5
|
-
import mapContextDecorator from "../../decorators/MapContextDecorator";
|
|
6
|
-
|
|
7
|
-
const storyoptions = {
|
|
8
|
-
title: "MapComponents/MlCenterPosition",
|
|
9
|
-
component: MlCenterPosition,
|
|
10
|
-
argTypes: {
|
|
11
|
-
},
|
|
12
|
-
decorators: mapContextDecorator,
|
|
13
|
-
parameters: { docs: { source: { type: 'code' } } }
|
|
14
|
-
};
|
|
15
|
-
export default storyoptions;
|
|
16
|
-
|
|
17
|
-
const Template = (args) => <MlCenterPosition />;
|
|
18
|
-
|
|
19
|
-
export const ExampleConfig = Template.bind({});
|
|
20
|
-
ExampleConfig.parameters = {};
|
|
21
|
-
ExampleConfig.args = {};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import MlGPXViewer from './MlGPXViewer';
|
|
3
|
-
import mapContextDecorator from '../../decorators/MapContextDecorator';
|
|
4
|
-
import GeoJsonProvider from './util/GeoJsonProvider';
|
|
5
|
-
import MlGPXViewerInstructions from './util/MlGPXViewerInstructions';
|
|
6
|
-
import TopToolbar from '../../ui_components/TopToolbar';
|
|
7
|
-
import { Button, IconButton } from '@mui/material';
|
|
8
|
-
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
9
|
-
import MlGPXDemoLoader from './util/demoViewer';
|
|
10
|
-
import FileDownloadIcon from '@mui/icons-material/FileDownload';
|
|
11
|
-
|
|
12
|
-
const storyoptions = {
|
|
13
|
-
title: 'MapComponents/MlGPXViewer',
|
|
14
|
-
component: MlGPXViewer,
|
|
15
|
-
argTypes: {
|
|
16
|
-
options: {
|
|
17
|
-
control: {
|
|
18
|
-
type: 'object',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
decorators: mapContextDecorator,
|
|
23
|
-
};
|
|
24
|
-
export default storyoptions;
|
|
25
|
-
|
|
26
|
-
const Template = () => {
|
|
27
|
-
const mediaIsMobile = useMediaQuery('(max-width:900px)');
|
|
28
|
-
const [demoMode, setDemoMode] = useState(false);
|
|
29
|
-
const [guide, setGuide] = useState(false);
|
|
30
|
-
|
|
31
|
-
const handleClick1 = () => {
|
|
32
|
-
setDemoMode(!demoMode);
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
const handleClick2 = ()=>{
|
|
36
|
-
setGuide(true);
|
|
37
|
-
setTimeout(()=>{
|
|
38
|
-
setGuide(false)
|
|
39
|
-
}, 9000);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const textColor = () =>{
|
|
43
|
-
if(demoMode){
|
|
44
|
-
return "white"
|
|
45
|
-
} else {
|
|
46
|
-
return "steelblue"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const textColor2 = () =>{
|
|
51
|
-
if(guide){
|
|
52
|
-
return "white"
|
|
53
|
-
} else {
|
|
54
|
-
return "steelblue"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<>
|
|
60
|
-
<TopToolbar>
|
|
61
|
-
<MlGPXViewerInstructions open={guide} />
|
|
62
|
-
<Button variant="contained" onClick={handleClick2} color={guide ? "primary" : "inherit"} sx={{ color: textColor2, marginRight: '10px' }}> Guide me through</Button>
|
|
63
|
-
<Button variant="contained" onClick={handleClick1} color={demoMode ? "primary" : "inherit"} sx={{ color: textColor }}>
|
|
64
|
-
Demo Mode
|
|
65
|
-
</Button>
|
|
66
|
-
</TopToolbar>
|
|
67
|
-
<IconButton
|
|
68
|
-
style={{
|
|
69
|
-
position: 'absolute',
|
|
70
|
-
right: '5px',
|
|
71
|
-
bottom: mediaIsMobile ? '145px' : '130px',
|
|
72
|
-
backgroundColor: 'rgba(255,255,255,1)',
|
|
73
|
-
zIndex: 1000,
|
|
74
|
-
}}
|
|
75
|
-
title="Download sample-data"
|
|
76
|
-
size="large"
|
|
77
|
-
href="assets/sample.gpx"
|
|
78
|
-
target="blank"
|
|
79
|
-
>
|
|
80
|
-
<FileDownloadIcon />
|
|
81
|
-
</IconButton>
|
|
82
|
-
<GeoJsonProvider>
|
|
83
|
-
<MlGPXDemoLoader enabled={demoMode} />
|
|
84
|
-
<MlGPXViewer />
|
|
85
|
-
</GeoJsonProvider>
|
|
86
|
-
</>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export const ExampleConfig = Template.bind({});
|
|
91
|
-
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,379 +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
|
-
|
|
282
|
-
|
|
283
|
-
return (
|
|
284
|
-
<>
|
|
285
|
-
<div
|
|
286
|
-
style={{
|
|
287
|
-
position: "fixed",
|
|
288
|
-
right: "5px",
|
|
289
|
-
bottom: mediaIsMobile ? "40px" : "25px",
|
|
290
|
-
display: "flex",
|
|
291
|
-
flexDirection: "column",
|
|
292
|
-
gap: "5px",
|
|
293
|
-
zIndex: 1000,
|
|
294
|
-
}}
|
|
295
|
-
>
|
|
296
|
-
<IconButton
|
|
297
|
-
onClick={manualUpload}
|
|
298
|
-
style={{
|
|
299
|
-
backgroundColor: "rgba(255,255,255,1)",
|
|
300
|
-
}}
|
|
301
|
-
size="large"
|
|
302
|
-
>
|
|
303
|
-
<input
|
|
304
|
-
ref={fileupload}
|
|
305
|
-
onChange={fileUploadOnChange}
|
|
306
|
-
type="file"
|
|
307
|
-
id="input"
|
|
308
|
-
multiple
|
|
309
|
-
style={{ display: "none" }}
|
|
310
|
-
></input>
|
|
311
|
-
<FileCopy />
|
|
312
|
-
</IconButton>
|
|
313
|
-
<IconButton
|
|
314
|
-
onClick={toogleDrawer}
|
|
315
|
-
style={{
|
|
316
|
-
backgroundColor: "rgba(255,255,255,1)",
|
|
317
|
-
}}
|
|
318
|
-
size="large"
|
|
319
|
-
>
|
|
320
|
-
<InfoIcon />
|
|
321
|
-
</IconButton>
|
|
322
|
-
</div>
|
|
323
|
-
<Drawer variant="persistent" anchor="left" open={open}>
|
|
324
|
-
<Typography
|
|
325
|
-
variant="h6"
|
|
326
|
-
style={{
|
|
327
|
-
textAlign: "center",
|
|
328
|
-
padding: "1em",
|
|
329
|
-
}}
|
|
330
|
-
noWrap
|
|
331
|
-
>
|
|
332
|
-
Informationen zur Route
|
|
333
|
-
</Typography>
|
|
334
|
-
<Divider />
|
|
335
|
-
<List>
|
|
336
|
-
{metaData.map((item) => (
|
|
337
|
-
<ListItem key={`item--${item.id}`}>
|
|
338
|
-
<ListItemText primary={item.value} />
|
|
339
|
-
</ListItem>
|
|
340
|
-
))}
|
|
341
|
-
</List>
|
|
342
|
-
</Drawer>
|
|
343
|
-
<div
|
|
344
|
-
onDrop={dropHandler}
|
|
345
|
-
ref={dropZone}
|
|
346
|
-
style={{
|
|
347
|
-
position: "absolute",
|
|
348
|
-
left: "0",
|
|
349
|
-
top: "0",
|
|
350
|
-
backgroundColor: "rgba(255,255,255,0.5)",
|
|
351
|
-
width: "100%",
|
|
352
|
-
height: "100%",
|
|
353
|
-
zIndex: zIndex,
|
|
354
|
-
}}
|
|
355
|
-
>
|
|
356
|
-
<Typography
|
|
357
|
-
variant="h6"
|
|
358
|
-
style={{
|
|
359
|
-
top: "50%",
|
|
360
|
-
position: "absolute",
|
|
361
|
-
left: "50%",
|
|
362
|
-
msTransform: "translate(-50%, -50%)",
|
|
363
|
-
transform: " translate(-50%, -50%)",
|
|
364
|
-
}}
|
|
365
|
-
noWrap
|
|
366
|
-
>
|
|
367
|
-
Gpx-Datei ablegen
|
|
368
|
-
</Typography>
|
|
369
|
-
</div>
|
|
370
|
-
</>
|
|
371
|
-
);
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
MlGPXViewer.defaultProps = {
|
|
375
|
-
visible: true,
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
export default MlGPXViewer;
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Grid } from '@mui/material';
|
|
3
|
-
import ReplyAllIcon from '@mui/icons-material/ReplyAll';
|
|
4
|
-
import Fade from '@mui/material/Fade';
|
|
5
|
-
|
|
6
|
-
const divStyle = {
|
|
7
|
-
width: 450,
|
|
8
|
-
height: 450,
|
|
9
|
-
position: 'fixed',
|
|
10
|
-
//right: '5px',
|
|
11
|
-
//bottom: '25px',
|
|
12
|
-
display: 'block',
|
|
13
|
-
flexDirection: 'column',
|
|
14
|
-
gap: '5px',
|
|
15
|
-
zIndex: 900,
|
|
16
|
-
borderRadius: 360,
|
|
17
|
-
right: -120,
|
|
18
|
-
bottom: -120,
|
|
19
|
-
backgroundColor: 'steelblue',
|
|
20
|
-
alignItems: 'center',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default function MlGPXViewerInstructions(props) {
|
|
24
|
-
const [step1, setStep1] = useState(false);
|
|
25
|
-
const [step2, setStep2] = useState(false);
|
|
26
|
-
const [step3, setStep3] = useState(false);
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (props.open) {
|
|
30
|
-
setStep1(true);
|
|
31
|
-
|
|
32
|
-
setTimeout(() => {
|
|
33
|
-
setStep2(true);
|
|
34
|
-
setStep1(false);
|
|
35
|
-
}, 2500);
|
|
36
|
-
setTimeout(() => {
|
|
37
|
-
setStep3(true);
|
|
38
|
-
}, 5000);
|
|
39
|
-
|
|
40
|
-
setTimeout(() => {
|
|
41
|
-
setStep2(false);
|
|
42
|
-
}, 5000);
|
|
43
|
-
setTimeout(() => {
|
|
44
|
-
setStep3(false);
|
|
45
|
-
props.callback(false);
|
|
46
|
-
}, 9000);
|
|
47
|
-
} else {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
}, [props.open]);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<>
|
|
54
|
-
{step1 && (
|
|
55
|
-
<Fade in={step1} timeout={150}>
|
|
56
|
-
<div style={divStyle} >
|
|
57
|
-
<h2 style={{ marginTop: 100, marginLeft: 100, color: 'white', textAlign: 'left' }}>
|
|
58
|
-
You can load your <br />
|
|
59
|
-
own GPX file <br /> here
|
|
60
|
-
</h2>
|
|
61
|
-
<ReplyAllIcon
|
|
62
|
-
sx={{
|
|
63
|
-
color: 'white',
|
|
64
|
-
fontSize: 80,
|
|
65
|
-
transform: 'rotate(180deg)',
|
|
66
|
-
marginTop: -3,
|
|
67
|
-
marginLeft: 22,
|
|
68
|
-
}}
|
|
69
|
-
/>
|
|
70
|
-
</div>
|
|
71
|
-
</Fade>
|
|
72
|
-
)}
|
|
73
|
-
|
|
74
|
-
{step2 && (
|
|
75
|
-
<Fade in={step2} timeout={150}>
|
|
76
|
-
<div style={divStyle}>
|
|
77
|
-
<Grid>
|
|
78
|
-
<h2 style={{ marginTop: 100, marginLeft: 100, color: 'white', textAlign: 'left' }}>
|
|
79
|
-
You can see more <br /> information about <br />
|
|
80
|
-
the track <br />
|
|
81
|
-
here
|
|
82
|
-
</h2>
|
|
83
|
-
</Grid>
|
|
84
|
-
|
|
85
|
-
<Grid>
|
|
86
|
-
<ReplyAllIcon
|
|
87
|
-
sx={{
|
|
88
|
-
color: 'white',
|
|
89
|
-
fontSize: 80,
|
|
90
|
-
transform: 'rotate(180deg)',
|
|
91
|
-
marginTop: 1,
|
|
92
|
-
marginLeft: 22,
|
|
93
|
-
}}
|
|
94
|
-
/>
|
|
95
|
-
</Grid>
|
|
96
|
-
</div>
|
|
97
|
-
</Fade>
|
|
98
|
-
)}
|
|
99
|
-
{step3 && (
|
|
100
|
-
<Fade in={step3} timeout={1500}>
|
|
101
|
-
<div
|
|
102
|
-
style={{
|
|
103
|
-
width: 450,
|
|
104
|
-
height: 450,
|
|
105
|
-
position: 'fixed',
|
|
106
|
-
//left: '5px',
|
|
107
|
-
//top: '25px',
|
|
108
|
-
display: 'block',
|
|
109
|
-
flexDirection: 'column',
|
|
110
|
-
gap: '5px',
|
|
111
|
-
//zIndex: 500,
|
|
112
|
-
borderRadius: 360,
|
|
113
|
-
left: -40,
|
|
114
|
-
top: -150,
|
|
115
|
-
backgroundColor: 'steelblue',
|
|
116
|
-
opacity: 1,
|
|
117
|
-
alignItems: 'center',
|
|
118
|
-
transition:'ease-in',
|
|
119
|
-
transitionProperty:'opacity',
|
|
120
|
-
|
|
121
|
-
}}
|
|
122
|
-
>
|
|
123
|
-
<Grid>
|
|
124
|
-
<h2 style={{ marginTop: 230, marginRight: 190, color: 'white', textAlign: 'right' }}>
|
|
125
|
-
In demo mode we <br /> provide you some <br /> GPX tracks <br /> to load.
|
|
126
|
-
</h2>
|
|
127
|
-
</Grid>
|
|
128
|
-
<Grid>
|
|
129
|
-
<ReplyAllIcon
|
|
130
|
-
sx={{
|
|
131
|
-
color: 'white',
|
|
132
|
-
fontSize: 80,
|
|
133
|
-
position: 'absolute',
|
|
134
|
-
transform: 'rotate(90deg)',
|
|
135
|
-
marginTop: -18,
|
|
136
|
-
marginLeft: 35,
|
|
137
|
-
}}
|
|
138
|
-
/>
|
|
139
|
-
</Grid>
|
|
140
|
-
</div>
|
|
141
|
-
</Fade>
|
|
142
|
-
)}
|
|
143
|
-
</>
|
|
144
|
-
);
|
|
145
|
-
}
|