@mapcomponents/react-maplibre 0.1.56 → 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 +20 -0
- package/coverage/clover.xml +232 -80
- package/coverage/coverage-final.json +43 -37
- package/coverage/lcov-report/index.html +71 -26
- 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 +89 -89
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +11 -11
- 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 +14 -2
- package/coverage/lcov.info +450 -153
- 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/decorators/ThemeWrapper.d.ts +1 -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 +4 -0
- package/dist/index.esm.js +479 -190
- 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 +33 -35
- 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 +23 -25
- 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 +9 -0
- 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 +4 -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
|
*/
|
|
@@ -13814,6 +13824,235 @@ MlWmsLayer.propTypes = {
|
|
|
13814
13824
|
visible: PropTypes.bool,
|
|
13815
13825
|
};
|
|
13816
13826
|
|
|
13827
|
+
function ownKeys(object, enumerableOnly) {
|
|
13828
|
+
var keys = Object.keys(object);
|
|
13829
|
+
|
|
13830
|
+
if (Object.getOwnPropertySymbols) {
|
|
13831
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
13832
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
13833
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
13834
|
+
})), keys.push.apply(keys, symbols);
|
|
13835
|
+
}
|
|
13836
|
+
|
|
13837
|
+
return keys;
|
|
13838
|
+
}
|
|
13839
|
+
|
|
13840
|
+
function _objectSpread2(target) {
|
|
13841
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
13842
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
13843
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
13844
|
+
_defineProperty(target, key, source[key]);
|
|
13845
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
13846
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
13847
|
+
});
|
|
13848
|
+
}
|
|
13849
|
+
|
|
13850
|
+
return target;
|
|
13851
|
+
}
|
|
13852
|
+
|
|
13853
|
+
function _typeof(obj) {
|
|
13854
|
+
"@babel/helpers - typeof";
|
|
13855
|
+
|
|
13856
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
13857
|
+
return typeof obj;
|
|
13858
|
+
} : function (obj) {
|
|
13859
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
13860
|
+
}, _typeof(obj);
|
|
13861
|
+
}
|
|
13862
|
+
|
|
13863
|
+
function _defineProperty(obj, key, value) {
|
|
13864
|
+
if (key in obj) {
|
|
13865
|
+
Object.defineProperty(obj, key, {
|
|
13866
|
+
value: value,
|
|
13867
|
+
enumerable: true,
|
|
13868
|
+
configurable: true,
|
|
13869
|
+
writable: true
|
|
13870
|
+
});
|
|
13871
|
+
} else {
|
|
13872
|
+
obj[key] = value;
|
|
13873
|
+
}
|
|
13874
|
+
|
|
13875
|
+
return obj;
|
|
13876
|
+
}
|
|
13877
|
+
|
|
13878
|
+
function _slicedToArray(arr, i) {
|
|
13879
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
13880
|
+
}
|
|
13881
|
+
|
|
13882
|
+
function _toConsumableArray(arr) {
|
|
13883
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
13884
|
+
}
|
|
13885
|
+
|
|
13886
|
+
function _arrayWithoutHoles(arr) {
|
|
13887
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
13888
|
+
}
|
|
13889
|
+
|
|
13890
|
+
function _arrayWithHoles(arr) {
|
|
13891
|
+
if (Array.isArray(arr)) return arr;
|
|
13892
|
+
}
|
|
13893
|
+
|
|
13894
|
+
function _iterableToArray(iter) {
|
|
13895
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
13896
|
+
}
|
|
13897
|
+
|
|
13898
|
+
function _iterableToArrayLimit(arr, i) {
|
|
13899
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
13900
|
+
|
|
13901
|
+
if (_i == null) return;
|
|
13902
|
+
var _arr = [];
|
|
13903
|
+
var _n = true;
|
|
13904
|
+
var _d = false;
|
|
13905
|
+
|
|
13906
|
+
var _s, _e;
|
|
13907
|
+
|
|
13908
|
+
try {
|
|
13909
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
13910
|
+
_arr.push(_s.value);
|
|
13911
|
+
|
|
13912
|
+
if (i && _arr.length === i) break;
|
|
13913
|
+
}
|
|
13914
|
+
} catch (err) {
|
|
13915
|
+
_d = true;
|
|
13916
|
+
_e = err;
|
|
13917
|
+
} finally {
|
|
13918
|
+
try {
|
|
13919
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
13920
|
+
} finally {
|
|
13921
|
+
if (_d) throw _e;
|
|
13922
|
+
}
|
|
13923
|
+
}
|
|
13924
|
+
|
|
13925
|
+
return _arr;
|
|
13926
|
+
}
|
|
13927
|
+
|
|
13928
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
13929
|
+
if (!o) return;
|
|
13930
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
13931
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
13932
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
13933
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
13934
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
13935
|
+
}
|
|
13936
|
+
|
|
13937
|
+
function _arrayLikeToArray(arr, len) {
|
|
13938
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
13939
|
+
|
|
13940
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
13941
|
+
|
|
13942
|
+
return arr2;
|
|
13943
|
+
}
|
|
13944
|
+
|
|
13945
|
+
function _nonIterableSpread() {
|
|
13946
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
13947
|
+
}
|
|
13948
|
+
|
|
13949
|
+
function _nonIterableRest() {
|
|
13950
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
13951
|
+
}
|
|
13952
|
+
|
|
13953
|
+
var MlScaleReference = function MlScaleReference(props) {
|
|
13954
|
+
var zoomRef = useRef(0);
|
|
13955
|
+
var mapHook = useMap({
|
|
13956
|
+
mapId: props.mapId,
|
|
13957
|
+
waitForLayer: props.insertBeforeLayer
|
|
13958
|
+
});
|
|
13959
|
+
|
|
13960
|
+
var _useState = useState(0),
|
|
13961
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13962
|
+
pxWidth = _useState2[0],
|
|
13963
|
+
setPxWidth = _useState2[1];
|
|
13964
|
+
|
|
13965
|
+
var _useState3 = useState(""),
|
|
13966
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
13967
|
+
text = _useState4[0],
|
|
13968
|
+
setText = _useState4[1];
|
|
13969
|
+
|
|
13970
|
+
var updateScale = useCallback(function () {
|
|
13971
|
+
var _mapHook$map, _mapHook$map2;
|
|
13972
|
+
|
|
13973
|
+
if (((_mapHook$map = mapHook.map) === null || _mapHook$map === void 0 ? void 0 : _mapHook$map.map.getZoom()) === zoomRef.current) {
|
|
13974
|
+
return;
|
|
13975
|
+
}
|
|
13976
|
+
|
|
13977
|
+
if (!mapHook.map) return;
|
|
13978
|
+
zoomRef.current = (_mapHook$map2 = mapHook.map) === null || _mapHook$map2 === void 0 ? void 0 : _mapHook$map2.map.getZoom(); // Calculation from MapLibre
|
|
13979
|
+
// A horizontal scale is imagined to be present at center of the map
|
|
13980
|
+
// Using spherical law of cosines approximation, the real distance is
|
|
13981
|
+
// found between the two coordinates.
|
|
13982
|
+
|
|
13983
|
+
var maxWidth = props.maxWidth || 100;
|
|
13984
|
+
var y = mapHook.map._container.clientHeight / 2;
|
|
13985
|
+
var left = mapHook.map.unproject([0, y]);
|
|
13986
|
+
var right = mapHook.map.unproject([maxWidth, y]);
|
|
13987
|
+
var maxMeters = left.distanceTo(right); // The real distance corresponding to 100px scale length is rounded off to
|
|
13988
|
+
// near pretty number and the scale length for the same is found out.
|
|
13989
|
+
// Default unit of the scale is based on User's locale.
|
|
13990
|
+
|
|
13991
|
+
if (props.unit === "imperial") {
|
|
13992
|
+
var maxFeet = 3.2808 * maxMeters;
|
|
13993
|
+
|
|
13994
|
+
if (maxFeet > 5280) {
|
|
13995
|
+
var maxMiles = maxFeet / 5280;
|
|
13996
|
+
setScale(maxWidth, maxMiles, mapHook.map._getUIString("ScaleControl.Miles"));
|
|
13997
|
+
} else {
|
|
13998
|
+
setScale(maxWidth, maxFeet, mapHook.map._getUIString("ScaleControl.Feet"));
|
|
13999
|
+
}
|
|
14000
|
+
} else if (props.unit === "nautical") {
|
|
14001
|
+
var maxNauticals = maxMeters / 1852;
|
|
14002
|
+
setScale(maxWidth, maxNauticals, mapHook.map._getUIString("ScaleControl.NauticalMiles"));
|
|
14003
|
+
} else if (maxMeters >= 1000) {
|
|
14004
|
+
setScale(maxWidth, maxMeters / 1000, mapHook.map._getUIString("ScaleControl.Kilometers"));
|
|
14005
|
+
} else {
|
|
14006
|
+
setScale(maxWidth, maxMeters, mapHook.map._getUIString("ScaleControl.Meters"));
|
|
14007
|
+
}
|
|
14008
|
+
}, [mapHook.map, props.unit, props.maxWidth]);
|
|
14009
|
+
useEffect(function () {
|
|
14010
|
+
if (!mapHook.map) return;
|
|
14011
|
+
var _updateScale = updateScale;
|
|
14012
|
+
mapHook.map.on("move", _updateScale, mapHook.componentId);
|
|
14013
|
+
updateScale();
|
|
14014
|
+
return function () {
|
|
14015
|
+
mapHook.map.off("move", _updateScale);
|
|
14016
|
+
};
|
|
14017
|
+
}, [mapHook.map, updateScale]);
|
|
14018
|
+
|
|
14019
|
+
var setScale = function setScale(maxWidth, maxDistance, unit) {
|
|
14020
|
+
var distance = getRoundNum(maxDistance);
|
|
14021
|
+
var ratio = distance / maxDistance;
|
|
14022
|
+
setPxWidth(maxWidth * ratio);
|
|
14023
|
+
setText(distance + " " + unit);
|
|
14024
|
+
};
|
|
14025
|
+
|
|
14026
|
+
var getDecimalRoundNum = function getDecimalRoundNum(d) {
|
|
14027
|
+
var multiplier = Math.pow(10, Math.ceil(-Math.log(d) / Math.LN10));
|
|
14028
|
+
return Math.round(d * multiplier) / multiplier;
|
|
14029
|
+
};
|
|
14030
|
+
|
|
14031
|
+
var getRoundNum = function getRoundNum(num) {
|
|
14032
|
+
var pow10 = Math.pow(10, "".concat(Math.floor(num)).length - 1);
|
|
14033
|
+
var d = num / pow10;
|
|
14034
|
+
d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : d >= 1 ? 1 : getDecimalRoundNum(d);
|
|
14035
|
+
return pow10 * d;
|
|
14036
|
+
};
|
|
14037
|
+
|
|
14038
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
14039
|
+
style: {
|
|
14040
|
+
backgroundColor: "hsla(0,0%,100%,.75)",
|
|
14041
|
+
fontSize: "10px",
|
|
14042
|
+
border: "2px solid #333",
|
|
14043
|
+
borderTop: "#333",
|
|
14044
|
+
padding: "0 5px",
|
|
14045
|
+
color: "#333",
|
|
14046
|
+
boxSizing: "border-box",
|
|
14047
|
+
width: pxWidth + "px",
|
|
14048
|
+
fontFamily: "sans-serif"
|
|
14049
|
+
},
|
|
14050
|
+
dangerouslySetInnerHTML: {
|
|
14051
|
+
__html: text
|
|
14052
|
+
}
|
|
14053
|
+
}));
|
|
14054
|
+
};
|
|
14055
|
+
|
|
13817
14056
|
/**
|
|
13818
14057
|
*
|
|
13819
14058
|
* Hides the MapLibreMap referenced by props.map2Id except for the "magnifier"-circle that reveals
|
|
@@ -13895,27 +14134,27 @@ var MlLayerMagnify = function (props) {
|
|
|
13895
14134
|
/*
|
|
13896
14135
|
automatically adjust radius for small screens
|
|
13897
14136
|
if (
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
14137
|
+
mapContext.maps[props.map1Id].getCanvas().clientWidth >
|
|
14138
|
+
mapContext.maps[props.map1Id].getCanvas().clientHeight &&
|
|
14139
|
+
magnifierRadius * 2 >
|
|
14140
|
+
mapContext.maps[props.map1Id].getCanvas().clientHeight
|
|
13902
14141
|
) {
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
|
|
13906
|
-
|
|
14142
|
+
magnifierRadius = Math.floor(
|
|
14143
|
+
mapContext.maps[props.map1Id].getCanvas().clientHeight / 2
|
|
14144
|
+
);
|
|
14145
|
+
setMagnifierRadius(magnifierRadius);
|
|
13907
14146
|
}
|
|
13908
|
-
|
|
14147
|
+
|
|
13909
14148
|
if (
|
|
13910
|
-
|
|
13911
|
-
|
|
13912
|
-
|
|
13913
|
-
|
|
14149
|
+
mapContext.maps[props.map1Id].getCanvas().clientHeight >
|
|
14150
|
+
mapContext.maps[props.map1Id].getCanvas().clientWidth &&
|
|
14151
|
+
magnifierRadius * 2 >
|
|
14152
|
+
mapContext.maps[props.map1Id].getCanvas().clientWidth
|
|
13914
14153
|
) {
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
14154
|
+
magnifierRadius = Math.floor(
|
|
14155
|
+
mapContext.maps[props.map1Id].getCanvas().clientWidth / 2
|
|
14156
|
+
);
|
|
14157
|
+
setMagnifierRadius(magnifierRadius);
|
|
13919
14158
|
}
|
|
13920
14159
|
*/
|
|
13921
14160
|
onMove({
|
|
@@ -13971,7 +14210,7 @@ MlLayerMagnify.defaultProps = {
|
|
|
13971
14210
|
};
|
|
13972
14211
|
|
|
13973
14212
|
/**
|
|
13974
|
-
*
|
|
14213
|
+
* creates a split view of 2 synchronised maplibre instances
|
|
13975
14214
|
*/
|
|
13976
14215
|
var MlLayerSwipe = function (props) {
|
|
13977
14216
|
var mapContext = useContext(MapContext);
|
|
@@ -14063,132 +14302,6 @@ var MlLayerSwipe = function (props) {
|
|
|
14063
14302
|
}, onTouchStart: onDown, onMouseDown: onDown }));
|
|
14064
14303
|
};
|
|
14065
14304
|
|
|
14066
|
-
function ownKeys(object, enumerableOnly) {
|
|
14067
|
-
var keys = Object.keys(object);
|
|
14068
|
-
|
|
14069
|
-
if (Object.getOwnPropertySymbols) {
|
|
14070
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
14071
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
14072
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
14073
|
-
})), keys.push.apply(keys, symbols);
|
|
14074
|
-
}
|
|
14075
|
-
|
|
14076
|
-
return keys;
|
|
14077
|
-
}
|
|
14078
|
-
|
|
14079
|
-
function _objectSpread2(target) {
|
|
14080
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
14081
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
14082
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
14083
|
-
_defineProperty(target, key, source[key]);
|
|
14084
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
14085
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
14086
|
-
});
|
|
14087
|
-
}
|
|
14088
|
-
|
|
14089
|
-
return target;
|
|
14090
|
-
}
|
|
14091
|
-
|
|
14092
|
-
function _typeof(obj) {
|
|
14093
|
-
"@babel/helpers - typeof";
|
|
14094
|
-
|
|
14095
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
14096
|
-
return typeof obj;
|
|
14097
|
-
} : function (obj) {
|
|
14098
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
14099
|
-
}, _typeof(obj);
|
|
14100
|
-
}
|
|
14101
|
-
|
|
14102
|
-
function _defineProperty(obj, key, value) {
|
|
14103
|
-
if (key in obj) {
|
|
14104
|
-
Object.defineProperty(obj, key, {
|
|
14105
|
-
value: value,
|
|
14106
|
-
enumerable: true,
|
|
14107
|
-
configurable: true,
|
|
14108
|
-
writable: true
|
|
14109
|
-
});
|
|
14110
|
-
} else {
|
|
14111
|
-
obj[key] = value;
|
|
14112
|
-
}
|
|
14113
|
-
|
|
14114
|
-
return obj;
|
|
14115
|
-
}
|
|
14116
|
-
|
|
14117
|
-
function _slicedToArray(arr, i) {
|
|
14118
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
14119
|
-
}
|
|
14120
|
-
|
|
14121
|
-
function _toConsumableArray(arr) {
|
|
14122
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
14123
|
-
}
|
|
14124
|
-
|
|
14125
|
-
function _arrayWithoutHoles(arr) {
|
|
14126
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
14127
|
-
}
|
|
14128
|
-
|
|
14129
|
-
function _arrayWithHoles(arr) {
|
|
14130
|
-
if (Array.isArray(arr)) return arr;
|
|
14131
|
-
}
|
|
14132
|
-
|
|
14133
|
-
function _iterableToArray(iter) {
|
|
14134
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
14135
|
-
}
|
|
14136
|
-
|
|
14137
|
-
function _iterableToArrayLimit(arr, i) {
|
|
14138
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
14139
|
-
|
|
14140
|
-
if (_i == null) return;
|
|
14141
|
-
var _arr = [];
|
|
14142
|
-
var _n = true;
|
|
14143
|
-
var _d = false;
|
|
14144
|
-
|
|
14145
|
-
var _s, _e;
|
|
14146
|
-
|
|
14147
|
-
try {
|
|
14148
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
14149
|
-
_arr.push(_s.value);
|
|
14150
|
-
|
|
14151
|
-
if (i && _arr.length === i) break;
|
|
14152
|
-
}
|
|
14153
|
-
} catch (err) {
|
|
14154
|
-
_d = true;
|
|
14155
|
-
_e = err;
|
|
14156
|
-
} finally {
|
|
14157
|
-
try {
|
|
14158
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
14159
|
-
} finally {
|
|
14160
|
-
if (_d) throw _e;
|
|
14161
|
-
}
|
|
14162
|
-
}
|
|
14163
|
-
|
|
14164
|
-
return _arr;
|
|
14165
|
-
}
|
|
14166
|
-
|
|
14167
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
14168
|
-
if (!o) return;
|
|
14169
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
14170
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
14171
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
14172
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
14173
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
14174
|
-
}
|
|
14175
|
-
|
|
14176
|
-
function _arrayLikeToArray(arr, len) {
|
|
14177
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
14178
|
-
|
|
14179
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
14180
|
-
|
|
14181
|
-
return arr2;
|
|
14182
|
-
}
|
|
14183
|
-
|
|
14184
|
-
function _nonIterableSpread() {
|
|
14185
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14186
|
-
}
|
|
14187
|
-
|
|
14188
|
-
function _nonIterableRest() {
|
|
14189
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14190
|
-
}
|
|
14191
|
-
|
|
14192
14305
|
var _showNextTransitionSegment = function _showNextTransitionSegment(props, map, transitionInProgressRef, transitionGeojsonDataRef, transitionGeojsonCommonDataRef, currentTransitionStepRef, msPerStep, transitionTimeoutRef, setDisplayGeojson) {
|
|
14193
14306
|
var _arguments = arguments;
|
|
14194
14307
|
|
|
@@ -18840,6 +18953,182 @@ useWms.defaultProps = {
|
|
|
18840
18953
|
}
|
|
18841
18954
|
};
|
|
18842
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
|
+
|
|
18843
19132
|
var SimpleDataContext = /*#__PURE__*/React__default.createContext({});
|
|
18844
19133
|
var SimpleDataContextProvider = SimpleDataContext.Provider;
|
|
18845
19134
|
|
|
@@ -18902,5 +19191,5 @@ SimpleDataProvider.propTypes = {
|
|
|
18902
19191
|
children: PropTypes.node.isRequired
|
|
18903
19192
|
};
|
|
18904
19193
|
|
|
18905
|
-
export { GeoJsonContext, GeoJsonProvider, MapComponentsProvider, MapContext, MapLibreMap, MlBasicComponent, MlComponentTemplate, MlCreatePdfButton, MlFeatureEditor, MlFillExtrusionLayer, MlFollowGps, MlGPXViewer, MlGeoJsonLayer, MlImageMarkerLayer, MlLayer, MlLayerMagnify, MlLayerSwipe, MlMarker, MlMeasureTool, MlNavigationCompass, MlNavigationTools, MlOsmLayer, 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 };
|
|
18906
19195
|
//# sourceMappingURL=index.esm.js.map
|