@opengeoweb/core 10.1.0 → 10.2.1-spike-ol.0
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/README.md +3 -16
- package/index.esm.js +1389 -406
- package/package.json +7 -2
- package/src/lib/components/ConfigurableMapConnect/ConfigurableMapConnect.d.ts +2 -1
- package/src/lib/components/FeatureInfo/utils.d.ts +4 -1
- package/src/lib/components/MapDrawToolRedux/OpenLayersFeatureLayerConnect.d.ts +13 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.d.ts +4 -2
- package/src/lib/components/MapViewConnect/OlMapViewConnect.d.ts +16 -0
- package/src/lib/components/MapViewConnect/OlMapViewLayerConnect.d.ts +8 -0
- package/src/lib/components/MapViewConnect/index.d.ts +1 -0
- package/src/lib/components/MapViewConnect/olMapUtils.d.ts +5 -0
- package/src/lib/components/MapViewConnect/useGetOpenlayersView.d.ts +9 -0
- package/src/lib/components/MultiMapViewConnect/HarmoniePresets/HarmonieTempAndPrecipPreset.spec.d.ts +1 -0
- package/src/lib/components/Providers/Providers.d.ts +0 -2
- package/src/lib/components/Search/MyMapLocation.d.ts +5 -6
- package/src/lib/components/Search/SearchDialog.d.ts +4 -1
- package/src/lib/components/Search/{SearchControl.stories.d.ts → SearchDialog.stories.d.ts} +4 -4
- package/src/lib/components/Search/SearchDialogConnect.d.ts +5 -0
- package/src/lib/components/Search/SearchDialogConnect.spec.d.ts +1 -0
- package/src/lib/components/Search/SearchDialogConnect.stories.d.ts +7 -0
- package/src/lib/components/Search/index.d.ts +1 -1
- package/src/lib/components/Search/types.d.ts +13 -0
- package/src/lib/components/Search/utils.d.ts +8 -0
- package/src/lib/components/SyncGroups/SimpleTimeSliderConnect.d.ts +2 -2
- package/src/lib/components/TimeSliderConnect/TimeSliderConnect.d.ts +1 -1
- package/src/lib/components/TimeSliderConnect/TimeSliderLegendConnect.d.ts +4 -0
- package/src/lib/utils/location-api/api.d.ts +3 -0
- package/src/lib/utils/location-api/fakeApi.d.ts +70 -0
- package/src/lib/utils/location-api/hooks.d.ts +4 -0
- package/src/lib/components/Search/SearchControlConnect.d.ts +0 -5
- /package/src/lib/components/{Search/SearchControlConnect.spec.d.ts → MapViewConnect/olMapUtils.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { useState, useCallback,
|
|
4
|
-
import { Grid2, Box, MenuItem, Typography, useTheme, Popper, Fade, Tooltip, styled, LinearProgress, FormControl, InputLabel, Paper, List, ListItemButton, ListItemText, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, InputAdornment, DialogActions, Button,
|
|
3
|
+
import React__default, { useState, useCallback, useEffect, useContext, useMemo } from 'react';
|
|
4
|
+
import { Grid2, Box, MenuItem, Typography, useTheme, Popper, Fade, Tooltip, styled, LinearProgress, FormControl, InputLabel, Paper, List, ListItemButton, ListItemText, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, InputAdornment, DialogActions, Button, Autocomplete, ListItemIcon, Checkbox, Switch, Select } from '@mui/material';
|
|
5
5
|
import { SHARED_NAMESPACE, sharedTranslations, CustomIconButton, CustomTooltip, TooltipSelect, AlertIcon, sliderHeaderStyle, CustomSlider, ToggleMenu, tooltipContainerStyles, renderCounter, AlertBanner, CustomAccordion, PROJECTION, calculateStartSize, useWheelStopPropagation, ToolContainerDraggable, useDebounce, dateUtils, ErrorBoundary } from '@opengeoweb/shared';
|
|
6
6
|
import { CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, LayersAdd, CloudLoading, ColumnCollapsed, ColumnCollapse, Copy, None, FastForward, AutoUpdateActive, Both, Visibility, VisibilityOff, Delete, DragHandle as DragHandle$1, Cached, Add, MapAdd, WorldMapProjection, Layers, Search, Exclamation, MyLocation, Close, ExitDomain, Info, ThemeWrapper, lightTheme, FlagBritain, FlagNetherlands, FlagFinland, FlagNorway } from '@opengeoweb/theme';
|
|
7
7
|
import i18n from 'i18next';
|
|
8
8
|
import { initReactI18next, useTranslation, I18nextProvider } from 'react-i18next';
|
|
9
|
-
import { TIMESLIDER_NAMESPACE, timesliderTranslations, defaultTimeSpan, TIME_SLIDER_LEGEND_HEIGHT, SpeedButton, TimeStepButton, AnimationLengthButton, AnimationLength, TimeSpanButton, secondsPerPxFromCanvasWidth, getNewCenterOfFixedPointZoom, OptionsMenuButton, PlayButton, defaultTimeStep, BackwardForwardStepButton, AutoUpdateButton, NowButton, handleSetNowEvent, TimeSliderButtons, TimeSliderCurrentTimeBox, TimeSliderLegend,
|
|
10
|
-
import { WEBMAP_REACT_NAMESPACE, webmapReactTranslations, WEBMAP_NAMESPACE, webmapTranslations, LayerInfoButton, LayerInfoDialog, MapControlButton, MapDimensionSelect, dimensionConfig, DimensionSelectDialog, DimensionSelectButton, registerDrawFunction, ZoomControls, LegendDialog, LegendButton, MapView, MapViewLayer, MapControls,
|
|
9
|
+
import { TIMESLIDER_NAMESPACE, timesliderTranslations, defaultTimeSpan, TIME_SLIDER_LEGEND_HEIGHT, SpeedButton, TimeStepButton, AnimationLengthButton, AnimationLength, TimeSpanButton, secondsPerPxFromCanvasWidth, getNewCenterOfFixedPointZoom, OptionsMenuButton, PlayButton, defaultTimeStep, BackwardForwardStepButton, AutoUpdateButton, NowButton, handleSetNowEvent, TimeSliderButtons, TimeSliderCurrentTimeBox, TimeSliderLegend, onsetNewDateDebounced, defaultSecondsPerPx, moveSelectedTimePx, TimeSlider, getFilteredTime, ControlButtons, OptionsMenu, TimeSliderClock } from '@opengeoweb/timeslider';
|
|
10
|
+
import { WEBMAP_REACT_NAMESPACE, webmapReactTranslations, WEBMAP_NAMESPACE, webmapTranslations, LayerInfoButton, LayerInfoDialog, MapControlButton, MapDimensionSelect, dimensionConfig, DimensionSelectDialog, DimensionSelectButton, MapContext, emptyGeoJSON, registerDrawFunction, MapFeatureClass, setMapCenter, ZoomControls, LegendDialog, LegendButton, MapView, MapViewLayer, MapControls, GeoJSONLayer, OpenLayersMapDraw, getIsInsideAcceptanceTime, MapViewLayerToOpenLayer, useSetIntervalWhenVisible, openLayersGetMapImageStore, TimeContext, OpenLayersMapView, WMSLayer, genericOpenlayersFeatureStyle, OpenLayersGetFeatureInfo, OpenLayersZoomControl, getLayerUpdateInfo, publicLayers, isOpenLayersEnabled } from '@opengeoweb/webmap-react';
|
|
11
11
|
import { useDispatch, useSelector, connect, useStore, Provider } from 'react-redux';
|
|
12
12
|
import { ReactSortable } from 'react-sortablejs';
|
|
13
13
|
import Sortable from 'sortablejs';
|
|
14
|
-
import { layerTypes, layerUtils, mapSelectors, layerActions, layerSelectors, serviceSelectors, serviceActions, mapActions, mapEnums, uiSelectors, uiTypes, useSetupDialog, filterLayers, getUserAddedServices, uiActions, genericSelectors, genericActions,
|
|
14
|
+
import { layerTypes, layerUtils, mapSelectors, layerActions, layerSelectors, serviceSelectors, serviceActions, mapActions, mapEnums, uiSelectors, uiTypes, useSetupDialog, filterLayers, getUserAddedServices, uiActions, genericSelectors, genericActions, drawingToolSelectors, syncConstants, loadingIndicatorActions, syncGroupsSelectors, getViewObjectForSyncGroup, getViewObjectForMapId, defaultLayers, getSingularDrawtoolDrawLayerId, syncGroupsSelector, syncGroupsActions, routerUtils } from '@opengeoweb/store';
|
|
15
15
|
import _, { isArray, isEqual, debounce, range } from 'lodash';
|
|
16
|
-
import { webmapUtils, queryWMSServiceInfo, queryWMSLayers, queryWMSLayersTree, invalidateWMSGetCapabilities, LayerType, getWMSServiceId, getWMSGetFeatureInfoRequestURL, handleDateUtilsISOString, wmServiceListener, EVENT_GETCAPABILITIES_START, EVENT_GETCAPABILITIES_READY, WMLayer } from '@opengeoweb/webmap';
|
|
16
|
+
import { webmapUtils, queryWMSServiceInfo, queryWMSLayers, queryWMSLayersTree, invalidateWMSGetCapabilities, LayerType, getWMSServiceId, generateLayerId, getWMJSMapById, getWMSGetFeatureInfoRequestURL, getMapDimURL, handleDateUtilsISOString, wmServiceListener, EVENT_GETCAPABILITIES_START, EVENT_GETCAPABILITIES_READY, WMJSDimension, getWMLayerById, WMLayer } from '@opengeoweb/webmap';
|
|
17
17
|
import { Box as Box$1, styled as styled$1 } from '@mui/system';
|
|
18
18
|
import { LayerSelectButtonConnect, LayerSelectConnect } from '@opengeoweb/layer-select';
|
|
19
|
+
import { useQuery, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
20
|
+
import { getConfig } from '@opengeoweb/authentication';
|
|
21
|
+
import { handleResponse } from '@opengeoweb/api';
|
|
19
22
|
import axios from 'axios';
|
|
23
|
+
import { ImageWMS } from 'ol/source';
|
|
20
24
|
import DOMPurify from 'dompurify';
|
|
25
|
+
import { unByKey } from 'ol/Observable';
|
|
26
|
+
import { toLonLat } from 'ol/proj';
|
|
21
27
|
import { snackbarTypes, snackbarActions, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
|
|
22
28
|
import { useNavigate } from 'react-router-dom';
|
|
23
29
|
import * as Sentry from '@sentry/react';
|
|
@@ -65,10 +71,13 @@ var en = {
|
|
|
65
71
|
"wms-loader-error-http": "Use https or allow Mixed Content in your browser to use this WMS service",
|
|
66
72
|
"wms-loader-error-valid-service": "Please enter a valid WMS service",
|
|
67
73
|
"wms-loader-error-valid-url": "Please enter a valid URL",
|
|
68
|
-
"search-title": "
|
|
69
|
-
"search-title-aria": "
|
|
70
|
-
"search-
|
|
71
|
-
"search-
|
|
74
|
+
"search-title": "Find location",
|
|
75
|
+
"search-title-aria": "Find location on the map",
|
|
76
|
+
"search-my-location": "Find my location",
|
|
77
|
+
"search-title-long": "Find location, area, postal code, GPS, ...",
|
|
78
|
+
"search-no-results": "No results",
|
|
79
|
+
"my-location": "My location",
|
|
80
|
+
"search-clear": "Clear",
|
|
72
81
|
"syncgroups-title": "Sync",
|
|
73
82
|
"syncgroups-zoom": "ZoomPane",
|
|
74
83
|
"syncgroups-timeslider": "Timeslider",
|
|
@@ -140,8 +149,11 @@ var fi = {
|
|
|
140
149
|
"wms-loader-error-valid-url": "Lisää toimiva URL",
|
|
141
150
|
"search-title": "Etsi",
|
|
142
151
|
"search-title-aria": "Karttahaku",
|
|
143
|
-
"search-
|
|
144
|
-
"search-
|
|
152
|
+
"search-my-location": "Etsi sijaintini",
|
|
153
|
+
"search-title-long": "Find location, area, postal code, GPS, ...",
|
|
154
|
+
"search-no-results": "No results",
|
|
155
|
+
"my-location": "My location",
|
|
156
|
+
"search-clear": "Clear",
|
|
145
157
|
"syncgroups-title": "Sync",
|
|
146
158
|
"syncgroups-zoom": "ZoomPane",
|
|
147
159
|
"syncgroups-timeslider": "TimeSlider",
|
|
@@ -213,8 +225,11 @@ var no = {
|
|
|
213
225
|
"wms-loader-error-valid-url": "Vennligst skriv inn en gyldig URL",
|
|
214
226
|
"search-title": "Søk",
|
|
215
227
|
"search-title-aria": "Kart søk",
|
|
216
|
-
"search-
|
|
217
|
-
"search-
|
|
228
|
+
"search-my-location": "Finn min lokasjon",
|
|
229
|
+
"search-title-long": "Find location, area, postal code, GPS, ...",
|
|
230
|
+
"search-no-results": "No results",
|
|
231
|
+
"my-location": "Min lokasjon",
|
|
232
|
+
"search-clear": "Clear",
|
|
218
233
|
"syncgroups-title": "Synkroniser",
|
|
219
234
|
"syncgroups-zoom": "Zoom/Paner",
|
|
220
235
|
"syncgroups-timeslider": "Timeslider",
|
|
@@ -286,8 +301,11 @@ var nl = {
|
|
|
286
301
|
"wms-loader-error-valid-url": "Voer een geldige URL in",
|
|
287
302
|
"search-title": "Zoeken",
|
|
288
303
|
"search-title-aria": "Zoeken op de kaart",
|
|
289
|
-
"search-
|
|
290
|
-
"search-
|
|
304
|
+
"search-my-location": "Vind mijn locatie",
|
|
305
|
+
"search-title-long": "Vind locatie, gebied, postcode, GPS, ...",
|
|
306
|
+
"search-no-results": "Geen resultaten",
|
|
307
|
+
"my-location": "Mijn locatie",
|
|
308
|
+
"search-clear": "Wissen",
|
|
291
309
|
"syncgroups-title": "Synchroniseren",
|
|
292
310
|
"syncgroups-zoom": "Zoomvenster",
|
|
293
311
|
"syncgroups-timeslider": "Timeslider",
|
|
@@ -5627,230 +5645,512 @@ var SearchControlButtonConnect = function SearchControlButtonConnect(_ref) {
|
|
|
5627
5645
|
});
|
|
5628
5646
|
};
|
|
5629
5647
|
|
|
5630
|
-
var MY_LOCATION = '
|
|
5648
|
+
var MY_LOCATION = 'My location';
|
|
5631
5649
|
var locationOptions = {
|
|
5632
5650
|
enableHighAccuracy: false,
|
|
5633
|
-
timeout:
|
|
5651
|
+
timeout: 10000,
|
|
5634
5652
|
maximumAge: 0
|
|
5635
5653
|
};
|
|
5636
|
-
var circleDrawFunction = function circleDrawFunction(args, fillColor, radius) {
|
|
5637
|
-
if (fillColor === void 0) {
|
|
5638
|
-
fillColor = '#88F';
|
|
5639
|
-
}
|
|
5640
|
-
if (radius === void 0) {
|
|
5641
|
-
radius = 12;
|
|
5642
|
-
}
|
|
5643
|
-
var ctx = args.context,
|
|
5644
|
-
coord = args.coord;
|
|
5645
|
-
ctx.strokeStyle = '#000';
|
|
5646
|
-
ctx.fillStyle = fillColor || '#88F';
|
|
5647
|
-
ctx.lineWidth = 1;
|
|
5648
|
-
ctx.beginPath();
|
|
5649
|
-
ctx.arc(coord.x, coord.y, radius || 10, 0, 2 * Math.PI);
|
|
5650
|
-
ctx.fill();
|
|
5651
|
-
ctx.stroke();
|
|
5652
|
-
ctx.fillStyle = '#000';
|
|
5653
|
-
ctx.beginPath();
|
|
5654
|
-
ctx.arc(coord.x, coord.y, 2, 0, 2 * Math.PI);
|
|
5655
|
-
ctx.fill();
|
|
5656
|
-
};
|
|
5657
5654
|
var MyMapLocation = function MyMapLocation(_ref) {
|
|
5658
|
-
var
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5655
|
+
var _ref$mapId = _ref.mapId,
|
|
5656
|
+
mapId = _ref$mapId === void 0 ? '' : _ref$mapId,
|
|
5657
|
+
_ref$isSelected = _ref.isSelected,
|
|
5658
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
5659
|
+
_ref$onUpdateMyLocati = _ref.onUpdateMyLocation,
|
|
5660
|
+
onUpdateMyLocation = _ref$onUpdateMyLocati === void 0 ? function () {} : _ref$onUpdateMyLocati;
|
|
5661
|
+
var theme = useTheme();
|
|
5662
|
+
var _useState = useState(false),
|
|
5663
|
+
isLoading = _useState[0],
|
|
5664
|
+
setIsLoading = _useState[1];
|
|
5665
|
+
var _useState2 = useState(false),
|
|
5666
|
+
hasFailed = _useState2[0],
|
|
5667
|
+
setHasFailed = _useState2[1];
|
|
5664
5668
|
var _useCoreTranslation = useCoreTranslation(),
|
|
5665
5669
|
t = _useCoreTranslation.t;
|
|
5666
|
-
var dispatch = useDispatch();
|
|
5667
|
-
var layersBelongsToCurrentMapId = useSelector(function (store) {
|
|
5668
|
-
return layerSelectors.getLayersByMapId(store, mapId || '');
|
|
5669
|
-
});
|
|
5670
|
-
var layerLocation = layersBelongsToCurrentMapId.find(function (layer) {
|
|
5671
|
-
var _layer$geojson$featur;
|
|
5672
|
-
if (layer.geojson && layer.geojson.features[0] && layer.geojson.features[0].properties && (_layer$geojson$featur = layer.geojson.features[0].properties) != null && _layer$geojson$featur.name) {
|
|
5673
|
-
if (layer.geojson.features[0].properties.name === MY_LOCATION) {
|
|
5674
|
-
return layer;
|
|
5675
|
-
}
|
|
5676
|
-
}
|
|
5677
|
-
return undefined;
|
|
5678
|
-
});
|
|
5679
|
-
var layerLocationId = (layerLocation == null ? void 0 : layerLocation.id) || '';
|
|
5680
|
-
var circleDrawFunctionId = useRef(registerDrawFunction(circleDrawFunction));
|
|
5681
5670
|
var handleLocationClick = function handleLocationClick() {
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
}));
|
|
5688
|
-
setIsLoading(false);
|
|
5689
|
-
} else if (navigator.geolocation && mapId && layerLocationId === '' && circleDrawFunctionId) {
|
|
5671
|
+
if (mapId && isSelected) {
|
|
5672
|
+
onUpdateMyLocation(undefined);
|
|
5673
|
+
} else if (navigator.geolocation && mapId && !isSelected) {
|
|
5674
|
+
setIsLoading(true);
|
|
5675
|
+
setHasFailed(false);
|
|
5690
5676
|
navigator.geolocation.getCurrentPosition(function (success) {
|
|
5691
5677
|
setIsLoading(false);
|
|
5692
|
-
setHasFailed(false);
|
|
5693
5678
|
var _success$coords = success.coords,
|
|
5694
5679
|
latitude = _success$coords.latitude,
|
|
5695
5680
|
longitude = _success$coords.longitude;
|
|
5696
|
-
var
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
drawFunctionId: circleDrawFunctionId.current
|
|
5703
|
-
},
|
|
5704
|
-
geometry: {
|
|
5705
|
-
type: 'Point',
|
|
5706
|
-
coordinates: [longitude, latitude]
|
|
5707
|
-
}
|
|
5708
|
-
}]
|
|
5681
|
+
var location = {
|
|
5682
|
+
lat: latitude,
|
|
5683
|
+
lon: longitude,
|
|
5684
|
+
name: MY_LOCATION,
|
|
5685
|
+
source: 'MyMapLocation',
|
|
5686
|
+
id: MY_LOCATION
|
|
5709
5687
|
};
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
mapId: mapId,
|
|
5713
|
-
layer: {
|
|
5714
|
-
geojson: geojson,
|
|
5715
|
-
layerType: LayerType.featureLayer
|
|
5716
|
-
},
|
|
5717
|
-
layerId: layerId,
|
|
5718
|
-
origin: MY_LOCATION
|
|
5719
|
-
}));
|
|
5720
|
-
var wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
5721
|
-
if (!wmjsMap) {
|
|
5722
|
-
return;
|
|
5723
|
-
}
|
|
5724
|
-
wmjsMap.calculateBoundingBoxAndZoom(latitude, longitude);
|
|
5725
|
-
}, function (error) {
|
|
5688
|
+
onUpdateMyLocation(location);
|
|
5689
|
+
}, function () {
|
|
5726
5690
|
setIsLoading(false);
|
|
5727
5691
|
setHasFailed(true);
|
|
5728
|
-
|
|
5729
|
-
error: error.message
|
|
5730
|
-
}));
|
|
5692
|
+
onUpdateMyLocation(undefined);
|
|
5731
5693
|
}, locationOptions);
|
|
5732
5694
|
}
|
|
5733
5695
|
};
|
|
5734
5696
|
var chooseIcon = function chooseIcon() {
|
|
5735
5697
|
return hasFailed ? jsx(Exclamation, {
|
|
5736
5698
|
style: {
|
|
5737
|
-
color:
|
|
5699
|
+
color: theme.palette.geowebColors.functional.error
|
|
5738
5700
|
},
|
|
5739
5701
|
"aria-label": "location error"
|
|
5740
5702
|
}) : jsx(MyLocation, {
|
|
5741
5703
|
"aria-label": "location default"
|
|
5742
5704
|
});
|
|
5743
5705
|
};
|
|
5744
|
-
return jsx(
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
return theme.palette.mode === 'light' ? '#1a90ff' : '#bad4ff';
|
|
5754
|
-
},
|
|
5755
|
-
padding: '8px'
|
|
5756
|
-
},
|
|
5757
|
-
thickness: 6,
|
|
5758
|
-
"aria-label": "location loading"
|
|
5759
|
-
}), jsx(CircularProgress, {
|
|
5760
|
-
variant: "indeterminate",
|
|
5761
|
-
disableShrink: true,
|
|
5762
|
-
sx: (_sx = {
|
|
5763
|
-
height: '100%',
|
|
5764
|
-
width: '100%',
|
|
5765
|
-
color: function color(theme) {
|
|
5766
|
-
return theme.palette.mode === 'light' ? '#bad4ff' : '#45556F';
|
|
5767
|
-
},
|
|
5768
|
-
animationDuration: '1000ms',
|
|
5769
|
-
position: 'absolute',
|
|
5770
|
-
left: 0
|
|
5771
|
-
}, _sx["& ." + circularProgressClasses.circle] = {
|
|
5772
|
-
strokeLinecap: 'round'
|
|
5773
|
-
}, _sx.padding = '8px', _sx),
|
|
5774
|
-
thickness: 6
|
|
5775
|
-
})]
|
|
5706
|
+
return jsx(Box, {
|
|
5707
|
+
sx: {
|
|
5708
|
+
height: 40,
|
|
5709
|
+
padding: 1
|
|
5710
|
+
},
|
|
5711
|
+
children: isLoading ? jsx(CircularProgress, {
|
|
5712
|
+
size: 24,
|
|
5713
|
+
"aria-label": "Location loading",
|
|
5714
|
+
color: "secondary"
|
|
5776
5715
|
}) : jsx(CustomIconButton, {
|
|
5777
|
-
|
|
5778
|
-
"aria-label":
|
|
5716
|
+
tooltipTitle: t('search-my-location'),
|
|
5717
|
+
"aria-label": t('search-my-location'),
|
|
5779
5718
|
onClick: handleLocationClick,
|
|
5780
|
-
isSelected:
|
|
5781
|
-
|
|
5719
|
+
isSelected: isSelected,
|
|
5720
|
+
variant: "tool",
|
|
5721
|
+
size: "small",
|
|
5782
5722
|
children: chooseIcon()
|
|
5783
5723
|
})
|
|
5784
5724
|
});
|
|
5785
5725
|
};
|
|
5786
5726
|
|
|
5727
|
+
/* *
|
|
5728
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5729
|
+
* you may not use this file except in compliance with the License.
|
|
5730
|
+
* You may obtain a copy of the License at
|
|
5731
|
+
*
|
|
5732
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5733
|
+
*
|
|
5734
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5735
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5736
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5737
|
+
* See the License for the specific language governing permissions and
|
|
5738
|
+
* limitations under the License.
|
|
5739
|
+
*
|
|
5740
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5741
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
5742
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
5743
|
+
* */
|
|
5744
|
+
var config = getConfig();
|
|
5745
|
+
var locationBaseUrl = config.GW_LOCATION_BASE_URL || '';
|
|
5746
|
+
var getLocationList = function getLocationList(search) {
|
|
5747
|
+
return fetch(locationBaseUrl + "/locations?search=" + search).then(handleResponse);
|
|
5748
|
+
};
|
|
5749
|
+
var getLocationDetail = function getLocationDetail(id, source) {
|
|
5750
|
+
return fetch(locationBaseUrl + "/locationdetail?id=" + id + "&source=" + source).then(handleResponse);
|
|
5751
|
+
};
|
|
5752
|
+
|
|
5753
|
+
/* *
|
|
5754
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5755
|
+
* you may not use this file except in compliance with the License.
|
|
5756
|
+
* You may obtain a copy of the License at
|
|
5757
|
+
*
|
|
5758
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5759
|
+
*
|
|
5760
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5761
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5762
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5763
|
+
* See the License for the specific language governing permissions and
|
|
5764
|
+
* limitations under the License.
|
|
5765
|
+
*
|
|
5766
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5767
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
5768
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
5769
|
+
* */
|
|
5770
|
+
var useLocationList = function useLocationList(search) {
|
|
5771
|
+
return useQuery({
|
|
5772
|
+
queryKey: ['location-list', search],
|
|
5773
|
+
queryFn: function queryFn() {
|
|
5774
|
+
return getLocationList(search);
|
|
5775
|
+
}
|
|
5776
|
+
});
|
|
5777
|
+
};
|
|
5778
|
+
var useLocationDetail = function useLocationDetail(id, source) {
|
|
5779
|
+
if (id === void 0) {
|
|
5780
|
+
id = '';
|
|
5781
|
+
}
|
|
5782
|
+
if (source === void 0) {
|
|
5783
|
+
source = '';
|
|
5784
|
+
}
|
|
5785
|
+
return useQuery({
|
|
5786
|
+
queryKey: ['location-detail', {
|
|
5787
|
+
id: id,
|
|
5788
|
+
source: source
|
|
5789
|
+
}],
|
|
5790
|
+
queryFn: function queryFn() {
|
|
5791
|
+
return getLocationDetail(id, source);
|
|
5792
|
+
},
|
|
5793
|
+
enabled: !!id
|
|
5794
|
+
});
|
|
5795
|
+
};
|
|
5796
|
+
|
|
5787
5797
|
var SearchDialog = function SearchDialog(_ref) {
|
|
5788
5798
|
var isOpen = _ref.isOpen,
|
|
5789
|
-
onClose = _ref.onClose,
|
|
5790
5799
|
_ref$mapId = _ref.mapId,
|
|
5791
|
-
mapId = _ref$mapId === void 0 ? '' : _ref$mapId
|
|
5800
|
+
mapId = _ref$mapId === void 0 ? '' : _ref$mapId,
|
|
5801
|
+
_ref$onSelectLocation = _ref.onSelectLocation,
|
|
5802
|
+
onSelectLocation = _ref$onSelectLocation === void 0 ? function () {} : _ref$onSelectLocation,
|
|
5803
|
+
_ref$onUpdateMyLocati = _ref.onUpdateMyLocation,
|
|
5804
|
+
onUpdateMyLocation = _ref$onUpdateMyLocati === void 0 ? function () {} : _ref$onUpdateMyLocati,
|
|
5805
|
+
_ref$isMyLocationSele = _ref.isMyLocationSelected,
|
|
5806
|
+
isMyLocationSelected = _ref$isMyLocationSele === void 0 ? false : _ref$isMyLocationSele;
|
|
5807
|
+
var theme = useTheme();
|
|
5792
5808
|
var _useCoreTranslation = useCoreTranslation(),
|
|
5793
5809
|
t = _useCoreTranslation.t;
|
|
5794
|
-
var _useState = useState(
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
var _useState2 = useState(
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5810
|
+
var _useState = useState(''),
|
|
5811
|
+
inputValue = _useState[0],
|
|
5812
|
+
setInputValue = _useState[1];
|
|
5813
|
+
var _useState2 = useState(null),
|
|
5814
|
+
selectedValue = _useState2[0],
|
|
5815
|
+
setSelectedValue = _useState2[1];
|
|
5816
|
+
var debouncedInputValue = useDebounce(inputValue, 300);
|
|
5817
|
+
var _useLocationList = useLocationList(debouncedInputValue),
|
|
5818
|
+
locationListData = _useLocationList.data;
|
|
5819
|
+
var _useLocationDetail = useLocationDetail(selectedValue == null ? void 0 : selectedValue.id, selectedValue == null ? void 0 : selectedValue.source),
|
|
5820
|
+
locationDetail = _useLocationDetail.data,
|
|
5821
|
+
isFetchingDetail = _useLocationDetail.isFetching;
|
|
5822
|
+
useEffect(function () {
|
|
5823
|
+
if (isFetchingDetail) {
|
|
5824
|
+
return;
|
|
5825
|
+
}
|
|
5826
|
+
onSelectLocation(selectedValue ? locationDetail : undefined);
|
|
5827
|
+
}, [locationDetail, onSelectLocation, selectedValue, isFetchingDetail]);
|
|
5828
|
+
return isOpen && mapId ? jsxs(Box, {
|
|
5801
5829
|
sx: {
|
|
5802
5830
|
display: 'flex',
|
|
5803
5831
|
flexDirection: 'row',
|
|
5804
5832
|
alignItems: 'center',
|
|
5805
5833
|
position: 'absolute',
|
|
5806
5834
|
pointerEvents: 'all',
|
|
5807
|
-
zIndex:
|
|
5835
|
+
zIndex: 99,
|
|
5808
5836
|
left: 50,
|
|
5809
|
-
top:
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5837
|
+
top: 8,
|
|
5838
|
+
backgroundColor: theme.palette.geowebColors.textInputField["default"].fill,
|
|
5839
|
+
height: 40,
|
|
5840
|
+
boxShadow: theme.shadows[6],
|
|
5841
|
+
width: 'calc(100% - 50px)',
|
|
5842
|
+
maxWidth: 380
|
|
5814
5843
|
},
|
|
5815
5844
|
children: [jsx(MyMapLocation, {
|
|
5816
5845
|
mapId: mapId,
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5846
|
+
onUpdateMyLocation: onUpdateMyLocation,
|
|
5847
|
+
isSelected: isMyLocationSelected
|
|
5848
|
+
}), jsx(Autocomplete, {
|
|
5849
|
+
disablePortal: true,
|
|
5850
|
+
selectOnFocus: true,
|
|
5851
|
+
sx: {
|
|
5852
|
+
width: '100%',
|
|
5853
|
+
'&.MuiAutocomplete-root .MuiFilledInput-root': {
|
|
5854
|
+
height: 40,
|
|
5855
|
+
padding: '0px!important',
|
|
5856
|
+
'&:before, &:hover:before': {
|
|
5857
|
+
borderColor: 'transparent'
|
|
5858
|
+
}
|
|
5859
|
+
},
|
|
5860
|
+
'&.MuiAutocomplete-root .MuiInputLabel-root': {
|
|
5861
|
+
lineHeight: '16px',
|
|
5862
|
+
maxWidth: 'calc(100% - 40px)',
|
|
5863
|
+
':not(.MuiInputLabel-shrink)': {
|
|
5864
|
+
transform: 'translate(12px, 12px) scale(1)'
|
|
5865
|
+
}
|
|
5866
|
+
},
|
|
5867
|
+
'&.MuiAutocomplete-root .MuiFilledInput-input': {
|
|
5868
|
+
lineHeight: '20px',
|
|
5869
|
+
paddingLeft: '12px',
|
|
5870
|
+
paddingTop: '20px'
|
|
5871
|
+
}
|
|
5872
|
+
},
|
|
5873
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
5874
|
+
return option.name;
|
|
5875
|
+
},
|
|
5876
|
+
filterOptions: function filterOptions(x) {
|
|
5877
|
+
return x;
|
|
5878
|
+
},
|
|
5879
|
+
options: locationListData || [],
|
|
5880
|
+
noOptionsText: t('search-no-results'),
|
|
5881
|
+
popupIcon: null,
|
|
5882
|
+
clearIcon: null,
|
|
5883
|
+
onChange: function onChange(_event, newValue) {
|
|
5884
|
+
if (newValue && typeof newValue !== 'string') {
|
|
5885
|
+
setSelectedValue(newValue);
|
|
5886
|
+
setInputValue(newValue.name);
|
|
5887
|
+
}
|
|
5888
|
+
},
|
|
5889
|
+
value: selectedValue,
|
|
5890
|
+
inputValue: inputValue,
|
|
5891
|
+
isOptionEqualToValue: function isOptionEqualToValue(option, value) {
|
|
5892
|
+
return option.id === value.id;
|
|
5893
|
+
},
|
|
5894
|
+
renderInput: function renderInput(params) {
|
|
5895
|
+
return jsx(TextField, Object.assign({}, params, {
|
|
5896
|
+
autoFocus: true,
|
|
5897
|
+
size: "medium",
|
|
5898
|
+
label: t('search-title-long'),
|
|
5899
|
+
fullWidth: true,
|
|
5900
|
+
variant: "filled",
|
|
5901
|
+
onChange: function onChange(event) {
|
|
5902
|
+
setInputValue(event.target.value);
|
|
5903
|
+
if (selectedValue) {
|
|
5904
|
+
setSelectedValue(null);
|
|
5905
|
+
}
|
|
5906
|
+
},
|
|
5907
|
+
InputProps: Object.assign({}, params.InputProps, {
|
|
5908
|
+
endAdornment: jsx(CustomIconButton, {
|
|
5909
|
+
tooltipTitle: t('search-clear'),
|
|
5910
|
+
onClick: function onClick() {
|
|
5911
|
+
setInputValue('');
|
|
5912
|
+
setSelectedValue(null);
|
|
5913
|
+
},
|
|
5914
|
+
sx: {
|
|
5915
|
+
marginRight: 1
|
|
5916
|
+
},
|
|
5835
5917
|
children: jsx(Close, {})
|
|
5836
5918
|
})
|
|
5837
5919
|
})
|
|
5838
|
-
}
|
|
5920
|
+
}));
|
|
5839
5921
|
}
|
|
5840
5922
|
})]
|
|
5841
5923
|
}) : null;
|
|
5842
5924
|
};
|
|
5843
5925
|
|
|
5844
|
-
|
|
5845
|
-
|
|
5926
|
+
/* *
|
|
5927
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5928
|
+
* you may not use this file except in compliance with the License.
|
|
5929
|
+
* You may obtain a copy of the License at
|
|
5930
|
+
*
|
|
5931
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5932
|
+
*
|
|
5933
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5934
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5935
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5936
|
+
* See the License for the specific language governing permissions and
|
|
5937
|
+
* limitations under the License.
|
|
5938
|
+
*
|
|
5939
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5940
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
5941
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
5942
|
+
* */
|
|
5943
|
+
var myLocationDrawFunction = function myLocationDrawFunction(args) {
|
|
5944
|
+
var ctx = args.context,
|
|
5945
|
+
coord = args.coord;
|
|
5946
|
+
// Draw outer circle
|
|
5947
|
+
ctx.strokeStyle = '#fff';
|
|
5948
|
+
ctx.fillStyle = '#fff';
|
|
5949
|
+
ctx.shadowColor = '#00000080';
|
|
5950
|
+
ctx.shadowBlur = 4;
|
|
5951
|
+
ctx.beginPath();
|
|
5952
|
+
ctx.arc(coord.x, coord.y, 14, 0, 2 * Math.PI);
|
|
5953
|
+
ctx.fill();
|
|
5954
|
+
ctx.shadowBlur = 0;
|
|
5955
|
+
// Draw inner circle
|
|
5956
|
+
ctx.fillStyle = '#186dff';
|
|
5957
|
+
ctx.beginPath();
|
|
5958
|
+
ctx.arc(coord.x, coord.y, 10, 0, 2 * Math.PI);
|
|
5959
|
+
ctx.fill();
|
|
5960
|
+
};
|
|
5961
|
+
var selectedLocationDrawFunction = function selectedLocationDrawFunction(args) {
|
|
5962
|
+
var ctx = args.context,
|
|
5963
|
+
coord = args.coord;
|
|
5964
|
+
ctx.strokeStyle = '#051039';
|
|
5965
|
+
ctx.fillStyle = '#051039';
|
|
5966
|
+
ctx.beginPath();
|
|
5967
|
+
var topRadius = 7;
|
|
5968
|
+
var topHeight = 2 * topRadius;
|
|
5969
|
+
ctx.arc(coord.x, coord.y - topHeight, topRadius, Math.PI, Math.PI * 2);
|
|
5970
|
+
ctx.bezierCurveTo(coord.x + topRadius, coord.y - topHeight, coord.x + topRadius / 1.6, coord.y - topRadius, coord.x, coord.y);
|
|
5971
|
+
ctx.bezierCurveTo(coord.x, coord.y, coord.x - topRadius / 1.6, coord.y - topRadius, coord.x - topRadius, coord.y - topHeight);
|
|
5972
|
+
ctx.stroke();
|
|
5973
|
+
ctx.fill();
|
|
5974
|
+
/* Fill center circle */
|
|
5975
|
+
ctx.fillStyle = '#FFF';
|
|
5976
|
+
ctx.beginPath();
|
|
5977
|
+
ctx.arc(coord.x, coord.y - topHeight, topRadius / 2.5, Math.PI * 2, 0);
|
|
5978
|
+
ctx.fill();
|
|
5979
|
+
};
|
|
5980
|
+
var geometryStyling = {
|
|
5981
|
+
fill: '#FF7800',
|
|
5982
|
+
'fill-opacity': 0.25,
|
|
5983
|
+
stroke: '#FF7800',
|
|
5984
|
+
'stroke-opacity': 1,
|
|
5985
|
+
'stroke-width': 4
|
|
5986
|
+
};
|
|
5987
|
+
var makeGeoJSONFeatureFromLocation = function makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId, mapFeatureClass) {
|
|
5988
|
+
var _location$geometry;
|
|
5989
|
+
var collection = {
|
|
5990
|
+
type: 'FeatureCollection',
|
|
5991
|
+
features: []
|
|
5992
|
+
};
|
|
5993
|
+
var geometry = Object.assign({}, location.geometry, {
|
|
5994
|
+
properties: Object.assign({}, geometryStyling, {
|
|
5995
|
+
name: location.name,
|
|
5996
|
+
hoverDrawFunctionId: hoverDrawFunctionId
|
|
5997
|
+
})
|
|
5998
|
+
});
|
|
5999
|
+
var marker = {
|
|
6000
|
+
type: 'Feature',
|
|
6001
|
+
properties: {
|
|
6002
|
+
name: location.name,
|
|
6003
|
+
drawFunctionId: drawFunctionId,
|
|
6004
|
+
hoverDrawFunctionId: hoverDrawFunctionId,
|
|
6005
|
+
mapFeatureClass: mapFeatureClass
|
|
6006
|
+
},
|
|
6007
|
+
geometry: {
|
|
6008
|
+
type: 'Point',
|
|
6009
|
+
coordinates: [location.lon, location.lat]
|
|
6010
|
+
}
|
|
6011
|
+
};
|
|
6012
|
+
switch ((_location$geometry = location.geometry) == null ? void 0 : _location$geometry.geometry.type) {
|
|
6013
|
+
case 'Point':
|
|
6014
|
+
case 'MultiLineString':
|
|
6015
|
+
case undefined:
|
|
6016
|
+
collection.features.push(marker);
|
|
6017
|
+
break;
|
|
6018
|
+
default:
|
|
6019
|
+
collection.features.push(geometry);
|
|
6020
|
+
}
|
|
6021
|
+
return collection;
|
|
6022
|
+
};
|
|
6023
|
+
var fitText = function fitText(ctx, text, x, y, lineheight) {
|
|
6024
|
+
var lines = text.split('\n');
|
|
6025
|
+
for (var i = 0; i < lines.length; i += 1) {
|
|
6026
|
+
ctx.fillText(lines[i], x, y + i * lineheight);
|
|
6027
|
+
}
|
|
6028
|
+
};
|
|
6029
|
+
var roundRect = function roundRect(ctx, w, h, x, y, radius) {
|
|
6030
|
+
if (radius === void 0) {
|
|
6031
|
+
radius = 2;
|
|
6032
|
+
}
|
|
6033
|
+
var r = x + w;
|
|
6034
|
+
var b = y + h;
|
|
6035
|
+
ctx.beginPath();
|
|
6036
|
+
ctx.moveTo(x + radius, y);
|
|
6037
|
+
ctx.lineTo(r - radius, y);
|
|
6038
|
+
ctx.quadraticCurveTo(r, y, r, y + radius);
|
|
6039
|
+
ctx.lineTo(r, y + h - radius);
|
|
6040
|
+
ctx.quadraticCurveTo(r, b, r - radius, b);
|
|
6041
|
+
ctx.lineTo(x + radius, b);
|
|
6042
|
+
ctx.quadraticCurveTo(x, b, x, b - radius);
|
|
6043
|
+
ctx.lineTo(x, y + radius);
|
|
6044
|
+
ctx.quadraticCurveTo(x, y, x + radius, y);
|
|
6045
|
+
ctx.stroke();
|
|
6046
|
+
ctx.fill();
|
|
6047
|
+
};
|
|
6048
|
+
var hoverDrawFunction = function hoverDrawFunction(args) {
|
|
6049
|
+
var ctx = args.context,
|
|
6050
|
+
coord = args.coord,
|
|
6051
|
+
feature = args.feature;
|
|
6052
|
+
var fontSize = 16;
|
|
6053
|
+
var padding = 20;
|
|
6054
|
+
// eslint-disable-next-line no-param-reassign
|
|
6055
|
+
ctx.font = fontSize + "px Roboto";
|
|
6056
|
+
var x = coord.x,
|
|
6057
|
+
y = coord.y;
|
|
6058
|
+
ctx.strokeStyle = '#000';
|
|
6059
|
+
ctx.fillStyle = '#000';
|
|
6060
|
+
roundRect(ctx, ctx.measureText(feature.properties.name).width + padding, fontSize + padding, x - padding * 0.5 - ctx.measureText(feature.properties.name).width * 0.5, y + padding);
|
|
6061
|
+
// eslint-disable-next-line no-param-reassign
|
|
6062
|
+
ctx.fillStyle = '#FFF';
|
|
6063
|
+
// eslint-disable-next-line no-param-reassign
|
|
6064
|
+
ctx.textAlign = 'left';
|
|
6065
|
+
if (feature && feature.properties) {
|
|
6066
|
+
fitText(ctx, feature.properties.name, x - ctx.measureText(feature.properties.name).width * 0.5, y + padding * 2, fontSize);
|
|
6067
|
+
}
|
|
6068
|
+
};
|
|
6069
|
+
var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
|
|
6070
|
+
var dispatch = useDispatch();
|
|
6071
|
+
var _useContext = useContext(MapContext),
|
|
6072
|
+
map = _useContext.map;
|
|
6073
|
+
var layerIdRef = React__default.useRef();
|
|
6074
|
+
React__default.useEffect(function () {
|
|
6075
|
+
layerIdRef.current = generateLayerId();
|
|
6076
|
+
}, []);
|
|
6077
|
+
var layerId = layerIdRef.current;
|
|
6078
|
+
var isMapPresent = useSelector(function (store) {
|
|
6079
|
+
return mapSelectors.getIsMapPresent(store, mapId);
|
|
6080
|
+
});
|
|
6081
|
+
var isLayerPresent = useSelector(function (store) {
|
|
6082
|
+
return layerSelectors.getIsLayerPresent(store, layerIdRef.current);
|
|
6083
|
+
});
|
|
6084
|
+
var shouldAddLayer = isMapPresent && !isLayerPresent && layerId;
|
|
6085
|
+
React__default.useEffect(function () {
|
|
6086
|
+
if (shouldAddLayer) {
|
|
6087
|
+
dispatch(layerActions.addLayer({
|
|
6088
|
+
mapId: mapId,
|
|
6089
|
+
layerId: layerId,
|
|
6090
|
+
layer: {
|
|
6091
|
+
geojson: emptyGeoJSON,
|
|
6092
|
+
layerType: LayerType.featureLayer
|
|
6093
|
+
},
|
|
6094
|
+
origin: 'SearchDialogConnect'
|
|
6095
|
+
}));
|
|
6096
|
+
}
|
|
6097
|
+
}, [dispatch, layerId, mapId, shouldAddLayer]);
|
|
6098
|
+
var drawFunctionId = React__default.useRef(registerDrawFunction(drawFunction)).current;
|
|
6099
|
+
var hoverDrawFunctionId = React__default.useRef(registerDrawFunction(hoverDrawFunction)).current;
|
|
6100
|
+
var updateGeoJSON = React__default.useCallback(function (location) {
|
|
6101
|
+
var mapFeatureClass = (location == null ? void 0 : location.source) === 'MyMapLocation' ? MapFeatureClass.MyLocation : MapFeatureClass.GenericMarker;
|
|
6102
|
+
var geojson = location ? makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId, mapFeatureClass) : emptyGeoJSON;
|
|
6103
|
+
dispatch(layerActions.updateFeature({
|
|
6104
|
+
layerId: layerId,
|
|
6105
|
+
geojson: geojson
|
|
6106
|
+
}));
|
|
6107
|
+
}, [dispatch, drawFunctionId, hoverDrawFunctionId, layerId]);
|
|
6108
|
+
var zoomToFeature = React__default.useCallback(function (location) {
|
|
6109
|
+
var webMap = getWMJSMapById(mapId);
|
|
6110
|
+
if (webMap) {
|
|
6111
|
+
webMap.calculateBoundingBoxAndZoom(location.lat, location.lon);
|
|
6112
|
+
} else if (map) {
|
|
6113
|
+
setMapCenter(map, location.lon, location.lat);
|
|
6114
|
+
}
|
|
6115
|
+
}, [mapId, map]);
|
|
6116
|
+
var onUpdateLocation = React__default.useCallback(function (location) {
|
|
6117
|
+
updateGeoJSON(location);
|
|
6118
|
+
if (location) {
|
|
6119
|
+
zoomToFeature(location);
|
|
6120
|
+
}
|
|
6121
|
+
}, [updateGeoJSON, zoomToFeature]);
|
|
6122
|
+
return [onUpdateLocation];
|
|
6123
|
+
};
|
|
6124
|
+
|
|
6125
|
+
var SearchDialogConnect = function SearchDialogConnect(_ref) {
|
|
6126
|
+
var _ref$mapId = _ref.mapId,
|
|
6127
|
+
mapId = _ref$mapId === void 0 ? '' : _ref$mapId;
|
|
5846
6128
|
var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
|
|
5847
6129
|
var _useSetupDialog = useSetupDialog(dialogType),
|
|
5848
|
-
isDialogOpen = _useSetupDialog.isDialogOpen
|
|
5849
|
-
|
|
6130
|
+
isDialogOpen = _useSetupDialog.isDialogOpen;
|
|
6131
|
+
var _useDrawOnMap = useDrawOnMap(mapId, selectedLocationDrawFunction),
|
|
6132
|
+
updateMapPin = _useDrawOnMap[0];
|
|
6133
|
+
var _useDrawOnMap2 = useDrawOnMap(mapId, myLocationDrawFunction),
|
|
6134
|
+
updateMyLocation = _useDrawOnMap2[0];
|
|
6135
|
+
var mapLayers = useSelector(function (store) {
|
|
6136
|
+
return layerSelectors.getLayersByMapId(store, mapId);
|
|
6137
|
+
});
|
|
6138
|
+
var myLocationLayer = mapLayers.find(function (layer) {
|
|
6139
|
+
var _layer$geojson;
|
|
6140
|
+
if ((_layer$geojson = layer.geojson) != null && (_layer$geojson = _layer$geojson.features[0]) != null && (_layer$geojson = _layer$geojson.properties) != null && _layer$geojson.name) {
|
|
6141
|
+
if (layer.geojson.features[0].properties.name === MY_LOCATION) {
|
|
6142
|
+
return true;
|
|
6143
|
+
}
|
|
6144
|
+
}
|
|
6145
|
+
return false;
|
|
6146
|
+
});
|
|
6147
|
+
var isMyLocationSelected = !!myLocationLayer;
|
|
5850
6148
|
return jsx(SearchDialog, {
|
|
5851
6149
|
isOpen: isDialogOpen,
|
|
5852
|
-
|
|
5853
|
-
|
|
6150
|
+
mapId: mapId,
|
|
6151
|
+
onSelectLocation: updateMapPin,
|
|
6152
|
+
onUpdateMyLocation: updateMyLocation,
|
|
6153
|
+
isMyLocationSelected: isMyLocationSelected
|
|
5854
6154
|
});
|
|
5855
6155
|
};
|
|
5856
6156
|
|
|
@@ -6002,30 +6302,50 @@ var getTitle = function getTitle(layerId) {
|
|
|
6002
6302
|
var wmjsLayer = webmapUtils.getWMLayerById(layerId);
|
|
6003
6303
|
return wmjsLayer ? wmjsLayer.title || wmjsLayer.name : layerId;
|
|
6004
6304
|
};
|
|
6305
|
+
var getFeatureInfoUrl = function getFeatureInfoUrl(layer, wmjsMap, mapPinLocation) {
|
|
6306
|
+
/*
|
|
6307
|
+
We need a wmjsLayer to build the getfeatureinfo url (getWMSGetFeatureInfoRequestURL function).
|
|
6308
|
+
But it seems that its dimension are lazely updated (by ReactMapView).
|
|
6309
|
+
Therefore make a clone of this layer and set its dimensions based on the layer object.
|
|
6310
|
+
Otherwise we risk making a getfeatureinfo call with outdated dimension values.
|
|
6311
|
+
*/
|
|
6312
|
+
var wmjsLayer = webmapUtils.getWMLayerById(layer.id).cloneLayer();
|
|
6313
|
+
if (wmjsMap) {
|
|
6314
|
+
// WebMapJS version
|
|
6315
|
+
return getWMSGetFeatureInfoRequestURL(wmjsLayer, wmjsMap.getMapPin().getXY().x, wmjsMap.getMapPin().getXY().y, 'text/html');
|
|
6316
|
+
}
|
|
6317
|
+
if (mapPinLocation) {
|
|
6318
|
+
// OpenLayers WMS version
|
|
6319
|
+
var source = new ImageWMS({
|
|
6320
|
+
url: wmjsLayer.getmapURL,
|
|
6321
|
+
params: {
|
|
6322
|
+
LAYERS: wmjsLayer.getLayerName()
|
|
6323
|
+
}
|
|
6324
|
+
});
|
|
6325
|
+
return source.getFeatureInfoUrl([mapPinLocation.projectionX, mapPinLocation.projectionY], mapPinLocation.resolution, mapPinLocation.srs, {
|
|
6326
|
+
INFO_FORMAT: 'text/html'
|
|
6327
|
+
}) + "&" + getMapDimURL(wmjsLayer).toString();
|
|
6328
|
+
}
|
|
6329
|
+
return undefined;
|
|
6330
|
+
};
|
|
6005
6331
|
/**
|
|
6006
6332
|
* Make a list of GFI Layers to display.
|
|
6007
6333
|
* @param layers
|
|
6008
6334
|
* @param mapId
|
|
6009
6335
|
* @returns
|
|
6010
6336
|
*/
|
|
6011
|
-
var getLayersToUpdate = function getLayersToUpdate(layers, mapId) {
|
|
6337
|
+
var getLayersToUpdate = function getLayersToUpdate(mapPinLocation, layers, mapId) {
|
|
6012
6338
|
var wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
6013
|
-
if (!
|
|
6339
|
+
if (!layers || layers.length === 0 || !wmjsMap && !mapPinLocation) {
|
|
6014
6340
|
return [];
|
|
6015
6341
|
}
|
|
6016
6342
|
return layers.filter(function (layer) {
|
|
6017
6343
|
return layer && layer.enabled && !!webmapUtils.getWMLayerById(layer.id);
|
|
6018
6344
|
}).map(function (layer) {
|
|
6019
|
-
|
|
6020
|
-
We need a wmjsLayer to build the getfeatureinfo url (getWMSGetFeatureInfoRequestURL function).
|
|
6021
|
-
But it seems that its dimension are lazely updated (by ReactMapView).
|
|
6022
|
-
Therefore make a clone of this layer and set its dimensions based on the layer object.
|
|
6023
|
-
Otherwise we risk making a getfeatureinfo call with outdated dimension values.
|
|
6024
|
-
*/
|
|
6025
|
-
var wmjsLayer = webmapUtils.getWMLayerById(layer.id).cloneLayer();
|
|
6345
|
+
var url = getFeatureInfoUrl(layer, wmjsMap, mapPinLocation);
|
|
6026
6346
|
return {
|
|
6027
6347
|
layerId: layer.id,
|
|
6028
|
-
url:
|
|
6348
|
+
url: url,
|
|
6029
6349
|
title: getTitle(layer.id)
|
|
6030
6350
|
};
|
|
6031
6351
|
});
|
|
@@ -6093,7 +6413,7 @@ var GetFeatureInfoDialog = function GetFeatureInfoDialog(_ref) {
|
|
|
6093
6413
|
triggerRerender("" + layerId + isLoading);
|
|
6094
6414
|
};
|
|
6095
6415
|
/* Build a layerlist array with a set of arguments per layer to do the query for */
|
|
6096
|
-
var layerToUpdateList = isOpen ? getLayersToUpdate(layers, mapId) : [];
|
|
6416
|
+
var layerToUpdateList = isOpen && mapPinLocation ? getLayersToUpdate(mapPinLocation, layers, mapId) : [];
|
|
6097
6417
|
/*
|
|
6098
6418
|
Build a string based on the GFI urls. If this changes for whatever reason we need to update.
|
|
6099
6419
|
These strings can change very often, therefore they need to be debounced and only use the most recent result must be used.
|
|
@@ -6336,7 +6656,7 @@ var GetFeatureInfoButtonConnect = function GetFeatureInfoButtonConnect(_ref) {
|
|
|
6336
6656
|
});
|
|
6337
6657
|
};
|
|
6338
6658
|
|
|
6339
|
-
var _excluded$1 = ["mapId", "children", "controls"];
|
|
6659
|
+
var _excluded$1 = ["mapId", "children", "controls", "initialBbox"];
|
|
6340
6660
|
var ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION = 'ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION';
|
|
6341
6661
|
/**
|
|
6342
6662
|
* Connected component used to display the map and selected layers.
|
|
@@ -6358,8 +6678,9 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
6358
6678
|
controls = _ref$controls === void 0 ? {
|
|
6359
6679
|
mapControlsPositionTop: 0,
|
|
6360
6680
|
zoomControls: true
|
|
6361
|
-
} : _ref$controls
|
|
6362
|
-
|
|
6681
|
+
} : _ref$controls;
|
|
6682
|
+
_ref.initialBbox;
|
|
6683
|
+
var props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
6363
6684
|
var mapRef = React.useRef(null);
|
|
6364
6685
|
var store = useStore();
|
|
6365
6686
|
var mapDimensions = useSelector(function (store) {
|
|
@@ -6477,26 +6798,26 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
6477
6798
|
var geojson = _ref2.geojson,
|
|
6478
6799
|
reason = _ref2.reason,
|
|
6479
6800
|
layerId = _ref2.layerId;
|
|
6480
|
-
var activeDrawToolId =
|
|
6481
|
-
var activeDrawMode =
|
|
6801
|
+
var activeDrawToolId = drawingToolSelectors.getActiveDrawToolId(store.getState());
|
|
6802
|
+
var activeDrawMode = drawingToolSelectors.getActiveDrawMode(store.getState(), activeDrawToolId);
|
|
6482
6803
|
dispatch(layerActions.updateFeature({
|
|
6483
6804
|
geojson: geojson,
|
|
6484
6805
|
reason: reason,
|
|
6485
6806
|
layerId: layerId,
|
|
6486
|
-
shouldAllowMultipleShapes:
|
|
6487
|
-
geoJSONIntersectionLayerId:
|
|
6488
|
-
geoJSONIntersectionBoundsLayerId:
|
|
6807
|
+
shouldAllowMultipleShapes: drawingToolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId),
|
|
6808
|
+
geoJSONIntersectionLayerId: drawingToolSelectors.getGeoJSONIntersectionLayerId(store.getState(), activeDrawToolId),
|
|
6809
|
+
geoJSONIntersectionBoundsLayerId: drawingToolSelectors.getGeoJSONIntersectionBoundsLayerId(store.getState(), activeDrawToolId),
|
|
6489
6810
|
selectionType: activeDrawMode == null ? void 0 : activeDrawMode.selectionType
|
|
6490
6811
|
}));
|
|
6491
6812
|
}, [dispatch, store]);
|
|
6492
6813
|
var exitFeatureDrawMode = React.useCallback(function (_ref3) {
|
|
6493
6814
|
var reason = _ref3.reason,
|
|
6494
6815
|
layerId = _ref3.layerId;
|
|
6495
|
-
var activeDrawToolId =
|
|
6816
|
+
var activeDrawToolId = drawingToolSelectors.getActiveDrawToolId(store.getState());
|
|
6496
6817
|
dispatch(layerActions.exitFeatureDrawMode({
|
|
6497
6818
|
reason: reason,
|
|
6498
6819
|
layerId: layerId,
|
|
6499
|
-
shouldAllowMultipleShapes:
|
|
6820
|
+
shouldAllowMultipleShapes: drawingToolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId)
|
|
6500
6821
|
}));
|
|
6501
6822
|
}, [dispatch, store]);
|
|
6502
6823
|
var isActiveWindowId = useSelector(function (store) {
|
|
@@ -6596,174 +6917,769 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
6596
6917
|
value: handleDateUtilsISOString(mapDimensionPayload.dimension.currentValue)
|
|
6597
6918
|
});
|
|
6598
6919
|
} else {
|
|
6599
|
-
mapChangeDimension(mapDimensionPayload);
|
|
6920
|
+
mapChangeDimension(mapDimensionPayload);
|
|
6921
|
+
}
|
|
6922
|
+
},
|
|
6923
|
+
onUpdateLayerInformation: updateLayerInformation,
|
|
6924
|
+
onMapPinChangeLocation: mapPinChangeLocation,
|
|
6925
|
+
onMapZoomEnd: function onMapZoomEnd(a) {
|
|
6926
|
+
genericSetBbox({
|
|
6927
|
+
bbox: a.bbox,
|
|
6928
|
+
srs: a.srs,
|
|
6929
|
+
sourceId: mapId,
|
|
6930
|
+
origin: mapEnums.MapActionOrigin.map,
|
|
6931
|
+
mapId: mapId
|
|
6932
|
+
});
|
|
6933
|
+
},
|
|
6934
|
+
onWMJSMount: function onWMJSMount(mapId) {
|
|
6935
|
+
var wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
6936
|
+
if (!wmjsMap) {
|
|
6937
|
+
return;
|
|
6938
|
+
}
|
|
6939
|
+
wmjsMap.getListener().addEventListener('onloadstart', onGetMapLoadStart);
|
|
6940
|
+
wmjsMap.getListener().addEventListener('onloadready', onGetMapLoadReady);
|
|
6941
|
+
wmServiceListener.addEventListener(EVENT_GETCAPABILITIES_START, onGetCapabilitiesLoadStart, true);
|
|
6942
|
+
wmServiceListener.addEventListener(EVENT_GETCAPABILITIES_READY, onGetCapabilitiesLoadReady, true);
|
|
6943
|
+
},
|
|
6944
|
+
onWMJSUnMount: function onWMJSUnMount(mapId) {
|
|
6945
|
+
unRegister(mapId);
|
|
6946
|
+
wmServiceListener.removeEventListener(EVENT_GETCAPABILITIES_START, onGetCapabilitiesLoadStart);
|
|
6947
|
+
wmServiceListener.removeEventListener(EVENT_GETCAPABILITIES_READY, onGetCapabilitiesLoadReady);
|
|
6948
|
+
},
|
|
6949
|
+
children: [baseLayers.map(function (layer) {
|
|
6950
|
+
return jsx(MapViewLayer, Object.assign({
|
|
6951
|
+
id: "baselayer-" + layer.id,
|
|
6952
|
+
onLayerError: function onLayerError(_, error) {
|
|
6953
|
+
layerError({
|
|
6954
|
+
layerId: layer.id,
|
|
6955
|
+
error: Error("" + error)
|
|
6956
|
+
});
|
|
6957
|
+
}
|
|
6958
|
+
}, layer), layer.id);
|
|
6959
|
+
}), layers.map(function (layer) {
|
|
6960
|
+
return jsx(MapViewLayer, Object.assign({
|
|
6961
|
+
id: "layer-" + layer.id,
|
|
6962
|
+
onLayerError: function onLayerError(_, error) {
|
|
6963
|
+
layerError({
|
|
6964
|
+
layerId: layer.id,
|
|
6965
|
+
error: Error("" + error)
|
|
6966
|
+
});
|
|
6967
|
+
}
|
|
6968
|
+
}, layer), layer.id);
|
|
6969
|
+
}), (_linkedFeatures$conca = linkedFeatures.concat(linkedFormFeatures)) == null ? void 0 : _linkedFeatures$conca.map(function (feature) {
|
|
6970
|
+
return jsx(MapViewLayer, {
|
|
6971
|
+
id: feature.id,
|
|
6972
|
+
geojson: feature == null ? void 0 : feature.geoJSON,
|
|
6973
|
+
onHoverFeature: function onHoverFeature(hoverInfo) {
|
|
6974
|
+
if (hoverInfo === undefined && hoverId !== undefined) {
|
|
6975
|
+
debouncedSetHoverFeature();
|
|
6976
|
+
} else if (hoverInfo != null && hoverInfo.feature && feature.originalId !== hoverId) {
|
|
6977
|
+
debouncedSetHoverFeature(feature.originalId);
|
|
6978
|
+
}
|
|
6979
|
+
},
|
|
6980
|
+
onClickFeature: function onClickFeature(event) {
|
|
6981
|
+
var _event$feature$proper;
|
|
6982
|
+
var isClickOutsideFeature = !event || !event.feature;
|
|
6983
|
+
if (isClickOutsideFeature) {
|
|
6984
|
+
if (mapPinLocation) {
|
|
6985
|
+
handleFeatureSelect(linkedPanelId, undefined);
|
|
6986
|
+
}
|
|
6987
|
+
return;
|
|
6988
|
+
}
|
|
6989
|
+
// Handle clicks on station
|
|
6990
|
+
var clickedFeatureName = (_event$feature$proper = event.feature.properties) == null ? void 0 : _event$feature$proper.name;
|
|
6991
|
+
var features = linkedFeatures[0].geoJSON.features;
|
|
6992
|
+
var clickedFeatureIndex = features.findIndex(function (feature) {
|
|
6993
|
+
var _feature$properties;
|
|
6994
|
+
return ((_feature$properties = feature.properties) == null ? void 0 : _feature$properties.name) === clickedFeatureName;
|
|
6995
|
+
});
|
|
6996
|
+
if (disableMapPin === false) {
|
|
6997
|
+
var _selectedFeature$id;
|
|
6998
|
+
var selectedFeature = features[clickedFeatureIndex];
|
|
6999
|
+
handleFeatureSelect(linkedPanelId, (_selectedFeature$id = selectedFeature.id) == null ? void 0 : _selectedFeature$id.toString());
|
|
7000
|
+
}
|
|
7001
|
+
}
|
|
7002
|
+
}, feature.id);
|
|
7003
|
+
}), featureLayers.map(function (layer) {
|
|
7004
|
+
return jsx(MapViewLayer, Object.assign({
|
|
7005
|
+
id: "featurelayer-" + layer.id,
|
|
7006
|
+
onLayerError: function onLayerError(_, error) {
|
|
7007
|
+
layerError({
|
|
7008
|
+
layerId: layer.id,
|
|
7009
|
+
error: Error("" + error)
|
|
7010
|
+
});
|
|
7011
|
+
},
|
|
7012
|
+
onClickFeature: function onClickFeature(event) {
|
|
7013
|
+
var isClickOutsideFeature = !event;
|
|
7014
|
+
if (isClickOutsideFeature && !layer.isInEditMode) {
|
|
7015
|
+
setSelectedFeature({
|
|
7016
|
+
layerId: layer.id,
|
|
7017
|
+
selectedFeatureIndex: undefined
|
|
7018
|
+
});
|
|
7019
|
+
return;
|
|
7020
|
+
}
|
|
7021
|
+
if ((event == null ? void 0 : event.isInEditMode) === false) {
|
|
7022
|
+
setSelectedFeature({
|
|
7023
|
+
layerId: layer.id,
|
|
7024
|
+
selectedFeatureIndex: event.featureIndex
|
|
7025
|
+
});
|
|
7026
|
+
}
|
|
7027
|
+
},
|
|
7028
|
+
updateGeojson: function updateGeojson(geojson, reason) {
|
|
7029
|
+
updateFeature({
|
|
7030
|
+
geojson: geojson,
|
|
7031
|
+
layerId: layer.id,
|
|
7032
|
+
reason: reason
|
|
7033
|
+
});
|
|
7034
|
+
},
|
|
7035
|
+
exitDrawModeCallback: function exitDrawModeCallback(reason) {
|
|
7036
|
+
return exitFeatureDrawMode({
|
|
7037
|
+
reason: reason,
|
|
7038
|
+
layerId: layer.id
|
|
7039
|
+
});
|
|
7040
|
+
}
|
|
7041
|
+
}, layer), layer.id);
|
|
7042
|
+
}), overLayers.map(function (layer) {
|
|
7043
|
+
return jsx(MapViewLayer, Object.assign({
|
|
7044
|
+
id: "baselayer-" + layer.id,
|
|
7045
|
+
onLayerError: function onLayerError(_, error) {
|
|
7046
|
+
layerError({
|
|
7047
|
+
layerId: layer.id,
|
|
7048
|
+
error: Error("" + error)
|
|
7049
|
+
});
|
|
7050
|
+
}
|
|
7051
|
+
}, layer), layer.id);
|
|
7052
|
+
}), children]
|
|
7053
|
+
})), jsxs(MapControls, {
|
|
7054
|
+
"data-testid": "mapControls",
|
|
7055
|
+
style: {
|
|
7056
|
+
top: controls == null ? void 0 : controls.mapControlsPositionTop
|
|
7057
|
+
},
|
|
7058
|
+
children: [(controls == null ? void 0 : controls.search) && jsx(SearchControlButtonConnect, {
|
|
7059
|
+
mapId: mapId
|
|
7060
|
+
}), (controls == null ? void 0 : controls.zoomControls) && jsx(ZoomControlConnect, {
|
|
7061
|
+
mapId: mapId
|
|
7062
|
+
}), (controls == null ? void 0 : controls.layerManagerAndLegend) && jsxs(Fragment, {
|
|
7063
|
+
children: [jsx(LayerManagerMapButtonConnect, {
|
|
7064
|
+
mapId: mapId
|
|
7065
|
+
}), jsx(LegendMapButtonConnect, {
|
|
7066
|
+
mapId: mapId,
|
|
7067
|
+
multiLegend: controls == null ? void 0 : controls.multiLegend
|
|
7068
|
+
})]
|
|
7069
|
+
}), (controls == null ? void 0 : controls.dimensionSelect) && jsx(MultiDimensionSelectMapButtonsConnect, {
|
|
7070
|
+
mapId: mapId
|
|
7071
|
+
}), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoButtonConnect, {
|
|
7072
|
+
mapId: mapId
|
|
7073
|
+
}), controls == null ? void 0 : controls.additionalMapControls]
|
|
7074
|
+
}), (controls == null ? void 0 : controls.multiLegend) && jsx(LegendConnect, {
|
|
7075
|
+
showMapId: true,
|
|
7076
|
+
mapId: mapId,
|
|
7077
|
+
multiLegend: controls == null ? void 0 : controls.multiLegend
|
|
7078
|
+
}), (controls == null ? void 0 : controls.search) && jsx(SearchDialogConnect, {
|
|
7079
|
+
mapId: mapId
|
|
7080
|
+
}), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoConnect, {
|
|
7081
|
+
showMapId: true,
|
|
7082
|
+
mapId: mapId
|
|
7083
|
+
}), jsx(LayerManagerConnect, {
|
|
7084
|
+
mapId: mapId,
|
|
7085
|
+
bounds: "parent",
|
|
7086
|
+
isDocked: true
|
|
7087
|
+
})]
|
|
7088
|
+
});
|
|
7089
|
+
};
|
|
7090
|
+
|
|
7091
|
+
/* *
|
|
7092
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7093
|
+
* you may not use this file except in compliance with the License.
|
|
7094
|
+
* You may obtain a copy of the License at
|
|
7095
|
+
*
|
|
7096
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7097
|
+
*
|
|
7098
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7099
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7100
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7101
|
+
* See the License for the specific language governing permissions and
|
|
7102
|
+
* limitations under the License.
|
|
7103
|
+
*
|
|
7104
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7105
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
7106
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
7107
|
+
* */
|
|
7108
|
+
var useGetOpenlayersView = function useGetOpenlayersView(mapId, store) {
|
|
7109
|
+
var _useState = useState(),
|
|
7110
|
+
view = _useState[0],
|
|
7111
|
+
setView = _useState[1];
|
|
7112
|
+
var _useState2 = useState(),
|
|
7113
|
+
name = _useState2[0],
|
|
7114
|
+
setName = _useState2[1];
|
|
7115
|
+
var syncGroupState = syncGroupsSelectors.getSynchronizationGroupState(store.getState());
|
|
7116
|
+
var syncGroupView = useMemo(function () {
|
|
7117
|
+
var thisAreaSyncGroupId = syncGroupState.groups.allIds.find(function (id) {
|
|
7118
|
+
var group = syncGroupState.groups.byId[id];
|
|
7119
|
+
return group.type === syncConstants.SYNCGROUPS_TYPE_SETBBOX && group.targets.allIds.indexOf(mapId) !== -1;
|
|
7120
|
+
});
|
|
7121
|
+
return thisAreaSyncGroupId ? getViewObjectForSyncGroup(thisAreaSyncGroupId) : null;
|
|
7122
|
+
}, [mapId, syncGroupState.groups]);
|
|
7123
|
+
useEffect(function () {
|
|
7124
|
+
var mapBbox = mapSelectors.getBbox(store.getState(), mapId);
|
|
7125
|
+
var storedView = syncGroupView || getViewObjectForMapId(mapId);
|
|
7126
|
+
if (storedView.view.getCenter() === undefined && mapBbox.left !== undefined) {
|
|
7127
|
+
storedView.view.fit([mapBbox.left, mapBbox.bottom, mapBbox.right, mapBbox.top]);
|
|
7128
|
+
}
|
|
7129
|
+
setName(storedView.name);
|
|
7130
|
+
// window.console.log('useGetOpenlayersView -> ######## Choosing storedView object')
|
|
7131
|
+
var setViewFromStoredView = function setViewFromStoredView() {
|
|
7132
|
+
// window.console.log('useGetOpenlayersView -> ######## calling setView()', storedView.view);
|
|
7133
|
+
setView(storedView.view);
|
|
7134
|
+
};
|
|
7135
|
+
setViewFromStoredView();
|
|
7136
|
+
var eventKey = storedView.on('change', setViewFromStoredView);
|
|
7137
|
+
return function () {
|
|
7138
|
+
unByKey(eventKey);
|
|
7139
|
+
};
|
|
7140
|
+
}, [syncGroupView, mapId, store]);
|
|
7141
|
+
return {
|
|
7142
|
+
view: view,
|
|
7143
|
+
name: name
|
|
7144
|
+
};
|
|
7145
|
+
};
|
|
7146
|
+
|
|
7147
|
+
/* *
|
|
7148
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7149
|
+
* you may not use this file except in compliance with the License.
|
|
7150
|
+
* You may obtain a copy of the License at
|
|
7151
|
+
*
|
|
7152
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7153
|
+
*
|
|
7154
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7155
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7156
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7157
|
+
* See the License for the specific language governing permissions and
|
|
7158
|
+
* limitations under the License.
|
|
7159
|
+
*
|
|
7160
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7161
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
7162
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
7163
|
+
* */
|
|
7164
|
+
var makePrefetchTimeSpan = function makePrefetchTimeSpan(timeSliderStartCenterEndTime, animationStartTime, animationEndTime, isAnimating) {
|
|
7165
|
+
var timeSliderTimeStepInS = timeSliderStartCenterEndTime.step * 60;
|
|
7166
|
+
var animationTimeStartInS = dateUtils.parseISO(animationStartTime).getTime() / 1000;
|
|
7167
|
+
var animationTimeEndInS = dateUtils.parseISO(animationEndTime).getTime() / 1000;
|
|
7168
|
+
var prefetchStart = isAnimating ? animationTimeStartInS : timeSliderStartCenterEndTime.start;
|
|
7169
|
+
var prefetchEnd = isAnimating ? animationTimeEndInS : timeSliderStartCenterEndTime.end;
|
|
7170
|
+
if (!prefetchStart || !prefetchEnd) {
|
|
7171
|
+
return {
|
|
7172
|
+
timespan: {
|
|
7173
|
+
start: 0,
|
|
7174
|
+
end: 0,
|
|
7175
|
+
step: 0
|
|
7176
|
+
},
|
|
7177
|
+
isAnimating: isAnimating
|
|
7178
|
+
};
|
|
7179
|
+
}
|
|
7180
|
+
var roundStart = Math.round(prefetchStart / timeSliderTimeStepInS) * timeSliderTimeStepInS;
|
|
7181
|
+
var roundEnd = Math.round(prefetchEnd / timeSliderTimeStepInS) * timeSliderTimeStepInS;
|
|
7182
|
+
// eslint-disable-next-line no-constant-condition
|
|
7183
|
+
return {
|
|
7184
|
+
timespan: {
|
|
7185
|
+
start: roundStart * 1000,
|
|
7186
|
+
end: roundEnd * 1000,
|
|
7187
|
+
step: timeSliderTimeStepInS * 1000
|
|
7188
|
+
},
|
|
7189
|
+
isAnimating: isAnimating
|
|
7190
|
+
};
|
|
7191
|
+
};
|
|
7192
|
+
var makeLayerInfoPayload = function makeLayerInfoPayload(payload, mapDimensions, mapId) {
|
|
7193
|
+
// During intialization, try to base the layer dimension on the current map dimension value.
|
|
7194
|
+
var updatedPayLoad = {
|
|
7195
|
+
origin: 'OnInitializeLayerProps in MapViewConnect',
|
|
7196
|
+
layerDimensions: {
|
|
7197
|
+
layerId: payload.layerId,
|
|
7198
|
+
origin: 'OnInitializeLayerProps in MapViewConnect',
|
|
7199
|
+
dimensions: (payload.dimensions || []).map(function (layerDim) {
|
|
7200
|
+
var _find;
|
|
7201
|
+
var currentMapDim = ((_find = (mapDimensions || []).find(function (mapDim) {
|
|
7202
|
+
return mapDim.name === layerDim.name;
|
|
7203
|
+
})) == null ? void 0 : _find.currentValue) || layerDim.currentValue;
|
|
7204
|
+
var wmDim = new WMJSDimension(layerDim);
|
|
7205
|
+
return Object.assign({}, layerDim, {
|
|
7206
|
+
currentValue: wmDim.getClosestValue(currentMapDim)
|
|
7207
|
+
});
|
|
7208
|
+
})
|
|
7209
|
+
},
|
|
7210
|
+
mapDimensions: {
|
|
7211
|
+
mapId: mapId,
|
|
7212
|
+
origin: 'OnInitializeLayerProps in MapViewConnect',
|
|
7213
|
+
dimensions: (payload.dimensions || []).map(function (layerDim) {
|
|
7214
|
+
var _find2;
|
|
7215
|
+
var currentMapDim = ((_find2 = (mapDimensions || []).find(function (mapDim) {
|
|
7216
|
+
return mapDim.name === layerDim.name;
|
|
7217
|
+
})) == null ? void 0 : _find2.currentValue) || layerDim.currentValue;
|
|
7218
|
+
var wmDim = new WMJSDimension(layerDim);
|
|
7219
|
+
return Object.assign({}, layerDim, {
|
|
7220
|
+
currentValue: wmDim.getClosestValue(currentMapDim)
|
|
7221
|
+
});
|
|
7222
|
+
})
|
|
7223
|
+
}
|
|
7224
|
+
};
|
|
7225
|
+
return updatedPayLoad;
|
|
7226
|
+
};
|
|
7227
|
+
|
|
7228
|
+
var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref) {
|
|
7229
|
+
var layer = _ref.layer,
|
|
7230
|
+
layerId = _ref.layerId,
|
|
7231
|
+
zIndex = _ref.zIndex,
|
|
7232
|
+
style = _ref.style,
|
|
7233
|
+
hoverSelect = _ref.hoverSelect;
|
|
7234
|
+
var store = useStore();
|
|
7235
|
+
var dispatch = useDispatch();
|
|
7236
|
+
// geoJson: GeometryObject, text: string
|
|
7237
|
+
var updateFeature = React__default.useCallback(function (geojson, reason) {
|
|
7238
|
+
if (!layerId) {
|
|
7239
|
+
window.console.error('updateFeature without layerId');
|
|
7240
|
+
return;
|
|
7241
|
+
}
|
|
7242
|
+
var activeDrawToolId = drawingToolSelectors.getActiveDrawToolId(store.getState());
|
|
7243
|
+
var activeDrawMode = drawingToolSelectors.getActiveDrawMode(store.getState(), activeDrawToolId);
|
|
7244
|
+
dispatch(layerActions.updateFeature({
|
|
7245
|
+
geojson: geojson,
|
|
7246
|
+
reason: reason,
|
|
7247
|
+
layerId: layerId,
|
|
7248
|
+
shouldAllowMultipleShapes: drawingToolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId),
|
|
7249
|
+
geoJSONIntersectionLayerId: drawingToolSelectors.getGeoJSONIntersectionLayerId(store.getState(), activeDrawToolId),
|
|
7250
|
+
geoJSONIntersectionBoundsLayerId: drawingToolSelectors.getGeoJSONIntersectionBoundsLayerId(store.getState(), activeDrawToolId),
|
|
7251
|
+
selectionType: activeDrawMode == null ? void 0 : activeDrawMode.selectionType
|
|
7252
|
+
}));
|
|
7253
|
+
}, [dispatch, store, layerId]);
|
|
7254
|
+
var exitFeatureDrawMode = React__default.useCallback(function (reason) {
|
|
7255
|
+
if (!layerId) {
|
|
7256
|
+
window.console.error('exitFeatureDrawMode without layerId');
|
|
7257
|
+
return;
|
|
7258
|
+
}
|
|
7259
|
+
var activeDrawToolId = drawingToolSelectors.getActiveDrawToolId(store.getState());
|
|
7260
|
+
dispatch(layerActions.exitFeatureDrawMode({
|
|
7261
|
+
reason: reason,
|
|
7262
|
+
layerId: layerId,
|
|
7263
|
+
shouldAllowMultipleShapes: drawingToolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId)
|
|
7264
|
+
}));
|
|
7265
|
+
}, [dispatch, store, layerId]);
|
|
7266
|
+
return jsxs(Fragment, {
|
|
7267
|
+
children: [jsx(GeoJSONLayer, {
|
|
7268
|
+
featureCollection: !layer.isInEditMode ? layer.geojson : undefined,
|
|
7269
|
+
zIndex: zIndex,
|
|
7270
|
+
style: style,
|
|
7271
|
+
hoverSelect: hoverSelect
|
|
7272
|
+
}), jsx(OpenLayersMapDraw
|
|
7273
|
+
// linkedFeatures={null!} // TODO: !!!
|
|
7274
|
+
, {
|
|
7275
|
+
// linkedFeatures={null!} // TODO: !!!
|
|
7276
|
+
drawMode: layer.drawMode,
|
|
7277
|
+
viewOnlyStyle: style,
|
|
7278
|
+
exitDrawModeCallback: exitFeatureDrawMode,
|
|
7279
|
+
geojson: layer.geojson,
|
|
7280
|
+
// isInDeleteMode={false} // TODO: dunno!
|
|
7281
|
+
isInEditMode: layer.isInEditMode || false,
|
|
7282
|
+
selectedFeatureIndex: layer.selectedFeatureIndex || 0,
|
|
7283
|
+
updateGeojson: updateFeature
|
|
7284
|
+
})]
|
|
7285
|
+
});
|
|
7286
|
+
};
|
|
7287
|
+
|
|
7288
|
+
var OlMapViewLayerConnect = function OlMapViewLayerConnect(layerProps) {
|
|
7289
|
+
var layerId = layerProps.layerId,
|
|
7290
|
+
mapId = layerProps.mapId,
|
|
7291
|
+
zIndex = layerProps.zIndex,
|
|
7292
|
+
debugMode = layerProps.debugMode;
|
|
7293
|
+
var layer = useSelector(function (store) {
|
|
7294
|
+
return layerSelectors.getLayerById(store, layerId);
|
|
7295
|
+
});
|
|
7296
|
+
var mapDimensions = useSelector(function (store) {
|
|
7297
|
+
return mapSelectors.getMapDimensions(store, mapId);
|
|
7298
|
+
});
|
|
7299
|
+
var dispatch = useDispatch();
|
|
7300
|
+
var onInitializeLayer = useCallback(function (initProps) {
|
|
7301
|
+
var updatedPayLoad = makeLayerInfoPayload(initProps, mapDimensions || [], mapId);
|
|
7302
|
+
dispatch(layerActions.onUpdateLayerInformation(updatedPayLoad));
|
|
7303
|
+
}, [dispatch, mapDimensions, mapId]);
|
|
7304
|
+
if (!layerId || !layer) {
|
|
7305
|
+
return null;
|
|
7306
|
+
}
|
|
7307
|
+
var isInsideAcceptanceTime = getIsInsideAcceptanceTime(layer.acceptanceTimeInMinutes, mapDimensions, layer.dimensions);
|
|
7308
|
+
return jsx(MapViewLayerToOpenLayer, Object.assign({
|
|
7309
|
+
id: "layer-" + (layer == null ? void 0 : layer.id),
|
|
7310
|
+
zIndex: zIndex
|
|
7311
|
+
}, layer, {
|
|
7312
|
+
enabled: isInsideAcceptanceTime && layer.enabled,
|
|
7313
|
+
onInitializeLayer: onInitializeLayer,
|
|
7314
|
+
debugMode: debugMode
|
|
7315
|
+
}), "layer-" + (layer == null ? void 0 : layer.id));
|
|
7316
|
+
};
|
|
7317
|
+
|
|
7318
|
+
var getCenterOfLinkedFeature = function getCenterOfLinkedFeature(feature, srs) {
|
|
7319
|
+
var _feature$getGeometry;
|
|
7320
|
+
if (feature && ((_feature$getGeometry = feature.getGeometry()) == null ? void 0 : _feature$getGeometry.getType()) === 'Point') {
|
|
7321
|
+
var _feature$getId;
|
|
7322
|
+
var projectionCoords = feature.getGeometry().getCoordinates();
|
|
7323
|
+
var coords = toLonLat(projectionCoords, srs);
|
|
7324
|
+
var id = (feature == null || (_feature$getId = feature.getId()) == null ? void 0 : _feature$getId.toString()) || '';
|
|
7325
|
+
return {
|
|
7326
|
+
lon: coords[0],
|
|
7327
|
+
lat: coords[1],
|
|
7328
|
+
id: id,
|
|
7329
|
+
serviceId: feature.getProperties().serviceId,
|
|
7330
|
+
collectionId: feature.getProperties().collectionId
|
|
7331
|
+
};
|
|
7332
|
+
}
|
|
7333
|
+
return null;
|
|
7334
|
+
};
|
|
7335
|
+
/**
|
|
7336
|
+
* Connected component used to display the map and selected layers.
|
|
7337
|
+
* Includes options to disable the map controls and legend.
|
|
7338
|
+
*
|
|
7339
|
+
* Expects the following props:
|
|
7340
|
+
* @param {string} mapId mapId: string - Id of the map
|
|
7341
|
+
* @param {object} [controls.zoomControls] **optional** controls: object - toggle the map controls, zoomControls defaults to true
|
|
7342
|
+
* @param {boolean} [displayTimeInMap] **optional** displayTimeInMap: boolean, toggles the mapTime, defaults to true
|
|
7343
|
+
* @param {boolean} [showScaleBar] **optional** showScaleBar: boolean, toggles the scaleBar, defaults to true
|
|
7344
|
+
* @example
|
|
7345
|
+
* ```<MapViewConnect mapId={mapId} controls={{ zoomControls: false }} displayTimeInMap={false} showScaleBar={false}/>```
|
|
7346
|
+
*/
|
|
7347
|
+
var OlMapViewConnect = function OlMapViewConnect(_ref) {
|
|
7348
|
+
var mapId = _ref.mapId,
|
|
7349
|
+
_ref$controls = _ref.controls,
|
|
7350
|
+
controls = _ref$controls === void 0 ? {
|
|
7351
|
+
mapControlsPositionTop: 0,
|
|
7352
|
+
zoomControls: true
|
|
7353
|
+
} : _ref$controls,
|
|
7354
|
+
initialBbox = _ref.initialBbox,
|
|
7355
|
+
children = _ref.children;
|
|
7356
|
+
var store = useStore();
|
|
7357
|
+
var mapRef = React.useRef(null);
|
|
7358
|
+
var _useGetOpenlayersView = useGetOpenlayersView(mapId, store),
|
|
7359
|
+
view = _useGetOpenlayersView.view;
|
|
7360
|
+
var _React$useState = React.useState(),
|
|
7361
|
+
hoverLinkedFeature = _React$useState[0],
|
|
7362
|
+
setHoverLinkedFeature = _React$useState[1];
|
|
7363
|
+
var linkedPanelId = useSelector(function (store) {
|
|
7364
|
+
return genericSelectors.selectLinkedPanelId(store, mapId);
|
|
7365
|
+
});
|
|
7366
|
+
var mapLayerIds = useSelector(function (store) {
|
|
7367
|
+
return mapSelectors.getMapLayerIdsEnabled(store, mapId);
|
|
7368
|
+
});
|
|
7369
|
+
var baseLayers = useSelector(function (store) {
|
|
7370
|
+
return mapSelectors.getMapBaseLayers(store, mapId);
|
|
7371
|
+
});
|
|
7372
|
+
var overLayers = useSelector(function (store) {
|
|
7373
|
+
return mapSelectors.getMapOverLayers(store, mapId);
|
|
7374
|
+
});
|
|
7375
|
+
var featureLayers = useSelector(function (store) {
|
|
7376
|
+
return mapSelectors.getMapFeatureLayers(store, mapId);
|
|
7377
|
+
});
|
|
7378
|
+
var linkedFeaturesFromState = useSelector(function (store) {
|
|
7379
|
+
var _store$syncGroups;
|
|
7380
|
+
return genericSelectors.selectLinkedFeatures((_store$syncGroups = store.syncGroups) == null ? void 0 : _store$syncGroups.linkedState, mapId);
|
|
7381
|
+
});
|
|
7382
|
+
var linkedFeatures = React.useMemo(function () {
|
|
7383
|
+
return {
|
|
7384
|
+
type: 'FeatureCollection',
|
|
7385
|
+
features: linkedFeaturesFromState.flatMap(function (feature) {
|
|
7386
|
+
return feature.geoJSON.features;
|
|
7387
|
+
})
|
|
7388
|
+
};
|
|
7389
|
+
}, [linkedFeaturesFromState]);
|
|
7390
|
+
var srs = useSelector(function (store) {
|
|
7391
|
+
return mapSelectors.getSrs(store, mapId);
|
|
7392
|
+
});
|
|
7393
|
+
var timeSliderStartCenterEndTime = useSelector(function (store) {
|
|
7394
|
+
return mapSelectors.getMapTimeSliderStartCenterEndAndStep(store, mapId);
|
|
7395
|
+
});
|
|
7396
|
+
var animationStartTime = useSelector(function (store) {
|
|
7397
|
+
return mapSelectors.getAnimationStartTime(store, mapId);
|
|
7398
|
+
});
|
|
7399
|
+
var animationEndTime = useSelector(function (store) {
|
|
7400
|
+
return mapSelectors.getAnimationEndTime(store, mapId);
|
|
7401
|
+
});
|
|
7402
|
+
var isTimeScrollingEnabled = useSelector(syncGroupsSelectors.isTimeScrollingEnabled);
|
|
7403
|
+
var isAnimating = useSelector(function (store) {
|
|
7404
|
+
return mapSelectors.isAnimating(store, mapId);
|
|
7405
|
+
});
|
|
7406
|
+
var dispatch = useDispatch();
|
|
7407
|
+
var updateLayerInformation = React.useCallback(function (payload) {
|
|
7408
|
+
var _payload$layerDimensi, _payload$layerDimensi2;
|
|
7409
|
+
var updatedPayLoad = Object.assign({}, payload, {
|
|
7410
|
+
origin: 'OnInitializeLayerProps in MapViewConnect',
|
|
7411
|
+
layerDimensions: {
|
|
7412
|
+
layerId: ((_payload$layerDimensi = payload.layerDimensions) == null ? void 0 : _payload$layerDimensi.layerId) || '',
|
|
7413
|
+
origin: 'OnInitializeLayerProps in MapViewConnect',
|
|
7414
|
+
dimensions: (((_payload$layerDimensi2 = payload.layerDimensions) == null ? void 0 : _payload$layerDimensi2.dimensions) || []).map(function (layerDim) {
|
|
7415
|
+
return Object.assign({}, layerDim);
|
|
7416
|
+
})
|
|
7417
|
+
}
|
|
7418
|
+
});
|
|
7419
|
+
dispatch(layerActions.onUpdateLayerInformation(updatedPayLoad));
|
|
7420
|
+
}, [dispatch]);
|
|
7421
|
+
var registerMap = React.useCallback(function (payload) {
|
|
7422
|
+
dispatch(mapActions.registerMap(payload));
|
|
7423
|
+
}, [dispatch]);
|
|
7424
|
+
var syncGroupsAddSource = React.useCallback(function (payload) {
|
|
7425
|
+
dispatch(genericActions.syncGroupAddSource(payload));
|
|
7426
|
+
}, [dispatch]);
|
|
7427
|
+
var hoverSelect = React.useMemo(function () {
|
|
7428
|
+
return {
|
|
7429
|
+
active: true,
|
|
7430
|
+
onHover: setHoverLinkedFeature
|
|
7431
|
+
};
|
|
7432
|
+
}, []);
|
|
7433
|
+
var displayMapPin = useSelector(function (store) {
|
|
7434
|
+
return mapSelectors.getDisplayMapPin(store, mapId);
|
|
7435
|
+
});
|
|
7436
|
+
var mapPinLocation = useSelector(function (store) {
|
|
7437
|
+
return mapSelectors.getPinLocation(store, mapId);
|
|
7438
|
+
});
|
|
7439
|
+
var mapPinChangeLocation = React.useCallback(function (clickedLocation) {
|
|
7440
|
+
var _hoverLinkedFeature$g;
|
|
7441
|
+
var mapPinLocation = getCenterOfLinkedFeature(hoverLinkedFeature, srs) || clickedLocation;
|
|
7442
|
+
var selectedFeatureId = (hoverLinkedFeature == null || (_hoverLinkedFeature$g = hoverLinkedFeature.getId()) == null ? void 0 : _hoverLinkedFeature$g.toString()) || '';
|
|
7443
|
+
if (hoverLinkedFeature) {
|
|
7444
|
+
var selectedFeatureIndex = linkedFeatures.features.findIndex(function (feature) {
|
|
7445
|
+
return feature.id === selectedFeatureId;
|
|
7446
|
+
});
|
|
7447
|
+
dispatch(layerActions.setSelectedFeature({
|
|
7448
|
+
layerId: "drawlayer-" + mapId,
|
|
7449
|
+
selectedFeatureIndex: selectedFeatureIndex
|
|
7450
|
+
}));
|
|
7451
|
+
}
|
|
7452
|
+
dispatch(genericActions.addSharedData({
|
|
7453
|
+
panelId: linkedPanelId,
|
|
7454
|
+
data: {
|
|
7455
|
+
selectedFeatureId: selectedFeatureId
|
|
7456
|
+
}
|
|
7457
|
+
}));
|
|
7458
|
+
dispatch(mapActions.setMapPinLocation({
|
|
7459
|
+
mapId: mapId,
|
|
7460
|
+
mapPinLocation: mapPinLocation
|
|
7461
|
+
}));
|
|
7462
|
+
}, [dispatch, hoverLinkedFeature, linkedFeatures.features, linkedPanelId, mapId, srs]);
|
|
7463
|
+
var isActiveWindowId = useSelector(function (store) {
|
|
7464
|
+
return uiSelectors.getIsActiveWindowId(store, mapId);
|
|
7465
|
+
});
|
|
7466
|
+
useKeyboardZoomAndPan(isActiveWindowId, mapId, mapRef.current);
|
|
7467
|
+
useTouchZoomPan(isActiveWindowId, mapId);
|
|
7468
|
+
React.useEffect(function () {
|
|
7469
|
+
registerMap({
|
|
7470
|
+
mapId: mapId
|
|
7471
|
+
});
|
|
7472
|
+
syncGroupsAddSource({
|
|
7473
|
+
id: mapId,
|
|
7474
|
+
type: [syncConstants.SYNCGROUPS_TYPE_SETTIME, syncConstants.SYNCGROUPS_TYPE_SETBBOX]
|
|
7475
|
+
});
|
|
7476
|
+
dispatch(loadingIndicatorActions.setGetMapIsLoading({
|
|
7477
|
+
id: mapId,
|
|
7478
|
+
isGetMapLoading: false
|
|
7479
|
+
}));
|
|
7480
|
+
}, [dispatch, mapId, registerMap, syncGroupsAddSource]);
|
|
7481
|
+
var onGetMapLoadStart = React.useCallback(function () {
|
|
7482
|
+
dispatch(loadingIndicatorActions.setGetMapIsLoading({
|
|
7483
|
+
id: mapId,
|
|
7484
|
+
isGetMapLoading: true
|
|
7485
|
+
}));
|
|
7486
|
+
}, [dispatch, mapId]);
|
|
7487
|
+
var onGetMapLoadReady = React.useCallback(function () {
|
|
7488
|
+
dispatch(loadingIndicatorActions.setGetMapIsLoading({
|
|
7489
|
+
id: mapId,
|
|
7490
|
+
isGetMapLoading: false
|
|
7491
|
+
}));
|
|
7492
|
+
}, [dispatch, mapId]);
|
|
7493
|
+
React.useEffect(function () {
|
|
7494
|
+
if (!view) {
|
|
7495
|
+
return function () {};
|
|
7496
|
+
}
|
|
7497
|
+
var eventKey = view.on('change', function () {
|
|
7498
|
+
var _view$getViewStateAnd = view.getViewStateAndExtent(),
|
|
7499
|
+
extent = _view$getViewStateAnd.extent;
|
|
7500
|
+
dispatch(genericActions.setBbox({
|
|
7501
|
+
bbox: {
|
|
7502
|
+
left: extent[0],
|
|
7503
|
+
bottom: extent[1],
|
|
7504
|
+
right: extent[2],
|
|
7505
|
+
top: extent[3]
|
|
7506
|
+
},
|
|
7507
|
+
sourceId: mapId,
|
|
7508
|
+
srs: srs
|
|
7509
|
+
}));
|
|
7510
|
+
});
|
|
7511
|
+
return function () {
|
|
7512
|
+
unByKey(eventKey);
|
|
7513
|
+
};
|
|
7514
|
+
}, [view, mapId, srs, dispatch]);
|
|
7515
|
+
var prefetchTimespan = makePrefetchTimeSpan(timeSliderStartCenterEndTime, animationStartTime, animationEndTime, isAnimating);
|
|
7516
|
+
var layerIds = mapLayerIds.join();
|
|
7517
|
+
var refetchLayers = React.useCallback(function () {
|
|
7518
|
+
mapLayerIds == null || mapLayerIds.forEach( /*#__PURE__*/function () {
|
|
7519
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(layerId) {
|
|
7520
|
+
var wmLayer, layerInfo;
|
|
7521
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7522
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7523
|
+
case 0:
|
|
7524
|
+
if (!layerId) {
|
|
7525
|
+
_context.next = 15;
|
|
7526
|
+
break;
|
|
7527
|
+
}
|
|
7528
|
+
_context.prev = 1;
|
|
7529
|
+
wmLayer = getWMLayerById(layerId);
|
|
7530
|
+
if (!wmLayer) {
|
|
7531
|
+
console.warn('No wmLayer exists for layer id', layerId);
|
|
7532
|
+
}
|
|
7533
|
+
_context.next = 6;
|
|
7534
|
+
return wmLayer.parseLayer(true);
|
|
7535
|
+
case 6:
|
|
7536
|
+
layerInfo = getLayerUpdateInfo(wmLayer, mapId);
|
|
7537
|
+
updateLayerInformation && updateLayerInformation(layerInfo);
|
|
7538
|
+
_context.next = 13;
|
|
7539
|
+
break;
|
|
7540
|
+
case 10:
|
|
7541
|
+
_context.prev = 10;
|
|
7542
|
+
_context.t0 = _context["catch"](1);
|
|
7543
|
+
window.console.error(_context.t0);
|
|
7544
|
+
case 13:
|
|
7545
|
+
_context.next = 16;
|
|
7546
|
+
break;
|
|
7547
|
+
case 15:
|
|
7548
|
+
console.warn('Not updating layer, something is wrong.', layerId);
|
|
7549
|
+
case 16:
|
|
7550
|
+
case "end":
|
|
7551
|
+
return _context.stop();
|
|
7552
|
+
}
|
|
7553
|
+
}, _callee, null, [[1, 10]]);
|
|
7554
|
+
}));
|
|
7555
|
+
return function (_x) {
|
|
7556
|
+
return _ref2.apply(this, arguments);
|
|
7557
|
+
};
|
|
7558
|
+
}());
|
|
7559
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7560
|
+
}, [mapId, updateLayerInformation, layerIds]);
|
|
7561
|
+
useSetIntervalWhenVisible(refetchLayers, 60000);
|
|
7562
|
+
var isLoading = React.useRef(false);
|
|
7563
|
+
// UseEffect for loading indicator
|
|
7564
|
+
React.useEffect(function () {
|
|
7565
|
+
openLayersGetMapImageStore.addImageEventCallback(function () {
|
|
7566
|
+
var checkLoading = !!(openLayersGetMapImageStore.getNumImagesLoading() > 0);
|
|
7567
|
+
if (checkLoading !== isLoading.current) {
|
|
7568
|
+
if (checkLoading === true) {
|
|
7569
|
+
onGetMapLoadStart && onGetMapLoadStart();
|
|
7570
|
+
} else {
|
|
7571
|
+
onGetMapLoadReady && onGetMapLoadReady();
|
|
6600
7572
|
}
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
7573
|
+
isLoading.current = checkLoading;
|
|
7574
|
+
}
|
|
7575
|
+
}, mapId);
|
|
7576
|
+
return function () {
|
|
7577
|
+
openLayersGetMapImageStore.removeEventCallback(mapId);
|
|
7578
|
+
};
|
|
7579
|
+
}, [mapId, onGetMapLoadReady, onGetMapLoadStart]);
|
|
7580
|
+
var _React$useState2 = React.useState(false),
|
|
7581
|
+
debugMode = _React$useState2[0],
|
|
7582
|
+
toggleDebugMode = _React$useState2[1];
|
|
7583
|
+
React.useEffect(function () {
|
|
7584
|
+
var handleKeyPress = function handleKeyPress(event) {
|
|
7585
|
+
if (event.isTrusted && event.key === 'd') {
|
|
7586
|
+
toggleDebugMode(!debugMode);
|
|
7587
|
+
}
|
|
7588
|
+
};
|
|
7589
|
+
document.addEventListener('keyup', handleKeyPress);
|
|
7590
|
+
return function () {
|
|
7591
|
+
document.removeEventListener('keyup', handleKeyPress);
|
|
7592
|
+
};
|
|
7593
|
+
}, [debugMode]);
|
|
7594
|
+
var homeExtent = React.useMemo(function () {
|
|
7595
|
+
return initialBbox && [initialBbox.left, initialBbox.bottom, initialBbox.right, initialBbox.top];
|
|
7596
|
+
}, [initialBbox]);
|
|
7597
|
+
return jsx(TimeContext.Provider, {
|
|
7598
|
+
value: prefetchTimespan,
|
|
7599
|
+
children: jsxs(OpenLayersMapView, {
|
|
7600
|
+
view: view,
|
|
7601
|
+
isFocused: isActiveWindowId,
|
|
7602
|
+
isMouseWheelZoomEnabled: !isTimeScrollingEnabled,
|
|
7603
|
+
children: [children, baseLayers.map(function (layer, zIndex) {
|
|
7604
|
+
return jsx(MapViewLayerToOpenLayer, Object.assign({
|
|
7605
|
+
id: "baselayer-" + (layer == null ? void 0 : layer.id),
|
|
7606
|
+
zIndex: baseLayers.length - zIndex + 10
|
|
7607
|
+
}, layer, {
|
|
7608
|
+
isBaseLayer: true
|
|
7609
|
+
}), "baselayer-" + (layer == null ? void 0 : layer.id));
|
|
7610
|
+
}), mapLayerIds.map(function (layerId, zIndex) {
|
|
7611
|
+
return jsx(OlMapViewLayerConnect, {
|
|
7612
|
+
layerId: layerId,
|
|
7613
|
+
zIndex: mapLayerIds.length - zIndex + 1000,
|
|
7614
|
+
debugMode: debugMode,
|
|
6610
7615
|
mapId: mapId
|
|
6611
|
-
});
|
|
6612
|
-
},
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
wmServiceListener.addEventListener(EVENT_GETCAPABILITIES_READY, onGetCapabilitiesLoadReady, true);
|
|
6622
|
-
},
|
|
6623
|
-
onWMJSUnMount: function onWMJSUnMount(mapId) {
|
|
6624
|
-
unRegister(mapId);
|
|
6625
|
-
wmServiceListener.removeEventListener(EVENT_GETCAPABILITIES_START, onGetCapabilitiesLoadStart);
|
|
6626
|
-
wmServiceListener.removeEventListener(EVENT_GETCAPABILITIES_READY, onGetCapabilitiesLoadReady);
|
|
6627
|
-
},
|
|
6628
|
-
children: [baseLayers.map(function (layer) {
|
|
6629
|
-
return jsx(MapViewLayer, Object.assign({
|
|
6630
|
-
id: "baselayer-" + layer.id,
|
|
6631
|
-
onLayerError: function onLayerError(_, error) {
|
|
6632
|
-
layerError({
|
|
6633
|
-
layerId: layer.id,
|
|
6634
|
-
error: Error("" + error)
|
|
6635
|
-
});
|
|
6636
|
-
}
|
|
6637
|
-
}, layer), layer.id);
|
|
6638
|
-
}), layers.map(function (layer) {
|
|
6639
|
-
return jsx(MapViewLayer, Object.assign({
|
|
6640
|
-
id: "layer-" + layer.id,
|
|
6641
|
-
onLayerError: function onLayerError(_, error) {
|
|
6642
|
-
layerError({
|
|
6643
|
-
layerId: layer.id,
|
|
6644
|
-
error: Error("" + error)
|
|
6645
|
-
});
|
|
6646
|
-
}
|
|
6647
|
-
}, layer), layer.id);
|
|
6648
|
-
}), (_linkedFeatures$conca = linkedFeatures.concat(linkedFormFeatures)) == null ? void 0 : _linkedFeatures$conca.map(function (feature) {
|
|
6649
|
-
return jsx(MapViewLayer, {
|
|
6650
|
-
id: feature.id,
|
|
6651
|
-
geojson: feature == null ? void 0 : feature.geoJSON,
|
|
6652
|
-
onHoverFeature: function onHoverFeature(hoverInfo) {
|
|
6653
|
-
if (hoverInfo === undefined && hoverId !== undefined) {
|
|
6654
|
-
debouncedSetHoverFeature();
|
|
6655
|
-
} else if (hoverInfo != null && hoverInfo.feature && feature.originalId !== hoverId) {
|
|
6656
|
-
debouncedSetHoverFeature(feature.originalId);
|
|
6657
|
-
}
|
|
6658
|
-
},
|
|
6659
|
-
onClickFeature: function onClickFeature(event) {
|
|
6660
|
-
var _event$feature$proper;
|
|
6661
|
-
var isClickOutsideFeature = !event || !event.feature;
|
|
6662
|
-
if (isClickOutsideFeature) {
|
|
6663
|
-
if (mapPinLocation) {
|
|
6664
|
-
handleFeatureSelect(linkedPanelId, undefined);
|
|
6665
|
-
}
|
|
6666
|
-
return;
|
|
6667
|
-
}
|
|
6668
|
-
// Handle clicks on station
|
|
6669
|
-
var clickedFeatureName = (_event$feature$proper = event.feature.properties) == null ? void 0 : _event$feature$proper.name;
|
|
6670
|
-
var features = linkedFeatures[0].geoJSON.features;
|
|
6671
|
-
var clickedFeatureIndex = features.findIndex(function (feature) {
|
|
6672
|
-
var _feature$properties;
|
|
6673
|
-
return ((_feature$properties = feature.properties) == null ? void 0 : _feature$properties.name) === clickedFeatureName;
|
|
6674
|
-
});
|
|
6675
|
-
if (disableMapPin === false) {
|
|
6676
|
-
var _selectedFeature$id;
|
|
6677
|
-
var selectedFeature = features[clickedFeatureIndex];
|
|
6678
|
-
handleFeatureSelect(linkedPanelId, (_selectedFeature$id = selectedFeature.id) == null ? void 0 : _selectedFeature$id.toString());
|
|
6679
|
-
}
|
|
6680
|
-
}
|
|
6681
|
-
}, feature.id);
|
|
6682
|
-
}), featureLayers.map(function (layer) {
|
|
6683
|
-
return jsx(MapViewLayer, Object.assign({
|
|
6684
|
-
id: "featurelayer-" + layer.id,
|
|
6685
|
-
onLayerError: function onLayerError(_, error) {
|
|
6686
|
-
layerError({
|
|
6687
|
-
layerId: layer.id,
|
|
6688
|
-
error: Error("" + error)
|
|
6689
|
-
});
|
|
6690
|
-
},
|
|
6691
|
-
onClickFeature: function onClickFeature(event) {
|
|
6692
|
-
var isClickOutsideFeature = !event;
|
|
6693
|
-
if (isClickOutsideFeature && !layer.isInEditMode) {
|
|
6694
|
-
setSelectedFeature({
|
|
6695
|
-
layerId: layer.id,
|
|
6696
|
-
selectedFeatureIndex: undefined
|
|
6697
|
-
});
|
|
6698
|
-
return;
|
|
6699
|
-
}
|
|
6700
|
-
if ((event == null ? void 0 : event.isInEditMode) === false) {
|
|
6701
|
-
setSelectedFeature({
|
|
6702
|
-
layerId: layer.id,
|
|
6703
|
-
selectedFeatureIndex: event.featureIndex
|
|
6704
|
-
});
|
|
6705
|
-
}
|
|
6706
|
-
},
|
|
6707
|
-
updateGeojson: function updateGeojson(geojson, reason) {
|
|
6708
|
-
updateFeature({
|
|
6709
|
-
geojson: geojson,
|
|
6710
|
-
layerId: layer.id,
|
|
6711
|
-
reason: reason
|
|
6712
|
-
});
|
|
6713
|
-
},
|
|
6714
|
-
exitDrawModeCallback: function exitDrawModeCallback(reason) {
|
|
6715
|
-
return exitFeatureDrawMode({
|
|
6716
|
-
reason: reason,
|
|
6717
|
-
layerId: layer.id
|
|
6718
|
-
});
|
|
7616
|
+
}, "layer-" + layerId);
|
|
7617
|
+
}), overLayers.filter(function (layer) {
|
|
7618
|
+
return layer == null ? void 0 : layer.service;
|
|
7619
|
+
}).map(function (layer, zIndex) {
|
|
7620
|
+
return jsx(WMSLayer, {
|
|
7621
|
+
url: layer.service,
|
|
7622
|
+
layerName: layer.name,
|
|
7623
|
+
styleName: layer.style,
|
|
7624
|
+
layerOptions: {
|
|
7625
|
+
zIndex: overLayers.length - zIndex + 2000
|
|
6719
7626
|
}
|
|
6720
|
-
}, layer
|
|
6721
|
-
}),
|
|
6722
|
-
return jsx(
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
7627
|
+
}, "overlayer-" + (layer == null ? void 0 : layer.id));
|
|
7628
|
+
}), featureLayers.map(function (layer, zIndex) {
|
|
7629
|
+
return jsx(OpenLayersFeatureLayerConnect, {
|
|
7630
|
+
layerId: layer == null ? void 0 : layer.id,
|
|
7631
|
+
layer: layer,
|
|
7632
|
+
zIndex: mapLayerIds.length - zIndex + 3000,
|
|
7633
|
+
style: genericOpenlayersFeatureStyle,
|
|
7634
|
+
hoverSelect: {
|
|
7635
|
+
active: true
|
|
6729
7636
|
}
|
|
6730
|
-
}, layer
|
|
6731
|
-
}),
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
},
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
7637
|
+
}, "featurelayer-" + (layer == null ? void 0 : layer.id));
|
|
7638
|
+
}), jsx(GeoJSONLayer, {
|
|
7639
|
+
style: genericOpenlayersFeatureStyle,
|
|
7640
|
+
featureCollection: linkedFeatures,
|
|
7641
|
+
zIndex: 4000,
|
|
7642
|
+
hoverSelect: hoverSelect
|
|
7643
|
+
}), jsx(OpenLayersGetFeatureInfo, {
|
|
7644
|
+
mapPinLocation: mapPinLocation,
|
|
7645
|
+
displayMapPin: displayMapPin,
|
|
7646
|
+
selectLocation: mapPinChangeLocation
|
|
7647
|
+
}), jsxs(MapControls, {
|
|
7648
|
+
"data-testid": "mapControls",
|
|
7649
|
+
style: {
|
|
7650
|
+
top: controls == null ? void 0 : controls.mapControlsPositionTop
|
|
7651
|
+
},
|
|
7652
|
+
children: [(controls == null ? void 0 : controls.search) && jsx(SearchControlButtonConnect, {
|
|
6743
7653
|
mapId: mapId
|
|
6744
|
-
}), jsx(
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
7654
|
+
}), (controls == null ? void 0 : controls.zoomControls) && jsx(OpenLayersZoomControl, {
|
|
7655
|
+
homeExtent: homeExtent
|
|
7656
|
+
}), (controls == null ? void 0 : controls.layerManagerAndLegend) && jsxs(Fragment, {
|
|
7657
|
+
children: [jsx(LayerManagerMapButtonConnect, {
|
|
7658
|
+
mapId: mapId
|
|
7659
|
+
}), jsx(LegendMapButtonConnect, {
|
|
7660
|
+
mapId: mapId,
|
|
7661
|
+
multiLegend: controls == null ? void 0 : controls.multiLegend
|
|
7662
|
+
})]
|
|
7663
|
+
}), (controls == null ? void 0 : controls.dimensionSelect) && jsx(MultiDimensionSelectMapButtonsConnect, {
|
|
7664
|
+
mapId: mapId
|
|
7665
|
+
}), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoButtonConnect, {
|
|
7666
|
+
mapId: mapId
|
|
7667
|
+
}), controls == null ? void 0 : controls.additionalMapControls]
|
|
7668
|
+
}), (controls == null ? void 0 : controls.multiLegend) && jsx(LegendConnect, {
|
|
7669
|
+
showMapId: true,
|
|
7670
|
+
mapId: mapId,
|
|
7671
|
+
multiLegend: controls == null ? void 0 : controls.multiLegend
|
|
7672
|
+
}), (controls == null ? void 0 : controls.search) && jsx(SearchDialogConnect, {
|
|
6749
7673
|
mapId: mapId
|
|
6750
|
-
}), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(
|
|
7674
|
+
}), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoConnect, {
|
|
7675
|
+
showMapId: true,
|
|
6751
7676
|
mapId: mapId
|
|
6752
|
-
}),
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
})
|
|
6758
|
-
mapId: mapId
|
|
6759
|
-
}), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoConnect, {
|
|
6760
|
-
showMapId: true,
|
|
6761
|
-
mapId: mapId
|
|
6762
|
-
}), jsx(LayerManagerConnect, {
|
|
6763
|
-
mapId: mapId,
|
|
6764
|
-
bounds: "parent",
|
|
6765
|
-
isDocked: true
|
|
6766
|
-
})]
|
|
7677
|
+
}), jsx(LayerManagerConnect, {
|
|
7678
|
+
mapId: mapId,
|
|
7679
|
+
bounds: "parent",
|
|
7680
|
+
isDocked: true
|
|
7681
|
+
})]
|
|
7682
|
+
})
|
|
6767
7683
|
});
|
|
6768
7684
|
};
|
|
6769
7685
|
|
|
@@ -6981,7 +7897,8 @@ var TimeSpanButtonConnect = function TimeSpanButtonConnect(_ref) {
|
|
|
6981
7897
|
}));
|
|
6982
7898
|
dispatch(mapActions.setTimeSliderSpan({
|
|
6983
7899
|
mapId: mapId,
|
|
6984
|
-
timeSliderSpan: spanInSeconds
|
|
7900
|
+
timeSliderSpan: spanInSeconds,
|
|
7901
|
+
origin: mapEnums.MapActionOrigin.map
|
|
6985
7902
|
}));
|
|
6986
7903
|
dispatch(mapActions.setTimeSliderCenterTime({
|
|
6987
7904
|
mapId: mapId,
|
|
@@ -7258,7 +8175,8 @@ var TimeSliderLegendConnect = function TimeSliderLegendConnect(_ref) {
|
|
|
7258
8175
|
onSetTimeSliderSpan = _ref.onSetTimeSliderSpan,
|
|
7259
8176
|
unfilteredSelectedTime = _ref.unfilteredSelectedTime,
|
|
7260
8177
|
setUnfilteredSelectedTime = _ref.setUnfilteredSelectedTime,
|
|
7261
|
-
mapWindowRef = _ref.mapWindowRef
|
|
8178
|
+
mapWindowRef = _ref.mapWindowRef,
|
|
8179
|
+
adjustSelectedTimeOnWheel = _ref.adjustSelectedTimeOnWheel;
|
|
7262
8180
|
var isTimeScrollingEnabled = useSelector(syncGroupsSelectors.isTimeScrollingEnabled);
|
|
7263
8181
|
var centerTime = useSelector(function (store) {
|
|
7264
8182
|
return mapSelectors.getMapTimeSliderCenterTime(store, mapId);
|
|
@@ -7390,7 +8308,8 @@ var TimeSliderLegendConnect = function TimeSliderLegendConnect(_ref) {
|
|
|
7390
8308
|
}));
|
|
7391
8309
|
}
|
|
7392
8310
|
}
|
|
7393
|
-
}
|
|
8311
|
+
},
|
|
8312
|
+
adjustSelectedTimeOnWheel: adjustSelectedTimeOnWheel
|
|
7394
8313
|
});
|
|
7395
8314
|
};
|
|
7396
8315
|
|
|
@@ -7450,10 +8369,7 @@ var useUpdateTimeSpan = function useUpdateTimeSpan(mapId, myOnSetTimeSliderSpan)
|
|
|
7450
8369
|
}
|
|
7451
8370
|
};
|
|
7452
8371
|
React.useEffect(function () {
|
|
7453
|
-
if (
|
|
7454
|
-
return;
|
|
7455
|
-
}
|
|
7456
|
-
if (isTimeSpanAuto && autoTimeStepLayerId) {
|
|
8372
|
+
if (isTimeSpanAuto && autoTimeStepLayerId && activeLayerTimeDimension) {
|
|
7457
8373
|
var _getTimeBounds = getTimeBounds([activeLayerTimeDimension]),
|
|
7458
8374
|
startTime = _getTimeBounds.startTime,
|
|
7459
8375
|
endTime = _getTimeBounds.endTime;
|
|
@@ -7468,7 +8384,7 @@ var useUpdateTimeSpan = function useUpdateTimeSpan(mapId, myOnSetTimeSliderSpan)
|
|
|
7468
8384
|
updateTimeSliderSpan(_spanInSeconds, _newCenterTime, _newSecondsPerPx);
|
|
7469
8385
|
}
|
|
7470
8386
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7471
|
-
}, [autoTimeStepLayerId, isTimeSpanAuto,
|
|
8387
|
+
}, [autoTimeStepLayerId, isTimeSpanAuto, mapId]);
|
|
7472
8388
|
};
|
|
7473
8389
|
var timeToIso = function timeToIso(selectedTime) {
|
|
7474
8390
|
return handleDateUtilsISOString(dateUtils.fromUnix(selectedTime).toISOString());
|
|
@@ -7549,9 +8465,6 @@ var TimeSliderConnect = function TimeSliderConnect(_ref) {
|
|
|
7549
8465
|
});
|
|
7550
8466
|
useUpdateTimestep(mapId);
|
|
7551
8467
|
useUpdateTimeSpan(mapId, onSetTimeSliderSpan);
|
|
7552
|
-
var makeFilteredSelectedTime = function makeFilteredSelectedTime(timeValue) {
|
|
7553
|
-
return getFilteredTime(timeValue, timeStep, dataStartTime, dataEndTime);
|
|
7554
|
-
};
|
|
7555
8468
|
// Local state for unfiltered selected time
|
|
7556
8469
|
var _React$useState = React.useState(selectedTime),
|
|
7557
8470
|
unfilteredSelectedTime = _React$useState[0],
|
|
@@ -7559,7 +8472,7 @@ var TimeSliderConnect = function TimeSliderConnect(_ref) {
|
|
|
7559
8472
|
// Reference to the last time value set by this timeslider
|
|
7560
8473
|
var lastTimeValueAsSetByThisTimeSlider = React.useRef();
|
|
7561
8474
|
// Set new time in the redux state
|
|
7562
|
-
var _onSetNewDate = function
|
|
8475
|
+
var _onSetNewDate = React.useCallback(function (newDate) {
|
|
7563
8476
|
// Remember that this timeslider has set this time
|
|
7564
8477
|
lastTimeValueAsSetByThisTimeSlider.current = newDate;
|
|
7565
8478
|
if (isAnimating) {
|
|
@@ -7572,7 +8485,7 @@ var TimeSliderConnect = function TimeSliderConnect(_ref) {
|
|
|
7572
8485
|
origin: 'TimeSliderConnect',
|
|
7573
8486
|
value: handleDateUtilsISOString(newDate)
|
|
7574
8487
|
}));
|
|
7575
|
-
};
|
|
8488
|
+
}, [dispatch, isAnimating, mapId, sourceId]);
|
|
7576
8489
|
// Update local state when time is updated outside of this component, e.g. during animation or syncgroups
|
|
7577
8490
|
React.useEffect(function () {
|
|
7578
8491
|
var selectedTimeAsIsoString = timeToIso(selectedTime);
|
|
@@ -7581,13 +8494,16 @@ var TimeSliderConnect = function TimeSliderConnect(_ref) {
|
|
|
7581
8494
|
}
|
|
7582
8495
|
}, [selectedTime]);
|
|
7583
8496
|
// Function used by timeslider components to update the unfiltered selected time
|
|
7584
|
-
var setUnfilteredSelectedTime = function
|
|
8497
|
+
var setUnfilteredSelectedTime = React.useCallback(function (unfilteredSelectedTimeFromComponents) {
|
|
8498
|
+
var makeFilteredSelectedTime = function makeFilteredSelectedTime(timeValue) {
|
|
8499
|
+
return getFilteredTime(timeValue, timeStep, dataStartTime, dataEndTime);
|
|
8500
|
+
};
|
|
7585
8501
|
setUnfilteredSelectedTimeViaState(unfilteredSelectedTimeFromComponents);
|
|
7586
8502
|
var filteredIsoTime = makeFilteredSelectedTime(unfilteredSelectedTimeFromComponents);
|
|
7587
8503
|
if (selectedTime !== filteredIsoTime) {
|
|
7588
8504
|
onsetNewDateDebounced(timeToIso(filteredIsoTime), _onSetNewDate);
|
|
7589
8505
|
}
|
|
7590
|
-
};
|
|
8506
|
+
}, [dataEndTime, dataStartTime, _onSetNewDate, selectedTime, timeStep]);
|
|
7591
8507
|
// Move animation bar when user changes time using time picker
|
|
7592
8508
|
// Animation bar however cannot be moved into a time where there is no data
|
|
7593
8509
|
var moveAnimationUsingCalendar = function moveAnimationUsingCalendar(newTime) {
|
|
@@ -7613,6 +8529,40 @@ var TimeSliderConnect = function TimeSliderConnect(_ref) {
|
|
|
7613
8529
|
setUnfilteredSelectedTime(newSelectedTime);
|
|
7614
8530
|
moveAnimationUsingCalendar(newSelectedTime);
|
|
7615
8531
|
};
|
|
8532
|
+
var secondsPerPx = useSelector(function (store) {
|
|
8533
|
+
return mapSelectors.getMapTimeSliderSecondsPerPx(store, mapId);
|
|
8534
|
+
}) || defaultSecondsPerPx;
|
|
8535
|
+
var timeSliderWidth = useSelector(function (store) {
|
|
8536
|
+
return mapSelectors.getMapTimeSliderWidth(store, mapId);
|
|
8537
|
+
}) || 0;
|
|
8538
|
+
var centerTime = useSelector(function (store) {
|
|
8539
|
+
return mapSelectors.getMapTimeSliderCenterTime(store, mapId);
|
|
8540
|
+
});
|
|
8541
|
+
var isTimeScrollingEnabled = useSelector(syncGroupsSelectors.isTimeScrollingEnabled);
|
|
8542
|
+
var adjustSelectedTimeOnWheel = React.useCallback(function (_ref2) {
|
|
8543
|
+
var event = _ref2.event,
|
|
8544
|
+
deltaY = _ref2.deltaY;
|
|
8545
|
+
if (!(event.ctrlKey || event.metaKey || event.shiftKey || event.altKey)) {
|
|
8546
|
+
var pixelsPerScroll = -deltaY * timeStep / (2 * secondsPerPx);
|
|
8547
|
+
moveSelectedTimePx(pixelsPerScroll, timeSliderWidth, centerTime, dataStartTime, dataEndTime, secondsPerPx, timeStep, unfilteredSelectedTime, setUnfilteredSelectedTime);
|
|
8548
|
+
}
|
|
8549
|
+
}, [timeSliderWidth, centerTime, dataEndTime, dataStartTime, secondsPerPx, setUnfilteredSelectedTime, timeStep, unfilteredSelectedTime]);
|
|
8550
|
+
React.useEffect(function () {
|
|
8551
|
+
if (isTimeScrollingEnabled && mapWindowRef != null && mapWindowRef.current) {
|
|
8552
|
+
var handleWheel = function handleWheel(event) {
|
|
8553
|
+
adjustSelectedTimeOnWheel({
|
|
8554
|
+
event: event,
|
|
8555
|
+
deltaY: event.deltaY
|
|
8556
|
+
});
|
|
8557
|
+
};
|
|
8558
|
+
var element = mapWindowRef.current;
|
|
8559
|
+
element.addEventListener('wheel', handleWheel);
|
|
8560
|
+
return function () {
|
|
8561
|
+
element.removeEventListener('wheel', handleWheel);
|
|
8562
|
+
};
|
|
8563
|
+
}
|
|
8564
|
+
return undefined;
|
|
8565
|
+
}, [isTimeScrollingEnabled, mapWindowRef, adjustSelectedTimeOnWheel]);
|
|
7616
8566
|
return jsx(TimeSlider, {
|
|
7617
8567
|
timeStep: timeStep,
|
|
7618
8568
|
dataStartTime: dataStartTime,
|
|
@@ -7642,7 +8592,8 @@ var TimeSliderConnect = function TimeSliderConnect(_ref) {
|
|
|
7642
8592
|
onSetTimeSliderSpan: onSetTimeSliderSpan,
|
|
7643
8593
|
unfilteredSelectedTime: unfilteredSelectedTime,
|
|
7644
8594
|
setUnfilteredSelectedTime: setUnfilteredSelectedTime,
|
|
7645
|
-
mapWindowRef: mapWindowRef
|
|
8595
|
+
mapWindowRef: mapWindowRef,
|
|
8596
|
+
adjustSelectedTimeOnWheel: adjustSelectedTimeOnWheel
|
|
7646
8597
|
}),
|
|
7647
8598
|
mapIsActive: mapIsActive,
|
|
7648
8599
|
onToggleTimeSlider: onToggleTimeSliderVisibility,
|
|
@@ -7714,7 +8665,7 @@ var TimeSliderClockConnect = function TimeSliderClockConnect(_ref) {
|
|
|
7714
8665
|
});
|
|
7715
8666
|
};
|
|
7716
8667
|
|
|
7717
|
-
var _excluded = ["id", "dockedLayerManagerSize", "title", "layers", "dimensions", "shouldAutoUpdate", "shouldAnimate", "shouldAutoFetch", "
|
|
8668
|
+
var _excluded = ["id", "dockedLayerManagerSize", "title", "layers", "dimensions", "shouldAutoUpdate", "shouldAnimate", "shouldAutoFetch", "initialBbox", "srs", "shouldShowZoomControls", "displayMapPin", "showTimeSlider", "disableTimeSlider", "displayTimeInMap", "displayLayerManagerAndLegendButtonInMap", "displayDimensionSelectButtonInMap", "multiLegend", "shouldShowLayerManager", "shouldShowDockedLayerManager", "showClock", "displayGetFeatureInfoButtonInMap", "shouldDisplayDrawControls", "displaySearchButtonInMap", "useOl", "mapControls", "children", "shouldDisablePrefetching", "tileServerSettings"];
|
|
7718
8669
|
var titleStyle = function titleStyle(theme) {
|
|
7719
8670
|
return {
|
|
7720
8671
|
position: 'absolute',
|
|
@@ -7749,8 +8700,8 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
7749
8700
|
shouldAnimate = _ref$shouldAnimate === void 0 ? false : _ref$shouldAnimate,
|
|
7750
8701
|
_ref$shouldAutoFetch = _ref.shouldAutoFetch,
|
|
7751
8702
|
shouldAutoFetch = _ref$shouldAutoFetch === void 0 ? true : _ref$shouldAutoFetch,
|
|
7752
|
-
_ref$
|
|
7753
|
-
|
|
8703
|
+
_ref$initialBbox = _ref.initialBbox,
|
|
8704
|
+
initialBbox = _ref$initialBbox === void 0 ? defaultBbox.bbox : _ref$initialBbox,
|
|
7754
8705
|
_ref$srs = _ref.srs,
|
|
7755
8706
|
srs = _ref$srs === void 0 ? defaultBbox.srs : _ref$srs,
|
|
7756
8707
|
_ref$shouldShowZoomCo = _ref.shouldShowZoomControls,
|
|
@@ -7779,6 +8730,8 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
7779
8730
|
shouldDisplayDrawControls = _ref$shouldDisplayDra === void 0 ? false : _ref$shouldDisplayDra,
|
|
7780
8731
|
_ref$displaySearchBut = _ref.displaySearchButtonInMap,
|
|
7781
8732
|
displaySearchButtonInMap = _ref$displaySearchBut === void 0 ? false : _ref$displaySearchBut,
|
|
8733
|
+
_ref$useOl = _ref.useOl,
|
|
8734
|
+
useOl = _ref$useOl === void 0 ? true : _ref$useOl,
|
|
7782
8735
|
mapControls = _ref.mapControls,
|
|
7783
8736
|
children = _ref.children,
|
|
7784
8737
|
shouldDisablePrefetching = _ref.shouldDisablePrefetching,
|
|
@@ -7807,7 +8760,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
7807
8760
|
var mapPreset = Object.assign({
|
|
7808
8761
|
layers: updatedLayers,
|
|
7809
8762
|
proj: {
|
|
7810
|
-
bbox:
|
|
8763
|
+
bbox: initialBbox,
|
|
7811
8764
|
srs: srs
|
|
7812
8765
|
},
|
|
7813
8766
|
dimensions: dimensions,
|
|
@@ -7898,7 +8851,17 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
7898
8851
|
sourceId: id,
|
|
7899
8852
|
mapWindowRef: mapWindowRef
|
|
7900
8853
|
})
|
|
7901
|
-
}), jsx(
|
|
8854
|
+
}), useOl ? jsx(OlMapViewConnect, {
|
|
8855
|
+
controls: mapControlConfig,
|
|
8856
|
+
displayTimeInMap: displayTimeInMap,
|
|
8857
|
+
showScaleBar: false,
|
|
8858
|
+
shouldAutoFetch: shouldAutoFetch,
|
|
8859
|
+
mapId: mapId,
|
|
8860
|
+
initialBbox: initialBbox,
|
|
8861
|
+
shouldDisablePrefetching: shouldDisablePrefetching,
|
|
8862
|
+
tileServerSettings: tileServerSettings,
|
|
8863
|
+
children: children
|
|
8864
|
+
}) : jsx(MapViewConnect, {
|
|
7902
8865
|
controls: mapControlConfig,
|
|
7903
8866
|
displayTimeInMap: displayTimeInMap,
|
|
7904
8867
|
showScaleBar: false,
|
|
@@ -7911,7 +8874,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
7911
8874
|
mapId: mapId
|
|
7912
8875
|
})]
|
|
7913
8876
|
});
|
|
7914
|
-
}, [mapId, title, id, mapControlConfig, tileServerSettings, disableTimeSlider, displayTimeInMap, shouldAutoFetch, shouldDisablePrefetching, children, showClock]);
|
|
8877
|
+
}, [mapId, title, id, useOl, initialBbox, mapControlConfig, tileServerSettings, disableTimeSlider, displayTimeInMap, shouldAutoFetch, shouldDisablePrefetching, children, showClock]);
|
|
7915
8878
|
};
|
|
7916
8879
|
|
|
7917
8880
|
var mapBoxStyle = function mapBoxStyle(theme) {
|
|
@@ -8007,7 +8970,7 @@ var MultiMapViewConnect = function MultiMapViewConnect(_ref) {
|
|
|
8007
8970
|
layers: map.layers || [],
|
|
8008
8971
|
autoTimeStepLayerId: map.autoTimeStepLayerId,
|
|
8009
8972
|
autoUpdateLayerId: map.autoUpdateLayerId,
|
|
8010
|
-
|
|
8973
|
+
initialBbox: map.bbox,
|
|
8011
8974
|
srs: map.srs,
|
|
8012
8975
|
dimensions: map.dimensions || [],
|
|
8013
8976
|
displayTimeInMap: map.displayTimeInMap || false,
|
|
@@ -8138,6 +9101,9 @@ var useGetReferenceTimes = function useGetReferenceTimes(inputLayer) {
|
|
|
8138
9101
|
var _React$useState = React.useState([]),
|
|
8139
9102
|
referenceTimes = _React$useState[0],
|
|
8140
9103
|
setReferenceTimes = _React$useState[1];
|
|
9104
|
+
var _React$useState2 = React.useState(null),
|
|
9105
|
+
error = _React$useState2[0],
|
|
9106
|
+
setError = _React$useState2[1];
|
|
8141
9107
|
React.useEffect(function () {
|
|
8142
9108
|
var referenceTimes = [];
|
|
8143
9109
|
var wmLayer = new WMLayer(Object.assign({}, inputLayer));
|
|
@@ -8150,9 +9116,14 @@ var useGetReferenceTimes = function useGetReferenceTimes(inputLayer) {
|
|
|
8150
9116
|
referenceTimes.push(referenceTimeValue);
|
|
8151
9117
|
}
|
|
8152
9118
|
setReferenceTimes(referenceTimes);
|
|
8153
|
-
})["catch"](
|
|
9119
|
+
})["catch"](function (error) {
|
|
9120
|
+
setError(error);
|
|
9121
|
+
});
|
|
8154
9122
|
}, [inputLayer]);
|
|
8155
|
-
return
|
|
9123
|
+
return {
|
|
9124
|
+
referenceTimes: referenceTimes,
|
|
9125
|
+
error: error
|
|
9126
|
+
};
|
|
8156
9127
|
};
|
|
8157
9128
|
var HarmonieTempAndPrecipPreset = function HarmonieTempAndPrecipPreset(_ref) {
|
|
8158
9129
|
var layers = _ref.layers,
|
|
@@ -8161,7 +9132,14 @@ var HarmonieTempAndPrecipPreset = function HarmonieTempAndPrecipPreset(_ref) {
|
|
|
8161
9132
|
var displayLayerManagerAndLegendButtonInAllTopRows = !useHasSyncGroupWithLayerActions(layers && layers.topRowSyncGroups);
|
|
8162
9133
|
var displayLayerManagerAndLegendButtonInAllBottomRows = !useHasSyncGroupWithLayerActions(layers && layers.bottomRowSyncGroups);
|
|
8163
9134
|
/* Get all the reference times for this layer */
|
|
8164
|
-
var
|
|
9135
|
+
var _useGetReferenceTimes = useGetReferenceTimes(layers.topRow),
|
|
9136
|
+
referenceTimes = _useGetReferenceTimes.referenceTimes,
|
|
9137
|
+
error = _useGetReferenceTimes.error;
|
|
9138
|
+
if (error) {
|
|
9139
|
+
return jsx(AlertBanner, {
|
|
9140
|
+
title: error.message
|
|
9141
|
+
});
|
|
9142
|
+
}
|
|
8165
9143
|
if (referenceTimes.length === 0) {
|
|
8166
9144
|
return jsx("div", {
|
|
8167
9145
|
children: "Loading..."
|
|
@@ -8224,17 +9202,20 @@ var componentsLookUp = function componentsLookUp(_ref) {
|
|
|
8224
9202
|
switch (componentType) {
|
|
8225
9203
|
case 'Map':
|
|
8226
9204
|
{
|
|
9205
|
+
var _mapPreset$proj;
|
|
8227
9206
|
var mapPreset = initialProps.mapPreset,
|
|
8228
9207
|
mapControls = initialProps.mapControls,
|
|
8229
9208
|
shouldDisplayDrawControls = initialProps.shouldDisplayDrawControls,
|
|
8230
9209
|
displaySearchButtonInMap = initialProps.displaySearchButtonInMap;
|
|
8231
9210
|
return jsx(ConfigurableMapConnect, Object.assign({}, mapPreset, {
|
|
9211
|
+
initialBbox: mapPreset == null || (_mapPreset$proj = mapPreset.proj) == null ? void 0 : _mapPreset$proj.bbox,
|
|
8232
9212
|
id: id,
|
|
8233
9213
|
"data-testid": "coreConfigurableMapConnect",
|
|
8234
9214
|
displayGetFeatureInfoButtonInMap: true,
|
|
8235
9215
|
shouldDisplayDrawControls: shouldDisplayDrawControls,
|
|
8236
9216
|
displaySearchButtonInMap: displaySearchButtonInMap,
|
|
8237
|
-
mapControls: mapControls
|
|
9217
|
+
mapControls: mapControls,
|
|
9218
|
+
useOl: isOpenLayersEnabled()
|
|
8238
9219
|
}));
|
|
8239
9220
|
}
|
|
8240
9221
|
case 'MultiMap':
|
|
@@ -8425,7 +9406,7 @@ var SyncGroupViewer = function SyncGroupViewer(_ref) {
|
|
|
8425
9406
|
React.useEffect(function () {
|
|
8426
9407
|
var handleKeyDown = function handleKeyDown(event) {
|
|
8427
9408
|
var target = event.target;
|
|
8428
|
-
if (target.tagName !== 'INPUT' && target.tagName !== 'TEXTAREA' && event.key === 's') {
|
|
9409
|
+
if (target.tagName !== 'INPUT' && target.tagName !== 'TEXTAREA' && (event.key === 's' || event.key === 'S') && !event.getModifierState('Control') && !event.getModifierState('Alt') && !event.getModifierState('AltGraph') && !event.getModifierState('Meta')) {
|
|
8429
9410
|
toggleTimeScroll({
|
|
8430
9411
|
isTimeScrollingEnabled: !isTimeScrollingEnabled
|
|
8431
9412
|
});
|
|
@@ -8756,17 +9737,19 @@ var CoreThemeProvider = function CoreThemeProvider(_ref) {
|
|
|
8756
9737
|
var children = _ref.children,
|
|
8757
9738
|
_ref$theme = _ref.theme,
|
|
8758
9739
|
theme = _ref$theme === void 0 ? lightTheme : _ref$theme;
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
9740
|
+
var queryClient = new QueryClient({
|
|
9741
|
+
defaultOptions: {
|
|
9742
|
+
queries: {
|
|
9743
|
+
retry: false
|
|
9744
|
+
}
|
|
9745
|
+
}
|
|
8762
9746
|
});
|
|
8763
|
-
|
|
8764
|
-
var ThemeWrapperWithModules = function ThemeWrapperWithModules(_ref2) {
|
|
8765
|
-
var theme = _ref2.theme,
|
|
8766
|
-
children = _ref2.children;
|
|
8767
|
-
return jsx(CoreThemeProvider, {
|
|
9747
|
+
return jsx(ThemeWrapper, {
|
|
8768
9748
|
theme: theme,
|
|
8769
|
-
children:
|
|
9749
|
+
children: jsx(QueryClientProvider, {
|
|
9750
|
+
client: queryClient,
|
|
9751
|
+
children: children
|
|
9752
|
+
})
|
|
8770
9753
|
});
|
|
8771
9754
|
};
|
|
8772
9755
|
/**
|
|
@@ -8775,14 +9758,14 @@ var ThemeWrapperWithModules = function ThemeWrapperWithModules(_ref2) {
|
|
|
8775
9758
|
* @param children
|
|
8776
9759
|
* @returns
|
|
8777
9760
|
*/
|
|
8778
|
-
var CoreThemeStoreProvider = function CoreThemeStoreProvider(
|
|
8779
|
-
var children =
|
|
8780
|
-
|
|
8781
|
-
theme =
|
|
8782
|
-
store =
|
|
9761
|
+
var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref2) {
|
|
9762
|
+
var children = _ref2.children,
|
|
9763
|
+
_ref2$theme = _ref2.theme,
|
|
9764
|
+
theme = _ref2$theme === void 0 ? lightTheme : _ref2$theme,
|
|
9765
|
+
store = _ref2.store;
|
|
8783
9766
|
return jsx(Provider, {
|
|
8784
9767
|
store: store,
|
|
8785
|
-
children: jsx(
|
|
9768
|
+
children: jsx(CoreThemeProvider, {
|
|
8786
9769
|
theme: theme,
|
|
8787
9770
|
children: jsx(SnackbarWrapperConnect, {
|
|
8788
9771
|
children: children
|
|
@@ -8790,8 +9773,8 @@ var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref3) {
|
|
|
8790
9773
|
})
|
|
8791
9774
|
});
|
|
8792
9775
|
};
|
|
8793
|
-
var CoreI18nProvider = function CoreI18nProvider(
|
|
8794
|
-
var children =
|
|
9776
|
+
var CoreI18nProvider = function CoreI18nProvider(_ref3) {
|
|
9777
|
+
var children = _ref3.children;
|
|
8795
9778
|
initCoreReactI18n();
|
|
8796
9779
|
return jsx(I18nextProvider, {
|
|
8797
9780
|
i18n: i18n,
|
|
@@ -9017,4 +10000,4 @@ var LanguageSelect = function LanguageSelect(_ref) {
|
|
|
9017
10000
|
});
|
|
9018
10001
|
};
|
|
9019
10002
|
|
|
9020
|
-
export { CORE_NAMESPACE, ConfigurableMapConnect, CoreI18nProvider, CoreThemeProvider, CoreThemeStoreProvider, DemoWrapper, DemoWrapperConnect, HarmonieTempAndPrecipPreset, LanguageSelect, LayerInfoButtonConnect, LayerInfoDialogConnect, LayerManager, BaseLayerRow as LayerManagerBaseLayerRow, LayerManagerConnect, DescriptionRow as LayerManagerDescriptionRow, HeaderOptions as LayerManagerHeaderOptions, LayerContainerRow as LayerManagerLayerContainerRow, LayerManagerMapButtonConnect, LegendConnect, LegendMapButtonConnect, MapViewConnect, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, MyMapLocation, RouterWrapperConnect, SearchControlButtonConnect,
|
|
10003
|
+
export { CORE_NAMESPACE, ConfigurableMapConnect, CoreI18nProvider, CoreThemeProvider, CoreThemeStoreProvider, DemoWrapper, DemoWrapperConnect, HarmonieTempAndPrecipPreset, LanguageSelect, LayerInfoButtonConnect, LayerInfoDialogConnect, LayerManager, BaseLayerRow as LayerManagerBaseLayerRow, LayerManagerConnect, DescriptionRow as LayerManagerDescriptionRow, HeaderOptions as LayerManagerHeaderOptions, LayerContainerRow as LayerManagerLayerContainerRow, LayerManagerMapButtonConnect, LegendConnect, LegendMapButtonConnect, MapViewConnect, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, MyMapLocation, OlMapViewConnect, RouterWrapperConnect, SearchControlButtonConnect, SearchDialog, SearchDialogConnect, SentryRecordButton, SyncGroupViewerConnect, TimeSliderConnect, ZoomControlConnect, componentsLookUp, coreTranslations, defaultBbox, defaultConfigurations, filterMapPresets, filterServices, filterTimeSeriesServices, getLanguageFromLocalStorage, languageLocalStorageKey, saveLanguageToLocalStorage, testLayers, useFetchServices, useUpdateTimeSpan, useUpdateTimestep };
|