@mapcomponents/react-maplibre 0.1.57 → 0.1.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +11 -0
- package/.eslintrc.js +20 -0
- package/.github/workflows/check-formatting.yml +46 -0
- package/.prettierignore +11 -0
- package/.prettierrc.json +6 -0
- package/CHANGELOG.md +13 -0
- package/coverage/clover.xml +229 -77
- package/coverage/coverage-final.json +43 -37
- package/coverage/lcov-report/index.html +65 -20
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +83 -83
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +66 -66
- package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +30 -30
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +202 -0
- package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +116 -0
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +99 -99
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +66 -66
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +221 -221
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.tsx.html +308 -308
- package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +497 -497
- package/coverage/lcov-report/src/components/MlGPXViewer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +85 -85
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +469 -0
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +116 -0
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +140 -140
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +37 -37
- package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +179 -179
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +113 -113
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +181 -181
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +58 -58
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +108 -108
- package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +39 -39
- package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +183 -183
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +163 -163
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +50 -50
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +30 -30
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +83 -83
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +204 -204
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +180 -180
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +163 -163
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +136 -136
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +53 -53
- package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +123 -123
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +35 -35
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +155 -155
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +255 -255
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
- package/coverage/lcov-report/src/contexts/MapContext.tsx.html +66 -66
- package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
- package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +48 -48
- package/coverage/lcov-report/src/contexts/index.html +1 -1
- package/coverage/lcov-report/src/hooks/exportMap/index.html +131 -0
- package/coverage/lcov-report/src/hooks/exportMap/index.ts.html +175 -0
- package/coverage/lcov-report/src/hooks/exportMap/lib.ts.html +646 -0
- package/coverage/lcov-report/src/hooks/index.html +48 -18
- package/coverage/lcov-report/src/hooks/useLayer.ts.html +230 -188
- package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +232 -0
- package/coverage/lcov-report/src/hooks/useMap.ts.html +72 -69
- package/coverage/lcov-report/src/hooks/useMapState.ts.html +145 -145
- package/coverage/lcov-report/src/hooks/useSource.ts.html +337 -0
- package/coverage/lcov-report/src/hooks/useWms.js.html +72 -72
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +11 -2
- package/coverage/lcov.info +448 -151
- package/dist/components/MlCreatePdfForm/MlCreatePdfForm.d.ts +24 -0
- package/dist/components/MlCreatePdfForm/MlCreatePdfForm.stories.d.ts +13 -0
- package/dist/components/MlCreatePdfForm/lib/PdfContext.d.ts +21 -0
- package/dist/components/MlCreatePdfForm/lib/PdfForm.d.ts +10 -0
- package/dist/components/MlCreatePdfForm/lib/PdfPreview.d.ts +13 -0
- package/dist/components/MlCreatePdfForm/lib/pdf.templates.d.ts +11 -0
- package/dist/components/MlFeatureEditor/lib/create_vertex.d.ts +1 -1
- package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.d.ts +22 -0
- package/dist/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.stories.d.ts +10 -0
- package/dist/components/MlLayerSwipe/MlLayerSwipe.d.ts +1 -1
- package/dist/components/MlWmsLayer/MlWmsLayer.d.ts +2 -2
- package/dist/decorators/MapContextDecoratorHooks.d.ts +2 -0
- package/dist/hooks/exportMap/index.d.ts +11 -0
- package/dist/hooks/exportMap/lib.d.ts +36 -0
- package/dist/hooks/useLayer.d.ts +6 -5
- package/dist/hooks/useLayerEvent.d.ts +2 -0
- package/dist/hooks/useMap.d.ts +1 -1
- package/dist/hooks/useMapState.stories.d.ts +2 -2
- package/dist/hooks/useSource.d.ts +17 -0
- package/dist/hooks/useSources.stories.d.ts +13 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +250 -64
- package/dist/index.esm.js.map +1 -1
- package/eslintErrorTest.js +10 -0
- package/package.json +7 -1
- package/public/thumbnails/MlCreatePdfForm.png +0 -0
- package/src/components/MapLibreMap/MapLibreMap.stories.js +72 -72
- package/src/components/MapLibreMap/MapLibreMap.test.js +60 -60
- package/src/components/MapLibreMap/MapLibreMap.tsx +82 -82
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.test.js +343 -343
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.ts +619 -619
- package/src/components/MlBasicComponent.js +25 -25
- package/src/components/MlCenterPosition/MlCenterPosition.stories.js +6 -6
- package/src/components/MlCenterPosition/MlCenterPosition.tsx +65 -65
- package/src/components/MlComponentTemplate/MlComponentTemplate.stories.js +5 -5
- package/src/components/MlComponentTemplate/MlComponentTemplate.tsx +23 -23
- package/src/components/MlCreatePdfButton/{MlCreatePdfButton.meta.json → MlCreatePdfButton.meta_.json} +0 -0
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.stories.js +16 -16
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx +29 -29
- package/src/components/MlCreatePdfButton/lib/createPdf.ts +175 -175
- package/src/components/MlCreatePdfButton/lib/nominatimMap.ts +51 -51
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.doc.de.md +3 -0
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.meta.json +15 -0
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.stories.tsx +152 -0
- package/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx +39 -0
- package/src/components/MlCreatePdfForm/lib/PdfContext.tsx +53 -0
- package/src/components/MlCreatePdfForm/lib/PdfForm.tsx +161 -0
- package/src/components/MlCreatePdfForm/lib/PdfPreview.tsx +399 -0
- package/src/components/MlCreatePdfForm/lib/pdf.templates.ts +82 -0
- package/src/components/MlFeatureEditor/MlFeatureEditor.stories.js +55 -55
- package/src/components/MlFeatureEditor/MlFeatureEditor.test.js +105 -105
- package/src/components/MlFeatureEditor/MlFeatureEditor.tsx +119 -119
- package/src/components/MlFeatureEditor/custom-direct-select-mode.js +208 -208
- package/src/components/MlFeatureEditor/custom-polygon-mode.js +148 -148
- package/src/components/MlFeatureEditor/custom-select-mode.js +314 -314
- package/src/components/MlFeatureEditor/lib/common_selectors.js +34 -34
- package/src/components/MlFeatureEditor/lib/constants.js +61 -61
- package/src/components/MlFeatureEditor/lib/constrain_feature_movement.js +51 -51
- package/src/components/MlFeatureEditor/lib/create_midpoint.js +30 -30
- package/src/components/MlFeatureEditor/lib/create_supplementary_points.js +82 -82
- package/src/components/MlFeatureEditor/lib/create_vertex.js +16 -16
- package/src/components/MlFeatureEditor/lib/double_click_zoom.js +23 -23
- package/src/components/MlFeatureEditor/lib/euclidean_distance.js +3 -3
- package/src/components/MlFeatureEditor/lib/features_at.js +23 -23
- package/src/components/MlFeatureEditor/lib/get_features_and_set_cursor.js +15 -15
- package/src/components/MlFeatureEditor/lib/is_click.js +8 -8
- package/src/components/MlFeatureEditor/lib/is_event_at_coordinates.js +2 -2
- package/src/components/MlFeatureEditor/lib/is_tap.js +6 -6
- package/src/components/MlFeatureEditor/lib/map_event_to_bounding_box.js +4 -4
- package/src/components/MlFeatureEditor/lib/mode_handler.js +105 -105
- package/src/components/MlFeatureEditor/lib/mouse_event_point.js +5 -5
- package/src/components/MlFeatureEditor/lib/move_features.js +33 -33
- package/src/components/MlFeatureEditor/lib/sort_features.js +25 -25
- package/src/components/MlFeatureEditor/lib/string_set.js +36 -36
- package/src/components/MlFeatureEditor/lib/string_sets_are_equal.js +2 -2
- package/src/components/MlFeatureEditor/lib/theme.js +230 -230
- package/src/components/MlFeatureEditor/lib/to_dense_array.js +1 -1
- package/src/components/MlFeatureEditor/lib/utils.js +40 -40
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.stories.js +9 -9
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.test.js +4 -4
- package/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx +65 -65
- package/src/components/MlFollowGps/MlFollowGps.stories.js +6 -6
- package/src/components/MlFollowGps/MlFollowGps.test.js +44 -44
- package/src/components/MlFollowGps/MlFollowGps.tsx +220 -220
- package/src/components/MlGPXViewer/MlGPXViewer.stories.js +15 -15
- package/src/components/MlGPXViewer/MlGPXViewer.test.js +12 -12
- package/src/components/MlGPXViewer/MlGPXViewer.tsx +345 -345
- package/src/components/MlGPXViewer/gpxConverter.js +496 -496
- package/src/components/MlGPXViewer/util/GeoJsonContext.ts +4 -4
- package/src/components/MlGPXViewer/util/GeoJsonProvider.tsx +16 -16
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.js +34 -34
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.test.js +8 -8
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx +84 -84
- package/src/components/MlGeoJsonLayer/util/getDefaultLayerTypeByGeometry.ts +21 -21
- package/src/components/MlGeoJsonLayer/util/getDefaultPaintPropsByType.ts +27 -27
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.doc.de.md +3 -0
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.meta_.json +15 -0
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.stories.js +19 -0
- package/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx +128 -0
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.stories.js +28 -28
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +8 -8
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx +162 -162
- package/src/components/MlLayer/MlLayer.stories.js +5 -5
- package/src/components/MlLayer/MlLayer.test.js +86 -86
- package/src/components/MlLayer/MlLayer.tsx +36 -36
- package/src/components/MlLayerMagnify/MlLayerMagnify.stories.js +21 -21
- package/src/components/MlLayerMagnify/MlLayerMagnify.test.js +54 -54
- package/src/components/MlLayerMagnify/MlLayerMagnify.tsx +201 -201
- package/src/components/MlLayerSwipe/MlLayerSwipe.stories.js +20 -20
- package/src/components/MlLayerSwipe/MlLayerSwipe.test.js +54 -54
- package/src/components/MlLayerSwipe/MlLayerSwipe.tsx +130 -130
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.js +194 -194
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.stories.js +85 -85
- package/src/components/MlLayerSwitcher/components/LayerBox.js +57 -57
- package/src/components/MlMarker/MlMarker.stories.js +7 -7
- package/src/components/MlMarker/MlMarker.tsx +119 -119
- package/src/components/MlMeasureTool/MlMeasureTool.stories.js +64 -64
- package/src/components/MlMeasureTool/MlMeasureTool.tsx +38 -38
- package/src/components/MlNavigationCompass/MlNavigationCompass.stories.js +45 -45
- package/src/components/MlNavigationCompass/MlNavigationCompass.test.js +40 -40
- package/src/components/MlNavigationCompass/MlNavigationCompass.tsx +192 -192
- package/src/components/MlNavigationTools/MlNavigationTools.stories.js +18 -18
- package/src/components/MlNavigationTools/MlNavigationTools.tsx +173 -173
- package/src/components/MlOsmLayer/MlOsmLayer.js +49 -49
- package/src/components/MlOsmLayer/MlOsmLayer.stories_.js +29 -29
- package/src/components/MlOsmLayer/MlOsmLayer.test.js +8 -8
- package/src/components/MlScaleReference/MlScaleReference.js +82 -82
- package/src/components/MlScaleReference/MlScaleReference.stories.js +27 -27
- package/src/components/MlShareMapState/MlShareMapState.js +203 -203
- package/src/components/MlShareMapState/MlShareMapState.stories.js +68 -68
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js +201 -201
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +35 -35
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.test.js +8 -8
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.js +186 -186
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.stories.js +21 -21
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.test.js +24 -24
- package/src/components/MlThreeJsLayer/lib/GLTFLoader.js +3327 -3327
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.stories.js +31 -30
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.test.js +8 -8
- package/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx +146 -146
- package/src/components/MlTransitionGeoJsonLayer/util/transitionFunctions.js +207 -207
- package/src/components/MlUseMapDebugger/MlUseMapDebugger.js +52 -52
- package/src/components/MlUseMapDebugger/MlUseMapDebugger.stories.js +13 -13
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.stories.js +27 -27
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.test.js +27 -27
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx +137 -137
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js +34 -34
- package/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.stories.js +7 -7
- package/src/components/MlWmsLayer/MlWmsLayer.stories.js +26 -26
- package/src/components/MlWmsLayer/MlWmsLayer.test.js +8 -8
- package/src/components/MlWmsLayer/MlWmsLayer.tsx +167 -167
- package/src/components/MlWmsLoader/MlWmsLoader.stories.js +27 -27
- package/src/components/MlWmsLoader/MlWmsLoader.tsx +254 -254
- package/src/contexts/MapComponentsProvider.test.js +229 -229
- package/src/contexts/MapContext.tsx +65 -65
- package/src/contexts/SimpleDataProvider.js +47 -47
- package/src/contexts/SimpleDataProvider.test.js +29 -29
- package/src/custom.d.tsx +14 -14
- package/src/decorators/MapContextDecorator.js +22 -22
- package/src/decorators/MapContextDecoratorHooks.js +34 -0
- package/src/decorators/MultiMapContextDecorator.js +63 -63
- package/src/decorators/NoNavToolsDecorator.js +17 -17
- package/src/decorators/ThemeWrapper.jsx +1 -1
- package/src/hooks/assets/pointWG.json +13 -0
- package/src/hooks/exportMap/index.ts +30 -0
- package/src/hooks/exportMap/lib.ts +187 -0
- package/src/hooks/useLayer.test.js +188 -188
- package/src/hooks/useLayer.ts +194 -180
- package/src/hooks/useLayerEvent.js +49 -0
- package/src/hooks/useMap.ts +67 -66
- package/src/hooks/useMapState.stories.js +78 -78
- package/src/hooks/useMapState.ts +161 -161
- package/src/hooks/useSource.ts +84 -0
- package/src/hooks/useSources.stories.js +232 -0
- package/src/hooks/useWms.js +71 -71
- package/src/index.ts +3 -0
- package/src/setupTests.js +86 -86
- package/src/ui_components/ImageLoader.js +62 -62
- package/src/ui_components/Legend.js +34 -34
- package/src/ui_components/LoadingOverlay.js +29 -29
- package/src/ui_components/LoadingOverlayContext.js +68 -68
- package/src/ui_components/Sidebar.js +80 -80
- package/src/ui_components/Tooltip.js +9 -9
- package/src/ui_components/TopToolbar.js +23 -23
- package/src/util/layerRemovalTest.js +111 -111
- package/src/util/sourceRemovalTest.js +103 -103
package/dist/index.esm.js
CHANGED
|
@@ -293,18 +293,18 @@ var MapLibreGlWrapper = /** @class */ (function () {
|
|
|
293
293
|
//let paint = {};
|
|
294
294
|
//let values = layer.paint?._values;
|
|
295
295
|
//Object.keys(values || {}).map((propName) => {
|
|
296
|
-
//
|
|
297
|
-
//
|
|
298
|
-
//
|
|
299
|
-
//
|
|
296
|
+
// paint[propName] =
|
|
297
|
+
// typeof values[propName].value !== "undefined"
|
|
298
|
+
// ? values[propName].value.value
|
|
299
|
+
// : values[propName];
|
|
300
300
|
//});
|
|
301
301
|
//let layout = {};
|
|
302
302
|
//values = layer.layout?._values;
|
|
303
303
|
//Object.keys(values || {}).map((propName) => {
|
|
304
|
-
//
|
|
305
|
-
//
|
|
306
|
-
//
|
|
307
|
-
//
|
|
304
|
+
// layout[propName] =
|
|
305
|
+
// typeof values[propName].value !== "undefined"
|
|
306
|
+
// ? values[propName].value.value
|
|
307
|
+
// : values[propName];
|
|
308
308
|
//});
|
|
309
309
|
return {
|
|
310
310
|
id: layer.id,
|
|
@@ -598,7 +598,7 @@ var MapLibreGlWrapper = /** @class */ (function () {
|
|
|
598
598
|
};
|
|
599
599
|
});
|
|
600
600
|
this.addNativeMaplibreFunctionsAndProps = function () {
|
|
601
|
-
//
|
|
601
|
+
// add MapLibre-gl functions
|
|
602
602
|
Object.getOwnPropertyNames(Object.getPrototypeOf(_this.map)).forEach(function (item) {
|
|
603
603
|
if (typeof _this[item] === "undefined") {
|
|
604
604
|
_this[item] = function () {
|
|
@@ -611,7 +611,7 @@ var MapLibreGlWrapper = /** @class */ (function () {
|
|
|
611
611
|
};
|
|
612
612
|
}
|
|
613
613
|
});
|
|
614
|
-
//
|
|
614
|
+
// add MapLibre-gl properties
|
|
615
615
|
Object.keys(_this.map).forEach(function (item) {
|
|
616
616
|
if (typeof _this[item] === "undefined") {
|
|
617
617
|
_this[item] = self.map[item];
|
|
@@ -957,13 +957,12 @@ function useMap(props) {
|
|
|
957
957
|
},
|
|
958
958
|
});
|
|
959
959
|
var initializedRef = useRef(false);
|
|
960
|
-
var mapRef = useRef(
|
|
960
|
+
var mapRef = useRef();
|
|
961
961
|
var componentId = useRef(v4());
|
|
962
962
|
var _b = useState(false), mapIsReady = _b[0], setMapIsReady = _b[1];
|
|
963
963
|
var cleanup = function () {
|
|
964
964
|
if (mapRef.current) {
|
|
965
965
|
mapRef.current.cleanup(componentId.current);
|
|
966
|
-
mapRef.current = undefined;
|
|
967
966
|
}
|
|
968
967
|
initializedRef.current = false;
|
|
969
968
|
};
|
|
@@ -971,6 +970,7 @@ function useMap(props) {
|
|
|
971
970
|
return function () {
|
|
972
971
|
cleanup();
|
|
973
972
|
setMapIsReady(false);
|
|
973
|
+
mapRef.current = undefined;
|
|
974
974
|
};
|
|
975
975
|
}, []);
|
|
976
976
|
useEffect(function () {
|
|
@@ -10091,7 +10091,7 @@ function isEventAtCoordinates(event, coordinates) {
|
|
|
10091
10091
|
* @param {string} parentId
|
|
10092
10092
|
* @param {Array<number>} coordinates
|
|
10093
10093
|
* @param {string} path - Dot-separated numbers indicating exactly
|
|
10094
|
-
*
|
|
10094
|
+
* where the point exists within its parent feature's coordinates.
|
|
10095
10095
|
* @param {boolean} selected
|
|
10096
10096
|
* @return {GeoJSON} Point
|
|
10097
10097
|
*/
|
|
@@ -11368,7 +11368,7 @@ var LAT_MIN = LAT_MIN$1,
|
|
|
11368
11368
|
LNG_MAX = LNG_MAX$1; // Ensure that we do not drag north-south far enough for
|
|
11369
11369
|
// - any part of any feature to exceed the poles
|
|
11370
11370
|
// - any feature to be completely lost in the space between the projection's
|
|
11371
|
-
//
|
|
11371
|
+
// edge and the poles, such that it couldn't be re-selected and moved back
|
|
11372
11372
|
|
|
11373
11373
|
var constrain_feature_movement = function constrain_feature_movement(geojsonFeatures, delta) {
|
|
11374
11374
|
// "inner edge" = a feature's latitude closest to the equator
|
|
@@ -11617,7 +11617,7 @@ CustomSelectMode.clickOnVertex = function (state, e) {
|
|
|
11617
11617
|
this.changeMode("custom_direct_select", {
|
|
11618
11618
|
featureId: e.featureTarget.properties.parent,
|
|
11619
11619
|
coordPath: e.featureTarget.properties.coord_path,
|
|
11620
|
-
startPos: e.lngLat //
|
|
11620
|
+
startPos: e.lngLat // groupMove_vertices: matchingVertices,
|
|
11621
11621
|
|
|
11622
11622
|
});
|
|
11623
11623
|
this.updateUIClasses({
|
|
@@ -12268,27 +12268,27 @@ var MlFeatureEditor = function (props) {
|
|
|
12268
12268
|
};
|
|
12269
12269
|
|
|
12270
12270
|
var legalLayerTypes = [
|
|
12271
|
-
|
|
12272
|
-
|
|
12273
|
-
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
|
|
12278
|
-
|
|
12279
|
-
|
|
12271
|
+
'fill',
|
|
12272
|
+
'line',
|
|
12273
|
+
'symbol',
|
|
12274
|
+
'circle',
|
|
12275
|
+
'heatmap',
|
|
12276
|
+
'fill-extrusion',
|
|
12277
|
+
'raster',
|
|
12278
|
+
'hillshade',
|
|
12279
|
+
'background',
|
|
12280
12280
|
];
|
|
12281
12281
|
function useLayer(props) {
|
|
12282
12282
|
var mapHook = useMap({
|
|
12283
12283
|
mapId: props.mapId,
|
|
12284
12284
|
waitForLayer: props.insertBeforeLayer,
|
|
12285
12285
|
});
|
|
12286
|
-
var layerTypeRef = useRef(
|
|
12287
|
-
var layerPaintConfRef = useRef(
|
|
12288
|
-
var layerLayoutConfRef = useRef(
|
|
12286
|
+
var layerTypeRef = useRef('');
|
|
12287
|
+
var layerPaintConfRef = useRef('');
|
|
12288
|
+
var layerLayoutConfRef = useRef('');
|
|
12289
12289
|
var _a = useState(), layer = _a[0], setLayer = _a[1];
|
|
12290
12290
|
var initializedRef = useRef(false);
|
|
12291
|
-
var layerId = useRef(props.layerId || (props.idPrefix ? props.idPrefix :
|
|
12291
|
+
var layerId = useRef(props.layerId || (props.idPrefix ? props.idPrefix : 'Layer-') + mapHook.componentId);
|
|
12292
12292
|
var createLayer = useCallback(function () {
|
|
12293
12293
|
var _a, _b;
|
|
12294
12294
|
if (!mapHook.map)
|
|
@@ -12299,34 +12299,43 @@ function useLayer(props) {
|
|
|
12299
12299
|
if (mapHook.map.map.getSource(layerId.current)) {
|
|
12300
12300
|
mapHook.map.map.removeSource(layerId.current);
|
|
12301
12301
|
}
|
|
12302
|
+
if (typeof props.source === 'string') {
|
|
12303
|
+
if (props.source === '' || !mapHook.map.map.getSource(props.source)) {
|
|
12304
|
+
return;
|
|
12305
|
+
}
|
|
12306
|
+
}
|
|
12302
12307
|
initializedRef.current = true;
|
|
12303
|
-
mapHook.map.addLayer(__assign(__assign(__assign({}, props.options), (props.geojson
|
|
12308
|
+
mapHook.map.addLayer(__assign(__assign(__assign(__assign({}, props.options), (props.geojson && !props.source
|
|
12304
12309
|
? {
|
|
12305
12310
|
source: {
|
|
12306
|
-
type:
|
|
12311
|
+
type: 'geojson',
|
|
12307
12312
|
data: props.geojson,
|
|
12308
12313
|
},
|
|
12309
12314
|
}
|
|
12315
|
+
: {})), (props.source
|
|
12316
|
+
? {
|
|
12317
|
+
source: props.source,
|
|
12318
|
+
}
|
|
12310
12319
|
: {})), { id: layerId.current }), props.insertBeforeLayer
|
|
12311
12320
|
? props.insertBeforeLayer
|
|
12312
12321
|
: props.insertBeforeFirstSymbolLayer
|
|
12313
12322
|
? mapHook.map.firstSymbolLayer
|
|
12314
12323
|
: undefined, mapHook.componentId);
|
|
12315
12324
|
setLayer(mapHook.map.map.getLayer(layerId.current));
|
|
12316
|
-
if (typeof props.onHover !==
|
|
12317
|
-
mapHook.map.on(
|
|
12325
|
+
if (typeof props.onHover !== 'undefined') {
|
|
12326
|
+
mapHook.map.on('mousemove', layerId.current, props.onHover, mapHook.componentId);
|
|
12318
12327
|
}
|
|
12319
|
-
if (typeof props.onClick !==
|
|
12320
|
-
mapHook.map.on(
|
|
12328
|
+
if (typeof props.onClick !== 'undefined') {
|
|
12329
|
+
mapHook.map.on('click', layerId.current, props.onClick, mapHook.componentId);
|
|
12321
12330
|
}
|
|
12322
|
-
if (typeof props.onLeave !==
|
|
12323
|
-
mapHook.map.on(
|
|
12331
|
+
if (typeof props.onLeave !== 'undefined') {
|
|
12332
|
+
mapHook.map.on('mouseleave', layerId.current, props.onLeave, mapHook.componentId);
|
|
12324
12333
|
}
|
|
12325
12334
|
// recreate layer if style has changed
|
|
12326
|
-
mapHook.map.on(
|
|
12335
|
+
mapHook.map.on('styledata', function () {
|
|
12327
12336
|
var _a;
|
|
12328
12337
|
if (initializedRef.current && !((_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map.getLayer(layerId.current))) {
|
|
12329
|
-
console.log(
|
|
12338
|
+
console.log('Recreate Layer');
|
|
12330
12339
|
createLayer();
|
|
12331
12340
|
}
|
|
12332
12341
|
}, mapHook.componentId);
|
|
@@ -12349,6 +12358,7 @@ function useLayer(props) {
|
|
|
12349
12358
|
var _a, _b, _c, _d;
|
|
12350
12359
|
if (!initializedRef.current || !((_b = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.getSource(layerId.current)))
|
|
12351
12360
|
return;
|
|
12361
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12352
12362
|
//@ts-ignore setData only exists on GeoJsonSource
|
|
12353
12363
|
(_d = (_c = mapHook.map.map.getSource(layerId.current)) === null || _c === void 0 ? void 0 : _c.setData) === null || _d === void 0 ? void 0 : _d.call(_c, props.geojson);
|
|
12354
12364
|
}, [props.geojson, mapHook.map, props.options.type]);
|
|
@@ -12757,8 +12767,8 @@ var MlImageMarkerLayer = function (props) {
|
|
|
12757
12767
|
};
|
|
12758
12768
|
|
|
12759
12769
|
//const unitSquareConvert = {
|
|
12760
|
-
//
|
|
12761
|
-
//
|
|
12770
|
+
// kilometers: 1,
|
|
12771
|
+
// miles: 1 / 2.58998811,
|
|
12762
12772
|
//};
|
|
12763
12773
|
function getUnitSquareMultiplier(measureType) {
|
|
12764
12774
|
return measureType === "miles" ? 1 / 2.58998811 : 1;
|
|
@@ -13179,9 +13189,9 @@ var SvgNeedle = function SvgNeedle(props) {
|
|
|
13179
13189
|
}))));
|
|
13180
13190
|
};
|
|
13181
13191
|
|
|
13182
|
-
var NeedleButton = styled$3.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n
|
|
13183
|
-
var NeedleContainer = styled$3.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n
|
|
13184
|
-
var RotateButton = styled$3.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n
|
|
13192
|
+
var NeedleButton = styled$3.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\twidth: 40%;\n\tdisplay: flex;\n\talign-items: center;\n\n\t&:hover {\n\t\tcursor: pointer;\n\t}\n\tpath {\n\t\tfilter: drop-shadow(0px 0px 15px rgba(0, 0, 0, 0.2));\n\t}\n\t&:hover path {\n\t\tfilter: drop-shadow(0px 0px 13px rgba(255, 255, 255, 0.1));\n\t}\n\tpath:nth-of-type(2) {\n\t\tfill: #343434;\n\t}\n\t&:hover path:nth-of-type(2) {\n\t\tfill: #434343;\n\t}\n\tpath:nth-of-type(1) {\n\t\tfill: #e90318;\n\t}\n\t&:hover path:nth-of-type(1) {\n\t\tfill: #fb4052;\n\t}\n"], ["\n\twidth: 40%;\n\tdisplay: flex;\n\talign-items: center;\n\n\t&:hover {\n\t\tcursor: pointer;\n\t}\n\tpath {\n\t\tfilter: drop-shadow(0px 0px 15px rgba(0, 0, 0, 0.2));\n\t}\n\t&:hover path {\n\t\tfilter: drop-shadow(0px 0px 13px rgba(255, 255, 255, 0.1));\n\t}\n\tpath:nth-of-type(2) {\n\t\tfill: #343434;\n\t}\n\t&:hover path:nth-of-type(2) {\n\t\tfill: #434343;\n\t}\n\tpath:nth-of-type(1) {\n\t\tfill: #e90318;\n\t}\n\t&:hover path:nth-of-type(1) {\n\t\tfill: #fb4052;\n\t}\n"])));
|
|
13193
|
+
var NeedleContainer = styled$3.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\tpointer-events: none;\n\tdisplay: flex;\n\tz-index: 1002;\n\tposition: absolute;\n\talign-items: center;\n\n\tmargin-left: -30%;\n\tpath:nth-of-type(2) {\n\t}\n\tsvg g {\n\t\ttransform: translate(-76.7053, -29.7727) scale(2, 1);\n\t}\n\tsvg {\n\t\tz-index: 9990;\n\t\theight: 150px;\n\t\twidth: 200px;\n\t}\n"], ["\n\tpointer-events: none;\n\tdisplay: flex;\n\tz-index: 1002;\n\tposition: absolute;\n\talign-items: center;\n\n\tmargin-left: -30%;\n\tpath:nth-of-type(2) {\n\t}\n\tsvg g {\n\t\ttransform: translate(-76.7053, -29.7727) scale(2, 1);\n\t}\n\tsvg {\n\t\tz-index: 9990;\n\t\theight: 150px;\n\t\twidth: 200px;\n\t}\n"])));
|
|
13194
|
+
var RotateButton = styled$3.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\twidth: 30%;\n\tmargin-top: 14px;\n\tz-index: 999;\n\tdisplay: flex;\n\n\tsvg:hover {\n\t\tcursor: pointer;\n\t}\n\tsvg:hover path {\n\t\tfill: #ececec;\n\t\tfilter: drop-shadow(0px 0px 5px rgba(0, 0, 0, 0.1));\n\t}\n\tpath {\n\t\tfill: #bbb;\n\t}\n\tsvg {\n\t\ttransform: scale(0.6);\n\t\tz-index: 9990;\n\t\theight: 172px;\n\t}\n"], ["\n\twidth: 30%;\n\tmargin-top: 14px;\n\tz-index: 999;\n\tdisplay: flex;\n\n\tsvg:hover {\n\t\tcursor: pointer;\n\t}\n\tsvg:hover path {\n\t\tfill: #ececec;\n\t\tfilter: drop-shadow(0px 0px 5px rgba(0, 0, 0, 0.1));\n\t}\n\tpath {\n\t\tfill: #bbb;\n\t}\n\tsvg {\n\t\ttransform: scale(0.6);\n\t\tz-index: 9990;\n\t\theight: 172px;\n\t}\n"])));
|
|
13185
13195
|
/**
|
|
13186
13196
|
* Navigation component that displays a compass component which indicates the current oriantation of the map it is registered for and offers controls to turn the bearing 90° left/right or reset north to point up.
|
|
13187
13197
|
*
|
|
@@ -13700,13 +13710,13 @@ var defaultProps = {
|
|
|
13700
13710
|
* @param {object} props
|
|
13701
13711
|
* @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
|
|
13702
13712
|
* @param {string} props.url WMS URL
|
|
13703
|
-
* @param {bool}
|
|
13713
|
+
* @param {bool} props.visible Sets layer "visibility" property to "visible" if true or "none" if false
|
|
13704
13714
|
* @param {string} props.attribution MapLibre attribution shown in the bottom right of the map, if this layer is visible
|
|
13705
13715
|
* @param {string} props.mapId Id of the target MapLibre instance in mapContext
|
|
13706
13716
|
* @param {object} props.sourceOptions Object that is passed to the MapLibre.addSource call as config option parameter
|
|
13707
13717
|
* @param {object} props.layerOptions Object that is passed to the MapLibre.addLayer call as config option parameter
|
|
13708
13718
|
* @param {string} props.insertBeforeLayer Id of an existing layer in the mapLibre instance to help specify the layer order
|
|
13709
|
-
|
|
13719
|
+
This layer will be visually beneath the layer with the "insertBeforeLayer" id
|
|
13710
13720
|
*
|
|
13711
13721
|
* @component
|
|
13712
13722
|
*/
|
|
@@ -14124,27 +14134,27 @@ var MlLayerMagnify = function (props) {
|
|
|
14124
14134
|
/*
|
|
14125
14135
|
automatically adjust radius for small screens
|
|
14126
14136
|
if (
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14137
|
+
mapContext.maps[props.map1Id].getCanvas().clientWidth >
|
|
14138
|
+
mapContext.maps[props.map1Id].getCanvas().clientHeight &&
|
|
14139
|
+
magnifierRadius * 2 >
|
|
14140
|
+
mapContext.maps[props.map1Id].getCanvas().clientHeight
|
|
14131
14141
|
) {
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14142
|
+
magnifierRadius = Math.floor(
|
|
14143
|
+
mapContext.maps[props.map1Id].getCanvas().clientHeight / 2
|
|
14144
|
+
);
|
|
14145
|
+
setMagnifierRadius(magnifierRadius);
|
|
14136
14146
|
}
|
|
14137
|
-
|
|
14147
|
+
|
|
14138
14148
|
if (
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14149
|
+
mapContext.maps[props.map1Id].getCanvas().clientHeight >
|
|
14150
|
+
mapContext.maps[props.map1Id].getCanvas().clientWidth &&
|
|
14151
|
+
magnifierRadius * 2 >
|
|
14152
|
+
mapContext.maps[props.map1Id].getCanvas().clientWidth
|
|
14143
14153
|
) {
|
|
14144
|
-
|
|
14145
|
-
|
|
14146
|
-
|
|
14147
|
-
|
|
14154
|
+
magnifierRadius = Math.floor(
|
|
14155
|
+
mapContext.maps[props.map1Id].getCanvas().clientWidth / 2
|
|
14156
|
+
);
|
|
14157
|
+
setMagnifierRadius(magnifierRadius);
|
|
14148
14158
|
}
|
|
14149
14159
|
*/
|
|
14150
14160
|
onMove({
|
|
@@ -14200,7 +14210,7 @@ MlLayerMagnify.defaultProps = {
|
|
|
14200
14210
|
};
|
|
14201
14211
|
|
|
14202
14212
|
/**
|
|
14203
|
-
*
|
|
14213
|
+
* creates a split view of 2 synchronised maplibre instances
|
|
14204
14214
|
*/
|
|
14205
14215
|
var MlLayerSwipe = function (props) {
|
|
14206
14216
|
var mapContext = useContext(MapContext);
|
|
@@ -18943,6 +18953,182 @@ useWms.defaultProps = {
|
|
|
18943
18953
|
}
|
|
18944
18954
|
};
|
|
18945
18955
|
|
|
18956
|
+
function useSource(props) {
|
|
18957
|
+
var _a;
|
|
18958
|
+
var mapHook = useMap({
|
|
18959
|
+
mapId: props.mapId,
|
|
18960
|
+
});
|
|
18961
|
+
var initializedRef = useRef(false);
|
|
18962
|
+
var _b = useState(), source = _b[0], setSource = _b[1];
|
|
18963
|
+
var sourceId = useRef(props.sourceId || (props.idPrefix ? props.idPrefix : "Source-") + mapHook.componentId);
|
|
18964
|
+
var createSource = useCallback(function () {
|
|
18965
|
+
var _a;
|
|
18966
|
+
if (!mapHook.map)
|
|
18967
|
+
return;
|
|
18968
|
+
initializedRef.current = true;
|
|
18969
|
+
if (mapHook.map.map.getSource(sourceId.current)) {
|
|
18970
|
+
mapHook.cleanup();
|
|
18971
|
+
}
|
|
18972
|
+
(_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.addSource(sourceId.current, __assign({}, props.source));
|
|
18973
|
+
setSource(mapHook.map.map.getSource(sourceId.current));
|
|
18974
|
+
}, [props, mapHook.map]);
|
|
18975
|
+
useEffect(function () {
|
|
18976
|
+
if (!mapHook.map || initializedRef.current)
|
|
18977
|
+
return;
|
|
18978
|
+
createSource();
|
|
18979
|
+
}, [mapHook.map, props, createSource]);
|
|
18980
|
+
useEffect(function () {
|
|
18981
|
+
var _a, _b, _c, _d;
|
|
18982
|
+
if (!initializedRef.current || !((_b = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.getSource(props.sourceId)))
|
|
18983
|
+
return;
|
|
18984
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
18985
|
+
//@ts-ignore setData only exists on GeoJsonSource
|
|
18986
|
+
(_d = (_c = mapHook.map.map.getSource(props.sourceId)) === null || _c === void 0 ? void 0 : _c.setData) === null || _d === void 0 ? void 0 : _d.call(_c, props.source.data);
|
|
18987
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
18988
|
+
//@ts-ignore data only exists on GeoJsonSource
|
|
18989
|
+
}, [(_a = props.source) === null || _a === void 0 ? void 0 : _a.data]);
|
|
18990
|
+
//cleanup
|
|
18991
|
+
useEffect(function () {
|
|
18992
|
+
return function () {
|
|
18993
|
+
initializedRef.current = false;
|
|
18994
|
+
if (mapHook.map) {
|
|
18995
|
+
for (var _i = 0, _a = Object.entries(mapHook.map.map.style._layers); _i < _a.length; _i++) {
|
|
18996
|
+
var _b = _a[_i], layerId = _b[0], layer = _b[1];
|
|
18997
|
+
if (layer.source === sourceId.current) {
|
|
18998
|
+
mapHook.map.map.removeLayer(layerId);
|
|
18999
|
+
}
|
|
19000
|
+
}
|
|
19001
|
+
mapHook.map.map.removeSource(sourceId.current);
|
|
19002
|
+
}
|
|
19003
|
+
};
|
|
19004
|
+
}, [mapHook.map]);
|
|
19005
|
+
return {
|
|
19006
|
+
map: mapHook.map,
|
|
19007
|
+
source: source,
|
|
19008
|
+
componentId: mapHook.componentId,
|
|
19009
|
+
mapHook: mapHook,
|
|
19010
|
+
};
|
|
19011
|
+
}
|
|
19012
|
+
|
|
19013
|
+
var createExport = function (options) {
|
|
19014
|
+
var width = options.width;
|
|
19015
|
+
var height = options.height;
|
|
19016
|
+
// Create map container
|
|
19017
|
+
var hiddenContainer = document.createElement('div');
|
|
19018
|
+
hiddenContainer.className = 'hidden-map';
|
|
19019
|
+
document.body.appendChild(hiddenContainer);
|
|
19020
|
+
var container = document.createElement('div');
|
|
19021
|
+
container.style.width = width + 'px';
|
|
19022
|
+
container.style.height = height + 'px';
|
|
19023
|
+
hiddenContainer.appendChild(container);
|
|
19024
|
+
var style = options.map.map.getStyle();
|
|
19025
|
+
var _loop_1 = function (name_1) {
|
|
19026
|
+
var src = style.sources[name_1];
|
|
19027
|
+
Object.keys(src).forEach(function (key) {
|
|
19028
|
+
// delete property if value is undefined.
|
|
19029
|
+
// for instance, raster-dem might have undefined value in "url" and "bounds"
|
|
19030
|
+
if (!src[key]) {
|
|
19031
|
+
delete src[key];
|
|
19032
|
+
}
|
|
19033
|
+
});
|
|
19034
|
+
};
|
|
19035
|
+
// delete undefined source properties
|
|
19036
|
+
for (var name_1 in style.sources) {
|
|
19037
|
+
_loop_1(name_1);
|
|
19038
|
+
}
|
|
19039
|
+
// Create a new MapLibre-gl instance
|
|
19040
|
+
var renderMap = new Map$2({
|
|
19041
|
+
container: container,
|
|
19042
|
+
center: options.map.map.getCenter(),
|
|
19043
|
+
zoom: options.map.map.getZoom(),
|
|
19044
|
+
bearing: 0,
|
|
19045
|
+
pitch: 0,
|
|
19046
|
+
interactive: false,
|
|
19047
|
+
preserveDrawingBuffer: true,
|
|
19048
|
+
fadeDuration: 0,
|
|
19049
|
+
attributionControl: false,
|
|
19050
|
+
style: style,
|
|
19051
|
+
});
|
|
19052
|
+
var _previewGeojson = turf.bboxPolygon([
|
|
19053
|
+
options.bbox[0],
|
|
19054
|
+
options.bbox[1],
|
|
19055
|
+
options.bbox[2],
|
|
19056
|
+
options.bbox[3],
|
|
19057
|
+
]);
|
|
19058
|
+
_previewGeojson = turf.transformRotate(_previewGeojson, options.bearing);
|
|
19059
|
+
// use original unrotated bbox and bearing 0 to calculate the correct zoom value as the function always adds a padding if used on the rotated feature coordinates
|
|
19060
|
+
var bboxCamera = renderMap._cameraForBoxAndBearing([options.bboxUnrotated[0], options.bboxUnrotated[1]], [options.bboxUnrotated[2], options.bboxUnrotated[3]], 0);
|
|
19061
|
+
var geometryCamera = renderMap._cameraForBoxAndBearing(_previewGeojson.geometry.coordinates[0][0], _previewGeojson.geometry.coordinates[0][2], options.bearing);
|
|
19062
|
+
geometryCamera.zoom = bboxCamera.zoom;
|
|
19063
|
+
renderMap._fitInternal(geometryCamera);
|
|
19064
|
+
return new Promise(function (resolve) {
|
|
19065
|
+
renderMap.once('idle', function () {
|
|
19066
|
+
if (renderMap.getLayer('pdfPreviewGeojsonOutline')) {
|
|
19067
|
+
renderMap.setLayoutProperty('pdfPreviewGeojsonOutline', 'visibility', 'none');
|
|
19068
|
+
}
|
|
19069
|
+
if (renderMap.getLayer('pdfPreviewGeojson')) {
|
|
19070
|
+
renderMap.setLayoutProperty('pdfPreviewGeojson', 'visibility', 'none');
|
|
19071
|
+
}
|
|
19072
|
+
if (renderMap.getLayer('pdfPreviewGeojsonResizeHandle')) {
|
|
19073
|
+
renderMap.setLayoutProperty('pdfPreviewGeojsonResizeHandle', 'visibility', 'none');
|
|
19074
|
+
}
|
|
19075
|
+
if (renderMap.getLayer('pdfPreviewGeojsonRotationHandle')) {
|
|
19076
|
+
renderMap.setLayoutProperty('pdfPreviewGeojsonRotationHandle', 'visibility', 'none');
|
|
19077
|
+
}
|
|
19078
|
+
renderMap.once('idle', function () {
|
|
19079
|
+
var params = __assign(__assign({}, options), { renderMap: renderMap, hiddenContainer: hiddenContainer, createPdf: function (_options) {
|
|
19080
|
+
return createJsPdf(__assign(__assign(__assign({}, options), { renderMap: renderMap, hiddenContainer: hiddenContainer }), _options));
|
|
19081
|
+
} });
|
|
19082
|
+
resolve(params);
|
|
19083
|
+
});
|
|
19084
|
+
});
|
|
19085
|
+
});
|
|
19086
|
+
};
|
|
19087
|
+
function createJsPdf(options) {
|
|
19088
|
+
var pdf = new jsPDF({
|
|
19089
|
+
orientation: (options === null || options === void 0 ? void 0 : options.orientation) === 'portrait' ? 'p' : 'l',
|
|
19090
|
+
unit: 'mm',
|
|
19091
|
+
compress: true,
|
|
19092
|
+
format: options.format,
|
|
19093
|
+
});
|
|
19094
|
+
Object.defineProperty(window, 'devicePixelRatio', {
|
|
19095
|
+
get: function () {
|
|
19096
|
+
return 300 / 96;
|
|
19097
|
+
},
|
|
19098
|
+
});
|
|
19099
|
+
return new Promise(function (resolve) {
|
|
19100
|
+
var _a;
|
|
19101
|
+
//Render map image
|
|
19102
|
+
pdf.addImage(options.renderMap.getCanvas().toDataURL('image/png'), 'png', 0, 0, pdf.internal.pageSize.getWidth(), pdf.internal.pageSize.getHeight(), undefined, 'FAST');
|
|
19103
|
+
// remove DOM Elements
|
|
19104
|
+
options.renderMap.remove();
|
|
19105
|
+
(_a = options.hiddenContainer.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(options.hiddenContainer);
|
|
19106
|
+
var params = __assign(__assign({}, options), { pdf: pdf, downloadPdf: function (_options) { return downloadPdf(__assign(__assign({}, params), _options)); } });
|
|
19107
|
+
resolve(params);
|
|
19108
|
+
});
|
|
19109
|
+
}
|
|
19110
|
+
function downloadPdf(options) {
|
|
19111
|
+
options.pdf.save('Map.pdf');
|
|
19112
|
+
return new Promise(function (resolve) {
|
|
19113
|
+
resolve(__assign({}, options));
|
|
19114
|
+
});
|
|
19115
|
+
}
|
|
19116
|
+
|
|
19117
|
+
function exportMap(props) {
|
|
19118
|
+
var mapHook = useMap({ mapId: props.mapId });
|
|
19119
|
+
var _createExport = useMemo(function () {
|
|
19120
|
+
if (mapHook.map) {
|
|
19121
|
+
return function (options) {
|
|
19122
|
+
return createExport(__assign({ map: mapHook.map }, options));
|
|
19123
|
+
};
|
|
19124
|
+
}
|
|
19125
|
+
return;
|
|
19126
|
+
}, [mapHook.map]);
|
|
19127
|
+
return {
|
|
19128
|
+
createExport: _createExport,
|
|
19129
|
+
};
|
|
19130
|
+
}
|
|
19131
|
+
|
|
18946
19132
|
var SimpleDataContext = /*#__PURE__*/React__default.createContext({});
|
|
18947
19133
|
var SimpleDataContextProvider = SimpleDataContext.Provider;
|
|
18948
19134
|
|
|
@@ -19005,5 +19191,5 @@ SimpleDataProvider.propTypes = {
|
|
|
19005
19191
|
children: PropTypes.node.isRequired
|
|
19006
19192
|
};
|
|
19007
19193
|
|
|
19008
|
-
export { GeoJsonContext, GeoJsonProvider, MapComponentsProvider, MapContext, MapLibreMap, MlBasicComponent, MlComponentTemplate, MlCreatePdfButton, MlFeatureEditor, MlFillExtrusionLayer, MlFollowGps, MlGPXViewer, MlGeoJsonLayer, MlImageMarkerLayer, MlLayer, MlLayerMagnify, MlLayerSwipe, MlMarker, MlMeasureTool, MlNavigationCompass, MlNavigationTools, MlOsmLayer, MlScaleReference, MlSpatialElevationProfile, MlTransitionGeoJsonLayer, MlVectorTileLayer, MlWmsLayer, SimpleDataContext, SimpleDataProvider, useLayer, useMap, useMapState, useWms };
|
|
19194
|
+
export { GeoJsonContext, GeoJsonProvider, MapComponentsProvider, MapContext, MapLibreMap, MlBasicComponent, MlComponentTemplate, MlCreatePdfButton, MlCreatePdfButton as MlCreatePdfForm, MlFeatureEditor, MlFillExtrusionLayer, MlFollowGps, MlGPXViewer, MlGeoJsonLayer, MlImageMarkerLayer, MlLayer, MlLayerMagnify, MlLayerSwipe, MlMarker, MlMeasureTool, MlNavigationCompass, MlNavigationTools, MlOsmLayer, MlScaleReference, MlSpatialElevationProfile, MlTransitionGeoJsonLayer, MlVectorTileLayer, MlWmsLayer, SimpleDataContext, SimpleDataProvider, exportMap as useExportMap, useLayer, useMap, useMapState, useSource, useWms };
|
|
19009
19195
|
//# sourceMappingURL=index.esm.js.map
|