@mapcomponents/react-maplibre 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/index.cjs.js +812 -120
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +806 -119
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/MlClientSearch/lib/createGeojsonFeature.d.ts +4 -0
- package/dist/{components → src/components}/MlCreatePdfButton/MlCreatePdfButton.d.ts +1 -1
- package/dist/{components → src/components}/MlCreatePdfForm/lib/PdfPreview.d.ts +1 -1
- package/dist/{components → src/components}/MlCreatePngButton/MlCreatePngButton.d.ts +1 -1
- package/dist/{components → src/components}/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +2 -2
- package/dist/{components → src/components}/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.d.ts +2 -1
- package/dist/src/components/MlGeoJsonLayer/util/getDefaultLayerTypeByGeometry.d.ts +4 -0
- package/dist/{components → src/components}/MlGpxViewer/MlGpxViewer.d.ts +1 -1
- package/dist/{components → src/components}/MlGpxViewer/util/GeoJsonContext.d.ts +3 -3
- package/dist/{components → src/components}/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +1 -1
- package/dist/{components → src/components}/MlLayer/MlLayer.d.ts +1 -1
- package/dist/{components → src/components}/MlMeasureTool/MlMeasureTool.d.ts +8 -7
- package/dist/{components → src/components}/MlMultiMeasureTool/MlMultiMeasureTool.d.ts +3 -3
- package/dist/src/components/MlOgcApiFeatures/MlOgcApiFeatures.d.ts +45 -0
- package/dist/{components → src/components}/MlSketchTool/MlSketchTool.d.ts +1 -1
- package/dist/{components → src/components}/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +1 -1
- package/dist/{components → src/components}/MlSpatialElevationProfile/util/getElevationData.d.ts +1 -1
- package/dist/{components → src/components}/MlTemporalController/MlTemporalController.d.ts +1 -1
- package/dist/{components → src/components}/MlTemporalController/utils/MlTemporalControllerLabels.d.ts +1 -1
- package/dist/{components → src/components}/MlTemporalController/utils/useFilterData.d.ts +2 -2
- package/dist/{components → src/components}/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +2 -2
- package/dist/{components → src/components}/MlVectorTileLayer/MlVectorTileLayer.d.ts +4 -1
- package/dist/src/decorators/MapContextReduxStoreDecorator.d.ts +7 -0
- package/dist/{hooks → src/hooks}/useExportMap/lib.d.ts +1 -1
- package/dist/{hooks → src/hooks}/useFeatureEditor/useFeatureEditor.d.ts +3 -3
- package/dist/{hooks → src/hooks}/useFeatureEditor/utils/FeatureEditorStyle.d.ts +44 -16
- package/dist/{hooks → src/hooks}/useGpx/useGpx.d.ts +2 -2
- package/dist/{hooks → src/hooks}/useLayer.d.ts +3 -3
- package/dist/{hooks → src/hooks}/useLayerHoverPopup/LayerHoverPopup.d.ts +2 -1
- package/dist/{index.d.ts → src/index.d.ts} +38 -0
- package/dist/{protocol_handlers → src/protocol_handlers}/csv.d.ts +2 -2
- package/dist/{protocol_handlers → src/protocol_handlers}/osm.d.ts +2 -2
- package/dist/{protocol_handlers → src/protocol_handlers}/topojson.d.ts +2 -2
- package/dist/{protocol_handlers → src/protocol_handlers}/xml.d.ts +2 -2
- package/dist/src/stores/map.store.d.ts +105 -0
- package/dist/{ui_components → src/ui_components}/ColorPicker/ColorPicker.d.ts +0 -2
- package/dist/{ui_components → src/ui_components}/LayerList/util/LayerListItemVectorLayer.d.ts +2 -4
- package/dist/src/ui_components/LayerTree/LayerOnMap.d.ts +7 -0
- package/dist/src/ui_components/LayerTree/LayerTree.d.ts +6 -0
- package/dist/src/ui_components/LayerTree/LayerTreeListItem.d.ts +18 -0
- package/dist/src/ui_components/LayerTree/util/LayerPropertyForm.d.ts +9 -0
- package/dist/src/ui_components/LayerTree/util/input/ColorPicker.d.ts +7 -0
- package/package.json +14 -8
- package/rollup.config.mjs +2 -1
- package/dist/components/MlClientSearch/lib/createGeojsonFeature.d.ts +0 -3
- package/dist/components/MlGeoJsonLayer/util/getDefaultLayerTypeByGeometry.d.ts +0 -2
- /package/dist/{components → src/components}/MapLibreMap/MapLibreMap.d.ts +0 -0
- /package/dist/{components → src/components}/MapLibreMap/lib/MapLibreGlWrapper.d.ts +0 -0
- /package/dist/{components → src/components}/MlCenterPosition/MlCenterPosition.d.ts +0 -0
- /package/dist/{components → src/components}/MlClientSearch/MlClientSearch.d.ts +0 -0
- /package/dist/{components → src/components}/MlClientSearch/lib/SearchContext.d.ts +0 -0
- /package/dist/{components → src/components}/MlClientSearch/lib/SearchForm.d.ts +0 -0
- /package/dist/{components → src/components}/MlComponentTemplate/MlComponentTemplate.d.ts +0 -0
- /package/dist/{components → src/components}/MlCreatePdfForm/MlCreatePdfForm.d.ts +0 -0
- /package/dist/{components → src/components}/MlCreatePdfForm/lib/PdfContext.d.ts +0 -0
- /package/dist/{components → src/components}/MlCreatePdfForm/lib/PdfForm.d.ts +0 -0
- /package/dist/{components → src/components}/MlCreatePdfForm/lib/pdf.templates.d.ts +0 -0
- /package/dist/{components → src/components}/MlFeatureEditor/MlFeatureEditor.d.ts +0 -0
- /package/dist/{components → src/components}/MlFillExtrusionLayer/MlFillExtrusionLayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlFollowGps/MlFollowGps.d.ts +0 -0
- /package/dist/{components → src/components}/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.d.ts +0 -0
- /package/dist/{components → src/components}/MlGeoJsonLayer/util/getDefaultPaintPropsByType.d.ts +0 -0
- /package/dist/{components → src/components}/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.d.ts +0 -0
- /package/dist/{components → src/components}/MlGpxViewer/util/GeoJsonProvider.d.ts +0 -0
- /package/dist/{components → src/components}/MlGpxViewer/util/Metadata.d.ts +0 -0
- /package/dist/{components → src/components}/MlGpxViewer/util/MlGpxDemoLoader.d.ts +0 -0
- /package/dist/{components → src/components}/MlGpxViewer/util/MlGpxViewerInstructions.d.ts +0 -0
- /package/dist/{components → src/components}/MlLayerMagnify/MlLayerMagnify.d.ts +0 -0
- /package/dist/{components → src/components}/MlLayerSwipe/MlLayerSwipe.d.ts +0 -0
- /package/dist/{components → src/components}/MlLayerSwitcher/MlLayerSwitcher.d.ts +0 -0
- /package/dist/{components → src/components}/MlLayerSwitcher/components/LayerBox.d.ts +0 -0
- /package/dist/{components → src/components}/MlMarker/MlMarker.d.ts +0 -0
- /package/dist/{components → src/components}/MlNavigationCompass/MlNavigationCompass.d.ts +0 -0
- /package/dist/{components → src/components}/MlNavigationTools/MlNavigationTools.d.ts +0 -0
- /package/dist/{components → src/components}/MlOrderLayers/MlOrderLayers.d.ts +0 -0
- /package/dist/{components → src/components}/MlScaleReference/MlScaleReference.d.ts +0 -0
- /package/dist/{components → src/components}/MlShareMapState/MlShareMapState.d.ts +0 -0
- /package/dist/{components → src/components}/MlTemporalController/utils/TemporalControllerPlayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlTemporalController/utils/paintPicker.d.ts +0 -0
- /package/dist/{components → src/components}/MlTerrainLayer/MlTerrainLayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlThreeJsLayer/MlThreeJsLayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlUseMapDebugger/MlUseMapDebugger.d.ts +0 -0
- /package/dist/{components → src/components}/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.d.ts +0 -0
- /package/dist/{components → src/components}/MlWmsLayer/MlWmsLayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlWmsLoader/MlWmsLoader.d.ts +0 -0
- /package/dist/{components → src/components}/MlWmsLoader/utils/MlWmsLoaderInstructions.d.ts +0 -0
- /package/dist/{components → src/components}/MlWmsLoader/utils/WMSLinks.d.ts +0 -0
- /package/dist/{contexts → src/contexts}/LayerContext.d.ts +0 -0
- /package/dist/{contexts → src/contexts}/MapContext.d.ts +0 -0
- /package/dist/{contexts → src/contexts}/SimpleDataContext.d.ts +0 -0
- /package/dist/{contexts → src/contexts}/SimpleDataProvider.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/EmptyMapDecorator.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/GeoJsonMapDecorator.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/LowZoomDecorator.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/MapContextDecorator.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/MapContextDecoratorHooks.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/MultiMapContextDecorator.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/NoNavToolsDecorator.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/ThemeDecorator.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useAddImage/useAddImage.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useAddProtocol/useAddProtocol.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useCameraFollowPath/useCameraFollowPath.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useExportMap/index.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useFitLayerBounds.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useLayerContext.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useLayerFilter/useLayerFilter.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMap.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapState.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useSource.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useWms.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/bright.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/config.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/gruvbox.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/medieval_kingdom.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/monokai.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/oceanic_next.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/solarized.d.ts +0 -0
- /package/dist/{protocol_handlers → src/protocol_handlers}/mbtiles.d.ts +0 -0
- /package/dist/{protocol_handlers → src/protocol_handlers}/utils/getProtocolData.d.ts +0 -0
- /package/dist/{protocol_handlers → src/protocol_handlers}/utils/protocolPathParser.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/AddLayerButton.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/AddLayerPopup.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/GeoJsonLayerForm.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/LayerTypeForm.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/MbtilesLayerForm.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/ProtocolHandlerLayerForm.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/WmsLayerForm.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/utils/CSVOptionsFomular.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/utils/MbtilesLayerPropFormular.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/utils/OsmOptionsFomular.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/ColorPicker/transformers.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/ConfirmDialog.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/DemoDescriptions.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/Dropzone.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/ImageLoader.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/LayerList.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/LayerListFolder.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/LayerListItem.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/LayerListItemFactory.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/util/LayerPropertyForm.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/util/SortableContainer.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/util/input/ColorPicker.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LoadingOverlayContext.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/MapcomponentsTheme.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/SelectStyleButton/SelectStyleButton.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/SelectStyleButton/SelectStylePopup.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/Sidebar.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/SpeedDial/SpeedDial.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/TopToolbar.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/UploadButton.d.ts +0 -0
- /package/dist/{util → src/util}/BubbleForInstructions.d.ts +0 -0
- /package/dist/{util → src/util}/Instructions.d.ts +0 -0
package/dist/index.esm.js
CHANGED
|
@@ -84,6 +84,8 @@ import SpeedDialAction from '@mui/material/SpeedDialAction';
|
|
|
84
84
|
import LayersIcon from '@mui/icons-material/Layers';
|
|
85
85
|
import DesignServicesIcon from '@mui/icons-material/DesignServices';
|
|
86
86
|
import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf';
|
|
87
|
+
import { useSelector, useDispatch } from 'react-redux';
|
|
88
|
+
import { createSlice, configureStore } from '@reduxjs/toolkit';
|
|
87
89
|
|
|
88
90
|
/******************************************************************************
|
|
89
91
|
Copyright (c) Microsoft Corporation.
|
|
@@ -2005,9 +2007,9 @@ function featureEditorStyle() {
|
|
|
2005
2007
|
['!=', 'mode', 'static'],
|
|
2006
2008
|
],
|
|
2007
2009
|
paint: {
|
|
2008
|
-
'fill-color': '#
|
|
2009
|
-
'fill-outline-color': '#
|
|
2010
|
-
'fill-opacity': 0.
|
|
2010
|
+
'fill-color': '#009EE0',
|
|
2011
|
+
'fill-outline-color': '#009EE0',
|
|
2012
|
+
'fill-opacity': 0.3,
|
|
2011
2013
|
},
|
|
2012
2014
|
},
|
|
2013
2015
|
{
|
|
@@ -2015,18 +2017,9 @@ function featureEditorStyle() {
|
|
|
2015
2017
|
type: 'fill',
|
|
2016
2018
|
filter: ['all', ['==', 'active', 'true'], ['==', '$type', 'Polygon']],
|
|
2017
2019
|
paint: {
|
|
2018
|
-
'fill-color': '#
|
|
2019
|
-
'fill-outline-color': '#
|
|
2020
|
-
'fill-opacity': 0.
|
|
2021
|
-
},
|
|
2022
|
-
},
|
|
2023
|
-
{
|
|
2024
|
-
id: 'gl-draw-polygon-midpoint',
|
|
2025
|
-
type: 'circle',
|
|
2026
|
-
filter: ['all', ['==', '$type', 'Point'], ['==', 'meta', 'midpoint']],
|
|
2027
|
-
paint: {
|
|
2028
|
-
'circle-radius': mediaIsMobile ? 7 : 5,
|
|
2029
|
-
'circle-color': '#fbb03b',
|
|
2020
|
+
'fill-color': '#009EE0',
|
|
2021
|
+
'fill-outline-color': '#009EE0',
|
|
2022
|
+
'fill-opacity': 0.2,
|
|
2030
2023
|
},
|
|
2031
2024
|
},
|
|
2032
2025
|
{
|
|
@@ -2043,8 +2036,8 @@ function featureEditorStyle() {
|
|
|
2043
2036
|
'line-join': 'round',
|
|
2044
2037
|
},
|
|
2045
2038
|
paint: {
|
|
2046
|
-
'line-color': '#
|
|
2047
|
-
'line-width':
|
|
2039
|
+
'line-color': '#009EE0',
|
|
2040
|
+
'line-width': 3,
|
|
2048
2041
|
},
|
|
2049
2042
|
},
|
|
2050
2043
|
{
|
|
@@ -2056,7 +2049,7 @@ function featureEditorStyle() {
|
|
|
2056
2049
|
'line-join': 'round',
|
|
2057
2050
|
},
|
|
2058
2051
|
paint: {
|
|
2059
|
-
'line-color': '#
|
|
2052
|
+
'line-color': '#009EE0',
|
|
2060
2053
|
'line-dasharray': [0.2, 2],
|
|
2061
2054
|
'line-width': 2,
|
|
2062
2055
|
},
|
|
@@ -2075,8 +2068,8 @@ function featureEditorStyle() {
|
|
|
2075
2068
|
'line-join': 'round',
|
|
2076
2069
|
},
|
|
2077
2070
|
paint: {
|
|
2078
|
-
'line-color': '#
|
|
2079
|
-
'line-width':
|
|
2071
|
+
'line-color': '#009EE0',
|
|
2072
|
+
'line-width': 3,
|
|
2080
2073
|
},
|
|
2081
2074
|
},
|
|
2082
2075
|
{
|
|
@@ -2088,11 +2081,22 @@ function featureEditorStyle() {
|
|
|
2088
2081
|
'line-join': 'round',
|
|
2089
2082
|
},
|
|
2090
2083
|
paint: {
|
|
2091
|
-
'line-color':
|
|
2084
|
+
'line-color': "#009EE0",
|
|
2092
2085
|
'line-dasharray': [0.2, 2],
|
|
2093
2086
|
'line-width': 2,
|
|
2094
2087
|
},
|
|
2095
2088
|
},
|
|
2089
|
+
{
|
|
2090
|
+
id: 'gl-draw-polygon-midpoint',
|
|
2091
|
+
type: 'circle',
|
|
2092
|
+
filter: ['all', ['==', '$type', 'Point'], ['==', 'meta', 'midpoint']],
|
|
2093
|
+
paint: {
|
|
2094
|
+
'circle-radius': mediaIsMobile ? 5 : 4,
|
|
2095
|
+
'circle-color': '#ffffff',
|
|
2096
|
+
'circle-stroke-color': '#009EE0',
|
|
2097
|
+
'circle-stroke-width': 1
|
|
2098
|
+
},
|
|
2099
|
+
},
|
|
2096
2100
|
{
|
|
2097
2101
|
id: 'gl-draw-polygon-and-line-vertex-stroke-inactive',
|
|
2098
2102
|
type: 'circle',
|
|
@@ -2108,7 +2112,9 @@ function featureEditorStyle() {
|
|
|
2108
2112
|
filter: ['all', ['==', 'meta', 'vertex'], ['==', '$type', 'Point'], ['!=', 'mode', 'static']],
|
|
2109
2113
|
paint: {
|
|
2110
2114
|
'circle-radius': mediaIsMobile ? 7 : 5,
|
|
2111
|
-
'circle-color': '#
|
|
2115
|
+
'circle-color': '#ffffff',
|
|
2116
|
+
'circle-stroke-color': '#009EE0',
|
|
2117
|
+
'circle-stroke-width': 1
|
|
2112
2118
|
},
|
|
2113
2119
|
},
|
|
2114
2120
|
{
|
|
@@ -2124,7 +2130,7 @@ function featureEditorStyle() {
|
|
|
2124
2130
|
paint: {
|
|
2125
2131
|
'circle-radius': mediaIsMobile ? 10 : 9,
|
|
2126
2132
|
'circle-opacity': 1,
|
|
2127
|
-
'circle-color': '#
|
|
2133
|
+
'circle-color': '#009EE0',
|
|
2128
2134
|
},
|
|
2129
2135
|
},
|
|
2130
2136
|
{
|
|
@@ -2139,7 +2145,7 @@ function featureEditorStyle() {
|
|
|
2139
2145
|
],
|
|
2140
2146
|
paint: {
|
|
2141
2147
|
'circle-radius': mediaIsMobile ? 7.5 : 6.5,
|
|
2142
|
-
'circle-color': '#
|
|
2148
|
+
'circle-color': '#009EE0',
|
|
2143
2149
|
},
|
|
2144
2150
|
},
|
|
2145
2151
|
{
|
|
@@ -2167,7 +2173,7 @@ function featureEditorStyle() {
|
|
|
2167
2173
|
],
|
|
2168
2174
|
paint: {
|
|
2169
2175
|
'circle-radius': mediaIsMobile ? 8.5 : 7.5,
|
|
2170
|
-
'circle-color': '#
|
|
2176
|
+
'circle-color': '#009EE0',
|
|
2171
2177
|
},
|
|
2172
2178
|
},
|
|
2173
2179
|
{
|
|
@@ -2906,7 +2912,7 @@ var MlFollowGps = function (props) {
|
|
|
2906
2912
|
];
|
|
2907
2913
|
var accurancyBounds = bbox(accuracyGeoJson);
|
|
2908
2914
|
var contained = booleanContains(bboxPolygon(actualBounds), bboxPolygon(accurancyBounds));
|
|
2909
|
-
if (contained
|
|
2915
|
+
if (!contained) {
|
|
2910
2916
|
(_b = mapHook.map) === null || _b === void 0 ? void 0 : _b.fitBounds(accurancyBounds, {
|
|
2911
2917
|
padding: { top: 25, bottom: 25 },
|
|
2912
2918
|
});
|
|
@@ -2985,46 +2991,93 @@ var MlImageMarkerLayer = function (props) {
|
|
|
2985
2991
|
return React__default.createElement(React__default.Fragment, null);
|
|
2986
2992
|
};
|
|
2987
2993
|
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
+
function unitMultiplier(unit) {
|
|
2995
|
+
switch (unit) {
|
|
2996
|
+
case 'meters':
|
|
2997
|
+
return 1;
|
|
2998
|
+
case 'millimeters':
|
|
2999
|
+
return 1000;
|
|
3000
|
+
case 'centimeters':
|
|
3001
|
+
return 100;
|
|
3002
|
+
case 'kilometers':
|
|
3003
|
+
return 0.001;
|
|
3004
|
+
case 'miles':
|
|
3005
|
+
return 1 / 1609.344; // Meters in Miles
|
|
3006
|
+
case 'nauticalmiles':
|
|
3007
|
+
return 1 / 1852; // Meters in Nautical Miles
|
|
3008
|
+
case 'inches':
|
|
3009
|
+
return 39.3701; // Meters in Inches
|
|
3010
|
+
case 'yards':
|
|
3011
|
+
return 1.09361; // Meters in Yards
|
|
3012
|
+
case 'feet':
|
|
3013
|
+
return 3.28084; // Meters in Feet
|
|
3014
|
+
// case 'acres':
|
|
3015
|
+
// return 1 / 4046.8564224; // Square meters in an acre
|
|
3016
|
+
// case 'hectares':
|
|
3017
|
+
// return 1 / 10000; // Square meters in a hectare
|
|
3018
|
+
default:
|
|
3019
|
+
return 1;
|
|
3020
|
+
}
|
|
2994
3021
|
}
|
|
2995
|
-
function
|
|
2996
|
-
|
|
3022
|
+
function unitLabel(unit) {
|
|
3023
|
+
switch (unit) {
|
|
3024
|
+
case 'miles':
|
|
3025
|
+
return 'mi';
|
|
3026
|
+
case 'acres':
|
|
3027
|
+
return 'ac';
|
|
3028
|
+
case 'kilometers':
|
|
3029
|
+
return 'km';
|
|
3030
|
+
case 'meters':
|
|
3031
|
+
return 'm';
|
|
3032
|
+
case 'millimeters':
|
|
3033
|
+
return 'mm';
|
|
3034
|
+
case 'centimeters':
|
|
3035
|
+
return 'cm';
|
|
3036
|
+
case 'nauticalmiles':
|
|
3037
|
+
return 'nm';
|
|
3038
|
+
case 'inches':
|
|
3039
|
+
return 'in';
|
|
3040
|
+
case 'yards':
|
|
3041
|
+
return 'yd';
|
|
3042
|
+
case 'feet':
|
|
3043
|
+
return 'ft';
|
|
3044
|
+
case 'hectares':
|
|
3045
|
+
return 'ha';
|
|
3046
|
+
default:
|
|
3047
|
+
return 'm';
|
|
3048
|
+
}
|
|
2997
3049
|
}
|
|
2998
3050
|
var MlMeasureTool = function (props) {
|
|
2999
3051
|
var _a = useState({ value: 0, label: '' }), displayValue = _a[0], setDisplayValue = _a[1];
|
|
3000
3052
|
var _b = useState([]), currentFeatures = _b[0], setCurrentFeatures = _b[1];
|
|
3001
3053
|
useEffect(function () {
|
|
3002
3054
|
if (currentFeatures[0]) {
|
|
3003
|
-
var result =
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3055
|
+
var result = 0;
|
|
3056
|
+
if (props.measureType === 'polygon') {
|
|
3057
|
+
// Calculate area in square meters
|
|
3058
|
+
result = turf.area(currentFeatures[0]);
|
|
3059
|
+
// Convert area depending on the unit (square meters -> selected area unit)
|
|
3060
|
+
if (props.unit) {
|
|
3061
|
+
var unit = props.unit;
|
|
3062
|
+
if (unit === 'acres') {
|
|
3063
|
+
result = result / 4046.8564224;
|
|
3064
|
+
}
|
|
3065
|
+
else if (unit === 'hectares') {
|
|
3066
|
+
result = result / 10000;
|
|
3067
|
+
}
|
|
3068
|
+
else {
|
|
3069
|
+
result = result * Math.pow(unitMultiplier(props.unit), 2);
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
else {
|
|
3074
|
+
result = turf.length(currentFeatures[0], { units: props.unit });
|
|
3075
|
+
}
|
|
3008
3076
|
if (typeof props.onChange === 'function') {
|
|
3009
3077
|
props.onChange({ value: result, unit: props.unit, geojson: currentFeatures[0] });
|
|
3010
3078
|
}
|
|
3011
3079
|
if (result >= 0.1) {
|
|
3012
|
-
setDisplayValue({ value: result, label:
|
|
3013
|
-
}
|
|
3014
|
-
else {
|
|
3015
|
-
var label = 'm';
|
|
3016
|
-
var value = result * 1000;
|
|
3017
|
-
if (props.measureType === 'polygon') {
|
|
3018
|
-
value = result * 1000000;
|
|
3019
|
-
}
|
|
3020
|
-
if (getUnitLabel(props.unit) === 'mi') {
|
|
3021
|
-
label = 'Yard';
|
|
3022
|
-
value = result * 1760;
|
|
3023
|
-
if (props.measureType === 'polygon') {
|
|
3024
|
-
value = result * 3097600;
|
|
3025
|
-
}
|
|
3026
|
-
}
|
|
3027
|
-
setDisplayValue({ value: value, label: label });
|
|
3080
|
+
setDisplayValue({ value: result, label: unitLabel(props.unit) });
|
|
3028
3081
|
}
|
|
3029
3082
|
}
|
|
3030
3083
|
}, [props.unit, currentFeatures]);
|
|
@@ -3032,35 +3085,41 @@ var MlMeasureTool = function (props) {
|
|
|
3032
3085
|
React__default.createElement(MlFeatureEditor, { onChange: function (features) {
|
|
3033
3086
|
features && setCurrentFeatures(features);
|
|
3034
3087
|
}, mode: props.measureType === 'polygon' ? 'draw_polygon' : 'draw_line_string', onFinish: props.onFinish }),
|
|
3035
|
-
displayValue.value.
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3088
|
+
displayValue.value.toLocaleString('de-DE', {
|
|
3089
|
+
minimumFractionDigits: 2,
|
|
3090
|
+
maximumFractionDigits: 2,
|
|
3091
|
+
}),
|
|
3092
|
+
' ',
|
|
3093
|
+
unitLabel(props.unit),
|
|
3094
|
+
displayValue.label &&
|
|
3095
|
+
props.measureType === 'polygon' &&
|
|
3096
|
+
!['hectares', 'acres'].includes(props.unit || '')
|
|
3097
|
+
? ' ²'
|
|
3098
|
+
: ''));
|
|
3040
3099
|
};
|
|
3041
3100
|
MlMeasureTool.defaultProps = {
|
|
3042
3101
|
mapId: undefined,
|
|
3043
3102
|
measureType: 'line',
|
|
3044
|
-
unit: '
|
|
3103
|
+
unit: 'meters',
|
|
3045
3104
|
};
|
|
3046
3105
|
|
|
3047
|
-
var ListStyled$
|
|
3106
|
+
var ListStyled$3 = styled(List)({
|
|
3048
3107
|
marginTop: '15px',
|
|
3049
3108
|
});
|
|
3050
3109
|
function LayerList(props) {
|
|
3051
|
-
return React__default.createElement(ListStyled$
|
|
3110
|
+
return React__default.createElement(ListStyled$3, null, props === null || props === void 0 ? void 0 : props.children);
|
|
3052
3111
|
}
|
|
3053
3112
|
|
|
3054
|
-
var ListItemStyled$
|
|
3113
|
+
var ListItemStyled$2 = styled$1(ListItem)({
|
|
3055
3114
|
paddingRight: 0,
|
|
3056
3115
|
paddingLeft: 0,
|
|
3057
3116
|
paddingTop: 0,
|
|
3058
3117
|
paddingBottom: '4px',
|
|
3059
3118
|
});
|
|
3060
|
-
var ListItemIconStyled = styled$1(ListItemIcon)({
|
|
3119
|
+
var ListItemIconStyled$1 = styled$1(ListItemIcon)({
|
|
3061
3120
|
minWidth: '30px',
|
|
3062
3121
|
});
|
|
3063
|
-
var IconButtonStyled$
|
|
3122
|
+
var IconButtonStyled$2 = styled$1(IconButton)({
|
|
3064
3123
|
marginRight: '0px',
|
|
3065
3124
|
padding: '0px',
|
|
3066
3125
|
});
|
|
@@ -3068,13 +3127,13 @@ var CheckboxStyled$1 = styled$1(Checkbox)({
|
|
|
3068
3127
|
padding: 0,
|
|
3069
3128
|
marginRight: '5px',
|
|
3070
3129
|
});
|
|
3071
|
-
var BoxStyled$
|
|
3130
|
+
var BoxStyled$4 = styled$1(Box)(function (_a) {
|
|
3072
3131
|
var open = _a.open;
|
|
3073
3132
|
return ({
|
|
3074
3133
|
display: open ? 'block' : 'none',
|
|
3075
3134
|
});
|
|
3076
3135
|
});
|
|
3077
|
-
var ListStyled = styled$1(List)({
|
|
3136
|
+
var ListStyled$2 = styled$1(List)({
|
|
3078
3137
|
marginLeft: '50px',
|
|
3079
3138
|
});
|
|
3080
3139
|
function LayerListFolder(_a) {
|
|
@@ -3103,9 +3162,9 @@ function LayerListFolder(_a) {
|
|
|
3103
3162
|
return React__default.createElement(React__default.Fragment, null);
|
|
3104
3163
|
}, [_visible]);
|
|
3105
3164
|
return (React__default.createElement(React__default.Fragment, null,
|
|
3106
|
-
React__default.createElement(ListItemStyled$
|
|
3107
|
-
React__default.createElement(ListItemIconStyled, null,
|
|
3108
|
-
React__default.createElement(IconButtonStyled$
|
|
3165
|
+
React__default.createElement(ListItemStyled$2, null,
|
|
3166
|
+
React__default.createElement(ListItemIconStyled$1, null,
|
|
3167
|
+
React__default.createElement(IconButtonStyled$2, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React__default.createElement(ExpandMore, null) : React__default.createElement(KeyboardArrowRight, null)),
|
|
3109
3168
|
React__default.createElement(CheckboxStyled$1, { disabled: setVisible ? false : !visible, checked: setVisible ? visible : localVisible, onClick: function () {
|
|
3110
3169
|
if (setVisible) {
|
|
3111
3170
|
setVisible(function (val) { return !val; });
|
|
@@ -3115,8 +3174,8 @@ function LayerListFolder(_a) {
|
|
|
3115
3174
|
}
|
|
3116
3175
|
} })),
|
|
3117
3176
|
React__default.createElement(ListItemText, { primary: name, variant: "layerlist" })),
|
|
3118
|
-
React__default.createElement(BoxStyled$
|
|
3119
|
-
React__default.createElement(ListStyled, { disablePadding: true }, _children))));
|
|
3177
|
+
React__default.createElement(BoxStyled$4, { open: open },
|
|
3178
|
+
React__default.createElement(ListStyled$2, { disablePadding: true }, _children))));
|
|
3120
3179
|
}
|
|
3121
3180
|
|
|
3122
3181
|
var converters = {
|
|
@@ -3130,7 +3189,7 @@ var converters = {
|
|
|
3130
3189
|
var ColorPicker = function (_a) {
|
|
3131
3190
|
var convert = _a.convert, props = __rest(_a, ["convert"]);
|
|
3132
3191
|
var _b = useState(false), showPicker = _b[0], setShowPicker = _b[1];
|
|
3133
|
-
var
|
|
3192
|
+
var value = (props === null || props === void 0 ? void 0 : props.value) || '';
|
|
3134
3193
|
return (React__default.createElement(React__default.Fragment, null,
|
|
3135
3194
|
React__default.createElement(Grid, { container: true, sx: { flexWrap: 'nowrap' } },
|
|
3136
3195
|
React__default.createElement(Grid, { xs: 12, item: true },
|
|
@@ -3157,7 +3216,6 @@ var ColorPicker = function (_a) {
|
|
|
3157
3216
|
React__default.createElement(ChromePicker, { color: value, onChange: function (c) {
|
|
3158
3217
|
var _a;
|
|
3159
3218
|
var newValue = converters[convert](c);
|
|
3160
|
-
setValue(newValue);
|
|
3161
3219
|
(_a = props === null || props === void 0 ? void 0 : props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, newValue);
|
|
3162
3220
|
} }))))));
|
|
3163
3221
|
};
|
|
@@ -3167,7 +3225,7 @@ ColorPicker.defaultProps = {
|
|
|
3167
3225
|
name: 'color',
|
|
3168
3226
|
};
|
|
3169
3227
|
|
|
3170
|
-
function PaintPropsColorPicker(_a) {
|
|
3228
|
+
function PaintPropsColorPicker$1(_a) {
|
|
3171
3229
|
var propKey = _a.propKey, value = _a.value, setPaintProps = _a.setPaintProps;
|
|
3172
3230
|
return (React__default.createElement(ColorPicker, { value: value, label: "Color", onChange: function (value) {
|
|
3173
3231
|
setPaintProps(function (current) {
|
|
@@ -3178,7 +3236,7 @@ function PaintPropsColorPicker(_a) {
|
|
|
3178
3236
|
} }));
|
|
3179
3237
|
}
|
|
3180
3238
|
|
|
3181
|
-
var PaperStyled = styled(Paper)({
|
|
3239
|
+
var PaperStyled$1 = styled(Paper)({
|
|
3182
3240
|
marginLeft: '-100px',
|
|
3183
3241
|
marginRight: '-21px',
|
|
3184
3242
|
paddingLeft: '53px',
|
|
@@ -3186,10 +3244,10 @@ var PaperStyled = styled(Paper)({
|
|
|
3186
3244
|
boxShadow: 'none',
|
|
3187
3245
|
backgroundColor: 'rgb(0, 0, 0, 0)',
|
|
3188
3246
|
});
|
|
3189
|
-
var BoxStyled$
|
|
3247
|
+
var BoxStyled$3 = styled(Box$1)({
|
|
3190
3248
|
marginLeft: '61px',
|
|
3191
3249
|
});
|
|
3192
|
-
var mapPropKeyToFormInputType = {
|
|
3250
|
+
var mapPropKeyToFormInputType$1 = {
|
|
3193
3251
|
'circle-color': 'colorpicker',
|
|
3194
3252
|
'circle-radius': 'slider',
|
|
3195
3253
|
'circle-stroke-color': 'colorpicker',
|
|
@@ -3200,8 +3258,8 @@ var mapPropKeyToFormInputType = {
|
|
|
3200
3258
|
'line-width': 'slider',
|
|
3201
3259
|
'line-blur': 'slider',
|
|
3202
3260
|
};
|
|
3203
|
-
var mapPropKeyToFormInputTypeKeys = Object.keys(mapPropKeyToFormInputType);
|
|
3204
|
-
var inputPropsByPropKey = {
|
|
3261
|
+
var mapPropKeyToFormInputTypeKeys$1 = Object.keys(mapPropKeyToFormInputType$1);
|
|
3262
|
+
var inputPropsByPropKey$1 = {
|
|
3205
3263
|
'circle-stroke-width': {
|
|
3206
3264
|
step: 1,
|
|
3207
3265
|
min: 1,
|
|
@@ -3223,18 +3281,18 @@ var inputPropsByPropKey = {
|
|
|
3223
3281
|
max: 100,
|
|
3224
3282
|
},
|
|
3225
3283
|
};
|
|
3226
|
-
function LayerPropertyForm(_a) {
|
|
3284
|
+
function LayerPropertyForm$1(_a) {
|
|
3227
3285
|
var _b = _a.paintProps, paintProps = _b === void 0 ? {} : _b, setPaintProps = _a.setPaintProps;
|
|
3228
3286
|
var key = useRef(Math.round(Math.random() * 10000000000));
|
|
3229
3287
|
var getFormInputByType = useCallback(function (key) {
|
|
3230
|
-
if (mapPropKeyToFormInputTypeKeys.indexOf(key) !== -1 &&
|
|
3288
|
+
if (mapPropKeyToFormInputTypeKeys$1.indexOf(key) !== -1 &&
|
|
3231
3289
|
(typeof paintProps[key] === 'number' || typeof paintProps[key] === 'string')) {
|
|
3232
3290
|
var label = (React__default.createElement(Typography, { id: key + '_label', gutterBottom: true }, key));
|
|
3233
|
-
switch (mapPropKeyToFormInputType[key]) {
|
|
3291
|
+
switch (mapPropKeyToFormInputType$1[key]) {
|
|
3234
3292
|
case 'slider':
|
|
3235
3293
|
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
3236
3294
|
label,
|
|
3237
|
-
React__default.createElement(Slider, __assign({}, inputPropsByPropKey[key], { inputProps: { inputMode: 'decimal', pattern: '[0-9]*' }, value: paintProps[key], valueLabelDisplay: "auto", onChange: function (_ev, value) {
|
|
3295
|
+
React__default.createElement(Slider, __assign({}, inputPropsByPropKey$1[key], { inputProps: { inputMode: 'decimal', pattern: '[0-9]*' }, value: paintProps[key], valueLabelDisplay: "auto", onChange: function (_ev, value) {
|
|
3238
3296
|
if (value) {
|
|
3239
3297
|
setPaintProps(function (current) {
|
|
3240
3298
|
var _a;
|
|
@@ -3258,24 +3316,24 @@ function LayerPropertyForm(_a) {
|
|
|
3258
3316
|
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
3259
3317
|
label,
|
|
3260
3318
|
React__default.createElement(Box$1, { sx: { '& > div': { width: 'initial !important' } } },
|
|
3261
|
-
React__default.createElement(PaintPropsColorPicker, { key: key, value: paintProps[key], propKey: key, setPaintProps: setPaintProps }))));
|
|
3319
|
+
React__default.createElement(PaintPropsColorPicker$1, { key: key, value: paintProps[key], propKey: key, setPaintProps: setPaintProps }))));
|
|
3262
3320
|
}
|
|
3263
3321
|
}
|
|
3264
3322
|
return null;
|
|
3265
3323
|
}, [paintProps]);
|
|
3266
3324
|
return (React__default.createElement(React__default.Fragment, null,
|
|
3267
|
-
React__default.createElement(PaperStyled, null,
|
|
3325
|
+
React__default.createElement(PaperStyled$1, null,
|
|
3268
3326
|
React__default.createElement(ListItem, { key: key + '_paintPropForm' },
|
|
3269
|
-
React__default.createElement(BoxStyled$
|
|
3327
|
+
React__default.createElement(BoxStyled$3, null, Object.keys(paintProps).map(function (el) { return getFormInputByType(el); }))))));
|
|
3270
3328
|
}
|
|
3271
3329
|
|
|
3272
|
-
var ListItemStyled = styled(ListItem)(function (configurable) { return ({
|
|
3330
|
+
var ListItemStyled$1 = styled(ListItem)(function (configurable) { return ({
|
|
3273
3331
|
paddingRight: configurable ? '56px' : 0,
|
|
3274
3332
|
paddingLeft: 0,
|
|
3275
3333
|
paddingTop: 0,
|
|
3276
3334
|
paddingBottom: '4px',
|
|
3277
3335
|
}); });
|
|
3278
|
-
var TuneIconButton$
|
|
3336
|
+
var TuneIconButton$2 = styled(IconButton)({
|
|
3279
3337
|
padding: '4px',
|
|
3280
3338
|
marginTop: '-3px',
|
|
3281
3339
|
});
|
|
@@ -3320,7 +3378,7 @@ function LayerListItemVectorLayer(_a) {
|
|
|
3320
3378
|
}
|
|
3321
3379
|
}, [paintProps, id, setVtProps, vtProps]);
|
|
3322
3380
|
return (React__default.createElement(React__default.Fragment, null,
|
|
3323
|
-
React__default.createElement(ListItemStyled, { key: id, secondaryAction: configurable ? (React__default.createElement(TuneIconButton$
|
|
3381
|
+
React__default.createElement(ListItemStyled$1, { key: id, secondaryAction: configurable ? (React__default.createElement(TuneIconButton$2, { edge: "end", "aria-label": "comments", onClick: function () {
|
|
3324
3382
|
setPaintPropsFormVisible(function (current) {
|
|
3325
3383
|
return !current;
|
|
3326
3384
|
});
|
|
@@ -3331,7 +3389,7 @@ function LayerListItemVectorLayer(_a) {
|
|
|
3331
3389
|
setVisible(function (val) { return !val; });
|
|
3332
3390
|
} })),
|
|
3333
3391
|
React__default.createElement(ListItemText, { primary: vtProps.layers[id].id, variant: "layerlist" })),
|
|
3334
|
-
configurable && paintPropsFormVisible && (React__default.createElement(LayerPropertyForm, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: vtProps.layers[id].type }))));
|
|
3392
|
+
configurable && paintPropsFormVisible && (React__default.createElement(LayerPropertyForm$1, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: vtProps.layers[id].type }))));
|
|
3335
3393
|
}
|
|
3336
3394
|
LayerListItemVectorLayer.defaultProps = {
|
|
3337
3395
|
configurable: true,
|
|
@@ -3363,11 +3421,11 @@ function SortableContainer(_a) {
|
|
|
3363
3421
|
return (React__default.createElement("li", __assign({ ref: setNodeRef, style: style }, attributes, listeners), children));
|
|
3364
3422
|
}
|
|
3365
3423
|
|
|
3366
|
-
var TuneIconButton = styled(IconButton)({
|
|
3424
|
+
var TuneIconButton$1 = styled(IconButton)({
|
|
3367
3425
|
padding: '4px',
|
|
3368
3426
|
marginTop: '-3px',
|
|
3369
3427
|
});
|
|
3370
|
-
var DeleteIconButton = styled(IconButton)({
|
|
3428
|
+
var DeleteIconButton$1 = styled(IconButton)({
|
|
3371
3429
|
marginLeft: '20px',
|
|
3372
3430
|
});
|
|
3373
3431
|
function LayerListItem(_a) {
|
|
@@ -3452,9 +3510,9 @@ function LayerListItem(_a) {
|
|
|
3452
3510
|
}
|
|
3453
3511
|
return undefined;
|
|
3454
3512
|
}, [layerComponent]);
|
|
3455
|
-
var listContent = (React__default.createElement(ListItemStyled, { sx: __assign({}, props.listItemSx), secondaryAction: configurable && ((_h = Object.keys(paintProps)) === null || _h === void 0 ? void 0 : _h.length) > 0 ? (React__default.createElement(React__default.Fragment, null, props === null || props === void 0 ? void 0 :
|
|
3513
|
+
var listContent = (React__default.createElement(ListItemStyled$1, { sx: __assign({}, props.listItemSx), secondaryAction: configurable && ((_h = Object.keys(paintProps)) === null || _h === void 0 ? void 0 : _h.length) > 0 ? (React__default.createElement(React__default.Fragment, null, props === null || props === void 0 ? void 0 :
|
|
3456
3514
|
props.buttons,
|
|
3457
|
-
React__default.createElement(TuneIconButton, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
3515
|
+
React__default.createElement(TuneIconButton$1, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
3458
3516
|
setPaintPropsFormVisible(function (current) {
|
|
3459
3517
|
return !current;
|
|
3460
3518
|
});
|
|
@@ -3474,7 +3532,7 @@ function LayerListItem(_a) {
|
|
|
3474
3532
|
configurable &&
|
|
3475
3533
|
paintPropsFormVisible && (React__default.createElement(React__default.Fragment, null,
|
|
3476
3534
|
props.showDeleteButton && (React__default.createElement(React__default.Fragment, null,
|
|
3477
|
-
React__default.createElement(DeleteIconButton, { edge: "end", "aria-label": "delete", onClick: function () {
|
|
3535
|
+
React__default.createElement(DeleteIconButton$1, { edge: "end", "aria-label": "delete", onClick: function () {
|
|
3478
3536
|
if (typeof setLayerState === 'function') {
|
|
3479
3537
|
setShowDeletionConfirmationDialog(true);
|
|
3480
3538
|
}
|
|
@@ -3489,7 +3547,7 @@ function LayerListItem(_a) {
|
|
|
3489
3547
|
}, onCancel: function () {
|
|
3490
3548
|
setShowDeletionConfirmationDialog(false);
|
|
3491
3549
|
}, title: "Delete layer", text: "Are you sure you want to delete this layer?" })))),
|
|
3492
|
-
React__default.createElement(LayerPropertyForm, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: layerType }))),
|
|
3550
|
+
React__default.createElement(LayerPropertyForm$1, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: layerType }))),
|
|
3493
3551
|
((_m = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _m === void 0 ? void 0 : _m.layers) && (React__default.createElement(LayerListFolder, { visible: localVisible, setVisible: setLocalVisible, name: name }, (_q = (_p = (_o = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _o === void 0 ? void 0 : _o.layers) === null || _p === void 0 ? void 0 : _p.map) === null || _q === void 0 ? void 0 : _q.call(_p, function (_el, idx) { return (React__default.createElement(LayerListItemVectorLayer, { vtProps: layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props, setVtProps: setLayerState, id: '' + idx, key: '' + idx, visibleMaster: _visible })); })))));
|
|
3494
3552
|
}
|
|
3495
3553
|
LayerListItem.defaultProps = {
|
|
@@ -3599,7 +3657,6 @@ var MlMultiMeasureTool = function (props) {
|
|
|
3599
3657
|
var _d = useState(), measureState = _d[0], setMeasureState = _d[1];
|
|
3600
3658
|
var _e = useState('kilometers'), selectedUnit = _e[0], setSelectedUnit = _e[1];
|
|
3601
3659
|
var _f = useState([]), measureList = _f[0], setMeasureList = _f[1];
|
|
3602
|
-
console.log(measureList);
|
|
3603
3660
|
var _g = useState(false), reload = _g[0], setReload = _g[1];
|
|
3604
3661
|
var unitSwitch = function () {
|
|
3605
3662
|
if (selectedUnit === 'kilometers') {
|
|
@@ -3797,7 +3854,7 @@ var SvgCompassBackground = function SvgCompassBackground(props) {
|
|
|
3797
3854
|
})));
|
|
3798
3855
|
};
|
|
3799
3856
|
|
|
3800
|
-
var BoxStyled = styled(Box$1)(function (_a) {
|
|
3857
|
+
var BoxStyled$2 = styled(Box$1)(function (_a) {
|
|
3801
3858
|
var _b;
|
|
3802
3859
|
var theme = _a.theme;
|
|
3803
3860
|
return (_b = {
|
|
@@ -3898,7 +3955,7 @@ var MlNavigationCompass = function (props) {
|
|
|
3898
3955
|
}
|
|
3899
3956
|
};
|
|
3900
3957
|
return (React__default.createElement(React__default.Fragment, null,
|
|
3901
|
-
React__default.createElement(BoxStyled, { sx: __assign({}, props.style) },
|
|
3958
|
+
React__default.createElement(BoxStyled$2, { sx: __assign({}, props.style) },
|
|
3902
3959
|
React__default.createElement(CompassBox, { onClick: rotate, sx: __assign({}, props.backgroundStyle) },
|
|
3903
3960
|
React__default.createElement(SvgCompassBackground, { style: { position: 'absolute', top: 0, left: 0 } }),
|
|
3904
3961
|
React__default.createElement(NeedleBox, { onClick: rotate, sx: __assign({}, props.needleStyle) },
|
|
@@ -3948,7 +4005,7 @@ var MlNavigationTools = function (props) {
|
|
|
3948
4005
|
var targetPitch = mapHook.map.getPitch() !== 0 ? 0 : 60;
|
|
3949
4006
|
mapHook.map.easeTo({ pitch: targetPitch });
|
|
3950
4007
|
}, [mapHook.map]);
|
|
3951
|
-
return (React__default.createElement(Box$2, { sx: __assign(__assign({ zIndex: 501, position: 'absolute', display: 'flex', flexDirection: 'column', right: mediaIsMobile ? '15px' : '25px', bottom: mediaIsMobile ? '20px' : '
|
|
4008
|
+
return (React__default.createElement(Box$2, { sx: __assign(__assign({ zIndex: 501, position: 'absolute', display: 'flex', flexDirection: 'column', right: mediaIsMobile ? '15px' : '25px', bottom: mediaIsMobile ? '20px' : '40px' }, (mediaIsMobile ? { margin: '80px 10px 50px 10px' } : { marginTop: '50px' })), props.sx) },
|
|
3952
4009
|
React__default.createElement(MlNavigationCompass, null),
|
|
3953
4010
|
props.show3DButton && (React__default.createElement(Button$1, { variant: "navtools", onClick: adjustPitch }, pitch < 29 ? '3D' : '2D')),
|
|
3954
4011
|
props.showFollowGpsButton && React__default.createElement(MlFollowGps, null),
|
|
@@ -5751,6 +5808,75 @@ var MlVectorTileLayer = function (props) {
|
|
|
5751
5808
|
return React__default.createElement(React__default.Fragment, null);
|
|
5752
5809
|
};
|
|
5753
5810
|
|
|
5811
|
+
var MlOgcApiFeatures = function (props) {
|
|
5812
|
+
var _a;
|
|
5813
|
+
var _b = useState(), geojson = _b[0], setGeojson = _b[1];
|
|
5814
|
+
var mapHook = useMap({ mapId: props.mapId });
|
|
5815
|
+
var layerId = useRef(((_a = props.mlGeoJsonLayerProps) === null || _a === void 0 ? void 0 : _a.layerId) || 'MlOgcApiFeature-' + mapHook.componentId);
|
|
5816
|
+
var buildOgcApiUrl = function () {
|
|
5817
|
+
var _a, _b;
|
|
5818
|
+
var url = new URL(props.ogcApiUrl);
|
|
5819
|
+
if (props.ogcApiFeatureParams) {
|
|
5820
|
+
Object.entries(props.ogcApiFeatureParams).forEach(function (_a) {
|
|
5821
|
+
var key = _a[0], value = _a[1];
|
|
5822
|
+
if (value !== undefined && value !== null) {
|
|
5823
|
+
url.searchParams.append(key, value.toString());
|
|
5824
|
+
}
|
|
5825
|
+
});
|
|
5826
|
+
}
|
|
5827
|
+
if (props.reloadFeaturesOnMapMove) {
|
|
5828
|
+
var southWest = (_a = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _a === void 0 ? void 0 : _a.getBounds().getSouthWest();
|
|
5829
|
+
var northEast = (_b = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _b === void 0 ? void 0 : _b.getBounds().getNorthEast();
|
|
5830
|
+
var bbox = "".concat(southWest === null || southWest === void 0 ? void 0 : southWest.lng, ",").concat(southWest === null || southWest === void 0 ? void 0 : southWest.lat, ",").concat(northEast === null || northEast === void 0 ? void 0 : northEast.lng, ",").concat(northEast === null || northEast === void 0 ? void 0 : northEast.lat);
|
|
5831
|
+
url.searchParams.append('bbox', bbox);
|
|
5832
|
+
}
|
|
5833
|
+
return url.toString();
|
|
5834
|
+
};
|
|
5835
|
+
useEffect(function () {
|
|
5836
|
+
if (!mapHook.map)
|
|
5837
|
+
return;
|
|
5838
|
+
var getDataHandler = function () {
|
|
5839
|
+
var generatedOgcApiUrl = buildOgcApiUrl();
|
|
5840
|
+
fetch(generatedOgcApiUrl)
|
|
5841
|
+
.then(function (res) {
|
|
5842
|
+
if (!res.ok)
|
|
5843
|
+
throw new Error('Error fetching OGC features');
|
|
5844
|
+
return res.json();
|
|
5845
|
+
})
|
|
5846
|
+
.then(function (data) {
|
|
5847
|
+
setGeojson(data);
|
|
5848
|
+
})
|
|
5849
|
+
.catch(function (error) {
|
|
5850
|
+
console.log(error);
|
|
5851
|
+
setGeojson(undefined);
|
|
5852
|
+
});
|
|
5853
|
+
};
|
|
5854
|
+
getDataHandler();
|
|
5855
|
+
if (props.reloadFeaturesOnMapMove) {
|
|
5856
|
+
mapHook.map.on('moveend', getDataHandler);
|
|
5857
|
+
}
|
|
5858
|
+
return function () {
|
|
5859
|
+
var _a;
|
|
5860
|
+
if ((_a = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _a === void 0 ? void 0 : _a.off) {
|
|
5861
|
+
mapHook.map.off('moveend', getDataHandler);
|
|
5862
|
+
}
|
|
5863
|
+
};
|
|
5864
|
+
}, [mapHook.map, props.ogcApiFeatureParams, props.ogcApiUrl]);
|
|
5865
|
+
useEffect(function () {
|
|
5866
|
+
// if layer is not yet on map return
|
|
5867
|
+
if (!mapHook.map || !mapHook.map.map.style.getLayer(layerId.current))
|
|
5868
|
+
return;
|
|
5869
|
+
// if layer is already on map: toggle layer visibility by changing the layout object's visibility property
|
|
5870
|
+
if (props.visible) {
|
|
5871
|
+
mapHook.map.map.setLayoutProperty(layerId.current, 'visibility', 'visible');
|
|
5872
|
+
}
|
|
5873
|
+
else {
|
|
5874
|
+
mapHook.map.map.setLayoutProperty(layerId.current, 'visibility', 'none');
|
|
5875
|
+
}
|
|
5876
|
+
}, [props.visible, mapHook.map]);
|
|
5877
|
+
return (React__default.createElement(React__default.Fragment, null, geojson && (React__default.createElement(MlGeoJsonLayer, __assign({ geojson: geojson, layerId: layerId.current }, props.mlGeoJsonLayerProps)))));
|
|
5878
|
+
};
|
|
5879
|
+
|
|
5754
5880
|
/**
|
|
5755
5881
|
* TODO: Add short & useful description
|
|
5756
5882
|
*
|
|
@@ -6124,13 +6250,13 @@ var MlWmsLoader = function (props) {
|
|
|
6124
6250
|
var unprojected = mapHook.map.unproject([ev.point.x, ev.point.y]);
|
|
6125
6251
|
var point = turf.point([unprojected.lng, unprojected.lat]);
|
|
6126
6252
|
var buffered = turf.buffer(point, 50, { units: 'meters' });
|
|
6127
|
-
var _bbox = turf.bbox(buffered);
|
|
6128
|
-
var _sw = lngLatToMeters({ lng: _bbox[0], lat: _bbox[1] });
|
|
6129
|
-
var _ne = lngLatToMeters({ lng: _bbox[2], lat: _bbox[3] });
|
|
6130
|
-
var bbox = [_sw[0], _sw[1], _ne[0], _ne[1]];
|
|
6253
|
+
var _bbox = buffered && turf.bbox(buffered);
|
|
6254
|
+
var _sw = _bbox && lngLatToMeters({ lng: _bbox[0], lat: _bbox[1] });
|
|
6255
|
+
var _ne = _bbox && lngLatToMeters({ lng: _bbox[2], lat: _bbox[3] });
|
|
6256
|
+
var bbox = _sw && _ne && [_sw[0], _sw[1], _ne[0], _ne[1]];
|
|
6131
6257
|
var _getFeatureInfoUrlParams = {
|
|
6132
6258
|
REQUEST: 'GetFeatureInfo',
|
|
6133
|
-
BBOX: bbox.join(','),
|
|
6259
|
+
BBOX: bbox === null || bbox === void 0 ? void 0 : bbox.join(','),
|
|
6134
6260
|
SERVICE: 'WMS',
|
|
6135
6261
|
INFO_FORMAT: ((_b = (_a = capabilities === null || capabilities === void 0 ? void 0 : capabilities.Capability) === null || _a === void 0 ? void 0 : _a.Request) === null || _b === void 0 ? void 0 : _b.GetFeatureInfo.Format.indexOf('text/html')) !== -1
|
|
6136
6262
|
? 'text/html'
|
|
@@ -7050,7 +7176,7 @@ var useCameraFollowPath = function (props) {
|
|
|
7050
7176
|
var speed = useRef(props.speed);
|
|
7051
7177
|
var timeoutId = useRef();
|
|
7052
7178
|
var kmPerStep = props.kmPerStep || 0.01;
|
|
7053
|
-
var routeDistance = turf.
|
|
7179
|
+
var routeDistance = turf.length(props.route);
|
|
7054
7180
|
var stepDuration = props.stepDuration || 70;
|
|
7055
7181
|
var mapHook = useMap({
|
|
7056
7182
|
mapId: props.mapId,
|
|
@@ -7639,7 +7765,7 @@ SimpleDataProvider.propTypes = {
|
|
|
7639
7765
|
children: PropTypes.node.isRequired,
|
|
7640
7766
|
};
|
|
7641
7767
|
|
|
7642
|
-
var IconButtonStyled = styled(IconButton)({
|
|
7768
|
+
var IconButtonStyled$1 = styled(IconButton)({
|
|
7643
7769
|
padding: '4px',
|
|
7644
7770
|
marginTop: '-3px',
|
|
7645
7771
|
background: 'none',
|
|
@@ -7742,15 +7868,15 @@ function LayerListItemFactory(props) {
|
|
|
7742
7868
|
switch (layer.type) {
|
|
7743
7869
|
case 'geojson':
|
|
7744
7870
|
return (React__default.createElement(LayerListItem, { key: layer.id, layerId: layer.id, sortable: props.sortable, name: (layer === null || layer === void 0 ? void 0 : layer.name) || ((_a = layer === null || layer === void 0 ? void 0 : layer.config) === null || _a === void 0 ? void 0 : _a.type) + ' layer' || 'unnamed layer', layerComponent: React__default.createElement(MlGeoJsonLayer, __assign({}, layer.config, { mapId: props === null || props === void 0 ? void 0 : props.mapId, layerId: layer.id, insertBeforeLayer: 'content_order_' + (layers.length - 1 - idx) })), buttons: React__default.createElement(React__default.Fragment, null,
|
|
7745
|
-
React__default.createElement(IconButtonStyled, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7871
|
+
React__default.createElement(IconButtonStyled$1, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7746
7872
|
layerContext.moveDown(layer.id || '');
|
|
7747
7873
|
} },
|
|
7748
7874
|
React__default.createElement(ArrowCircleDown, null)),
|
|
7749
|
-
React__default.createElement(IconButtonStyled, { disabled: idx === 0, onClick: function () {
|
|
7875
|
+
React__default.createElement(IconButtonStyled$1, { disabled: idx === 0, onClick: function () {
|
|
7750
7876
|
layerContext.moveUp(layer.id || '');
|
|
7751
7877
|
} },
|
|
7752
7878
|
React__default.createElement(ArrowCircleUp, null)),
|
|
7753
|
-
React__default.createElement(IconButtonStyled, { onClick: function () { return fitLayer(layer); } },
|
|
7879
|
+
React__default.createElement(IconButtonStyled$1, { onClick: function () { return fitLayer(layer); } },
|
|
7754
7880
|
React__default.createElement(CenterFocusWeak, null))), setLayerState: function (layerConfig) {
|
|
7755
7881
|
return setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7756
7882
|
var _layers = __spreadArray([], current, true);
|
|
@@ -7788,28 +7914,28 @@ function LayerListItemFactory(props) {
|
|
|
7788
7914
|
return _layers;
|
|
7789
7915
|
});
|
|
7790
7916
|
}, showDeleteButton: true, buttons: React__default.createElement(React__default.Fragment, null,
|
|
7791
|
-
React__default.createElement(IconButtonStyled, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7917
|
+
React__default.createElement(IconButtonStyled$1, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7792
7918
|
layerContext.moveDown(layer.id || '');
|
|
7793
7919
|
} },
|
|
7794
7920
|
React__default.createElement(ArrowCircleDown, null)),
|
|
7795
|
-
React__default.createElement(IconButtonStyled, { disabled: idx === 0, onClick: function () {
|
|
7921
|
+
React__default.createElement(IconButtonStyled$1, { disabled: idx === 0, onClick: function () {
|
|
7796
7922
|
layerContext.moveUp(layer.id || '');
|
|
7797
7923
|
} },
|
|
7798
7924
|
React__default.createElement(ArrowCircleUp, null)),
|
|
7799
|
-
React__default.createElement(IconButtonStyled, { onClick: function () { return fitLayer(layer); } },
|
|
7925
|
+
React__default.createElement(IconButtonStyled$1, { onClick: function () { return fitLayer(layer); } },
|
|
7800
7926
|
React__default.createElement(CenterFocusWeak, null))) }))));
|
|
7801
7927
|
case 'vt':
|
|
7802
7928
|
return (React__default.createElement(React__default.Fragment, { key: (layer === null || layer === void 0 ? void 0 : layer.id) + '_listItem' },
|
|
7803
7929
|
React__default.createElement(LayerListItem, { key: layer.id, name: (layer === null || layer === void 0 ? void 0 : layer.name) || (layer === null || layer === void 0 ? void 0 : layer.type) + ' layer' || 'unnamed layer', layerComponent: React__default.createElement(MlVectorTileLayer, { layers: ((_c = layer === null || layer === void 0 ? void 0 : layer.config) === null || _c === void 0 ? void 0 : _c.layers) || [], key: layer.id, mapId: layer === null || layer === void 0 ? void 0 : layer.config.mapId, sourceOptions: (_d = layer === null || layer === void 0 ? void 0 : layer.config) === null || _d === void 0 ? void 0 : _d.sourceOptions, layerId: layer.id, url: (_e = layer === null || layer === void 0 ? void 0 : layer.config) === null || _e === void 0 ? void 0 : _e.url }), buttons: React__default.createElement(React__default.Fragment, null,
|
|
7804
|
-
React__default.createElement(IconButtonStyled, { key: layer.id + '_button1', disabled: idx === layers.length - 1, onClick: function () {
|
|
7930
|
+
React__default.createElement(IconButtonStyled$1, { key: layer.id + '_button1', disabled: idx === layers.length - 1, onClick: function () {
|
|
7805
7931
|
layerContext.moveDown(layer.id || '');
|
|
7806
7932
|
} },
|
|
7807
7933
|
React__default.createElement(ArrowCircleDown, null)),
|
|
7808
|
-
React__default.createElement(IconButtonStyled, { key: layer.id + '_button2', disabled: idx === 0, onClick: function () {
|
|
7934
|
+
React__default.createElement(IconButtonStyled$1, { key: layer.id + '_button2', disabled: idx === 0, onClick: function () {
|
|
7809
7935
|
layerContext.moveUp(layer.id || '');
|
|
7810
7936
|
} },
|
|
7811
7937
|
React__default.createElement(ArrowCircleUp, null)),
|
|
7812
|
-
React__default.createElement(IconButtonStyled, { onClick: function () { return fitLayer(layer); } },
|
|
7938
|
+
React__default.createElement(IconButtonStyled$1, { onClick: function () { return fitLayer(layer); } },
|
|
7813
7939
|
React__default.createElement(CenterFocusWeak, null))), setLayerState: function (layerConfig) {
|
|
7814
7940
|
return setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7815
7941
|
var _layers = __spreadArray([], current, true);
|
|
@@ -21160,5 +21286,566 @@ SpeedDial.defaultProps = {
|
|
|
21160
21286
|
mapId: undefined,
|
|
21161
21287
|
};
|
|
21162
21288
|
|
|
21163
|
-
|
|
21289
|
+
var _a;
|
|
21290
|
+
function processLayerOrderItems(action, items, parent) {
|
|
21291
|
+
items.forEach(function (item) {
|
|
21292
|
+
action(item, parent);
|
|
21293
|
+
if (item.layers && item.layers.length > 0) {
|
|
21294
|
+
processLayerOrderItems(action, item.layers, item);
|
|
21295
|
+
}
|
|
21296
|
+
});
|
|
21297
|
+
}
|
|
21298
|
+
var initialState = {
|
|
21299
|
+
mapConfigs: {},
|
|
21300
|
+
};
|
|
21301
|
+
//@ts-ignore
|
|
21302
|
+
var mapConfigSlice = createSlice({
|
|
21303
|
+
name: 'mapConfig',
|
|
21304
|
+
initialState: initialState,
|
|
21305
|
+
reducers: {
|
|
21306
|
+
// Add or update a MapConfig
|
|
21307
|
+
setMapConfig: function (state, action) {
|
|
21308
|
+
var mapConfig = action.payload.mapConfig;
|
|
21309
|
+
var key = action.payload.key;
|
|
21310
|
+
//@ts-ignore
|
|
21311
|
+
state.mapConfigs[key] = mapConfig;
|
|
21312
|
+
},
|
|
21313
|
+
// Remove a MapConfig by its uuid
|
|
21314
|
+
removeMapConfig: function (state, action) {
|
|
21315
|
+
delete state.mapConfigs[action.payload.key];
|
|
21316
|
+
},
|
|
21317
|
+
// Add or update a layer within a MapConfig
|
|
21318
|
+
setLayerInMapConfig: function (state, action) {
|
|
21319
|
+
var _a = action.payload, mapConfigKey = _a.mapConfigKey, updatedLayer = _a.layer;
|
|
21320
|
+
var mapConfig = state.mapConfigs[mapConfigKey];
|
|
21321
|
+
if (mapConfig) {
|
|
21322
|
+
for (var i = 0; i < mapConfig.layers.length; i++) {
|
|
21323
|
+
if (mapConfig.layers[i].uuid === updatedLayer.uuid) {
|
|
21324
|
+
mapConfig.layers[i] = updatedLayer;
|
|
21325
|
+
break;
|
|
21326
|
+
}
|
|
21327
|
+
}
|
|
21328
|
+
}
|
|
21329
|
+
},
|
|
21330
|
+
// Remove a layer from a MapConfig
|
|
21331
|
+
removeLayerFromMapConfig: function (state, action) {
|
|
21332
|
+
var _a = action.payload, mapConfigKey = _a.mapConfigKey, layerUuid = _a.layerUuid;
|
|
21333
|
+
var mapConfig = state.mapConfigs[mapConfigKey];
|
|
21334
|
+
if (mapConfig) {
|
|
21335
|
+
var targetLayerIndex = mapConfig.layers.findIndex(function (el) { return el.uuid === layerUuid; });
|
|
21336
|
+
if (targetLayerIndex !== -1) {
|
|
21337
|
+
delete mapConfig.layers[targetLayerIndex];
|
|
21338
|
+
processLayerOrderItems(function (_, parent) {
|
|
21339
|
+
if (parent && parent.layers) {
|
|
21340
|
+
parent.layers = parent.layers.filter(function (child) { return child.uuid !== layerUuid; });
|
|
21341
|
+
}
|
|
21342
|
+
}, mapConfig.layerOrder);
|
|
21343
|
+
}
|
|
21344
|
+
}
|
|
21345
|
+
},
|
|
21346
|
+
updateLayerOrder: function (state, action) {
|
|
21347
|
+
var _a = action.payload, mapConfigKey = _a.mapConfigKey, newOrder = _a.newOrder;
|
|
21348
|
+
var mapConfig = state.mapConfigs[mapConfigKey];
|
|
21349
|
+
if (mapConfig) {
|
|
21350
|
+
mapConfig.layerOrder = newOrder;
|
|
21351
|
+
}
|
|
21352
|
+
},
|
|
21353
|
+
// masterVisible property will be applied to all children of a folder that is set to be not visible
|
|
21354
|
+
// masterVisible will over rule the actual layer config if set to false
|
|
21355
|
+
// if masterVisible is true the actual layerConfig visibility setting is respected
|
|
21356
|
+
setMasterVisible: function (state, action) {
|
|
21357
|
+
var _a;
|
|
21358
|
+
var _b = action.payload, mapConfigKey = _b.mapConfigKey, layerId = _b.layerId, masterVisible = _b.masterVisible;
|
|
21359
|
+
var mapConfig = state.mapConfigs[mapConfigKey];
|
|
21360
|
+
if (mapConfig) {
|
|
21361
|
+
var targetLayerIndex = mapConfig.layers.findIndex(function (el) { return el.uuid === layerId; });
|
|
21362
|
+
if (targetLayerIndex !== -1) {
|
|
21363
|
+
var layerConfig = mapConfig.layers[targetLayerIndex];
|
|
21364
|
+
if (layerConfig) {
|
|
21365
|
+
var updatedLayers_1 = __spreadArray([], mapConfig.layers, true);
|
|
21366
|
+
if (layerConfig.type === 'folder') {
|
|
21367
|
+
mapConfig.layerOrder.forEach(function (folder) {
|
|
21368
|
+
var _a;
|
|
21369
|
+
if (folder.uuid === layerId) {
|
|
21370
|
+
(_a = folder.layers) === null || _a === void 0 ? void 0 : _a.forEach(function (childUuid) {
|
|
21371
|
+
var _a;
|
|
21372
|
+
var childLayerIndex = mapConfig.layers.findIndex(function (el) { return el.uuid === childUuid.uuid; });
|
|
21373
|
+
var childLayer = updatedLayers_1[childLayerIndex];
|
|
21374
|
+
updatedLayers_1[childLayerIndex] = __assign(__assign({}, childLayer), { masterVisible: masterVisible });
|
|
21375
|
+
if ((childLayer === null || childLayer === void 0 ? void 0 : childLayer.type) === 'vt' && ((_a = childLayer === null || childLayer === void 0 ? void 0 : childLayer.config) === null || _a === void 0 ? void 0 : _a.layers)) {
|
|
21376
|
+
childLayer.config.layers = childLayer.config.layers.map(function (layer) { return (__assign(__assign({}, layer), { masterVisible: masterVisible })); });
|
|
21377
|
+
}
|
|
21378
|
+
});
|
|
21379
|
+
}
|
|
21380
|
+
});
|
|
21381
|
+
}
|
|
21382
|
+
if (layerConfig.type === 'vt' && ((_a = layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.config) === null || _a === void 0 ? void 0 : _a.layers)) {
|
|
21383
|
+
layerConfig.config.layers = layerConfig.config.layers.map(function (layer) { return (__assign(__assign({}, layer), { masterVisible: masterVisible })); });
|
|
21384
|
+
}
|
|
21385
|
+
state.mapConfigs[mapConfigKey].layers = updatedLayers_1;
|
|
21386
|
+
}
|
|
21387
|
+
}
|
|
21388
|
+
}
|
|
21389
|
+
},
|
|
21390
|
+
},
|
|
21391
|
+
});
|
|
21392
|
+
var getLayerByUuid = function (state, uuid) {
|
|
21393
|
+
var mapConfigs = state.mapConfigs;
|
|
21394
|
+
for (var key in mapConfigs) {
|
|
21395
|
+
var mapConfig = mapConfigs[key];
|
|
21396
|
+
var targetLayerIndex = mapConfig.layers.findIndex(function (el) { return el.uuid === uuid; });
|
|
21397
|
+
var foundLayer = mapConfig.layers[targetLayerIndex];
|
|
21398
|
+
if (foundLayer)
|
|
21399
|
+
return foundLayer;
|
|
21400
|
+
}
|
|
21401
|
+
return null;
|
|
21402
|
+
};
|
|
21403
|
+
var extractUuidsFromLayerOrder = function (state, mapConfigKey) {
|
|
21404
|
+
var mapConfig = state.mapConfig.mapConfigs[mapConfigKey];
|
|
21405
|
+
if (!mapConfig) {
|
|
21406
|
+
return [];
|
|
21407
|
+
}
|
|
21408
|
+
var layerOrder = mapConfig.layerOrder;
|
|
21409
|
+
var uuids = [];
|
|
21410
|
+
function extractUuids(items) {
|
|
21411
|
+
items.forEach(function (item) {
|
|
21412
|
+
uuids.push(item.uuid);
|
|
21413
|
+
if (item.layers && item.layers.length > 0) {
|
|
21414
|
+
extractUuids(item.layers);
|
|
21415
|
+
}
|
|
21416
|
+
});
|
|
21417
|
+
}
|
|
21418
|
+
extractUuids(layerOrder);
|
|
21419
|
+
return uuids;
|
|
21420
|
+
};
|
|
21421
|
+
var store = configureStore({
|
|
21422
|
+
reducer: {
|
|
21423
|
+
mapConfig: mapConfigSlice.reducer,
|
|
21424
|
+
},
|
|
21425
|
+
});
|
|
21426
|
+
var setMapConfig = (_a = mapConfigSlice.actions, _a.setMapConfig), removeMapConfig = _a.removeMapConfig, setLayerInMapConfig = _a.setLayerInMapConfig, removeLayerFromMapConfig = _a.removeLayerFromMapConfig, updateLayerOrder = _a.updateLayerOrder, setMasterVisible = _a.setMasterVisible;
|
|
21427
|
+
|
|
21428
|
+
function PaintPropsColorPicker(props) {
|
|
21429
|
+
return (React__default.createElement(ColorPicker, { value: props.value, label: "Color", onChange: function (value) {
|
|
21430
|
+
if (typeof props.onChange === 'function') {
|
|
21431
|
+
props.onChange(value);
|
|
21432
|
+
}
|
|
21433
|
+
} }));
|
|
21434
|
+
}
|
|
21435
|
+
|
|
21436
|
+
var PaperStyled = styled(Paper)({
|
|
21437
|
+
marginLeft: '-100px',
|
|
21438
|
+
marginRight: '-21px',
|
|
21439
|
+
paddingLeft: '53px',
|
|
21440
|
+
borderRadius: '0px',
|
|
21441
|
+
boxShadow: 'none',
|
|
21442
|
+
backgroundColor: 'rgb(0, 0, 0, 0)',
|
|
21443
|
+
});
|
|
21444
|
+
var BoxStyled$1 = styled(Box$1)({
|
|
21445
|
+
marginLeft: '61px',
|
|
21446
|
+
});
|
|
21447
|
+
var mapPropKeyToFormInputType = {
|
|
21448
|
+
'circle-color': 'colorpicker',
|
|
21449
|
+
'circle-radius': 'slider',
|
|
21450
|
+
'circle-stroke-color': 'colorpicker',
|
|
21451
|
+
'circle-stroke-width': 'slider',
|
|
21452
|
+
'fill-color': 'colorpicker',
|
|
21453
|
+
'fill-outline-color': 'colorpicker',
|
|
21454
|
+
'line-color': 'colorpicker',
|
|
21455
|
+
'line-width': 'slider',
|
|
21456
|
+
'line-blur': 'slider',
|
|
21457
|
+
};
|
|
21458
|
+
var mapPropKeyToFormInputTypeKeys = Object.keys(mapPropKeyToFormInputType);
|
|
21459
|
+
var inputPropsByPropKey = {
|
|
21460
|
+
'circle-stroke-width': {
|
|
21461
|
+
step: 1,
|
|
21462
|
+
min: 1,
|
|
21463
|
+
max: 20,
|
|
21464
|
+
},
|
|
21465
|
+
'circle-radius': {
|
|
21466
|
+
step: 1,
|
|
21467
|
+
min: 1,
|
|
21468
|
+
max: 100,
|
|
21469
|
+
},
|
|
21470
|
+
'line-blur': {
|
|
21471
|
+
step: 1,
|
|
21472
|
+
min: 1,
|
|
21473
|
+
max: 100,
|
|
21474
|
+
},
|
|
21475
|
+
'line-width': {
|
|
21476
|
+
step: 1,
|
|
21477
|
+
min: 1,
|
|
21478
|
+
max: 100,
|
|
21479
|
+
},
|
|
21480
|
+
};
|
|
21481
|
+
function LayerPropertyForm(props) {
|
|
21482
|
+
var _a, _b;
|
|
21483
|
+
var key = useRef(Math.round(Math.random() * 10000000000));
|
|
21484
|
+
var layer = getLayerByUuid(useSelector(function (state) { return state.mapConfig; }), props.layerUuid);
|
|
21485
|
+
var dispatch = useDispatch();
|
|
21486
|
+
var paintProps = useMemo(function () {
|
|
21487
|
+
var _a, _b, _c, _d;
|
|
21488
|
+
if ((_b = (_a = layer === null || layer === void 0 ? void 0 : layer.config) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.paint) {
|
|
21489
|
+
return (_d = (_c = layer === null || layer === void 0 ? void 0 : layer.config) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.paint;
|
|
21490
|
+
}
|
|
21491
|
+
return {};
|
|
21492
|
+
}, [(_b = (_a = layer === null || layer === void 0 ? void 0 : layer.config) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.paint]);
|
|
21493
|
+
var updatePaintProp = function (key, value) {
|
|
21494
|
+
var _a;
|
|
21495
|
+
var _b, _c, _d;
|
|
21496
|
+
var updatedLayer = __assign(__assign({}, layer), { config: __assign(__assign({}, layer === null || layer === void 0 ? void 0 : layer.config), { options: __assign(__assign({}, (_b = layer === null || layer === void 0 ? void 0 : layer.config) === null || _b === void 0 ? void 0 : _b.options), { paint: __assign(__assign({}, (_d = (_c = layer === null || layer === void 0 ? void 0 : layer.config) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.paint), (_a = {}, _a[key] = value, _a)) }) }) });
|
|
21497
|
+
dispatch(setLayerInMapConfig({
|
|
21498
|
+
mapConfigKey: props.mapConfigKey,
|
|
21499
|
+
layer: updatedLayer,
|
|
21500
|
+
}));
|
|
21501
|
+
};
|
|
21502
|
+
var getFormInputByType = useCallback(function (key) {
|
|
21503
|
+
if ((paintProps === null || paintProps === void 0 ? void 0 : paintProps[key]) &&
|
|
21504
|
+
mapPropKeyToFormInputTypeKeys.indexOf(key) !== -1 &&
|
|
21505
|
+
(typeof paintProps[key] === 'number' || typeof paintProps[key] === 'string')) {
|
|
21506
|
+
var label = (React__default.createElement(Typography, { id: key + '_label', gutterBottom: true }, key));
|
|
21507
|
+
switch (mapPropKeyToFormInputType[key]) {
|
|
21508
|
+
case 'slider':
|
|
21509
|
+
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
21510
|
+
label,
|
|
21511
|
+
React__default.createElement(Slider, __assign({}, inputPropsByPropKey[key], { value: paintProps[key], valueLabelDisplay: "auto", onChange: function (_ev, value) {
|
|
21512
|
+
if (value) {
|
|
21513
|
+
updatePaintProp(key, value);
|
|
21514
|
+
}
|
|
21515
|
+
} }))));
|
|
21516
|
+
case 'numberfield':
|
|
21517
|
+
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
21518
|
+
label,
|
|
21519
|
+
React__default.createElement(TextField, { inputProps: { inputMode: 'decimal', pattern: '[0-9]*' }, value: paintProps[key], onChange: function (ev) {
|
|
21520
|
+
var _a;
|
|
21521
|
+
if ((_a = ev === null || ev === void 0 ? void 0 : ev.target) === null || _a === void 0 ? void 0 : _a.value) {
|
|
21522
|
+
updatePaintProp(key, parseInt(ev.target.value));
|
|
21523
|
+
}
|
|
21524
|
+
} })));
|
|
21525
|
+
case 'colorpicker':
|
|
21526
|
+
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
21527
|
+
label,
|
|
21528
|
+
React__default.createElement(Box$1, { sx: { '& > div': { width: 'initial !important' } } },
|
|
21529
|
+
React__default.createElement(PaintPropsColorPicker, { key: key, value: paintProps[key], onChange: function (value) {
|
|
21530
|
+
updatePaintProp(key, value);
|
|
21531
|
+
} }))));
|
|
21532
|
+
}
|
|
21533
|
+
}
|
|
21534
|
+
return null;
|
|
21535
|
+
}, [paintProps]);
|
|
21536
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
21537
|
+
React__default.createElement(PaperStyled, null,
|
|
21538
|
+
React__default.createElement(ListItem, { key: key.current + '_paintPropForm' },
|
|
21539
|
+
React__default.createElement(BoxStyled$1, null, paintProps &&
|
|
21540
|
+
Object.keys(paintProps).map(function (el) { return getFormInputByType(el); }))))));
|
|
21541
|
+
}
|
|
21542
|
+
|
|
21543
|
+
var TuneIconButton = styled(IconButton)({
|
|
21544
|
+
padding: '4px',
|
|
21545
|
+
marginTop: '-3px',
|
|
21546
|
+
});
|
|
21547
|
+
var DeleteIconButton = styled(IconButton)({
|
|
21548
|
+
marginLeft: '20px',
|
|
21549
|
+
});
|
|
21550
|
+
var ListItemStyled = styled(ListItem)({
|
|
21551
|
+
paddingRight: 0,
|
|
21552
|
+
paddingLeft: 0,
|
|
21553
|
+
paddingTop: 0,
|
|
21554
|
+
paddingBottom: '4px',
|
|
21555
|
+
});
|
|
21556
|
+
var ListItemIconStyled = styled(ListItemIcon)({
|
|
21557
|
+
minWidth: '30px',
|
|
21558
|
+
});
|
|
21559
|
+
var IconButtonStyled = styled(IconButton)({
|
|
21560
|
+
marginRight: '0px',
|
|
21561
|
+
padding: '0px',
|
|
21562
|
+
});
|
|
21563
|
+
var BoxStyled = styled(Box$1)(function (_a) {
|
|
21564
|
+
var open = _a.open;
|
|
21565
|
+
return ({
|
|
21566
|
+
display: open ? 'block' : 'none',
|
|
21567
|
+
});
|
|
21568
|
+
});
|
|
21569
|
+
var ListStyled$1 = styled(List)({
|
|
21570
|
+
marginLeft: '50px',
|
|
21571
|
+
});
|
|
21572
|
+
function LayerTreeListItem(props) {
|
|
21573
|
+
var _a = useState(false), paintPropsFormVisible = _a[0], setPaintPropsFormVisible = _a[1];
|
|
21574
|
+
var _b = useState(false), showDeletionConfirmationDialog = _b[0], setShowDeletionConfirmationDialog = _b[1];
|
|
21575
|
+
var layer = getLayerByUuid(useSelector(function (state) { return state.mapConfig; }), props.layerOrderConfig.uuid);
|
|
21576
|
+
var _c = useState(false), open = _c[0], setOpen = _c[1];
|
|
21577
|
+
var dispatch = useDispatch();
|
|
21578
|
+
var mapConfig = useSelector(function (state) { return state.mapConfig.mapConfigs[props.mapConfigKey]; });
|
|
21579
|
+
function moveLayer(uuid, getNewPos) {
|
|
21580
|
+
var newLayerOrder = JSON.parse(JSON.stringify(mapConfig.layerOrder));
|
|
21581
|
+
var findAndMove = function (layers) {
|
|
21582
|
+
var found = false;
|
|
21583
|
+
layers.forEach(function (layer, index) {
|
|
21584
|
+
if (found)
|
|
21585
|
+
return;
|
|
21586
|
+
if (layer.uuid === uuid) {
|
|
21587
|
+
var newPos = getNewPos(index);
|
|
21588
|
+
if (newPos < 0 || newPos >= layers.length) {
|
|
21589
|
+
throw new Error('New position is out of bounds');
|
|
21590
|
+
}
|
|
21591
|
+
var item = layers.splice(index, 1)[0];
|
|
21592
|
+
layers.splice(newPos, 0, item);
|
|
21593
|
+
found = true;
|
|
21594
|
+
}
|
|
21595
|
+
else if (layer.layers) {
|
|
21596
|
+
if (findAndMove(layer.layers)) {
|
|
21597
|
+
found = true;
|
|
21598
|
+
}
|
|
21599
|
+
}
|
|
21600
|
+
});
|
|
21601
|
+
return found;
|
|
21602
|
+
};
|
|
21603
|
+
findAndMove(newLayerOrder);
|
|
21604
|
+
dispatch(updateLayerOrder({ mapConfigKey: props.mapConfigKey, newOrder: newLayerOrder }));
|
|
21605
|
+
}
|
|
21606
|
+
var moveDown = function (uuid) {
|
|
21607
|
+
moveLayer(uuid, function (idx) { return idx + 1; });
|
|
21608
|
+
};
|
|
21609
|
+
var moveUp = function (uuid) {
|
|
21610
|
+
moveLayer(uuid, function (idx) { return idx - 1; });
|
|
21611
|
+
};
|
|
21612
|
+
function handleToggleVisibility(visible, specificLayerId) {
|
|
21613
|
+
if (specificLayerId === void 0) { specificLayerId = ''; }
|
|
21614
|
+
var nextVisible = !visible;
|
|
21615
|
+
if (layer) {
|
|
21616
|
+
toggleVisible(layer, nextVisible, specificLayerId);
|
|
21617
|
+
if (layer.type === 'folder' || (layer.type === 'vt' && specificLayerId === '')) {
|
|
21618
|
+
dispatch(setMasterVisible({
|
|
21619
|
+
mapConfigKey: props.mapConfigKey,
|
|
21620
|
+
layerId: layer.uuid,
|
|
21621
|
+
masterVisible: nextVisible,
|
|
21622
|
+
}));
|
|
21623
|
+
}
|
|
21624
|
+
}
|
|
21625
|
+
}
|
|
21626
|
+
function toggleVisible(layer, nextVisible, specificLayerId) {
|
|
21627
|
+
var _a, _b, _c;
|
|
21628
|
+
//TODO: update layout for all layer types
|
|
21629
|
+
var updatedLayer = __assign({}, layer);
|
|
21630
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'folder') {
|
|
21631
|
+
updatedLayer = __assign(__assign({}, layer), { visible: !layer.visible });
|
|
21632
|
+
}
|
|
21633
|
+
else {
|
|
21634
|
+
switch (layer === null || layer === void 0 ? void 0 : layer.type) {
|
|
21635
|
+
case 'geojson': {
|
|
21636
|
+
updatedLayer = __assign(__assign({}, layer), { config: __assign(__assign({}, layer.config), { options: __assign(__assign({}, (_a = layer === null || layer === void 0 ? void 0 : layer.config) === null || _a === void 0 ? void 0 : _a.options), { layout: __assign(__assign({}, (_c = (_b = layer === null || layer === void 0 ? void 0 : layer.config) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.layout), { visibility: nextVisible ? 'visible' : 'none' }) }) }) });
|
|
21637
|
+
break;
|
|
21638
|
+
}
|
|
21639
|
+
case 'vt': {
|
|
21640
|
+
var updateSublayerOnly_1 = false;
|
|
21641
|
+
var updatedSubLayers = layer.config.layers.map(function (layer) {
|
|
21642
|
+
if (layer.id === specificLayerId) {
|
|
21643
|
+
updateSublayerOnly_1 = true;
|
|
21644
|
+
return __assign(__assign({}, layer), { layout: __assign(__assign({}, layer.layout), { visibility: nextVisible ? 'visible' : 'none' }) });
|
|
21645
|
+
}
|
|
21646
|
+
return layer;
|
|
21647
|
+
});
|
|
21648
|
+
if (updateSublayerOnly_1) {
|
|
21649
|
+
updatedLayer = __assign(__assign({}, layer), { config: __assign(__assign({}, layer.config), { layers: updatedSubLayers }) });
|
|
21650
|
+
}
|
|
21651
|
+
else {
|
|
21652
|
+
updatedLayer = __assign(__assign({}, layer), { visible: nextVisible, config: __assign(__assign({}, layer.config), { layers: updatedSubLayers }) });
|
|
21653
|
+
}
|
|
21654
|
+
break;
|
|
21655
|
+
}
|
|
21656
|
+
case 'wms': {
|
|
21657
|
+
updatedLayer = __assign(__assign({}, layer), { visible: nextVisible, config: __assign(__assign({}, layer.config), { visible: nextVisible }) });
|
|
21658
|
+
break;
|
|
21659
|
+
}
|
|
21660
|
+
}
|
|
21661
|
+
}
|
|
21662
|
+
dispatch(setLayerInMapConfig({
|
|
21663
|
+
mapConfigKey: props.mapConfigKey,
|
|
21664
|
+
layer: updatedLayer,
|
|
21665
|
+
}));
|
|
21666
|
+
return updatedLayer;
|
|
21667
|
+
}
|
|
21668
|
+
function renderLayerItem(layer) {
|
|
21669
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
21670
|
+
var visible = true;
|
|
21671
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'geojson') {
|
|
21672
|
+
visible = ((_c = (_b = (_a = layer === null || layer === void 0 ? void 0 : layer.config) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.visibility) !== 'none';
|
|
21673
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
21674
|
+
React__default.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx), secondaryAction: React__default.createElement(React__default.Fragment, null, props === null || props === void 0 ? void 0 :
|
|
21675
|
+
props.buttons,
|
|
21676
|
+
React__default.createElement(IconButtonStyled, { disabled: false, onClick: function () {
|
|
21677
|
+
moveDown(layer.uuid);
|
|
21678
|
+
} },
|
|
21679
|
+
React__default.createElement(ArrowCircleDown, null)),
|
|
21680
|
+
React__default.createElement(IconButtonStyled, { disabled: false, onClick: function () {
|
|
21681
|
+
moveUp(layer.uuid);
|
|
21682
|
+
} },
|
|
21683
|
+
React__default.createElement(ArrowCircleUp, null)),
|
|
21684
|
+
layer.configurable && (React__default.createElement(React__default.Fragment, null,
|
|
21685
|
+
React__default.createElement(TuneIconButton, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
21686
|
+
setPaintPropsFormVisible(function (current) {
|
|
21687
|
+
return !current;
|
|
21688
|
+
});
|
|
21689
|
+
} },
|
|
21690
|
+
React__default.createElement(Tune, null))))) },
|
|
21691
|
+
React__default.createElement(CheckboxListItemIcon, null,
|
|
21692
|
+
React__default.createElement(CheckboxStyled, { checked: visible, disabled: layer.masterVisible === false, onClick: function () { return handleToggleVisibility(visible); } })),
|
|
21693
|
+
React__default.createElement(ListItemText, { variant: "layerlist", primary: layer.name || '', secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } }),
|
|
21694
|
+
props.buttons),
|
|
21695
|
+
layer.configurable && paintPropsFormVisible && (React__default.createElement(React__default.Fragment, null,
|
|
21696
|
+
props.showDeleteButton && (React__default.createElement(React__default.Fragment, null,
|
|
21697
|
+
React__default.createElement(DeleteIconButton, { edge: "end", "aria-label": "delete", onClick: function () { } },
|
|
21698
|
+
React__default.createElement(Delete, null)),
|
|
21699
|
+
showDeletionConfirmationDialog && (React__default.createElement(ConfirmDialog, { open: showDeletionConfirmationDialog, onConfirm: function () {
|
|
21700
|
+
setShowDeletionConfirmationDialog(false);
|
|
21701
|
+
}, onCancel: function () {
|
|
21702
|
+
setShowDeletionConfirmationDialog(false);
|
|
21703
|
+
}, title: "Delete layer", text: "Are you sure you want to delete this layer?" })))),
|
|
21704
|
+
React__default.createElement(LayerPropertyForm, { layerUuid: layer.uuid, mapConfigKey: props.mapConfigKey })))));
|
|
21705
|
+
}
|
|
21706
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'vt') {
|
|
21707
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
21708
|
+
React__default.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx), secondaryAction: undefined },
|
|
21709
|
+
React__default.createElement(ListItemIconStyled, null,
|
|
21710
|
+
React__default.createElement(IconButtonStyled, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React__default.createElement(ExpandMore, null) : React__default.createElement(KeyboardArrowRight, null)),
|
|
21711
|
+
React__default.createElement(CheckboxListItemIcon, null,
|
|
21712
|
+
React__default.createElement(CheckboxStyled, { checked: layer.visible, disabled: layer.masterVisible === false, onClick: function () { var _a; return handleToggleVisibility((_a = layer.visible) !== null && _a !== void 0 ? _a : false); } }))),
|
|
21713
|
+
React__default.createElement(ListItemText, { primary: layer.name, secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } })),
|
|
21714
|
+
React__default.createElement(BoxStyled, { key: layer.uuid + '_list', open: open },
|
|
21715
|
+
React__default.createElement(ListStyled$1, { disablePadding: true }, (_e = (_d = layer.config) === null || _d === void 0 ? void 0 : _d.layers) === null || _e === void 0 ? void 0 : _e.map(function (subLayer) {
|
|
21716
|
+
var _a, _b;
|
|
21717
|
+
return (React__default.createElement(ListItemStyled, { key: subLayer.id, sx: __assign({}, props.listItemSx), secondaryAction: undefined },
|
|
21718
|
+
' ',
|
|
21719
|
+
React__default.createElement(ListItemIconStyled, null,
|
|
21720
|
+
React__default.createElement(CheckboxListItemIcon, null,
|
|
21721
|
+
React__default.createElement(CheckboxStyled, { checked: ((_b = (_a = subLayer === null || subLayer === void 0 ? void 0 : subLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== null && _b !== void 0 ? _b : 'visible') === 'visible', disabled: (subLayer === null || subLayer === void 0 ? void 0 : subLayer.masterVisible) === false, onClick: function () {
|
|
21722
|
+
var _a;
|
|
21723
|
+
return handleToggleVisibility(((_a = subLayer === null || subLayer === void 0 ? void 0 : subLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible', subLayer.id);
|
|
21724
|
+
} }))),
|
|
21725
|
+
React__default.createElement(ListItemText, { key: subLayer.id, variant: "layerlist", primary: subLayer['source-layer'], primaryTypographyProps: { overflow: 'hidden' } })));
|
|
21726
|
+
})))));
|
|
21727
|
+
}
|
|
21728
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'wms') {
|
|
21729
|
+
var visible_1 = (_g = (_f = layer.config) === null || _f === void 0 ? void 0 : _f.visible) !== null && _g !== void 0 ? _g : true;
|
|
21730
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
21731
|
+
React__default.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx), secondaryAction: undefined },
|
|
21732
|
+
React__default.createElement(CheckboxListItemIcon, null,
|
|
21733
|
+
React__default.createElement(CheckboxStyled, { checked: visible_1, disabled: layer.masterVisible === false, onClick: function () { return handleToggleVisibility(visible_1); } })),
|
|
21734
|
+
React__default.createElement(ListItemText, { primary: layer.name, secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } }))));
|
|
21735
|
+
}
|
|
21736
|
+
if (layer.type === 'folder') {
|
|
21737
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
21738
|
+
React__default.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx) },
|
|
21739
|
+
React__default.createElement(ListItemIconStyled, null,
|
|
21740
|
+
React__default.createElement(IconButtonStyled, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React__default.createElement(ExpandMore, null) : React__default.createElement(KeyboardArrowRight, null)),
|
|
21741
|
+
React__default.createElement(CheckboxListItemIcon, null,
|
|
21742
|
+
React__default.createElement(CheckboxStyled, { checked: layer.visible, disabled: layer.masterVisible, onClick: function () { return handleToggleVisibility(layer.visible ? layer.visible : false); } }))),
|
|
21743
|
+
React__default.createElement(ListItemText, { primary: layer.name, secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } })),
|
|
21744
|
+
React__default.createElement(BoxStyled, { key: layer.uuid + '_list', open: open },
|
|
21745
|
+
React__default.createElement(ListStyled$1, { disablePadding: true }, (_j = (_h = props === null || props === void 0 ? void 0 : props.layerOrderConfig) === null || _h === void 0 ? void 0 : _h.layers) === null || _j === void 0 ? void 0 : _j.map(function (subLayer) { return (React__default.createElement(LayerTreeListItem, { layerOrderConfig: subLayer, key: subLayer.uuid, mapConfigKey: props.mapConfigKey })); })))));
|
|
21746
|
+
}
|
|
21747
|
+
else {
|
|
21748
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
21749
|
+
}
|
|
21750
|
+
}
|
|
21751
|
+
return React__default.createElement(React__default.Fragment, null, layer && renderLayerItem(layer));
|
|
21752
|
+
}
|
|
21753
|
+
|
|
21754
|
+
var ListStyled = styled(List)({
|
|
21755
|
+
marginTop: '15px',
|
|
21756
|
+
});
|
|
21757
|
+
function LayerTree(props) {
|
|
21758
|
+
var _a;
|
|
21759
|
+
var layerOrder = useSelector(function (state) { var _a, _b; return (_b = (_a = state.mapConfig.mapConfigs) === null || _a === void 0 ? void 0 : _a[props.mapConfigKey]) === null || _b === void 0 ? void 0 : _b.layerOrder; });
|
|
21760
|
+
return (React__default.createElement(ListStyled, null, (_a = layerOrder === null || layerOrder === void 0 ? void 0 : layerOrder.map) === null || _a === void 0 ? void 0 : _a.call(layerOrder, function (el) { return (React__default.createElement(LayerTreeListItem, { key: el.uuid, layerOrderConfig: el, mapConfigKey: props.mapConfigKey })); })));
|
|
21761
|
+
}
|
|
21762
|
+
|
|
21763
|
+
function LayerOnMap(props) {
|
|
21764
|
+
var _a;
|
|
21765
|
+
var layers = useSelector(function (state) { var _a, _b; return (_b = (_a = state.mapConfig.mapConfigs) === null || _a === void 0 ? void 0 : _a[props.mapConfigKey]) === null || _b === void 0 ? void 0 : _b.layers; });
|
|
21766
|
+
var layerStoreOrder = useSelector(function (state) { var _a, _b; return (_b = (_a = state.mapConfig.mapConfigs) === null || _a === void 0 ? void 0 : _a[props.mapConfigKey]) === null || _b === void 0 ? void 0 : _b.layerOrder; });
|
|
21767
|
+
var mapHook = useMap({ mapId: props === null || props === void 0 ? void 0 : props.mapId });
|
|
21768
|
+
var layerStoreOrderIds = useSelector(function (state) {
|
|
21769
|
+
return extractUuidsFromLayerOrder(state, props.mapConfigKey);
|
|
21770
|
+
});
|
|
21771
|
+
var previousLayerStoreOrderRef = useRef([]);
|
|
21772
|
+
useEffect(function () {
|
|
21773
|
+
if (!mapHook.map || !layerStoreOrder)
|
|
21774
|
+
return;
|
|
21775
|
+
var adjustLayerOrderAtLevel = function (layers, previousLayers, map) {
|
|
21776
|
+
for (var i = 0; i < layers.length; i++) {
|
|
21777
|
+
var currentLayer = layers[i];
|
|
21778
|
+
var previousLayer = previousLayers ? previousLayers[i] : null;
|
|
21779
|
+
if (currentLayer.uuid !== (previousLayer === null || previousLayer === void 0 ? void 0 : previousLayer.uuid)) {
|
|
21780
|
+
if (map.getLayer(currentLayer.uuid)) {
|
|
21781
|
+
var beforeLayer = i > 0 ? layers[i - 1].uuid : undefined;
|
|
21782
|
+
map.moveLayer(currentLayer.uuid, beforeLayer);
|
|
21783
|
+
}
|
|
21784
|
+
}
|
|
21785
|
+
if (currentLayer.layers && currentLayer.layers.length > 0) {
|
|
21786
|
+
var previousSubLayers = (previousLayer === null || previousLayer === void 0 ? void 0 : previousLayer.layers) || [];
|
|
21787
|
+
adjustLayerOrderAtLevel(currentLayer.layers, previousSubLayers, map);
|
|
21788
|
+
}
|
|
21789
|
+
}
|
|
21790
|
+
};
|
|
21791
|
+
var previousLayerStoreOrder = previousLayerStoreOrderRef.current;
|
|
21792
|
+
adjustLayerOrderAtLevel(layerStoreOrder, previousLayerStoreOrder, mapHook.map);
|
|
21793
|
+
previousLayerStoreOrderRef.current = layerStoreOrder;
|
|
21794
|
+
}, [layerStoreOrder, mapHook.map]);
|
|
21795
|
+
var orderLayers = useMemo(function () {
|
|
21796
|
+
var layerIds = __spreadArray(__spreadArray([
|
|
21797
|
+
'order-background'
|
|
21798
|
+
], layerStoreOrderIds.map(function (el) { return 'layer_id_' + el; }), true), [
|
|
21799
|
+
'order-labels',
|
|
21800
|
+
], false);
|
|
21801
|
+
return layerIds;
|
|
21802
|
+
}, [layerStoreOrderIds]);
|
|
21803
|
+
function renderLayer(layer) {
|
|
21804
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
21805
|
+
var targetLayerIndex = layers.findIndex(function (el) { return el.uuid === layer.uuid; });
|
|
21806
|
+
var layerConfig = layers[targetLayerIndex];
|
|
21807
|
+
switch (layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.type) {
|
|
21808
|
+
case 'geojson':
|
|
21809
|
+
return (React__default.createElement(MlGeoJsonLayer, __assign({ key: layerConfig.uuid, layerId: layerConfig.uuid, insertBeforeLayer: 'layer_id_' + layerConfig.uuid }, layerConfig.config, { options: __assign(__assign({}, layerConfig.config.options), { layout: __assign(__assign({}, (_b = (_a = layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.config) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.layout), { visibility: layerConfig.masterVisible === false
|
|
21810
|
+
? 'none'
|
|
21811
|
+
: ((_e = (_d = (_c = layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.config) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.visibility)
|
|
21812
|
+
? (_h = (_g = (_f = layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.config) === null || _f === void 0 ? void 0 : _f.options) === null || _g === void 0 ? void 0 : _g.layout) === null || _h === void 0 ? void 0 : _h.visibility
|
|
21813
|
+
: 'visible' }) }) })));
|
|
21814
|
+
case 'vt': {
|
|
21815
|
+
var l = layerConfig.config.layers.map(function (layer) {
|
|
21816
|
+
var _a;
|
|
21817
|
+
var newLayer = __assign({}, layer);
|
|
21818
|
+
if (newLayer.layout) {
|
|
21819
|
+
newLayer.layout = __assign(__assign({}, newLayer.layout), { visibility: newLayer.masterVisible === false ? 'none' : (_a = newLayer.layout.visibility) !== null && _a !== void 0 ? _a : 'visible' });
|
|
21820
|
+
}
|
|
21821
|
+
return newLayer;
|
|
21822
|
+
});
|
|
21823
|
+
return (React__default.createElement(MlVectorTileLayer, { key: layerConfig.uuid, layerId: layerConfig.uuid, insertBeforeLayer: 'layer_id_' + layerConfig.uuid, url: layerConfig.config.url, layers: l }));
|
|
21824
|
+
}
|
|
21825
|
+
case 'wms': {
|
|
21826
|
+
var visible = layerConfig.masterVisible === false ? false : (_j = layerConfig.config) === null || _j === void 0 ? void 0 : _j.visible;
|
|
21827
|
+
return (React__default.createElement(MlWmsLayer, { key: layerConfig.uuid, layerId: layerConfig.uuid, insertBeforeLayer: 'layer_id_' + layerConfig.uuid, url: ((_k = layerConfig.config) === null || _k === void 0 ? void 0 : _k.url) || '', urlParameters: (_l = layerConfig.config) === null || _l === void 0 ? void 0 : _l.urlParameters, visible: visible }));
|
|
21828
|
+
}
|
|
21829
|
+
case 'folder':
|
|
21830
|
+
return (layer === null || layer === void 0 ? void 0 : layer.layers) ? (layer.layers.map(function (subLayer) { return renderLayer(subLayer); })) : (React__default.createElement(React__default.Fragment, null));
|
|
21831
|
+
default:
|
|
21832
|
+
return null;
|
|
21833
|
+
}
|
|
21834
|
+
}
|
|
21835
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
21836
|
+
React__default.createElement(MlOrderLayers, { layerIds: orderLayers }), (_a = layerStoreOrder === null || layerStoreOrder === void 0 ? void 0 : layerStoreOrder.map) === null || _a === void 0 ? void 0 :
|
|
21837
|
+
_a.call(layerStoreOrder, function (layerOrderItem) { return renderLayer(layerOrderItem); })));
|
|
21838
|
+
}
|
|
21839
|
+
|
|
21840
|
+
var MapStore = {
|
|
21841
|
+
store: store,
|
|
21842
|
+
setMapConfig: setMapConfig,
|
|
21843
|
+
removeMapConfig: removeMapConfig,
|
|
21844
|
+
setLayerInMapConfig: setLayerInMapConfig,
|
|
21845
|
+
removeLayerFromMapConfig: removeLayerFromMapConfig,
|
|
21846
|
+
updateLayerOrder: updateLayerOrder,
|
|
21847
|
+
setMasterVisible: setMasterVisible,
|
|
21848
|
+
};
|
|
21849
|
+
|
|
21850
|
+
export { AddLayerButton, AddLayerPopup, CSVProtocolHandler, PaintPropsColorPicker$1 as ColorPicker, ConfirmDialog, GeoJsonContext, GeoJsonLayerForm, GeoJsonProvider, GruvboxStyle, LayerContext, LayerContextProvider, LayerList, LayerListFolder, LayerListItem, LayerListItemFactory, LayerListItemVectorLayer, LayerOnMap, LayerPropertyForm$1 as LayerPropertyForm, LayerTree, LayerTreeListItem, LayerTypeForm, MapComponentsProvider, MapContext, MapLibreGlWrapper, MapLibreMap, MapStore, MedievalKingdomStyle, MlCenterPosition, MlComponentTemplate, MlCreatePdfButton, MlCreatePdfForm, MlFeatureEditor, MlFillExtrusionLayer, MlFollowGps, MlGeoJsonLayer, MlGpxViewer, MlImageMarkerLayer, MlLayer, MlLayerMagnify, MlLayerSwipe, MlMarker, MlMeasureTool, MlMultiMeasureTool, MlNavigationCompass, MlNavigationTools, MlOgcApiFeatures, MlOrderLayers, PdfPreview as MlPdfPreview, MlScaleReference, MlShareMapState, MlSketchTool, MlSpatialElevationProfile, MlTemporalController, MlTerrainLayer, MlTransitionGeoJsonLayer, MlVectorTileLayer, MlWmsFeatureInfoPopup, MlWmsLayer, MlWmsLoader, MonokaiStyle, OSMProtocolHandler, OceanicNextStyle, PdfContext, PdfForm, SelectStyleButton, SelectStylePopup, Sidebar, SimpleDataContext, SimpleDataProvider, SolarizedStyle, SpeedDial, TopToolbar, TopojsonProtocolHandler, UploadButton, WmsLayerForm, XMLProtocolHandler, convertCsv, convertOSM, convertTopojson, convertXML, getTheme, useAddImage, useAddProtocol, useCameraFollowPath, useExportMap, useFeatureEditor, useFilterData, useGpx, useLayer, useLayerContext, useLayerEvent, useLayerFilter, LayerHoverPopup as useLayerHoverPopup, useMap, useMapState, useSource, useWms };
|
|
21164
21851
|
//# sourceMappingURL=index.esm.js.map
|