@mapcomponents/react-maplibre 0.1.32 → 0.1.35
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/.babelrc +3 -0
- package/.github/workflows/storybook.yml +1 -1
- package/.storybook/.babelrc +26 -0
- package/.storybook/main.js +15 -1
- package/.storybook/mapcomponents_logo.png +0 -0
- package/CHANGELOG.md +10 -0
- package/config/env.js +106 -0
- package/config/getHttpsConfig.js +66 -0
- package/config/jest/babelTransform.js +29 -0
- package/config/jest/cssTransform.js +14 -0
- package/config/jest/fileTransform.js +40 -0
- package/config/modules.js +134 -0
- package/config/paths.js +75 -0
- package/config/pnpTs.js +35 -0
- package/config/webpack.config.js +757 -0
- package/config/webpackDevServer.config.js +130 -0
- package/coverage/clover.xml +822 -900
- package/coverage/coverage-final.json +23 -24
- package/coverage/lcov-report/index.html +135 -150
- package/coverage/lcov-report/src/components/MapLibreMap/{MapLibreMap.js.html → MapLibreMap.tsx.html} +77 -68
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +6 -6
- package/coverage/lcov-report/src/components/MlCreatePdfButton/{MlCreatePdfButton.js.html → MlCreatePdfButton.tsx.html} +40 -43
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +10 -10
- package/coverage/lcov-report/src/components/MlFeatureEditor/{MlFeatureEditor.js.html → MlFeatureEditor.tsx.html} +145 -85
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +21 -21
- package/coverage/lcov-report/src/components/{MlImageMarkerLayer/MlImageMarkerLayer.js.html → MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html} +141 -111
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +20 -20
- package/coverage/lcov-report/src/components/MlFollowGps/{MlFollowGps.js.html → MlFollowGps.tsx.html} +177 -138
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +15 -15
- package/coverage/lcov-report/src/components/MlGPXViewer/{MlGPXViewer.js.html → MlGPXViewer.tsx.html} +134 -80
- package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/index.html +16 -16
- package/coverage/lcov-report/src/components/{MlLayer/MlLayer.js.html → MlGeoJsonLayer/MlGeoJsonLayer.tsx.html} +151 -154
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +19 -19
- package/coverage/lcov-report/src/components/{MlFillExtrusionLayer/MlFillExtrusionLayer.js.html → MlImageMarkerLayer/MlImageMarkerLayer.tsx.html} +151 -223
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +16 -16
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +229 -0
- package/coverage/lcov-report/src/components/MlLayer/index.html +21 -21
- package/coverage/lcov-report/src/components/MlLayerMagnify/{MlLayerMagnify.js.html → MlLayerMagnify.tsx.html} +134 -77
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +20 -20
- package/coverage/lcov-report/src/components/MlLayerSwipe/{MlLayerSwipe.js.html → MlLayerSwipe.tsx.html} +83 -41
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +2 -2
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +3 -15
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
- 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.js.html → MlMarker.tsx.html} +89 -137
- package/coverage/lcov-report/src/components/MlMarker/index.html +10 -10
- package/coverage/lcov-report/src/components/MlNavigationCompass/{MlNavigationCompass.js.html → MlNavigationCompass.tsx.html} +76 -25
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +17 -17
- package/coverage/lcov-report/src/components/MlNavigationTools/{MlNavigationTools.js.html → MlNavigationTools.tsx.html} +67 -52
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +10 -10
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +3 -3
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +5 -5
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/{MlTransitionGeoJsonLayer.js.html → MlTransitionGeoJsonLayer.tsx.html} +127 -118
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +11 -11
- package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/{MlVectorTileLayer.js.html → MlVectorTileLayer.tsx.html} +59 -11
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +2 -2
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/{MlWmsLayer.js.html → MlWmsLayer.tsx.html} +56 -11
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +2 -2
- package/coverage/lcov-report/src/components/MlWmsLoader/{MlWmsLoader.js.html → MlWmsLoader.tsx.html} +102 -78
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +8 -8
- package/coverage/lcov-report/src/hooks/index.html +44 -29
- package/coverage/lcov-report/src/{components/MlGeoJsonLayer/MlGeoJsonLayer.js.html → hooks/useLayer.ts.html} +328 -184
- package/coverage/lcov-report/src/hooks/{useMap.js.html → useMap.ts.html} +140 -50
- package/coverage/lcov-report/src/hooks/{useMapState.js.html → useMapState.ts.html} +166 -61
- package/coverage/lcov-report/src/hooks/useWms.js.html +1 -1
- package/coverage/lcov-report/src/index.html +15 -15
- package/coverage/lcov-report/src/{i18n.js.html → index.ts.html} +50 -32
- package/coverage/lcov.info +1540 -1669
- package/dist/index.esm.css +195 -0
- package/dist/index.esm.js +17304 -4936
- package/dist/index.esm.js.map +1 -1
- package/docs-build/0.d0c23b79.iframe.bundle.js +2 -0
- package/docs-build/0.d0c23b79.iframe.bundle.js.map +1 -0
- package/docs-build/0.fd1aa3ea21956d993519.manager.bundle.js +1 -0
- package/docs-build/1.34075652.iframe.bundle.js +10 -0
- package/docs-build/1.34075652.iframe.bundle.js.map +1 -0
- package/docs-build/16.ca488dae.iframe.bundle.js +2 -0
- package/docs-build/16.ca488dae.iframe.bundle.js.map +1 -0
- package/docs-build/17.e40eac7f.iframe.bundle.js +17 -0
- package/docs-build/17.e40eac7f.iframe.bundle.js.map +1 -0
- package/docs-build/18.62af0912.iframe.bundle.js +14 -0
- package/docs-build/18.62af0912.iframe.bundle.js.map +1 -0
- package/docs-build/19.0a217189.iframe.bundle.js +2 -0
- package/docs-build/19.0a217189.iframe.bundle.js.map +1 -0
- package/docs-build/2.f15ae19a.iframe.bundle.js +2 -0
- package/docs-build/2.f15ae19a.iframe.bundle.js.map +1 -0
- package/docs-build/20.4c43e27c.iframe.bundle.js +4 -0
- package/docs-build/20.4c43e27c.iframe.bundle.js.map +1 -0
- package/docs-build/21.19c21085.iframe.bundle.js +22 -0
- package/docs-build/21.19c21085.iframe.bundle.js.map +1 -0
- package/docs-build/3.5dd9e88b.iframe.bundle.js +2 -0
- package/docs-build/3.5dd9e88b.iframe.bundle.js.map +1 -0
- package/docs-build/4.f741dafe1833630ec8bf.manager.bundle.js +2 -0
- package/docs-build/4.f741dafe1833630ec8bf.manager.bundle.js.LICENSE.txt +8 -0
- package/docs-build/5.d4de191e7daeefb036ca.manager.bundle.js +1 -0
- package/docs-build/6.2b178c5444648ee5c0fa.manager.bundle.js +2 -0
- package/docs-build/6.2b178c5444648ee5c0fa.manager.bundle.js.LICENSE.txt +12 -0
- package/docs-build/7.7c16aea8ec7ea6e91994.manager.bundle.js +1 -0
- package/docs-build/8.52fa838fdf937b29676a.manager.bundle.js +1 -0
- package/docs-build/assets/dop.png +0 -0
- package/docs-build/assets/historic.png +0 -0
- package/docs-build/assets/marker.png +0 -0
- package/docs-build/assets/osm.png +0 -0
- package/docs-build/assets/sample.gpx +716 -0
- package/docs-build/{.gitkeep → catalogue/.gitkeep} +0 -0
- package/docs-build/catalogue/mc_meta.json +1 -0
- package/docs-build/favicon.ico +0 -0
- package/docs-build/iframe.html +348 -0
- package/docs-build/index.html +59 -0
- package/docs-build/logo.png +0 -0
- package/docs-build/main.8a7ec710ea1c16b5e13f.manager.bundle.js +1 -0
- package/docs-build/main~24120820.ba6665a8.iframe.bundle.js +2 -0
- package/docs-build/main~24120820.ba6665a8.iframe.bundle.js.map +1 -0
- package/docs-build/manifest.json +25 -0
- package/docs-build/robots.txt +3 -0
- package/docs-build/runtime~main.67aa1de2d72f40a81164.manager.bundle.js +1 -0
- package/docs-build/static/media/mapcomponents_logo.98b01a05.png +0 -0
- package/docs-build/static/media/wg-marker.bf3eeb2d.png +0 -0
- package/docs-build/stories.json +331 -0
- package/docs-build/thumbnails/MapLibreMap.png +0 -0
- package/docs-build/thumbnails/MlCameraFollowPath.png +0 -0
- package/docs-build/thumbnails/MlCreatePdfButton.png +0 -0
- package/docs-build/thumbnails/MlDeckGlLayer.png +0 -0
- package/docs-build/thumbnails/MlDeckGlTerrainLayer.png +0 -0
- package/docs-build/thumbnails/MlDemoDashboard.png +0 -0
- package/docs-build/thumbnails/MlFeatureEditor.png +0 -0
- package/docs-build/thumbnails/MlFillExtrusionLayer.png +0 -0
- package/docs-build/thumbnails/MlFollowGps.png +0 -0
- package/docs-build/thumbnails/MlGPXViewer.png +0 -0
- package/docs-build/thumbnails/MlGeoJsonLayer.png +0 -0
- package/docs-build/thumbnails/MlHillshadeLayer.png +0 -0
- package/docs-build/thumbnails/MlIconLayer.png +0 -0
- package/docs-build/thumbnails/MlLaermkarte.png +0 -0
- package/docs-build/thumbnails/MlLayerMagnify.png +0 -0
- package/docs-build/thumbnails/MlLayerSwipe.png +0 -0
- package/docs-build/thumbnails/MlMapDrawTools.png +0 -0
- package/docs-build/thumbnails/MlMobilerImker.png +0 -0
- package/docs-build/thumbnails/MlNavigationCompass.png +0 -0
- package/docs-build/thumbnails/MlNavigationTools.png +0 -0
- package/docs-build/thumbnails/MlOsmLayer.png +0 -0
- package/docs-build/thumbnails/MlScaleReference.png +0 -0
- package/docs-build/thumbnails/MlSpatialElevationProfile.png +0 -0
- package/docs-build/thumbnails/MlThreeJsLayer.png +0 -0
- package/docs-build/thumbnails/MlTransitionGeoJsonLayer.png +0 -0
- package/docs-build/thumbnails/MlVectorTileLayer.png +0 -0
- package/docs-build/thumbnails/MlWanderApp.png +0 -0
- package/docs-build/thumbnails/MlWmsLayer.png +0 -0
- package/docs-build/thumbnails/MlWmsLoader.png +0 -0
- package/docs-build/vendors~main.351900838c49e9200954.manager.bundle.js +2 -0
- package/docs-build/vendors~main.351900838c49e9200954.manager.bundle.js.LICENSE.txt +101 -0
- package/docs-build/vendors~main~0ad7406a.a6abfed7.iframe.bundle.js +8 -0
- package/docs-build/vendors~main~0ad7406a.a6abfed7.iframe.bundle.js.map +1 -0
- package/docs-build/vendors~main~0f485567.1d7a15b7.iframe.bundle.js +2 -0
- package/docs-build/vendors~main~0f485567.1d7a15b7.iframe.bundle.js.map +1 -0
- package/docs-build/vendors~main~41a6ab2c.525ecc56.iframe.bundle.js +2 -0
- package/docs-build/vendors~main~41a6ab2c.525ecc56.iframe.bundle.js.map +1 -0
- package/docs-build/vendors~main~52589227.1d1558cd.iframe.bundle.js +8 -0
- package/docs-build/vendors~main~52589227.1d1558cd.iframe.bundle.js.map +1 -0
- package/docs-build/vendors~main~73914085.227c6747.iframe.bundle.js +293 -0
- package/docs-build/vendors~main~73914085.227c6747.iframe.bundle.js.map +1 -0
- package/docs-build/vendors~main~9c5b28f6.f02cc741.iframe.bundle.js +7 -0
- package/docs-build/vendors~main~9c5b28f6.f02cc741.iframe.bundle.js.map +1 -0
- package/docs-build/vendors~main~b5906859.4083ac60.iframe.bundle.js +21 -0
- package/docs-build/vendors~main~b5906859.4083ac60.iframe.bundle.js.map +1 -0
- package/docs-build/vendors~main~b8f44717.7a612c34.iframe.bundle.js +89 -0
- package/docs-build/vendors~main~b8f44717.7a612c34.iframe.bundle.js.map +1 -0
- package/docs-build/vendors~main~b9cf3951.45da142d.iframe.bundle.js +68 -0
- package/docs-build/vendors~main~b9cf3951.45da142d.iframe.bundle.js.map +1 -0
- package/docs-build/vendors~main~d939e436.92c27fbf.iframe.bundle.js +2 -0
- package/docs-build/vendors~main~d939e436.92c27fbf.iframe.bundle.js.map +1 -0
- package/docs-build/vendors~main~dab50aa4.b0d58038.iframe.bundle.js +107 -0
- package/docs-build/vendors~main~dab50aa4.b0d58038.iframe.bundle.js.map +1 -0
- package/package.json +133 -117
- package/public/favicon.ico +0 -0
- package/public/logo.png +0 -0
- package/rollup.config.js +26 -3
- package/scripts/start.js +166 -0
- package/scripts/test.js +53 -0
- package/src/components/MapLibreMap/MapLibreMap.stories.js +14 -5
- package/src/components/MapLibreMap/MapLibreMap.test.js +1 -1
- package/src/components/MapLibreMap/{MapLibreMap.js → MapLibreMap.tsx} +40 -37
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.test.js +3 -3
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +636 -0
- package/src/components/MlComponentTemplate/MlComponentTemplate.stories.js +0 -2
- package/src/components/MlComponentTemplate/MlComponentTemplate.tsx +42 -0
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.stories.js +0 -5
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx +51 -0
- package/src/components/MlCreatePdfButton/lib/{createPdf.js → createPdf.ts} +26 -23
- package/src/components/MlCreatePdfButton/lib/{nominatimMap.js → nominatimMap.ts} +3 -3
- package/src/components/MlFeatureEditor/MlFeatureEditor.doc.en.md +1 -0
- package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +139 -0
- package/src/components/MlFeatureEditor/custom-direct-select-mode.js +12 -8
- package/src/components/MlFeatureEditor/custom-polygon-mode.js +9 -5
- package/src/components/MlFeatureEditor/custom-select-mode.js +11 -7
- package/src/components/MlFeatureEditor/lib/LICENSE.md +18 -0
- package/src/components/MlFeatureEditor/lib/common_selectors.js +4 -0
- package/src/components/MlFeatureEditor/lib/constants.js +4 -0
- package/src/components/MlFeatureEditor/lib/constrain_feature_movement.js +4 -0
- package/src/components/MlFeatureEditor/lib/create_midpoint.js +4 -0
- package/src/components/MlFeatureEditor/lib/create_supplementary_points.js +4 -0
- package/src/components/MlFeatureEditor/lib/create_vertex.js +4 -0
- package/src/components/MlFeatureEditor/lib/double_click_zoom.js +4 -0
- package/src/components/MlFeatureEditor/lib/euclidean_distance.js +4 -0
- package/src/components/MlFeatureEditor/lib/features_at.js +4 -0
- package/src/components/MlFeatureEditor/lib/get_features_and_set_cursor.js +4 -0
- package/src/components/MlFeatureEditor/lib/is_click.js +4 -0
- package/src/components/MlFeatureEditor/lib/is_event_at_coordinates.js +4 -0
- package/src/components/MlFeatureEditor/lib/is_tap.js +4 -0
- package/src/components/MlFeatureEditor/lib/map_event_to_bounding_box.js +4 -0
- package/src/components/MlFeatureEditor/lib/mode_handler.js +4 -0
- package/src/components/MlFeatureEditor/lib/mouse_event_point.js +4 -0
- package/src/components/MlFeatureEditor/lib/move_features.js +4 -0
- package/src/components/MlFeatureEditor/lib/sort_features.js +4 -0
- package/src/components/MlFeatureEditor/lib/string_set.js +4 -0
- package/src/components/MlFeatureEditor/lib/string_sets_are_equal.js +4 -0
- package/src/components/MlFeatureEditor/lib/theme.js +4 -0
- package/src/components/MlFeatureEditor/lib/to_dense_array.js +4 -0
- package/src/components/MlFeatureEditor/lib/utils.js +4 -0
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.doc.en.md +1 -0
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.stories.js +6 -11
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx +85 -0
- package/src/components/MlFollowGps/MlFollowGps.doc.en.md +1 -0
- package/src/components/MlFollowGps/MlFollowGps.stories.js +0 -2
- package/src/components/MlFollowGps/{MlFollowGps.js → MlFollowGps.tsx} +99 -86
- package/src/components/MlGPXViewer/MlGPXViewer.doc.en.md +1 -0
- package/src/components/MlGPXViewer/{MlGPXViewer.js → MlGPXViewer.tsx} +68 -50
- package/src/components/MlGPXViewer/util/GeoJsonContext.ts +13 -0
- package/src/components/MlGPXViewer/util/{GeoJsonProvider.js → GeoJsonProvider.tsx} +3 -7
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.doc.en.md +1 -0
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.js +8 -3
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +106 -0
- package/src/components/MlGeoJsonLayer/util/{getDefaultLayerTypeByGeometry.js → getDefaultLayerTypeByGeometry.ts} +6 -1
- package/src/components/MlGeoJsonLayer/util/{getDefaultPaintPropsByType.js → getDefaultPaintPropsByType.ts} +1 -1
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.js +1 -4
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx +129 -0
- package/src/components/MlLayer/MlLayer.stories.js +0 -2
- package/src/components/MlLayer/MlLayer.tsx +48 -0
- package/src/components/MlLayerMagnify/MlLayerMagnify.doc.en.md +1 -0
- package/src/components/MlLayerMagnify/MlLayerMagnify.stories.js +3 -3
- package/src/components/MlLayerMagnify/{MlLayerMagnify.js → MlLayerMagnify.tsx} +62 -43
- package/src/components/MlLayerSwipe/MlLayerSwipe.doc.en.md +1 -0
- package/src/components/MlLayerSwipe/MlLayerSwipe.stories.js +0 -2
- package/src/components/MlLayerSwipe/{MlLayerSwipe.js → MlLayerSwipe.tsx} +38 -24
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.js +0 -4
- package/src/components/MlMarker/MlMarker.tsx +140 -0
- package/src/components/MlNavigationCompass/MlNavigationCompass.doc.en.md +1 -0
- package/src/components/MlNavigationCompass/{MlNavigationCompass.js → MlNavigationCompass.tsx} +27 -10
- package/src/components/MlNavigationTools/MlNavigationTools.doc.en.md +1 -0
- package/src/components/MlNavigationTools/{MlNavigationTools.js → MlNavigationTools.tsx} +37 -32
- package/src/components/MlScaleReference/MlScaleReference.doc.en.md +1 -0
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.doc.en.md +1 -0
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.doc.en.md +1 -0
- package/src/components/MlTransitionGeoJsonLayer/{MlTransitionGeoJsonLayer.js → MlTransitionGeoJsonLayer.tsx} +76 -73
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.doc.en.md +1 -0
- package/src/components/MlVectorTileLayer/{MlVectorTileLayer.js → MlVectorTileLayer.tsx} +23 -7
- package/src/components/MlWmsLayer/{MlWmsLayer.js → MlWmsLayer.tsx} +22 -7
- package/src/components/MlWmsLoader/MlWmsLoader.doc.en.md +1 -0
- package/src/components/MlWmsLoader/{MlWmsLoader.js → MlWmsLoader.tsx} +55 -47
- package/src/custom.d.tsx +26 -0
- package/src/hooks/useLayer.ts +221 -0
- package/src/hooks/{useMap.js → useMap.ts} +48 -17
- package/src/hooks/{useMapState.js → useMapState.ts} +42 -7
- package/src/{index.js → index.ts} +15 -8
- package/tsconfig.json +18 -24
- package/.env +0 -1
- package/.storybook/main.bck.js +0 -56
- package/babel.config.json +0 -4
- package/coverage/lcov-report/src/translations/english.js.html +0 -94
- package/coverage/lcov-report/src/translations/german.js.html +0 -94
- package/coverage/lcov-report/src/translations/index.html +0 -131
- package/jest.config.json +0 -16
- package/jsdoc.json +0 -21
- package/public/assets/3D/posttower.gltf +0 -103
- package/public/assets/3D/posttower_simple.gltf +0 -103
- package/public/assets/3D/posttower_wh.gltf.glb +0 -0
- package/public/bee.png +0 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.js +0 -528
- package/src/components/MlComponentTemplate/MlComponentTemplate.js +0 -39
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.js +0 -52
- package/src/components/MlFeatureEditor/MlFeatureEditor.js +0 -119
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.js +0 -153
- package/src/components/MlGPXViewer/util/GeoJsonContext.js +0 -6
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.js +0 -173
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.js +0 -75
- package/src/components/MlLayer/MlLayer.js +0 -107
- package/src/components/MlLayerMagnify/utils/compareMagnify.js +0 -173
- package/src/components/MlLayerSwipe/utils/swipeCompare.js +0 -220
- package/src/components/MlMarker/MlMarker.js +0 -156
- package/src/components/index.js +0 -6
- package/src/i18n.js +0 -28
- package/src/react-app-env.d.ts +0 -1
- package/src/stories/IntroductionCore.stories.mdx +0 -3
- package/src/stories/assets/code-brackets.svg +0 -1
- package/src/stories/assets/colors.svg +0 -1
- package/src/stories/assets/comments.svg +0 -1
- package/src/stories/assets/direction.svg +0 -1
- package/src/stories/assets/flow.svg +0 -1
- package/src/stories/assets/plugin.svg +0 -1
- package/src/stories/assets/repo.svg +0 -1
- package/src/stories/assets/stackalt.svg +0 -1
- package/src/stories/components/ComponentTeaser.js +0 -64
- package/src/translations/english.js +0 -4
- package/src/translations/german.js +0 -4
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect, useCallback } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
|
|
4
3
|
import * as turf from "@turf/turf";
|
|
5
4
|
|
|
@@ -7,28 +6,95 @@ import useMap from "../../hooks/useMap";
|
|
|
7
6
|
|
|
8
7
|
import { _transitionToGeojson } from "./util/transitionFunctions";
|
|
9
8
|
import MlGeoJsonLayer from "../MlGeoJsonLayer/MlGeoJsonLayer";
|
|
9
|
+
import { Feature, FeatureCollection } from "@turf/turf";
|
|
10
10
|
|
|
11
11
|
const msPerStep = 50;
|
|
12
12
|
|
|
13
|
+
interface MlTransitionGeoJsonLayerProps {
|
|
14
|
+
/**
|
|
15
|
+
* Id of the target MapLibre instance in mapContext
|
|
16
|
+
*/
|
|
17
|
+
mapId: string;
|
|
18
|
+
/**
|
|
19
|
+
* Type of the layer that will be added to the MapLibre instance.
|
|
20
|
+
* Possible values: "line", "circle", "fill"
|
|
21
|
+
*/
|
|
22
|
+
type: string;
|
|
23
|
+
/**
|
|
24
|
+
* Layout property object, that is passed to the addLayer call.
|
|
25
|
+
* Possible props depend on the layer type.
|
|
26
|
+
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
|
|
27
|
+
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
|
|
28
|
+
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
|
|
29
|
+
*/
|
|
30
|
+
layout: any;
|
|
31
|
+
/**
|
|
32
|
+
* Paint property object, that is passed to the addLayer call.
|
|
33
|
+
* Possible props depend on the layer type.
|
|
34
|
+
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
|
|
35
|
+
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
|
|
36
|
+
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
|
|
37
|
+
*/
|
|
38
|
+
paint: any;
|
|
39
|
+
/**
|
|
40
|
+
* Javascript object with optional properties "fill", "line", "circle" to override implicit layer type default paint properties.
|
|
41
|
+
*/
|
|
42
|
+
defaultPaintOverrides: any;
|
|
43
|
+
/**
|
|
44
|
+
* Javascript object that is spread into the addLayer commands first parameter.
|
|
45
|
+
*/
|
|
46
|
+
options: any;
|
|
47
|
+
/**
|
|
48
|
+
* GeoJSON data that is supposed to be rendered by this component.
|
|
49
|
+
*/
|
|
50
|
+
geojson: Feature | FeatureCollection;
|
|
51
|
+
/**
|
|
52
|
+
* Id of an existing layer in the mapLibre instance to help specify the layer order
|
|
53
|
+
* This layer will be visually beneath the layer with the "insertBeforeLayer" id.
|
|
54
|
+
*/
|
|
55
|
+
insertBeforeLayer: string;
|
|
56
|
+
/**
|
|
57
|
+
* Click event handler that is executed whenever a geometry rendered by this component is clicked.
|
|
58
|
+
*/
|
|
59
|
+
onClick: Function;
|
|
60
|
+
/**
|
|
61
|
+
* Hover event handler that is executed whenever a geometry rendered by this component is hovered.
|
|
62
|
+
*/
|
|
63
|
+
onHover: Function;
|
|
64
|
+
/**
|
|
65
|
+
* Leave event handler that is executed whenever a geometry rendered by this component is
|
|
66
|
+
* left/unhovered.
|
|
67
|
+
*/
|
|
68
|
+
onLeave: Function;
|
|
69
|
+
/**
|
|
70
|
+
* Creates transition animation whenever the geojson prop changes.
|
|
71
|
+
* Only works with layer type "line" and LineString GeoJSON data.
|
|
72
|
+
*/
|
|
73
|
+
transitionTime: number;
|
|
74
|
+
}
|
|
75
|
+
|
|
13
76
|
/**
|
|
14
77
|
* Adds source and layer of types "line", "fill" or "circle" to display GeoJSON data on the map.
|
|
15
|
-
*
|
|
16
|
-
* @component
|
|
17
78
|
*/
|
|
18
|
-
const MlTransitionGeoJsonLayer = (props) => {
|
|
79
|
+
const MlTransitionGeoJsonLayer = (props: MlTransitionGeoJsonLayerProps) => {
|
|
19
80
|
const { geojson, ...restProps } = props;
|
|
20
|
-
|
|
21
|
-
const mapHook = useMap({
|
|
81
|
+
|
|
82
|
+
const mapHook = useMap({
|
|
83
|
+
mapId: props.mapId,
|
|
84
|
+
waitForLayer: props.insertBeforeLayer,
|
|
85
|
+
});
|
|
22
86
|
const initializedRef = useRef(false);
|
|
23
87
|
|
|
24
88
|
// transition effect variables
|
|
25
|
-
const oldGeojsonRef = useRef(
|
|
89
|
+
const oldGeojsonRef = useRef<Feature | FeatureCollection>();
|
|
26
90
|
const transitionInProgressRef = useRef(false);
|
|
27
91
|
const transitionTimeoutRef = useRef(undefined);
|
|
28
92
|
const currentTransitionStepRef = useRef(false);
|
|
29
93
|
const transitionGeojsonDataRef = useRef([]);
|
|
30
94
|
const transitionGeojsonCommonDataRef = useRef([]);
|
|
31
|
-
const [displayGeojson, setDisplayGeojson] = useState(
|
|
95
|
+
const [displayGeojson, setDisplayGeojson] = useState(
|
|
96
|
+
turf.featureCollection([])
|
|
97
|
+
);
|
|
32
98
|
|
|
33
99
|
useEffect(() => {
|
|
34
100
|
return () => {
|
|
@@ -76,10 +142,10 @@ const MlTransitionGeoJsonLayer = (props) => {
|
|
|
76
142
|
props.type === "line" &&
|
|
77
143
|
typeof props.transitionTime !== "undefined" &&
|
|
78
144
|
props.transitionTime &&
|
|
79
|
-
typeof props.geojson
|
|
145
|
+
typeof props.geojson !== "undefined" &&
|
|
80
146
|
JSON.stringify(oldGeojsonRef.current) !== JSON.stringify(props.geojson)
|
|
81
147
|
) {
|
|
82
|
-
transitionToGeojson(
|
|
148
|
+
transitionToGeojson();
|
|
83
149
|
oldGeojsonRef.current = props.geojson;
|
|
84
150
|
}
|
|
85
151
|
}, [props, transitionToGeojson]);
|
|
@@ -99,67 +165,4 @@ const MlTransitionGeoJsonLayer = (props) => {
|
|
|
99
165
|
);
|
|
100
166
|
};
|
|
101
167
|
|
|
102
|
-
MlTransitionGeoJsonLayer.propTypes = {
|
|
103
|
-
/**
|
|
104
|
-
* Id of the target MapLibre instance in mapContext
|
|
105
|
-
*/
|
|
106
|
-
mapId: PropTypes.string,
|
|
107
|
-
/**
|
|
108
|
-
* Type of the layer that will be added to the MapLibre instance.
|
|
109
|
-
* Possible values: "line", "circle", "fill"
|
|
110
|
-
*/
|
|
111
|
-
type: PropTypes.string,
|
|
112
|
-
/**
|
|
113
|
-
* Layout property object, that is passed to the addLayer call.
|
|
114
|
-
* Possible props depend on the layer type.
|
|
115
|
-
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
|
|
116
|
-
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
|
|
117
|
-
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
|
|
118
|
-
*/
|
|
119
|
-
layout: PropTypes.object,
|
|
120
|
-
/**
|
|
121
|
-
* Paint property object, that is passed to the addLayer call.
|
|
122
|
-
* Possible props depend on the layer type.
|
|
123
|
-
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
|
|
124
|
-
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
|
|
125
|
-
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
|
|
126
|
-
*/
|
|
127
|
-
paint: PropTypes.object,
|
|
128
|
-
/**
|
|
129
|
-
* Javascript object with optional properties "fill", "line", "circle" to override implicit layer type default paint properties.
|
|
130
|
-
*/
|
|
131
|
-
defaultPaintOverrides: PropTypes.object,
|
|
132
|
-
/**
|
|
133
|
-
* Javascript object that is spread into the addLayer commands first parameter.
|
|
134
|
-
*/
|
|
135
|
-
options: PropTypes.object,
|
|
136
|
-
/**
|
|
137
|
-
* GeoJSON data that is supposed to be rendered by this component.
|
|
138
|
-
*/
|
|
139
|
-
geojson: PropTypes.object,
|
|
140
|
-
/**
|
|
141
|
-
* Id of an existing layer in the mapLibre instance to help specify the layer order
|
|
142
|
-
* This layer will be visually beneath the layer with the "insertBeforeLayer" id.
|
|
143
|
-
*/
|
|
144
|
-
insertBeforeLayer: PropTypes.string,
|
|
145
|
-
/**
|
|
146
|
-
* Click event handler that is executed whenever a geometry rendered by this component is clicked.
|
|
147
|
-
*/
|
|
148
|
-
onClick: PropTypes.func,
|
|
149
|
-
/**
|
|
150
|
-
* Hover event handler that is executed whenever a geometry rendered by this component is hovered.
|
|
151
|
-
*/
|
|
152
|
-
onHover: PropTypes.func,
|
|
153
|
-
/**
|
|
154
|
-
* Leave event handler that is executed whenever a geometry rendered by this component is
|
|
155
|
-
* left/unhovered.
|
|
156
|
-
*/
|
|
157
|
-
onLeave: PropTypes.func,
|
|
158
|
-
/**
|
|
159
|
-
* Creates transition animation whenever the geojson prop changes.
|
|
160
|
-
* Only works with layer type "line" and LineString GeoJSON data.
|
|
161
|
-
*/
|
|
162
|
-
transitionTime: PropTypes.number,
|
|
163
|
-
};
|
|
164
|
-
|
|
165
168
|
export default MlTransitionGeoJsonLayer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Presentation of vector tiles.
|
|
@@ -2,17 +2,31 @@ import React, { useRef, useEffect } from "react";
|
|
|
2
2
|
import useMap from "../../hooks/useMap";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
|
|
5
|
+
interface MlVectorTileLayerProps {
|
|
6
|
+
mapId?: string;
|
|
7
|
+
insertBeforeLayer?: string;
|
|
8
|
+
layerId?: string;
|
|
9
|
+
sourceOptions?: any;
|
|
10
|
+
url?: string;
|
|
11
|
+
layers?: any;
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
/**
|
|
6
15
|
* Adds a vector-tile source and 0...n vector-tile-layers to the MapLibre instance referenced by
|
|
7
16
|
* props.mapId
|
|
8
17
|
*
|
|
9
18
|
* @component
|
|
10
19
|
*/
|
|
11
|
-
const MlVectorTileLayer = (props) => {
|
|
12
|
-
const mapHook = useMap({
|
|
20
|
+
const MlVectorTileLayer = (props: MlVectorTileLayerProps) => {
|
|
21
|
+
const mapHook = useMap({
|
|
22
|
+
mapId: props.mapId,
|
|
23
|
+
waitForLayer: props.insertBeforeLayer,
|
|
24
|
+
});
|
|
13
25
|
|
|
14
26
|
const layerIdsRef = useRef({});
|
|
15
|
-
const layerId = useRef(
|
|
27
|
+
const layerId = useRef(
|
|
28
|
+
props.layerId || "MlVectorTileLayer-" + mapHook.componentId
|
|
29
|
+
);
|
|
16
30
|
const layerPaintConfsRef = useRef({});
|
|
17
31
|
const layerLayoutConfsRef = useRef({});
|
|
18
32
|
const initializedRef = useRef(false);
|
|
@@ -58,7 +72,9 @@ const MlVectorTileLayer = (props) => {
|
|
|
58
72
|
mapHook.componentId
|
|
59
73
|
);
|
|
60
74
|
layerPaintConfsRef.current[key] = JSON.stringify(props.layers[key].paint);
|
|
61
|
-
layerLayoutConfsRef.current[key] = JSON.stringify(
|
|
75
|
+
layerLayoutConfsRef.current[key] = JSON.stringify(
|
|
76
|
+
props.layers[key].layout
|
|
77
|
+
);
|
|
62
78
|
}
|
|
63
79
|
}, [mapHook.map, props]);
|
|
64
80
|
|
|
@@ -66,13 +82,13 @@ const MlVectorTileLayer = (props) => {
|
|
|
66
82
|
if (!mapHook.map || !initializedRef.current) return;
|
|
67
83
|
// initialize the layer and add it to the MapLibre-gl instance or do something else with it
|
|
68
84
|
for (var key in props.layers) {
|
|
69
|
-
if (mapHook.map.getLayer(layerIdsRef.current[key])) {
|
|
85
|
+
if (mapHook.map.map.getLayer(layerIdsRef.current[key])) {
|
|
70
86
|
// update changed paint property
|
|
71
87
|
let layerPaintConfString = JSON.stringify(props.layers[key].paint);
|
|
72
88
|
|
|
73
89
|
if (layerPaintConfString !== layerPaintConfsRef.current[key]) {
|
|
74
90
|
for (let paintKey in props.layers[key].paint) {
|
|
75
|
-
mapHook.map.setPaintProperty(
|
|
91
|
+
mapHook.map.map.setPaintProperty(
|
|
76
92
|
layerIdsRef.current[key],
|
|
77
93
|
paintKey,
|
|
78
94
|
props.layers[key].paint[paintKey]
|
|
@@ -86,7 +102,7 @@ const MlVectorTileLayer = (props) => {
|
|
|
86
102
|
|
|
87
103
|
if (layerLayoutConfString !== layerLayoutConfsRef.current[key]) {
|
|
88
104
|
for (let layoutKey in props.layers[key].layout) {
|
|
89
|
-
mapHook.map.setLayoutProperty(
|
|
105
|
+
mapHook.map.map.setLayoutProperty(
|
|
90
106
|
layerIdsRef.current[key],
|
|
91
107
|
layoutKey,
|
|
92
108
|
props.layers[key].layout[layoutKey]
|
|
@@ -27,13 +27,24 @@ const defaultProps = {
|
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
interface MlWmsLayerProps {
|
|
31
|
+
urlParameters?: any;
|
|
32
|
+
url: string;
|
|
33
|
+
visible?: boolean;
|
|
34
|
+
attribution?: string;
|
|
35
|
+
mapId?: string;
|
|
36
|
+
sourceOptions?: any;
|
|
37
|
+
layerOptions?: any;
|
|
38
|
+
insertBeforeLayer?: string;
|
|
39
|
+
layerId?: string;
|
|
40
|
+
}
|
|
30
41
|
/**
|
|
31
42
|
* Adds a WMS raster source & layer to the maplibre-gl instance
|
|
32
43
|
*
|
|
33
44
|
* @param {object} props
|
|
34
45
|
* @param {object} props.urlParameters URL query parameters that will be added to the WMS URL. A layers property (string) is mandatory. Any value defined on this attribute will extend the default object
|
|
35
46
|
* @param {string} props.url WMS URL
|
|
36
|
-
* @param {bool}
|
|
47
|
+
* @param {bool} props.visible Sets layer "visibility" property to "visible" if true or "none" if false
|
|
37
48
|
* @param {string} props.attribution MapLibre attribution shown in the bottom right of the map, if this layer is visible
|
|
38
49
|
* @param {string} props.mapId Id of the target MapLibre instance in mapContext
|
|
39
50
|
* @param {object} props.sourceOptions Object that is passed to the MapLibre.addSource call as config option parameter
|
|
@@ -43,8 +54,11 @@ const defaultProps = {
|
|
|
43
54
|
*
|
|
44
55
|
* @component
|
|
45
56
|
*/
|
|
46
|
-
const MlWmsLayer = (props) => {
|
|
47
|
-
const mapHook = useMap({
|
|
57
|
+
const MlWmsLayer = (props:MlWmsLayerProps) => {
|
|
58
|
+
const mapHook = useMap({
|
|
59
|
+
mapId: props.mapId,
|
|
60
|
+
waitForLayer: props.insertBeforeLayer,
|
|
61
|
+
});
|
|
48
62
|
|
|
49
63
|
const initializedRef = useRef(false);
|
|
50
64
|
const layerId = useRef(props.layerId || "MlWmsLayer-" + mapHook.componentId);
|
|
@@ -69,7 +83,8 @@ const MlWmsLayer = (props) => {
|
|
|
69
83
|
};
|
|
70
84
|
let urlParams = new URLSearchParams(urlParamsObj);
|
|
71
85
|
let urlParamsStr =
|
|
72
|
-
decodeURIComponent(urlParams.toString()) +
|
|
86
|
+
decodeURIComponent(urlParams.toString()) +
|
|
87
|
+
"".replace(/%2F/g, "/").replace(/%3A/g, ":");
|
|
73
88
|
|
|
74
89
|
mapHook.map.addSource(
|
|
75
90
|
layerId.current,
|
|
@@ -95,7 +110,7 @@ const MlWmsLayer = (props) => {
|
|
|
95
110
|
);
|
|
96
111
|
|
|
97
112
|
if (!props.visible) {
|
|
98
|
-
mapHook.map.setLayoutProperty(layerId.current, "visibility", "none");
|
|
113
|
+
mapHook.map.map.setLayoutProperty(layerId.current, "visibility", "none");
|
|
99
114
|
}
|
|
100
115
|
}, [mapHook, props]);
|
|
101
116
|
|
|
@@ -104,9 +119,9 @@ const MlWmsLayer = (props) => {
|
|
|
104
119
|
|
|
105
120
|
// toggle layer visibility by changing the layout object's visibility property
|
|
106
121
|
if (props.visible) {
|
|
107
|
-
mapHook.map.setLayoutProperty(layerId.current, "visibility", "visible");
|
|
122
|
+
mapHook.map.map.setLayoutProperty(layerId.current, "visibility", "visible");
|
|
108
123
|
} else {
|
|
109
|
-
mapHook.map.setLayoutProperty(layerId.current, "visibility", "none");
|
|
124
|
+
mapHook.map.map.setLayoutProperty(layerId.current, "visibility", "none");
|
|
110
125
|
}
|
|
111
126
|
}, [props.visible, mapHook.map]);
|
|
112
127
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Presentation of WMS services with the feature of an information query.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useContext, useCallback, useState } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
|
|
3
|
+
// @ts-ignore
|
|
4
4
|
import { MapContext } from "@mapcomponents/react-core";
|
|
5
5
|
import { v4 as uuidv4 } from "uuid";
|
|
6
6
|
|
|
@@ -15,9 +15,11 @@ import List from "@mui/material/List";
|
|
|
15
15
|
import ListItem from "@mui/material/ListItem";
|
|
16
16
|
import ListItemText from "@mui/material/ListItemText";
|
|
17
17
|
import IconButton from "@mui/material/IconButton";
|
|
18
|
+
import {LngLat} from "maplibre-gl";
|
|
19
|
+
import MapLibreGlWrapper from "../MapLibreMap/lib/MapLibreGlWrapper";
|
|
18
20
|
|
|
19
21
|
var originShift = (2 * Math.PI * 6378137) / 2.0;
|
|
20
|
-
const lngLatToMeters = function (lnglat,
|
|
22
|
+
const lngLatToMeters = function (lnglat:LngLat, accuracy = { enable: true, decimal: 1 }) {
|
|
21
23
|
var lng = lnglat.lng;
|
|
22
24
|
var lat = lnglat.lat;
|
|
23
25
|
var x = (lng * originShift) / 180.0;
|
|
@@ -29,6 +31,32 @@ const lngLatToMeters = function (lnglat, validate, accuracy = { enable: true, de
|
|
|
29
31
|
}
|
|
30
32
|
return [x, y];
|
|
31
33
|
};
|
|
34
|
+
|
|
35
|
+
interface MlWmsLoaderProps {
|
|
36
|
+
/**
|
|
37
|
+
* WMS URL
|
|
38
|
+
*/
|
|
39
|
+
url: string;
|
|
40
|
+
/**
|
|
41
|
+
* Id of the target MapLibre instance in mapContext
|
|
42
|
+
*/
|
|
43
|
+
mapId: string;
|
|
44
|
+
/**
|
|
45
|
+
* URL parameters that will be used in the getCapabilities request
|
|
46
|
+
*/
|
|
47
|
+
urlParameters: object;
|
|
48
|
+
/**
|
|
49
|
+
* URL parameters that will be added when requesting WMS capabilities
|
|
50
|
+
*/
|
|
51
|
+
wmsUrlParameters: object;
|
|
52
|
+
/**
|
|
53
|
+
* URL parameters that will be added when requesting tiles
|
|
54
|
+
*/
|
|
55
|
+
layerUrlParameters: object;
|
|
56
|
+
lngLat: LngLat;
|
|
57
|
+
idPrefix: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
32
60
|
/**
|
|
33
61
|
* Loads a WMS getCapabilities xml document and adds a MlWmsLayer component for each layer that is
|
|
34
62
|
* offered by the WMS.
|
|
@@ -37,21 +65,23 @@ const lngLatToMeters = function (lnglat, validate, accuracy = { enable: true, de
|
|
|
37
65
|
*
|
|
38
66
|
* @component
|
|
39
67
|
*/
|
|
40
|
-
const MlWmsLoader = (props) => {
|
|
68
|
+
const MlWmsLoader = (props: MlWmsLoaderProps) => {
|
|
41
69
|
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
42
|
-
const mapContext = useContext(MapContext);
|
|
43
|
-
const { capabilities, error, setUrl, getFeatureInfoUrl, wmsUrl } = useWms({
|
|
70
|
+
const mapContext: MapContextType = useContext(MapContext);
|
|
71
|
+
const { capabilities, error, setUrl, getFeatureInfoUrl, wmsUrl }: any = useWms({
|
|
44
72
|
url: undefined,
|
|
45
73
|
urlParameters: props.urlParameters,
|
|
46
74
|
});
|
|
75
|
+
let layerType : { visible: boolean, queryable: boolean, Name: string, Title: string, LatLonBoundingBox: Array<number>,
|
|
76
|
+
EX_GeographicBoundingBox: Array<number>, Abstract: any}
|
|
47
77
|
|
|
48
78
|
const initializedRef = useRef(false);
|
|
49
|
-
const mapRef = useRef(
|
|
79
|
+
const mapRef = useRef<MapLibreGlWrapper>();
|
|
50
80
|
const componentId = useRef((props.idPrefix ? props.idPrefix : "MlWmsLoader-") + uuidv4());
|
|
51
|
-
const [layers, setLayers] = useState([]);
|
|
81
|
+
const [layers, setLayers] = useState<Array<typeof layerType>>([]);
|
|
52
82
|
|
|
53
83
|
const [featureInfoLngLat, setFeatureInfoLngLat] = useState(undefined);
|
|
54
|
-
const [featureInfoContent, setFeatureInfoContent] = useState(undefined);
|
|
84
|
+
const [featureInfoContent, setFeatureInfoContent] = useState<string|undefined>(undefined);
|
|
55
85
|
|
|
56
86
|
useEffect(() => {
|
|
57
87
|
let _componentId = componentId.current;
|
|
@@ -79,9 +109,10 @@ const MlWmsLoader = (props) => {
|
|
|
79
109
|
|
|
80
110
|
const getFeatureInfo = useCallback(
|
|
81
111
|
(ev) => {
|
|
112
|
+
if(!mapRef.current) return;
|
|
82
113
|
setFeatureInfoLngLat(undefined);
|
|
83
114
|
setFeatureInfoContent(undefined);
|
|
84
|
-
let _bounds = mapRef.current.getBounds();
|
|
115
|
+
let _bounds = mapRef.current.map.getBounds();
|
|
85
116
|
let _sw = lngLatToMeters(_bounds._sw);
|
|
86
117
|
let _ne = lngLatToMeters(_bounds._ne);
|
|
87
118
|
let bbox = [_sw[0], _sw[1], _ne[0], _ne[1]];
|
|
@@ -96,13 +127,13 @@ const MlWmsLoader = (props) => {
|
|
|
96
127
|
: "text/plain",
|
|
97
128
|
FEATURE_COUNT: "10",
|
|
98
129
|
LAYERS: layers
|
|
99
|
-
.map((layer
|
|
130
|
+
.map((layer: typeof layerType) => (layer.visible && layer.queryable ? layer.Name : undefined))
|
|
100
131
|
.filter((n) => n),
|
|
101
132
|
QUERY_LAYERS: layers
|
|
102
|
-
.map((layer
|
|
133
|
+
.map((layer: typeof layerType) => (layer.visible && layer.queryable ? layer.Name : undefined))
|
|
103
134
|
.filter((n) => n),
|
|
104
|
-
WIDTH: mapRef.current._container.clientWidth,
|
|
105
|
-
HEIGHT: mapRef.current._container.clientHeight,
|
|
135
|
+
WIDTH: mapRef.current?.map._container.clientWidth,
|
|
136
|
+
HEIGHT: mapRef.current?.map._container.clientHeight,
|
|
106
137
|
srs: "EPSG:3857",
|
|
107
138
|
CRS: "EPSG:3857",
|
|
108
139
|
version: "1.3.0",
|
|
@@ -113,7 +144,7 @@ const MlWmsLoader = (props) => {
|
|
|
113
144
|
buffer: "50",
|
|
114
145
|
};
|
|
115
146
|
|
|
116
|
-
let _gfiUrl = getFeatureInfoUrl;
|
|
147
|
+
let _gfiUrl : string | undefined = getFeatureInfoUrl;
|
|
117
148
|
let _gfiUrlParts;
|
|
118
149
|
if (_gfiUrl?.indexOf?.("?") !== -1) {
|
|
119
150
|
_gfiUrlParts = props.url.split("?");
|
|
@@ -126,7 +157,7 @@ const MlWmsLoader = (props) => {
|
|
|
126
157
|
..._getFeatureInfoUrlParams,
|
|
127
158
|
};
|
|
128
159
|
// create URLSearchParams object to assemble the URL Parameters
|
|
129
|
-
let urlParams = new URLSearchParams(urlParamsObj);
|
|
160
|
+
let urlParams = new URLSearchParams(urlParamsObj.toString());
|
|
130
161
|
|
|
131
162
|
fetch(props.url + "?" + urlParams.toString())
|
|
132
163
|
.then((res) => {
|
|
@@ -151,9 +182,9 @@ const MlWmsLoader = (props) => {
|
|
|
151
182
|
|
|
152
183
|
mapRef.current.on("click", _getFeatureInfo, componentId.current);
|
|
153
184
|
return () => {
|
|
154
|
-
mapRef.current?.off?.("click", _getFeatureInfo);
|
|
185
|
+
mapRef.current?.map.off?.("click", _getFeatureInfo);
|
|
155
186
|
};
|
|
156
|
-
}, [
|
|
187
|
+
}, [getFeatureInfo]);
|
|
157
188
|
|
|
158
189
|
useEffect(() => {
|
|
159
190
|
if (!capabilities?.Service) return;
|
|
@@ -167,9 +198,9 @@ const MlWmsLoader = (props) => {
|
|
|
167
198
|
"MlWmsLoader (" + capabilities.Service.Title + "): WGS 84/Pseudo-Mercator supported"
|
|
168
199
|
);
|
|
169
200
|
|
|
170
|
-
let _LatLonBoundingBox;
|
|
201
|
+
let _LatLonBoundingBox: Array<number> = [];
|
|
171
202
|
setLayers(
|
|
172
|
-
capabilities?.Capability?.Layer?.Layer.map((layer, idx) => {
|
|
203
|
+
capabilities?.Capability?.Layer?.Layer.map((layer: typeof layerType, idx: number) => {
|
|
173
204
|
if (idx === 0) {
|
|
174
205
|
_LatLonBoundingBox = layer.LatLonBoundingBox;
|
|
175
206
|
if (!_LatLonBoundingBox) {
|
|
@@ -182,8 +213,8 @@ const MlWmsLoader = (props) => {
|
|
|
182
213
|
);
|
|
183
214
|
|
|
184
215
|
// zoom to extent of first layer
|
|
185
|
-
if (mapRef.current && _LatLonBoundingBox
|
|
186
|
-
mapRef.current.fitBounds([
|
|
216
|
+
if (mapRef.current && _LatLonBoundingBox.length > 3) {
|
|
217
|
+
mapRef.current.map.fitBounds([
|
|
187
218
|
[_LatLonBoundingBox[0], _LatLonBoundingBox[1]],
|
|
188
219
|
[_LatLonBoundingBox[2], _LatLonBoundingBox[3]],
|
|
189
220
|
]);
|
|
@@ -206,7 +237,7 @@ const MlWmsLoader = (props) => {
|
|
|
206
237
|
{error && <p>{error}</p>}
|
|
207
238
|
<h3 key="title">{capabilities?.Service?.Title}</h3>
|
|
208
239
|
{console.log(componentId.current)}
|
|
209
|
-
{capabilities?.Capability?.Layer?.Layer.map((
|
|
240
|
+
{capabilities?.Capability?.Layer?.Layer.map((idx: number) => (
|
|
210
241
|
<MlLayer
|
|
211
242
|
layerId={"Order-" + componentId.current + "-" + idx}
|
|
212
243
|
key={componentId.current + "-" + idx}
|
|
@@ -219,7 +250,7 @@ const MlWmsLoader = (props) => {
|
|
|
219
250
|
))}
|
|
220
251
|
<List dense key="layers">
|
|
221
252
|
{wmsUrl &&
|
|
222
|
-
layers?.map?.((layer, idx) => {
|
|
253
|
+
layers?.map?.((layer: typeof layerType, idx) => {
|
|
223
254
|
return layer?.Name ? (
|
|
224
255
|
<ListItem
|
|
225
256
|
key={layer.Name + idx}
|
|
@@ -228,7 +259,7 @@ const MlWmsLoader = (props) => {
|
|
|
228
259
|
edge="end"
|
|
229
260
|
aria-label="toggle visibility"
|
|
230
261
|
onClick={() => {
|
|
231
|
-
let _layers = [...layers];
|
|
262
|
+
let _layers: Array<typeof layerType> = [...layers];
|
|
232
263
|
_layers[idx].visible = !_layers[idx].visible;
|
|
233
264
|
setLayers([..._layers]);
|
|
234
265
|
}}
|
|
@@ -272,27 +303,4 @@ MlWmsLoader.defaultProps = {
|
|
|
272
303
|
},
|
|
273
304
|
};
|
|
274
305
|
|
|
275
|
-
MlWmsLoader.propTypes = {
|
|
276
|
-
/**
|
|
277
|
-
* WMS URL
|
|
278
|
-
*/
|
|
279
|
-
url: PropTypes.string.isRequired,
|
|
280
|
-
/**
|
|
281
|
-
* Id of the target MapLibre instance in mapContext
|
|
282
|
-
*/
|
|
283
|
-
mapId: PropTypes.string,
|
|
284
|
-
/**
|
|
285
|
-
* URL parameters that will be used in the getCapabilities request
|
|
286
|
-
*/
|
|
287
|
-
urlParameters: PropTypes.object,
|
|
288
|
-
/**
|
|
289
|
-
* URL parameters that will be added when requesting WMS capabilities
|
|
290
|
-
*/
|
|
291
|
-
wmsUrlParameters: PropTypes.object,
|
|
292
|
-
/**
|
|
293
|
-
* URL parameters that will be added when requesting tiles
|
|
294
|
-
*/
|
|
295
|
-
layerUrlParameters: PropTypes.object,
|
|
296
|
-
};
|
|
297
|
-
|
|
298
306
|
export default MlWmsLoader;
|
package/src/custom.d.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
declare module "*.svg" {
|
|
3
|
+
const content: any;
|
|
4
|
+
export default content;
|
|
5
|
+
export { content as ReactComponent };
|
|
6
|
+
}
|
|
7
|
+
declare module "*.js" {
|
|
8
|
+
const content: any;
|
|
9
|
+
export default content;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//declare module '@mapcomponents/react-core';
|
|
13
|
+
type MapContextType= {
|
|
14
|
+
mapIds: [string?];
|
|
15
|
+
mapExists: Function;
|
|
16
|
+
maps: [];
|
|
17
|
+
map: any,
|
|
18
|
+
getMap: Function;
|
|
19
|
+
setMap: Function;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
interface GeoJSON {
|
|
23
|
+
type: string,
|
|
24
|
+
features?: any
|
|
25
|
+
geometry?: any
|
|
26
|
+
}
|