@opengeoweb/core 19.5.1 → 19.6.1-nightly-20260910
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/dist/index.esm.js +508 -236
- package/dist/src/lib/components/ClockConnect/OptionsMenu.d.ts +3 -3
- package/dist/src/lib/components/MapDrawToolRedux/OpenLayersFeatureLayerConnect.d.ts +27 -4
- package/dist/src/lib/components/MapViewConnect/InitialZoomToLayerConnect.d.ts +8 -0
- package/dist/src/lib/components/MapViewConnect/useGetOpenLayersView.d.ts +2 -0
- package/dist/src/lib/components/TimeSliderConnect/TimeSliderButtonsConnect/AnimationLengthPanelConnect.d.ts +5 -0
- package/dist/src/lib/components/TimeSliderConnect/TimeSliderButtonsConnect/AutoUpdateButtonConnect.d.ts +1 -1
- package/dist/src/lib/components/TimeSliderConnect/TimeSliderConnect.d.ts +2 -0
- package/dist/src/lib/index.d.ts +1 -0
- package/package.json +63 -63
package/dist/index.esm.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { FormControl, MenuItem, Grid, InputLabel, Paper, Box, Typography, CircularProgress, List, ListSubheader, ListItemButton, ListItemText, DialogContentText, TextField, InputAdornment, Button, useTheme, Tooltip, ListItem, ListItemIcon, Checkbox, Popper, Fade, styled, LinearProgress, Autocomplete, Switch, Select } from '@mui/material';
|
|
3
3
|
import React, { useMemo, useState, useCallback, useEffect, useContext } from 'react';
|
|
4
|
-
import { safelyInitI18nForTestsAndStories, sharedTranslations, SHARED_NAMESPACE, TooltipSelect, CustomIconButton, CustomDialog, CustomTooltip, ToggleMenu, AlertIcon, useConfirmationDialog, useScrollingInIsolation, sliderHeaderStyle, CustomSlider, tooltipContainerStyles, renderCounter, AlertBanner, CustomAccordion, PROJECTION, calculateStartSize, useWheelStopPropagation, ToolContainerDraggable, dateUtils, sessionStorageProvider, useDebounce, usePrevious } from '@opengeoweb/shared';
|
|
5
|
-
import { webmapUtils, queryWMSLayersTree, invalidateWMSGetCapabilities, LayerType,
|
|
4
|
+
import { safelyInitI18nForTestsAndStories, sharedTranslations, SHARED_NAMESPACE, TooltipSelect, CustomIconButton, CustomDialog, CustomTooltip, ToggleMenu, AlertIcon, useConfirmationDialog, useScrollingInIsolation, sliderHeaderStyle, CustomSlider, SearchField, SearchHighlight, tooltipContainerStyles, renderCounter, AlertBanner, CustomAccordion, PROJECTION, calculateStartSize, useWheelStopPropagation, ToolContainerDraggable, dateUtils, sessionStorageProvider, useDebounce, usePrevious } from '@opengeoweb/shared';
|
|
5
|
+
import { webmapUtils, queryWMSLayersTree, invalidateWMSGetCapabilities, LayerType, WMJSDimension, WMDefaultStyleName, queryWMSServiceInfo, queryWMSLayers, getWMSServiceId, handleDateUtilsISOString, generateLayerId, getWMLayerById, getMapDimURL, WMLayer } from '@opengeoweb/webmap';
|
|
6
6
|
import _, { isEqual, isArray, range, zip, throttle } from 'lodash';
|
|
7
7
|
import { useDispatch, useSelector, connect, useStore, shallowEqual, Provider } from 'react-redux';
|
|
8
8
|
import { mapSelectors, layerSelectors, layerActions, layerTypes, filterLayers, mapActions, mapEnums, loadingIndicatorSelectors, layerUtils, serviceSelectors, serviceActions, uiSelectors, uiTypes, useSetupDialog, getUserAddedServices, uiActions, genericActions, drawingToolSelectors, syncGroupsSelectors, syncConstants, getViewObjectForSyncGroup, getViewObjectForMapId, loadingIndicatorActions, genericSelectors, PUBLIC_WARNING_DRAW_TOOL_ID, defaultLayers, getSingularDrawtoolDrawLayerId, syncGroupsSelector, syncGroupsActions, routerUtils, mapUtils } from '@opengeoweb/store';
|
|
9
9
|
import i18n from 'i18next';
|
|
10
10
|
import { useTranslation, Trans, I18nextProvider } from 'react-i18next';
|
|
11
|
-
import { TIME_SLIDER_NAMESPACE, timesliderTranslations, defaultTimeSpan,
|
|
12
|
-
import { webmapReactTranslations, WEBMAP_REACT_NAMESPACE, webmapTranslations, WEBMAP_NAMESPACE, openLayersGetMapImageStore, LayerInfoButton, useStacCollection, useGetWMLayerInstance, useEDRGetCollectionDetails, getStacCollectionStyles, resolvePreferredStyleName, defaultEdrStyles, LayerInfoDialog, MapControlButton, MapDimensionSelect, dimensionConfig, DimensionSelectDialog, DimensionSelectButton, Clock, LegendDialog, LegendButton, MapContext, emptyGeoJSON, MapFeatureClass, setMapCenter, makeTimeList, getIsInsideAcceptanceTime, OpenLayersLayer, isGeoJSONGeometryEmpty, OpenLayersFeatureLayer, OpenLayersMapDraw, MapMeasure, useSetIntervalWhenVisible, TimeContext, OpenLayersMapView, WMSLayer, genericOpenLayersFeatureStyle, OpenLayersGetFeatureInfo, MapControls, OpenLayersZoomControl, getLayerUpdateInfo, publicLayers } from '@opengeoweb/webmap-react';
|
|
11
|
+
import { TIME_SLIDER_NAMESPACE, timesliderTranslations, defaultTimeSpan, AnimationLengthPanel, exactAnimationLength, AnimationLengthMode, isValidNowAnimationLength, isWithinAnimationStepLimit, resolveNowAnimationRange, AutoUpdateButton, BackwardForwardStepButton, NowButton, handleSetNowEvent, PlayButton, defaultTimeStep, SpeedButton, TimeSpanButton, secondsPerPxFromCanvasWidth, getNewCenterOfFixedPointZoom, TimeStepButton, OptionsMenuButton, TimeSliderButtons, TimeSliderCurrentTimeBox, TimeSliderLegend, onsetNewDateDebounced, getFilteredTime, defaultSecondsPerPx, moveSelectedTimePx, TimeSlider } from '@opengeoweb/time-slider';
|
|
12
|
+
import { webmapReactTranslations, WEBMAP_REACT_NAMESPACE, webmapTranslations, WEBMAP_NAMESPACE, openLayersGetMapImageStore, LayerInfoButton, useStacCollection, useGetWMLayerInstance, getLayerExtentForProjection, useEDRGetCollectionDetails, getStacCollectionStyles, resolvePreferredStyleName, defaultEdrStyles, LayerInfoDialog, MapControlButton, MapDimensionSelect, dimensionConfig, DimensionSelectDialog, DimensionSelectButton, Clock, LegendDialog, LegendButton, MapContext, emptyGeoJSON, MapFeatureClass, setMapCenter, makeTimeList, getIsInsideAcceptanceTime, OpenLayersLayer, isGeoJSONGeometryEmpty, calculateNewSelection, shouldExitEditModeForMultiSelect, shouldEnterEditMode, calculateBoxSelection, OpenLayersFeatureLayer, OpenLayersMapDraw, DRAWMODE, getOlFeatureKey, MapMeasure, useViewFromLayer, useSetIntervalWhenVisible, TimeContext, OpenLayersMapView, WMSLayer, genericOpenLayersFeatureStyle, OpenLayersGetFeatureInfo, MapControls, OpenLayersZoomControl, getLayerUpdateInfo, publicLayers } from '@opengeoweb/webmap-react';
|
|
13
|
+
export { getAffectedIndices } from '@opengeoweb/webmap-react';
|
|
13
14
|
import { Cached, Add, MapAdd, CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, LayersAdd, CloudLoading, ColumnCollapsed, ColumnCollapse, DragHandle as DragHandle$1, None, FastForward, AutoUpdateActive, Both, Delete, Visibility, VisibilityOff, Copy, ZoomToLayer, Overlayers, WorldMapProjection, Layers, Search, Exclamation, MyLocation, Airplane, Region, Pinned, Close, ExitDomain, LocationInfo, Measure, Options, Info, ThemeWrapper, lightTheme, FlagBritain, FlagNetherlands, FlagFinland, FlagNorway } from '@opengeoweb/theme';
|
|
14
15
|
import { ReactSortable } from 'react-sortablejs';
|
|
15
16
|
import Sortable from 'sortablejs';
|
|
16
17
|
import { Box as Box$1, Stack } from '@mui/system';
|
|
17
|
-
import { transformExtent, toLonLat, fromLonLat } from 'ol/proj';
|
|
18
18
|
import { LayerSelectButtonConnect, LayerSelectConnect, DataExplorerButtonConnect } from '@opengeoweb/layer-select';
|
|
19
19
|
import { unByKey } from 'ol/Observable';
|
|
20
20
|
import { useQuery, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
@@ -23,6 +23,7 @@ import { bbox } from '@turf/turf';
|
|
|
23
23
|
import proj4 from 'proj4';
|
|
24
24
|
import { getIntersection } from 'ol/extent';
|
|
25
25
|
import GeoJSON from 'ol/format/GeoJSON';
|
|
26
|
+
import { toLonLat, fromLonLat } from 'ol/proj';
|
|
26
27
|
import { ImageWMS } from 'ol/source';
|
|
27
28
|
import DOMPurify from 'dompurify';
|
|
28
29
|
import { snackbarTypes, snackbarActions, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
|
|
@@ -2793,7 +2794,10 @@ var DimensionSelect = function DimensionSelect(_ref) {
|
|
|
2793
2794
|
return dimension.name === selectedDimensionName;
|
|
2794
2795
|
});
|
|
2795
2796
|
var wmDimension = webmapUtils.getWMJSDimensionForLayerAndDimension(layerId || '', selectedDimension == null ? void 0 : selectedDimension.name);
|
|
2796
|
-
var generatedValues = (
|
|
2797
|
+
var generatedValues = React.useMemo(function () {
|
|
2798
|
+
var dimension = wmDimension || (selectedDimension != null && selectedDimension.values ? new WMJSDimension(selectedDimension) : undefined);
|
|
2799
|
+
return (dimension == null ? void 0 : dimension.generateAllValues()) || [];
|
|
2800
|
+
}, [selectedDimension, wmDimension]);
|
|
2797
2801
|
var dimensionNames = layerDimensions.map(function (dimension) {
|
|
2798
2802
|
return dimension.name;
|
|
2799
2803
|
});
|
|
@@ -3694,6 +3698,9 @@ var RenderLayers = function RenderLayers(_ref) {
|
|
|
3694
3698
|
isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
|
|
3695
3699
|
tooltipPrefix = _ref.tooltipPrefix,
|
|
3696
3700
|
skipLocalStyling = _ref.skipLocalStyling;
|
|
3701
|
+
var _React$useState = React.useState(''),
|
|
3702
|
+
searchFilter = _React$useState[0],
|
|
3703
|
+
setSearchFilter = _React$useState[1];
|
|
3697
3704
|
var _useCoreTranslation = useCoreTranslation(),
|
|
3698
3705
|
t = _useCoreTranslation.t;
|
|
3699
3706
|
var nonEmptyTooltipPrefix = tooltipPrefix != null ? tooltipPrefix : t('layermanager-layer') + ": ";
|
|
@@ -3713,7 +3720,25 @@ var RenderLayers = function RenderLayers(_ref) {
|
|
|
3713
3720
|
value: layer.name
|
|
3714
3721
|
};
|
|
3715
3722
|
});
|
|
3723
|
+
var filteredLayers = extendedLayers.filter(function (layer) {
|
|
3724
|
+
var _layer$title;
|
|
3725
|
+
return (_layer$title = layer.title) == null ? void 0 : _layer$title.toLowerCase().includes(searchFilter.toLowerCase());
|
|
3726
|
+
});
|
|
3716
3727
|
return jsxs(TooltipSelect, {
|
|
3728
|
+
MenuProps: {
|
|
3729
|
+
slotProps: {
|
|
3730
|
+
paper: {
|
|
3731
|
+
style: {
|
|
3732
|
+
width: '500px'
|
|
3733
|
+
}
|
|
3734
|
+
},
|
|
3735
|
+
list: {
|
|
3736
|
+
style: {
|
|
3737
|
+
padding: 0
|
|
3738
|
+
}
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
},
|
|
3717
3742
|
currentIndex: currentIndex,
|
|
3718
3743
|
disableUnderline: true,
|
|
3719
3744
|
inputProps: {
|
|
@@ -3736,19 +3761,57 @@ var RenderLayers = function RenderLayers(_ref) {
|
|
|
3736
3761
|
skipLocalStyling: skipLocalStyling,
|
|
3737
3762
|
tooltip: "" + nonEmptyTooltipPrefix + ((_extendedLayers$curre = extendedLayers[currentIndex]) == null ? void 0 : _extendedLayers$curre.title),
|
|
3738
3763
|
value: currentValue,
|
|
3739
|
-
children: [jsx(
|
|
3764
|
+
children: [jsx(Box, {
|
|
3765
|
+
ref: function ref(node) {
|
|
3766
|
+
if (node) {
|
|
3767
|
+
// focus the search field when the menu opens
|
|
3768
|
+
requestAnimationFrame(function () {
|
|
3769
|
+
var _node$querySelector;
|
|
3770
|
+
(_node$querySelector = node.querySelector('input')) == null || _node$querySelector.focus();
|
|
3771
|
+
});
|
|
3772
|
+
}
|
|
3773
|
+
},
|
|
3774
|
+
sx: {
|
|
3775
|
+
position: 'sticky',
|
|
3776
|
+
top: 0,
|
|
3777
|
+
zIndex: 1,
|
|
3778
|
+
backgroundColor: 'geowebColors.background.surface'
|
|
3779
|
+
},
|
|
3780
|
+
children: jsx(SearchField, {
|
|
3781
|
+
searchFilter: searchFilter,
|
|
3782
|
+
setSearchFilter: setSearchFilter
|
|
3783
|
+
})
|
|
3784
|
+
}), jsx(MenuItem, {
|
|
3740
3785
|
disabled: true,
|
|
3741
|
-
children: t('layermanager-layer')
|
|
3742
|
-
}),
|
|
3786
|
+
children: filteredLayers.length ? t('layermanager-layer') : t('layermanager-layer') + " - " + t('search-no-results')
|
|
3787
|
+
}), filteredLayers.map(function (layerFromServiceLayers, currentIndex) {
|
|
3743
3788
|
return jsxs(MenuItem, {
|
|
3744
3789
|
disabled: !layerFromServiceLayers.leaf,
|
|
3745
3790
|
sx: {
|
|
3746
3791
|
'& .MuiSvgIcon-root': {
|
|
3747
3792
|
marginLeft: '28px'
|
|
3748
|
-
}
|
|
3793
|
+
},
|
|
3794
|
+
gap: 1
|
|
3749
3795
|
},
|
|
3750
3796
|
value: layerFromServiceLayers.name,
|
|
3751
|
-
children: [
|
|
3797
|
+
children: [jsx(CustomTooltip, {
|
|
3798
|
+
title: layerFromServiceLayers.title,
|
|
3799
|
+
children: jsx(Box, {
|
|
3800
|
+
component: "span",
|
|
3801
|
+
sx: {
|
|
3802
|
+
display: 'block',
|
|
3803
|
+
flex: '1 1 auto',
|
|
3804
|
+
minWidth: 0,
|
|
3805
|
+
overflow: 'hidden',
|
|
3806
|
+
textOverflow: 'ellipsis',
|
|
3807
|
+
whiteSpace: 'nowrap'
|
|
3808
|
+
},
|
|
3809
|
+
children: jsx(SearchHighlight, {
|
|
3810
|
+
search: searchFilter,
|
|
3811
|
+
text: layerFromServiceLayers.title
|
|
3812
|
+
})
|
|
3813
|
+
})
|
|
3814
|
+
}), currentIndex === layers.length && jsx(AlertIcon, {
|
|
3752
3815
|
severity: "error"
|
|
3753
3816
|
})]
|
|
3754
3817
|
}, layerFromServiceLayers.name);
|
|
@@ -4449,13 +4512,12 @@ var LayerManagerMenuButtonConnect = function LayerManagerMenuButtonConnect(_ref)
|
|
|
4449
4512
|
if (!layerId || !mapSrs || !wmLayer) {
|
|
4450
4513
|
return;
|
|
4451
4514
|
}
|
|
4452
|
-
var
|
|
4453
|
-
if (
|
|
4454
|
-
var
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
top = _crs$bbox$getExtent[3];
|
|
4515
|
+
var extent = getLayerExtentForProjection(wmLayer, mapSrs);
|
|
4516
|
+
if (extent) {
|
|
4517
|
+
var left = extent[0],
|
|
4518
|
+
bottom = extent[1],
|
|
4519
|
+
right = extent[2],
|
|
4520
|
+
top = extent[3];
|
|
4459
4521
|
dispatch(mapActions.setBbox({
|
|
4460
4522
|
mapId: mapId,
|
|
4461
4523
|
srs: mapSrs,
|
|
@@ -4467,26 +4529,6 @@ var LayerManagerMenuButtonConnect = function LayerManagerMenuButtonConnect(_ref)
|
|
|
4467
4529
|
},
|
|
4468
4530
|
origin: layerTypes.LayerActionOrigin.layerManager
|
|
4469
4531
|
}));
|
|
4470
|
-
return;
|
|
4471
|
-
}
|
|
4472
|
-
var geo = wmLayer.geographicBoundingBox;
|
|
4473
|
-
if (geo) {
|
|
4474
|
-
var _transformExtent = transformExtent([parseFloat(geo.west), parseFloat(geo.south), parseFloat(geo.east), parseFloat(geo.north)], WMJSMAP_LONLAT_EPSGCODE, mapSrs),
|
|
4475
|
-
_left = _transformExtent[0],
|
|
4476
|
-
_bottom = _transformExtent[1],
|
|
4477
|
-
_right = _transformExtent[2],
|
|
4478
|
-
_top = _transformExtent[3];
|
|
4479
|
-
dispatch(mapActions.setBbox({
|
|
4480
|
-
mapId: mapId,
|
|
4481
|
-
srs: mapSrs,
|
|
4482
|
-
bbox: {
|
|
4483
|
-
left: _left,
|
|
4484
|
-
bottom: _bottom,
|
|
4485
|
-
right: _right,
|
|
4486
|
-
top: _top
|
|
4487
|
-
},
|
|
4488
|
-
origin: layerTypes.LayerActionOrigin.layerManager
|
|
4489
|
-
}));
|
|
4490
4532
|
}
|
|
4491
4533
|
}, [dispatch, layerId, mapId, mapSrs, wmLayer]);
|
|
4492
4534
|
var duplicateLayer = React.useCallback(function (_ref3) {
|
|
@@ -4517,9 +4559,9 @@ var LayerManagerMenuButtonConnect = function LayerManagerMenuButtonConnect(_ref)
|
|
|
4517
4559
|
icon: icon,
|
|
4518
4560
|
isFeatureLayer: isFeatureLayer,
|
|
4519
4561
|
isFeatureSyncLayer: isFeatureSyncLayer,
|
|
4562
|
+
isTiledStacCollection: isStacGeoTIFFLayer ? isTiledStacCollection : undefined,
|
|
4520
4563
|
layerId: layerId,
|
|
4521
4564
|
mapId: mapId,
|
|
4522
|
-
isTiledStacCollection: isStacGeoTIFFLayer ? isTiledStacCollection : undefined,
|
|
4523
4565
|
onChangeStacDataLayout: isStacGeoTIFFLayer ? changeStacDataLayout : undefined,
|
|
4524
4566
|
onLayerCopyToOtherMaps: copyLayerToOtherMaps,
|
|
4525
4567
|
onLayerDuplicate: function onLayerDuplicate() {
|
|
@@ -4621,6 +4663,9 @@ var RenderEDRLayers = function RenderEDRLayers(_ref) {
|
|
|
4621
4663
|
isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
|
|
4622
4664
|
tooltipPrefix = _ref.tooltipPrefix,
|
|
4623
4665
|
skipLocalStyling = _ref.skipLocalStyling;
|
|
4666
|
+
var _React$useState = React.useState(''),
|
|
4667
|
+
searchFilter = _React$useState[0],
|
|
4668
|
+
setSearchFilter = _React$useState[1];
|
|
4624
4669
|
var _useCoreTranslation = useCoreTranslation(),
|
|
4625
4670
|
t = _useCoreTranslation.t;
|
|
4626
4671
|
var nonEmptyTooltipPrefix = tooltipPrefix != null ? tooltipPrefix : selectedParams.length === 1 ? t('layermanager-layer') + ": " : t('layermanager-layer-multi') + ": ";
|
|
@@ -4646,6 +4691,10 @@ var RenderEDRLayers = function RenderEDRLayers(_ref) {
|
|
|
4646
4691
|
value: layer.name
|
|
4647
4692
|
};
|
|
4648
4693
|
});
|
|
4694
|
+
var filteredLayers = extendedLayers.filter(function (layer) {
|
|
4695
|
+
var _layer$title;
|
|
4696
|
+
return (_layer$title = layer.title) == null ? void 0 : _layer$title.toLowerCase().includes(searchFilter.toLowerCase());
|
|
4697
|
+
});
|
|
4649
4698
|
var edrText = t('layermanager-EDR');
|
|
4650
4699
|
var tooltipNames = currentValues.map(function (value) {
|
|
4651
4700
|
var layer = extendedLayers.find(function (layer) {
|
|
@@ -4657,6 +4706,20 @@ var RenderEDRLayers = function RenderEDRLayers(_ref) {
|
|
|
4657
4706
|
return (paramA != null ? paramA : '').localeCompare(paramB != null ? paramB : '');
|
|
4658
4707
|
}).join(', ');
|
|
4659
4708
|
return jsxs(TooltipSelect, {
|
|
4709
|
+
MenuProps: {
|
|
4710
|
+
slotProps: {
|
|
4711
|
+
paper: {
|
|
4712
|
+
style: {
|
|
4713
|
+
width: '500px'
|
|
4714
|
+
}
|
|
4715
|
+
},
|
|
4716
|
+
list: {
|
|
4717
|
+
style: {
|
|
4718
|
+
padding: 0
|
|
4719
|
+
}
|
|
4720
|
+
}
|
|
4721
|
+
}
|
|
4722
|
+
},
|
|
4660
4723
|
disableUnderline: true,
|
|
4661
4724
|
inputProps: {
|
|
4662
4725
|
SelectDisplayProps: {
|
|
@@ -4673,22 +4736,59 @@ var RenderEDRLayers = function RenderEDRLayers(_ref) {
|
|
|
4673
4736
|
skipLocalStyling: skipLocalStyling,
|
|
4674
4737
|
tooltip: tooltip,
|
|
4675
4738
|
value: currentValues,
|
|
4676
|
-
children: [jsx(
|
|
4739
|
+
children: [jsx(Box, {
|
|
4740
|
+
ref: function ref(node) {
|
|
4741
|
+
if (node) {
|
|
4742
|
+
requestAnimationFrame(function () {
|
|
4743
|
+
var _node$querySelector;
|
|
4744
|
+
(_node$querySelector = node.querySelector('input')) == null || _node$querySelector.focus();
|
|
4745
|
+
});
|
|
4746
|
+
}
|
|
4747
|
+
},
|
|
4748
|
+
sx: {
|
|
4749
|
+
position: 'sticky',
|
|
4750
|
+
top: 0,
|
|
4751
|
+
zIndex: 1,
|
|
4752
|
+
backgroundColor: 'geowebColors.background.surface'
|
|
4753
|
+
},
|
|
4754
|
+
children: jsx(SearchField, {
|
|
4755
|
+
searchFilter: searchFilter,
|
|
4756
|
+
setSearchFilter: setSearchFilter
|
|
4757
|
+
})
|
|
4758
|
+
}), jsx(MenuItem, {
|
|
4677
4759
|
disabled: true,
|
|
4678
|
-
children: t('layermanager-layer')
|
|
4679
|
-
}),
|
|
4760
|
+
children: filteredLayers.length ? t('layermanager-layer') : t('layermanager-layer') + " - " + t('search-no-results')
|
|
4761
|
+
}), filteredLayers.map(function (layerFromServiceLayers, currentIndex) {
|
|
4680
4762
|
return jsxs(MenuItem, {
|
|
4681
4763
|
disabled: !layerFromServiceLayers.leaf,
|
|
4682
4764
|
sx: {
|
|
4683
4765
|
'&.MuiMenuItem-root.Mui-selected': {
|
|
4684
4766
|
background: 'none',
|
|
4685
4767
|
color: 'geowebColors.typographyAndIcons.text'
|
|
4686
|
-
}
|
|
4768
|
+
},
|
|
4769
|
+
whiteSpace: 'pre-wrap'
|
|
4687
4770
|
},
|
|
4688
4771
|
value: layerFromServiceLayers.name,
|
|
4689
4772
|
children: [jsx(Checkbox, {
|
|
4690
4773
|
checked: currentValues.includes(layerFromServiceLayers.name)
|
|
4691
|
-
}),
|
|
4774
|
+
}), jsx(CustomTooltip, {
|
|
4775
|
+
title: layerFromServiceLayers.title,
|
|
4776
|
+
children: jsx(Box, {
|
|
4777
|
+
component: "span",
|
|
4778
|
+
sx: {
|
|
4779
|
+
display: 'block',
|
|
4780
|
+
flex: '1 1 auto',
|
|
4781
|
+
minWidth: 0,
|
|
4782
|
+
overflow: 'hidden',
|
|
4783
|
+
textOverflow: 'ellipsis',
|
|
4784
|
+
whiteSpace: 'nowrap'
|
|
4785
|
+
},
|
|
4786
|
+
children: jsx(SearchHighlight, {
|
|
4787
|
+
search: searchFilter,
|
|
4788
|
+
text: layerFromServiceLayers.title
|
|
4789
|
+
})
|
|
4790
|
+
})
|
|
4791
|
+
}), currentIndex === layers.length && jsx(AlertIcon, {
|
|
4692
4792
|
severity: "error"
|
|
4693
4793
|
})]
|
|
4694
4794
|
}, layerFromServiceLayers.name);
|
|
@@ -5932,6 +6032,7 @@ var _LayerManager = function LayerManager(_ref) {
|
|
|
5932
6032
|
"data-size": dataSize,
|
|
5933
6033
|
"data-testid": "layerManagerWindow",
|
|
5934
6034
|
dragHandleIcon: settings == null || (_settings$toolbar2 = settings.toolbar) == null || (_settings$toolbar2 = _settings$toolbar2.dragHandle) == null ? void 0 : _settings$toolbar2.icon,
|
|
6035
|
+
fixTopPosition: true,
|
|
5935
6036
|
headerSize: headerSize,
|
|
5936
6037
|
isOpen: isOpen,
|
|
5937
6038
|
minHeight: minSize.height,
|
|
@@ -6489,56 +6590,52 @@ var MultiMapMultiDimensionSelectConnect = function MultiMapMultiDimensionSelectC
|
|
|
6489
6590
|
});
|
|
6490
6591
|
};
|
|
6491
6592
|
|
|
6492
|
-
var
|
|
6593
|
+
var AnimationLengthPanelConnect = function AnimationLengthPanelConnect(_ref) {
|
|
6493
6594
|
var mapId = _ref.mapId;
|
|
6494
6595
|
var dispatch = useDispatch();
|
|
6495
6596
|
var isAnimating = useSelector(function (store) {
|
|
6496
6597
|
return mapSelectors.isAnimating(store, mapId);
|
|
6497
6598
|
});
|
|
6498
|
-
var
|
|
6499
|
-
return mapSelectors.
|
|
6599
|
+
var animationLength = useSelector(function (store) {
|
|
6600
|
+
return mapSelectors.getAnimationLength(store, mapId);
|
|
6500
6601
|
});
|
|
6501
6602
|
var _useSelector = useSelector(function (store) {
|
|
6502
6603
|
return mapSelectors.getAnimationRange(store, mapId);
|
|
6503
6604
|
}),
|
|
6504
6605
|
animationStartTime = _useSelector.animationStartTime,
|
|
6505
6606
|
animationEndTime = _useSelector.animationEndTime;
|
|
6506
|
-
var
|
|
6507
|
-
var handlechangeAnimationLength = function handlechangeAnimationLength(length) {
|
|
6508
|
-
var newStartTime = dateUtils.dateToIsoString(dateUtils.add(dateUtils.utc(animationEndTime), {
|
|
6509
|
-
minutes: -length
|
|
6510
|
-
}));
|
|
6511
|
-
dispatch(mapActions.setAnimationStartTime({
|
|
6512
|
-
mapId: mapId,
|
|
6513
|
-
animationStartTime: newStartTime || dateUtils.dateToIsoString(dateUtils.utc()),
|
|
6514
|
-
origin: mapEnums.MapActionOrigin.map
|
|
6515
|
-
}));
|
|
6516
|
-
dispatch(mapActions.setAnimationEndTime({
|
|
6517
|
-
mapId: mapId,
|
|
6518
|
-
animationEndTime: animationEndTime || dateUtils.dateToIsoString(dateUtils.utc()),
|
|
6519
|
-
origin: mapEnums.MapActionOrigin.map
|
|
6520
|
-
}));
|
|
6521
|
-
};
|
|
6522
|
-
var toggleAnimationLengthAuto = React.useCallback(function () {
|
|
6523
|
-
dispatch(mapActions.toggleAnimationLengthAuto({
|
|
6524
|
-
mapId: mapId,
|
|
6525
|
-
autoAnimationLength: true,
|
|
6526
|
-
origin: mapEnums.MapActionOrigin.map
|
|
6527
|
-
}));
|
|
6528
|
-
}, [dispatch, mapId]);
|
|
6529
|
-
var autoTimestepLayerId = useSelector(function (store) {
|
|
6607
|
+
var autoTimeStepLayerId = useSelector(function (store) {
|
|
6530
6608
|
return mapSelectors.getAutoTimeStepLayerId(store, mapId);
|
|
6531
6609
|
});
|
|
6610
|
+
var autoTimeStepLayerName = useSelector(function (store) {
|
|
6611
|
+
return autoTimeStepLayerId ? layerSelectors.getLayerTitleFromService(store, autoTimeStepLayerId) : undefined;
|
|
6612
|
+
});
|
|
6532
6613
|
var timeStepFromLayer = useSelector(function (store) {
|
|
6533
|
-
return layerSelectors.getTimeStepForLayerId(store,
|
|
6614
|
+
return layerSelectors.getTimeStepForLayerId(store, autoTimeStepLayerId);
|
|
6534
6615
|
});
|
|
6535
|
-
|
|
6536
|
-
|
|
6616
|
+
var timeStep = useSelector(function (store) {
|
|
6617
|
+
return mapSelectors.getMapTimeStep(store, mapId);
|
|
6618
|
+
});
|
|
6619
|
+
var changeAnimationLength = function changeAnimationLength(animationLength) {
|
|
6620
|
+
var followsClock = animationLength.mode === AnimationLengthMode.Now;
|
|
6621
|
+
var isUsableRange = isValidNowAnimationLength(animationLength) && isWithinAnimationStepLimit(animationLength, timeStep);
|
|
6622
|
+
var resolvedRange = followsClock && isUsableRange ? resolveNowAnimationRange(animationLength) : undefined;
|
|
6623
|
+
dispatch(mapActions.setAnimationLength(Object.assign({
|
|
6624
|
+
mapId: mapId,
|
|
6625
|
+
animationLength: animationLength
|
|
6626
|
+
}, resolvedRange, {
|
|
6627
|
+
origin: mapEnums.MapActionOrigin.map
|
|
6628
|
+
})));
|
|
6629
|
+
};
|
|
6630
|
+
return jsx(AnimationLengthPanel, {
|
|
6631
|
+
animationEndTime: animationEndTime,
|
|
6632
|
+
animationStartTime: animationStartTime,
|
|
6633
|
+
autoTimeStepLayerName: autoTimeStepLayerName,
|
|
6537
6634
|
disabled: isAnimating,
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6635
|
+
isAutoDisabled: !timeStepFromLayer,
|
|
6636
|
+
timeStep: timeStep,
|
|
6637
|
+
onChange: changeAnimationLength,
|
|
6638
|
+
setting: animationLength != null ? animationLength : exactAnimationLength
|
|
6542
6639
|
});
|
|
6543
6640
|
};
|
|
6544
6641
|
|
|
@@ -6807,42 +6904,31 @@ var _TimeStepButtonConnect = function TimeStepButtonConnect(_ref) {
|
|
|
6807
6904
|
};
|
|
6808
6905
|
|
|
6809
6906
|
var POPPER_WIDTH = 440;
|
|
6810
|
-
var
|
|
6811
|
-
var getPopperplacement = function getPopperplacement(buttonElement, mapId) {
|
|
6907
|
+
var getOptionsMenuOrientation = function getOptionsMenuOrientation(buttonElement, mapId) {
|
|
6812
6908
|
var _document$getElementB;
|
|
6813
6909
|
var button = buttonElement == null ? void 0 : buttonElement.getBoundingClientRect();
|
|
6814
6910
|
var mapWindow = (_document$getElementB = document.getElementById("mapcontainer_" + mapId)) == null ? void 0 : _document$getElementB.getBoundingClientRect();
|
|
6815
|
-
if (button
|
|
6816
|
-
|
|
6817
|
-
var popperIsOutsideWindowOnBottom = button.bottom + POPPER_LENGTH > mapWindow.bottom;
|
|
6818
|
-
var popperIsOutsideWindowOnRight = button.right + POPPER_WIDTH > mapWindow.right;
|
|
6819
|
-
if (!popperIsOutsideWindowOnLeft) {
|
|
6820
|
-
return 'left';
|
|
6821
|
-
}
|
|
6822
|
-
if (!popperIsOutsideWindowOnBottom) {
|
|
6823
|
-
return 'bottom';
|
|
6824
|
-
}
|
|
6825
|
-
if (!popperIsOutsideWindowOnRight) {
|
|
6826
|
-
return 'right';
|
|
6827
|
-
}
|
|
6828
|
-
return 'top';
|
|
6911
|
+
if (!button || !mapWindow) {
|
|
6912
|
+
return 'horizontal';
|
|
6829
6913
|
}
|
|
6830
|
-
|
|
6914
|
+
var horizontalMenuFitsInsideMap = button.right - POPPER_WIDTH >= mapWindow.left;
|
|
6915
|
+
return horizontalMenuFitsInsideMap ? 'horizontal' : 'vertical';
|
|
6831
6916
|
};
|
|
6832
6917
|
var OptionsMenu = function OptionsMenu(_ref) {
|
|
6833
6918
|
var _ref$isOpen = _ref.isOpen,
|
|
6834
6919
|
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
6835
6920
|
buttonElement = _ref.buttonElement,
|
|
6836
|
-
|
|
6921
|
+
orientation = _ref.orientation,
|
|
6837
6922
|
mapId = _ref.mapId;
|
|
6838
6923
|
if (!buttonElement) {
|
|
6839
6924
|
return null;
|
|
6840
6925
|
}
|
|
6841
|
-
var
|
|
6926
|
+
var isVertical = orientation === 'vertical';
|
|
6842
6927
|
return jsx(Popper, {
|
|
6843
6928
|
anchorEl: buttonElement,
|
|
6929
|
+
"data-testid": "clockOptionsMenu",
|
|
6844
6930
|
open: isOpen,
|
|
6845
|
-
placement:
|
|
6931
|
+
placement: "bottom-end",
|
|
6846
6932
|
sx: {
|
|
6847
6933
|
zIndex: 1002
|
|
6848
6934
|
},
|
|
@@ -6853,19 +6939,19 @@ var OptionsMenu = function OptionsMenu(_ref) {
|
|
|
6853
6939
|
spacing: 0.5,
|
|
6854
6940
|
sx: Object.assign({
|
|
6855
6941
|
padding: '8px'
|
|
6856
|
-
},
|
|
6942
|
+
}, isVertical && {
|
|
6857
6943
|
'& button': {
|
|
6858
6944
|
width: '100%!important'
|
|
6859
6945
|
}
|
|
6860
6946
|
}, {
|
|
6861
|
-
flexDirection:
|
|
6947
|
+
flexDirection: isVertical ? 'column' : 'row'
|
|
6862
6948
|
}),
|
|
6863
6949
|
children: [jsx(NowButtonConnect, {
|
|
6864
6950
|
mapId: mapId,
|
|
6865
6951
|
sourceId: mapId
|
|
6866
|
-
}), jsx(
|
|
6952
|
+
}), jsx(AnimationLengthPanelConnect, {
|
|
6867
6953
|
mapId: mapId
|
|
6868
|
-
}), jsx(
|
|
6954
|
+
}), jsx(TimeSpanButtonConnect, {
|
|
6869
6955
|
mapId: mapId
|
|
6870
6956
|
}), jsx(_TimeStepButtonConnect, {
|
|
6871
6957
|
mapId: mapId
|
|
@@ -6893,9 +6979,9 @@ var ClockConnect = function ClockConnect(_ref) {
|
|
|
6893
6979
|
var _useState = useState(null),
|
|
6894
6980
|
popperButtonElement = _useState[0],
|
|
6895
6981
|
setPopperButtonElement = _useState[1];
|
|
6896
|
-
var _useState2 = useState('
|
|
6897
|
-
|
|
6898
|
-
|
|
6982
|
+
var _useState2 = useState('horizontal'),
|
|
6983
|
+
optionsMenuOrientation = _useState2[0],
|
|
6984
|
+
setOptionsMenuOrientation = _useState2[1];
|
|
6899
6985
|
var selectedTime = useSelector(function (store) {
|
|
6900
6986
|
return mapSelectors.getSelectedTime(store, mapId);
|
|
6901
6987
|
});
|
|
@@ -6912,9 +6998,8 @@ var ClockConnect = function ClockConnect(_ref) {
|
|
|
6912
6998
|
return mapSelectors.getIsClockOptionsMenuVisible(store, mapId);
|
|
6913
6999
|
});
|
|
6914
7000
|
useEffect(function () {
|
|
6915
|
-
// Update optionsMenu placement when visiblity or clock position/size changes
|
|
6916
7001
|
if (popperButtonElement) {
|
|
6917
|
-
|
|
7002
|
+
setOptionsMenuOrientation(getOptionsMenuOrientation(popperButtonElement, mapId));
|
|
6918
7003
|
}
|
|
6919
7004
|
}, [mapId, isOptionsMenuVisible, clockPosition, clockSize, popperButtonElement]);
|
|
6920
7005
|
var onToggleClock = function onToggleClock(isClockVisible) {
|
|
@@ -6961,7 +7046,7 @@ var ClockConnect = function ClockConnect(_ref) {
|
|
|
6961
7046
|
buttonElement: popperButtonElement,
|
|
6962
7047
|
isOpen: isOptionsMenuVisible,
|
|
6963
7048
|
mapId: mapId,
|
|
6964
|
-
|
|
7049
|
+
orientation: optionsMenuOrientation
|
|
6965
7050
|
})]
|
|
6966
7051
|
});
|
|
6967
7052
|
};
|
|
@@ -6981,15 +7066,16 @@ var LegendConnectComponent = function LegendConnectComponent(_ref) {
|
|
|
6981
7066
|
var mapIdStore = useSelector(function (store) {
|
|
6982
7067
|
return uiSelectors.getDialogMapId(store, legendType);
|
|
6983
7068
|
});
|
|
6984
|
-
var
|
|
6985
|
-
mapId = _React$useState[0],
|
|
6986
|
-
setMapId = _React$useState[1];
|
|
6987
|
-
React.useEffect(function () {
|
|
6988
|
-
setMapId(mapIdStore);
|
|
6989
|
-
}, [mapIdStore]);
|
|
7069
|
+
var mapId = initialMapId || mapIdStore;
|
|
6990
7070
|
var mapLayers = useSelector(function (store) {
|
|
6991
7071
|
return mapSelectors.getMapLayers(store, mapId);
|
|
6992
7072
|
});
|
|
7073
|
+
var legendPosition = useSelector(function (store) {
|
|
7074
|
+
return mapSelectors.getLegendPosition(store, mapId);
|
|
7075
|
+
});
|
|
7076
|
+
var legendSize = useSelector(function (store) {
|
|
7077
|
+
return mapSelectors.getLegendSize(store, mapId);
|
|
7078
|
+
});
|
|
6993
7079
|
var _useSetupDialog = useSetupDialog(legendType, source),
|
|
6994
7080
|
dialogOrder = _useSetupDialog.dialogOrder,
|
|
6995
7081
|
isDialogOpen = _useSetupDialog.isDialogOpen,
|
|
@@ -7013,16 +7099,42 @@ var LegendConnectComponent = function LegendConnectComponent(_ref) {
|
|
|
7013
7099
|
origin: mapEnums.MapActionOrigin.map
|
|
7014
7100
|
}));
|
|
7015
7101
|
};
|
|
7102
|
+
var onLegendDialogMove = React.useCallback(function (position, size) {
|
|
7103
|
+
dispatch(mapActions.setLegendPositionSize(Object.assign({
|
|
7104
|
+
mapId: mapId,
|
|
7105
|
+
position: {
|
|
7106
|
+
x: position.x,
|
|
7107
|
+
y: position.y
|
|
7108
|
+
}
|
|
7109
|
+
}, typeof size.width === 'number' && typeof size.height === 'number' && {
|
|
7110
|
+
size: {
|
|
7111
|
+
width: size.width,
|
|
7112
|
+
height: size.height
|
|
7113
|
+
}
|
|
7114
|
+
}, {
|
|
7115
|
+
origin: mapEnums.MapActionOrigin.map
|
|
7116
|
+
})));
|
|
7117
|
+
}, [dispatch, mapId]);
|
|
7016
7118
|
return jsx(LegendDialog, {
|
|
7017
7119
|
isOpen: isDialogOpen,
|
|
7018
7120
|
layers: mapLayers,
|
|
7019
7121
|
mapId: mapId,
|
|
7020
7122
|
onClose: onCloseDialog,
|
|
7123
|
+
onDragEnd: onLegendDialogMove,
|
|
7021
7124
|
onMouseDown: setDialogOrder,
|
|
7022
7125
|
onToggleLayerLegendVisibility: onToggleLayerLegendVisibility,
|
|
7023
7126
|
order: dialogOrder,
|
|
7024
7127
|
showMapId: showMapId,
|
|
7025
|
-
source: uiSource
|
|
7128
|
+
source: uiSource,
|
|
7129
|
+
startDraggablePosition: legendPosition != null ? legendPosition : {
|
|
7130
|
+
x: 0,
|
|
7131
|
+
y: 0
|
|
7132
|
+
},
|
|
7133
|
+
startPosition: {
|
|
7134
|
+
right: 20,
|
|
7135
|
+
top: 50
|
|
7136
|
+
},
|
|
7137
|
+
startSize: legendSize
|
|
7026
7138
|
});
|
|
7027
7139
|
};
|
|
7028
7140
|
/**
|
|
@@ -8221,9 +8333,91 @@ var OlMapViewLayerConnect = function OlMapViewLayerConnect(layerProps) {
|
|
|
8221
8333
|
}), "layer-" + (layer == null ? void 0 : layer.id));
|
|
8222
8334
|
};
|
|
8223
8335
|
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8336
|
+
/** Escape drops a multi selection only. A sole selection is kept, matching the
|
|
8337
|
+
* plain click behaviour, and edit mode keeps its own Escape handling. */
|
|
8338
|
+
var shouldDeselectAllOnEscape = function shouldDeselectAllOnEscape(selectedFeatureCount, isInEditMode, hasRegisteredDrawTool) {
|
|
8339
|
+
return hasRegisteredDrawTool && !isInEditMode && selectedFeatureCount > 1;
|
|
8340
|
+
};
|
|
8341
|
+
var useDeselectAllOnEscape = function useDeselectAllOnEscape(_ref) {
|
|
8342
|
+
var selectedFeatureCount = _ref.selectedFeatureCount,
|
|
8343
|
+
isInEditMode = _ref.isInEditMode,
|
|
8344
|
+
hasRegisteredDrawTool = _ref.hasRegisteredDrawTool,
|
|
8345
|
+
onDeselectAll = _ref.onDeselectAll;
|
|
8346
|
+
React.useEffect(function () {
|
|
8347
|
+
if (!shouldDeselectAllOnEscape(selectedFeatureCount, isInEditMode, hasRegisteredDrawTool)) {
|
|
8348
|
+
return undefined;
|
|
8349
|
+
}
|
|
8350
|
+
var onKeyDown = function onKeyDown(event) {
|
|
8351
|
+
if (event.key !== 'Escape' || document.activeElement !== document.body) {
|
|
8352
|
+
return;
|
|
8353
|
+
}
|
|
8354
|
+
onDeselectAll();
|
|
8355
|
+
};
|
|
8356
|
+
window.addEventListener('keydown', onKeyDown);
|
|
8357
|
+
return function () {
|
|
8358
|
+
return window.removeEventListener('keydown', onKeyDown);
|
|
8359
|
+
};
|
|
8360
|
+
}, [selectedFeatureCount, isInEditMode, hasRegisteredDrawTool, onDeselectAll]);
|
|
8361
|
+
};
|
|
8362
|
+
var shouldClearSelectionOnEmptyClick = function shouldClearSelectionOnEmptyClick(activeDrawToolId, hasRegisteredDrawTool) {
|
|
8363
|
+
return !activeDrawToolId && hasRegisteredDrawTool;
|
|
8364
|
+
};
|
|
8365
|
+
var isSketchInProgress = function isSketchInProgress(isInEditMode, drawMode, activeFeature) {
|
|
8366
|
+
if (!isInEditMode) {
|
|
8367
|
+
return false;
|
|
8368
|
+
}
|
|
8369
|
+
if (drawMode === DRAWMODE.SPLIT) {
|
|
8370
|
+
return true;
|
|
8371
|
+
}
|
|
8372
|
+
return Boolean(activeFeature && isGeoJSONGeometryEmpty(activeFeature));
|
|
8373
|
+
};
|
|
8374
|
+
/** Soundings and time series set their own highlight, so they must stay out of this. */
|
|
8375
|
+
var usesFeatureIdSelection = function usesFeatureIdSelection(isSelectable, hasRegisteredDrawTool) {
|
|
8376
|
+
return Boolean(isSelectable) || hasRegisteredDrawTool;
|
|
8377
|
+
};
|
|
8378
|
+
var getSelectionProperties = function getSelectionProperties(usesIdSelection, selectedFeatureIdSet, featureId) {
|
|
8379
|
+
if (!usesIdSelection) {
|
|
8380
|
+
return undefined;
|
|
8381
|
+
}
|
|
8382
|
+
var isSelected = featureId !== undefined && selectedFeatureIdSet.has(featureId);
|
|
8383
|
+
return {
|
|
8384
|
+
isSelected: isSelected,
|
|
8385
|
+
highlightSelectedFeature: isSelected
|
|
8386
|
+
};
|
|
8387
|
+
};
|
|
8388
|
+
var getClickedFeatureKey = getOlFeatureKey;
|
|
8389
|
+
var findFeatureIndexByKey = function findFeatureIndexByKey(geojson, feature) {
|
|
8390
|
+
var key = getClickedFeatureKey(feature);
|
|
8391
|
+
// -1 when the feature has no key, so an unidentifiable click never matches feature 0
|
|
8392
|
+
if (key === undefined || !geojson) {
|
|
8393
|
+
return -1;
|
|
8394
|
+
}
|
|
8395
|
+
return geojson.features.findIndex(function (feat) {
|
|
8396
|
+
return layerUtils.getFeatureSelectionKey(feat) === key;
|
|
8397
|
+
});
|
|
8398
|
+
};
|
|
8399
|
+
var getMovableSelectedFeatureIds = function getMovableSelectedFeatureIds(geojson, selectedFeatureIds) {
|
|
8400
|
+
if (!(geojson != null && geojson.features.length) || !(selectedFeatureIds != null && selectedFeatureIds.length)) {
|
|
8401
|
+
return [];
|
|
8402
|
+
}
|
|
8403
|
+
var selectedFeatureIdSet = new Set(selectedFeatureIds);
|
|
8404
|
+
return geojson.features.reduce(function (featureIds, feature) {
|
|
8405
|
+
var _feature$properties;
|
|
8406
|
+
var featureKey = layerUtils.getFeatureSelectionKey(feature);
|
|
8407
|
+
if (featureKey && selectedFeatureIdSet.has(featureKey) && ((_feature$properties = feature.properties) == null ? void 0 : _feature$properties.isReadonly) !== true) {
|
|
8408
|
+
featureIds.push(featureKey);
|
|
8409
|
+
}
|
|
8410
|
+
return featureIds;
|
|
8411
|
+
}, []);
|
|
8412
|
+
};
|
|
8413
|
+
/** Moving a set of shapes belongs to the drawing tool only: selection-only
|
|
8414
|
+
* reference layers stay selectable but must never be dragged. */
|
|
8415
|
+
var shouldEnableMultiShapeMove = function shouldEnableMultiShapeMove(hasRegisteredDrawTool, isInEditMode, selectedFeatureCount, movableFeatureCount) {
|
|
8416
|
+
return hasRegisteredDrawTool && !isInEditMode && selectedFeatureCount > 1 && movableFeatureCount > 0;
|
|
8417
|
+
};
|
|
8418
|
+
var getCurrentSelectedIndices = function getCurrentSelectedIndices(_ref2) {
|
|
8419
|
+
var geojson = _ref2.geojson,
|
|
8420
|
+
selectedFeatureIds = _ref2.selectedFeatureIds;
|
|
8227
8421
|
if (!(geojson != null && geojson.features.length) || !(selectedFeatureIds != null && selectedFeatureIds.length)) {
|
|
8228
8422
|
return [];
|
|
8229
8423
|
}
|
|
@@ -8236,46 +8430,12 @@ var getCurrentSelectedIndices = function getCurrentSelectedIndices(_ref) {
|
|
|
8236
8430
|
return indices;
|
|
8237
8431
|
}, []);
|
|
8238
8432
|
};
|
|
8239
|
-
var
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
}
|
|
8246
|
-
return [].concat(currentSelectedIndices, [clickedIndex]);
|
|
8247
|
-
}
|
|
8248
|
-
var isSoleSelection = currentSelectedIndices.length === 1 && currentSelectedIndices[0] === clickedIndex;
|
|
8249
|
-
return isSoleSelection ? [] : [clickedIndex];
|
|
8250
|
-
};
|
|
8251
|
-
var getAffectedIndices = function getAffectedIndices(oldSelection, newSelection) {
|
|
8252
|
-
var allIndices = new Set([].concat(oldSelection, newSelection));
|
|
8253
|
-
return Array.from(allIndices).filter(function (idx) {
|
|
8254
|
-
return oldSelection.includes(idx) !== newSelection.includes(idx);
|
|
8255
|
-
});
|
|
8256
|
-
};
|
|
8257
|
-
var shouldEnterEditMode = function shouldEnterEditMode(isReadonly, isShiftClick, newSelectionCount) {
|
|
8258
|
-
return !isReadonly && !isShiftClick && newSelectionCount === 1;
|
|
8259
|
-
};
|
|
8260
|
-
var updateFeatureSelectionProperties = function updateFeatureSelectionProperties(dispatch, layerId, affectedIndices, newSelection) {
|
|
8261
|
-
affectedIndices.forEach(function (idx) {
|
|
8262
|
-
var isNowSelected = newSelection.includes(idx);
|
|
8263
|
-
dispatch(layerActions.updateFeatureProperties({
|
|
8264
|
-
layerId: layerId,
|
|
8265
|
-
properties: {
|
|
8266
|
-
highlightSelectedFeature: isNowSelected,
|
|
8267
|
-
isSelected: isNowSelected
|
|
8268
|
-
},
|
|
8269
|
-
targetFeatureIndex: idx
|
|
8270
|
-
}));
|
|
8271
|
-
});
|
|
8272
|
-
};
|
|
8273
|
-
var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref2) {
|
|
8274
|
-
var layer = _ref2.layer,
|
|
8275
|
-
layerId = _ref2.layerId,
|
|
8276
|
-
zIndex = _ref2.zIndex,
|
|
8277
|
-
style = _ref2.style,
|
|
8278
|
-
hoverSelect = _ref2.hoverSelect;
|
|
8433
|
+
var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref3) {
|
|
8434
|
+
var layer = _ref3.layer,
|
|
8435
|
+
layerId = _ref3.layerId,
|
|
8436
|
+
zIndex = _ref3.zIndex,
|
|
8437
|
+
style = _ref3.style,
|
|
8438
|
+
hoverSelect = _ref3.hoverSelect;
|
|
8279
8439
|
var store = useStore();
|
|
8280
8440
|
var dispatch = useDispatch();
|
|
8281
8441
|
var activeDrawToolId = useSelector(drawingToolSelectors.getActiveDrawToolId);
|
|
@@ -8297,7 +8457,7 @@ var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref2
|
|
|
8297
8457
|
return drawingToolSelectors.getGeoJSONIntersectionBoundsLayerId(store, activeDrawToolId);
|
|
8298
8458
|
});
|
|
8299
8459
|
var activeFeatureIndex = React.useMemo(function () {
|
|
8300
|
-
var _layer$geojson, _currentSelectedFeatu,
|
|
8460
|
+
var _layer$geojson, _currentSelectedFeatu, _ref4;
|
|
8301
8461
|
var currentActiveFeatureIndex = layerUtils.getSelectedFeatureIndexByIds(layer.geojson, layer.selectedFeatureIds);
|
|
8302
8462
|
if (!shouldAllowMultipleShapes || !(activeDrawMode != null && activeDrawMode.selectionType) || !((_layer$geojson = layer.geojson) != null && _layer$geojson.features.length)) {
|
|
8303
8463
|
return currentActiveFeatureIndex != null ? currentActiveFeatureIndex : 0;
|
|
@@ -8308,9 +8468,9 @@ var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref2
|
|
|
8308
8468
|
}
|
|
8309
8469
|
var matchingFeatureIndex;
|
|
8310
8470
|
for (var index = layer.geojson.features.length - 1; index >= 0; index -= 1) {
|
|
8311
|
-
var _feature$
|
|
8471
|
+
var _feature$properties2;
|
|
8312
8472
|
var feature = layer.geojson.features[index];
|
|
8313
|
-
if (((_feature$
|
|
8473
|
+
if (((_feature$properties2 = feature.properties) == null ? void 0 : _feature$properties2.selectionType) === activeDrawMode.selectionType) {
|
|
8314
8474
|
if (isGeoJSONGeometryEmpty(feature)) {
|
|
8315
8475
|
return index;
|
|
8316
8476
|
}
|
|
@@ -8319,32 +8479,55 @@ var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref2
|
|
|
8319
8479
|
}
|
|
8320
8480
|
}
|
|
8321
8481
|
}
|
|
8322
|
-
return (
|
|
8482
|
+
return (_ref4 = matchingFeatureIndex != null ? matchingFeatureIndex : currentActiveFeatureIndex) != null ? _ref4 : 0;
|
|
8323
8483
|
}, [activeDrawMode == null ? void 0 : activeDrawMode.selectionType, layer.geojson, layer.selectedFeatureIds, shouldAllowMultipleShapes]);
|
|
8484
|
+
var sketchInProgress = React.useMemo(function () {
|
|
8485
|
+
var _layer$geojson2;
|
|
8486
|
+
return isSketchInProgress(layer.isInEditMode, layer.drawMode, (_layer$geojson2 = layer.geojson) == null ? void 0 : _layer$geojson2.features[activeFeatureIndex]);
|
|
8487
|
+
}, [layer.isInEditMode, layer.drawMode, layer.geojson, activeFeatureIndex]);
|
|
8488
|
+
var usesIdSelection = usesFeatureIdSelection(layer.isSelectable, hasRegisteredDrawTool);
|
|
8324
8489
|
var displayGeojson = React.useMemo(function () {
|
|
8325
|
-
var _layer$hoveredFeature;
|
|
8490
|
+
var _layer$hoveredFeature, _layer$selectedFeatur;
|
|
8326
8491
|
if (!layer.geojson) {
|
|
8327
8492
|
return undefined;
|
|
8328
8493
|
}
|
|
8329
8494
|
var hoveredFeatureIds = new Set((_layer$hoveredFeature = layer.hoveredFeatureIds) != null ? _layer$hoveredFeature : []);
|
|
8495
|
+
var selectedFeatureIdSet = new Set((_layer$selectedFeatur = layer.selectedFeatureIds) != null ? _layer$selectedFeatur : []);
|
|
8330
8496
|
return Object.assign({}, layer.geojson, {
|
|
8331
8497
|
features: layer.geojson.features.map(function (feature) {
|
|
8332
|
-
var _feature$
|
|
8498
|
+
var _feature$properties3;
|
|
8333
8499
|
var featureId = feature.id !== undefined ? String(feature.id) : undefined;
|
|
8334
|
-
var originalId = typeof ((_feature$
|
|
8500
|
+
var originalId = typeof ((_feature$properties3 = feature.properties) == null ? void 0 : _feature$properties3.originalId) === 'string' ? feature.properties.originalId : layer.originalId;
|
|
8501
|
+
var selectionProperties = getSelectionProperties(usesIdSelection, selectedFeatureIdSet, featureId);
|
|
8335
8502
|
return Object.assign({}, feature, {
|
|
8336
8503
|
properties: Object.assign({}, feature.properties, {
|
|
8337
8504
|
hover: featureId !== undefined && hoveredFeatureIds.has(featureId) || typeof originalId === 'string' && hoveredFeatureIds.has(originalId)
|
|
8338
|
-
})
|
|
8505
|
+
}, selectionProperties)
|
|
8339
8506
|
});
|
|
8340
8507
|
})
|
|
8341
8508
|
});
|
|
8342
|
-
}, [layer.geojson, layer.hoveredFeatureIds, layer.originalId]);
|
|
8509
|
+
}, [layer.geojson, layer.hoveredFeatureIds, layer.originalId, layer.selectedFeatureIds, usesIdSelection]);
|
|
8510
|
+
var clearSelection = React.useCallback(function () {
|
|
8511
|
+
if (!shouldClearSelectionOnEmptyClick(activeDrawToolId, hasRegisteredDrawTool)) {
|
|
8512
|
+
return;
|
|
8513
|
+
}
|
|
8514
|
+
dispatch(layerActions.setSelectedFeatures({
|
|
8515
|
+
layerId: layerId,
|
|
8516
|
+
selectedFeatureIds: []
|
|
8517
|
+
}));
|
|
8518
|
+
dispatch(layerActions.toggleFeatureMode({
|
|
8519
|
+
layerId: layerId,
|
|
8520
|
+
isInEditMode: false,
|
|
8521
|
+
drawMode: ''
|
|
8522
|
+
}));
|
|
8523
|
+
}, [activeDrawToolId, hasRegisteredDrawTool, dispatch, layerId]);
|
|
8343
8524
|
var onFeatureClick = React.useCallback(function (feature, isShiftClick) {
|
|
8344
8525
|
var _clickedFeature$prope;
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8526
|
+
if (!feature.length) {
|
|
8527
|
+
clearSelection();
|
|
8528
|
+
return;
|
|
8529
|
+
}
|
|
8530
|
+
var clickedIndex = findFeatureIndexByKey(layer.geojson, feature[0]);
|
|
8348
8531
|
if (clickedIndex === -1) {
|
|
8349
8532
|
return;
|
|
8350
8533
|
}
|
|
@@ -8354,10 +8537,9 @@ var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref2
|
|
|
8354
8537
|
geojson: layer.geojson,
|
|
8355
8538
|
selectedFeatureIds: layer.selectedFeatureIds
|
|
8356
8539
|
});
|
|
8357
|
-
//
|
|
8358
|
-
//
|
|
8359
|
-
//
|
|
8360
|
-
// instead happen via empty-space click or multi-select interactions.
|
|
8540
|
+
// Drawing layers only: deselecting the active edit target collapses edit mode,
|
|
8541
|
+
// so a plain click on the sole selection keeps it. Clearing happens through
|
|
8542
|
+
// empty space or shift+click instead.
|
|
8361
8543
|
var shouldPreventDeselect = hasRegisteredDrawTool && !isReadonly && !isShiftClick && currentSelection.length === 1 && currentSelection[0] === clickedIndex;
|
|
8362
8544
|
var newSelection = shouldPreventDeselect ? [clickedIndex] : calculateNewSelection(currentSelection, clickedIndex, isShiftClick != null ? isShiftClick : false);
|
|
8363
8545
|
var nextSelectedFeatureIds = newSelection.map(function (index) {
|
|
@@ -8369,25 +8551,13 @@ var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref2
|
|
|
8369
8551
|
layerId: layerId,
|
|
8370
8552
|
selectedFeatureIds: nextSelectedFeatureIds
|
|
8371
8553
|
}));
|
|
8372
|
-
if (newSelection.length === 0) {
|
|
8554
|
+
if (newSelection.length === 0 || shouldExitEditModeForMultiSelect(newSelection.length)) {
|
|
8373
8555
|
dispatch(layerActions.toggleFeatureMode({
|
|
8374
8556
|
layerId: layerId,
|
|
8375
8557
|
isInEditMode: false,
|
|
8376
8558
|
drawMode: ''
|
|
8377
8559
|
}));
|
|
8378
8560
|
}
|
|
8379
|
-
var affectedIndices = getAffectedIndices(currentSelection, newSelection);
|
|
8380
|
-
affectedIndices.forEach(function (idx) {
|
|
8381
|
-
var isNowSelected = newSelection.includes(idx);
|
|
8382
|
-
dispatch(layerActions.updateFeatureProperties({
|
|
8383
|
-
layerId: layerId,
|
|
8384
|
-
properties: {
|
|
8385
|
-
highlightSelectedFeature: isNowSelected,
|
|
8386
|
-
isSelected: isNowSelected
|
|
8387
|
-
},
|
|
8388
|
-
targetFeatureIndex: idx
|
|
8389
|
-
}));
|
|
8390
|
-
});
|
|
8391
8561
|
if (shouldEnterEditMode(isReadonly, isShiftClick != null ? isShiftClick : false, newSelection.length)) {
|
|
8392
8562
|
dispatch(layerActions.toggleFeatureMode({
|
|
8393
8563
|
layerId: layerId,
|
|
@@ -8395,27 +8565,15 @@ var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref2
|
|
|
8395
8565
|
drawMode: ''
|
|
8396
8566
|
}));
|
|
8397
8567
|
}
|
|
8398
|
-
}, [hasRegisteredDrawTool, dispatch, layer.geojson, layer.selectedFeatureIds, layerId]);
|
|
8399
|
-
var onNoFeatureClick =
|
|
8400
|
-
if (activeDrawToolId) {
|
|
8401
|
-
// do not disable edit mode when a drawing tool is active
|
|
8402
|
-
return;
|
|
8403
|
-
}
|
|
8404
|
-
dispatch(layerActions.toggleFeatureMode({
|
|
8405
|
-
layerId: layerId,
|
|
8406
|
-
isInEditMode: false,
|
|
8407
|
-
drawMode: ''
|
|
8408
|
-
}));
|
|
8409
|
-
}, [activeDrawToolId, dispatch, layerId]);
|
|
8568
|
+
}, [hasRegisteredDrawTool, dispatch, layer.geojson, layer.selectedFeatureIds, layerId, clearSelection]);
|
|
8569
|
+
var onNoFeatureClick = clearSelection;
|
|
8410
8570
|
var onBoxSelect = React.useCallback(function (features, addToSelection) {
|
|
8411
|
-
var _layer$
|
|
8412
|
-
if (!((_layer$
|
|
8571
|
+
var _layer$geojson3;
|
|
8572
|
+
if (!((_layer$geojson3 = layer.geojson) != null && _layer$geojson3.features.length)) {
|
|
8413
8573
|
return;
|
|
8414
8574
|
}
|
|
8415
8575
|
var boxSelectedIndices = features.map(function (feature) {
|
|
8416
|
-
return layer.geojson
|
|
8417
|
-
return feat.id === feature.getId();
|
|
8418
|
-
});
|
|
8576
|
+
return findFeatureIndexByKey(layer.geojson, feature);
|
|
8419
8577
|
}).filter(function (idx) {
|
|
8420
8578
|
return idx !== -1;
|
|
8421
8579
|
});
|
|
@@ -8426,7 +8584,7 @@ var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref2
|
|
|
8426
8584
|
geojson: layer.geojson,
|
|
8427
8585
|
selectedFeatureIds: layer.selectedFeatureIds
|
|
8428
8586
|
});
|
|
8429
|
-
var newSelection =
|
|
8587
|
+
var newSelection = calculateBoxSelection(previousSelection, boxSelectedIndices, addToSelection);
|
|
8430
8588
|
var nextSelectedFeatureIds = newSelection.map(function (index) {
|
|
8431
8589
|
return layerUtils.getFeatureSelectionKey(layer.geojson.features[index]);
|
|
8432
8590
|
}).filter(function (featureId) {
|
|
@@ -8436,21 +8594,66 @@ var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref2
|
|
|
8436
8594
|
layerId: layerId,
|
|
8437
8595
|
selectedFeatureIds: nextSelectedFeatureIds
|
|
8438
8596
|
}));
|
|
8439
|
-
|
|
8440
|
-
|
|
8597
|
+
if (shouldExitEditModeForMultiSelect(newSelection.length)) {
|
|
8598
|
+
dispatch(layerActions.toggleFeatureMode({
|
|
8599
|
+
layerId: layerId,
|
|
8600
|
+
isInEditMode: false,
|
|
8601
|
+
drawMode: ''
|
|
8602
|
+
}));
|
|
8603
|
+
}
|
|
8441
8604
|
}, [dispatch, layer.geojson, layer.selectedFeatureIds, layerId]);
|
|
8442
8605
|
var boxSelectConfig = React.useMemo(function () {
|
|
8443
|
-
return
|
|
8606
|
+
return usesIdSelection && !layer.isInEditMode ? {
|
|
8444
8607
|
onBoxSelect: onBoxSelect,
|
|
8445
8608
|
active: true
|
|
8446
8609
|
} : undefined;
|
|
8447
|
-
}, [
|
|
8448
|
-
|
|
8449
|
-
|
|
8610
|
+
}, [usesIdSelection, layer.isInEditMode, onBoxSelect]);
|
|
8611
|
+
// Mutually exclusive with boxSelectConfig, so only one DragBox is ever live.
|
|
8612
|
+
var editModeBoxSelectConfig = React.useMemo(function () {
|
|
8613
|
+
return usesIdSelection && layer.isInEditMode ? {
|
|
8614
|
+
onBoxSelect: onBoxSelect,
|
|
8615
|
+
active: true
|
|
8616
|
+
} : undefined;
|
|
8617
|
+
}, [usesIdSelection, layer.isInEditMode, onBoxSelect]);
|
|
8618
|
+
var selectedFeatureIndices = React.useMemo(function () {
|
|
8619
|
+
return getCurrentSelectedIndices({
|
|
8620
|
+
geojson: layer.geojson,
|
|
8621
|
+
selectedFeatureIds: layer.selectedFeatureIds
|
|
8622
|
+
});
|
|
8623
|
+
}, [layer.geojson, layer.selectedFeatureIds]);
|
|
8624
|
+
useDeselectAllOnEscape({
|
|
8625
|
+
selectedFeatureCount: selectedFeatureIndices.length,
|
|
8626
|
+
isInEditMode: layer.isInEditMode,
|
|
8627
|
+
hasRegisteredDrawTool: hasRegisteredDrawTool,
|
|
8628
|
+
onDeselectAll: clearSelection
|
|
8629
|
+
});
|
|
8630
|
+
var movableSelectedFeatureIds = React.useMemo(function () {
|
|
8631
|
+
return getMovableSelectedFeatureIds(layer.geojson, layer.selectedFeatureIds);
|
|
8632
|
+
}, [layer.geojson, layer.selectedFeatureIds]);
|
|
8633
|
+
var onMoveEnd = React.useCallback(function (movedFeatures) {
|
|
8634
|
+
if (!layerId || !movedFeatures.length) {
|
|
8450
8635
|
return;
|
|
8451
8636
|
}
|
|
8452
|
-
|
|
8453
|
-
|
|
8637
|
+
dispatch(layerActions.moveFeatures({
|
|
8638
|
+
layerId: layerId,
|
|
8639
|
+
movedFeatures: movedFeatures,
|
|
8640
|
+
geoJSONIntersectionLayerId: geoJSONIntersectionLayerId,
|
|
8641
|
+
geoJSONIntersectionBoundsLayerId: geoJSONIntersectionBoundsLayerId
|
|
8642
|
+
}));
|
|
8643
|
+
}, [dispatch, layerId, geoJSONIntersectionLayerId, geoJSONIntersectionBoundsLayerId]);
|
|
8644
|
+
var moveFeaturesConfig = React.useMemo(function () {
|
|
8645
|
+
var _layer$selectedFeatur2, _layer$selectedFeatur3;
|
|
8646
|
+
return shouldEnableMultiShapeMove(hasRegisteredDrawTool, layer.isInEditMode, (_layer$selectedFeatur2 = (_layer$selectedFeatur3 = layer.selectedFeatureIds) == null ? void 0 : _layer$selectedFeatur3.length) != null ? _layer$selectedFeatur2 : 0, movableSelectedFeatureIds.length) ? {
|
|
8647
|
+
onMoveEnd: onMoveEnd,
|
|
8648
|
+
active: true
|
|
8649
|
+
} : undefined;
|
|
8650
|
+
}, [hasRegisteredDrawTool, layer.isInEditMode, layer.selectedFeatureIds, movableSelectedFeatureIds, onMoveEnd]);
|
|
8651
|
+
var onViewOnlyFeatureClick = React.useCallback(function (feature, isShiftClick) {
|
|
8652
|
+
if (sketchInProgress) {
|
|
8653
|
+
return;
|
|
8654
|
+
}
|
|
8655
|
+
onFeatureClick(feature, isShiftClick);
|
|
8656
|
+
}, [sketchInProgress, onFeatureClick]);
|
|
8454
8657
|
var updateFeature = React.useCallback(function (geojson, reason) {
|
|
8455
8658
|
if (!layerId) {
|
|
8456
8659
|
window.console.error('updateFeature without layerId');
|
|
@@ -8481,18 +8684,20 @@ var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref2
|
|
|
8481
8684
|
return jsxs(Fragment, {
|
|
8482
8685
|
children: [jsx(OpenLayersFeatureLayer, {
|
|
8483
8686
|
boxSelect: boxSelectConfig,
|
|
8484
|
-
clickOnFeature: layer.
|
|
8687
|
+
clickOnFeature: usesIdSelection && !layer.isInEditMode ? {
|
|
8485
8688
|
onClick: onFeatureClick,
|
|
8486
8689
|
hitTolerance: 5
|
|
8487
8690
|
} : undefined,
|
|
8488
8691
|
featureCollection: !layer.isInEditMode ? displayGeojson : undefined,
|
|
8489
8692
|
hoverSelect: hoverSelect,
|
|
8490
8693
|
layerId: layerId,
|
|
8694
|
+
moveFeatures: moveFeaturesConfig,
|
|
8491
8695
|
opacity: layer.opacity,
|
|
8492
8696
|
style: style,
|
|
8493
8697
|
visible: layer.enabled,
|
|
8494
8698
|
zIndex: zIndex
|
|
8495
8699
|
}), jsx(OpenLayersMapDraw, {
|
|
8700
|
+
boxSelect: editModeBoxSelectConfig,
|
|
8496
8701
|
drawMode: layer.drawMode,
|
|
8497
8702
|
exitDrawModeCallback: exitFeatureDrawMode,
|
|
8498
8703
|
geojson: layer.geojson,
|
|
@@ -8500,6 +8705,7 @@ var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref2
|
|
|
8500
8705
|
onNoFeatureClick: onNoFeatureClick,
|
|
8501
8706
|
onViewOnlyFeatureClick: onViewOnlyFeatureClick,
|
|
8502
8707
|
selectedFeatureIndex: activeFeatureIndex,
|
|
8708
|
+
selectedFeatureIndices: selectedFeatureIndices,
|
|
8503
8709
|
updateGeojson: updateFeature,
|
|
8504
8710
|
viewOnlyStyle: style
|
|
8505
8711
|
})]
|
|
@@ -8523,6 +8729,14 @@ var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref2
|
|
|
8523
8729
|
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
8524
8730
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
8525
8731
|
* */
|
|
8732
|
+
var getStoredViewObjectForMap = function getStoredViewObjectForMap(mapId, store) {
|
|
8733
|
+
var syncGroupState = syncGroupsSelectors.getSynchronizationGroupState(store.getState());
|
|
8734
|
+
var thisAreaSyncGroupId = syncGroupState.groups.allIds.find(function (id) {
|
|
8735
|
+
var group = syncGroupState.groups.byId[id];
|
|
8736
|
+
return group.type === syncConstants.SYNCGROUPS_TYPE_SETBBOX && group.targets.allIds.includes(mapId);
|
|
8737
|
+
});
|
|
8738
|
+
return thisAreaSyncGroupId ? getViewObjectForSyncGroup(thisAreaSyncGroupId) : getViewObjectForMapId(mapId);
|
|
8739
|
+
};
|
|
8526
8740
|
var useGetOpenLayersView = function useGetOpenLayersView(mapId, store) {
|
|
8527
8741
|
var _useState = useState(),
|
|
8528
8742
|
view = _useState[0],
|
|
@@ -8530,17 +8744,9 @@ var useGetOpenLayersView = function useGetOpenLayersView(mapId, store) {
|
|
|
8530
8744
|
var _useState2 = useState(),
|
|
8531
8745
|
name = _useState2[0],
|
|
8532
8746
|
setName = _useState2[1];
|
|
8533
|
-
var
|
|
8534
|
-
var syncGroupView = useMemo(function () {
|
|
8535
|
-
var thisAreaSyncGroupId = syncGroupState.groups.allIds.find(function (id) {
|
|
8536
|
-
var group = syncGroupState.groups.byId[id];
|
|
8537
|
-
return group.type === syncConstants.SYNCGROUPS_TYPE_SETBBOX && group.targets.allIds.includes(mapId);
|
|
8538
|
-
});
|
|
8539
|
-
return thisAreaSyncGroupId ? getViewObjectForSyncGroup(thisAreaSyncGroupId) : null;
|
|
8540
|
-
}, [mapId, syncGroupState.groups]);
|
|
8747
|
+
var storedView = getStoredViewObjectForMap(mapId, store);
|
|
8541
8748
|
useEffect(function () {
|
|
8542
8749
|
var mapBbox = mapSelectors.getBbox(store.getState(), mapId);
|
|
8543
|
-
var storedView = syncGroupView || getViewObjectForMapId(mapId);
|
|
8544
8750
|
if (storedView.view.getCenter() === undefined && mapBbox.left !== undefined) {
|
|
8545
8751
|
storedView.view.fit([mapBbox.left, mapBbox.bottom, mapBbox.right, mapBbox.top]);
|
|
8546
8752
|
}
|
|
@@ -8553,7 +8759,7 @@ var useGetOpenLayersView = function useGetOpenLayersView(mapId, store) {
|
|
|
8553
8759
|
return function () {
|
|
8554
8760
|
unByKey(eventKey);
|
|
8555
8761
|
};
|
|
8556
|
-
}, [
|
|
8762
|
+
}, [storedView, mapId, store]);
|
|
8557
8763
|
return {
|
|
8558
8764
|
view: view,
|
|
8559
8765
|
name: name
|
|
@@ -8923,6 +9129,7 @@ var GetFeatureInfoDialog = function GetFeatureInfoDialog(_ref) {
|
|
|
8923
9129
|
return jsx(ToolContainerDraggable, {
|
|
8924
9130
|
bounds: "parent",
|
|
8925
9131
|
"data-testid": "moveable-getfeatureinfo",
|
|
9132
|
+
fixTopPosition: true,
|
|
8926
9133
|
initialMaxHeight: 440,
|
|
8927
9134
|
isOpen: isOpen,
|
|
8928
9135
|
minWidth: 100,
|
|
@@ -9201,6 +9408,60 @@ var MapOptionsButtonConnect = function MapOptionsButtonConnect(_ref) {
|
|
|
9201
9408
|
});
|
|
9202
9409
|
};
|
|
9203
9410
|
|
|
9411
|
+
/* *
|
|
9412
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9413
|
+
* you may not use this file except in compliance with the License.
|
|
9414
|
+
* You may obtain a copy of the License at
|
|
9415
|
+
*
|
|
9416
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9417
|
+
*
|
|
9418
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9419
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9420
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9421
|
+
* See the License for the specific language governing permissions and
|
|
9422
|
+
* limitations under the License.
|
|
9423
|
+
*
|
|
9424
|
+
* Copyright 2026 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
9425
|
+
* Copyright 2026 - Finnish Meteorological Institute (FMI)
|
|
9426
|
+
* Copyright 2026 - The Norwegian Meteorological Institute (MET Norway)
|
|
9427
|
+
* */
|
|
9428
|
+
var InitialZoomToLayerConnect = function InitialZoomToLayerConnect(_ref) {
|
|
9429
|
+
var mapId = _ref.mapId,
|
|
9430
|
+
onHomeExtentResolved = _ref.onHomeExtentResolved;
|
|
9431
|
+
var initialZoomToLayerId = useSelector(function (store) {
|
|
9432
|
+
return mapSelectors.getInitialZoomToLayerId(store, mapId);
|
|
9433
|
+
});
|
|
9434
|
+
var layer = useSelector(function (store) {
|
|
9435
|
+
return initialZoomToLayerId ? layerSelectors.getLayerById(store, initialZoomToLayerId) : undefined;
|
|
9436
|
+
});
|
|
9437
|
+
var store = useStore();
|
|
9438
|
+
var view = useViewFromLayer(layer);
|
|
9439
|
+
var _useGetWMLayerInstanc = useGetWMLayerInstance(layer),
|
|
9440
|
+
wmLayer = _useGetWMLayerInstanc.wmLayer;
|
|
9441
|
+
var hasResolvedInitialLayerView = React.useRef(false);
|
|
9442
|
+
React.useEffect(function () {
|
|
9443
|
+
var storedView = getStoredViewObjectForMap(mapId, store);
|
|
9444
|
+
if (storedView.view !== view) {
|
|
9445
|
+
storedView.setView(view);
|
|
9446
|
+
}
|
|
9447
|
+
}, [mapId, store, view]);
|
|
9448
|
+
React.useEffect(function () {
|
|
9449
|
+
if (hasResolvedInitialLayerView.current || !wmLayer) {
|
|
9450
|
+
return;
|
|
9451
|
+
}
|
|
9452
|
+
var extent = getLayerExtentForProjection(wmLayer, view.getProjection().getCode());
|
|
9453
|
+
if (extent) {
|
|
9454
|
+
onHomeExtentResolved([].concat(extent));
|
|
9455
|
+
}
|
|
9456
|
+
hasResolvedInitialLayerView.current = true;
|
|
9457
|
+
store.dispatch(mapActions.setPendingInitialZoomToLayer({
|
|
9458
|
+
mapId: mapId,
|
|
9459
|
+
layerId: undefined
|
|
9460
|
+
}));
|
|
9461
|
+
}, [mapId, onHomeExtentResolved, store, view, wmLayer]);
|
|
9462
|
+
return null;
|
|
9463
|
+
};
|
|
9464
|
+
|
|
9204
9465
|
/**
|
|
9205
9466
|
* Connected component used to display the map and selected layers.
|
|
9206
9467
|
* Includes options to disable the map controls and legend.
|
|
@@ -9231,6 +9492,9 @@ var OlMapViewConnect = function OlMapViewConnect(_ref) {
|
|
|
9231
9492
|
var _React$useState = React.useState(),
|
|
9232
9493
|
hoverLinkedFeature = _React$useState[0],
|
|
9233
9494
|
setHoverLinkedFeature = _React$useState[1];
|
|
9495
|
+
var _React$useState2 = React.useState(undefined),
|
|
9496
|
+
derivedHomeExtent = _React$useState2[0],
|
|
9497
|
+
setDerivedHomeExtent = _React$useState2[1];
|
|
9234
9498
|
var linkedPanelIds = useSelector(function (store) {
|
|
9235
9499
|
return genericSelectors.selectLinkedPanelIdsForMap(store, mapId);
|
|
9236
9500
|
});
|
|
@@ -9659,11 +9923,11 @@ var OlMapViewConnect = function OlMapViewConnect(_ref) {
|
|
|
9659
9923
|
checkIfDataOutdated();
|
|
9660
9924
|
}, [checkIfDataOutdated]);
|
|
9661
9925
|
useMapViewLoadingIndicator(mapId, mapLayerIds);
|
|
9662
|
-
var _React$
|
|
9926
|
+
var _React$useState3 = React.useState({
|
|
9663
9927
|
debugMode: false
|
|
9664
9928
|
}),
|
|
9665
|
-
mapMode = _React$
|
|
9666
|
-
setMapMode = _React$
|
|
9929
|
+
mapMode = _React$useState3[0],
|
|
9930
|
+
setMapMode = _React$useState3[1];
|
|
9667
9931
|
React.useEffect(function () {
|
|
9668
9932
|
var handleKeyPress = function handleKeyPress(event) {
|
|
9669
9933
|
if (event.isTrusted && document.activeElement === document.body) {
|
|
@@ -9681,9 +9945,12 @@ var OlMapViewConnect = function OlMapViewConnect(_ref) {
|
|
|
9681
9945
|
document.removeEventListener('keyup', handleKeyPress);
|
|
9682
9946
|
};
|
|
9683
9947
|
}, [mapMode]);
|
|
9948
|
+
var handleInitialHomeExtentResolved = React.useCallback(function (extent) {
|
|
9949
|
+
setDerivedHomeExtent(extent);
|
|
9950
|
+
}, []);
|
|
9684
9951
|
var homeExtent = React.useMemo(function () {
|
|
9685
|
-
return initialBbox
|
|
9686
|
-
}, [initialBbox]);
|
|
9952
|
+
return initialBbox ? [initialBbox.left, initialBbox.bottom, initialBbox.right, initialBbox.top] : derivedHomeExtent;
|
|
9953
|
+
}, [derivedHomeExtent, initialBbox]);
|
|
9687
9954
|
var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
|
|
9688
9955
|
var _useSetupDialog = useSetupDialog(dialogType),
|
|
9689
9956
|
isSearchDialogOpen = _useSetupDialog.isDialogOpen;
|
|
@@ -9727,9 +9994,12 @@ var OlMapViewConnect = function OlMapViewConnect(_ref) {
|
|
|
9727
9994
|
features: linkedFeatureCollectionsWithHover.features
|
|
9728
9995
|
};
|
|
9729
9996
|
}, [linkedFeatureCollectionsWithHover]);
|
|
9730
|
-
return
|
|
9997
|
+
return jsxs(TimeContext.Provider, {
|
|
9731
9998
|
value: prefetchTimespan,
|
|
9732
|
-
children:
|
|
9999
|
+
children: [jsx(InitialZoomToLayerConnect, {
|
|
10000
|
+
mapId: mapId,
|
|
10001
|
+
onHomeExtentResolved: handleInitialHomeExtentResolved
|
|
10002
|
+
}), jsxs(OpenLayersMapView, {
|
|
9733
10003
|
holdShiftToScroll: holdShiftToScroll,
|
|
9734
10004
|
isFocused: isActiveWindowId,
|
|
9735
10005
|
isMouseWheelZoomEnabled: !isTimeScrollingEnabled,
|
|
@@ -9821,7 +10091,7 @@ var OlMapViewConnect = function OlMapViewConnect(_ref) {
|
|
|
9821
10091
|
}), !!displayTimeInMap && jsx(ClockConnect, {
|
|
9822
10092
|
mapId: mapId
|
|
9823
10093
|
}), children]
|
|
9824
|
-
})
|
|
10094
|
+
})]
|
|
9825
10095
|
});
|
|
9826
10096
|
};
|
|
9827
10097
|
|
|
@@ -9837,7 +10107,7 @@ var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_ref) {
|
|
|
9837
10107
|
var mapId = _ref.mapId,
|
|
9838
10108
|
enableKeyboardShortcut = _ref.enableKeyboardShortcut;
|
|
9839
10109
|
return jsx(OptionsMenuButton, {
|
|
9840
|
-
animationLengthBtn: jsx(
|
|
10110
|
+
animationLengthBtn: jsx(AnimationLengthPanelConnect, {
|
|
9841
10111
|
mapId: mapId
|
|
9842
10112
|
}),
|
|
9843
10113
|
enableKeyboardShortcut: enableKeyboardShortcut,
|
|
@@ -10128,6 +10398,8 @@ var calculateNewAnimationTimeBounds = function calculateNewAnimationTimeBounds(n
|
|
|
10128
10398
|
};
|
|
10129
10399
|
};
|
|
10130
10400
|
|
|
10401
|
+
/** Below dialogs, so their resize handles stay hoverable over the slider. */
|
|
10402
|
+
var TIME_SLIDER_Z_INDEX = 60;
|
|
10131
10403
|
var useUpdateTimestep = function useUpdateTimestep(mapId) {
|
|
10132
10404
|
var autoTimeStepLayerId = useSelector(function (store) {
|
|
10133
10405
|
return mapSelectors.getAutoTimeStepLayerId(store, mapId);
|
|
@@ -10670,7 +10942,7 @@ var _ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
10670
10942
|
position: 'absolute',
|
|
10671
10943
|
left: '0px',
|
|
10672
10944
|
bottom: '0px',
|
|
10673
|
-
zIndex:
|
|
10945
|
+
zIndex: TIME_SLIDER_Z_INDEX,
|
|
10674
10946
|
width: '100%'
|
|
10675
10947
|
},
|
|
10676
10948
|
children: jsx(TimeSliderConnect, {
|
|
@@ -10766,7 +11038,7 @@ var MultiMapViewConnect = function MultiMapViewConnect(_ref) {
|
|
|
10766
11038
|
position: 'absolute',
|
|
10767
11039
|
left: '0px',
|
|
10768
11040
|
bottom: '0px',
|
|
10769
|
-
zIndex:
|
|
11041
|
+
zIndex: TIME_SLIDER_Z_INDEX,
|
|
10770
11042
|
width: '100%'
|
|
10771
11043
|
},
|
|
10772
11044
|
children: !!showTimeSlider && jsx(TimeSliderConnect, {
|
|
@@ -12137,4 +12409,4 @@ var storyUtils = /*#__PURE__*/Object.freeze({
|
|
|
12137
12409
|
useDefaultMapSettings: useDefaultMapSettings
|
|
12138
12410
|
});
|
|
12139
12411
|
|
|
12140
|
-
export { CORE_NAMESPACE, _ConfigurableMapConnect as ConfigurableMapConnect, CoreI18nProvider, CoreStoreProvider, CoreThemeProvider, CoreThemeStoreProvider, DemoWrapper, DemoWrapperConnect, HarmonieTempAndPrecipPreset, LanguageSelect, LayerInfoButtonConnect, LayerInfoDialogConnect, _LayerManager as LayerManager, BaseLayerRow as LayerManagerBaseLayerRow, LayerManagerConnect, DescriptionRow as LayerManagerDescriptionRow, HeaderOptions as LayerManagerHeaderOptions, LayerContainerRow as LayerManagerLayerContainerRow, LayerManagerMapButtonConnect, LegendConnect, LegendMapButtonConnect, LoadingIndicatorProgressBar, LocationSearch, LocationSearchConnect, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, MyMapLocation, OlMapViewConnect, RouterWrapperConnect, SearchControlButtonConnect, SelectedFeaturesDialogConnect, SyncGroupViewerConnect, TimeSliderConnect, componentsLookUp, coreTranslations, defaultBbox, defaultConfigurations, filterMapPresets, filterServices, filterTimeSeriesServices, getCenterOfLinkedFeature, getIsOutdated, getLanguageFromLocalStorage, getRenderedDimensions, languageLocalStorageKey, makeLayerInfoPayload, makePrefetchTimeSpan, saveLanguageToLocalStorage, storyUtils, testLayers, useFetchServices, useFitAndHighlightWarningFeature, useGetOpenLayersView, useLocationDetail, useLocationList, usePrefetchTimeSpan, useUpdateTimeSpan, useUpdateTimestep };
|
|
12412
|
+
export { CORE_NAMESPACE, _ConfigurableMapConnect as ConfigurableMapConnect, CoreI18nProvider, CoreStoreProvider, CoreThemeProvider, CoreThemeStoreProvider, DemoWrapper, DemoWrapperConnect, HarmonieTempAndPrecipPreset, LanguageSelect, LayerInfoButtonConnect, LayerInfoDialogConnect, _LayerManager as LayerManager, BaseLayerRow as LayerManagerBaseLayerRow, LayerManagerConnect, DescriptionRow as LayerManagerDescriptionRow, HeaderOptions as LayerManagerHeaderOptions, LayerContainerRow as LayerManagerLayerContainerRow, LayerManagerMapButtonConnect, LegendConnect, LegendMapButtonConnect, LoadingIndicatorProgressBar, LocationSearch, LocationSearchConnect, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, MyMapLocation, OlMapViewConnect, RouterWrapperConnect, SearchControlButtonConnect, SelectedFeaturesDialogConnect, SyncGroupViewerConnect, TIME_SLIDER_Z_INDEX, TimeSliderConnect, componentsLookUp, coreTranslations, defaultBbox, defaultConfigurations, filterMapPresets, filterServices, filterTimeSeriesServices, getCenterOfLinkedFeature, getCurrentSelectedIndices, getIsOutdated, getLanguageFromLocalStorage, getRenderedDimensions, getStoredViewObjectForMap, languageLocalStorageKey, makeLayerInfoPayload, makePrefetchTimeSpan, saveLanguageToLocalStorage, storyUtils, testLayers, useFetchServices, useFitAndHighlightWarningFeature, useGetOpenLayersView, useLocationDetail, useLocationList, usePrefetchTimeSpan, useUpdateTimeSpan, useUpdateTimestep };
|