@mapcomponents/react-maplibre 0.1.57 → 0.1.59
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/.eslintignore +11 -0
- package/.eslintrc.js +20 -0
- package/.github/workflows/check-formatting.yml +46 -0
- package/.prettierignore +11 -0
- package/.prettierrc.json +6 -0
- package/CHANGELOG.md +18 -0
- package/coverage/clover.xml +229 -77
- package/coverage/coverage-final.json +43 -37
- package/coverage/lcov-report/index.html +65 -20
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +83 -83
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +66 -66
- package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +30 -30
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +202 -0
- package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +116 -0
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +99 -99
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +66 -66
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +221 -221
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.tsx.html +308 -308
- package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +497 -497
- package/coverage/lcov-report/src/components/MlGPXViewer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +85 -85
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +469 -0
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +116 -0
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +140 -140
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +37 -37
- package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +179 -179
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +113 -113
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +181 -181
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +58 -58
- 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 +108 -108
- package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +39 -39
- package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +183 -183
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +163 -163
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +50 -50
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +30 -30
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +83 -83
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +204 -204
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +180 -180
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +163 -163
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +136 -136
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +53 -53
- package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +123 -123
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +35 -35
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +155 -155
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +255 -255
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
- package/coverage/lcov-report/src/contexts/MapContext.tsx.html +66 -66
- package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
- package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +48 -48
- package/coverage/lcov-report/src/contexts/index.html +1 -1
- package/coverage/lcov-report/src/hooks/exportMap/index.html +131 -0
- package/coverage/lcov-report/src/hooks/exportMap/index.ts.html +175 -0
- package/coverage/lcov-report/src/hooks/exportMap/lib.ts.html +646 -0
- package/coverage/lcov-report/src/hooks/index.html +48 -18
- package/coverage/lcov-report/src/hooks/useLayer.ts.html +230 -188
- package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +232 -0
- package/coverage/lcov-report/src/hooks/useMap.ts.html +72 -69
- package/coverage/lcov-report/src/hooks/useMapState.ts.html +145 -145
- package/coverage/lcov-report/src/hooks/useSource.ts.html +337 -0
- package/coverage/lcov-report/src/hooks/useWms.js.html +72 -72
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +11 -2
- package/coverage/lcov.info +448 -151
- package/dist/components/MlCreatePdfForm/MlCreatePdfForm.d.ts +24 -0
- package/dist/components/MlCreatePdfForm/MlCreatePdfForm.stories.d.ts +13 -0
- package/dist/components/MlCreatePdfForm/lib/PdfContext.d.ts +21 -0
- package/dist/components/MlCreatePdfForm/lib/PdfForm.d.ts +10 -0
- package/dist/components/MlCreatePdfForm/lib/PdfPreview.d.ts +13 -0
- package/dist/components/MlCreatePdfForm/lib/pdf.templates.d.ts +11 -0
- package/dist/components/MlFeatureEditor/lib/create_vertex.d.ts +1 -1
- package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.d.ts +22 -0
- package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.stories.d.ts +10 -0
- package/dist/components/MlLayerSwipe/MlLayerSwipe.d.ts +1 -1
- package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +2 -2
- package/dist/decorators/MapContextDecoratorHooks.d.ts +2 -0
- package/dist/hooks/exportMap/index.d.ts +11 -0
- package/dist/hooks/exportMap/lib.d.ts +36 -0
- package/dist/hooks/useLayer.d.ts +6 -5
- package/dist/hooks/useLayerEvent.d.ts +2 -0
- package/dist/hooks/useMap.d.ts +1 -1
- package/dist/hooks/useMapState.stories.d.ts +2 -2
- package/dist/hooks/useSource.d.ts +17 -0
- package/dist/hooks/useSources.stories.d.ts +13 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +1055 -315
- package/dist/index.esm.js.map +1 -1
- package/eslintErrorTest.js +10 -0
- package/package.json +7 -1
- package/public/thumbnails/MlCreatePdfForm.png +0 -0
- package/src/components/MapLibreMap/MapLibreMap.stories.js +72 -72
- package/src/components/MapLibreMap/MapLibreMap.test.js +60 -60
- package/src/components/MapLibreMap/MapLibreMap.tsx +82 -82
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.test.js +343 -343
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +619 -619
- package/src/components/MlBasicComponent.js +25 -25
- package/src/components/MlCenterPosition/MlCenterPosition.stories.js +6 -6
- package/src/components/MlCenterPosition/MlCenterPosition.tsx +65 -65
- package/src/components/MlComponentTemplate/MlComponentTemplate.stories.js +5 -5
- package/src/components/MlComponentTemplate/MlComponentTemplate.tsx +23 -23
- package/src/components/MlCreatePdfButton/{MlCreatePdfButton.meta.json → MlCreatePdfButton.meta_.json} +0 -0
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.stories.js +16 -16
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx +29 -29
- package/src/components/MlCreatePdfButton/lib/createPdf.ts +175 -175
- package/src/components/MlCreatePdfButton/lib/nominatimMap.ts +51 -51
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.doc.de.md +3 -0
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.meta.json +15 -0
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.stories.tsx +152 -0
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx +39 -0
- package/src/components/MlCreatePdfForm/lib/PdfContext.tsx +53 -0
- package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +161 -0
- package/src/components/MlCreatePdfForm/lib/PdfPreview.tsx +399 -0
- package/src/components/MlCreatePdfForm/lib/pdf.templates.ts +82 -0
- package/src/components/MlFeatureEditor/MlFeatureEditor.stories.js +55 -55
- package/src/components/MlFeatureEditor/MlFeatureEditor.test.js +105 -105
- package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +119 -119
- package/src/components/MlFeatureEditor/custom-direct-select-mode.js +208 -208
- package/src/components/MlFeatureEditor/custom-polygon-mode.js +148 -148
- package/src/components/MlFeatureEditor/custom-select-mode.js +314 -314
- package/src/components/MlFeatureEditor/lib/common_selectors.js +34 -34
- package/src/components/MlFeatureEditor/lib/constants.js +61 -61
- package/src/components/MlFeatureEditor/lib/constrain_feature_movement.js +51 -51
- package/src/components/MlFeatureEditor/lib/create_midpoint.js +30 -30
- package/src/components/MlFeatureEditor/lib/create_supplementary_points.js +82 -82
- package/src/components/MlFeatureEditor/lib/create_vertex.js +16 -16
- package/src/components/MlFeatureEditor/lib/double_click_zoom.js +23 -23
- package/src/components/MlFeatureEditor/lib/euclidean_distance.js +3 -3
- package/src/components/MlFeatureEditor/lib/features_at.js +23 -23
- package/src/components/MlFeatureEditor/lib/get_features_and_set_cursor.js +15 -15
- package/src/components/MlFeatureEditor/lib/is_click.js +8 -8
- package/src/components/MlFeatureEditor/lib/is_event_at_coordinates.js +2 -2
- package/src/components/MlFeatureEditor/lib/is_tap.js +6 -6
- package/src/components/MlFeatureEditor/lib/map_event_to_bounding_box.js +4 -4
- package/src/components/MlFeatureEditor/lib/mode_handler.js +105 -105
- package/src/components/MlFeatureEditor/lib/mouse_event_point.js +5 -5
- package/src/components/MlFeatureEditor/lib/move_features.js +33 -33
- package/src/components/MlFeatureEditor/lib/sort_features.js +25 -25
- package/src/components/MlFeatureEditor/lib/string_set.js +36 -36
- package/src/components/MlFeatureEditor/lib/string_sets_are_equal.js +2 -2
- package/src/components/MlFeatureEditor/lib/theme.js +230 -230
- package/src/components/MlFeatureEditor/lib/to_dense_array.js +1 -1
- package/src/components/MlFeatureEditor/lib/utils.js +40 -40
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.stories.js +9 -9
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.test.js +4 -4
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx +65 -65
- package/src/components/MlFollowGps/MlFollowGps.stories.js +6 -6
- package/src/components/MlFollowGps/MlFollowGps.test.js +44 -44
- package/src/components/MlFollowGps/MlFollowGps.tsx +220 -220
- package/src/components/MlGPXViewer/MlGPXViewer.stories.js +15 -15
- package/src/components/MlGPXViewer/MlGPXViewer.test.js +12 -12
- package/src/components/MlGPXViewer/MlGPXViewer.tsx +345 -345
- package/src/components/MlGPXViewer/gpxConverter.js +496 -496
- package/src/components/MlGPXViewer/util/GeoJsonContext.ts +4 -4
- package/src/components/MlGPXViewer/util/GeoJsonProvider.tsx +16 -16
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.js +34 -34
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.test.js +8 -8
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +84 -84
- package/src/components/MlGeoJsonLayer/util/getDefaultLayerTypeByGeometry.ts +21 -21
- package/src/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.ts +27 -27
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.doc.de.md +3 -0
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.meta_.json +15 -0
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.stories.js +19 -0
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx +128 -0
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.js +28 -28
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +8 -8
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx +162 -162
- package/src/components/MlLayer/MlLayer.stories.js +5 -5
- package/src/components/MlLayer/MlLayer.test.js +86 -86
- package/src/components/MlLayer/MlLayer.tsx +36 -36
- package/src/components/MlLayerMagnify/MlLayerMagnify.stories.js +21 -21
- package/src/components/MlLayerMagnify/MlLayerMagnify.test.js +54 -54
- package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +201 -201
- package/src/components/MlLayerSwipe/MlLayerSwipe.stories.js +20 -20
- package/src/components/MlLayerSwipe/MlLayerSwipe.test.js +54 -54
- package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +130 -130
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.js +194 -194
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.stories.js +85 -85
- package/src/components/MlLayerSwitcher/components/LayerBox.js +57 -57
- package/src/components/MlMarker/MlMarker.stories.js +7 -7
- package/src/components/MlMarker/MlMarker.tsx +119 -119
- package/src/components/MlMeasureTool/MlMeasureTool.stories.js +64 -64
- package/src/components/MlMeasureTool/MlMeasureTool.tsx +38 -38
- package/src/components/MlNavigationCompass/MlNavigationCompass.stories.js +45 -45
- package/src/components/MlNavigationCompass/MlNavigationCompass.test.js +40 -40
- package/src/components/MlNavigationCompass/MlNavigationCompass.tsx +192 -192
- package/src/components/MlNavigationTools/MlNavigationTools.stories.js +18 -18
- package/src/components/MlNavigationTools/MlNavigationTools.tsx +173 -173
- package/src/components/MlOsmLayer/MlOsmLayer.js +49 -49
- package/src/components/MlOsmLayer/MlOsmLayer.stories_.js +29 -29
- package/src/components/MlOsmLayer/MlOsmLayer.test.js +8 -8
- package/src/components/MlScaleReference/MlScaleReference.js +82 -82
- package/src/components/MlScaleReference/MlScaleReference.stories.js +27 -27
- package/src/components/MlShareMapState/MlShareMapState.js +203 -203
- package/src/components/MlShareMapState/MlShareMapState.stories.js +68 -68
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js +201 -201
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +35 -35
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.test.js +8 -8
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.js +186 -186
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.stories.js +21 -21
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.test.js +24 -24
- package/src/components/MlThreeJsLayer/lib/GLTFLoader.js +3327 -3327
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.stories.js +31 -30
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.test.js +8 -8
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx +146 -146
- package/src/components/MlTransitionGeoJsonLayer/util/transitionFunctions.js +207 -207
- package/src/components/MlUseMapDebugger/MlUseMapDebugger.js +52 -52
- package/src/components/MlUseMapDebugger/MlUseMapDebugger.stories.js +13 -13
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.stories.js +27 -27
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.test.js +27 -27
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +137 -137
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js +34 -34
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.stories.js +7 -7
- package/src/components/MlWmsLayer/MlWmsLayer.stories.js +26 -26
- package/src/components/MlWmsLayer/MlWmsLayer.test.js +8 -8
- package/src/components/MlWmsLayer/MlWmsLayer.tsx +167 -167
- package/src/components/MlWmsLoader/MlWmsLoader.stories.js +27 -27
- package/src/components/MlWmsLoader/MlWmsLoader.tsx +254 -254
- package/src/contexts/MapComponentsProvider.test.js +229 -229
- package/src/contexts/MapContext.tsx +65 -65
- package/src/contexts/SimpleDataProvider.js +47 -47
- package/src/contexts/SimpleDataProvider.test.js +29 -29
- package/src/custom.d.tsx +14 -14
- package/src/decorators/MapContextDecorator.js +22 -22
- package/src/decorators/MapContextDecoratorHooks.js +34 -0
- package/src/decorators/MultiMapContextDecorator.js +63 -63
- package/src/decorators/NoNavToolsDecorator.js +17 -17
- package/src/decorators/ThemeWrapper.jsx +1 -1
- package/src/hooks/assets/pointWG.json +13 -0
- package/src/hooks/exportMap/index.ts +30 -0
- package/src/hooks/exportMap/lib.ts +187 -0
- package/src/hooks/useLayer.test.js +188 -188
- package/src/hooks/useLayer.ts +194 -180
- package/src/hooks/useLayerEvent.js +49 -0
- package/src/hooks/useMap.ts +67 -66
- package/src/hooks/useMapState.stories.js +78 -78
- package/src/hooks/useMapState.ts +161 -161
- package/src/hooks/useSource.ts +84 -0
- package/src/hooks/useSources.stories.js +232 -0
- package/src/hooks/useWms.js +71 -71
- package/src/index.ts +3 -0
- package/src/setupTests.js +86 -86
- package/src/ui_components/ImageLoader.js +62 -62
- package/src/ui_components/Legend.js +34 -34
- package/src/ui_components/LoadingOverlay.js +29 -29
- package/src/ui_components/LoadingOverlayContext.js +68 -68
- package/src/ui_components/Sidebar.js +80 -80
- package/src/ui_components/Tooltip.js +9 -9
- package/src/ui_components/TopToolbar.js +23 -23
- package/src/util/layerRemovalTest.js +111 -111
- package/src/util/sourceRemovalTest.js +103 -103
|
@@ -836,360 +836,360 @@ import useMap from "../../hooks/useMap";
|
|
|
836
836
|
|
|
837
837
|
interface MlGPXViewerProps {
|
|
838
838
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
839
|
+
/**
|
|
840
|
+
* Id of the target MapLibre instance in mapHook
|
|
841
|
+
*/
|
|
842
|
+
mapId?: string,
|
|
843
|
+
/**
|
|
844
|
+
* The layerId of an existing layer this layer should be rendered visually beneath
|
|
845
|
+
* https://maplibre.org/maplibre-gl-js-docs/api/map/#map#addlayer - see "beforeId" property
|
|
846
|
+
*/
|
|
847
|
+
insertBeforeLayer?: string,
|
|
848
|
+
/**
|
|
849
|
+
* Prefix of the component id this component uses when adding elements to the MapLibreGl-instance
|
|
850
|
+
*/
|
|
851
|
+
idPrefix?: string,
|
|
852
|
+
/**
|
|
853
|
+
* Sets the layers layout-property "visibility" to "none" if false or "visible" if true
|
|
854
|
+
*/
|
|
855
|
+
visible?: boolean,
|
|
856
856
|
}
|
|
857
857
|
|
|
858
858
|
/**
|
|
859
859
|
* MlGPXViewer returns a dropzone and a button to load a GPX Track into the map.
|
|
860
860
|
*/
|
|
861
861
|
const MlGPXViewer = (props:MlGPXViewerProps) => {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
862
|
+
const dataSource = useContext(GeoJsonContext);
|
|
863
|
+
const initializedRef = useRef(false);
|
|
864
|
+
const mapHook = useMap({ mapId: props.mapId, waitForLayer: props.insertBeforeLayer });
|
|
865
|
+
const sourceName = "import-source";
|
|
866
|
+
const layerNameLines = "importer-layer-lines";
|
|
867
|
+
const layerNamePoints = "importer-layer-points";
|
|
868
868
|
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
869
|
+
const [open, setIsOpen] = useState(false);
|
|
870
|
+
const dropZone = useRef<HTMLDivElement>(null);
|
|
871
|
+
const [zIndex, setZIndex] = useState(0);
|
|
872
|
+
const [metaData, setMetaData] = useState<{ title: string; value: string; id: number; }[]>([]);
|
|
873
|
+
const fileupload = useRef<HTMLInputElement>(null);
|
|
874
|
+
const mediaIsMobile = useMediaQuery("(max-width:900px)");
|
|
875
875
|
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
876
|
+
const popup = useRef(
|
|
877
|
+
new Popup({
|
|
878
|
+
closeButton: false,
|
|
879
|
+
closeOnClick: true,
|
|
880
|
+
})
|
|
881
|
+
);
|
|
882
882
|
|
|
883
|
-
|
|
884
|
-
|
|
883
|
+
useEffect(() => {
|
|
884
|
+
if (!mapHook.map || initializedRef.current) return;
|
|
885
885
|
|
|
886
|
-
|
|
886
|
+
initializedRef.current = true;
|
|
887
887
|
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
888
|
+
mapHook.map.addSource(
|
|
889
|
+
sourceName,
|
|
890
|
+
{
|
|
891
|
+
type: "geojson",
|
|
892
|
+
data: dataSource.data,
|
|
893
|
+
},
|
|
894
|
+
mapHook.componentId
|
|
895
|
+
);
|
|
896
|
+
mapHook.map.addLayer(
|
|
897
|
+
{
|
|
898
|
+
id: layerNameLines,
|
|
899
|
+
source: sourceName,
|
|
900
|
+
type: "line",
|
|
901
|
+
paint: {
|
|
902
|
+
"line-width": 4,
|
|
903
|
+
"line-color": "rgba(212, 55, 23,0.5)",
|
|
904
|
+
},
|
|
905
|
+
},
|
|
906
|
+
props.insertBeforeLayer,
|
|
907
|
+
mapHook.componentId
|
|
908
|
+
);
|
|
909
|
+
mapHook.map.addLayer(
|
|
910
|
+
{
|
|
911
|
+
id: layerNamePoints,
|
|
912
|
+
source: sourceName,
|
|
913
|
+
type: "circle",
|
|
914
|
+
paint: {
|
|
915
|
+
"circle-color": "rgba(72, 77, 99,0.5)",
|
|
916
|
+
"circle-radius": 7,
|
|
917
|
+
},
|
|
918
|
+
filter: ["==", "$type", "Point"],
|
|
919
|
+
},
|
|
920
|
+
props.insertBeforeLayer,
|
|
921
|
+
mapHook.componentId
|
|
922
|
+
);
|
|
923
923
|
|
|
924
|
-
|
|
925
|
-
|
|
924
|
+
[layerNameLines, layerNamePoints].forEach((layerName) => {
|
|
925
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if(!mapHook.map)<span class="cstat-no" title="statement not covered" >return;</span>
|
|
926
926
|
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
<span class="fstat-no" title="function not covered" >
|
|
933
|
-
<span class="cstat-no" title="statement not covered" >
|
|
934
|
-
|
|
927
|
+
mapHook.map.map.setLayoutProperty(layerName, "visibility", "visible");
|
|
928
|
+
});
|
|
929
|
+
mapHook.map.on(
|
|
930
|
+
"mouseenter",
|
|
931
|
+
layerNamePoints,
|
|
932
|
+
<span class="fstat-no" title="function not covered" > (e</span>:any) => {
|
|
933
|
+
<span class="cstat-no" title="statement not covered" > if(!mapHook.map)<span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
934
|
+
// Change the cursor style as a UI indicator.
|
|
935
935
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
936
|
+
const coordinates = <span class="cstat-no" title="statement not covered" >e.features[0].geometry.coordinates.slice();</span>
|
|
937
|
+
//const description = e.features[0].properties.desc;
|
|
938
|
+
const name = <span class="cstat-no" title="statement not covered" >e.features[0].properties.name;</span>
|
|
939
939
|
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
<span class="cstat-no" title="statement not covered" >
|
|
944
|
-
<span class="cstat-no" title="statement not covered" >
|
|
945
|
-
|
|
940
|
+
// Ensure that if the map is zoomed out such that multiple
|
|
941
|
+
// copies of the feature are visible, the popup appears
|
|
942
|
+
// over the copy being pointed to.
|
|
943
|
+
<span class="cstat-no" title="statement not covered" > while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {</span>
|
|
944
|
+
<span class="cstat-no" title="statement not covered" > coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;</span>
|
|
945
|
+
}
|
|
946
946
|
|
|
947
|
-
|
|
947
|
+
// Populate the popup and set its coordinates
|
|
948
948
|
|
|
949
|
-
|
|
950
|
-
<span class="cstat-no" title="statement not covered" >
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
949
|
+
// based on the feature found.
|
|
950
|
+
<span class="cstat-no" title="statement not covered" > popup.current.setLngLat(coordinates).setHTML(name).addTo(mapHook.map.map);</span>
|
|
951
|
+
},
|
|
952
|
+
mapHook.componentId
|
|
953
|
+
);
|
|
954
954
|
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
<span class="fstat-no" title="function not covered" >
|
|
959
|
-
<span class="cstat-no" title="statement not covered" >
|
|
955
|
+
mapHook.map.on(
|
|
956
|
+
"mouseleave",
|
|
957
|
+
"places",
|
|
958
|
+
<span class="fstat-no" title="function not covered" > fu</span>nction () {
|
|
959
|
+
<span class="cstat-no" title="statement not covered" > if(!mapHook.map)<span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
960
960
|
|
|
961
|
-
<span class="cstat-no" title="statement not covered" >
|
|
962
|
-
<span class="cstat-no" title="statement not covered" >
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
961
|
+
<span class="cstat-no" title="statement not covered" > mapHook.map.map.getCanvas().style.cursor = "";</span>
|
|
962
|
+
<span class="cstat-no" title="statement not covered" > popup.current.remove();</span>
|
|
963
|
+
},
|
|
964
|
+
mapHook.componentId
|
|
965
|
+
);
|
|
966
966
|
|
|
967
|
-
|
|
968
|
-
|
|
967
|
+
mapHook.map.map.setZoom(10);
|
|
968
|
+
}, [mapHook.map]);
|
|
969
969
|
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
<span class="cstat-no" title="statement not covered" >
|
|
974
|
-
<span class="cstat-no" title="statement not covered" >
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
<span class="cstat-no" title="statement not covered" >
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
<span class="cstat-no" title="statement not covered" >
|
|
981
|
-
<span class="cstat-no" title="statement not covered" >
|
|
982
|
-
|
|
970
|
+
useEffect(() => {
|
|
971
|
+
const _dropZone = dropZone.current;
|
|
972
|
+
const raiseDropZoneAndStopDefault = <span class="fstat-no" title="function not covered" >(e</span>vent:any) => {
|
|
973
|
+
<span class="cstat-no" title="statement not covered" > setZIndex(1000);</span>
|
|
974
|
+
<span class="cstat-no" title="statement not covered" > stopDefault(event);</span>
|
|
975
|
+
};
|
|
976
|
+
const lowerDropZone = <span class="fstat-no" title="function not covered" >()</span> => {
|
|
977
|
+
<span class="cstat-no" title="statement not covered" > setZIndex(0);</span>
|
|
978
|
+
};
|
|
979
|
+
const lowerDropZoneAndStopDefault = <span class="fstat-no" title="function not covered" >(e</span>vent:any) => {
|
|
980
|
+
<span class="cstat-no" title="statement not covered" > setZIndex(0);</span>
|
|
981
|
+
<span class="cstat-no" title="statement not covered" > stopDefault(event);</span>
|
|
982
|
+
};
|
|
983
983
|
|
|
984
|
-
|
|
985
|
-
|
|
984
|
+
window.addEventListener("dragenter", raiseDropZoneAndStopDefault);
|
|
985
|
+
window.addEventListener("dragover", stopDefault);
|
|
986
986
|
|
|
987
|
-
|
|
987
|
+
_dropZone?.addEventListener("dragleave", lowerDropZone);
|
|
988
988
|
|
|
989
|
-
|
|
989
|
+
window.addEventListener("drop", lowerDropZoneAndStopDefault);
|
|
990
990
|
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
991
|
+
return () => {
|
|
992
|
+
window.removeEventListener("dragenter", raiseDropZoneAndStopDefault);
|
|
993
|
+
window.removeEventListener("dragover", stopDefault);
|
|
994
|
+
_dropZone?.removeEventListener("dragleave", lowerDropZone);
|
|
995
|
+
window.removeEventListener("drop", lowerDropZoneAndStopDefault);
|
|
996
|
+
};
|
|
997
|
+
});
|
|
998
998
|
|
|
999
|
-
|
|
1000
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1001
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1002
|
-
|
|
999
|
+
const stopDefault = <span class="fstat-no" title="function not covered" >(e</span>vent:any) => {
|
|
1000
|
+
<span class="cstat-no" title="statement not covered" > event.preventDefault();</span>
|
|
1001
|
+
<span class="cstat-no" title="statement not covered" > event.stopPropagation();</span>
|
|
1002
|
+
};
|
|
1003
1003
|
|
|
1004
|
-
|
|
1005
|
-
|
|
1004
|
+
useEffect(() => {
|
|
1005
|
+
<span class="missing-if-branch" title="else path not taken" >E</span>if (!mapHook.map) return;
|
|
1006
1006
|
|
|
1007
|
-
|
|
1007
|
+
const visibility = <span class="cstat-no" title="statement not covered" >props.visible ? "visible" : "none";</span>
|
|
1008
1008
|
|
|
1009
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1010
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1009
|
+
<span class="cstat-no" title="statement not covered" > [layerNameLines, layerNamePoints].forEach(<span class="fstat-no" title="function not covered" >(l</span>ayerName) => {</span>
|
|
1010
|
+
<span class="cstat-no" title="statement not covered" > if(!mapHook.map)<span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
1011
1011
|
|
|
1012
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1013
|
-
|
|
1014
|
-
|
|
1012
|
+
<span class="cstat-no" title="statement not covered" > mapHook.map.map.setLayoutProperty(layerName, "visibility", visibility);</span>
|
|
1013
|
+
});
|
|
1014
|
+
}, [props.visible]);
|
|
1015
1015
|
|
|
1016
|
-
|
|
1017
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1016
|
+
const dropHandler = <span class="fstat-no" title="function not covered" >(e</span>vent:any) => {
|
|
1017
|
+
<span class="cstat-no" title="statement not covered" > event.preventDefault();</span>
|
|
1018
1018
|
|
|
1019
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1020
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1021
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1025
|
-
|
|
1026
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1027
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1019
|
+
<span class="cstat-no" title="statement not covered" > if (event.dataTransfer.items) {</span>
|
|
1020
|
+
<span class="cstat-no" title="statement not covered" > if (event.dataTransfer.items.length > 1) {</span>
|
|
1021
|
+
<span class="cstat-no" title="statement not covered" > return false;</span>
|
|
1022
|
+
}
|
|
1023
|
+
// If dropped items aren't files, reject them
|
|
1024
|
+
<span class="cstat-no" title="statement not covered" > if (event.dataTransfer.items[0].kind === "file") {</span>
|
|
1025
|
+
const reader = <span class="cstat-no" title="statement not covered" >new FileReader();</span>
|
|
1026
|
+
<span class="cstat-no" title="statement not covered" > reader.onload = <span class="fstat-no" title="function not covered" >(p</span>ayload:any) => {</span>
|
|
1027
|
+
<span class="cstat-no" title="statement not covered" > if(!payload?.currentTarget?.result)<span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
1028
1028
|
|
|
1029
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1038
|
-
|
|
1029
|
+
<span class="cstat-no" title="statement not covered" > addGPXToMap(payload.currentTarget.result);</span>
|
|
1030
|
+
};
|
|
1031
|
+
const file = <span class="cstat-no" title="statement not covered" >event.dataTransfer.items[0].getAsFile();</span>
|
|
1032
|
+
<span class="cstat-no" title="statement not covered" > reader.readAsText(file);</span>
|
|
1033
|
+
}
|
|
1034
|
+
} else {
|
|
1035
|
+
// Use DataTransfer interface to access the file(s)
|
|
1036
|
+
}
|
|
1037
|
+
<span class="cstat-no" title="statement not covered" > return;</span>
|
|
1038
|
+
};
|
|
1039
1039
|
|
|
1040
|
-
|
|
1041
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1040
|
+
const addGPXToMap = <span class="fstat-no" title="function not covered" >(g</span>pxAsString:string) => {
|
|
1041
|
+
<span class="cstat-no" title="statement not covered" > if (!mapHook.map || !dataSource.setData) <span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
1042
1042
|
|
|
1043
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1044
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1049
|
-
|
|
1050
|
-
|
|
1043
|
+
<span class="cstat-no" title="statement not covered" > try {</span>
|
|
1044
|
+
<span class="cstat-no" title="statement not covered" > setMetaData([]);</span>
|
|
1045
|
+
const domParser = <span class="cstat-no" title="statement not covered" >new DOMParser();</span>
|
|
1046
|
+
const gpxDoc = <span class="cstat-no" title="statement not covered" >domParser.parseFromString(gpxAsString, "application/xml");</span>
|
|
1047
|
+
const metadata = <span class="cstat-no" title="statement not covered" >gpxDoc.querySelector("metadata");</span>
|
|
1048
|
+
<span class="cstat-no" title="statement not covered" > metadata?.childNodes.forEach(<span class="fstat-no" title="function not covered" >(n</span>ode:Element) => {</span>
|
|
1049
|
+
let value = <span class="cstat-no" title="statement not covered" >node.textContent;</span>
|
|
1050
|
+
const title = <span class="cstat-no" title="statement not covered" >node.nodeName;</span>
|
|
1051
1051
|
|
|
1052
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1053
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1054
|
-
|
|
1055
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1066
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1067
|
-
|
|
1068
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1069
|
-
|
|
1070
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1071
|
-
|
|
1072
|
-
|
|
1052
|
+
<span class="cstat-no" title="statement not covered" > if (node.nodeName === "link") {</span>
|
|
1053
|
+
<span class="cstat-no" title="statement not covered" > value = node.getAttribute("href");</span>
|
|
1054
|
+
}
|
|
1055
|
+
<span class="cstat-no" title="statement not covered" > if (!!value?.trim().length) {</span>
|
|
1056
|
+
const metaDatEntry = <span class="cstat-no" title="statement not covered" >{</span>
|
|
1057
|
+
title: title,
|
|
1058
|
+
value: value,
|
|
1059
|
+
id: new Date().getTime(),
|
|
1060
|
+
};
|
|
1061
|
+
<span class="cstat-no" title="statement not covered" > setMetaData(<span class="fstat-no" title="function not covered" >(p</span>revState) => <span class="cstat-no" title="statement not covered" >[...prevState, metaDatEntry])</span>;</span>
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
const data = <span class="cstat-no" title="statement not covered" >toGeoJSON.gpx(gpxDoc);</span>
|
|
1065
|
+
<span class="cstat-no" title="statement not covered" > dataSource.setData(data);</span>
|
|
1066
|
+
<span class="cstat-no" title="statement not covered" > (mapHook.map.map.getSource(sourceName) as GeoJSONSource).setData(data as GeoJSON);</span>
|
|
1067
|
+
const bounds = <span class="cstat-no" title="statement not covered" >bbox(data);</span>
|
|
1068
|
+
<span class="cstat-no" title="statement not covered" > mapHook.map.map.fitBounds(bounds as LngLatBoundsLike);</span>
|
|
1069
|
+
} catch (e) {
|
|
1070
|
+
<span class="cstat-no" title="statement not covered" > console.log(e);</span>
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
1073
|
|
|
1074
|
-
|
|
1075
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1076
|
-
|
|
1074
|
+
const toogleDrawer = <span class="fstat-no" title="function not covered" >()</span> => {
|
|
1075
|
+
<span class="cstat-no" title="statement not covered" > setIsOpen(<span class="fstat-no" title="function not covered" >(p</span>revState) => <span class="cstat-no" title="statement not covered" >!prevState)</span>;</span>
|
|
1076
|
+
};
|
|
1077
1077
|
|
|
1078
|
-
|
|
1079
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1078
|
+
const fileUploadOnChange = <span class="fstat-no" title="function not covered" >()</span> => {
|
|
1079
|
+
<span class="cstat-no" title="statement not covered" > if(!fileupload.current)<span class="cstat-no" title="statement not covered" >return false;</span></span>
|
|
1080
1080
|
|
|
1081
|
-
|
|
1082
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1083
|
-
|
|
1084
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1085
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1081
|
+
const file = <span class="cstat-no" title="statement not covered" >fileupload.current?.files?.[0];</span>
|
|
1082
|
+
<span class="cstat-no" title="statement not covered" > if (!file) <span class="cstat-no" title="statement not covered" >return false;</span></span>
|
|
1083
|
+
const reader = <span class="cstat-no" title="statement not covered" >new FileReader();</span>
|
|
1084
|
+
<span class="cstat-no" title="statement not covered" > reader.onload = <span class="fstat-no" title="function not covered" >(p</span>ayload:any) => {</span>
|
|
1085
|
+
<span class="cstat-no" title="statement not covered" > if(!payload)<span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
1086
1086
|
|
|
1087
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1088
|
-
|
|
1087
|
+
<span class="cstat-no" title="statement not covered" > addGPXToMap(payload.currentTarget.result);</span>
|
|
1088
|
+
};
|
|
1089
1089
|
|
|
1090
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1090
|
+
<span class="cstat-no" title="statement not covered" > reader.readAsText(file);</span>
|
|
1091
1091
|
|
|
1092
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1093
|
-
|
|
1092
|
+
<span class="cstat-no" title="statement not covered" > return;</span>
|
|
1093
|
+
};
|
|
1094
1094
|
|
|
1095
|
-
|
|
1096
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1095
|
+
const manualUpload = <span class="fstat-no" title="function not covered" >()</span> => {
|
|
1096
|
+
<span class="cstat-no" title="statement not covered" > if(!fileupload.current)<span class="cstat-no" title="statement not covered" >return;</span></span>
|
|
1097
1097
|
|
|
1098
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
<span class="cstat-no" title="statement not covered" >
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1098
|
+
<span class="cstat-no" title="statement not covered" > fileupload.current.click();</span>
|
|
1099
|
+
};
|
|
1100
|
+
return (
|
|
1101
|
+
<>
|
|
1102
|
+
<div
|
|
1103
|
+
style={{
|
|
1104
|
+
position: "fixed",
|
|
1105
|
+
right: "5px",
|
|
1106
|
+
bottom: mediaIsMobile ? <span class="branch-0 cbranch-no" title="branch not covered" >"40px" </span>: "25px",
|
|
1107
|
+
display: "flex",
|
|
1108
|
+
flexDirection: "column",
|
|
1109
|
+
gap: "5px",
|
|
1110
|
+
zIndex: 1000,
|
|
1111
|
+
}}
|
|
1112
|
+
>
|
|
1113
|
+
<IconButton
|
|
1114
|
+
onClick={manualUpload}
|
|
1115
|
+
style={{
|
|
1116
|
+
backgroundColor: "rgba(255,255,255,1)",
|
|
1117
|
+
}}
|
|
1118
|
+
size="large"
|
|
1119
|
+
>
|
|
1120
|
+
<input
|
|
1121
|
+
ref={fileupload}
|
|
1122
|
+
onChange={fileUploadOnChange}
|
|
1123
|
+
type="file"
|
|
1124
|
+
id="input"
|
|
1125
|
+
multiple
|
|
1126
|
+
style={{ display: "none" }}
|
|
1127
|
+
></input>
|
|
1128
|
+
<FileCopy />
|
|
1129
|
+
</IconButton>
|
|
1130
|
+
<IconButton
|
|
1131
|
+
onClick={toogleDrawer}
|
|
1132
|
+
style={{
|
|
1133
|
+
backgroundColor: "rgba(255,255,255,1)",
|
|
1134
|
+
}}
|
|
1135
|
+
size="large"
|
|
1136
|
+
>
|
|
1137
|
+
<InfoIcon />
|
|
1138
|
+
</IconButton>
|
|
1139
|
+
</div>
|
|
1140
|
+
<Drawer variant="persistent" anchor="left" open={open}>
|
|
1141
|
+
<Typography
|
|
1142
|
+
variant="h6"
|
|
1143
|
+
style={{
|
|
1144
|
+
textAlign: "center",
|
|
1145
|
+
padding: "1em",
|
|
1146
|
+
}}
|
|
1147
|
+
noWrap
|
|
1148
|
+
>
|
|
1149
|
+
Informationen zur Route
|
|
1150
|
+
</Typography>
|
|
1151
|
+
<Divider />
|
|
1152
|
+
<List>
|
|
1153
|
+
{metaData.map(<span class="fstat-no" title="function not covered" >(i</span>tem) => (
|
|
1154
|
+
<span class="cstat-no" title="statement not covered" > <ListItem key={`item--${item.id}`}></span>
|
|
1155
|
+
<ListItemText primary={item.value} />
|
|
1156
|
+
</ListItem>
|
|
1157
|
+
))}
|
|
1158
|
+
</List>
|
|
1159
|
+
</Drawer>
|
|
1160
|
+
<div
|
|
1161
|
+
onDrop={dropHandler}
|
|
1162
|
+
ref={dropZone}
|
|
1163
|
+
style={{
|
|
1164
|
+
position: "absolute",
|
|
1165
|
+
left: "0",
|
|
1166
|
+
top: "0",
|
|
1167
|
+
backgroundColor: "rgba(255,255,255,0.5)",
|
|
1168
|
+
width: "100%",
|
|
1169
|
+
height: "100%",
|
|
1170
|
+
zIndex: zIndex,
|
|
1171
|
+
}}
|
|
1172
|
+
>
|
|
1173
|
+
<Typography
|
|
1174
|
+
variant="h6"
|
|
1175
|
+
style={{
|
|
1176
|
+
top: "50%",
|
|
1177
|
+
position: "absolute",
|
|
1178
|
+
left: "50%",
|
|
1179
|
+
msTransform: "translate(-50%, -50%)",
|
|
1180
|
+
transform: " translate(-50%, -50%)",
|
|
1181
|
+
}}
|
|
1182
|
+
noWrap
|
|
1183
|
+
>
|
|
1184
|
+
Gpx-Datei ablegen
|
|
1185
|
+
</Typography>
|
|
1186
|
+
</div>
|
|
1187
|
+
</>
|
|
1188
|
+
);
|
|
1189
1189
|
};
|
|
1190
1190
|
|
|
1191
1191
|
MlGPXViewer.defaultProps = {
|
|
1192
|
-
|
|
1192
|
+
visible: true,
|
|
1193
1193
|
};
|
|
1194
1194
|
|
|
1195
1195
|
|
|
@@ -1201,7 +1201,7 @@ export default MlGPXViewer;
|
|
|
1201
1201
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1202
1202
|
Code coverage generated by
|
|
1203
1203
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1204
|
-
at Tue
|
|
1204
|
+
at Tue Oct 04 2022 12:11:13 GMT+0000 (Coordinated Universal Time)
|
|
1205
1205
|
</div>
|
|
1206
1206
|
<script src="../../../prettify.js"></script>
|
|
1207
1207
|
<script>
|