@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.
- package/.editorconfig +1 -1
- package/.eslintrc.js +9 -6
- package/.github/workflows/check-catalogue-metadata-schema.yml +19 -0
- package/CHANGELOG.md +27 -2
- package/coverage/clover.xml +671 -1032
- package/coverage/coverage-final.json +24 -21
- package/coverage/lcov-report/index.html +112 -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 +1 -1
- 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 +1 -1
- 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/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 +1284 -1959
- 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/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/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/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +3 -67
- 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/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/{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 +68 -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/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/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/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/MlCenterPosition/MlCenterPosition.stories.js → hooks/useGpx/useGpx.stories.js} +4 -5
- package/src/hooks/useGpx/useGpx.tsx +70 -0
- package/src/hooks/useLayer.ts +32 -10
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.doc.de.md +3 -0
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.meta_.json +15 -0
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.js +20 -0
- 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/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/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
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "FeatureCollection",
|
|
3
|
+
"features": [
|
|
4
|
+
{
|
|
5
|
+
"id": "1",
|
|
6
|
+
"type": "Feature",
|
|
7
|
+
"properties": {
|
|
8
|
+
"Standort": "Bonn",
|
|
9
|
+
"Mitarbeitende": 26
|
|
10
|
+
},
|
|
11
|
+
"geometry": {
|
|
12
|
+
"coordinates": [
|
|
13
|
+
7.085121767634178,
|
|
14
|
+
50.738628929850876
|
|
15
|
+
],
|
|
16
|
+
"type": "Point"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "2",
|
|
21
|
+
"type": "Feature",
|
|
22
|
+
"properties": {
|
|
23
|
+
"Standort": "Freiburg",
|
|
24
|
+
"Mitarbeitende": 10
|
|
25
|
+
},
|
|
26
|
+
"geometry": {
|
|
27
|
+
"coordinates": [
|
|
28
|
+
7.842759788570362,
|
|
29
|
+
47.98905444717667
|
|
30
|
+
],
|
|
31
|
+
"type": "Point"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "3",
|
|
36
|
+
"type": "Feature",
|
|
37
|
+
"properties": {
|
|
38
|
+
"Standort": "Berlin",
|
|
39
|
+
"Mitarbeitende": 13
|
|
40
|
+
},
|
|
41
|
+
"geometry": {
|
|
42
|
+
"coordinates": [
|
|
43
|
+
13.330420447460796,
|
|
44
|
+
52.492768290796676
|
|
45
|
+
],
|
|
46
|
+
"type": "Point"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "4",
|
|
51
|
+
"type": "Feature",
|
|
52
|
+
"properties": {
|
|
53
|
+
"Standort": "Hamburg",
|
|
54
|
+
"Mitarbeitende": 3
|
|
55
|
+
},
|
|
56
|
+
"geometry": {
|
|
57
|
+
"coordinates": [
|
|
58
|
+
10.041789021808029,
|
|
59
|
+
53.5511363175323
|
|
60
|
+
],
|
|
61
|
+
"type": "Point"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MlGeoJsonLayer from '../MlGeoJsonLayer';
|
|
3
|
+
import { MlGeoJsonLayerProps } from '../MlGeoJsonLayer';
|
|
4
|
+
|
|
5
|
+
const CircleMapStyler = (props: MlGeoJsonLayerProps) => {
|
|
6
|
+
return <MlGeoJsonLayer {...props} />;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default CircleMapStyler;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MlGeoJsonLayer from '../MlGeoJsonLayer';
|
|
3
|
+
import { MlGeoJsonLayerProps } from '../MlGeoJsonLayer';
|
|
4
|
+
|
|
5
|
+
const HeatMapStyler = (props: MlGeoJsonLayerProps) => {
|
|
6
|
+
|
|
7
|
+
return <MlGeoJsonLayer {...props} />;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default HeatMapStyler;
|
package/src/components/{MlGPXViewer/MlGPXViewer.doc.de.md → MlGpxViewer/MlGpxViewer.doc.de.md}
RENAMED
|
File without changes
|
package/src/components/{MlGPXViewer/MlGPXViewer.doc.en.md → MlGpxViewer/MlGpxViewer.doc.en.md}
RENAMED
|
File without changes
|
package/src/components/{MlGPXViewer/MlGPXViewer.meta.json → MlGpxViewer/MlGpxViewer.meta.json}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "MlGpxViewer",
|
|
3
3
|
"title": "GPX viewer",
|
|
4
4
|
"description": "",
|
|
5
5
|
"i18n": {
|
|
@@ -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,109 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import MlGpxViewer from './MlGpxViewer';
|
|
3
|
+
import mapContextDecorator from '../../decorators/MapContextDecorator';
|
|
4
|
+
import MlGpxViewerInstructions from './util/MlGpxViewerInstructions';
|
|
5
|
+
import TopToolbar from '../../ui_components/TopToolbar';
|
|
6
|
+
import { Button, IconButton } from '@mui/material';
|
|
7
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
8
|
+
import MlGpxDemoLoader from './util/MlGpxDemoLoader';
|
|
9
|
+
import FileCopy from '@mui/icons-material/FileCopy';
|
|
10
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
11
|
+
import Dropzone from '../../ui_components/Dropzone';
|
|
12
|
+
import UploadButton from '../../ui_components/UploadButton';
|
|
13
|
+
import MetadataDrawer from './util/MetadataDrawer';
|
|
14
|
+
import { MetadataType } from '../../hooks/useGpx/useGpx';
|
|
15
|
+
|
|
16
|
+
const storyoptions = {
|
|
17
|
+
title: 'MapComponents/MlGpxViewer',
|
|
18
|
+
component: MlGpxViewer,
|
|
19
|
+
argTypes: {
|
|
20
|
+
options: {
|
|
21
|
+
control: {
|
|
22
|
+
type: 'object',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
decorators: mapContextDecorator,
|
|
27
|
+
};
|
|
28
|
+
export default storyoptions;
|
|
29
|
+
|
|
30
|
+
const Template = () => {
|
|
31
|
+
const [gpxData, setGpxData] = useState<string | ArrayBuffer | undefined>();
|
|
32
|
+
const mediaIsMobile = useMediaQuery('(max-width:900px)');
|
|
33
|
+
const [demoLoaderOpen, setDemoLoaderOpen] = useState(false);
|
|
34
|
+
const [guide, setGuide] = useState(false);
|
|
35
|
+
const [metadataDrawerOpen, setMetadataDrawerOpen] = useState(false);
|
|
36
|
+
const [metadata, setMetadata] = useState<MetadataType[]>([]);
|
|
37
|
+
|
|
38
|
+
const handleClick1 = () => {
|
|
39
|
+
setDemoLoaderOpen(!demoLoaderOpen);
|
|
40
|
+
};
|
|
41
|
+
const handleClick2 = () => {
|
|
42
|
+
setGuide(true);
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
setGuide(false);
|
|
45
|
+
}, 9000);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
<MlGpxViewerInstructions open={guide} />
|
|
51
|
+
<MlGpxDemoLoader open={demoLoaderOpen} setOpen={setDemoLoaderOpen} setGpx={setGpxData} />
|
|
52
|
+
<TopToolbar appBarStyle={{ zIndex: 500 }}>
|
|
53
|
+
<Button variant="contained" onClick={handleClick2} sx={{ marginRight: '10px' }}>
|
|
54
|
+
Guide me through
|
|
55
|
+
</Button>
|
|
56
|
+
<Button variant="contained" onClick={handleClick1}>
|
|
57
|
+
Demo Mode
|
|
58
|
+
</Button>
|
|
59
|
+
</TopToolbar>
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
<div
|
|
63
|
+
style={{
|
|
64
|
+
position: 'fixed',
|
|
65
|
+
right: '5px',
|
|
66
|
+
bottom: mediaIsMobile ? '40px' : '25px',
|
|
67
|
+
display: 'flex',
|
|
68
|
+
flexDirection: 'column',
|
|
69
|
+
gap: '5px',
|
|
70
|
+
zIndex: 1000,
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
<UploadButton
|
|
74
|
+
setData={setGpxData}
|
|
75
|
+
buttonComponent={
|
|
76
|
+
<IconButton
|
|
77
|
+
style={{
|
|
78
|
+
backgroundColor: 'rgba(255,255,255,1)',
|
|
79
|
+
}}
|
|
80
|
+
size="large"
|
|
81
|
+
>
|
|
82
|
+
<FileCopy />
|
|
83
|
+
</IconButton>
|
|
84
|
+
}
|
|
85
|
+
/>
|
|
86
|
+
<IconButton
|
|
87
|
+
onClick={() => {
|
|
88
|
+
setMetadataDrawerOpen((prevState) => !prevState);
|
|
89
|
+
}}
|
|
90
|
+
style={{
|
|
91
|
+
backgroundColor: 'rgba(255,255,255,1)',
|
|
92
|
+
}}
|
|
93
|
+
size="large"
|
|
94
|
+
>
|
|
95
|
+
<InfoIcon />
|
|
96
|
+
</IconButton>
|
|
97
|
+
</div>
|
|
98
|
+
<MetadataDrawer metadata={metadata} open={metadataDrawerOpen} />
|
|
99
|
+
<Dropzone setData={(data) => setGpxData(data)} />
|
|
100
|
+
<MlGpxViewer
|
|
101
|
+
gpxData={gpxData as string | undefined}
|
|
102
|
+
onParseGpxData={(parsedGpx) => setMetadata(parsedGpx.metadata ? parsedGpx.metadata : [])}
|
|
103
|
+
/>
|
|
104
|
+
</>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const ExampleConfig = Template.bind({});
|
|
109
|
+
ExampleConfig.parameters = {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { layerRemovalTest, sourceRemovalTest } from '../../util';
|
|
2
|
+
|
|
3
|
+
import MlGpxViewer from './MlGpxViewer';
|
|
4
|
+
import { uuid_regex } from '../../setupTests';
|
|
5
|
+
|
|
6
|
+
const gpxSample = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
7
|
+
<gpx version="1.1" creator="outdooractive - http://www.outdooractive.com" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" xmlns:oa="http://www.outdooractive.com/GPX/Extensions/1">
|
|
8
|
+
<metadata>
|
|
9
|
+
<name>Traumpfad Bergheidenweg</name>
|
|
10
|
+
<author>
|
|
11
|
+
<name>Nicole Pfeifer - Rhein-Mosel-Eifel-Touristik</name>
|
|
12
|
+
</author>
|
|
13
|
+
<link href="https://www.outdooractive.com/r/1386783"/>
|
|
14
|
+
<time>2021-04-08T13:53:11.658</time>
|
|
15
|
+
<extensions>
|
|
16
|
+
<oa:oaCategory>hikingTourTrail</oa:oaCategory>
|
|
17
|
+
</extensions>
|
|
18
|
+
</metadata>
|
|
19
|
+
<wpt lon="7.07093" lat="50.369418">
|
|
20
|
+
<ele>423</ele>
|
|
21
|
+
<name>HausAcht - Tagungs- und Freizeithaus</name>
|
|
22
|
+
<desc></desc>
|
|
23
|
+
<src>feratel-eifel.21430.e4c23207-9b3e-47bc-a359-730147d57644</src>
|
|
24
|
+
<link href="https://www.HausAcht.de"/>
|
|
25
|
+
<type>Ferienwohnung</type>
|
|
26
|
+
</wpt>
|
|
27
|
+
</gpx>`;
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line react/react-in-jsx-scope
|
|
30
|
+
const testComponent = <MlGpxViewer gpxData={gpxSample} />;
|
|
31
|
+
|
|
32
|
+
let sourceTestParams = [
|
|
33
|
+
'<MlGpxViewer />',
|
|
34
|
+
testComponent,
|
|
35
|
+
new RegExp('^.*"gpx-viewer-source-' + uuid_regex + '".*$'),
|
|
36
|
+
'gpx-viewer-source',
|
|
37
|
+
];
|
|
38
|
+
let layer1TestParams = [
|
|
39
|
+
'<MlGpxViewer />',
|
|
40
|
+
testComponent,
|
|
41
|
+
new RegExp('^.*"importer-layer-lines-' + uuid_regex + '".*$'),
|
|
42
|
+
'importer-layer-lines',
|
|
43
|
+
];
|
|
44
|
+
let layer2TestParams = [
|
|
45
|
+
'<MlGpxViewer />',
|
|
46
|
+
testComponent,
|
|
47
|
+
new RegExp('^.*"importer-layer-points-' + uuid_regex + '".*$'),
|
|
48
|
+
'importer-layer-points',
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
layerRemovalTest(...layer1TestParams);
|
|
52
|
+
layerRemovalTest(...layer2TestParams);
|
|
53
|
+
sourceRemovalTest(...sourceTestParams);
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { bbox, featureCollection, FeatureCollection } from '@turf/turf';
|
|
3
|
+
import { LngLatBoundsLike } from 'maplibre-gl';
|
|
4
|
+
import useMap from '../../hooks/useMap';
|
|
5
|
+
import useGpx, { MetadataType } from '../../hooks/useGpx/useGpx';
|
|
6
|
+
import useLayerHoverPopup from '../../hooks/useLayerHoverPopup/useLayerHoverPopup';
|
|
7
|
+
import useSource from '../../hooks/useSource';
|
|
8
|
+
import useLayer from '../../hooks/useLayer';
|
|
9
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
10
|
+
|
|
11
|
+
export interface MlGpxViewerProps {
|
|
12
|
+
/**
|
|
13
|
+
* Id of the target MapLibre instance in mapHook
|
|
14
|
+
*/
|
|
15
|
+
mapId?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The layerId of an existing layer this layer should be rendered visually beneath
|
|
18
|
+
* https://maplibre.org/maplibre-gl-js-docs/api/map/#map#addlayer - see "beforeId" property
|
|
19
|
+
*/
|
|
20
|
+
insertBeforeLayer?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Prefix of the component id this component uses when adding elements to the MapLibreGl-instance
|
|
23
|
+
*/
|
|
24
|
+
idPrefix?: string;
|
|
25
|
+
gpxData: string | undefined;
|
|
26
|
+
onParseGpxData: (arg0: {
|
|
27
|
+
geojson: FeatureCollection | undefined;
|
|
28
|
+
metadata: MetadataType[];
|
|
29
|
+
}) => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* MlGpxViewer visualizes a given GPX Track on the map
|
|
34
|
+
*/
|
|
35
|
+
const MlGpxViewer = (props: MlGpxViewerProps) => {
|
|
36
|
+
const parsedGpx = useGpx({ data: props.gpxData });
|
|
37
|
+
const mapHook = useMap({ mapId: props.mapId, waitForLayer: props.insertBeforeLayer });
|
|
38
|
+
const sourceName = useRef('gpx-viewer-source-' + uuidv4());
|
|
39
|
+
const layerNameLines = useRef('importer-layer-lines-' + uuidv4());
|
|
40
|
+
const layerNamePoints = useRef('importer-layer-points-' + uuidv4());
|
|
41
|
+
|
|
42
|
+
useLayerHoverPopup({
|
|
43
|
+
layerId: layerNamePoints.current,
|
|
44
|
+
getPopupContent: (feature) => feature?.properties?.name,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
useSource({
|
|
48
|
+
mapId: props.mapId,
|
|
49
|
+
sourceId: sourceName.current,
|
|
50
|
+
source: {
|
|
51
|
+
type: 'geojson',
|
|
52
|
+
data: parsedGpx.geojson || featureCollection([]),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
useLayer({
|
|
57
|
+
layerId: layerNameLines.current,
|
|
58
|
+
source: sourceName.current,
|
|
59
|
+
options: {
|
|
60
|
+
type: 'line',
|
|
61
|
+
paint: {
|
|
62
|
+
'line-width': 4,
|
|
63
|
+
'line-color': 'rgba(212, 55, 23,0.5)',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
insertBeforeLayer: props.insertBeforeLayer,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
useLayer({
|
|
70
|
+
layerId: layerNamePoints.current,
|
|
71
|
+
source: sourceName.current,
|
|
72
|
+
options: {
|
|
73
|
+
type: 'circle',
|
|
74
|
+
paint: {
|
|
75
|
+
'circle-color': 'rgba(72, 77, 99,0.5)',
|
|
76
|
+
'circle-radius': 7,
|
|
77
|
+
},
|
|
78
|
+
filter: ['==', '$type', 'Point'],
|
|
79
|
+
},
|
|
80
|
+
insertBeforeLayer: props.insertBeforeLayer,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
|
|
85
|
+
if (!mapHook.map || !parsedGpx.geojson) return;
|
|
86
|
+
|
|
87
|
+
if (typeof props.onParseGpxData === 'function') {
|
|
88
|
+
props.onParseGpxData(parsedGpx);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// fit map view to GeoJSON bbox
|
|
92
|
+
|
|
93
|
+
const bounds = bbox(parsedGpx.geojson);
|
|
94
|
+
mapHook.map.map.fitBounds(bounds as LngLatBoundsLike);
|
|
95
|
+
|
|
96
|
+
}, [parsedGpx]);
|
|
97
|
+
|
|
98
|
+
return <></>;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
MlGpxViewer.defaultProps = {};
|
|
102
|
+
|
|
103
|
+
export default MlGpxViewer;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Divider from '@mui/material/Divider';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import Drawer from '@mui/material/Drawer';
|
|
5
|
+
import List from '@mui/material/List';
|
|
6
|
+
import ListItem from '@mui/material/ListItem';
|
|
7
|
+
import ListItemText from '@mui/material/ListItemText';
|
|
8
|
+
import { MetadataType } from '../../../hooks/useGpx/useGpx';
|
|
9
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
metadata: MetadataType[];
|
|
12
|
+
open: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function MetadataDrawer(props: Props) {
|
|
16
|
+
return (
|
|
17
|
+
<Drawer variant="persistent" anchor="left" open={props.open}>
|
|
18
|
+
<Typography
|
|
19
|
+
variant="h6"
|
|
20
|
+
style={{
|
|
21
|
+
textAlign: 'center',
|
|
22
|
+
padding: '1em',
|
|
23
|
+
}}
|
|
24
|
+
noWrap
|
|
25
|
+
>
|
|
26
|
+
Informationen zur Route
|
|
27
|
+
</Typography>
|
|
28
|
+
<Divider />
|
|
29
|
+
<List>
|
|
30
|
+
{props.metadata?.length && props.metadata.map((item, idx) => (
|
|
31
|
+
<ListItem key={`item--${idx}`}>
|
|
32
|
+
<ListItemText primary={item.value} />
|
|
33
|
+
</ListItem>
|
|
34
|
+
))}
|
|
35
|
+
</List>
|
|
36
|
+
</Drawer>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import Divider from '@mui/material/Divider';
|
|
3
|
+
import Typography from '@mui/material/Typography';
|
|
4
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
5
|
+
import Box from '@mui/material/Box';
|
|
6
|
+
import Button from '@mui/material/Button';
|
|
7
|
+
import Modal from '@mui/material/Modal';
|
|
8
|
+
import List from '@mui/material/List';
|
|
9
|
+
import ListItem from '@mui/material/ListItem';
|
|
10
|
+
import ListItemText from '@mui/material/ListItemText';
|
|
11
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
12
|
+
import Grid from '@mui/material/Grid';
|
|
13
|
+
import { ListItemButton } from '@mui/material';
|
|
14
|
+
|
|
15
|
+
const modalStyle = {
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
top: '50%',
|
|
18
|
+
left: '60%',
|
|
19
|
+
width: 350,
|
|
20
|
+
height: 280,
|
|
21
|
+
bgcolor: 'background.paper',
|
|
22
|
+
boxShadow: 24,
|
|
23
|
+
p: 4,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const mobileStyle = {
|
|
27
|
+
position: 'absolute',
|
|
28
|
+
top: '30%',
|
|
29
|
+
left: '20%',
|
|
30
|
+
width: 200,
|
|
31
|
+
height: 300,
|
|
32
|
+
bgcolor: 'background.paper',
|
|
33
|
+
boxShadow: 24,
|
|
34
|
+
p: 4,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
interface MlGpxDemoLoaderProps {
|
|
38
|
+
open: boolean;
|
|
39
|
+
setOpen: (open: boolean) => void;
|
|
40
|
+
setGpx: (gpx: string | undefined) => void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const samples = [
|
|
44
|
+
{
|
|
45
|
+
name: 'mountain_trail.gpx',
|
|
46
|
+
path: 'assets/sample1.gpx',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'bycycle_tour.gpx',
|
|
50
|
+
path: 'assets/sample2.gpx',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'treckking.gpx',
|
|
54
|
+
path: 'assets/sample3.gpx',
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
/**
|
|
58
|
+
* MlGpxDemoLoader returns a button to load a Demo GPX Track into the map.
|
|
59
|
+
*/
|
|
60
|
+
const MlGpxDemoLoader = (props: MlGpxDemoLoaderProps) => {
|
|
61
|
+
const reader = useRef(new FileReader());
|
|
62
|
+
reader.current.onload = () => {
|
|
63
|
+
if (!reader?.current?.result) return;
|
|
64
|
+
if (typeof reader.current.result === 'string') {
|
|
65
|
+
props.setGpx(reader.current.result);
|
|
66
|
+
}
|
|
67
|
+
handleClose();
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const mediaIsMobile = useMediaQuery('(max-width:900px)');
|
|
71
|
+
|
|
72
|
+
const loadSample = (samplePath: string) => {
|
|
73
|
+
fetch(samplePath)
|
|
74
|
+
.then(function (response) {
|
|
75
|
+
return response.blob();
|
|
76
|
+
})
|
|
77
|
+
.then(function (gpx) {
|
|
78
|
+
reader.current.readAsText(gpx);
|
|
79
|
+
})
|
|
80
|
+
.catch((error) => console.log(error));
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const handleClose = () => {
|
|
84
|
+
props.setOpen(false);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<>
|
|
89
|
+
<Modal
|
|
90
|
+
open={props.open}
|
|
91
|
+
onClose={handleClose}
|
|
92
|
+
aria-labelledby="modal-modal-title"
|
|
93
|
+
aria-describedby="modal-modal-description"
|
|
94
|
+
>
|
|
95
|
+
<Box sx={mediaIsMobile ? mobileStyle : modalStyle}>
|
|
96
|
+
<Grid container>
|
|
97
|
+
<Grid item xs={10}>
|
|
98
|
+
<Typography id="modal-modal-title" variant="h6">
|
|
99
|
+
GPX demo files
|
|
100
|
+
</Typography>
|
|
101
|
+
</Grid>
|
|
102
|
+
<Grid item xs={2}>
|
|
103
|
+
<Button onClick={handleClose}>
|
|
104
|
+
<CloseIcon sx={{ color: 'black' }} />
|
|
105
|
+
</Button>
|
|
106
|
+
</Grid>
|
|
107
|
+
</Grid>
|
|
108
|
+
<Divider />
|
|
109
|
+
|
|
110
|
+
<List>
|
|
111
|
+
{samples.map((el, idx) => (
|
|
112
|
+
<>
|
|
113
|
+
<ListItem key={idx}>
|
|
114
|
+
<ListItemButton onClick={() => loadSample(el.path)}>
|
|
115
|
+
<ListItemText>{el.name}</ListItemText>
|
|
116
|
+
</ListItemButton>
|
|
117
|
+
</ListItem>
|
|
118
|
+
<Divider key={'div' + idx} variant="inset" component="li" />
|
|
119
|
+
</>
|
|
120
|
+
))}
|
|
121
|
+
</List>
|
|
122
|
+
</Box>
|
|
123
|
+
</Modal>
|
|
124
|
+
</>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export default MlGpxDemoLoader;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Instructions from '../../../util/Instructions';
|
|
3
|
+
|
|
4
|
+
const bubbleBottomRightStyle = {
|
|
5
|
+
bubbleRight: '-120px',
|
|
6
|
+
bubbleBottom: '-120px',
|
|
7
|
+
textMarginTop: '70px',
|
|
8
|
+
textMarginLeft: '120px',
|
|
9
|
+
iconTransform: 'rotate(180deg)',
|
|
10
|
+
iconMarginLeft: '200px',
|
|
11
|
+
zIndex: 200
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const steps = [
|
|
15
|
+
{
|
|
16
|
+
duration: 3000,
|
|
17
|
+
props: {
|
|
18
|
+
...bubbleBottomRightStyle,
|
|
19
|
+
iconMarginTop: '43px',
|
|
20
|
+
},
|
|
21
|
+
content: (
|
|
22
|
+
<>
|
|
23
|
+
You can load your <br />
|
|
24
|
+
own GPX file <br /> here
|
|
25
|
+
</>
|
|
26
|
+
),
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
duration: 3000,
|
|
30
|
+
props: {
|
|
31
|
+
...bubbleBottomRightStyle,
|
|
32
|
+
iconMarginTop: '68px',
|
|
33
|
+
},
|
|
34
|
+
content: (
|
|
35
|
+
<>
|
|
36
|
+
You can see more <br /> information about <br />
|
|
37
|
+
the track <br />
|
|
38
|
+
here
|
|
39
|
+
</>
|
|
40
|
+
),
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
duration: 3000,
|
|
44
|
+
props: {
|
|
45
|
+
bubbleLeft: '-40px',
|
|
46
|
+
bubbleTop: '-150px',
|
|
47
|
+
textMarginTop: '230px',
|
|
48
|
+
textMarginLeft: '75px',
|
|
49
|
+
iconTransform: 'rotate(90deg)',
|
|
50
|
+
iconMarginTop: '-135px',
|
|
51
|
+
iconMarginLeft: '280px',
|
|
52
|
+
zIndex: 400
|
|
53
|
+
},
|
|
54
|
+
content: (
|
|
55
|
+
<>
|
|
56
|
+
In demo mode we <br /> provide you some <br /> GPX tracks <br /> to load.
|
|
57
|
+
</>
|
|
58
|
+
),
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
export default function MlGpxViewerInstructions(props: { open: boolean}) {
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<>
|
|
65
|
+
<Instructions steps={steps} open={props.open} />
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import MlImageMarkerLayer from './MlImageMarkerLayer';
|
|
4
|
+
|
|
5
|
+
import mapContextDecorator from '../../decorators/MapContextDecorator';
|
|
6
|
+
|
|
7
|
+
const storyoptions = {
|
|
8
|
+
title: 'MapComponents/MlImageMarkerLayer',
|
|
9
|
+
component: MlImageMarkerLayer,
|
|
10
|
+
argTypes: {},
|
|
11
|
+
decorators: mapContextDecorator,
|
|
12
|
+
};
|
|
13
|
+
export default storyoptions;
|
|
14
|
+
|
|
15
|
+
const Template = () => (
|
|
16
|
+
<MlImageMarkerLayer
|
|
17
|
+
options={{
|
|
18
|
+
source: {
|
|
19
|
+
type: 'geojson',
|
|
20
|
+
data: {
|
|
21
|
+
type: 'Feature',
|
|
22
|
+
geometry: {
|
|
23
|
+
type: 'Point',
|
|
24
|
+
coordinates: [7.0847929969609424, 50.73855193187643],
|
|
25
|
+
},
|
|
26
|
+
properties: { id: 'test' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
layout: {
|
|
30
|
+
'icon-allow-overlap': true,
|
|
31
|
+
'icon-size': 0.14,
|
|
32
|
+
'icon-offset': [0, -180],
|
|
33
|
+
},
|
|
34
|
+
}}
|
|
35
|
+
imgSrc={'/assets/wg-marker.png'}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
export const ExampleConfig = Template.bind({});
|
|
40
|
+
ExampleConfig.parameters = {};
|
|
41
|
+
ExampleConfig.args = {};
|