@mapcomponents/react-maplibre 0.1.69 → 0.1.70
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/CHANGELOG.md +18 -0
- package/README.md +3 -2
- package/dist/components/MlCreatePdfButton/MlCreatePdfButton.d.ts +3 -3
- package/dist/components/MlCreatePdfForm/MlCreatePdfForm.d.ts +7 -2
- package/dist/components/MlCreatePngButton/MlCreatePngButton.d.ts +22 -0
- package/dist/components/MlCreatePngButton/MlCreatePngButton.stories.d.ts +14 -0
- package/dist/components/MlGpxViewer/util/{MetadataDrawer.d.ts → Metadata.d.ts} +1 -2
- package/dist/components/MlGpxViewer/util/MlGpxDemoLoader.d.ts +1 -1
- package/dist/hooks/useExportMap/lib.d.ts +16 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +284 -276
- package/dist/index.esm.js.map +1 -1
- package/dist/ui_components/Sidebar.d.ts +5 -3
- package/dist/ui_components/TopToolbar.d.ts +8 -7
- package/package.json +1 -2
- package/.babelrc +0 -22
- package/.editorconfig +0 -19
- package/.eslintignore +0 -12
- package/.eslintrc.js +0 -30
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -41
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -22
- package/.github/workflows/check-catalogue-metadata-schema.yml +0 -19
- package/.github/workflows/check-formatting.yml +0 -46
- package/.github/workflows/node_version_test.yml +0 -26
- package/.github/workflows/publish.yml +0 -21
- package/.github/workflows/storybook.yml +0 -28
- package/.prettierignore +0 -11
- package/.prettierrc.json +0 -6
- package/.storybook/.babelrc +0 -26
- package/.storybook/main.js +0 -40
- package/.storybook/manager.js +0 -6
- package/.storybook/mapcomponents_logo.png +0 -0
- package/.storybook/preview.js +0 -33
- package/.storybook/style.css +0 -15
- package/.storybook/wheregroupTheme.js +0 -9
- package/config/env.js +0 -106
- package/config/jest/babelTransform.js +0 -29
- package/config/jest/cssTransform.js +0 -14
- package/config/jest/fileTransform.js +0 -40
- package/config/paths.js +0 -75
- package/coverage/clover.xml +0 -2018
- package/coverage/coverage-final.json +0 -60
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -731
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +0 -466
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +0 -116
- package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +0 -322
- package/coverage/lcov-report/src/components/MlCenterPosition/index.html +0 -116
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +0 -238
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +0 -116
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx.html +0 -148
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +0 -196
- package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +0 -131
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +0 -535
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +0 -116
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +0 -340
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +0 -116
- package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +0 -808
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +0 -116
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +0 -469
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +0 -116
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js.html +0 -652
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js.html +0 -649
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx.html +0 -112
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx.html +0 -115
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/story_utils/index.html +0 -161
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +0 -469
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +0 -116
- package/coverage/lcov-report/src/components/MlGpxViewer/MlGpxViewer.tsx.html +0 -394
- package/coverage/lcov-report/src/components/MlGpxViewer/index.html +0 -116
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +0 -385
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +0 -116
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +0 -247
- package/coverage/lcov-report/src/components/MlLayer/index.html +0 -116
- package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +0 -745
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +0 -116
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +0 -520
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +0 -116
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +0 -736
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +0 -316
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +0 -116
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +0 -116
- package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +0 -505
- package/coverage/lcov-report/src/components/MlMarker/index.html +0 -116
- package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +0 -265
- package/coverage/lcov-report/src/components/MlMeasureTool/index.html +0 -116
- package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +0 -763
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +0 -116
- package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +0 -613
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +0 -116
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +0 -298
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +0 -232
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +0 -131
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.tsx.html +0 -412
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +0 -116
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.tsx.html +0 -892
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +0 -116
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/ColorPicker.tsx.html +0 -214
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerList.tsx.html +0 -121
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerListItem.tsx.html +0 -412
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx.html +0 -463
- package/coverage/lcov-report/src/components/MlSketchTool/LayerList/index.html +0 -161
- package/coverage/lcov-report/src/components/MlSketchTool/MlSketchTool.tsx.html +0 -898
- package/coverage/lcov-report/src/components/MlSketchTool/index.html +0 -116
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx.html +0 -514
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +0 -116
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +0 -703
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreejsLayer.tsx.html +0 -769
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +0 -131
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +0 -406
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +0 -116
- package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +0 -310
- package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +0 -116
- package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +0 -517
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +0 -116
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +0 -277
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +0 -116
- package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +0 -739
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +0 -116
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +0 -1102
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +0 -116
- package/coverage/lcov-report/src/contexts/MapContext.tsx.html +0 -403
- package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +0 -103
- package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +0 -277
- package/coverage/lcov-report/src/contexts/index.html +0 -146
- package/coverage/lcov-report/src/hooks/index.html +0 -191
- package/coverage/lcov-report/src/hooks/useCameraFollowPath/index.html +0 -116
- package/coverage/lcov-report/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx.html +0 -661
- package/coverage/lcov-report/src/hooks/useExportMap/index.html +0 -131
- package/coverage/lcov-report/src/hooks/useExportMap/index.ts.html +0 -175
- package/coverage/lcov-report/src/hooks/useExportMap/lib.ts.html +0 -559
- package/coverage/lcov-report/src/hooks/useGpx/index.html +0 -116
- package/coverage/lcov-report/src/hooks/useGpx/useGpx.tsx.html +0 -295
- package/coverage/lcov-report/src/hooks/useLayer.ts.html +0 -787
- package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +0 -232
- package/coverage/lcov-report/src/hooks/useLayerFilter/index.html +0 -116
- package/coverage/lcov-report/src/hooks/useLayerFilter/useLayerFilter.ts.html +0 -184
- package/coverage/lcov-report/src/hooks/useLayerHoverPopup/index.html +0 -116
- package/coverage/lcov-report/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx.html +0 -334
- package/coverage/lcov-report/src/hooks/useMap.ts.html +0 -358
- package/coverage/lcov-report/src/hooks/useMapState.ts.html +0 -631
- package/coverage/lcov-report/src/hooks/useSource.ts.html +0 -337
- package/coverage/lcov-report/src/hooks/useWms.ts.html +0 -397
- package/coverage/lcov-report/src/index.html +0 -116
- package/coverage/lcov-report/src/index.ts.html +0 -316
- package/coverage/lcov.info +0 -3987
- package/cypress/support/commands.ts +0 -37
- package/cypress/support/component-index.html +0 -12
- package/cypress/support/component.ts +0 -46
- package/cypress.config.ts +0 -101
- package/dist/components/MlCreatePdfButton/lib/createPdf.d.ts +0 -2
- package/dist/components/MlCreatePdfButton/lib/nominatimMap.d.ts +0 -2
- package/eslintErrorTest.js +0 -10
- package/public/assets/3D/godzilla_simple.glb +0 -0
- package/public/assets/dop.png +0 -0
- package/public/assets/historic.png +0 -0
- package/public/assets/marker.png +0 -0
- package/public/assets/osm.png +0 -0
- package/public/assets/sample.gpx +0 -716
- package/public/assets/sample1.gpx +0 -3003
- package/public/assets/sample2.gpx +0 -1264
- package/public/assets/sample3.gpx +0 -912
- package/public/assets/wg-marker.png +0 -0
- package/public/catalogue/.gitkeep +0 -0
- package/public/catalogue/mc_meta.json +0 -1
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -39
- package/public/logo.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/public/thumbnails/MapLibreMap.png +0 -0
- package/public/thumbnails/MlCameraFollowPath.png +0 -0
- package/public/thumbnails/MlCreatePdfButton.png +0 -0
- package/public/thumbnails/MlCreatePdfForm.png +0 -0
- package/public/thumbnails/MlDeckGlLayer.png +0 -0
- package/public/thumbnails/MlDeckGlTerrainLayer.png +0 -0
- package/public/thumbnails/MlDemoDashboard.png +0 -0
- package/public/thumbnails/MlFeatureEditor.png +0 -0
- package/public/thumbnails/MlFillExtrusionLayer.png +0 -0
- package/public/thumbnails/MlFollowGps.png +0 -0
- package/public/thumbnails/MlGeoJsonLayer.png +0 -0
- package/public/thumbnails/MlGpxViewer.png +0 -0
- package/public/thumbnails/MlHillshadeLayer.png +0 -0
- package/public/thumbnails/MlIconLayer.png +0 -0
- package/public/thumbnails/MlLaermkarte.png +0 -0
- package/public/thumbnails/MlLayerMagnify.png +0 -0
- package/public/thumbnails/MlLayerSwipe.png +0 -0
- package/public/thumbnails/MlMapDrawTools.png +0 -0
- package/public/thumbnails/MlMeasureTool.png +0 -0
- package/public/thumbnails/MlMobilerImker.png +0 -0
- package/public/thumbnails/MlNavigationCompass.png +0 -0
- package/public/thumbnails/MlNavigationTools.png +0 -0
- package/public/thumbnails/MlOsmLayer.png +0 -0
- package/public/thumbnails/MlScaleReference.png +0 -0
- package/public/thumbnails/MlSketchTool.png +0 -0
- package/public/thumbnails/MlSpatialElevationProfile.png +0 -0
- package/public/thumbnails/MlThreeJsLayer.png +0 -0
- package/public/thumbnails/MlTransitionGeoJsonLayer.png +0 -0
- package/public/thumbnails/MlVectorTileLayer.png +0 -0
- package/public/thumbnails/MlWanderApp.png +0 -0
- package/public/thumbnails/MlWmsLayer.png +0 -0
- package/public/thumbnails/MlWmsLoader.png +0 -0
- package/public/thumbnails/useCameraFollowPath.png +0 -0
- package/rollup.config.js +0 -74
- package/scripts/build-catalogue-markdown-docs.js +0 -28
- package/scripts/build-catalogue-meta.js +0 -42
- package/scripts/create-map-component.sh +0 -36
- package/scripts/test.js +0 -53
- package/src/@types/assets/index.d.ts +0 -20
- package/src/App.css +0 -0
- package/src/components/MapLibreMap/MapLibreMap.stories.js +0 -106
- package/src/components/MapLibreMap/MapLibreMap.test.js +0 -84
- package/src/components/MapLibreMap/MapLibreMap.tsx +0 -127
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.test.js +0 -395
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +0 -691
- package/src/components/MlBasicComponent.js +0 -39
- package/src/components/MlCenterPosition/MlCenterPosition.doc.de.md +0 -3
- package/src/components/MlCenterPosition/MlCenterPosition.meta_.json +0 -14
- package/src/components/MlCenterPosition/MlCenterPosition.stories.tsx +0 -20
- package/src/components/MlCenterPosition/MlCenterPosition.tsx +0 -79
- package/src/components/MlComponentTemplate/MlComponentTemplate.doc.de.md +0 -3
- package/src/components/MlComponentTemplate/MlComponentTemplate.meta_.json +0 -14
- package/src/components/MlComponentTemplate/MlComponentTemplate.stories.tsx +0 -20
- package/src/components/MlComponentTemplate/MlComponentTemplate.tsx +0 -42
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.doc.de.md +0 -1
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.doc.en.md +0 -1
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.meta_.json +0 -14
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.stories.tsx +0 -35
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx +0 -51
- package/src/components/MlCreatePdfButton/lib/createPdf.ts +0 -189
- package/src/components/MlCreatePdfButton/lib/nominatimMap.ts +0 -57
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.cy.tsx +0 -21
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.doc.de.md +0 -3
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.meta.json +0 -14
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.stories.tsx +0 -165
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx +0 -37
- package/src/components/MlCreatePdfForm/lib/PdfContext.tsx +0 -51
- package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +0 -257
- package/src/components/MlCreatePdfForm/lib/PdfPreview.tsx +0 -327
- package/src/components/MlCreatePdfForm/lib/_PdfPreview.tsx +0 -399
- package/src/components/MlCreatePdfForm/lib/pdf.templates.ts +0 -82
- package/src/components/MlCreatePdfForm/lib/pdfContext.d.ts +0 -24
- package/src/components/MlCreatePdfForm/lib/preview.css +0 -114
- package/src/components/MlFeatureEditor/MlFeatureEditor.css +0 -0
- package/src/components/MlFeatureEditor/MlFeatureEditor.doc.de.md +0 -1
- package/src/components/MlFeatureEditor/MlFeatureEditor.doc.en.md +0 -1
- package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +0 -14
- package/src/components/MlFeatureEditor/MlFeatureEditor.stories.js +0 -91
- package/src/components/MlFeatureEditor/MlFeatureEditor.test.js +0 -126
- package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +0 -150
- package/src/components/MlFeatureEditor/custom-direct-select-mode.js +0 -303
- package/src/components/MlFeatureEditor/custom-polygon-mode.js +0 -188
- package/src/components/MlFeatureEditor/custom-select-mode.js +0 -406
- package/src/components/MlFeatureEditor/lib/LICENSE.md +0 -18
- package/src/components/MlFeatureEditor/lib/common_selectors.js +0 -72
- package/src/components/MlFeatureEditor/lib/constants.js +0 -104
- package/src/components/MlFeatureEditor/lib/constrain_feature_movement.js +0 -72
- package/src/components/MlFeatureEditor/lib/create_midpoint.js +0 -42
- package/src/components/MlFeatureEditor/lib/create_supplementary_points.js +0 -102
- package/src/components/MlFeatureEditor/lib/create_vertex.js +0 -35
- package/src/components/MlFeatureEditor/lib/double_click_zoom.js +0 -30
- package/src/components/MlFeatureEditor/lib/euclidean_distance.js +0 -9
- package/src/components/MlFeatureEditor/lib/features_at.js +0 -52
- package/src/components/MlFeatureEditor/lib/get_features_and_set_cursor.js +0 -28
- package/src/components/MlFeatureEditor/lib/is_click.js +0 -22
- package/src/components/MlFeatureEditor/lib/is_event_at_coordinates.js +0 -10
- package/src/components/MlFeatureEditor/lib/is_tap.js +0 -19
- package/src/components/MlFeatureEditor/lib/map_event_to_bounding_box.js +0 -18
- package/src/components/MlFeatureEditor/lib/mode_handler.js +0 -120
- package/src/components/MlFeatureEditor/lib/mouse_event_point.js +0 -23
- package/src/components/MlFeatureEditor/lib/move_features.js +0 -47
- package/src/components/MlFeatureEditor/lib/sort_features.js +0 -45
- package/src/components/MlFeatureEditor/lib/string_set.js +0 -59
- package/src/components/MlFeatureEditor/lib/string_sets_are_equal.js +0 -8
- package/src/components/MlFeatureEditor/lib/theme.js +0 -236
- package/src/components/MlFeatureEditor/lib/to_dense_array.js +0 -15
- package/src/components/MlFeatureEditor/lib/utils.js +0 -51
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.doc.de.md +0 -1
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.doc.en.md +0 -1
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.meta.json +0 -14
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.stories.js +0 -24
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.test.js +0 -15
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx +0 -85
- package/src/components/MlFollowGps/MlFollowGps.doc.de.md +0 -1
- package/src/components/MlFollowGps/MlFollowGps.doc.en.md +0 -1
- package/src/components/MlFollowGps/MlFollowGps.meta.json +0 -14
- package/src/components/MlFollowGps/MlFollowGps.stories.js +0 -40
- package/src/components/MlFollowGps/MlFollowGps.test.js +0 -63
- package/src/components/MlFollowGps/MlFollowGps.tsx +0 -241
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.doc.de.md +0 -1
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.doc.en.md +0 -1
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.meta.json +0 -14
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.tsx +0 -191
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.test.js +0 -20
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +0 -128
- package/src/components/MlGeoJsonLayer/assets/earthquake.json +0 -109937
- package/src/components/MlGeoJsonLayer/assets/sample_1.json +0 -140
- package/src/components/MlGeoJsonLayer/assets/sample_2.json +0 -142
- package/src/components/MlGeoJsonLayer/assets/sample_polygon_1.json +0 -33
- package/src/components/MlGeoJsonLayer/assets/wg_locations.json +0 -65
- package/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.js +0 -189
- package/src/components/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.js +0 -188
- package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerCircleStyler.tsx +0 -9
- package/src/components/MlGeoJsonLayer/story_utils/MlGeojsonLayerHeatMapStyler.tsx +0 -10
- package/src/components/MlGeoJsonLayer/util/getDefaultLayerTypeByGeometry.ts +0 -31
- package/src/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.ts +0 -37
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.doc.de.md +0 -3
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.meta_.json +0 -14
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.stories.tsx +0 -19
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx +0 -128
- package/src/components/MlGpxViewer/MlGpxViewer.doc.de.md +0 -1
- package/src/components/MlGpxViewer/MlGpxViewer.doc.en.md +0 -1
- package/src/components/MlGpxViewer/MlGpxViewer.meta.json +0 -14
- package/src/components/MlGpxViewer/MlGpxViewer.stories.tsx +0 -100
- package/src/components/MlGpxViewer/MlGpxViewer.test.js +0 -53
- package/src/components/MlGpxViewer/MlGpxViewer.tsx +0 -103
- package/src/components/MlGpxViewer/util/GeoJsonContext.ts +0 -13
- package/src/components/MlGpxViewer/util/GeoJsonProvider.tsx +0 -25
- package/src/components/MlGpxViewer/util/MetadataDrawer.tsx +0 -38
- package/src/components/MlGpxViewer/util/MlGpxDemoLoader.tsx +0 -130
- package/src/components/MlGpxViewer/util/MlGpxViewerInstructions.tsx +0 -71
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.doc.de.md +0 -3
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.meta_.json +0 -14
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.tsx +0 -41
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +0 -38
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx +0 -100
- package/src/components/MlLayer/MlLayer.doc.de.md +0 -3
- package/src/components/MlLayer/MlLayer.meta_.json +0 -14
- package/src/components/MlLayer/MlLayer.test.js +0 -117
- package/src/components/MlLayer/MlLayer.tsx +0 -54
- package/src/components/MlLayerMagnify/MlLayerMagnify.doc.de.md +0 -1
- package/src/components/MlLayerMagnify/MlLayerMagnify.doc.en.md +0 -1
- package/src/components/MlLayerMagnify/MlLayerMagnify.meta.json +0 -14
- package/src/components/MlLayerMagnify/MlLayerMagnify.stories.tsx +0 -44
- package/src/components/MlLayerMagnify/MlLayerMagnify.test.tsx +0 -83
- package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +0 -220
- package/src/components/MlLayerMagnify/style.css +0 -48
- package/src/components/MlLayerSwipe/MlLayerSwipe.doc.de.md +0 -1
- package/src/components/MlLayerSwipe/MlLayerSwipe.doc.en.md +0 -1
- package/src/components/MlLayerSwipe/MlLayerSwipe.meta.json +0 -14
- package/src/components/MlLayerSwipe/MlLayerSwipe.stories.tsx +0 -36
- package/src/components/MlLayerSwipe/MlLayerSwipe.test.js +0 -86
- package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +0 -145
- package/src/components/MlLayerSwipe/style.css +0 -48
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.css +0 -17
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.doc.de.md +0 -3
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.js +0 -217
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.meta_.json +0 -14
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.stories.js +0 -103
- package/src/components/MlLayerSwitcher/assets/sample_1.json +0 -26
- package/src/components/MlLayerSwitcher/assets/sample_2.json +0 -22
- package/src/components/MlLayerSwitcher/components/LayerBox.js +0 -77
- package/src/components/MlMarker/MlMarker.doc.de.md +0 -3
- package/src/components/MlMarker/MlMarker.meta_.json +0 -14
- package/src/components/MlMarker/MlMarker.stories.js +0 -22
- package/src/components/MlMarker/MlMarker.tsx +0 -140
- package/src/components/MlMeasureTool/MlMeasureTool.doc.de.md +0 -3
- package/src/components/MlMeasureTool/MlMeasureTool.meta.json +0 -14
- package/src/components/MlMeasureTool/MlMeasureTool.stories.js +0 -96
- package/src/components/MlMeasureTool/MlMeasureTool.tsx +0 -60
- package/src/components/MlNavigationCompass/MlNavigationCompass.doc.de.md +0 -1
- package/src/components/MlNavigationCompass/MlNavigationCompass.doc.en.md +0 -1
- package/src/components/MlNavigationCompass/MlNavigationCompass.meta.json +0 -14
- package/src/components/MlNavigationCompass/MlNavigationCompass.stories.js +0 -63
- package/src/components/MlNavigationCompass/MlNavigationCompass.test.js +0 -68
- package/src/components/MlNavigationCompass/MlNavigationCompass.tsx +0 -226
- package/src/components/MlNavigationCompass/assets/needle.svg +0 -17
- package/src/components/MlNavigationCompass/assets/needle__.svg +0 -19
- package/src/components/MlNavigationCompass/assets/rotate_left.svg +0 -13
- package/src/components/MlNavigationCompass/assets/rotate_right.svg +0 -15
- package/src/components/MlNavigationTools/MlNavigationTools.doc.de.md +0 -1
- package/src/components/MlNavigationTools/MlNavigationTools.doc.en.md +0 -1
- package/src/components/MlNavigationTools/MlNavigationTools.meta.json +0 -14
- package/src/components/MlNavigationTools/MlNavigationTools.stories.js +0 -64
- package/src/components/MlNavigationTools/MlNavigationTools.tsx +0 -176
- package/src/components/MlOsmLayer/MlOsmLayer.js +0 -71
- package/src/components/MlOsmLayer/MlOsmLayer.stories_.js +0 -49
- package/src/components/MlOsmLayer/MlOsmLayer.test.js +0 -19
- package/src/components/MlScaleReference/MlScaleReference.doc.de.md +0 -1
- package/src/components/MlScaleReference/MlScaleReference.doc.en.md +0 -1
- package/src/components/MlScaleReference/MlScaleReference.meta.json +0 -14
- package/src/components/MlScaleReference/MlScaleReference.stories.js +0 -51
- package/src/components/MlScaleReference/MlScaleReference.tsx +0 -109
- package/src/components/MlShareMapState/MlShareMapState.doc.de.md +0 -3
- package/src/components/MlShareMapState/MlShareMapState.meta_.json +0 -14
- package/src/components/MlShareMapState/MlShareMapState.stories.tsx +0 -100
- package/src/components/MlShareMapState/MlShareMapState.tsx +0 -269
- package/src/components/MlSketchTool/LayerList/ColorPicker.tsx +0 -43
- package/src/components/MlSketchTool/LayerList/LayerList.tsx +0 -12
- package/src/components/MlSketchTool/LayerList/LayerListItem.tsx +0 -109
- package/src/components/MlSketchTool/LayerList/LayerPropertyForm.tsx +0 -126
- package/src/components/MlSketchTool/MlSketchTool.doc.de.md +0 -3
- package/src/components/MlSketchTool/MlSketchTool.meta.json +0 -14
- package/src/components/MlSketchTool/MlSketchTool.stories.tsx +0 -26
- package/src/components/MlSketchTool/MlSketchTool.tsx +0 -271
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.doc.de.md +0 -1
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.doc.en.md +0 -1
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.meta.json +0 -14
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.tsx +0 -121
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.test.js +0 -48
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.tsx +0 -143
- package/src/components/MlSpatialElevationProfile/util/getElevationData.tsx +0 -103
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.doc.de.md +0 -1
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.doc.en.md +0 -1
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.js +0 -207
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.meta.json +0 -14
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.stories.tsx +0 -37
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.test.js +0 -33
- package/src/components/MlThreeJsLayer/MlThreejsLayer.tsx +0 -228
- package/src/components/MlThreeJsLayer/lib/GLTFLoader.js +0 -3331
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.doc.de.md +0 -3
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.meta.json +0 -14
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.stories.js +0 -52
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.test.js +0 -20
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx +0 -107
- package/src/components/MlTransitionGeoJsonLayer/assets/sample_1.json +0 -26
- package/src/components/MlTransitionGeoJsonLayer/assets/sample_2.json +0 -22
- package/src/components/MlTransitionGeoJsonLayer/assets/sample_polygon_1.json +0 -33
- package/src/components/MlTransitionGeoJsonLayer/util/transitionFunctions.js +0 -221
- package/src/components/MlUseMapDebugger/MlUseMapDebugger.doc.de.md +0 -3
- package/src/components/MlUseMapDebugger/MlUseMapDebugger.js +0 -75
- package/src/components/MlUseMapDebugger/MlUseMapDebugger.meta_.json +0 -14
- package/src/components/MlUseMapDebugger/MlUseMapDebugger.stories.js +0 -30
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.doc.de.md +0 -1
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.doc.en.md +0 -1
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.meta.json +0 -14
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.stories.js +0 -52
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.test.js +0 -40
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +0 -144
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.doc.de.md +0 -3
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js +0 -64
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.meta_.json +0 -14
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.stories.tsx +0 -22
- package/src/components/MlWmsLayer/MlWmsLayer.stories.js +0 -49
- package/src/components/MlWmsLayer/MlWmsLayer.test.js +0 -19
- package/src/components/MlWmsLayer/MlWmsLayer.tsx +0 -218
- package/src/components/MlWmsLoader/MlWmsLoader.doc.de.md +0 -1
- package/src/components/MlWmsLoader/MlWmsLoader.doc.en.md +0 -1
- package/src/components/MlWmsLoader/MlWmsLoader.meta.json +0 -14
- package/src/components/MlWmsLoader/MlWmsLoader.stories.tsx +0 -81
- package/src/components/MlWmsLoader/MlWmsLoader.tsx +0 -339
- package/src/components/MlWmsLoader/utils/MlWmsLoaderInstructions.tsx +0 -50
- package/src/components/MlWmsLoader/utils/WMSLinks.tsx +0 -128
- package/src/contexts/MapComponentsProvider.test.js +0 -260
- package/src/contexts/MapContext.tsx +0 -106
- package/src/contexts/SimpleDataContext.js +0 -6
- package/src/contexts/SimpleDataProvider.js +0 -64
- package/src/contexts/SimpleDataProvider.test.js +0 -68
- package/src/custom.d.ts +0 -4
- package/src/decorators/EmptyMapDecorator.js +0 -38
- package/src/decorators/MapContextDecorator.js +0 -39
- package/src/decorators/MapContextDecoratorHooks.js +0 -39
- package/src/decorators/MultiMapContextDecorator.js +0 -80
- package/src/decorators/NoNavToolsDecorator.js +0 -33
- package/src/decorators/ThemeDecorator.js +0 -24
- package/src/decorators/style.css +0 -34
- package/src/hooks/assets/pointWG.json +0 -13
- package/src/hooks/useCameraFollowPath/useCameraFollowPath.doc.de.md +0 -4
- package/src/hooks/useCameraFollowPath/useCameraFollowPath.doc.en.md +0 -1
- package/src/hooks/useCameraFollowPath/useCameraFollowPath.meta.json +0 -14
- package/src/hooks/useCameraFollowPath/useCameraFollowPath.stories.tsx +0 -192
- package/src/hooks/useCameraFollowPath/useCameraFollowPath.tsx +0 -192
- package/src/hooks/useExportMap/index.ts +0 -30
- package/src/hooks/useExportMap/lib.ts +0 -158
- package/src/hooks/useGpx/lib/gpxConverter.js +0 -521
- package/src/hooks/useGpx/useGpx.doc.de.md +0 -3
- package/src/hooks/useGpx/useGpx.meta_.json +0 -15
- package/src/hooks/useGpx/useGpx.stories.js +0 -20
- package/src/hooks/useGpx/useGpx.tsx +0 -70
- package/src/hooks/useLayer.test.js +0 -205
- package/src/hooks/useLayer.ts +0 -234
- package/src/hooks/useLayerEvent.js +0 -49
- package/src/hooks/useLayerFilter/useLayerFilter.doc.de.md +0 -3
- package/src/hooks/useLayerFilter/useLayerFilter.meta_.json +0 -14
- package/src/hooks/useLayerFilter/useLayerFilter.stories.tsx +0 -40
- package/src/hooks/useLayerFilter/useLayerFilter.ts +0 -33
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.doc.de.md +0 -3
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.meta_.json +0 -15
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.stories.js +0 -20
- package/src/hooks/useLayerHoverPopup/useLayerHoverPopup.tsx +0 -83
- package/src/hooks/useMap.test.tsx +0 -48
- package/src/hooks/useMap.ts +0 -91
- package/src/hooks/useMapState.stories.js +0 -120
- package/src/hooks/useMapState.ts +0 -182
- package/src/hooks/useSource.ts +0 -84
- package/src/hooks/useSources.stories.js +0 -232
- package/src/hooks/useWms.ts +0 -104
- package/src/index.ts +0 -78
- package/src/setupTests.js +0 -113
- package/src/stories/components/Readme.js +0 -7
- package/src/ui_components/Dropzone.tsx +0 -104
- package/src/ui_components/ImageLoader.tsx +0 -83
- package/src/ui_components/LayerList/LayerList.stories.tsx +0 -136
- package/src/ui_components/LayerList/LayerList.tsx +0 -12
- package/src/ui_components/LayerList/LayerListFolder.tsx +0 -82
- package/src/ui_components/LayerList/LayerListItem.tsx +0 -180
- package/src/ui_components/LayerList/assets/sample_1.json +0 -26
- package/src/ui_components/LayerList/assets/sample_2.json +0 -22
- package/src/ui_components/LayerList/assets/sample_polygon_1.json +0 -33
- package/src/ui_components/LayerList/assets/style.json +0 -2599
- package/src/ui_components/LayerList/util/LayerListItemVectorLayer.tsx +0 -92
- package/src/ui_components/LayerList/util/LayerPropertyForm.tsx +0 -125
- package/src/ui_components/LayerList/util/input/ColorPicker.tsx +0 -44
- package/src/ui_components/LoadingOverlay.css +0 -9
- package/src/ui_components/LoadingOverlayContext.tsx +0 -79
- package/src/ui_components/MapcomponentsTheme.tsx +0 -133
- package/src/ui_components/Sidebar.tsx +0 -87
- package/src/ui_components/Tooltip.tsx +0 -17
- package/src/ui_components/TopToolbar.tsx +0 -24
- package/src/ui_components/UploadButton.tsx +0 -57
- package/src/util/BubbleForInstructions.js +0 -48
- package/src/util/Instructions.tsx +0 -60
- package/src/util/index.js +0 -4
- package/src/util/layerRemovalTest.js +0 -121
- package/src/util/sourceRemovalTest.js +0 -113
- package/tsconfig.json +0 -34
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import MlLayerSwipe from "./MlLayerSwipe";
|
|
2
|
-
|
|
3
|
-
import React, { useContext, useState } from "react";
|
|
4
|
-
import { mount } from "enzyme";
|
|
5
|
-
import MapContext, { MapComponentsProvider } from "../../contexts/MapContext";
|
|
6
|
-
import MapLibreMap from "./../MapLibreMap/MapLibreMap";
|
|
7
|
-
import syncMove from "@mapbox/mapbox-gl-sync-move";
|
|
8
|
-
// Mapbox sync-move mockup
|
|
9
|
-
var mockSyncMoveMethods = {
|
|
10
|
-
cleanup: jest.fn(),
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
jest.mock("@mapbox/mapbox-gl-sync-move", () => {
|
|
14
|
-
const originalModule = jest.requireActual("@mapbox/mapbox-gl-sync-move");
|
|
15
|
-
return {
|
|
16
|
-
__esModule: true,
|
|
17
|
-
...originalModule,
|
|
18
|
-
default: () => mockSyncMoveMethods.cleanup,
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const syncMoveObj = {
|
|
23
|
-
syncMove: syncMove,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const TestComponent = (props) => {
|
|
27
|
-
const [layerVisible, setLayerVisible] = useState(true);
|
|
28
|
-
const [refreshTrigger, setRefreshTrigger] = useState(0);
|
|
29
|
-
const mapContext = useContext(MapContext);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<>
|
|
33
|
-
<MapLibreMap mapId="map_1" />
|
|
34
|
-
<MapLibreMap mapId="map_2" />
|
|
35
|
-
|
|
36
|
-
{layerVisible && <MlLayerSwipe map1Id="map_1" map2Id="map_2" />}
|
|
37
|
-
|
|
38
|
-
<button
|
|
39
|
-
className="toggle_layer_visible"
|
|
40
|
-
onClick={() => {
|
|
41
|
-
setLayerVisible(!layerVisible);
|
|
42
|
-
}}
|
|
43
|
-
>
|
|
44
|
-
toggle layer visible
|
|
45
|
-
</button>
|
|
46
|
-
<button
|
|
47
|
-
className="trigger_refresh"
|
|
48
|
-
onClick={() => {
|
|
49
|
-
setRefreshTrigger(refreshTrigger + 1);
|
|
50
|
-
}}
|
|
51
|
-
>
|
|
52
|
-
refresh
|
|
53
|
-
</button>
|
|
54
|
-
<div className="layers_json">
|
|
55
|
-
{mapContext.map && refreshTrigger && JSON.stringify(mapContext.map.layers)}
|
|
56
|
-
</div>
|
|
57
|
-
</>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const createWrapper = () =>
|
|
62
|
-
mount(
|
|
63
|
-
<MapComponentsProvider>
|
|
64
|
-
<TestComponent />
|
|
65
|
-
</MapComponentsProvider>
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
describe("<MlLayerSwipe/>", () => {
|
|
69
|
-
//it("should add a MlLayerSwipe Component to that calls syncMaps with both available MapLibre instances once", async () => {
|
|
70
|
-
// const spy = jest.spyOn(syncMoveObj, "syncMove");
|
|
71
|
-
// const wrapper = createWrapper(TestComponent);
|
|
72
|
-
|
|
73
|
-
// expect(spy).toHaveBeenCalledTimes(1);
|
|
74
|
-
//});
|
|
75
|
-
|
|
76
|
-
it("should call the syncMaps cleanup function once when it is removed from reactDOM", async () => {
|
|
77
|
-
const wrapper = createWrapper(TestComponent);
|
|
78
|
-
|
|
79
|
-
//expect(syncMove).toHaveBeenCalledTimes(1);
|
|
80
|
-
|
|
81
|
-
wrapper.find(".toggle_layer_visible").simulate("click");
|
|
82
|
-
|
|
83
|
-
//TODO: Fix cleanup test
|
|
84
|
-
expect(mockSyncMoveMethods.cleanup).toHaveBeenCalledTimes(1);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useCallback, useRef, useEffect, useState } from 'react';
|
|
2
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import syncMove from '@mapbox/mapbox-gl-sync-move';
|
|
5
|
-
import './style.css';
|
|
6
|
-
import MapContext, { MapContextType } from '../../contexts/MapContext';
|
|
7
|
-
|
|
8
|
-
export interface MlLayerSwipeProps {
|
|
9
|
-
/**
|
|
10
|
-
* Id of the first MapLibre instance.
|
|
11
|
-
*/
|
|
12
|
-
map1Id: string;
|
|
13
|
-
/**
|
|
14
|
-
* Id of the second MapLibre instance.
|
|
15
|
-
*/
|
|
16
|
-
map2Id: string;
|
|
17
|
-
/**
|
|
18
|
-
* object (React.CSSProperties) that is added to the button default style
|
|
19
|
-
*/
|
|
20
|
-
buttonStyle: React.CSSProperties | undefined;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* creates a split view of 2 synchronised maplibre instances
|
|
25
|
-
*/
|
|
26
|
-
const MlLayerSwipe = (props: MlLayerSwipeProps) => {
|
|
27
|
-
const mapContext: MapContextType = useContext(MapContext);
|
|
28
|
-
const initializedRef = useRef(false);
|
|
29
|
-
|
|
30
|
-
const [swipeX, setSwipeX] = useState(50);
|
|
31
|
-
const swipeXRef = useRef(0);
|
|
32
|
-
|
|
33
|
-
const syncCleanupFunctionRef = useRef(() => {});
|
|
34
|
-
|
|
35
|
-
const mapExists = useCallback(() => {
|
|
36
|
-
if (!props.map1Id || !props.map2Id) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
if (!mapContext.getMap(props.map1Id) || !mapContext.getMap(props.map2Id)) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return true;
|
|
44
|
-
}, [mapContext, props.map1Id, props.map2Id]);
|
|
45
|
-
|
|
46
|
-
const cleanup = () => {
|
|
47
|
-
syncCleanupFunctionRef.current();
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const onMove = useCallback(
|
|
51
|
-
(e:(TouchEvent & MouseEvent)) => {
|
|
52
|
-
if (!mapExists()) return;
|
|
53
|
-
|
|
54
|
-
const bounds = mapContext.maps[props.map1Id].getCanvas().getBoundingClientRect();
|
|
55
|
-
let clientX =
|
|
56
|
-
e.clientX ||
|
|
57
|
-
(typeof e.touches !== 'undefined' && typeof e.touches[0] !== 'undefined'
|
|
58
|
-
? e.touches[0].clientX
|
|
59
|
-
: 0);
|
|
60
|
-
|
|
61
|
-
clientX -= bounds.x;
|
|
62
|
-
const swipeX_tmp = parseFloat(((clientX / bounds.width) * 100).toFixed(2));
|
|
63
|
-
|
|
64
|
-
if (swipeXRef.current !== swipeX_tmp) {
|
|
65
|
-
setSwipeX(swipeX_tmp);
|
|
66
|
-
swipeXRef.current = swipeX_tmp;
|
|
67
|
-
|
|
68
|
-
const clipA = 'rect(0, ' + (swipeXRef.current * bounds.width) / 100 + 'px, 999em, 0)';
|
|
69
|
-
|
|
70
|
-
mapContext.maps[props.map2Id].getContainer().style.clip = clipA;
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
[mapContext, mapExists, props.map1Id, props.map2Id]
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
return cleanup;
|
|
78
|
-
}, []);
|
|
79
|
-
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
if (!mapExists() || initializedRef.current) return;
|
|
82
|
-
|
|
83
|
-
initializedRef.current = true;
|
|
84
|
-
syncCleanupFunctionRef.current = syncMove(
|
|
85
|
-
mapContext.getMap(props.map1Id).map,
|
|
86
|
-
mapContext.getMap(props.map2Id).map
|
|
87
|
-
);
|
|
88
|
-
onMove({
|
|
89
|
-
clientX: mapContext.maps[props.map1Id].getCanvas().clientWidth / 2,
|
|
90
|
-
} as (TouchEvent & MouseEvent));
|
|
91
|
-
}, [mapContext.mapIds, mapContext, props, onMove, mapExists]);
|
|
92
|
-
|
|
93
|
-
const onDown = (e: React.MouseEvent | React.TouchEvent) => {
|
|
94
|
-
if (e.nativeEvent instanceof TouchEvent) {
|
|
95
|
-
document.addEventListener('touchmove', onMove);
|
|
96
|
-
document.addEventListener('touchend', onTouchEnd);
|
|
97
|
-
} else {
|
|
98
|
-
document.addEventListener('mousemove', onMove);
|
|
99
|
-
document.addEventListener('mouseup', onMouseUp);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const onTouchEnd = () => {
|
|
104
|
-
document.removeEventListener('touchmove', onMove);
|
|
105
|
-
document.removeEventListener('touchend', onTouchEnd);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const onMouseUp = () => {
|
|
109
|
-
document.removeEventListener('mousemove', onMove);
|
|
110
|
-
document.removeEventListener('mouseup', onMouseUp);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
return (
|
|
114
|
-
<div
|
|
115
|
-
style={{
|
|
116
|
-
position: 'absolute',
|
|
117
|
-
left: swipeX + '%',
|
|
118
|
-
top: '50%',
|
|
119
|
-
borderRadius: '50%',
|
|
120
|
-
width: '100px',
|
|
121
|
-
height: '100px',
|
|
122
|
-
background: '#0066ff',
|
|
123
|
-
border: '3px solid #eaebf1',
|
|
124
|
-
cursor: 'pointer',
|
|
125
|
-
zIndex: '110',
|
|
126
|
-
marginLeft: '-50px',
|
|
127
|
-
marginTop: '-50px',
|
|
128
|
-
textAlign: 'center',
|
|
129
|
-
lineHeight: '91px',
|
|
130
|
-
fontSize: '2em',
|
|
131
|
-
color: '#fafafa',
|
|
132
|
-
userSelect: 'none',
|
|
133
|
-
...props.buttonStyle,
|
|
134
|
-
}}
|
|
135
|
-
onTouchStart={onDown}
|
|
136
|
-
onMouseDown={onDown}
|
|
137
|
-
></div>
|
|
138
|
-
);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
MlLayerSwipe.defaultProps = {
|
|
142
|
-
buttonStyle: {},
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export default MlLayerSwipe;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
.mapboxgl-compare {
|
|
2
|
-
background-color:#fff;
|
|
3
|
-
position:absolute;
|
|
4
|
-
width:2px;
|
|
5
|
-
height:100%;
|
|
6
|
-
z-index:110;
|
|
7
|
-
top: 0;
|
|
8
|
-
margin-left:0;
|
|
9
|
-
left:0;
|
|
10
|
-
}
|
|
11
|
-
.mapboxgl-compare .compare-swiper-vertical {
|
|
12
|
-
z-index:120;
|
|
13
|
-
background-color:#3887be;
|
|
14
|
-
box-shadow:inset 0 0 0 2px #fff;
|
|
15
|
-
display:inline-block;
|
|
16
|
-
border-radius:50%;
|
|
17
|
-
position:absolute;
|
|
18
|
-
width:60px;
|
|
19
|
-
height:60px;
|
|
20
|
-
top:50%;
|
|
21
|
-
left:-30px;
|
|
22
|
-
margin:-30px 1px 0;
|
|
23
|
-
color: #fff;
|
|
24
|
-
cursor:ew-resize;
|
|
25
|
-
background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgICB4bWxuczpzb2RpcG9kaT0iaHR0cDovL3NvZGlwb2RpLnNvdXJjZWZvcmdlLm5ldC9EVEQvc29kaXBvZGktMC5kdGQiICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiICAgd2lkdGg9IjYwIiAgIGhlaWdodD0iNjAiICAgdmVyc2lvbj0iMS4xIiAgIHZpZXdCb3g9IjAgMCA2MCA2MCIgICBpZD0ic3ZnNTQzNCIgICBpbmtzY2FwZTp2ZXJzaW9uPSIwLjkxK2RldmVsK29zeG1lbnUgcjEyOTExIiAgIHNvZGlwb2RpOmRvY25hbWU9Imwtci5zdmciPiAgPG1ldGFkYXRhICAgICBpZD0ibWV0YWRhdGE1NDQ0Ij4gICAgPHJkZjpSREY+ICAgICAgPGNjOldvcmsgICAgICAgICByZGY6YWJvdXQ9IiI+ICAgICAgICA8ZGM6Zm9ybWF0PmltYWdlL3N2Zyt4bWw8L2RjOmZvcm1hdD4gICAgICAgIDxkYzp0eXBlICAgICAgICAgICByZGY6cmVzb3VyY2U9Imh0dHA6Ly9wdXJsLm9yZy9kYy9kY21pdHlwZS9TdGlsbEltYWdlIiAvPiAgICAgICAgPGRjOnRpdGxlPjwvZGM6dGl0bGU+ICAgICAgPC9jYzpXb3JrPiAgICA8L3JkZjpSREY+ICA8L21ldGFkYXRhPiAgPGRlZnMgICAgIGlkPSJkZWZzNTQ0MiIgLz4gIDxzb2RpcG9kaTpuYW1lZHZpZXcgICAgIHBhZ2Vjb2xvcj0iI2ZmZmZmZiIgICAgIGJvcmRlcmNvbG9yPSIjNjY2NjY2IiAgICAgYm9yZGVyb3BhY2l0eT0iMSIgICAgIG9iamVjdHRvbGVyYW5jZT0iMTAiICAgICBncmlkdG9sZXJhbmNlPSIxMCIgICAgIGd1aWRldG9sZXJhbmNlPSIxMCIgICAgIGlua3NjYXBlOnBhZ2VvcGFjaXR5PSIwIiAgICAgaW5rc2NhcGU6cGFnZXNoYWRvdz0iMiIgICAgIGlua3NjYXBlOndpbmRvdy13aWR0aD0iMTI4NiIgICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9Ijc1MSIgICAgIGlkPSJuYW1lZHZpZXc1NDQwIiAgICAgc2hvd2dyaWQ9InRydWUiICAgICBpbmtzY2FwZTp6b29tPSI0IiAgICAgaW5rc2NhcGU6Y3g9IjI1Ljg4OTgzMSIgICAgIGlua3NjYXBlOmN5PSIzNC4zODE4MzMiICAgICBpbmtzY2FwZTp3aW5kb3cteD0iMCIgICAgIGlua3NjYXBlOndpbmRvdy15PSIyMyIgICAgIGlua3NjYXBlOndpbmRvdy1tYXhpbWl6ZWQ9IjAiICAgICBpbmtzY2FwZTpjdXJyZW50LWxheWVyPSJzdmc1NDM0IiAgICAgaW5rc2NhcGU6b2JqZWN0LW5vZGVzPSJ0cnVlIiAgICAgaW5rc2NhcGU6c25hcC1zbW9vdGgtbm9kZXM9InRydWUiPiAgICA8aW5rc2NhcGU6Z3JpZCAgICAgICB0eXBlPSJ4eWdyaWQiICAgICAgIGlkPSJncmlkNTk4OSIgLz4gIDwvc29kaXBvZGk6bmFtZWR2aWV3PiAgPHBhdGggICAgIHN0eWxlPSJmaWxsOiNmZmZmZmY7ZmlsbC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlOm5vbmU7c3Ryb2tlLXdpZHRoOjFweDtzdHJva2UtbGluZWNhcDpidXR0O3N0cm9rZS1saW5lam9pbjptaXRlcjtzdHJva2Utb3BhY2l0eToxIiAgICAgZD0iTSAyNSAyNCBMIDE2IDMwIEwgMjUgMzYgTCAyNSAyNCB6IE0gMzUgMjQgTCAzNSAzNiBMIDQ0IDMwIEwgMzUgMjQgeiAiICAgICBpZD0icGF0aDU5OTUiIC8+PC9zdmc+);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.mapboxgl-compare-horizontal {
|
|
29
|
-
position:relative;
|
|
30
|
-
width:100%;
|
|
31
|
-
height:2px;
|
|
32
|
-
}
|
|
33
|
-
.mapboxgl-compare .compare-swiper-horizontal {
|
|
34
|
-
background-color:#3887be;
|
|
35
|
-
box-shadow:inset 0 0 0 2px #fff;
|
|
36
|
-
display:inline-block;
|
|
37
|
-
border-radius:50%;
|
|
38
|
-
position:absolute;
|
|
39
|
-
width:60px;
|
|
40
|
-
height:60px;
|
|
41
|
-
top:50%;
|
|
42
|
-
left:50%;
|
|
43
|
-
margin:-30px 1px 0;
|
|
44
|
-
color: #fff;
|
|
45
|
-
cursor:ns-resize;
|
|
46
|
-
background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIgICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgICB4bWxuczpzb2RpcG9kaT0iaHR0cDovL3NvZGlwb2RpLnNvdXJjZWZvcmdlLm5ldC9EVEQvc29kaXBvZGktMC5kdGQiICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiICAgd2lkdGg9IjYwIiAgIGhlaWdodD0iNjAiICAgdmVyc2lvbj0iMS4xIiAgIHZpZXdCb3g9IjAgMCA2MCA2MCIgICBpZD0ic3ZnNTQzNCIgICBpbmtzY2FwZTp2ZXJzaW9uPSIwLjkxK2RldmVsK29zeG1lbnUgcjEyOTExIiAgIHNvZGlwb2RpOmRvY25hbWU9Imwtci5zdmciPiAgPG1ldGFkYXRhICAgICBpZD0ibWV0YWRhdGE1NDQ0Ij4gICAgPHJkZjpSREY+ICAgICAgPGNjOldvcmsgICAgICAgICByZGY6YWJvdXQ9IiI+ICAgICAgICA8ZGM6Zm9ybWF0PmltYWdlL3N2Zyt4bWw8L2RjOmZvcm1hdD4gICAgICAgIDxkYzp0eXBlICAgICAgICAgICByZGY6cmVzb3VyY2U9Imh0dHA6Ly9wdXJsLm9yZy9kYy9kY21pdHlwZS9TdGlsbEltYWdlIiAvPiAgICAgICAgPGRjOnRpdGxlPjwvZGM6dGl0bGU+ICAgICAgPC9jYzpXb3JrPiAgICA8L3JkZjpSREY+ICA8L21ldGFkYXRhPiAgPGRlZnMgICAgIGlkPSJkZWZzNTQ0MiIgLz4gIDxzb2RpcG9kaTpuYW1lZHZpZXcgICAgIHBhZ2Vjb2xvcj0iI2ZmZmZmZiIgICAgIGJvcmRlcmNvbG9yPSIjNjY2NjY2IiAgICAgYm9yZGVyb3BhY2l0eT0iMSIgICAgIG9iamVjdHRvbGVyYW5jZT0iMTAiICAgICBncmlkdG9sZXJhbmNlPSIxMCIgICAgIGd1aWRldG9sZXJhbmNlPSIxMCIgICAgIGlua3NjYXBlOnBhZ2VvcGFjaXR5PSIwIiAgICAgaW5rc2NhcGU6cGFnZXNoYWRvdz0iMiIgICAgIGlua3NjYXBlOndpbmRvdy13aWR0aD0iMTI4NiIgICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9Ijc1MSIgICAgIGlkPSJuYW1lZHZpZXc1NDQwIiAgICAgc2hvd2dyaWQ9InRydWUiICAgICBpbmtzY2FwZTp6b29tPSI0IiAgICAgaW5rc2NhcGU6Y3g9IjI1Ljg4OTgzMSIgICAgIGlua3NjYXBlOmN5PSIzNC4zODE4MzMiICAgICBpbmtzY2FwZTp3aW5kb3cteD0iMCIgICAgIGlua3NjYXBlOndpbmRvdy15PSIyMyIgICAgIGlua3NjYXBlOndpbmRvdy1tYXhpbWl6ZWQ9IjAiICAgICBpbmtzY2FwZTpjdXJyZW50LWxheWVyPSJzdmc1NDM0IiAgICAgaW5rc2NhcGU6b2JqZWN0LW5vZGVzPSJ0cnVlIiAgICAgaW5rc2NhcGU6c25hcC1zbW9vdGgtbm9kZXM9InRydWUiPiAgICA8aW5rc2NhcGU6Z3JpZCAgICAgICB0eXBlPSJ4eWdyaWQiICAgICAgIGlkPSJncmlkNTk4OSIgLz4gIDwvc29kaXBvZGk6bmFtZWR2aWV3PiAgPHBhdGggICAgIHN0eWxlPSJmaWxsOiNmZmZmZmY7ZmlsbC1ydWxlOmV2ZW5vZGQ7c3Ryb2tlOm5vbmU7c3Ryb2tlLXdpZHRoOjFweDtzdHJva2UtbGluZWNhcDpidXR0O3N0cm9rZS1saW5lam9pbjptaXRlcjtzdHJva2Utb3BhY2l0eToxIiAgICAgZD0iTSAyNSAyNCBMIDE2IDMwIEwgMjUgMzYgTCAyNSAyNCB6IE0gMzUgMjQgTCAzNSAzNiBMIDQ0IDMwIEwgMzUgMjQgeiAiICAgICBpZD0icGF0aDU5OTUiIC8+PC9zdmc+);
|
|
47
|
-
transform: rotate(90deg)
|
|
48
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
.mllayerswitcher-layer-box.activeHighlight > .mllayerswitcher-layer-image {
|
|
2
|
-
border-color: rgb(181, 215, 238);
|
|
3
|
-
border-radius: 8px;
|
|
4
|
-
}
|
|
5
|
-
.mllayerswitcher-layer-box.activeHighlight > .mllayerswitcher-layer-text {
|
|
6
|
-
color: rgb(181, 215, 238) !important;
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.mllayerswitcher-layer-box.active > .mllayerswitcher-layer-image {
|
|
11
|
-
border-color: rgb(196, 240, 0);
|
|
12
|
-
border-radius: 8px;
|
|
13
|
-
}
|
|
14
|
-
.mllayerswitcher-layer-box.active > .mllayerswitcher-layer-text {
|
|
15
|
-
color: rgb(252, 0, 0) !important;
|
|
16
|
-
|
|
17
|
-
}
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import "./MlLayerSwitcher.css";
|
|
2
|
-
//External
|
|
3
|
-
import React, { useEffect, useContext, useState } from "react";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
|
-
import { useTranslation } from "react-i18next";
|
|
6
|
-
import { Card, CardContent, Typography, Box } from "@mui/material";
|
|
7
|
-
//Internal
|
|
8
|
-
import MapContext from "../../contexts/MapContext";
|
|
9
|
-
import LayerBox from "./components/LayerBox";
|
|
10
|
-
import Divider from "@mui/material/Divider";
|
|
11
|
-
import useMapState from "../../hooks/useMapState";
|
|
12
|
-
/**
|
|
13
|
-
* @component
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
const MlLayerSwitcher = (props) => {
|
|
18
|
-
const mapContext = useContext(MapContext);
|
|
19
|
-
const showBaseSources = !!props.baseSourceConfig?.layers?.length;
|
|
20
|
-
const showDetailLayer = !!props.detailLayerConfig?.layers?.length;
|
|
21
|
-
const { layers } = useMapState({
|
|
22
|
-
mapId: props.mapId,
|
|
23
|
-
watch: {
|
|
24
|
-
viewport: false,
|
|
25
|
-
layers: true,
|
|
26
|
-
sources: false,
|
|
27
|
-
},
|
|
28
|
-
filter: {},
|
|
29
|
-
});
|
|
30
|
-
const [activeLayers, setActiveLayers] = useState([]);
|
|
31
|
-
const [activeDetailLayers, setActiveDetailLayers] = useState([]);
|
|
32
|
-
const { t } = useTranslation();
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
//Set base state to activate only the first layer
|
|
36
|
-
if (mapContext.map) {
|
|
37
|
-
const disableAllButFirst = (config, i) => {
|
|
38
|
-
const layers = getLayerListFromId(config.layerId);
|
|
39
|
-
const visible = i === 0 ? "visible" : "none";
|
|
40
|
-
|
|
41
|
-
layers.forEach((layer) => {
|
|
42
|
-
if (layer) {
|
|
43
|
-
changeLayerState(layer, visible);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
props.baseSourceConfig.layers.forEach((config, i) => disableAllButFirst(config, i));
|
|
49
|
-
props.detailLayerConfig.layers.forEach((config, i) => disableAllButFirst(config, i));
|
|
50
|
-
}
|
|
51
|
-
return () => {
|
|
52
|
-
// This is the cleanup function, it is called when this react component is removed from react-dom
|
|
53
|
-
// try to remove anything this component has added to the MapLibre-gl instance
|
|
54
|
-
// e.g.: remove the layer
|
|
55
|
-
// mapContext.getMap(props.mapId).removeLayer(layerRef.current);
|
|
56
|
-
// check for the existence of map.style before calling getLayer or getSource
|
|
57
|
-
};
|
|
58
|
-
}, [mapContext.map]);
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
if (mapContext.map?.style?._layers) {
|
|
62
|
-
let newactiveLayers = [];
|
|
63
|
-
let newactiveDetailLayers = [];
|
|
64
|
-
props.baseSourceConfig.layers.forEach((layerConfig) => {
|
|
65
|
-
const layers = getLayerListFromId(layerConfig.layerId);
|
|
66
|
-
|
|
67
|
-
layers.forEach((layer) => {
|
|
68
|
-
const visibilty = mapContext.map?.getLayoutProperty(layer, "visibility");
|
|
69
|
-
if (mapContext.map.baseLayers.indexOf(layer) !== -1) {
|
|
70
|
-
layer = "styleBase";
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (newactiveLayers.indexOf(layer) === -1 && visibilty === "visible") {
|
|
74
|
-
newactiveLayers.push(layer);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
props.detailLayerConfig.layers.forEach(({ layerId }) => {
|
|
79
|
-
const visibilty = mapContext.map?.getLayoutProperty(layerId, "visibility");
|
|
80
|
-
if (newactiveDetailLayers.indexOf(layerId) === -1 && visibilty === "visible") {
|
|
81
|
-
newactiveDetailLayers.push(layerId);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
setActiveLayers(newactiveLayers);
|
|
85
|
-
|
|
86
|
-
setActiveDetailLayers(newactiveDetailLayers);
|
|
87
|
-
}
|
|
88
|
-
}, [layers]);
|
|
89
|
-
|
|
90
|
-
const getLayerListFromId = (id) => {
|
|
91
|
-
return id === "styleBase" ? mapContext?.map.baseLayers : [id];
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const handleDetailLayerBoxClick = (layerId) => {
|
|
95
|
-
const cfg = props.detailLayerConfig.layers.find((e) => e.layerId === layerId);
|
|
96
|
-
if (cfg.linkedTo) {
|
|
97
|
-
handleLayerBoxClick(cfg.linkedTo);
|
|
98
|
-
}
|
|
99
|
-
const nextVisiblityClickedLayer =
|
|
100
|
-
mapContext?.map.getLayer(layerId)?.getLayoutProperty("visibility") === "visible"
|
|
101
|
-
? "none"
|
|
102
|
-
: "visible";
|
|
103
|
-
changeLayerState(layerId, nextVisiblityClickedLayer);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const handleLayerBoxClick = (id) => {
|
|
107
|
-
let layers = getLayerListFromId(id);
|
|
108
|
-
const nextVisiblityClickedLayer =
|
|
109
|
-
mapContext?.map.getLayer(layers[0])?.getLayoutProperty("visibility") === "visible"
|
|
110
|
-
? "none"
|
|
111
|
-
: "visible";
|
|
112
|
-
|
|
113
|
-
props.baseSourceConfig.layers.forEach((config, i) => {
|
|
114
|
-
let layers = getLayerListFromId(config.layerId);
|
|
115
|
-
let visible = "none";
|
|
116
|
-
if (config.layerId === id) {
|
|
117
|
-
visible = nextVisiblityClickedLayer;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
//To avoid disabling all base layers we activate the first one
|
|
121
|
-
if (nextVisiblityClickedLayer === "none" && i === 0) {
|
|
122
|
-
visible = "visible";
|
|
123
|
-
}
|
|
124
|
-
layers.forEach((layer) => {
|
|
125
|
-
if (layer) {
|
|
126
|
-
changeLayerState(layer, visible);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const changeLayerState = (layer, visible = "none") => {
|
|
133
|
-
mapContext.map?.setLayoutProperty(layer, "visibility", visible);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
return (
|
|
137
|
-
<>
|
|
138
|
-
<Card sx={{ zIndex: 101, position: "absolute", minWidth: "200px" }}>
|
|
139
|
-
<CardContent>
|
|
140
|
-
{showBaseSources && (
|
|
141
|
-
<Box sx={{ minHeight: "150px" }}>
|
|
142
|
-
<Typography variant="h6">{t(props.baseSourceConfig.label || "Map type")}</Typography>
|
|
143
|
-
<Divider />
|
|
144
|
-
<Box sx={{ display: "flex", paddingTop: "1rem" }}>
|
|
145
|
-
{props.baseSourceConfig.layers.map(({ src, label, layerId }) => {
|
|
146
|
-
return (
|
|
147
|
-
<LayerBox
|
|
148
|
-
mapId={props.mapId}
|
|
149
|
-
key={layerId}
|
|
150
|
-
activeLayers={activeLayers}
|
|
151
|
-
label={t(label)}
|
|
152
|
-
layerId={layerId}
|
|
153
|
-
thumbnail={src}
|
|
154
|
-
handleLayerBoxClick={() => {
|
|
155
|
-
handleLayerBoxClick(layerId);
|
|
156
|
-
}}
|
|
157
|
-
/>
|
|
158
|
-
);
|
|
159
|
-
})}
|
|
160
|
-
</Box>
|
|
161
|
-
</Box>
|
|
162
|
-
)}
|
|
163
|
-
{showDetailLayer && (
|
|
164
|
-
<Box sx={{ minHeight: "150px" }}>
|
|
165
|
-
<Typography variant="h6">{t("Map details")}</Typography>
|
|
166
|
-
<Divider />
|
|
167
|
-
<Box sx={{ display: "flex", paddingTop: "1rem" }}>
|
|
168
|
-
{props.detailLayerConfig.layers.map(({ src, label, layerId }) => {
|
|
169
|
-
return (
|
|
170
|
-
<LayerBox
|
|
171
|
-
mapId={props.mapId}
|
|
172
|
-
activeLayers={activeDetailLayers}
|
|
173
|
-
label={t(label)}
|
|
174
|
-
layerId={layerId}
|
|
175
|
-
key={layerId}
|
|
176
|
-
thumbnail={src}
|
|
177
|
-
handleLayerBoxClick={() => {
|
|
178
|
-
handleDetailLayerBoxClick(layerId);
|
|
179
|
-
}}
|
|
180
|
-
/>
|
|
181
|
-
);
|
|
182
|
-
})}
|
|
183
|
-
</Box>
|
|
184
|
-
</Box>
|
|
185
|
-
)}
|
|
186
|
-
</CardContent>{" "}
|
|
187
|
-
</Card>
|
|
188
|
-
</>
|
|
189
|
-
);
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
MlLayerSwitcher.propTypes = {
|
|
193
|
-
baseSourceConfig: PropTypes.shape({
|
|
194
|
-
label: PropTypes.string,
|
|
195
|
-
layers: PropTypes.arrayOf(
|
|
196
|
-
PropTypes.shape({
|
|
197
|
-
layerId: PropTypes.string.isRequired,
|
|
198
|
-
src: PropTypes.string,
|
|
199
|
-
label: PropTypes.string.isRequired,
|
|
200
|
-
})
|
|
201
|
-
),
|
|
202
|
-
}),
|
|
203
|
-
detailLayerConfig: PropTypes.shape({
|
|
204
|
-
label: PropTypes.string,
|
|
205
|
-
layers: PropTypes.arrayOf(
|
|
206
|
-
PropTypes.shape({
|
|
207
|
-
layerId: PropTypes.string.isRequired,
|
|
208
|
-
src: PropTypes.string,
|
|
209
|
-
label: PropTypes.string.isRequired,
|
|
210
|
-
linkedTo: PropTypes.string,
|
|
211
|
-
})
|
|
212
|
-
),
|
|
213
|
-
}),
|
|
214
|
-
mapId: PropTypes.string,
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
export default MlLayerSwitcher;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import MlWmsLayer from "../MlWmsLayer/MlWmsLayer";
|
|
3
|
-
import MlLayerSwitcher from "./MlLayerSwitcher";
|
|
4
|
-
import MlGeoJsonLayer from "../MlGeoJsonLayer/MlGeoJsonLayer";
|
|
5
|
-
import mapContextDecorator from "../../decorators/MapContextDecorator";
|
|
6
|
-
import sample_geojson_1 from "./assets/sample_1.json";
|
|
7
|
-
import sample_geojson_2 from "./assets/sample_2.json";
|
|
8
|
-
|
|
9
|
-
const storyoptions = {
|
|
10
|
-
title: "MapComponents/MlLayerSwitcher",
|
|
11
|
-
component: MlLayerSwitcher,
|
|
12
|
-
argTypes: {
|
|
13
|
-
url: {},
|
|
14
|
-
layer: {},
|
|
15
|
-
},
|
|
16
|
-
decorators: mapContextDecorator,
|
|
17
|
-
};
|
|
18
|
-
export default storyoptions;
|
|
19
|
-
const Template = (args) => {
|
|
20
|
-
return (
|
|
21
|
-
<>
|
|
22
|
-
<MlWmsLayer
|
|
23
|
-
url={args.url}
|
|
24
|
-
urlParameters={{ layers: args.layer }}
|
|
25
|
-
sourceOptions={args.sourceOptions}
|
|
26
|
-
layerId="historic"
|
|
27
|
-
visible={args.layerVisible}
|
|
28
|
-
/>
|
|
29
|
-
<MlWmsLayer
|
|
30
|
-
url={args.url2}
|
|
31
|
-
urlParameters={{ layers: args.layer2 }}
|
|
32
|
-
sourceOptions={args.sourceOptions}
|
|
33
|
-
layerId={args.layer2}
|
|
34
|
-
visible={args.layer2Visible}
|
|
35
|
-
/>
|
|
36
|
-
<MlGeoJsonLayer
|
|
37
|
-
type="line"
|
|
38
|
-
layout={{ visibility: args.geojsonLayerVisible ? "visible" : "none" }}
|
|
39
|
-
geojson={sample_geojson_1}
|
|
40
|
-
layerId="geojson1"
|
|
41
|
-
/>
|
|
42
|
-
<MlGeoJsonLayer
|
|
43
|
-
type="line"
|
|
44
|
-
layout={{ visibility: args.geojson2LayerVisible ? "visible" : "none" }}
|
|
45
|
-
geojson={sample_geojson_2}
|
|
46
|
-
layerId="geojson2"
|
|
47
|
-
/>
|
|
48
|
-
<MlLayerSwitcher
|
|
49
|
-
baseSourceConfig={{
|
|
50
|
-
active: args.baseSourcesActive,
|
|
51
|
-
layers: args.layers,
|
|
52
|
-
}}
|
|
53
|
-
detailLayerConfig={args.detailLayerConfig}
|
|
54
|
-
/>
|
|
55
|
-
;
|
|
56
|
-
</>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const ExampleConfig = Template.bind({});
|
|
61
|
-
ExampleConfig.parameters = {};
|
|
62
|
-
ExampleConfig.args = {
|
|
63
|
-
url: "https://www.wms.nrw.de/geobasis/wms_nw_uraufnahme",
|
|
64
|
-
layer: "nw_uraufnahme_rw",
|
|
65
|
-
layerVisible: true,
|
|
66
|
-
url2: "https://www.wms.nrw.de/geobasis/wms_nw_dop",
|
|
67
|
-
layer2: "WMS_NW_DOP",
|
|
68
|
-
layer2Visible: false,
|
|
69
|
-
geojsonLayerVisible: true,
|
|
70
|
-
geojson2LayerVisible: true,
|
|
71
|
-
sourceOptions: {
|
|
72
|
-
minzoom: 13,
|
|
73
|
-
maxzoom: 20,
|
|
74
|
-
},
|
|
75
|
-
baseSourcesActive: true,
|
|
76
|
-
layers: [
|
|
77
|
-
{
|
|
78
|
-
label: "Historic",
|
|
79
|
-
layerId: "historic",
|
|
80
|
-
src: "assets/historic.png",
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
label: "Straßenkarte",
|
|
84
|
-
layerId: "styleBase",
|
|
85
|
-
src: "assets/osm.png",
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
label: "DOP",
|
|
89
|
-
layerId: "WMS_NW_DOP",
|
|
90
|
-
src: "assets/dop.png",
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
detailLayerConfig: {
|
|
94
|
-
layers: [
|
|
95
|
-
{
|
|
96
|
-
label: "GeoJson 1",
|
|
97
|
-
layerId: "geojson1",
|
|
98
|
-
src: "assets/historic.png",
|
|
99
|
-
active: true,
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "Feature",
|
|
3
|
-
"properties": {},
|
|
4
|
-
"geometry": {
|
|
5
|
-
"type": "LineString",
|
|
6
|
-
"coordinates": [
|
|
7
|
-
[7.1074676513671875, 50.74340774029213],
|
|
8
|
-
[7.0992279052734375, 50.756441089372665],
|
|
9
|
-
[7.079315185546874, 50.764693667025014],
|
|
10
|
-
[7.045669555664062, 50.77945780529241],
|
|
11
|
-
[7.030563354492187, 50.79161300845443],
|
|
12
|
-
[7.0291900634765625, 50.80940599750376],
|
|
13
|
-
[7.0236968994140625, 50.820685846099174],
|
|
14
|
-
[7.0085906982421875, 50.825891011253546],
|
|
15
|
-
[6.9879913330078125, 50.826758482363275],
|
|
16
|
-
[6.97906494140625, 50.835432306955276],
|
|
17
|
-
[6.9824981689453125, 50.84583876895451],
|
|
18
|
-
[6.9962310791015625, 50.85147463352982],
|
|
19
|
-
[7.012023925781249, 50.85710981721644],
|
|
20
|
-
[7.021636962890625, 50.86664473085768],
|
|
21
|
-
[7.0367431640625, 50.872278081520406],
|
|
22
|
-
[7.0477294921875, 50.877044231111014],
|
|
23
|
-
[7.052536010742187, 50.88397594225127]
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "Feature",
|
|
3
|
-
"properties": {},
|
|
4
|
-
"geometry": {
|
|
5
|
-
"type": "LineString",
|
|
6
|
-
"coordinates": [
|
|
7
|
-
[7.0635223388671875, 50.71385204707258],
|
|
8
|
-
[7.06146240234375, 50.709721458354075],
|
|
9
|
-
[7.063865661621094, 50.70298129536074],
|
|
10
|
-
[7.064552307128906, 50.69906720767511],
|
|
11
|
-
[7.059059143066406, 50.69428287906098],
|
|
12
|
-
[7.05596923828125, 50.68797551838366],
|
|
13
|
-
[7.0580291748046875, 50.680797145321655],
|
|
14
|
-
[7.062835693359375, 50.67514068397085],
|
|
15
|
-
[7.060432434082031, 50.6686131506577],
|
|
16
|
-
[7.051849365234375, 50.659255436656736],
|
|
17
|
-
[7.044639587402344, 50.6512019574539],
|
|
18
|
-
[7.0484161376953125, 50.64271166020676],
|
|
19
|
-
[7.0566558837890625, 50.63748609931014]
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
}
|