@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.cjs.js
CHANGED
|
@@ -84,6 +84,8 @@ var SpeedDialAction = require('@mui/material/SpeedDialAction');
|
|
|
84
84
|
var LayersIcon = require('@mui/icons-material/Layers');
|
|
85
85
|
var DesignServicesIcon = require('@mui/icons-material/DesignServices');
|
|
86
86
|
var PictureAsPdfIcon = require('@mui/icons-material/PictureAsPdf');
|
|
87
|
+
var reactRedux = require('react-redux');
|
|
88
|
+
var toolkit = require('@reduxjs/toolkit');
|
|
87
89
|
|
|
88
90
|
function _interopNamespaceDefault(e) {
|
|
89
91
|
var n = Object.create(null);
|
|
@@ -2029,9 +2031,9 @@ function featureEditorStyle() {
|
|
|
2029
2031
|
['!=', 'mode', 'static'],
|
|
2030
2032
|
],
|
|
2031
2033
|
paint: {
|
|
2032
|
-
'fill-color': '#
|
|
2033
|
-
'fill-outline-color': '#
|
|
2034
|
-
'fill-opacity': 0.
|
|
2034
|
+
'fill-color': '#009EE0',
|
|
2035
|
+
'fill-outline-color': '#009EE0',
|
|
2036
|
+
'fill-opacity': 0.3,
|
|
2035
2037
|
},
|
|
2036
2038
|
},
|
|
2037
2039
|
{
|
|
@@ -2039,18 +2041,9 @@ function featureEditorStyle() {
|
|
|
2039
2041
|
type: 'fill',
|
|
2040
2042
|
filter: ['all', ['==', 'active', 'true'], ['==', '$type', 'Polygon']],
|
|
2041
2043
|
paint: {
|
|
2042
|
-
'fill-color': '#
|
|
2043
|
-
'fill-outline-color': '#
|
|
2044
|
-
'fill-opacity': 0.
|
|
2045
|
-
},
|
|
2046
|
-
},
|
|
2047
|
-
{
|
|
2048
|
-
id: 'gl-draw-polygon-midpoint',
|
|
2049
|
-
type: 'circle',
|
|
2050
|
-
filter: ['all', ['==', '$type', 'Point'], ['==', 'meta', 'midpoint']],
|
|
2051
|
-
paint: {
|
|
2052
|
-
'circle-radius': mediaIsMobile ? 7 : 5,
|
|
2053
|
-
'circle-color': '#fbb03b',
|
|
2044
|
+
'fill-color': '#009EE0',
|
|
2045
|
+
'fill-outline-color': '#009EE0',
|
|
2046
|
+
'fill-opacity': 0.2,
|
|
2054
2047
|
},
|
|
2055
2048
|
},
|
|
2056
2049
|
{
|
|
@@ -2067,8 +2060,8 @@ function featureEditorStyle() {
|
|
|
2067
2060
|
'line-join': 'round',
|
|
2068
2061
|
},
|
|
2069
2062
|
paint: {
|
|
2070
|
-
'line-color': '#
|
|
2071
|
-
'line-width':
|
|
2063
|
+
'line-color': '#009EE0',
|
|
2064
|
+
'line-width': 3,
|
|
2072
2065
|
},
|
|
2073
2066
|
},
|
|
2074
2067
|
{
|
|
@@ -2080,7 +2073,7 @@ function featureEditorStyle() {
|
|
|
2080
2073
|
'line-join': 'round',
|
|
2081
2074
|
},
|
|
2082
2075
|
paint: {
|
|
2083
|
-
'line-color': '#
|
|
2076
|
+
'line-color': '#009EE0',
|
|
2084
2077
|
'line-dasharray': [0.2, 2],
|
|
2085
2078
|
'line-width': 2,
|
|
2086
2079
|
},
|
|
@@ -2099,8 +2092,8 @@ function featureEditorStyle() {
|
|
|
2099
2092
|
'line-join': 'round',
|
|
2100
2093
|
},
|
|
2101
2094
|
paint: {
|
|
2102
|
-
'line-color': '#
|
|
2103
|
-
'line-width':
|
|
2095
|
+
'line-color': '#009EE0',
|
|
2096
|
+
'line-width': 3,
|
|
2104
2097
|
},
|
|
2105
2098
|
},
|
|
2106
2099
|
{
|
|
@@ -2112,11 +2105,22 @@ function featureEditorStyle() {
|
|
|
2112
2105
|
'line-join': 'round',
|
|
2113
2106
|
},
|
|
2114
2107
|
paint: {
|
|
2115
|
-
'line-color':
|
|
2108
|
+
'line-color': "#009EE0",
|
|
2116
2109
|
'line-dasharray': [0.2, 2],
|
|
2117
2110
|
'line-width': 2,
|
|
2118
2111
|
},
|
|
2119
2112
|
},
|
|
2113
|
+
{
|
|
2114
|
+
id: 'gl-draw-polygon-midpoint',
|
|
2115
|
+
type: 'circle',
|
|
2116
|
+
filter: ['all', ['==', '$type', 'Point'], ['==', 'meta', 'midpoint']],
|
|
2117
|
+
paint: {
|
|
2118
|
+
'circle-radius': mediaIsMobile ? 5 : 4,
|
|
2119
|
+
'circle-color': '#ffffff',
|
|
2120
|
+
'circle-stroke-color': '#009EE0',
|
|
2121
|
+
'circle-stroke-width': 1
|
|
2122
|
+
},
|
|
2123
|
+
},
|
|
2120
2124
|
{
|
|
2121
2125
|
id: 'gl-draw-polygon-and-line-vertex-stroke-inactive',
|
|
2122
2126
|
type: 'circle',
|
|
@@ -2132,7 +2136,9 @@ function featureEditorStyle() {
|
|
|
2132
2136
|
filter: ['all', ['==', 'meta', 'vertex'], ['==', '$type', 'Point'], ['!=', 'mode', 'static']],
|
|
2133
2137
|
paint: {
|
|
2134
2138
|
'circle-radius': mediaIsMobile ? 7 : 5,
|
|
2135
|
-
'circle-color': '#
|
|
2139
|
+
'circle-color': '#ffffff',
|
|
2140
|
+
'circle-stroke-color': '#009EE0',
|
|
2141
|
+
'circle-stroke-width': 1
|
|
2136
2142
|
},
|
|
2137
2143
|
},
|
|
2138
2144
|
{
|
|
@@ -2148,7 +2154,7 @@ function featureEditorStyle() {
|
|
|
2148
2154
|
paint: {
|
|
2149
2155
|
'circle-radius': mediaIsMobile ? 10 : 9,
|
|
2150
2156
|
'circle-opacity': 1,
|
|
2151
|
-
'circle-color': '#
|
|
2157
|
+
'circle-color': '#009EE0',
|
|
2152
2158
|
},
|
|
2153
2159
|
},
|
|
2154
2160
|
{
|
|
@@ -2163,7 +2169,7 @@ function featureEditorStyle() {
|
|
|
2163
2169
|
],
|
|
2164
2170
|
paint: {
|
|
2165
2171
|
'circle-radius': mediaIsMobile ? 7.5 : 6.5,
|
|
2166
|
-
'circle-color': '#
|
|
2172
|
+
'circle-color': '#009EE0',
|
|
2167
2173
|
},
|
|
2168
2174
|
},
|
|
2169
2175
|
{
|
|
@@ -2191,7 +2197,7 @@ function featureEditorStyle() {
|
|
|
2191
2197
|
],
|
|
2192
2198
|
paint: {
|
|
2193
2199
|
'circle-radius': mediaIsMobile ? 8.5 : 7.5,
|
|
2194
|
-
'circle-color': '#
|
|
2200
|
+
'circle-color': '#009EE0',
|
|
2195
2201
|
},
|
|
2196
2202
|
},
|
|
2197
2203
|
{
|
|
@@ -2930,7 +2936,7 @@ var MlFollowGps = function (props) {
|
|
|
2930
2936
|
];
|
|
2931
2937
|
var accurancyBounds = turf.bbox(accuracyGeoJson);
|
|
2932
2938
|
var contained = turf.booleanContains(turf.bboxPolygon(actualBounds), turf.bboxPolygon(accurancyBounds));
|
|
2933
|
-
if (contained
|
|
2939
|
+
if (!contained) {
|
|
2934
2940
|
(_b = mapHook.map) === null || _b === void 0 ? void 0 : _b.fitBounds(accurancyBounds, {
|
|
2935
2941
|
padding: { top: 25, bottom: 25 },
|
|
2936
2942
|
});
|
|
@@ -3009,46 +3015,93 @@ var MlImageMarkerLayer = function (props) {
|
|
|
3009
3015
|
return React.createElement(React.Fragment, null);
|
|
3010
3016
|
};
|
|
3011
3017
|
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
+
function unitMultiplier(unit) {
|
|
3019
|
+
switch (unit) {
|
|
3020
|
+
case 'meters':
|
|
3021
|
+
return 1;
|
|
3022
|
+
case 'millimeters':
|
|
3023
|
+
return 1000;
|
|
3024
|
+
case 'centimeters':
|
|
3025
|
+
return 100;
|
|
3026
|
+
case 'kilometers':
|
|
3027
|
+
return 0.001;
|
|
3028
|
+
case 'miles':
|
|
3029
|
+
return 1 / 1609.344; // Meters in Miles
|
|
3030
|
+
case 'nauticalmiles':
|
|
3031
|
+
return 1 / 1852; // Meters in Nautical Miles
|
|
3032
|
+
case 'inches':
|
|
3033
|
+
return 39.3701; // Meters in Inches
|
|
3034
|
+
case 'yards':
|
|
3035
|
+
return 1.09361; // Meters in Yards
|
|
3036
|
+
case 'feet':
|
|
3037
|
+
return 3.28084; // Meters in Feet
|
|
3038
|
+
// case 'acres':
|
|
3039
|
+
// return 1 / 4046.8564224; // Square meters in an acre
|
|
3040
|
+
// case 'hectares':
|
|
3041
|
+
// return 1 / 10000; // Square meters in a hectare
|
|
3042
|
+
default:
|
|
3043
|
+
return 1;
|
|
3044
|
+
}
|
|
3018
3045
|
}
|
|
3019
|
-
function
|
|
3020
|
-
|
|
3046
|
+
function unitLabel(unit) {
|
|
3047
|
+
switch (unit) {
|
|
3048
|
+
case 'miles':
|
|
3049
|
+
return 'mi';
|
|
3050
|
+
case 'acres':
|
|
3051
|
+
return 'ac';
|
|
3052
|
+
case 'kilometers':
|
|
3053
|
+
return 'km';
|
|
3054
|
+
case 'meters':
|
|
3055
|
+
return 'm';
|
|
3056
|
+
case 'millimeters':
|
|
3057
|
+
return 'mm';
|
|
3058
|
+
case 'centimeters':
|
|
3059
|
+
return 'cm';
|
|
3060
|
+
case 'nauticalmiles':
|
|
3061
|
+
return 'nm';
|
|
3062
|
+
case 'inches':
|
|
3063
|
+
return 'in';
|
|
3064
|
+
case 'yards':
|
|
3065
|
+
return 'yd';
|
|
3066
|
+
case 'feet':
|
|
3067
|
+
return 'ft';
|
|
3068
|
+
case 'hectares':
|
|
3069
|
+
return 'ha';
|
|
3070
|
+
default:
|
|
3071
|
+
return 'm';
|
|
3072
|
+
}
|
|
3021
3073
|
}
|
|
3022
3074
|
var MlMeasureTool = function (props) {
|
|
3023
3075
|
var _a = React.useState({ value: 0, label: '' }), displayValue = _a[0], setDisplayValue = _a[1];
|
|
3024
3076
|
var _b = React.useState([]), currentFeatures = _b[0], setCurrentFeatures = _b[1];
|
|
3025
3077
|
React.useEffect(function () {
|
|
3026
3078
|
if (currentFeatures[0]) {
|
|
3027
|
-
var result =
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3079
|
+
var result = 0;
|
|
3080
|
+
if (props.measureType === 'polygon') {
|
|
3081
|
+
// Calculate area in square meters
|
|
3082
|
+
result = turf__namespace.area(currentFeatures[0]);
|
|
3083
|
+
// Convert area depending on the unit (square meters -> selected area unit)
|
|
3084
|
+
if (props.unit) {
|
|
3085
|
+
var unit = props.unit;
|
|
3086
|
+
if (unit === 'acres') {
|
|
3087
|
+
result = result / 4046.8564224;
|
|
3088
|
+
}
|
|
3089
|
+
else if (unit === 'hectares') {
|
|
3090
|
+
result = result / 10000;
|
|
3091
|
+
}
|
|
3092
|
+
else {
|
|
3093
|
+
result = result * Math.pow(unitMultiplier(props.unit), 2);
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
else {
|
|
3098
|
+
result = turf__namespace.length(currentFeatures[0], { units: props.unit });
|
|
3099
|
+
}
|
|
3032
3100
|
if (typeof props.onChange === 'function') {
|
|
3033
3101
|
props.onChange({ value: result, unit: props.unit, geojson: currentFeatures[0] });
|
|
3034
3102
|
}
|
|
3035
3103
|
if (result >= 0.1) {
|
|
3036
|
-
setDisplayValue({ value: result, label:
|
|
3037
|
-
}
|
|
3038
|
-
else {
|
|
3039
|
-
var label = 'm';
|
|
3040
|
-
var value = result * 1000;
|
|
3041
|
-
if (props.measureType === 'polygon') {
|
|
3042
|
-
value = result * 1000000;
|
|
3043
|
-
}
|
|
3044
|
-
if (getUnitLabel(props.unit) === 'mi') {
|
|
3045
|
-
label = 'Yard';
|
|
3046
|
-
value = result * 1760;
|
|
3047
|
-
if (props.measureType === 'polygon') {
|
|
3048
|
-
value = result * 3097600;
|
|
3049
|
-
}
|
|
3050
|
-
}
|
|
3051
|
-
setDisplayValue({ value: value, label: label });
|
|
3104
|
+
setDisplayValue({ value: result, label: unitLabel(props.unit) });
|
|
3052
3105
|
}
|
|
3053
3106
|
}
|
|
3054
3107
|
}, [props.unit, currentFeatures]);
|
|
@@ -3056,35 +3109,41 @@ var MlMeasureTool = function (props) {
|
|
|
3056
3109
|
React.createElement(MlFeatureEditor, { onChange: function (features) {
|
|
3057
3110
|
features && setCurrentFeatures(features);
|
|
3058
3111
|
}, mode: props.measureType === 'polygon' ? 'draw_polygon' : 'draw_line_string', onFinish: props.onFinish }),
|
|
3059
|
-
displayValue.value.
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3112
|
+
displayValue.value.toLocaleString('de-DE', {
|
|
3113
|
+
minimumFractionDigits: 2,
|
|
3114
|
+
maximumFractionDigits: 2,
|
|
3115
|
+
}),
|
|
3116
|
+
' ',
|
|
3117
|
+
unitLabel(props.unit),
|
|
3118
|
+
displayValue.label &&
|
|
3119
|
+
props.measureType === 'polygon' &&
|
|
3120
|
+
!['hectares', 'acres'].includes(props.unit || '')
|
|
3121
|
+
? ' ²'
|
|
3122
|
+
: ''));
|
|
3064
3123
|
};
|
|
3065
3124
|
MlMeasureTool.defaultProps = {
|
|
3066
3125
|
mapId: undefined,
|
|
3067
3126
|
measureType: 'line',
|
|
3068
|
-
unit: '
|
|
3127
|
+
unit: 'meters',
|
|
3069
3128
|
};
|
|
3070
3129
|
|
|
3071
|
-
var ListStyled$
|
|
3130
|
+
var ListStyled$3 = material.styled(material.List)({
|
|
3072
3131
|
marginTop: '15px',
|
|
3073
3132
|
});
|
|
3074
3133
|
function LayerList(props) {
|
|
3075
|
-
return React.createElement(ListStyled$
|
|
3134
|
+
return React.createElement(ListStyled$3, null, props === null || props === void 0 ? void 0 : props.children);
|
|
3076
3135
|
}
|
|
3077
3136
|
|
|
3078
|
-
var ListItemStyled$
|
|
3137
|
+
var ListItemStyled$2 = system.styled(material.ListItem)({
|
|
3079
3138
|
paddingRight: 0,
|
|
3080
3139
|
paddingLeft: 0,
|
|
3081
3140
|
paddingTop: 0,
|
|
3082
3141
|
paddingBottom: '4px',
|
|
3083
3142
|
});
|
|
3084
|
-
var ListItemIconStyled = system.styled(material.ListItemIcon)({
|
|
3143
|
+
var ListItemIconStyled$1 = system.styled(material.ListItemIcon)({
|
|
3085
3144
|
minWidth: '30px',
|
|
3086
3145
|
});
|
|
3087
|
-
var IconButtonStyled$
|
|
3146
|
+
var IconButtonStyled$2 = system.styled(material.IconButton)({
|
|
3088
3147
|
marginRight: '0px',
|
|
3089
3148
|
padding: '0px',
|
|
3090
3149
|
});
|
|
@@ -3092,13 +3151,13 @@ var CheckboxStyled$1 = system.styled(material.Checkbox)({
|
|
|
3092
3151
|
padding: 0,
|
|
3093
3152
|
marginRight: '5px',
|
|
3094
3153
|
});
|
|
3095
|
-
var BoxStyled$
|
|
3154
|
+
var BoxStyled$4 = system.styled(system.Box)(function (_a) {
|
|
3096
3155
|
var open = _a.open;
|
|
3097
3156
|
return ({
|
|
3098
3157
|
display: open ? 'block' : 'none',
|
|
3099
3158
|
});
|
|
3100
3159
|
});
|
|
3101
|
-
var ListStyled = system.styled(material.List)({
|
|
3160
|
+
var ListStyled$2 = system.styled(material.List)({
|
|
3102
3161
|
marginLeft: '50px',
|
|
3103
3162
|
});
|
|
3104
3163
|
function LayerListFolder(_a) {
|
|
@@ -3127,9 +3186,9 @@ function LayerListFolder(_a) {
|
|
|
3127
3186
|
return React.createElement(React.Fragment, null);
|
|
3128
3187
|
}, [_visible]);
|
|
3129
3188
|
return (React.createElement(React.Fragment, null,
|
|
3130
|
-
React.createElement(ListItemStyled$
|
|
3131
|
-
React.createElement(ListItemIconStyled, null,
|
|
3132
|
-
React.createElement(IconButtonStyled$
|
|
3189
|
+
React.createElement(ListItemStyled$2, null,
|
|
3190
|
+
React.createElement(ListItemIconStyled$1, null,
|
|
3191
|
+
React.createElement(IconButtonStyled$2, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React.createElement(iconsMaterial.ExpandMore, null) : React.createElement(iconsMaterial.KeyboardArrowRight, null)),
|
|
3133
3192
|
React.createElement(CheckboxStyled$1, { disabled: setVisible ? false : !visible, checked: setVisible ? visible : localVisible, onClick: function () {
|
|
3134
3193
|
if (setVisible) {
|
|
3135
3194
|
setVisible(function (val) { return !val; });
|
|
@@ -3139,8 +3198,8 @@ function LayerListFolder(_a) {
|
|
|
3139
3198
|
}
|
|
3140
3199
|
} })),
|
|
3141
3200
|
React.createElement(material.ListItemText, { primary: name, variant: "layerlist" })),
|
|
3142
|
-
React.createElement(BoxStyled$
|
|
3143
|
-
React.createElement(ListStyled, { disablePadding: true }, _children))));
|
|
3201
|
+
React.createElement(BoxStyled$4, { open: open },
|
|
3202
|
+
React.createElement(ListStyled$2, { disablePadding: true }, _children))));
|
|
3144
3203
|
}
|
|
3145
3204
|
|
|
3146
3205
|
var converters = {
|
|
@@ -3154,7 +3213,7 @@ var converters = {
|
|
|
3154
3213
|
var ColorPicker = function (_a) {
|
|
3155
3214
|
var convert = _a.convert, props = __rest(_a, ["convert"]);
|
|
3156
3215
|
var _b = React.useState(false), showPicker = _b[0], setShowPicker = _b[1];
|
|
3157
|
-
var
|
|
3216
|
+
var value = (props === null || props === void 0 ? void 0 : props.value) || '';
|
|
3158
3217
|
return (React.createElement(React.Fragment, null,
|
|
3159
3218
|
React.createElement(material.Grid, { container: true, sx: { flexWrap: 'nowrap' } },
|
|
3160
3219
|
React.createElement(material.Grid, { xs: 12, item: true },
|
|
@@ -3181,7 +3240,6 @@ var ColorPicker = function (_a) {
|
|
|
3181
3240
|
React.createElement(reactColor.ChromePicker, { color: value, onChange: function (c) {
|
|
3182
3241
|
var _a;
|
|
3183
3242
|
var newValue = converters[convert](c);
|
|
3184
|
-
setValue(newValue);
|
|
3185
3243
|
(_a = props === null || props === void 0 ? void 0 : props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, newValue);
|
|
3186
3244
|
} }))))));
|
|
3187
3245
|
};
|
|
@@ -3191,7 +3249,7 @@ ColorPicker.defaultProps = {
|
|
|
3191
3249
|
name: 'color',
|
|
3192
3250
|
};
|
|
3193
3251
|
|
|
3194
|
-
function PaintPropsColorPicker(_a) {
|
|
3252
|
+
function PaintPropsColorPicker$1(_a) {
|
|
3195
3253
|
var propKey = _a.propKey, value = _a.value, setPaintProps = _a.setPaintProps;
|
|
3196
3254
|
return (React.createElement(ColorPicker, { value: value, label: "Color", onChange: function (value) {
|
|
3197
3255
|
setPaintProps(function (current) {
|
|
@@ -3202,7 +3260,7 @@ function PaintPropsColorPicker(_a) {
|
|
|
3202
3260
|
} }));
|
|
3203
3261
|
}
|
|
3204
3262
|
|
|
3205
|
-
var PaperStyled = material.styled(material.Paper)({
|
|
3263
|
+
var PaperStyled$1 = material.styled(material.Paper)({
|
|
3206
3264
|
marginLeft: '-100px',
|
|
3207
3265
|
marginRight: '-21px',
|
|
3208
3266
|
paddingLeft: '53px',
|
|
@@ -3210,10 +3268,10 @@ var PaperStyled = material.styled(material.Paper)({
|
|
|
3210
3268
|
boxShadow: 'none',
|
|
3211
3269
|
backgroundColor: 'rgb(0, 0, 0, 0)',
|
|
3212
3270
|
});
|
|
3213
|
-
var BoxStyled$
|
|
3271
|
+
var BoxStyled$3 = material.styled(material.Box)({
|
|
3214
3272
|
marginLeft: '61px',
|
|
3215
3273
|
});
|
|
3216
|
-
var mapPropKeyToFormInputType = {
|
|
3274
|
+
var mapPropKeyToFormInputType$1 = {
|
|
3217
3275
|
'circle-color': 'colorpicker',
|
|
3218
3276
|
'circle-radius': 'slider',
|
|
3219
3277
|
'circle-stroke-color': 'colorpicker',
|
|
@@ -3224,8 +3282,8 @@ var mapPropKeyToFormInputType = {
|
|
|
3224
3282
|
'line-width': 'slider',
|
|
3225
3283
|
'line-blur': 'slider',
|
|
3226
3284
|
};
|
|
3227
|
-
var mapPropKeyToFormInputTypeKeys = Object.keys(mapPropKeyToFormInputType);
|
|
3228
|
-
var inputPropsByPropKey = {
|
|
3285
|
+
var mapPropKeyToFormInputTypeKeys$1 = Object.keys(mapPropKeyToFormInputType$1);
|
|
3286
|
+
var inputPropsByPropKey$1 = {
|
|
3229
3287
|
'circle-stroke-width': {
|
|
3230
3288
|
step: 1,
|
|
3231
3289
|
min: 1,
|
|
@@ -3247,18 +3305,18 @@ var inputPropsByPropKey = {
|
|
|
3247
3305
|
max: 100,
|
|
3248
3306
|
},
|
|
3249
3307
|
};
|
|
3250
|
-
function LayerPropertyForm(_a) {
|
|
3308
|
+
function LayerPropertyForm$1(_a) {
|
|
3251
3309
|
var _b = _a.paintProps, paintProps = _b === void 0 ? {} : _b, setPaintProps = _a.setPaintProps;
|
|
3252
3310
|
var key = React.useRef(Math.round(Math.random() * 10000000000));
|
|
3253
3311
|
var getFormInputByType = React.useCallback(function (key) {
|
|
3254
|
-
if (mapPropKeyToFormInputTypeKeys.indexOf(key) !== -1 &&
|
|
3312
|
+
if (mapPropKeyToFormInputTypeKeys$1.indexOf(key) !== -1 &&
|
|
3255
3313
|
(typeof paintProps[key] === 'number' || typeof paintProps[key] === 'string')) {
|
|
3256
3314
|
var label = (React.createElement(material.Typography, { id: key + '_label', gutterBottom: true }, key));
|
|
3257
|
-
switch (mapPropKeyToFormInputType[key]) {
|
|
3315
|
+
switch (mapPropKeyToFormInputType$1[key]) {
|
|
3258
3316
|
case 'slider':
|
|
3259
3317
|
return (React.createElement(React.Fragment, { key: key },
|
|
3260
3318
|
label,
|
|
3261
|
-
React.createElement(material.Slider, __assign({}, inputPropsByPropKey[key], { inputProps: { inputMode: 'decimal', pattern: '[0-9]*' }, value: paintProps[key], valueLabelDisplay: "auto", onChange: function (_ev, value) {
|
|
3319
|
+
React.createElement(material.Slider, __assign({}, inputPropsByPropKey$1[key], { inputProps: { inputMode: 'decimal', pattern: '[0-9]*' }, value: paintProps[key], valueLabelDisplay: "auto", onChange: function (_ev, value) {
|
|
3262
3320
|
if (value) {
|
|
3263
3321
|
setPaintProps(function (current) {
|
|
3264
3322
|
var _a;
|
|
@@ -3282,24 +3340,24 @@ function LayerPropertyForm(_a) {
|
|
|
3282
3340
|
return (React.createElement(React.Fragment, { key: key },
|
|
3283
3341
|
label,
|
|
3284
3342
|
React.createElement(material.Box, { sx: { '& > div': { width: 'initial !important' } } },
|
|
3285
|
-
React.createElement(PaintPropsColorPicker, { key: key, value: paintProps[key], propKey: key, setPaintProps: setPaintProps }))));
|
|
3343
|
+
React.createElement(PaintPropsColorPicker$1, { key: key, value: paintProps[key], propKey: key, setPaintProps: setPaintProps }))));
|
|
3286
3344
|
}
|
|
3287
3345
|
}
|
|
3288
3346
|
return null;
|
|
3289
3347
|
}, [paintProps]);
|
|
3290
3348
|
return (React.createElement(React.Fragment, null,
|
|
3291
|
-
React.createElement(PaperStyled, null,
|
|
3349
|
+
React.createElement(PaperStyled$1, null,
|
|
3292
3350
|
React.createElement(material.ListItem, { key: key + '_paintPropForm' },
|
|
3293
|
-
React.createElement(BoxStyled$
|
|
3351
|
+
React.createElement(BoxStyled$3, null, Object.keys(paintProps).map(function (el) { return getFormInputByType(el); }))))));
|
|
3294
3352
|
}
|
|
3295
3353
|
|
|
3296
|
-
var ListItemStyled = material.styled(material.ListItem)(function (configurable) { return ({
|
|
3354
|
+
var ListItemStyled$1 = material.styled(material.ListItem)(function (configurable) { return ({
|
|
3297
3355
|
paddingRight: configurable ? '56px' : 0,
|
|
3298
3356
|
paddingLeft: 0,
|
|
3299
3357
|
paddingTop: 0,
|
|
3300
3358
|
paddingBottom: '4px',
|
|
3301
3359
|
}); });
|
|
3302
|
-
var TuneIconButton$
|
|
3360
|
+
var TuneIconButton$2 = material.styled(material.IconButton)({
|
|
3303
3361
|
padding: '4px',
|
|
3304
3362
|
marginTop: '-3px',
|
|
3305
3363
|
});
|
|
@@ -3344,7 +3402,7 @@ function LayerListItemVectorLayer(_a) {
|
|
|
3344
3402
|
}
|
|
3345
3403
|
}, [paintProps, id, setVtProps, vtProps]);
|
|
3346
3404
|
return (React.createElement(React.Fragment, null,
|
|
3347
|
-
React.createElement(ListItemStyled, { key: id, secondaryAction: configurable ? (React.createElement(TuneIconButton$
|
|
3405
|
+
React.createElement(ListItemStyled$1, { key: id, secondaryAction: configurable ? (React.createElement(TuneIconButton$2, { edge: "end", "aria-label": "comments", onClick: function () {
|
|
3348
3406
|
setPaintPropsFormVisible(function (current) {
|
|
3349
3407
|
return !current;
|
|
3350
3408
|
});
|
|
@@ -3355,7 +3413,7 @@ function LayerListItemVectorLayer(_a) {
|
|
|
3355
3413
|
setVisible(function (val) { return !val; });
|
|
3356
3414
|
} })),
|
|
3357
3415
|
React.createElement(material.ListItemText, { primary: vtProps.layers[id].id, variant: "layerlist" })),
|
|
3358
|
-
configurable && paintPropsFormVisible && (React.createElement(LayerPropertyForm, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: vtProps.layers[id].type }))));
|
|
3416
|
+
configurable && paintPropsFormVisible && (React.createElement(LayerPropertyForm$1, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: vtProps.layers[id].type }))));
|
|
3359
3417
|
}
|
|
3360
3418
|
LayerListItemVectorLayer.defaultProps = {
|
|
3361
3419
|
configurable: true,
|
|
@@ -3387,11 +3445,11 @@ function SortableContainer(_a) {
|
|
|
3387
3445
|
return (React.createElement("li", __assign({ ref: setNodeRef, style: style }, attributes, listeners), children));
|
|
3388
3446
|
}
|
|
3389
3447
|
|
|
3390
|
-
var TuneIconButton = material.styled(material.IconButton)({
|
|
3448
|
+
var TuneIconButton$1 = material.styled(material.IconButton)({
|
|
3391
3449
|
padding: '4px',
|
|
3392
3450
|
marginTop: '-3px',
|
|
3393
3451
|
});
|
|
3394
|
-
var DeleteIconButton = material.styled(material.IconButton)({
|
|
3452
|
+
var DeleteIconButton$1 = material.styled(material.IconButton)({
|
|
3395
3453
|
marginLeft: '20px',
|
|
3396
3454
|
});
|
|
3397
3455
|
function LayerListItem(_a) {
|
|
@@ -3476,9 +3534,9 @@ function LayerListItem(_a) {
|
|
|
3476
3534
|
}
|
|
3477
3535
|
return undefined;
|
|
3478
3536
|
}, [layerComponent]);
|
|
3479
|
-
var listContent = (React.createElement(ListItemStyled, { sx: __assign({}, props.listItemSx), secondaryAction: configurable && ((_h = Object.keys(paintProps)) === null || _h === void 0 ? void 0 : _h.length) > 0 ? (React.createElement(React.Fragment, null, props === null || props === void 0 ? void 0 :
|
|
3537
|
+
var listContent = (React.createElement(ListItemStyled$1, { sx: __assign({}, props.listItemSx), secondaryAction: configurable && ((_h = Object.keys(paintProps)) === null || _h === void 0 ? void 0 : _h.length) > 0 ? (React.createElement(React.Fragment, null, props === null || props === void 0 ? void 0 :
|
|
3480
3538
|
props.buttons,
|
|
3481
|
-
React.createElement(TuneIconButton, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
3539
|
+
React.createElement(TuneIconButton$1, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
3482
3540
|
setPaintPropsFormVisible(function (current) {
|
|
3483
3541
|
return !current;
|
|
3484
3542
|
});
|
|
@@ -3498,7 +3556,7 @@ function LayerListItem(_a) {
|
|
|
3498
3556
|
configurable &&
|
|
3499
3557
|
paintPropsFormVisible && (React.createElement(React.Fragment, null,
|
|
3500
3558
|
props.showDeleteButton && (React.createElement(React.Fragment, null,
|
|
3501
|
-
React.createElement(DeleteIconButton, { edge: "end", "aria-label": "delete", onClick: function () {
|
|
3559
|
+
React.createElement(DeleteIconButton$1, { edge: "end", "aria-label": "delete", onClick: function () {
|
|
3502
3560
|
if (typeof setLayerState === 'function') {
|
|
3503
3561
|
setShowDeletionConfirmationDialog(true);
|
|
3504
3562
|
}
|
|
@@ -3513,7 +3571,7 @@ function LayerListItem(_a) {
|
|
|
3513
3571
|
}, onCancel: function () {
|
|
3514
3572
|
setShowDeletionConfirmationDialog(false);
|
|
3515
3573
|
}, title: "Delete layer", text: "Are you sure you want to delete this layer?" })))),
|
|
3516
|
-
React.createElement(LayerPropertyForm, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: layerType }))),
|
|
3574
|
+
React.createElement(LayerPropertyForm$1, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: layerType }))),
|
|
3517
3575
|
((_m = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _m === void 0 ? void 0 : _m.layers) && (React.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.createElement(LayerListItemVectorLayer, { vtProps: layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props, setVtProps: setLayerState, id: '' + idx, key: '' + idx, visibleMaster: _visible })); })))));
|
|
3518
3576
|
}
|
|
3519
3577
|
LayerListItem.defaultProps = {
|
|
@@ -3623,7 +3681,6 @@ var MlMultiMeasureTool = function (props) {
|
|
|
3623
3681
|
var _d = React.useState(), measureState = _d[0], setMeasureState = _d[1];
|
|
3624
3682
|
var _e = React.useState('kilometers'), selectedUnit = _e[0], setSelectedUnit = _e[1];
|
|
3625
3683
|
var _f = React.useState([]), measureList = _f[0], setMeasureList = _f[1];
|
|
3626
|
-
console.log(measureList);
|
|
3627
3684
|
var _g = React.useState(false), reload = _g[0], setReload = _g[1];
|
|
3628
3685
|
var unitSwitch = function () {
|
|
3629
3686
|
if (selectedUnit === 'kilometers') {
|
|
@@ -3821,7 +3878,7 @@ var SvgCompassBackground = function SvgCompassBackground(props) {
|
|
|
3821
3878
|
})));
|
|
3822
3879
|
};
|
|
3823
3880
|
|
|
3824
|
-
var BoxStyled = material.styled(material.Box)(function (_a) {
|
|
3881
|
+
var BoxStyled$2 = material.styled(material.Box)(function (_a) {
|
|
3825
3882
|
var _b;
|
|
3826
3883
|
var theme = _a.theme;
|
|
3827
3884
|
return (_b = {
|
|
@@ -3922,7 +3979,7 @@ var MlNavigationCompass = function (props) {
|
|
|
3922
3979
|
}
|
|
3923
3980
|
};
|
|
3924
3981
|
return (React.createElement(React.Fragment, null,
|
|
3925
|
-
React.createElement(BoxStyled, { sx: __assign({}, props.style) },
|
|
3982
|
+
React.createElement(BoxStyled$2, { sx: __assign({}, props.style) },
|
|
3926
3983
|
React.createElement(CompassBox, { onClick: rotate, sx: __assign({}, props.backgroundStyle) },
|
|
3927
3984
|
React.createElement(SvgCompassBackground, { style: { position: 'absolute', top: 0, left: 0 } }),
|
|
3928
3985
|
React.createElement(NeedleBox, { onClick: rotate, sx: __assign({}, props.needleStyle) },
|
|
@@ -3972,7 +4029,7 @@ var MlNavigationTools = function (props) {
|
|
|
3972
4029
|
var targetPitch = mapHook.map.getPitch() !== 0 ? 0 : 60;
|
|
3973
4030
|
mapHook.map.easeTo({ pitch: targetPitch });
|
|
3974
4031
|
}, [mapHook.map]);
|
|
3975
|
-
return (React.createElement(Box, { sx: __assign(__assign({ zIndex: 501, position: 'absolute', display: 'flex', flexDirection: 'column', right: mediaIsMobile ? '15px' : '25px', bottom: mediaIsMobile ? '20px' : '
|
|
4032
|
+
return (React.createElement(Box, { 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) },
|
|
3976
4033
|
React.createElement(MlNavigationCompass, null),
|
|
3977
4034
|
props.show3DButton && (React.createElement(Button, { variant: "navtools", onClick: adjustPitch }, pitch < 29 ? '3D' : '2D')),
|
|
3978
4035
|
props.showFollowGpsButton && React.createElement(MlFollowGps, null),
|
|
@@ -5775,6 +5832,75 @@ var MlVectorTileLayer = function (props) {
|
|
|
5775
5832
|
return React.createElement(React.Fragment, null);
|
|
5776
5833
|
};
|
|
5777
5834
|
|
|
5835
|
+
var MlOgcApiFeatures = function (props) {
|
|
5836
|
+
var _a;
|
|
5837
|
+
var _b = React.useState(), geojson = _b[0], setGeojson = _b[1];
|
|
5838
|
+
var mapHook = useMap({ mapId: props.mapId });
|
|
5839
|
+
var layerId = React.useRef(((_a = props.mlGeoJsonLayerProps) === null || _a === void 0 ? void 0 : _a.layerId) || 'MlOgcApiFeature-' + mapHook.componentId);
|
|
5840
|
+
var buildOgcApiUrl = function () {
|
|
5841
|
+
var _a, _b;
|
|
5842
|
+
var url = new URL(props.ogcApiUrl);
|
|
5843
|
+
if (props.ogcApiFeatureParams) {
|
|
5844
|
+
Object.entries(props.ogcApiFeatureParams).forEach(function (_a) {
|
|
5845
|
+
var key = _a[0], value = _a[1];
|
|
5846
|
+
if (value !== undefined && value !== null) {
|
|
5847
|
+
url.searchParams.append(key, value.toString());
|
|
5848
|
+
}
|
|
5849
|
+
});
|
|
5850
|
+
}
|
|
5851
|
+
if (props.reloadFeaturesOnMapMove) {
|
|
5852
|
+
var southWest = (_a = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _a === void 0 ? void 0 : _a.getBounds().getSouthWest();
|
|
5853
|
+
var northEast = (_b = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _b === void 0 ? void 0 : _b.getBounds().getNorthEast();
|
|
5854
|
+
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);
|
|
5855
|
+
url.searchParams.append('bbox', bbox);
|
|
5856
|
+
}
|
|
5857
|
+
return url.toString();
|
|
5858
|
+
};
|
|
5859
|
+
React.useEffect(function () {
|
|
5860
|
+
if (!mapHook.map)
|
|
5861
|
+
return;
|
|
5862
|
+
var getDataHandler = function () {
|
|
5863
|
+
var generatedOgcApiUrl = buildOgcApiUrl();
|
|
5864
|
+
fetch(generatedOgcApiUrl)
|
|
5865
|
+
.then(function (res) {
|
|
5866
|
+
if (!res.ok)
|
|
5867
|
+
throw new Error('Error fetching OGC features');
|
|
5868
|
+
return res.json();
|
|
5869
|
+
})
|
|
5870
|
+
.then(function (data) {
|
|
5871
|
+
setGeojson(data);
|
|
5872
|
+
})
|
|
5873
|
+
.catch(function (error) {
|
|
5874
|
+
console.log(error);
|
|
5875
|
+
setGeojson(undefined);
|
|
5876
|
+
});
|
|
5877
|
+
};
|
|
5878
|
+
getDataHandler();
|
|
5879
|
+
if (props.reloadFeaturesOnMapMove) {
|
|
5880
|
+
mapHook.map.on('moveend', getDataHandler);
|
|
5881
|
+
}
|
|
5882
|
+
return function () {
|
|
5883
|
+
var _a;
|
|
5884
|
+
if ((_a = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _a === void 0 ? void 0 : _a.off) {
|
|
5885
|
+
mapHook.map.off('moveend', getDataHandler);
|
|
5886
|
+
}
|
|
5887
|
+
};
|
|
5888
|
+
}, [mapHook.map, props.ogcApiFeatureParams, props.ogcApiUrl]);
|
|
5889
|
+
React.useEffect(function () {
|
|
5890
|
+
// if layer is not yet on map return
|
|
5891
|
+
if (!mapHook.map || !mapHook.map.map.style.getLayer(layerId.current))
|
|
5892
|
+
return;
|
|
5893
|
+
// if layer is already on map: toggle layer visibility by changing the layout object's visibility property
|
|
5894
|
+
if (props.visible) {
|
|
5895
|
+
mapHook.map.map.setLayoutProperty(layerId.current, 'visibility', 'visible');
|
|
5896
|
+
}
|
|
5897
|
+
else {
|
|
5898
|
+
mapHook.map.map.setLayoutProperty(layerId.current, 'visibility', 'none');
|
|
5899
|
+
}
|
|
5900
|
+
}, [props.visible, mapHook.map]);
|
|
5901
|
+
return (React.createElement(React.Fragment, null, geojson && (React.createElement(MlGeoJsonLayer, __assign({ geojson: geojson, layerId: layerId.current }, props.mlGeoJsonLayerProps)))));
|
|
5902
|
+
};
|
|
5903
|
+
|
|
5778
5904
|
/**
|
|
5779
5905
|
* TODO: Add short & useful description
|
|
5780
5906
|
*
|
|
@@ -6148,13 +6274,13 @@ var MlWmsLoader = function (props) {
|
|
|
6148
6274
|
var unprojected = mapHook.map.unproject([ev.point.x, ev.point.y]);
|
|
6149
6275
|
var point = turf__namespace.point([unprojected.lng, unprojected.lat]);
|
|
6150
6276
|
var buffered = turf__namespace.buffer(point, 50, { units: 'meters' });
|
|
6151
|
-
var _bbox = turf__namespace.bbox(buffered);
|
|
6152
|
-
var _sw = lngLatToMeters({ lng: _bbox[0], lat: _bbox[1] });
|
|
6153
|
-
var _ne = lngLatToMeters({ lng: _bbox[2], lat: _bbox[3] });
|
|
6154
|
-
var bbox = [_sw[0], _sw[1], _ne[0], _ne[1]];
|
|
6277
|
+
var _bbox = buffered && turf__namespace.bbox(buffered);
|
|
6278
|
+
var _sw = _bbox && lngLatToMeters({ lng: _bbox[0], lat: _bbox[1] });
|
|
6279
|
+
var _ne = _bbox && lngLatToMeters({ lng: _bbox[2], lat: _bbox[3] });
|
|
6280
|
+
var bbox = _sw && _ne && [_sw[0], _sw[1], _ne[0], _ne[1]];
|
|
6155
6281
|
var _getFeatureInfoUrlParams = {
|
|
6156
6282
|
REQUEST: 'GetFeatureInfo',
|
|
6157
|
-
BBOX: bbox.join(','),
|
|
6283
|
+
BBOX: bbox === null || bbox === void 0 ? void 0 : bbox.join(','),
|
|
6158
6284
|
SERVICE: 'WMS',
|
|
6159
6285
|
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
|
|
6160
6286
|
? 'text/html'
|
|
@@ -7074,7 +7200,7 @@ var useCameraFollowPath = function (props) {
|
|
|
7074
7200
|
var speed = React.useRef(props.speed);
|
|
7075
7201
|
var timeoutId = React.useRef();
|
|
7076
7202
|
var kmPerStep = props.kmPerStep || 0.01;
|
|
7077
|
-
var routeDistance = turf__namespace.
|
|
7203
|
+
var routeDistance = turf__namespace.length(props.route);
|
|
7078
7204
|
var stepDuration = props.stepDuration || 70;
|
|
7079
7205
|
var mapHook = useMap({
|
|
7080
7206
|
mapId: props.mapId,
|
|
@@ -7663,7 +7789,7 @@ SimpleDataProvider.propTypes = {
|
|
|
7663
7789
|
children: PropTypes.node.isRequired,
|
|
7664
7790
|
};
|
|
7665
7791
|
|
|
7666
|
-
var IconButtonStyled = material.styled(material.IconButton)({
|
|
7792
|
+
var IconButtonStyled$1 = material.styled(material.IconButton)({
|
|
7667
7793
|
padding: '4px',
|
|
7668
7794
|
marginTop: '-3px',
|
|
7669
7795
|
background: 'none',
|
|
@@ -7766,15 +7892,15 @@ function LayerListItemFactory(props) {
|
|
|
7766
7892
|
switch (layer.type) {
|
|
7767
7893
|
case 'geojson':
|
|
7768
7894
|
return (React.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.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.createElement(React.Fragment, null,
|
|
7769
|
-
React.createElement(IconButtonStyled, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7895
|
+
React.createElement(IconButtonStyled$1, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7770
7896
|
layerContext.moveDown(layer.id || '');
|
|
7771
7897
|
} },
|
|
7772
7898
|
React.createElement(iconsMaterial.ArrowCircleDown, null)),
|
|
7773
|
-
React.createElement(IconButtonStyled, { disabled: idx === 0, onClick: function () {
|
|
7899
|
+
React.createElement(IconButtonStyled$1, { disabled: idx === 0, onClick: function () {
|
|
7774
7900
|
layerContext.moveUp(layer.id || '');
|
|
7775
7901
|
} },
|
|
7776
7902
|
React.createElement(iconsMaterial.ArrowCircleUp, null)),
|
|
7777
|
-
React.createElement(IconButtonStyled, { onClick: function () { return fitLayer(layer); } },
|
|
7903
|
+
React.createElement(IconButtonStyled$1, { onClick: function () { return fitLayer(layer); } },
|
|
7778
7904
|
React.createElement(iconsMaterial.CenterFocusWeak, null))), setLayerState: function (layerConfig) {
|
|
7779
7905
|
return setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7780
7906
|
var _layers = __spreadArray([], current, true);
|
|
@@ -7812,28 +7938,28 @@ function LayerListItemFactory(props) {
|
|
|
7812
7938
|
return _layers;
|
|
7813
7939
|
});
|
|
7814
7940
|
}, showDeleteButton: true, buttons: React.createElement(React.Fragment, null,
|
|
7815
|
-
React.createElement(IconButtonStyled, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7941
|
+
React.createElement(IconButtonStyled$1, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7816
7942
|
layerContext.moveDown(layer.id || '');
|
|
7817
7943
|
} },
|
|
7818
7944
|
React.createElement(iconsMaterial.ArrowCircleDown, null)),
|
|
7819
|
-
React.createElement(IconButtonStyled, { disabled: idx === 0, onClick: function () {
|
|
7945
|
+
React.createElement(IconButtonStyled$1, { disabled: idx === 0, onClick: function () {
|
|
7820
7946
|
layerContext.moveUp(layer.id || '');
|
|
7821
7947
|
} },
|
|
7822
7948
|
React.createElement(iconsMaterial.ArrowCircleUp, null)),
|
|
7823
|
-
React.createElement(IconButtonStyled, { onClick: function () { return fitLayer(layer); } },
|
|
7949
|
+
React.createElement(IconButtonStyled$1, { onClick: function () { return fitLayer(layer); } },
|
|
7824
7950
|
React.createElement(iconsMaterial.CenterFocusWeak, null))) }))));
|
|
7825
7951
|
case 'vt':
|
|
7826
7952
|
return (React.createElement(React.Fragment, { key: (layer === null || layer === void 0 ? void 0 : layer.id) + '_listItem' },
|
|
7827
7953
|
React.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.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.createElement(React.Fragment, null,
|
|
7828
|
-
React.createElement(IconButtonStyled, { key: layer.id + '_button1', disabled: idx === layers.length - 1, onClick: function () {
|
|
7954
|
+
React.createElement(IconButtonStyled$1, { key: layer.id + '_button1', disabled: idx === layers.length - 1, onClick: function () {
|
|
7829
7955
|
layerContext.moveDown(layer.id || '');
|
|
7830
7956
|
} },
|
|
7831
7957
|
React.createElement(iconsMaterial.ArrowCircleDown, null)),
|
|
7832
|
-
React.createElement(IconButtonStyled, { key: layer.id + '_button2', disabled: idx === 0, onClick: function () {
|
|
7958
|
+
React.createElement(IconButtonStyled$1, { key: layer.id + '_button2', disabled: idx === 0, onClick: function () {
|
|
7833
7959
|
layerContext.moveUp(layer.id || '');
|
|
7834
7960
|
} },
|
|
7835
7961
|
React.createElement(iconsMaterial.ArrowCircleUp, null)),
|
|
7836
|
-
React.createElement(IconButtonStyled, { onClick: function () { return fitLayer(layer); } },
|
|
7962
|
+
React.createElement(IconButtonStyled$1, { onClick: function () { return fitLayer(layer); } },
|
|
7837
7963
|
React.createElement(iconsMaterial.CenterFocusWeak, null))), setLayerState: function (layerConfig) {
|
|
7838
7964
|
return setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7839
7965
|
var _layers = __spreadArray([], current, true);
|
|
@@ -21184,10 +21310,571 @@ SpeedDial.defaultProps = {
|
|
|
21184
21310
|
mapId: undefined,
|
|
21185
21311
|
};
|
|
21186
21312
|
|
|
21313
|
+
var _a;
|
|
21314
|
+
function processLayerOrderItems(action, items, parent) {
|
|
21315
|
+
items.forEach(function (item) {
|
|
21316
|
+
action(item, parent);
|
|
21317
|
+
if (item.layers && item.layers.length > 0) {
|
|
21318
|
+
processLayerOrderItems(action, item.layers, item);
|
|
21319
|
+
}
|
|
21320
|
+
});
|
|
21321
|
+
}
|
|
21322
|
+
var initialState = {
|
|
21323
|
+
mapConfigs: {},
|
|
21324
|
+
};
|
|
21325
|
+
//@ts-ignore
|
|
21326
|
+
var mapConfigSlice = toolkit.createSlice({
|
|
21327
|
+
name: 'mapConfig',
|
|
21328
|
+
initialState: initialState,
|
|
21329
|
+
reducers: {
|
|
21330
|
+
// Add or update a MapConfig
|
|
21331
|
+
setMapConfig: function (state, action) {
|
|
21332
|
+
var mapConfig = action.payload.mapConfig;
|
|
21333
|
+
var key = action.payload.key;
|
|
21334
|
+
//@ts-ignore
|
|
21335
|
+
state.mapConfigs[key] = mapConfig;
|
|
21336
|
+
},
|
|
21337
|
+
// Remove a MapConfig by its uuid
|
|
21338
|
+
removeMapConfig: function (state, action) {
|
|
21339
|
+
delete state.mapConfigs[action.payload.key];
|
|
21340
|
+
},
|
|
21341
|
+
// Add or update a layer within a MapConfig
|
|
21342
|
+
setLayerInMapConfig: function (state, action) {
|
|
21343
|
+
var _a = action.payload, mapConfigKey = _a.mapConfigKey, updatedLayer = _a.layer;
|
|
21344
|
+
var mapConfig = state.mapConfigs[mapConfigKey];
|
|
21345
|
+
if (mapConfig) {
|
|
21346
|
+
for (var i = 0; i < mapConfig.layers.length; i++) {
|
|
21347
|
+
if (mapConfig.layers[i].uuid === updatedLayer.uuid) {
|
|
21348
|
+
mapConfig.layers[i] = updatedLayer;
|
|
21349
|
+
break;
|
|
21350
|
+
}
|
|
21351
|
+
}
|
|
21352
|
+
}
|
|
21353
|
+
},
|
|
21354
|
+
// Remove a layer from a MapConfig
|
|
21355
|
+
removeLayerFromMapConfig: function (state, action) {
|
|
21356
|
+
var _a = action.payload, mapConfigKey = _a.mapConfigKey, layerUuid = _a.layerUuid;
|
|
21357
|
+
var mapConfig = state.mapConfigs[mapConfigKey];
|
|
21358
|
+
if (mapConfig) {
|
|
21359
|
+
var targetLayerIndex = mapConfig.layers.findIndex(function (el) { return el.uuid === layerUuid; });
|
|
21360
|
+
if (targetLayerIndex !== -1) {
|
|
21361
|
+
delete mapConfig.layers[targetLayerIndex];
|
|
21362
|
+
processLayerOrderItems(function (_, parent) {
|
|
21363
|
+
if (parent && parent.layers) {
|
|
21364
|
+
parent.layers = parent.layers.filter(function (child) { return child.uuid !== layerUuid; });
|
|
21365
|
+
}
|
|
21366
|
+
}, mapConfig.layerOrder);
|
|
21367
|
+
}
|
|
21368
|
+
}
|
|
21369
|
+
},
|
|
21370
|
+
updateLayerOrder: function (state, action) {
|
|
21371
|
+
var _a = action.payload, mapConfigKey = _a.mapConfigKey, newOrder = _a.newOrder;
|
|
21372
|
+
var mapConfig = state.mapConfigs[mapConfigKey];
|
|
21373
|
+
if (mapConfig) {
|
|
21374
|
+
mapConfig.layerOrder = newOrder;
|
|
21375
|
+
}
|
|
21376
|
+
},
|
|
21377
|
+
// masterVisible property will be applied to all children of a folder that is set to be not visible
|
|
21378
|
+
// masterVisible will over rule the actual layer config if set to false
|
|
21379
|
+
// if masterVisible is true the actual layerConfig visibility setting is respected
|
|
21380
|
+
setMasterVisible: function (state, action) {
|
|
21381
|
+
var _a;
|
|
21382
|
+
var _b = action.payload, mapConfigKey = _b.mapConfigKey, layerId = _b.layerId, masterVisible = _b.masterVisible;
|
|
21383
|
+
var mapConfig = state.mapConfigs[mapConfigKey];
|
|
21384
|
+
if (mapConfig) {
|
|
21385
|
+
var targetLayerIndex = mapConfig.layers.findIndex(function (el) { return el.uuid === layerId; });
|
|
21386
|
+
if (targetLayerIndex !== -1) {
|
|
21387
|
+
var layerConfig = mapConfig.layers[targetLayerIndex];
|
|
21388
|
+
if (layerConfig) {
|
|
21389
|
+
var updatedLayers_1 = __spreadArray([], mapConfig.layers, true);
|
|
21390
|
+
if (layerConfig.type === 'folder') {
|
|
21391
|
+
mapConfig.layerOrder.forEach(function (folder) {
|
|
21392
|
+
var _a;
|
|
21393
|
+
if (folder.uuid === layerId) {
|
|
21394
|
+
(_a = folder.layers) === null || _a === void 0 ? void 0 : _a.forEach(function (childUuid) {
|
|
21395
|
+
var _a;
|
|
21396
|
+
var childLayerIndex = mapConfig.layers.findIndex(function (el) { return el.uuid === childUuid.uuid; });
|
|
21397
|
+
var childLayer = updatedLayers_1[childLayerIndex];
|
|
21398
|
+
updatedLayers_1[childLayerIndex] = __assign(__assign({}, childLayer), { masterVisible: masterVisible });
|
|
21399
|
+
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)) {
|
|
21400
|
+
childLayer.config.layers = childLayer.config.layers.map(function (layer) { return (__assign(__assign({}, layer), { masterVisible: masterVisible })); });
|
|
21401
|
+
}
|
|
21402
|
+
});
|
|
21403
|
+
}
|
|
21404
|
+
});
|
|
21405
|
+
}
|
|
21406
|
+
if (layerConfig.type === 'vt' && ((_a = layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.config) === null || _a === void 0 ? void 0 : _a.layers)) {
|
|
21407
|
+
layerConfig.config.layers = layerConfig.config.layers.map(function (layer) { return (__assign(__assign({}, layer), { masterVisible: masterVisible })); });
|
|
21408
|
+
}
|
|
21409
|
+
state.mapConfigs[mapConfigKey].layers = updatedLayers_1;
|
|
21410
|
+
}
|
|
21411
|
+
}
|
|
21412
|
+
}
|
|
21413
|
+
},
|
|
21414
|
+
},
|
|
21415
|
+
});
|
|
21416
|
+
var getLayerByUuid = function (state, uuid) {
|
|
21417
|
+
var mapConfigs = state.mapConfigs;
|
|
21418
|
+
for (var key in mapConfigs) {
|
|
21419
|
+
var mapConfig = mapConfigs[key];
|
|
21420
|
+
var targetLayerIndex = mapConfig.layers.findIndex(function (el) { return el.uuid === uuid; });
|
|
21421
|
+
var foundLayer = mapConfig.layers[targetLayerIndex];
|
|
21422
|
+
if (foundLayer)
|
|
21423
|
+
return foundLayer;
|
|
21424
|
+
}
|
|
21425
|
+
return null;
|
|
21426
|
+
};
|
|
21427
|
+
var extractUuidsFromLayerOrder = function (state, mapConfigKey) {
|
|
21428
|
+
var mapConfig = state.mapConfig.mapConfigs[mapConfigKey];
|
|
21429
|
+
if (!mapConfig) {
|
|
21430
|
+
return [];
|
|
21431
|
+
}
|
|
21432
|
+
var layerOrder = mapConfig.layerOrder;
|
|
21433
|
+
var uuids = [];
|
|
21434
|
+
function extractUuids(items) {
|
|
21435
|
+
items.forEach(function (item) {
|
|
21436
|
+
uuids.push(item.uuid);
|
|
21437
|
+
if (item.layers && item.layers.length > 0) {
|
|
21438
|
+
extractUuids(item.layers);
|
|
21439
|
+
}
|
|
21440
|
+
});
|
|
21441
|
+
}
|
|
21442
|
+
extractUuids(layerOrder);
|
|
21443
|
+
return uuids;
|
|
21444
|
+
};
|
|
21445
|
+
var store = toolkit.configureStore({
|
|
21446
|
+
reducer: {
|
|
21447
|
+
mapConfig: mapConfigSlice.reducer,
|
|
21448
|
+
},
|
|
21449
|
+
});
|
|
21450
|
+
var setMapConfig = (_a = mapConfigSlice.actions, _a.setMapConfig), removeMapConfig = _a.removeMapConfig, setLayerInMapConfig = _a.setLayerInMapConfig, removeLayerFromMapConfig = _a.removeLayerFromMapConfig, updateLayerOrder = _a.updateLayerOrder, setMasterVisible = _a.setMasterVisible;
|
|
21451
|
+
|
|
21452
|
+
function PaintPropsColorPicker(props) {
|
|
21453
|
+
return (React.createElement(ColorPicker, { value: props.value, label: "Color", onChange: function (value) {
|
|
21454
|
+
if (typeof props.onChange === 'function') {
|
|
21455
|
+
props.onChange(value);
|
|
21456
|
+
}
|
|
21457
|
+
} }));
|
|
21458
|
+
}
|
|
21459
|
+
|
|
21460
|
+
var PaperStyled = material.styled(material.Paper)({
|
|
21461
|
+
marginLeft: '-100px',
|
|
21462
|
+
marginRight: '-21px',
|
|
21463
|
+
paddingLeft: '53px',
|
|
21464
|
+
borderRadius: '0px',
|
|
21465
|
+
boxShadow: 'none',
|
|
21466
|
+
backgroundColor: 'rgb(0, 0, 0, 0)',
|
|
21467
|
+
});
|
|
21468
|
+
var BoxStyled$1 = material.styled(material.Box)({
|
|
21469
|
+
marginLeft: '61px',
|
|
21470
|
+
});
|
|
21471
|
+
var mapPropKeyToFormInputType = {
|
|
21472
|
+
'circle-color': 'colorpicker',
|
|
21473
|
+
'circle-radius': 'slider',
|
|
21474
|
+
'circle-stroke-color': 'colorpicker',
|
|
21475
|
+
'circle-stroke-width': 'slider',
|
|
21476
|
+
'fill-color': 'colorpicker',
|
|
21477
|
+
'fill-outline-color': 'colorpicker',
|
|
21478
|
+
'line-color': 'colorpicker',
|
|
21479
|
+
'line-width': 'slider',
|
|
21480
|
+
'line-blur': 'slider',
|
|
21481
|
+
};
|
|
21482
|
+
var mapPropKeyToFormInputTypeKeys = Object.keys(mapPropKeyToFormInputType);
|
|
21483
|
+
var inputPropsByPropKey = {
|
|
21484
|
+
'circle-stroke-width': {
|
|
21485
|
+
step: 1,
|
|
21486
|
+
min: 1,
|
|
21487
|
+
max: 20,
|
|
21488
|
+
},
|
|
21489
|
+
'circle-radius': {
|
|
21490
|
+
step: 1,
|
|
21491
|
+
min: 1,
|
|
21492
|
+
max: 100,
|
|
21493
|
+
},
|
|
21494
|
+
'line-blur': {
|
|
21495
|
+
step: 1,
|
|
21496
|
+
min: 1,
|
|
21497
|
+
max: 100,
|
|
21498
|
+
},
|
|
21499
|
+
'line-width': {
|
|
21500
|
+
step: 1,
|
|
21501
|
+
min: 1,
|
|
21502
|
+
max: 100,
|
|
21503
|
+
},
|
|
21504
|
+
};
|
|
21505
|
+
function LayerPropertyForm(props) {
|
|
21506
|
+
var _a, _b;
|
|
21507
|
+
var key = React.useRef(Math.round(Math.random() * 10000000000));
|
|
21508
|
+
var layer = getLayerByUuid(reactRedux.useSelector(function (state) { return state.mapConfig; }), props.layerUuid);
|
|
21509
|
+
var dispatch = reactRedux.useDispatch();
|
|
21510
|
+
var paintProps = React.useMemo(function () {
|
|
21511
|
+
var _a, _b, _c, _d;
|
|
21512
|
+
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) {
|
|
21513
|
+
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;
|
|
21514
|
+
}
|
|
21515
|
+
return {};
|
|
21516
|
+
}, [(_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]);
|
|
21517
|
+
var updatePaintProp = function (key, value) {
|
|
21518
|
+
var _a;
|
|
21519
|
+
var _b, _c, _d;
|
|
21520
|
+
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)) }) }) });
|
|
21521
|
+
dispatch(setLayerInMapConfig({
|
|
21522
|
+
mapConfigKey: props.mapConfigKey,
|
|
21523
|
+
layer: updatedLayer,
|
|
21524
|
+
}));
|
|
21525
|
+
};
|
|
21526
|
+
var getFormInputByType = React.useCallback(function (key) {
|
|
21527
|
+
if ((paintProps === null || paintProps === void 0 ? void 0 : paintProps[key]) &&
|
|
21528
|
+
mapPropKeyToFormInputTypeKeys.indexOf(key) !== -1 &&
|
|
21529
|
+
(typeof paintProps[key] === 'number' || typeof paintProps[key] === 'string')) {
|
|
21530
|
+
var label = (React.createElement(material.Typography, { id: key + '_label', gutterBottom: true }, key));
|
|
21531
|
+
switch (mapPropKeyToFormInputType[key]) {
|
|
21532
|
+
case 'slider':
|
|
21533
|
+
return (React.createElement(React.Fragment, { key: key },
|
|
21534
|
+
label,
|
|
21535
|
+
React.createElement(material.Slider, __assign({}, inputPropsByPropKey[key], { value: paintProps[key], valueLabelDisplay: "auto", onChange: function (_ev, value) {
|
|
21536
|
+
if (value) {
|
|
21537
|
+
updatePaintProp(key, value);
|
|
21538
|
+
}
|
|
21539
|
+
} }))));
|
|
21540
|
+
case 'numberfield':
|
|
21541
|
+
return (React.createElement(React.Fragment, { key: key },
|
|
21542
|
+
label,
|
|
21543
|
+
React.createElement(material.TextField, { inputProps: { inputMode: 'decimal', pattern: '[0-9]*' }, value: paintProps[key], onChange: function (ev) {
|
|
21544
|
+
var _a;
|
|
21545
|
+
if ((_a = ev === null || ev === void 0 ? void 0 : ev.target) === null || _a === void 0 ? void 0 : _a.value) {
|
|
21546
|
+
updatePaintProp(key, parseInt(ev.target.value));
|
|
21547
|
+
}
|
|
21548
|
+
} })));
|
|
21549
|
+
case 'colorpicker':
|
|
21550
|
+
return (React.createElement(React.Fragment, { key: key },
|
|
21551
|
+
label,
|
|
21552
|
+
React.createElement(material.Box, { sx: { '& > div': { width: 'initial !important' } } },
|
|
21553
|
+
React.createElement(PaintPropsColorPicker, { key: key, value: paintProps[key], onChange: function (value) {
|
|
21554
|
+
updatePaintProp(key, value);
|
|
21555
|
+
} }))));
|
|
21556
|
+
}
|
|
21557
|
+
}
|
|
21558
|
+
return null;
|
|
21559
|
+
}, [paintProps]);
|
|
21560
|
+
return (React.createElement(React.Fragment, null,
|
|
21561
|
+
React.createElement(PaperStyled, null,
|
|
21562
|
+
React.createElement(material.ListItem, { key: key.current + '_paintPropForm' },
|
|
21563
|
+
React.createElement(BoxStyled$1, null, paintProps &&
|
|
21564
|
+
Object.keys(paintProps).map(function (el) { return getFormInputByType(el); }))))));
|
|
21565
|
+
}
|
|
21566
|
+
|
|
21567
|
+
var TuneIconButton = material.styled(material.IconButton)({
|
|
21568
|
+
padding: '4px',
|
|
21569
|
+
marginTop: '-3px',
|
|
21570
|
+
});
|
|
21571
|
+
var DeleteIconButton = material.styled(material.IconButton)({
|
|
21572
|
+
marginLeft: '20px',
|
|
21573
|
+
});
|
|
21574
|
+
var ListItemStyled = material.styled(material.ListItem)({
|
|
21575
|
+
paddingRight: 0,
|
|
21576
|
+
paddingLeft: 0,
|
|
21577
|
+
paddingTop: 0,
|
|
21578
|
+
paddingBottom: '4px',
|
|
21579
|
+
});
|
|
21580
|
+
var ListItemIconStyled = material.styled(material.ListItemIcon)({
|
|
21581
|
+
minWidth: '30px',
|
|
21582
|
+
});
|
|
21583
|
+
var IconButtonStyled = material.styled(material.IconButton)({
|
|
21584
|
+
marginRight: '0px',
|
|
21585
|
+
padding: '0px',
|
|
21586
|
+
});
|
|
21587
|
+
var BoxStyled = material.styled(material.Box)(function (_a) {
|
|
21588
|
+
var open = _a.open;
|
|
21589
|
+
return ({
|
|
21590
|
+
display: open ? 'block' : 'none',
|
|
21591
|
+
});
|
|
21592
|
+
});
|
|
21593
|
+
var ListStyled$1 = material.styled(material.List)({
|
|
21594
|
+
marginLeft: '50px',
|
|
21595
|
+
});
|
|
21596
|
+
function LayerTreeListItem(props) {
|
|
21597
|
+
var _a = React.useState(false), paintPropsFormVisible = _a[0], setPaintPropsFormVisible = _a[1];
|
|
21598
|
+
var _b = React.useState(false), showDeletionConfirmationDialog = _b[0], setShowDeletionConfirmationDialog = _b[1];
|
|
21599
|
+
var layer = getLayerByUuid(reactRedux.useSelector(function (state) { return state.mapConfig; }), props.layerOrderConfig.uuid);
|
|
21600
|
+
var _c = React.useState(false), open = _c[0], setOpen = _c[1];
|
|
21601
|
+
var dispatch = reactRedux.useDispatch();
|
|
21602
|
+
var mapConfig = reactRedux.useSelector(function (state) { return state.mapConfig.mapConfigs[props.mapConfigKey]; });
|
|
21603
|
+
function moveLayer(uuid, getNewPos) {
|
|
21604
|
+
var newLayerOrder = JSON.parse(JSON.stringify(mapConfig.layerOrder));
|
|
21605
|
+
var findAndMove = function (layers) {
|
|
21606
|
+
var found = false;
|
|
21607
|
+
layers.forEach(function (layer, index) {
|
|
21608
|
+
if (found)
|
|
21609
|
+
return;
|
|
21610
|
+
if (layer.uuid === uuid) {
|
|
21611
|
+
var newPos = getNewPos(index);
|
|
21612
|
+
if (newPos < 0 || newPos >= layers.length) {
|
|
21613
|
+
throw new Error('New position is out of bounds');
|
|
21614
|
+
}
|
|
21615
|
+
var item = layers.splice(index, 1)[0];
|
|
21616
|
+
layers.splice(newPos, 0, item);
|
|
21617
|
+
found = true;
|
|
21618
|
+
}
|
|
21619
|
+
else if (layer.layers) {
|
|
21620
|
+
if (findAndMove(layer.layers)) {
|
|
21621
|
+
found = true;
|
|
21622
|
+
}
|
|
21623
|
+
}
|
|
21624
|
+
});
|
|
21625
|
+
return found;
|
|
21626
|
+
};
|
|
21627
|
+
findAndMove(newLayerOrder);
|
|
21628
|
+
dispatch(updateLayerOrder({ mapConfigKey: props.mapConfigKey, newOrder: newLayerOrder }));
|
|
21629
|
+
}
|
|
21630
|
+
var moveDown = function (uuid) {
|
|
21631
|
+
moveLayer(uuid, function (idx) { return idx + 1; });
|
|
21632
|
+
};
|
|
21633
|
+
var moveUp = function (uuid) {
|
|
21634
|
+
moveLayer(uuid, function (idx) { return idx - 1; });
|
|
21635
|
+
};
|
|
21636
|
+
function handleToggleVisibility(visible, specificLayerId) {
|
|
21637
|
+
if (specificLayerId === void 0) { specificLayerId = ''; }
|
|
21638
|
+
var nextVisible = !visible;
|
|
21639
|
+
if (layer) {
|
|
21640
|
+
toggleVisible(layer, nextVisible, specificLayerId);
|
|
21641
|
+
if (layer.type === 'folder' || (layer.type === 'vt' && specificLayerId === '')) {
|
|
21642
|
+
dispatch(setMasterVisible({
|
|
21643
|
+
mapConfigKey: props.mapConfigKey,
|
|
21644
|
+
layerId: layer.uuid,
|
|
21645
|
+
masterVisible: nextVisible,
|
|
21646
|
+
}));
|
|
21647
|
+
}
|
|
21648
|
+
}
|
|
21649
|
+
}
|
|
21650
|
+
function toggleVisible(layer, nextVisible, specificLayerId) {
|
|
21651
|
+
var _a, _b, _c;
|
|
21652
|
+
//TODO: update layout for all layer types
|
|
21653
|
+
var updatedLayer = __assign({}, layer);
|
|
21654
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'folder') {
|
|
21655
|
+
updatedLayer = __assign(__assign({}, layer), { visible: !layer.visible });
|
|
21656
|
+
}
|
|
21657
|
+
else {
|
|
21658
|
+
switch (layer === null || layer === void 0 ? void 0 : layer.type) {
|
|
21659
|
+
case 'geojson': {
|
|
21660
|
+
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' }) }) }) });
|
|
21661
|
+
break;
|
|
21662
|
+
}
|
|
21663
|
+
case 'vt': {
|
|
21664
|
+
var updateSublayerOnly_1 = false;
|
|
21665
|
+
var updatedSubLayers = layer.config.layers.map(function (layer) {
|
|
21666
|
+
if (layer.id === specificLayerId) {
|
|
21667
|
+
updateSublayerOnly_1 = true;
|
|
21668
|
+
return __assign(__assign({}, layer), { layout: __assign(__assign({}, layer.layout), { visibility: nextVisible ? 'visible' : 'none' }) });
|
|
21669
|
+
}
|
|
21670
|
+
return layer;
|
|
21671
|
+
});
|
|
21672
|
+
if (updateSublayerOnly_1) {
|
|
21673
|
+
updatedLayer = __assign(__assign({}, layer), { config: __assign(__assign({}, layer.config), { layers: updatedSubLayers }) });
|
|
21674
|
+
}
|
|
21675
|
+
else {
|
|
21676
|
+
updatedLayer = __assign(__assign({}, layer), { visible: nextVisible, config: __assign(__assign({}, layer.config), { layers: updatedSubLayers }) });
|
|
21677
|
+
}
|
|
21678
|
+
break;
|
|
21679
|
+
}
|
|
21680
|
+
case 'wms': {
|
|
21681
|
+
updatedLayer = __assign(__assign({}, layer), { visible: nextVisible, config: __assign(__assign({}, layer.config), { visible: nextVisible }) });
|
|
21682
|
+
break;
|
|
21683
|
+
}
|
|
21684
|
+
}
|
|
21685
|
+
}
|
|
21686
|
+
dispatch(setLayerInMapConfig({
|
|
21687
|
+
mapConfigKey: props.mapConfigKey,
|
|
21688
|
+
layer: updatedLayer,
|
|
21689
|
+
}));
|
|
21690
|
+
return updatedLayer;
|
|
21691
|
+
}
|
|
21692
|
+
function renderLayerItem(layer) {
|
|
21693
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
21694
|
+
var visible = true;
|
|
21695
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'geojson') {
|
|
21696
|
+
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';
|
|
21697
|
+
return (React.createElement(React.Fragment, null,
|
|
21698
|
+
React.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx), secondaryAction: React.createElement(React.Fragment, null, props === null || props === void 0 ? void 0 :
|
|
21699
|
+
props.buttons,
|
|
21700
|
+
React.createElement(IconButtonStyled, { disabled: false, onClick: function () {
|
|
21701
|
+
moveDown(layer.uuid);
|
|
21702
|
+
} },
|
|
21703
|
+
React.createElement(iconsMaterial.ArrowCircleDown, null)),
|
|
21704
|
+
React.createElement(IconButtonStyled, { disabled: false, onClick: function () {
|
|
21705
|
+
moveUp(layer.uuid);
|
|
21706
|
+
} },
|
|
21707
|
+
React.createElement(iconsMaterial.ArrowCircleUp, null)),
|
|
21708
|
+
layer.configurable && (React.createElement(React.Fragment, null,
|
|
21709
|
+
React.createElement(TuneIconButton, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
21710
|
+
setPaintPropsFormVisible(function (current) {
|
|
21711
|
+
return !current;
|
|
21712
|
+
});
|
|
21713
|
+
} },
|
|
21714
|
+
React.createElement(iconsMaterial.Tune, null))))) },
|
|
21715
|
+
React.createElement(CheckboxListItemIcon, null,
|
|
21716
|
+
React.createElement(CheckboxStyled, { checked: visible, disabled: layer.masterVisible === false, onClick: function () { return handleToggleVisibility(visible); } })),
|
|
21717
|
+
React.createElement(material.ListItemText, { variant: "layerlist", primary: layer.name || '', secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } }),
|
|
21718
|
+
props.buttons),
|
|
21719
|
+
layer.configurable && paintPropsFormVisible && (React.createElement(React.Fragment, null,
|
|
21720
|
+
props.showDeleteButton && (React.createElement(React.Fragment, null,
|
|
21721
|
+
React.createElement(DeleteIconButton, { edge: "end", "aria-label": "delete", onClick: function () { } },
|
|
21722
|
+
React.createElement(iconsMaterial.Delete, null)),
|
|
21723
|
+
showDeletionConfirmationDialog && (React.createElement(ConfirmDialog, { open: showDeletionConfirmationDialog, onConfirm: function () {
|
|
21724
|
+
setShowDeletionConfirmationDialog(false);
|
|
21725
|
+
}, onCancel: function () {
|
|
21726
|
+
setShowDeletionConfirmationDialog(false);
|
|
21727
|
+
}, title: "Delete layer", text: "Are you sure you want to delete this layer?" })))),
|
|
21728
|
+
React.createElement(LayerPropertyForm, { layerUuid: layer.uuid, mapConfigKey: props.mapConfigKey })))));
|
|
21729
|
+
}
|
|
21730
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'vt') {
|
|
21731
|
+
return (React.createElement(React.Fragment, null,
|
|
21732
|
+
React.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx), secondaryAction: undefined },
|
|
21733
|
+
React.createElement(ListItemIconStyled, null,
|
|
21734
|
+
React.createElement(IconButtonStyled, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React.createElement(iconsMaterial.ExpandMore, null) : React.createElement(iconsMaterial.KeyboardArrowRight, null)),
|
|
21735
|
+
React.createElement(CheckboxListItemIcon, null,
|
|
21736
|
+
React.createElement(CheckboxStyled, { checked: layer.visible, disabled: layer.masterVisible === false, onClick: function () { var _a; return handleToggleVisibility((_a = layer.visible) !== null && _a !== void 0 ? _a : false); } }))),
|
|
21737
|
+
React.createElement(material.ListItemText, { primary: layer.name, secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } })),
|
|
21738
|
+
React.createElement(BoxStyled, { key: layer.uuid + '_list', open: open },
|
|
21739
|
+
React.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) {
|
|
21740
|
+
var _a, _b;
|
|
21741
|
+
return (React.createElement(ListItemStyled, { key: subLayer.id, sx: __assign({}, props.listItemSx), secondaryAction: undefined },
|
|
21742
|
+
' ',
|
|
21743
|
+
React.createElement(ListItemIconStyled, null,
|
|
21744
|
+
React.createElement(CheckboxListItemIcon, null,
|
|
21745
|
+
React.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 () {
|
|
21746
|
+
var _a;
|
|
21747
|
+
return handleToggleVisibility(((_a = subLayer === null || subLayer === void 0 ? void 0 : subLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible', subLayer.id);
|
|
21748
|
+
} }))),
|
|
21749
|
+
React.createElement(material.ListItemText, { key: subLayer.id, variant: "layerlist", primary: subLayer['source-layer'], primaryTypographyProps: { overflow: 'hidden' } })));
|
|
21750
|
+
})))));
|
|
21751
|
+
}
|
|
21752
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'wms') {
|
|
21753
|
+
var visible_1 = (_g = (_f = layer.config) === null || _f === void 0 ? void 0 : _f.visible) !== null && _g !== void 0 ? _g : true;
|
|
21754
|
+
return (React.createElement(React.Fragment, null,
|
|
21755
|
+
React.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx), secondaryAction: undefined },
|
|
21756
|
+
React.createElement(CheckboxListItemIcon, null,
|
|
21757
|
+
React.createElement(CheckboxStyled, { checked: visible_1, disabled: layer.masterVisible === false, onClick: function () { return handleToggleVisibility(visible_1); } })),
|
|
21758
|
+
React.createElement(material.ListItemText, { primary: layer.name, secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } }))));
|
|
21759
|
+
}
|
|
21760
|
+
if (layer.type === 'folder') {
|
|
21761
|
+
return (React.createElement(React.Fragment, null,
|
|
21762
|
+
React.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx) },
|
|
21763
|
+
React.createElement(ListItemIconStyled, null,
|
|
21764
|
+
React.createElement(IconButtonStyled, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React.createElement(iconsMaterial.ExpandMore, null) : React.createElement(iconsMaterial.KeyboardArrowRight, null)),
|
|
21765
|
+
React.createElement(CheckboxListItemIcon, null,
|
|
21766
|
+
React.createElement(CheckboxStyled, { checked: layer.visible, disabled: layer.masterVisible, onClick: function () { return handleToggleVisibility(layer.visible ? layer.visible : false); } }))),
|
|
21767
|
+
React.createElement(material.ListItemText, { primary: layer.name, secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } })),
|
|
21768
|
+
React.createElement(BoxStyled, { key: layer.uuid + '_list', open: open },
|
|
21769
|
+
React.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.createElement(LayerTreeListItem, { layerOrderConfig: subLayer, key: subLayer.uuid, mapConfigKey: props.mapConfigKey })); })))));
|
|
21770
|
+
}
|
|
21771
|
+
else {
|
|
21772
|
+
return React.createElement(React.Fragment, null);
|
|
21773
|
+
}
|
|
21774
|
+
}
|
|
21775
|
+
return React.createElement(React.Fragment, null, layer && renderLayerItem(layer));
|
|
21776
|
+
}
|
|
21777
|
+
|
|
21778
|
+
var ListStyled = material.styled(material.List)({
|
|
21779
|
+
marginTop: '15px',
|
|
21780
|
+
});
|
|
21781
|
+
function LayerTree(props) {
|
|
21782
|
+
var _a;
|
|
21783
|
+
var layerOrder = reactRedux.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; });
|
|
21784
|
+
return (React.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.createElement(LayerTreeListItem, { key: el.uuid, layerOrderConfig: el, mapConfigKey: props.mapConfigKey })); })));
|
|
21785
|
+
}
|
|
21786
|
+
|
|
21787
|
+
function LayerOnMap(props) {
|
|
21788
|
+
var _a;
|
|
21789
|
+
var layers = reactRedux.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; });
|
|
21790
|
+
var layerStoreOrder = reactRedux.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; });
|
|
21791
|
+
var mapHook = useMap({ mapId: props === null || props === void 0 ? void 0 : props.mapId });
|
|
21792
|
+
var layerStoreOrderIds = reactRedux.useSelector(function (state) {
|
|
21793
|
+
return extractUuidsFromLayerOrder(state, props.mapConfigKey);
|
|
21794
|
+
});
|
|
21795
|
+
var previousLayerStoreOrderRef = React.useRef([]);
|
|
21796
|
+
React.useEffect(function () {
|
|
21797
|
+
if (!mapHook.map || !layerStoreOrder)
|
|
21798
|
+
return;
|
|
21799
|
+
var adjustLayerOrderAtLevel = function (layers, previousLayers, map) {
|
|
21800
|
+
for (var i = 0; i < layers.length; i++) {
|
|
21801
|
+
var currentLayer = layers[i];
|
|
21802
|
+
var previousLayer = previousLayers ? previousLayers[i] : null;
|
|
21803
|
+
if (currentLayer.uuid !== (previousLayer === null || previousLayer === void 0 ? void 0 : previousLayer.uuid)) {
|
|
21804
|
+
if (map.getLayer(currentLayer.uuid)) {
|
|
21805
|
+
var beforeLayer = i > 0 ? layers[i - 1].uuid : undefined;
|
|
21806
|
+
map.moveLayer(currentLayer.uuid, beforeLayer);
|
|
21807
|
+
}
|
|
21808
|
+
}
|
|
21809
|
+
if (currentLayer.layers && currentLayer.layers.length > 0) {
|
|
21810
|
+
var previousSubLayers = (previousLayer === null || previousLayer === void 0 ? void 0 : previousLayer.layers) || [];
|
|
21811
|
+
adjustLayerOrderAtLevel(currentLayer.layers, previousSubLayers, map);
|
|
21812
|
+
}
|
|
21813
|
+
}
|
|
21814
|
+
};
|
|
21815
|
+
var previousLayerStoreOrder = previousLayerStoreOrderRef.current;
|
|
21816
|
+
adjustLayerOrderAtLevel(layerStoreOrder, previousLayerStoreOrder, mapHook.map);
|
|
21817
|
+
previousLayerStoreOrderRef.current = layerStoreOrder;
|
|
21818
|
+
}, [layerStoreOrder, mapHook.map]);
|
|
21819
|
+
var orderLayers = React.useMemo(function () {
|
|
21820
|
+
var layerIds = __spreadArray(__spreadArray([
|
|
21821
|
+
'order-background'
|
|
21822
|
+
], layerStoreOrderIds.map(function (el) { return 'layer_id_' + el; }), true), [
|
|
21823
|
+
'order-labels',
|
|
21824
|
+
], false);
|
|
21825
|
+
return layerIds;
|
|
21826
|
+
}, [layerStoreOrderIds]);
|
|
21827
|
+
function renderLayer(layer) {
|
|
21828
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
21829
|
+
var targetLayerIndex = layers.findIndex(function (el) { return el.uuid === layer.uuid; });
|
|
21830
|
+
var layerConfig = layers[targetLayerIndex];
|
|
21831
|
+
switch (layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.type) {
|
|
21832
|
+
case 'geojson':
|
|
21833
|
+
return (React.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
|
|
21834
|
+
? 'none'
|
|
21835
|
+
: ((_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)
|
|
21836
|
+
? (_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
|
|
21837
|
+
: 'visible' }) }) })));
|
|
21838
|
+
case 'vt': {
|
|
21839
|
+
var l = layerConfig.config.layers.map(function (layer) {
|
|
21840
|
+
var _a;
|
|
21841
|
+
var newLayer = __assign({}, layer);
|
|
21842
|
+
if (newLayer.layout) {
|
|
21843
|
+
newLayer.layout = __assign(__assign({}, newLayer.layout), { visibility: newLayer.masterVisible === false ? 'none' : (_a = newLayer.layout.visibility) !== null && _a !== void 0 ? _a : 'visible' });
|
|
21844
|
+
}
|
|
21845
|
+
return newLayer;
|
|
21846
|
+
});
|
|
21847
|
+
return (React.createElement(MlVectorTileLayer, { key: layerConfig.uuid, layerId: layerConfig.uuid, insertBeforeLayer: 'layer_id_' + layerConfig.uuid, url: layerConfig.config.url, layers: l }));
|
|
21848
|
+
}
|
|
21849
|
+
case 'wms': {
|
|
21850
|
+
var visible = layerConfig.masterVisible === false ? false : (_j = layerConfig.config) === null || _j === void 0 ? void 0 : _j.visible;
|
|
21851
|
+
return (React.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 }));
|
|
21852
|
+
}
|
|
21853
|
+
case 'folder':
|
|
21854
|
+
return (layer === null || layer === void 0 ? void 0 : layer.layers) ? (layer.layers.map(function (subLayer) { return renderLayer(subLayer); })) : (React.createElement(React.Fragment, null));
|
|
21855
|
+
default:
|
|
21856
|
+
return null;
|
|
21857
|
+
}
|
|
21858
|
+
}
|
|
21859
|
+
return (React.createElement(React.Fragment, null,
|
|
21860
|
+
React.createElement(MlOrderLayers, { layerIds: orderLayers }), (_a = layerStoreOrder === null || layerStoreOrder === void 0 ? void 0 : layerStoreOrder.map) === null || _a === void 0 ? void 0 :
|
|
21861
|
+
_a.call(layerStoreOrder, function (layerOrderItem) { return renderLayer(layerOrderItem); })));
|
|
21862
|
+
}
|
|
21863
|
+
|
|
21864
|
+
var MapStore = {
|
|
21865
|
+
store: store,
|
|
21866
|
+
setMapConfig: setMapConfig,
|
|
21867
|
+
removeMapConfig: removeMapConfig,
|
|
21868
|
+
setLayerInMapConfig: setLayerInMapConfig,
|
|
21869
|
+
removeLayerFromMapConfig: removeLayerFromMapConfig,
|
|
21870
|
+
updateLayerOrder: updateLayerOrder,
|
|
21871
|
+
setMasterVisible: setMasterVisible,
|
|
21872
|
+
};
|
|
21873
|
+
|
|
21187
21874
|
exports.AddLayerButton = AddLayerButton;
|
|
21188
21875
|
exports.AddLayerPopup = AddLayerPopup;
|
|
21189
21876
|
exports.CSVProtocolHandler = CSVProtocolHandler;
|
|
21190
|
-
exports.ColorPicker = PaintPropsColorPicker;
|
|
21877
|
+
exports.ColorPicker = PaintPropsColorPicker$1;
|
|
21191
21878
|
exports.ConfirmDialog = ConfirmDialog;
|
|
21192
21879
|
exports.GeoJsonContext = GeoJsonContext;
|
|
21193
21880
|
exports.GeoJsonLayerForm = GeoJsonLayerForm;
|
|
@@ -21200,12 +21887,16 @@ exports.LayerListFolder = LayerListFolder;
|
|
|
21200
21887
|
exports.LayerListItem = LayerListItem;
|
|
21201
21888
|
exports.LayerListItemFactory = LayerListItemFactory;
|
|
21202
21889
|
exports.LayerListItemVectorLayer = LayerListItemVectorLayer;
|
|
21203
|
-
exports.
|
|
21890
|
+
exports.LayerOnMap = LayerOnMap;
|
|
21891
|
+
exports.LayerPropertyForm = LayerPropertyForm$1;
|
|
21892
|
+
exports.LayerTree = LayerTree;
|
|
21893
|
+
exports.LayerTreeListItem = LayerTreeListItem;
|
|
21204
21894
|
exports.LayerTypeForm = LayerTypeForm;
|
|
21205
21895
|
exports.MapComponentsProvider = MapComponentsProvider;
|
|
21206
21896
|
exports.MapContext = MapContext;
|
|
21207
21897
|
exports.MapLibreGlWrapper = MapLibreGlWrapper;
|
|
21208
21898
|
exports.MapLibreMap = MapLibreMap;
|
|
21899
|
+
exports.MapStore = MapStore;
|
|
21209
21900
|
exports.MedievalKingdomStyle = MedievalKingdomStyle;
|
|
21210
21901
|
exports.MlCenterPosition = MlCenterPosition;
|
|
21211
21902
|
exports.MlComponentTemplate = MlComponentTemplate;
|
|
@@ -21225,6 +21916,7 @@ exports.MlMeasureTool = MlMeasureTool;
|
|
|
21225
21916
|
exports.MlMultiMeasureTool = MlMultiMeasureTool;
|
|
21226
21917
|
exports.MlNavigationCompass = MlNavigationCompass;
|
|
21227
21918
|
exports.MlNavigationTools = MlNavigationTools;
|
|
21919
|
+
exports.MlOgcApiFeatures = MlOgcApiFeatures;
|
|
21228
21920
|
exports.MlOrderLayers = MlOrderLayers;
|
|
21229
21921
|
exports.MlPdfPreview = PdfPreview;
|
|
21230
21922
|
exports.MlScaleReference = MlScaleReference;
|