@opengeoweb/core 11.1.0 → 12.1.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/index.esm.js +761 -60
- package/package.json +12 -11
- package/src/lib/GeoWebDemo.stories.d.ts +4 -1
- package/src/lib/components/ComponentsLookUp/componentsLookUp.stories.d.ts +8 -7
- package/src/lib/components/ConfigurableMapConnect/ConfigurableMapConnect.d.ts +2 -1
- package/src/lib/components/ConfigurableMapConnect/ConfigurableMapConnect.stories.d.ts +6 -4
- package/src/lib/components/FeatureInfo/utils.d.ts +4 -1
- package/src/lib/components/LanguageSelect/Languages.stories.d.ts +9 -33
- package/src/lib/components/LayerManager/LayerContainerRow/LayerRow/DimensionSelect/DimensionSelect.d.ts +1 -0
- package/src/lib/components/LayerManager/LayerContainerRow/LayerRow/DimensionSelect/DimensionSelectValue.d.ts +1 -0
- package/src/lib/components/LayerManager/LayerManager.custom.stories.d.ts +4 -1
- package/src/lib/components/LayerManager/LayerManager.stories.d.ts +19 -90
- package/src/lib/components/LayerManager/LayerManagerConnect.stories.d.ts +7 -22
- package/src/lib/components/LayerManager/LayerSelect/LayerSelectConnect.stories.d.ts +7 -7
- package/src/lib/components/LayerManager/ProjectionSelect/ProjectionSelect.stories.d.ts +1 -0
- package/src/lib/components/LegendConnect/LegendConnect.stories.d.ts +1 -0
- package/src/lib/components/MapDrawToolRedux/MapDrawToolRedux.stories.d.ts +1 -0
- package/src/lib/components/MapDrawToolRedux/MapDrawToolReduxIntersection.stories.d.ts +1 -0
- package/src/lib/components/MapDrawToolRedux/MapDrawToolReduxMultipleDrawTools.stories.d.ts +1 -0
- package/src/lib/components/MapDrawToolRedux/OpenLayersFeatureLayerConnect.d.ts +13 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.DoubleMap.stories.d.ts +1 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.Errors.stories.d.ts +1 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.FeatureLayers.stories.d.ts +1 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.InitialBBoxAndWithout.stories.d.ts +1 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.LayerActions.stories.d.ts +1 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.LayerChangeEnabledOpacity.stories.d.ts +1 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.MapModuleOverDefaultMap.stories.d.ts +1 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.MapPin.stories.d.ts +1 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.MultiMapLayerManager.stories.d.ts +1 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.SelectorTest.stories.d.ts +1 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.SetBaseLayers.stories.d.ts +1 -0
- package/src/lib/components/MapViewConnect/MapViewConnect.ToggleControls.stories.d.ts +1 -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/OlMapViewConnect.spec.d.ts +1 -0
- package/src/lib/components/MapViewConnect/OlMapViewLayerConnect.d.ts +8 -0
- package/src/lib/components/MapViewConnect/index.d.ts +2 -0
- package/src/lib/components/MapViewConnect/olMapUtils.d.ts +7 -0
- package/src/lib/components/MapViewConnect/olMapUtils.spec.d.ts +1 -0
- package/src/lib/components/MapViewConnect/useGetOpenLayersView.d.ts +9 -0
- package/src/lib/components/MultiMapDimensionSelectConnect/EnsembleDimensionExample.stories.d.ts +1 -0
- package/src/lib/components/MultiMapDimensionSelectConnect/MultiDimensionSelectConnect.stories.d.ts +1 -0
- package/src/lib/components/MultiMapDimensionSelectConnect/MultiMapMultiDimensionSelect.stories.d.ts +1 -0
- package/src/lib/components/MultiMapViewConnect/ModelRunInterval/ModelRunInterval.stories.d.ts +1 -0
- package/src/lib/components/MultiMapViewConnect/MultiMapView10x10.stories.d.ts +1 -0
- package/src/lib/components/MultiMapViewConnect/MultiMapView2x2.stories.d.ts +1 -0
- package/src/lib/components/MultiMapViewConnect/MultiMapView4x3.stories.d.ts +1 -0
- package/src/lib/components/Providers/Providers.d.ts +9 -0
- package/src/lib/components/Search/SearchDialog.stories.d.ts +7 -13
- package/src/lib/components/Search/SearchDialogConnect.stories.d.ts +5 -1
- package/src/lib/components/SyncGroups/SyncGroups.FourMapsSynced.stories.d.ts +5 -1
- package/src/lib/components/SyncGroups/SyncGroups.SyncMany.stories.d.ts +1 -0
- package/src/lib/components/SyncGroups/SyncGroups.SyncMaps.stories.d.ts +5 -1
- package/src/lib/components/SyncGroups/SyncGroups.TwoMapsSynced.stories.d.ts +5 -1
- package/src/lib/components/TimeSliderConnect/AutoUpdate.stories.d.ts +1 -0
- package/src/lib/components/TimeSliderConnect/TimeSliderConnect.stories.d.ts +6 -15
- package/src/lib/components/WMSLoader/WMSLoader.stories.d.ts +1 -0
- package/src/lib/components/MultiMapViewConnect/MultiMapView.stories.d.ts +0 -9
package/index.esm.js
CHANGED
|
@@ -1,26 +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, useEffect, useMemo } from 'react';
|
|
3
|
+
import React__default, { useState, useCallback, useEffect, useContext, useMemo } from 'react';
|
|
4
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
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, emptyGeoJSON, registerDrawFunction, ZoomControls, LegendDialog, LegendButton, MapView, MapViewLayer, MapControls, publicLayers } from '@opengeoweb/webmap-react';
|
|
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, OpenLayersFeatureLayer, OpenLayersMapDraw, getIsInsideAcceptanceTime, OpenLayersLayer, useSetIntervalWhenVisible, openLayersGetMapImageStore, TimeContext, OpenLayersMapView, WMSLayer, genericOpenLayersFeatureStyle, OpenLayersGetFeatureInfo, OpenLayersZoomControl, getLayerUpdateInfo, isOpenLayersEnabled, publicLayers } 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, drawingToolSelectors, syncConstants, loadingIndicatorActions, syncGroupsSelectors, defaultLayers, getSingularDrawtoolDrawLayerId, syncGroupsSelector, syncGroupsActions, routerUtils } from '@opengeoweb/store';
|
|
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
|
+
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';
|
|
15
16
|
import _, { isArray, isEqual, debounce, range } from 'lodash';
|
|
16
|
-
import { webmapUtils, queryWMSServiceInfo, queryWMSLayers, queryWMSLayersTree, invalidateWMSGetCapabilities, LayerType, getWMSServiceId, generateLayerId, getWMJSMapById, getWMSGetFeatureInfoRequestURL, handleDateUtilsISOString, wmServiceListener, EVENT_GETCAPABILITIES_START, EVENT_GETCAPABILITIES_READY, 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
19
|
import { useQuery, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
20
20
|
import { getConfig } from '@opengeoweb/authentication';
|
|
21
21
|
import { handleResponse } from '@opengeoweb/api';
|
|
22
22
|
import axios from 'axios';
|
|
23
|
+
import { ImageWMS } from 'ol/source';
|
|
23
24
|
import DOMPurify from 'dompurify';
|
|
25
|
+
import { unByKey } from 'ol/Observable';
|
|
26
|
+
import { toLonLat } from 'ol/proj';
|
|
24
27
|
import { snackbarTypes, snackbarActions, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
|
|
25
28
|
import { useNavigate } from 'react-router-dom';
|
|
26
29
|
import * as Sentry from '@sentry/react';
|
|
@@ -1254,10 +1257,11 @@ var DimensionSelectName = function DimensionSelectName(_ref) {
|
|
|
1254
1257
|
};
|
|
1255
1258
|
|
|
1256
1259
|
var DimensionSelectValue = function DimensionSelectValue(_ref) {
|
|
1257
|
-
var _selectedDimension$va;
|
|
1258
1260
|
var isEnabled = _ref.isEnabled,
|
|
1259
1261
|
tooltip = _ref.tooltip,
|
|
1260
1262
|
selectedDimension = _ref.selectedDimension,
|
|
1263
|
+
_ref$generatedValues = _ref.generatedValues,
|
|
1264
|
+
generatedValues = _ref$generatedValues === void 0 ? [] : _ref$generatedValues,
|
|
1261
1265
|
icon = _ref.icon,
|
|
1262
1266
|
onLayerChangeDimension = _ref.onLayerChangeDimension,
|
|
1263
1267
|
valueMappings = _ref.valueMappings,
|
|
@@ -1267,7 +1271,7 @@ var DimensionSelectValue = function DimensionSelectValue(_ref) {
|
|
|
1267
1271
|
skipLocalStyling = _ref.skipLocalStyling;
|
|
1268
1272
|
var _useCoreTranslation = useCoreTranslation(),
|
|
1269
1273
|
t = _useCoreTranslation.t;
|
|
1270
|
-
var dimensionValuesRaw =
|
|
1274
|
+
var dimensionValuesRaw = generatedValues.toReversed().slice(0, 100);
|
|
1271
1275
|
if (!(selectedDimension != null && selectedDimension.name) || !(dimensionValuesRaw != null && dimensionValuesRaw.length)) {
|
|
1272
1276
|
return null;
|
|
1273
1277
|
}
|
|
@@ -1358,7 +1362,8 @@ var DimensionSelect = function DimensionSelect(_ref) {
|
|
|
1358
1362
|
useLatestReferenceTime = _ref.useLatestReferenceTime,
|
|
1359
1363
|
SingleValueComponent = _ref.SingleValueComponent,
|
|
1360
1364
|
hideLatestDuplicate = _ref.hideLatestDuplicate,
|
|
1361
|
-
skipLocalStyling = _ref.skipLocalStyling
|
|
1365
|
+
skipLocalStyling = _ref.skipLocalStyling,
|
|
1366
|
+
layerId = _ref.layerId;
|
|
1362
1367
|
var _useCoreTranslation = useCoreTranslation(),
|
|
1363
1368
|
t = _useCoreTranslation.t;
|
|
1364
1369
|
var _useState = useState(layerDimensions == null || (_layerDimensions$ = layerDimensions[0]) == null ? void 0 : _layerDimensions$.name),
|
|
@@ -1367,6 +1372,8 @@ var DimensionSelect = function DimensionSelect(_ref) {
|
|
|
1367
1372
|
var selectedDimension = layerDimensions.find(function (dimension) {
|
|
1368
1373
|
return dimension.name === selectedDimensionName;
|
|
1369
1374
|
});
|
|
1375
|
+
var wmDimension = webmapUtils.getWMJSDimensionForLayerAndDimension(layerId || '', selectedDimension == null ? void 0 : selectedDimension.name);
|
|
1376
|
+
var generatedValues = (wmDimension == null ? void 0 : wmDimension.generateAllValues()) || [];
|
|
1370
1377
|
var dimensionNames = layerDimensions.map(function (dimension) {
|
|
1371
1378
|
return dimension.name;
|
|
1372
1379
|
});
|
|
@@ -1406,6 +1413,7 @@ var DimensionSelect = function DimensionSelect(_ref) {
|
|
|
1406
1413
|
position: "value"
|
|
1407
1414
|
})) : jsx(DimensionSelectValue, {
|
|
1408
1415
|
selectedDimension: selectedDimension,
|
|
1416
|
+
generatedValues: generatedValues,
|
|
1409
1417
|
onLayerChangeDimension: onLayerChangeDimension,
|
|
1410
1418
|
tooltip: valueTooltip,
|
|
1411
1419
|
isEnabled: isEnabled,
|
|
@@ -2432,7 +2440,8 @@ var LayerRowUnstyled = function LayerRowUnstyled(_ref8) {
|
|
|
2432
2440
|
layerId: layerId,
|
|
2433
2441
|
dimension: dimension
|
|
2434
2442
|
});
|
|
2435
|
-
}
|
|
2443
|
+
},
|
|
2444
|
+
layerId: layerId
|
|
2436
2445
|
})
|
|
2437
2446
|
}), jsx(RowItemCollapse, {
|
|
2438
2447
|
className: columnClasses.acceptanceTime,
|
|
@@ -2782,7 +2791,8 @@ var DimensionSelectConnect = function DimensionSelectConnect(_ref) {
|
|
|
2782
2791
|
isEnabled: isLayerEnabled,
|
|
2783
2792
|
useLatestReferenceTime: useLatestReferenceTime,
|
|
2784
2793
|
setUseLatestReferenceTime: setUseLatestReferenceTime,
|
|
2785
|
-
skipLocalStyling: skipLocalStyling
|
|
2794
|
+
skipLocalStyling: skipLocalStyling,
|
|
2795
|
+
layerId: layerId
|
|
2786
2796
|
});
|
|
2787
2797
|
};
|
|
2788
2798
|
|
|
@@ -3236,7 +3246,8 @@ var CustomDimensionSelectConnect = function CustomDimensionSelectConnect(_ref) {
|
|
|
3236
3246
|
},
|
|
3237
3247
|
isEnabled: isLayerEnabled,
|
|
3238
3248
|
useLatestReferenceTime: useLatestReferenceTime,
|
|
3239
|
-
setUseLatestReferenceTime: setUseLatestReferenceTime
|
|
3249
|
+
setUseLatestReferenceTime: setUseLatestReferenceTime,
|
|
3250
|
+
layerId: layerId
|
|
3240
3251
|
}, props));
|
|
3241
3252
|
};
|
|
3242
3253
|
|
|
@@ -5987,7 +5998,7 @@ var geometryStyling = {
|
|
|
5987
5998
|
'stroke-opacity': 1,
|
|
5988
5999
|
'stroke-width': 4
|
|
5989
6000
|
};
|
|
5990
|
-
var makeGeoJSONFeatureFromLocation = function makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId) {
|
|
6001
|
+
var makeGeoJSONFeatureFromLocation = function makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId, mapFeatureClass) {
|
|
5991
6002
|
var _location$geometry;
|
|
5992
6003
|
var collection = {
|
|
5993
6004
|
type: 'FeatureCollection',
|
|
@@ -6004,7 +6015,8 @@ var makeGeoJSONFeatureFromLocation = function makeGeoJSONFeatureFromLocation(loc
|
|
|
6004
6015
|
properties: {
|
|
6005
6016
|
name: location.name,
|
|
6006
6017
|
drawFunctionId: drawFunctionId,
|
|
6007
|
-
hoverDrawFunctionId: hoverDrawFunctionId
|
|
6018
|
+
hoverDrawFunctionId: hoverDrawFunctionId,
|
|
6019
|
+
mapFeatureClass: mapFeatureClass
|
|
6008
6020
|
},
|
|
6009
6021
|
geometry: {
|
|
6010
6022
|
type: 'Point',
|
|
@@ -6070,14 +6082,20 @@ var hoverDrawFunction = function hoverDrawFunction(args) {
|
|
|
6070
6082
|
};
|
|
6071
6083
|
var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
|
|
6072
6084
|
var dispatch = useDispatch();
|
|
6073
|
-
var
|
|
6085
|
+
var _useContext = useContext(MapContext),
|
|
6086
|
+
map = _useContext.map;
|
|
6087
|
+
var layerIdRef = React__default.useRef();
|
|
6088
|
+
React__default.useEffect(function () {
|
|
6089
|
+
layerIdRef.current = generateLayerId();
|
|
6090
|
+
}, []);
|
|
6091
|
+
var layerId = layerIdRef.current;
|
|
6074
6092
|
var isMapPresent = useSelector(function (store) {
|
|
6075
6093
|
return mapSelectors.getIsMapPresent(store, mapId);
|
|
6076
6094
|
});
|
|
6077
6095
|
var isLayerPresent = useSelector(function (store) {
|
|
6078
|
-
return layerSelectors.getIsLayerPresent(store,
|
|
6096
|
+
return layerSelectors.getIsLayerPresent(store, layerIdRef.current);
|
|
6079
6097
|
});
|
|
6080
|
-
var shouldAddLayer = isMapPresent && !isLayerPresent;
|
|
6098
|
+
var shouldAddLayer = isMapPresent && !isLayerPresent && layerId;
|
|
6081
6099
|
React__default.useEffect(function () {
|
|
6082
6100
|
if (shouldAddLayer) {
|
|
6083
6101
|
dispatch(layerActions.addLayer({
|
|
@@ -6094,7 +6112,8 @@ var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
|
|
|
6094
6112
|
var drawFunctionId = React__default.useRef(registerDrawFunction(drawFunction)).current;
|
|
6095
6113
|
var hoverDrawFunctionId = React__default.useRef(registerDrawFunction(hoverDrawFunction)).current;
|
|
6096
6114
|
var updateGeoJSON = React__default.useCallback(function (location) {
|
|
6097
|
-
var
|
|
6115
|
+
var mapFeatureClass = (location == null ? void 0 : location.source) === 'MyMapLocation' ? MapFeatureClass.MyLocation : MapFeatureClass.GenericMarker;
|
|
6116
|
+
var geojson = location ? makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId, mapFeatureClass) : emptyGeoJSON;
|
|
6098
6117
|
dispatch(layerActions.updateFeature({
|
|
6099
6118
|
layerId: layerId,
|
|
6100
6119
|
geojson: geojson
|
|
@@ -6104,8 +6123,10 @@ var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
|
|
|
6104
6123
|
var webMap = getWMJSMapById(mapId);
|
|
6105
6124
|
if (webMap) {
|
|
6106
6125
|
webMap.calculateBoundingBoxAndZoom(location.lat, location.lon);
|
|
6126
|
+
} else if (map) {
|
|
6127
|
+
setMapCenter(map, location.lon, location.lat);
|
|
6107
6128
|
}
|
|
6108
|
-
}, [mapId]);
|
|
6129
|
+
}, [mapId, map]);
|
|
6109
6130
|
var onUpdateLocation = React__default.useCallback(function (location) {
|
|
6110
6131
|
updateGeoJSON(location);
|
|
6111
6132
|
if (location) {
|
|
@@ -6295,30 +6316,50 @@ var getTitle = function getTitle(layerId) {
|
|
|
6295
6316
|
var wmjsLayer = webmapUtils.getWMLayerById(layerId);
|
|
6296
6317
|
return wmjsLayer ? wmjsLayer.title || wmjsLayer.name : layerId;
|
|
6297
6318
|
};
|
|
6319
|
+
var getFeatureInfoUrl = function getFeatureInfoUrl(layer, wmjsMap, mapPinLocation) {
|
|
6320
|
+
/*
|
|
6321
|
+
We need a wmjsLayer to build the getfeatureinfo url (getWMSGetFeatureInfoRequestURL function).
|
|
6322
|
+
But it seems that its dimension are lazely updated (by ReactMapView).
|
|
6323
|
+
Therefore make a clone of this layer and set its dimensions based on the layer object.
|
|
6324
|
+
Otherwise we risk making a getfeatureinfo call with outdated dimension values.
|
|
6325
|
+
*/
|
|
6326
|
+
var wmjsLayer = webmapUtils.getWMLayerById(layer.id).cloneLayer();
|
|
6327
|
+
if (wmjsMap) {
|
|
6328
|
+
// WebMapJS version
|
|
6329
|
+
return getWMSGetFeatureInfoRequestURL(wmjsLayer, wmjsMap.getMapPin().getXY().x, wmjsMap.getMapPin().getXY().y, 'text/html');
|
|
6330
|
+
}
|
|
6331
|
+
if (mapPinLocation) {
|
|
6332
|
+
// OpenLayers WMS version
|
|
6333
|
+
var source = new ImageWMS({
|
|
6334
|
+
url: wmjsLayer.getmapURL,
|
|
6335
|
+
params: {
|
|
6336
|
+
LAYERS: wmjsLayer.getLayerName()
|
|
6337
|
+
}
|
|
6338
|
+
});
|
|
6339
|
+
return source.getFeatureInfoUrl([mapPinLocation.projectionX, mapPinLocation.projectionY], mapPinLocation.resolution, mapPinLocation.srs, {
|
|
6340
|
+
INFO_FORMAT: 'text/html'
|
|
6341
|
+
}) + "&" + getMapDimURL(wmjsLayer).toString();
|
|
6342
|
+
}
|
|
6343
|
+
return undefined;
|
|
6344
|
+
};
|
|
6298
6345
|
/**
|
|
6299
6346
|
* Make a list of GFI Layers to display.
|
|
6300
6347
|
* @param layers
|
|
6301
6348
|
* @param mapId
|
|
6302
6349
|
* @returns
|
|
6303
6350
|
*/
|
|
6304
|
-
var getLayersToUpdate = function getLayersToUpdate(layers, mapId) {
|
|
6351
|
+
var getLayersToUpdate = function getLayersToUpdate(mapPinLocation, layers, mapId) {
|
|
6305
6352
|
var wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
6306
|
-
if (!
|
|
6353
|
+
if (!layers || layers.length === 0 || !wmjsMap && !mapPinLocation) {
|
|
6307
6354
|
return [];
|
|
6308
6355
|
}
|
|
6309
6356
|
return layers.filter(function (layer) {
|
|
6310
6357
|
return layer && layer.enabled && !!webmapUtils.getWMLayerById(layer.id);
|
|
6311
6358
|
}).map(function (layer) {
|
|
6312
|
-
|
|
6313
|
-
We need a wmjsLayer to build the getfeatureinfo url (getWMSGetFeatureInfoRequestURL function).
|
|
6314
|
-
But it seems that its dimension are lazely updated (by ReactMapView).
|
|
6315
|
-
Therefore make a clone of this layer and set its dimensions based on the layer object.
|
|
6316
|
-
Otherwise we risk making a getfeatureinfo call with outdated dimension values.
|
|
6317
|
-
*/
|
|
6318
|
-
var wmjsLayer = webmapUtils.getWMLayerById(layer.id).cloneLayer();
|
|
6359
|
+
var url = getFeatureInfoUrl(layer, wmjsMap, mapPinLocation);
|
|
6319
6360
|
return {
|
|
6320
6361
|
layerId: layer.id,
|
|
6321
|
-
url:
|
|
6362
|
+
url: url,
|
|
6322
6363
|
title: getTitle(layer.id)
|
|
6323
6364
|
};
|
|
6324
6365
|
});
|
|
@@ -6386,7 +6427,7 @@ var GetFeatureInfoDialog = function GetFeatureInfoDialog(_ref) {
|
|
|
6386
6427
|
triggerRerender("" + layerId + isLoading);
|
|
6387
6428
|
};
|
|
6388
6429
|
/* Build a layerlist array with a set of arguments per layer to do the query for */
|
|
6389
|
-
var layerToUpdateList = isOpen ? getLayersToUpdate(layers, mapId) : [];
|
|
6430
|
+
var layerToUpdateList = isOpen && mapPinLocation ? getLayersToUpdate(mapPinLocation, layers, mapId) : [];
|
|
6390
6431
|
/*
|
|
6391
6432
|
Build a string based on the GFI urls. If this changes for whatever reason we need to update.
|
|
6392
6433
|
These strings can change very often, therefore they need to be debounced and only use the most recent result must be used.
|
|
@@ -6629,7 +6670,7 @@ var GetFeatureInfoButtonConnect = function GetFeatureInfoButtonConnect(_ref) {
|
|
|
6629
6670
|
});
|
|
6630
6671
|
};
|
|
6631
6672
|
|
|
6632
|
-
var _excluded$1 = ["mapId", "children", "controls"];
|
|
6673
|
+
var _excluded$1 = ["mapId", "children", "controls", "initialBbox"];
|
|
6633
6674
|
var ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION = 'ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION';
|
|
6634
6675
|
/**
|
|
6635
6676
|
* Connected component used to display the map and selected layers.
|
|
@@ -6651,8 +6692,9 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
6651
6692
|
controls = _ref$controls === void 0 ? {
|
|
6652
6693
|
mapControlsPositionTop: 0,
|
|
6653
6694
|
zoomControls: true
|
|
6654
|
-
} : _ref$controls
|
|
6655
|
-
|
|
6695
|
+
} : _ref$controls;
|
|
6696
|
+
_ref.initialBbox;
|
|
6697
|
+
var props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
6656
6698
|
var mapRef = React.useRef(null);
|
|
6657
6699
|
var store = useStore();
|
|
6658
6700
|
var mapDimensions = useSelector(function (store) {
|
|
@@ -6697,7 +6739,7 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
6697
6739
|
return genericSelectors.selectLinkedPanelId(store, mapId);
|
|
6698
6740
|
});
|
|
6699
6741
|
var selectedFeatureCoordinates = useSelector(function (store) {
|
|
6700
|
-
return genericSelectors.getSelectedFeature(store.syncGroups, linkedPanelId);
|
|
6742
|
+
return linkedPanelId && genericSelectors.getSelectedFeature(store.syncGroups, linkedPanelId);
|
|
6701
6743
|
});
|
|
6702
6744
|
var disableMapPin = useSelector(function (store) {
|
|
6703
6745
|
return mapSelectors.getDisableMapPin(store, mapId);
|
|
@@ -6894,10 +6936,10 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
6894
6936
|
},
|
|
6895
6937
|
onUpdateLayerInformation: updateLayerInformation,
|
|
6896
6938
|
onMapPinChangeLocation: mapPinChangeLocation,
|
|
6897
|
-
onMapZoomEnd: function onMapZoomEnd(
|
|
6939
|
+
onMapZoomEnd: function onMapZoomEnd(onZoomedCRS) {
|
|
6898
6940
|
genericSetBbox({
|
|
6899
|
-
bbox:
|
|
6900
|
-
srs:
|
|
6941
|
+
bbox: onZoomedCRS.bbox,
|
|
6942
|
+
srs: onZoomedCRS.srs,
|
|
6901
6943
|
sourceId: mapId,
|
|
6902
6944
|
origin: mapEnums.MapActionOrigin.map,
|
|
6903
6945
|
mapId: mapId
|
|
@@ -7060,6 +7102,624 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
7060
7102
|
});
|
|
7061
7103
|
};
|
|
7062
7104
|
|
|
7105
|
+
/* *
|
|
7106
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7107
|
+
* you may not use this file except in compliance with the License.
|
|
7108
|
+
* You may obtain a copy of the License at
|
|
7109
|
+
*
|
|
7110
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7111
|
+
*
|
|
7112
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7113
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7114
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7115
|
+
* See the License for the specific language governing permissions and
|
|
7116
|
+
* limitations under the License.
|
|
7117
|
+
*
|
|
7118
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7119
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
7120
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
7121
|
+
* */
|
|
7122
|
+
var useGetOpenLayersView = function useGetOpenLayersView(mapId, store) {
|
|
7123
|
+
var _useState = useState(),
|
|
7124
|
+
view = _useState[0],
|
|
7125
|
+
setView = _useState[1];
|
|
7126
|
+
var _useState2 = useState(),
|
|
7127
|
+
name = _useState2[0],
|
|
7128
|
+
setName = _useState2[1];
|
|
7129
|
+
var syncGroupState = syncGroupsSelectors.getSynchronizationGroupState(store.getState());
|
|
7130
|
+
var syncGroupView = useMemo(function () {
|
|
7131
|
+
var thisAreaSyncGroupId = syncGroupState.groups.allIds.find(function (id) {
|
|
7132
|
+
var group = syncGroupState.groups.byId[id];
|
|
7133
|
+
return group.type === syncConstants.SYNCGROUPS_TYPE_SETBBOX && group.targets.allIds.indexOf(mapId) !== -1;
|
|
7134
|
+
});
|
|
7135
|
+
return thisAreaSyncGroupId ? getViewObjectForSyncGroup(thisAreaSyncGroupId) : null;
|
|
7136
|
+
}, [mapId, syncGroupState.groups]);
|
|
7137
|
+
useEffect(function () {
|
|
7138
|
+
var mapBbox = mapSelectors.getBbox(store.getState(), mapId);
|
|
7139
|
+
var storedView = syncGroupView || getViewObjectForMapId(mapId);
|
|
7140
|
+
if (storedView.view.getCenter() === undefined && mapBbox.left !== undefined) {
|
|
7141
|
+
storedView.view.fit([mapBbox.left, mapBbox.bottom, mapBbox.right, mapBbox.top]);
|
|
7142
|
+
}
|
|
7143
|
+
setName(storedView.name);
|
|
7144
|
+
var setViewFromStoredView = function setViewFromStoredView() {
|
|
7145
|
+
setView(storedView.view);
|
|
7146
|
+
};
|
|
7147
|
+
setViewFromStoredView();
|
|
7148
|
+
var eventKey = storedView.on('change', setViewFromStoredView);
|
|
7149
|
+
return function () {
|
|
7150
|
+
unByKey(eventKey);
|
|
7151
|
+
};
|
|
7152
|
+
}, [syncGroupView, mapId, store]);
|
|
7153
|
+
return {
|
|
7154
|
+
view: view,
|
|
7155
|
+
name: name
|
|
7156
|
+
};
|
|
7157
|
+
};
|
|
7158
|
+
|
|
7159
|
+
/* *
|
|
7160
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7161
|
+
* you may not use this file except in compliance with the License.
|
|
7162
|
+
* You may obtain a copy of the License at
|
|
7163
|
+
*
|
|
7164
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7165
|
+
*
|
|
7166
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7167
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7168
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7169
|
+
* See the License for the specific language governing permissions and
|
|
7170
|
+
* limitations under the License.
|
|
7171
|
+
*
|
|
7172
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7173
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
7174
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
7175
|
+
* */
|
|
7176
|
+
var makePrefetchTimeSpan = function makePrefetchTimeSpan(timeSliderStartCenterEndTime, animationStartTime, animationEndTime, isAnimating) {
|
|
7177
|
+
var timeSliderTimeStepInS = timeSliderStartCenterEndTime.step * 60;
|
|
7178
|
+
var animationTimeStartInS = dateUtils.parseISO(animationStartTime).getTime() / 1000;
|
|
7179
|
+
var animationTimeEndInS = dateUtils.parseISO(animationEndTime).getTime() / 1000;
|
|
7180
|
+
var prefetchStart = isAnimating ? animationTimeStartInS : timeSliderStartCenterEndTime.start;
|
|
7181
|
+
var prefetchEnd = isAnimating ? animationTimeEndInS : timeSliderStartCenterEndTime.end;
|
|
7182
|
+
if (!prefetchStart || !prefetchEnd) {
|
|
7183
|
+
return {
|
|
7184
|
+
timespan: {
|
|
7185
|
+
start: 0,
|
|
7186
|
+
end: 0,
|
|
7187
|
+
step: 0
|
|
7188
|
+
},
|
|
7189
|
+
isAnimating: isAnimating
|
|
7190
|
+
};
|
|
7191
|
+
}
|
|
7192
|
+
var roundStart = Math.round(prefetchStart / timeSliderTimeStepInS) * timeSliderTimeStepInS;
|
|
7193
|
+
var roundEnd = Math.round(prefetchEnd / timeSliderTimeStepInS) * timeSliderTimeStepInS;
|
|
7194
|
+
// eslint-disable-next-line no-constant-condition
|
|
7195
|
+
return {
|
|
7196
|
+
timespan: {
|
|
7197
|
+
start: roundStart * 1000,
|
|
7198
|
+
end: roundEnd * 1000,
|
|
7199
|
+
step: timeSliderTimeStepInS * 1000
|
|
7200
|
+
},
|
|
7201
|
+
isAnimating: isAnimating
|
|
7202
|
+
};
|
|
7203
|
+
};
|
|
7204
|
+
var makeLayerInfoPayload = function makeLayerInfoPayload(payload, mapDimensions, mapId) {
|
|
7205
|
+
// During intialization, try to base the layer dimension on the current map dimension value.
|
|
7206
|
+
var updatedPayLoad = {
|
|
7207
|
+
origin: 'OnInitializeLayerProps in MapViewConnect',
|
|
7208
|
+
layerDimensions: {
|
|
7209
|
+
layerId: payload.layerId,
|
|
7210
|
+
origin: 'OnInitializeLayerProps in MapViewConnect',
|
|
7211
|
+
dimensions: (payload.dimensions || []).map(function (layerDim) {
|
|
7212
|
+
var _find;
|
|
7213
|
+
var currentMapDim = ((_find = (mapDimensions || []).find(function (mapDim) {
|
|
7214
|
+
return mapDim.name === layerDim.name;
|
|
7215
|
+
})) == null ? void 0 : _find.currentValue) || layerDim.currentValue;
|
|
7216
|
+
var wmDim = new WMJSDimension(layerDim);
|
|
7217
|
+
return Object.assign({}, layerDim, {
|
|
7218
|
+
currentValue: wmDim.getClosestValue(currentMapDim)
|
|
7219
|
+
});
|
|
7220
|
+
})
|
|
7221
|
+
},
|
|
7222
|
+
mapDimensions: {
|
|
7223
|
+
mapId: mapId,
|
|
7224
|
+
origin: 'OnInitializeLayerProps in MapViewConnect',
|
|
7225
|
+
dimensions: (payload.dimensions || []).map(function (layerDim) {
|
|
7226
|
+
var _find2;
|
|
7227
|
+
var currentMapDim = ((_find2 = (mapDimensions || []).find(function (mapDim) {
|
|
7228
|
+
return mapDim.name === layerDim.name;
|
|
7229
|
+
})) == null ? void 0 : _find2.currentValue) || layerDim.currentValue;
|
|
7230
|
+
var wmDim = new WMJSDimension(layerDim);
|
|
7231
|
+
return Object.assign({}, layerDim, {
|
|
7232
|
+
currentValue: wmDim.getClosestValue(currentMapDim)
|
|
7233
|
+
});
|
|
7234
|
+
})
|
|
7235
|
+
}
|
|
7236
|
+
};
|
|
7237
|
+
return updatedPayLoad;
|
|
7238
|
+
};
|
|
7239
|
+
var getCenterOfLinkedFeature = function getCenterOfLinkedFeature(feature, srs) {
|
|
7240
|
+
var _feature$getGeometry;
|
|
7241
|
+
if (feature && ((_feature$getGeometry = feature.getGeometry()) == null ? void 0 : _feature$getGeometry.getType()) === 'Point') {
|
|
7242
|
+
var _feature$getId;
|
|
7243
|
+
var projectionCoords = feature.getGeometry().getCoordinates();
|
|
7244
|
+
var coords = toLonLat(projectionCoords, srs);
|
|
7245
|
+
var id = (feature == null || (_feature$getId = feature.getId()) == null ? void 0 : _feature$getId.toString()) || '';
|
|
7246
|
+
return {
|
|
7247
|
+
lon: coords[0],
|
|
7248
|
+
lat: coords[1],
|
|
7249
|
+
id: id,
|
|
7250
|
+
serviceId: feature.getProperties().serviceId,
|
|
7251
|
+
collectionId: feature.getProperties().collectionId
|
|
7252
|
+
};
|
|
7253
|
+
}
|
|
7254
|
+
return null;
|
|
7255
|
+
};
|
|
7256
|
+
|
|
7257
|
+
var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref) {
|
|
7258
|
+
var layer = _ref.layer,
|
|
7259
|
+
layerId = _ref.layerId,
|
|
7260
|
+
zIndex = _ref.zIndex,
|
|
7261
|
+
style = _ref.style,
|
|
7262
|
+
hoverSelect = _ref.hoverSelect;
|
|
7263
|
+
var store = useStore();
|
|
7264
|
+
var dispatch = useDispatch();
|
|
7265
|
+
var updateFeature = React__default.useCallback(function (geojson, reason) {
|
|
7266
|
+
if (!layerId) {
|
|
7267
|
+
window.console.error('updateFeature without layerId');
|
|
7268
|
+
return;
|
|
7269
|
+
}
|
|
7270
|
+
var activeDrawToolId = drawingToolSelectors.getActiveDrawToolId(store.getState());
|
|
7271
|
+
var activeDrawMode = drawingToolSelectors.getActiveDrawMode(store.getState(), activeDrawToolId);
|
|
7272
|
+
dispatch(layerActions.updateFeature({
|
|
7273
|
+
geojson: geojson,
|
|
7274
|
+
reason: reason,
|
|
7275
|
+
layerId: layerId,
|
|
7276
|
+
shouldAllowMultipleShapes: drawingToolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId),
|
|
7277
|
+
geoJSONIntersectionLayerId: drawingToolSelectors.getGeoJSONIntersectionLayerId(store.getState(), activeDrawToolId),
|
|
7278
|
+
geoJSONIntersectionBoundsLayerId: drawingToolSelectors.getGeoJSONIntersectionBoundsLayerId(store.getState(), activeDrawToolId),
|
|
7279
|
+
selectionType: activeDrawMode == null ? void 0 : activeDrawMode.selectionType
|
|
7280
|
+
}));
|
|
7281
|
+
}, [dispatch, store, layerId]);
|
|
7282
|
+
var exitFeatureDrawMode = React__default.useCallback(function (reason) {
|
|
7283
|
+
if (!layerId) {
|
|
7284
|
+
window.console.error('exitFeatureDrawMode without layerId');
|
|
7285
|
+
return;
|
|
7286
|
+
}
|
|
7287
|
+
var activeDrawToolId = drawingToolSelectors.getActiveDrawToolId(store.getState());
|
|
7288
|
+
dispatch(layerActions.exitFeatureDrawMode({
|
|
7289
|
+
reason: reason,
|
|
7290
|
+
layerId: layerId,
|
|
7291
|
+
shouldAllowMultipleShapes: drawingToolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId)
|
|
7292
|
+
}));
|
|
7293
|
+
}, [dispatch, store, layerId]);
|
|
7294
|
+
return jsxs(Fragment, {
|
|
7295
|
+
children: [jsx(OpenLayersFeatureLayer, {
|
|
7296
|
+
featureCollection: !layer.isInEditMode ? layer.geojson : undefined,
|
|
7297
|
+
zIndex: zIndex,
|
|
7298
|
+
style: style,
|
|
7299
|
+
hoverSelect: hoverSelect
|
|
7300
|
+
}), jsx(OpenLayersMapDraw, {
|
|
7301
|
+
drawMode: layer.drawMode,
|
|
7302
|
+
viewOnlyStyle: style,
|
|
7303
|
+
exitDrawModeCallback: exitFeatureDrawMode,
|
|
7304
|
+
geojson: layer.geojson,
|
|
7305
|
+
isInEditMode: layer.isInEditMode || false,
|
|
7306
|
+
selectedFeatureIndex: layer.selectedFeatureIndex || 0,
|
|
7307
|
+
updateGeojson: updateFeature
|
|
7308
|
+
})]
|
|
7309
|
+
});
|
|
7310
|
+
};
|
|
7311
|
+
|
|
7312
|
+
var OlMapViewLayerConnect = function OlMapViewLayerConnect(layerProps) {
|
|
7313
|
+
var layerId = layerProps.layerId,
|
|
7314
|
+
mapId = layerProps.mapId,
|
|
7315
|
+
zIndex = layerProps.zIndex,
|
|
7316
|
+
debugMode = layerProps.debugMode;
|
|
7317
|
+
var layer = useSelector(function (store) {
|
|
7318
|
+
return layerSelectors.getLayerById(store, layerId);
|
|
7319
|
+
});
|
|
7320
|
+
var mapDimensions = useSelector(function (store) {
|
|
7321
|
+
return mapSelectors.getMapDimensions(store, mapId);
|
|
7322
|
+
});
|
|
7323
|
+
var dispatch = useDispatch();
|
|
7324
|
+
var onInitializeLayer = useCallback(function (initProps) {
|
|
7325
|
+
var updatedPayLoad = makeLayerInfoPayload(initProps, mapDimensions || [], mapId);
|
|
7326
|
+
dispatch(layerActions.onUpdateLayerInformation(updatedPayLoad));
|
|
7327
|
+
}, [dispatch, mapDimensions, mapId]);
|
|
7328
|
+
if (!layerId || !layer) {
|
|
7329
|
+
return null;
|
|
7330
|
+
}
|
|
7331
|
+
var isInsideAcceptanceTime = getIsInsideAcceptanceTime(layer.acceptanceTimeInMinutes, mapDimensions, layer.dimensions);
|
|
7332
|
+
return jsx(OpenLayersLayer, Object.assign({
|
|
7333
|
+
id: "layer-" + (layer == null ? void 0 : layer.id),
|
|
7334
|
+
zIndex: zIndex
|
|
7335
|
+
}, layer, {
|
|
7336
|
+
enabled: isInsideAcceptanceTime && layer.enabled,
|
|
7337
|
+
onInitializeLayer: onInitializeLayer,
|
|
7338
|
+
debugMode: debugMode
|
|
7339
|
+
}), "layer-" + (layer == null ? void 0 : layer.id));
|
|
7340
|
+
};
|
|
7341
|
+
|
|
7342
|
+
/**
|
|
7343
|
+
* Connected component used to display the map and selected layers.
|
|
7344
|
+
* Includes options to disable the map controls and legend.
|
|
7345
|
+
*
|
|
7346
|
+
* Expects the following props:
|
|
7347
|
+
* @param {string} mapId mapId: string - Id of the map
|
|
7348
|
+
* @param {object} [controls.zoomControls] **optional** controls: object - toggle the map controls, zoomControls defaults to true
|
|
7349
|
+
* @param {boolean} [displayTimeInMap] **optional** displayTimeInMap: boolean, toggles the mapTime, defaults to true
|
|
7350
|
+
* @param {boolean} [showScaleBar] **optional** showScaleBar: boolean, toggles the scaleBar, defaults to true
|
|
7351
|
+
* @example
|
|
7352
|
+
* ```<MapViewConnect mapId={mapId} controls={{ zoomControls: false }} displayTimeInMap={false} showScaleBar={false}/>```
|
|
7353
|
+
*/
|
|
7354
|
+
var OlMapViewConnect = function OlMapViewConnect(_ref) {
|
|
7355
|
+
var mapId = _ref.mapId,
|
|
7356
|
+
_ref$controls = _ref.controls,
|
|
7357
|
+
controls = _ref$controls === void 0 ? {
|
|
7358
|
+
mapControlsPositionTop: 0,
|
|
7359
|
+
zoomControls: true
|
|
7360
|
+
} : _ref$controls,
|
|
7361
|
+
initialBbox = _ref.initialBbox,
|
|
7362
|
+
children = _ref.children,
|
|
7363
|
+
holdShiftToScroll = _ref.holdShiftToScroll;
|
|
7364
|
+
var store = useStore();
|
|
7365
|
+
var mapRef = React.useRef(null);
|
|
7366
|
+
var _useGetOpenLayersView = useGetOpenLayersView(mapId, store),
|
|
7367
|
+
view = _useGetOpenLayersView.view;
|
|
7368
|
+
var _React$useState = React.useState(),
|
|
7369
|
+
hoverLinkedFeature = _React$useState[0],
|
|
7370
|
+
setHoverLinkedFeature = _React$useState[1];
|
|
7371
|
+
var linkedPanelId = useSelector(function (store) {
|
|
7372
|
+
return genericSelectors.selectLinkedPanelId(store, mapId);
|
|
7373
|
+
});
|
|
7374
|
+
var mapLayerIds = useSelector(function (store) {
|
|
7375
|
+
return mapSelectors.getMapLayerIdsEnabled(store, mapId);
|
|
7376
|
+
});
|
|
7377
|
+
var baseLayers = useSelector(function (store) {
|
|
7378
|
+
return mapSelectors.getMapBaseLayers(store, mapId);
|
|
7379
|
+
});
|
|
7380
|
+
var overLayers = useSelector(function (store) {
|
|
7381
|
+
return mapSelectors.getMapOverLayers(store, mapId);
|
|
7382
|
+
});
|
|
7383
|
+
var featureLayers = useSelector(function (store) {
|
|
7384
|
+
return mapSelectors.getMapFeatureLayers(store, mapId);
|
|
7385
|
+
});
|
|
7386
|
+
var linkedFeaturesFromState = useSelector(function (store) {
|
|
7387
|
+
var _store$syncGroups;
|
|
7388
|
+
return genericSelectors.selectLinkedFeatures((_store$syncGroups = store.syncGroups) == null ? void 0 : _store$syncGroups.linkedState, mapId);
|
|
7389
|
+
});
|
|
7390
|
+
var linkedFeatures = React.useMemo(function () {
|
|
7391
|
+
return {
|
|
7392
|
+
type: 'FeatureCollection',
|
|
7393
|
+
features: linkedFeaturesFromState.flatMap(function (feature) {
|
|
7394
|
+
return feature.geoJSON.features;
|
|
7395
|
+
})
|
|
7396
|
+
};
|
|
7397
|
+
}, [linkedFeaturesFromState]);
|
|
7398
|
+
var srs = useSelector(function (store) {
|
|
7399
|
+
return mapSelectors.getSrs(store, mapId);
|
|
7400
|
+
});
|
|
7401
|
+
var timeSliderStartCenterEndTime = useSelector(function (store) {
|
|
7402
|
+
return mapSelectors.getMapTimeSliderStartCenterEndAndStep(store, mapId);
|
|
7403
|
+
});
|
|
7404
|
+
var animationStartTime = useSelector(function (store) {
|
|
7405
|
+
return mapSelectors.getAnimationStartTime(store, mapId);
|
|
7406
|
+
});
|
|
7407
|
+
var animationEndTime = useSelector(function (store) {
|
|
7408
|
+
return mapSelectors.getAnimationEndTime(store, mapId);
|
|
7409
|
+
});
|
|
7410
|
+
var isTimeScrollingEnabled = useSelector(syncGroupsSelectors.isTimeScrollingEnabled);
|
|
7411
|
+
var isAnimating = useSelector(function (store) {
|
|
7412
|
+
return mapSelectors.isAnimating(store, mapId);
|
|
7413
|
+
});
|
|
7414
|
+
var dispatch = useDispatch();
|
|
7415
|
+
var updateLayerInformation = React.useCallback(function (payload) {
|
|
7416
|
+
var _payload$layerDimensi, _payload$layerDimensi2;
|
|
7417
|
+
var updatedPayLoad = Object.assign({}, payload, {
|
|
7418
|
+
origin: 'OnInitializeLayerProps in MapViewConnect',
|
|
7419
|
+
layerDimensions: {
|
|
7420
|
+
layerId: ((_payload$layerDimensi = payload.layerDimensions) == null ? void 0 : _payload$layerDimensi.layerId) || '',
|
|
7421
|
+
origin: 'OnInitializeLayerProps in MapViewConnect',
|
|
7422
|
+
dimensions: (((_payload$layerDimensi2 = payload.layerDimensions) == null ? void 0 : _payload$layerDimensi2.dimensions) || []).map(function (layerDim) {
|
|
7423
|
+
return Object.assign({}, layerDim);
|
|
7424
|
+
})
|
|
7425
|
+
}
|
|
7426
|
+
});
|
|
7427
|
+
dispatch(layerActions.onUpdateLayerInformation(updatedPayLoad));
|
|
7428
|
+
}, [dispatch]);
|
|
7429
|
+
var registerMap = React.useCallback(function (payload) {
|
|
7430
|
+
dispatch(mapActions.registerMap(payload));
|
|
7431
|
+
}, [dispatch]);
|
|
7432
|
+
var unregisterMap = React.useCallback(function (payload) {
|
|
7433
|
+
dispatch(mapActions.unregisterMap(payload));
|
|
7434
|
+
}, [dispatch]);
|
|
7435
|
+
var syncGroupsAddSource = React.useCallback(function (payload) {
|
|
7436
|
+
dispatch(genericActions.syncGroupAddSource(payload));
|
|
7437
|
+
}, [dispatch]);
|
|
7438
|
+
var syncGroupRemoveSource = React.useCallback(function (payload) {
|
|
7439
|
+
dispatch(genericActions.syncGroupRemoveSource(payload));
|
|
7440
|
+
}, [dispatch]);
|
|
7441
|
+
var hoverSelect = React.useMemo(function () {
|
|
7442
|
+
return {
|
|
7443
|
+
active: true,
|
|
7444
|
+
onHover: setHoverLinkedFeature
|
|
7445
|
+
};
|
|
7446
|
+
}, []);
|
|
7447
|
+
var displayMapPin = useSelector(function (store) {
|
|
7448
|
+
return mapSelectors.getDisplayMapPin(store, mapId);
|
|
7449
|
+
});
|
|
7450
|
+
var mapPinLocation = useSelector(function (store) {
|
|
7451
|
+
return mapSelectors.getPinLocation(store, mapId);
|
|
7452
|
+
});
|
|
7453
|
+
var mapPinChangeLocation = React.useCallback(function (clickedLocation) {
|
|
7454
|
+
var _hoverLinkedFeature$g;
|
|
7455
|
+
var mapPinLocation = getCenterOfLinkedFeature(hoverLinkedFeature, srs) || clickedLocation;
|
|
7456
|
+
var selectedFeatureId = (hoverLinkedFeature == null || (_hoverLinkedFeature$g = hoverLinkedFeature.getId()) == null ? void 0 : _hoverLinkedFeature$g.toString()) || '';
|
|
7457
|
+
if (hoverLinkedFeature) {
|
|
7458
|
+
var selectedFeatureIndex = linkedFeatures.features.findIndex(function (feature) {
|
|
7459
|
+
return feature.id === selectedFeatureId;
|
|
7460
|
+
});
|
|
7461
|
+
dispatch(layerActions.setSelectedFeature({
|
|
7462
|
+
layerId: "drawlayer-" + mapId,
|
|
7463
|
+
selectedFeatureIndex: selectedFeatureIndex
|
|
7464
|
+
}));
|
|
7465
|
+
}
|
|
7466
|
+
dispatch(genericActions.addSharedData({
|
|
7467
|
+
panelId: linkedPanelId,
|
|
7468
|
+
data: {
|
|
7469
|
+
selectedFeatureId: selectedFeatureId
|
|
7470
|
+
}
|
|
7471
|
+
}));
|
|
7472
|
+
dispatch(mapActions.setMapPinLocation({
|
|
7473
|
+
mapId: mapId,
|
|
7474
|
+
mapPinLocation: mapPinLocation
|
|
7475
|
+
}));
|
|
7476
|
+
}, [dispatch, hoverLinkedFeature, linkedFeatures.features, linkedPanelId, mapId, srs]);
|
|
7477
|
+
var isActiveWindowId = useSelector(function (store) {
|
|
7478
|
+
return uiSelectors.getIsActiveWindowId(store, mapId);
|
|
7479
|
+
});
|
|
7480
|
+
useKeyboardZoomAndPan(isActiveWindowId, mapId, mapRef.current);
|
|
7481
|
+
useTouchZoomPan(isActiveWindowId, mapId);
|
|
7482
|
+
React.useEffect(function () {
|
|
7483
|
+
registerMap({
|
|
7484
|
+
mapId: mapId
|
|
7485
|
+
});
|
|
7486
|
+
syncGroupsAddSource({
|
|
7487
|
+
id: mapId,
|
|
7488
|
+
type: [syncConstants.SYNCGROUPS_TYPE_SETTIME, syncConstants.SYNCGROUPS_TYPE_SETBBOX]
|
|
7489
|
+
});
|
|
7490
|
+
dispatch(loadingIndicatorActions.setGetMapIsLoading({
|
|
7491
|
+
id: mapId,
|
|
7492
|
+
isGetMapLoading: false
|
|
7493
|
+
}));
|
|
7494
|
+
return function () {
|
|
7495
|
+
unregisterMap({
|
|
7496
|
+
mapId: mapId
|
|
7497
|
+
});
|
|
7498
|
+
syncGroupRemoveSource({
|
|
7499
|
+
id: mapId
|
|
7500
|
+
});
|
|
7501
|
+
};
|
|
7502
|
+
}, [dispatch, mapId, registerMap, syncGroupRemoveSource, syncGroupsAddSource, unregisterMap]);
|
|
7503
|
+
var onGetMapLoadStart = React.useCallback(function () {
|
|
7504
|
+
dispatch(loadingIndicatorActions.setGetMapIsLoading({
|
|
7505
|
+
id: mapId,
|
|
7506
|
+
isGetMapLoading: true
|
|
7507
|
+
}));
|
|
7508
|
+
}, [dispatch, mapId]);
|
|
7509
|
+
var onGetMapLoadReady = React.useCallback(function () {
|
|
7510
|
+
dispatch(loadingIndicatorActions.setGetMapIsLoading({
|
|
7511
|
+
id: mapId,
|
|
7512
|
+
isGetMapLoading: false
|
|
7513
|
+
}));
|
|
7514
|
+
}, [dispatch, mapId]);
|
|
7515
|
+
React.useEffect(function () {
|
|
7516
|
+
if (!view) {
|
|
7517
|
+
return function () {};
|
|
7518
|
+
}
|
|
7519
|
+
var eventKey = view.on('change', function () {
|
|
7520
|
+
var _view$getViewStateAnd = view.getViewStateAndExtent(),
|
|
7521
|
+
extent = _view$getViewStateAnd.extent;
|
|
7522
|
+
dispatch(genericActions.setBbox({
|
|
7523
|
+
bbox: {
|
|
7524
|
+
left: extent[0],
|
|
7525
|
+
bottom: extent[1],
|
|
7526
|
+
right: extent[2],
|
|
7527
|
+
top: extent[3]
|
|
7528
|
+
},
|
|
7529
|
+
sourceId: mapId,
|
|
7530
|
+
srs: srs
|
|
7531
|
+
}));
|
|
7532
|
+
});
|
|
7533
|
+
return function () {
|
|
7534
|
+
unByKey(eventKey);
|
|
7535
|
+
};
|
|
7536
|
+
}, [view, mapId, srs, dispatch]);
|
|
7537
|
+
var prefetchTimespan = makePrefetchTimeSpan(timeSliderStartCenterEndTime, animationStartTime, animationEndTime, isAnimating);
|
|
7538
|
+
var layerIds = mapLayerIds.join();
|
|
7539
|
+
var refetchLayers = React.useCallback(function () {
|
|
7540
|
+
mapLayerIds == null || mapLayerIds.forEach( /*#__PURE__*/function () {
|
|
7541
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(layerId) {
|
|
7542
|
+
var wmLayer, layerInfo;
|
|
7543
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7544
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7545
|
+
case 0:
|
|
7546
|
+
if (!layerId) {
|
|
7547
|
+
_context.next = 15;
|
|
7548
|
+
break;
|
|
7549
|
+
}
|
|
7550
|
+
_context.prev = 1;
|
|
7551
|
+
wmLayer = getWMLayerById(layerId);
|
|
7552
|
+
if (!wmLayer) {
|
|
7553
|
+
console.warn('No wmLayer exists for layer id', layerId);
|
|
7554
|
+
}
|
|
7555
|
+
_context.next = 6;
|
|
7556
|
+
return wmLayer.parseLayer(true);
|
|
7557
|
+
case 6:
|
|
7558
|
+
layerInfo = getLayerUpdateInfo(wmLayer, mapId);
|
|
7559
|
+
updateLayerInformation && updateLayerInformation(layerInfo);
|
|
7560
|
+
_context.next = 13;
|
|
7561
|
+
break;
|
|
7562
|
+
case 10:
|
|
7563
|
+
_context.prev = 10;
|
|
7564
|
+
_context.t0 = _context["catch"](1);
|
|
7565
|
+
window.console.error(_context.t0);
|
|
7566
|
+
case 13:
|
|
7567
|
+
_context.next = 16;
|
|
7568
|
+
break;
|
|
7569
|
+
case 15:
|
|
7570
|
+
console.warn('Not updating layer, something is wrong.', layerId);
|
|
7571
|
+
case 16:
|
|
7572
|
+
case "end":
|
|
7573
|
+
return _context.stop();
|
|
7574
|
+
}
|
|
7575
|
+
}, _callee, null, [[1, 10]]);
|
|
7576
|
+
}));
|
|
7577
|
+
return function (_x) {
|
|
7578
|
+
return _ref2.apply(this, arguments);
|
|
7579
|
+
};
|
|
7580
|
+
}());
|
|
7581
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7582
|
+
}, [mapId, updateLayerInformation, layerIds]);
|
|
7583
|
+
useSetIntervalWhenVisible(refetchLayers, 60000);
|
|
7584
|
+
var isLoading = React.useRef(false);
|
|
7585
|
+
// UseEffect for loading indicator
|
|
7586
|
+
React.useEffect(function () {
|
|
7587
|
+
openLayersGetMapImageStore.addImageEventCallback(function () {
|
|
7588
|
+
var checkLoading = !!(openLayersGetMapImageStore.getNumImagesLoading() > 0);
|
|
7589
|
+
if (checkLoading !== isLoading.current) {
|
|
7590
|
+
if (checkLoading === true) {
|
|
7591
|
+
onGetMapLoadStart && onGetMapLoadStart();
|
|
7592
|
+
} else {
|
|
7593
|
+
onGetMapLoadReady && onGetMapLoadReady();
|
|
7594
|
+
}
|
|
7595
|
+
isLoading.current = checkLoading;
|
|
7596
|
+
}
|
|
7597
|
+
}, mapId);
|
|
7598
|
+
return function () {
|
|
7599
|
+
openLayersGetMapImageStore.removeEventCallback(mapId);
|
|
7600
|
+
};
|
|
7601
|
+
}, [mapId, onGetMapLoadReady, onGetMapLoadStart]);
|
|
7602
|
+
var _React$useState2 = React.useState(false),
|
|
7603
|
+
debugMode = _React$useState2[0],
|
|
7604
|
+
setDebugMode = _React$useState2[1];
|
|
7605
|
+
React.useEffect(function () {
|
|
7606
|
+
var handleKeyPress = function handleKeyPress(event) {
|
|
7607
|
+
if (event.isTrusted && event.key === 'd' && document.activeElement === document.body) {
|
|
7608
|
+
setDebugMode(function (prev) {
|
|
7609
|
+
return !prev;
|
|
7610
|
+
});
|
|
7611
|
+
}
|
|
7612
|
+
};
|
|
7613
|
+
document.addEventListener('keyup', handleKeyPress);
|
|
7614
|
+
return function () {
|
|
7615
|
+
document.removeEventListener('keyup', handleKeyPress);
|
|
7616
|
+
};
|
|
7617
|
+
}, [debugMode]);
|
|
7618
|
+
var homeExtent = React.useMemo(function () {
|
|
7619
|
+
return initialBbox && [initialBbox.left, initialBbox.bottom, initialBbox.right, initialBbox.top];
|
|
7620
|
+
}, [initialBbox]);
|
|
7621
|
+
var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
|
|
7622
|
+
var _useSetupDialog = useSetupDialog(dialogType),
|
|
7623
|
+
isSearchDialogOpen = _useSetupDialog.isDialogOpen;
|
|
7624
|
+
var layerDivStyle = React.useMemo(function () {
|
|
7625
|
+
var style = {
|
|
7626
|
+
position: 'absolute',
|
|
7627
|
+
zIndex: 1
|
|
7628
|
+
};
|
|
7629
|
+
if (isSearchDialogOpen) {
|
|
7630
|
+
style.top = 8 + 40 + "px";
|
|
7631
|
+
}
|
|
7632
|
+
return style;
|
|
7633
|
+
}, [isSearchDialogOpen]);
|
|
7634
|
+
return jsx(TimeContext.Provider, {
|
|
7635
|
+
value: prefetchTimespan,
|
|
7636
|
+
children: jsxs(OpenLayersMapView, {
|
|
7637
|
+
view: view,
|
|
7638
|
+
isFocused: isActiveWindowId,
|
|
7639
|
+
isMouseWheelZoomEnabled: !isTimeScrollingEnabled,
|
|
7640
|
+
holdShiftToScroll: holdShiftToScroll,
|
|
7641
|
+
children: [jsxs("div", {
|
|
7642
|
+
style: layerDivStyle,
|
|
7643
|
+
children: [baseLayers.map(function (layer, zIndex) {
|
|
7644
|
+
return jsx(OpenLayersLayer, Object.assign({
|
|
7645
|
+
id: "baselayer-" + (layer == null ? void 0 : layer.id),
|
|
7646
|
+
zIndex: baseLayers.length - zIndex + 10
|
|
7647
|
+
}, layer), "baselayer-" + (layer == null ? void 0 : layer.id));
|
|
7648
|
+
}), mapLayerIds.map(function (layerId, zIndex) {
|
|
7649
|
+
return jsx(OlMapViewLayerConnect, {
|
|
7650
|
+
layerId: layerId,
|
|
7651
|
+
zIndex: mapLayerIds.length - zIndex + 1000,
|
|
7652
|
+
debugMode: debugMode,
|
|
7653
|
+
mapId: mapId
|
|
7654
|
+
}, "layer-" + layerId);
|
|
7655
|
+
}), overLayers.map(function (layer, zIndex) {
|
|
7656
|
+
return jsx(WMSLayer, {
|
|
7657
|
+
url: layer.service,
|
|
7658
|
+
layerName: layer.name,
|
|
7659
|
+
styleName: layer.style,
|
|
7660
|
+
layerOptions: {
|
|
7661
|
+
zIndex: overLayers.length - zIndex + 2000
|
|
7662
|
+
}
|
|
7663
|
+
}, "overlayer-" + (layer == null ? void 0 : layer.id));
|
|
7664
|
+
}), featureLayers.map(function (layer, zIndex) {
|
|
7665
|
+
return jsx(OpenLayersFeatureLayerConnect, {
|
|
7666
|
+
layerId: layer == null ? void 0 : layer.id,
|
|
7667
|
+
layer: layer,
|
|
7668
|
+
zIndex: featureLayers.length - zIndex + 3000,
|
|
7669
|
+
style: genericOpenLayersFeatureStyle,
|
|
7670
|
+
hoverSelect: {
|
|
7671
|
+
active: true
|
|
7672
|
+
}
|
|
7673
|
+
}, "featurelayer-" + (layer == null ? void 0 : layer.id));
|
|
7674
|
+
}), jsx(OpenLayersFeatureLayer, {
|
|
7675
|
+
style: genericOpenLayersFeatureStyle,
|
|
7676
|
+
featureCollection: linkedFeatures,
|
|
7677
|
+
zIndex: 4000,
|
|
7678
|
+
hoverSelect: hoverSelect
|
|
7679
|
+
}), jsx(OpenLayersGetFeatureInfo, {
|
|
7680
|
+
mapPinLocation: mapPinLocation,
|
|
7681
|
+
displayMapPin: displayMapPin,
|
|
7682
|
+
selectLocation: mapPinChangeLocation
|
|
7683
|
+
})]
|
|
7684
|
+
}), jsxs(MapControls, {
|
|
7685
|
+
"data-testid": "mapControls",
|
|
7686
|
+
style: {
|
|
7687
|
+
top: controls == null ? void 0 : controls.mapControlsPositionTop
|
|
7688
|
+
},
|
|
7689
|
+
children: [(controls == null ? void 0 : controls.search) && jsx(SearchControlButtonConnect, {
|
|
7690
|
+
mapId: mapId
|
|
7691
|
+
}), (controls == null ? void 0 : controls.zoomControls) && jsx(OpenLayersZoomControl, {
|
|
7692
|
+
homeExtent: homeExtent
|
|
7693
|
+
}), (controls == null ? void 0 : controls.layerManagerAndLegend) && jsxs(Fragment, {
|
|
7694
|
+
children: [jsx(LayerManagerMapButtonConnect, {
|
|
7695
|
+
mapId: mapId
|
|
7696
|
+
}), jsx(LegendMapButtonConnect, {
|
|
7697
|
+
mapId: mapId,
|
|
7698
|
+
multiLegend: controls == null ? void 0 : controls.multiLegend
|
|
7699
|
+
})]
|
|
7700
|
+
}), (controls == null ? void 0 : controls.dimensionSelect) && jsx(MultiDimensionSelectMapButtonsConnect, {
|
|
7701
|
+
mapId: mapId
|
|
7702
|
+
}), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoButtonConnect, {
|
|
7703
|
+
mapId: mapId
|
|
7704
|
+
}), controls == null ? void 0 : controls.additionalMapControls]
|
|
7705
|
+
}), (controls == null ? void 0 : controls.multiLegend) && jsx(LegendConnect, {
|
|
7706
|
+
showMapId: true,
|
|
7707
|
+
mapId: mapId,
|
|
7708
|
+
multiLegend: controls == null ? void 0 : controls.multiLegend
|
|
7709
|
+
}), (controls == null ? void 0 : controls.search) && jsx(SearchDialogConnect, {
|
|
7710
|
+
mapId: mapId
|
|
7711
|
+
}), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoConnect, {
|
|
7712
|
+
showMapId: true,
|
|
7713
|
+
mapId: mapId
|
|
7714
|
+
}), jsx(LayerManagerConnect, {
|
|
7715
|
+
mapId: mapId,
|
|
7716
|
+
bounds: "parent",
|
|
7717
|
+
isDocked: true
|
|
7718
|
+
}), children]
|
|
7719
|
+
})
|
|
7720
|
+
});
|
|
7721
|
+
};
|
|
7722
|
+
|
|
7063
7723
|
/* *
|
|
7064
7724
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7065
7725
|
* you may not use this file except in compliance with the License.
|
|
@@ -7737,6 +8397,9 @@ var useUpdateTimeSpan = function useUpdateTimeSpan(mapId, myOnSetTimeSliderSpan)
|
|
|
7737
8397
|
var selectedTime = useSelector(function (store) {
|
|
7738
8398
|
return mapSelectors.getSelectedTime(store, mapId);
|
|
7739
8399
|
});
|
|
8400
|
+
var isAnimating = useSelector(function (store) {
|
|
8401
|
+
return mapSelectors.isAnimating(store, mapId);
|
|
8402
|
+
});
|
|
7740
8403
|
var updateTimeSliderSpan = function updateTimeSliderSpan(spanInSeconds, newCenterTime, newSecondsPerPx) {
|
|
7741
8404
|
if (spanInSeconds !== undefined && newCenterTime !== undefined && newSecondsPerPx !== undefined) {
|
|
7742
8405
|
// Do not dispatch actions if values are the same
|
|
@@ -7746,13 +8409,15 @@ var useUpdateTimeSpan = function useUpdateTimeSpan(mapId, myOnSetTimeSliderSpan)
|
|
|
7746
8409
|
}
|
|
7747
8410
|
};
|
|
7748
8411
|
React.useEffect(function () {
|
|
7749
|
-
if (isTimeSpanAuto && autoTimeStepLayerId && activeLayerTimeDimension) {
|
|
8412
|
+
if (isTimeSpanAuto && autoTimeStepLayerId && activeLayerTimeDimension && !isAnimating) {
|
|
7750
8413
|
var _getTimeBounds = getTimeBounds([activeLayerTimeDimension]),
|
|
7751
8414
|
startTime = _getTimeBounds.startTime,
|
|
7752
8415
|
endTime = _getTimeBounds.endTime;
|
|
7753
|
-
var
|
|
8416
|
+
var minimumStartTime = selectedTime - 24 * 3600;
|
|
8417
|
+
var slicedStartTime = startTime < minimumStartTime ? minimumStartTime : startTime;
|
|
8418
|
+
var spanInSeconds = endTime - slicedStartTime;
|
|
7754
8419
|
var newSecondsPerPx = secondsPerPxFromCanvasWidth(timeSliderWidth, spanInSeconds);
|
|
7755
|
-
var newCenterTime = (
|
|
8420
|
+
var newCenterTime = (slicedStartTime + endTime) / 2;
|
|
7756
8421
|
updateTimeSliderSpan(spanInSeconds, newCenterTime, newSecondsPerPx);
|
|
7757
8422
|
} else {
|
|
7758
8423
|
var _spanInSeconds = currentTimeSpan || defaultTimeSpan;
|
|
@@ -7761,7 +8426,7 @@ var useUpdateTimeSpan = function useUpdateTimeSpan(mapId, myOnSetTimeSliderSpan)
|
|
|
7761
8426
|
updateTimeSliderSpan(_spanInSeconds, _newCenterTime, _newSecondsPerPx);
|
|
7762
8427
|
}
|
|
7763
8428
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7764
|
-
}, [autoTimeStepLayerId, isTimeSpanAuto, mapId]);
|
|
8429
|
+
}, [autoTimeStepLayerId, isTimeSpanAuto, mapId, activeLayerTimeDimension == null ? void 0 : activeLayerTimeDimension.name]);
|
|
7765
8430
|
};
|
|
7766
8431
|
var timeToIso = function timeToIso(selectedTime) {
|
|
7767
8432
|
return handleDateUtilsISOString(dateUtils.fromUnix(selectedTime).toISOString());
|
|
@@ -8042,7 +8707,7 @@ var TimeSliderClockConnect = function TimeSliderClockConnect(_ref) {
|
|
|
8042
8707
|
});
|
|
8043
8708
|
};
|
|
8044
8709
|
|
|
8045
|
-
var _excluded = ["id", "dockedLayerManagerSize", "title", "layers", "dimensions", "shouldAutoUpdate", "shouldAnimate", "shouldAutoFetch", "
|
|
8710
|
+
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"];
|
|
8046
8711
|
var titleStyle = function titleStyle(theme) {
|
|
8047
8712
|
return {
|
|
8048
8713
|
position: 'absolute',
|
|
@@ -8077,8 +8742,8 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8077
8742
|
shouldAnimate = _ref$shouldAnimate === void 0 ? false : _ref$shouldAnimate,
|
|
8078
8743
|
_ref$shouldAutoFetch = _ref.shouldAutoFetch,
|
|
8079
8744
|
shouldAutoFetch = _ref$shouldAutoFetch === void 0 ? true : _ref$shouldAutoFetch,
|
|
8080
|
-
_ref$
|
|
8081
|
-
|
|
8745
|
+
_ref$initialBbox = _ref.initialBbox,
|
|
8746
|
+
initialBbox = _ref$initialBbox === void 0 ? defaultBbox.bbox : _ref$initialBbox,
|
|
8082
8747
|
_ref$srs = _ref.srs,
|
|
8083
8748
|
srs = _ref$srs === void 0 ? defaultBbox.srs : _ref$srs,
|
|
8084
8749
|
_ref$shouldShowZoomCo = _ref.shouldShowZoomControls,
|
|
@@ -8107,6 +8772,8 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8107
8772
|
shouldDisplayDrawControls = _ref$shouldDisplayDra === void 0 ? false : _ref$shouldDisplayDra,
|
|
8108
8773
|
_ref$displaySearchBut = _ref.displaySearchButtonInMap,
|
|
8109
8774
|
displaySearchButtonInMap = _ref$displaySearchBut === void 0 ? false : _ref$displaySearchBut,
|
|
8775
|
+
_ref$useOl = _ref.useOl,
|
|
8776
|
+
useOl = _ref$useOl === void 0 ? isOpenLayersEnabled() : _ref$useOl,
|
|
8110
8777
|
mapControls = _ref.mapControls,
|
|
8111
8778
|
children = _ref.children,
|
|
8112
8779
|
shouldDisablePrefetching = _ref.shouldDisablePrefetching,
|
|
@@ -8135,7 +8802,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8135
8802
|
var mapPreset = Object.assign({
|
|
8136
8803
|
layers: updatedLayers,
|
|
8137
8804
|
proj: {
|
|
8138
|
-
bbox:
|
|
8805
|
+
bbox: initialBbox,
|
|
8139
8806
|
srs: srs
|
|
8140
8807
|
},
|
|
8141
8808
|
dimensions: dimensions,
|
|
@@ -8184,6 +8851,13 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8184
8851
|
origin: 'ConfigurableMapConnect'
|
|
8185
8852
|
}));
|
|
8186
8853
|
}
|
|
8854
|
+
if (initialBbox) {
|
|
8855
|
+
dispatch(genericActions.setBbox({
|
|
8856
|
+
bbox: initialBbox,
|
|
8857
|
+
sourceId: mapId,
|
|
8858
|
+
srs: srs
|
|
8859
|
+
}));
|
|
8860
|
+
}
|
|
8187
8861
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8188
8862
|
}, []);
|
|
8189
8863
|
var mapControlConfig = useMemo(function () {
|
|
@@ -8226,7 +8900,17 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8226
8900
|
sourceId: id,
|
|
8227
8901
|
mapWindowRef: mapWindowRef
|
|
8228
8902
|
})
|
|
8229
|
-
}), jsx(
|
|
8903
|
+
}), useOl ? jsx(OlMapViewConnect, {
|
|
8904
|
+
controls: mapControlConfig,
|
|
8905
|
+
displayTimeInMap: displayTimeInMap,
|
|
8906
|
+
showScaleBar: false,
|
|
8907
|
+
shouldAutoFetch: shouldAutoFetch,
|
|
8908
|
+
mapId: mapId,
|
|
8909
|
+
initialBbox: initialBbox,
|
|
8910
|
+
shouldDisablePrefetching: shouldDisablePrefetching,
|
|
8911
|
+
tileServerSettings: tileServerSettings,
|
|
8912
|
+
children: children
|
|
8913
|
+
}) : jsx(MapViewConnect, {
|
|
8230
8914
|
controls: mapControlConfig,
|
|
8231
8915
|
displayTimeInMap: displayTimeInMap,
|
|
8232
8916
|
showScaleBar: false,
|
|
@@ -8239,7 +8923,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8239
8923
|
mapId: mapId
|
|
8240
8924
|
})]
|
|
8241
8925
|
});
|
|
8242
|
-
}, [mapId, title, id, mapControlConfig, tileServerSettings, disableTimeSlider, displayTimeInMap, shouldAutoFetch, shouldDisablePrefetching, children, showClock]);
|
|
8926
|
+
}, [mapId, title, id, useOl, initialBbox, mapControlConfig, tileServerSettings, disableTimeSlider, displayTimeInMap, shouldAutoFetch, shouldDisablePrefetching, children, showClock]);
|
|
8243
8927
|
};
|
|
8244
8928
|
|
|
8245
8929
|
var mapBoxStyle = function mapBoxStyle(theme) {
|
|
@@ -8335,7 +9019,7 @@ var MultiMapViewConnect = function MultiMapViewConnect(_ref) {
|
|
|
8335
9019
|
layers: map.layers || [],
|
|
8336
9020
|
autoTimeStepLayerId: map.autoTimeStepLayerId,
|
|
8337
9021
|
autoUpdateLayerId: map.autoUpdateLayerId,
|
|
8338
|
-
|
|
9022
|
+
initialBbox: map.bbox,
|
|
8339
9023
|
srs: map.srs,
|
|
8340
9024
|
dimensions: map.dimensions || [],
|
|
8341
9025
|
displayTimeInMap: map.displayTimeInMap || false,
|
|
@@ -8510,7 +9194,7 @@ var HarmonieTempAndPrecipPreset = function HarmonieTempAndPrecipPreset(_ref) {
|
|
|
8510
9194
|
children: "Loading..."
|
|
8511
9195
|
});
|
|
8512
9196
|
}
|
|
8513
|
-
/* Helper to make a map layer
|
|
9197
|
+
/* Helper to make a map layer preset */
|
|
8514
9198
|
var makeMapPreset = function makeMapPreset(referenceTime, uniqueId, layer, syncGroupsIds, col) {
|
|
8515
9199
|
return {
|
|
8516
9200
|
id: uniqueId,
|
|
@@ -8525,6 +9209,7 @@ var HarmonieTempAndPrecipPreset = function HarmonieTempAndPrecipPreset(_ref) {
|
|
|
8525
9209
|
componentType: 'MultiMap',
|
|
8526
9210
|
layers: [Object.assign({}, layer, {
|
|
8527
9211
|
id: uniqueId,
|
|
9212
|
+
useLatestReferenceTime: false,
|
|
8528
9213
|
dimensions: [{
|
|
8529
9214
|
name: 'reference_time',
|
|
8530
9215
|
currentValue: referenceTime
|
|
@@ -8567,11 +9252,13 @@ var componentsLookUp = function componentsLookUp(_ref) {
|
|
|
8567
9252
|
switch (componentType) {
|
|
8568
9253
|
case 'Map':
|
|
8569
9254
|
{
|
|
9255
|
+
var _mapPreset$proj;
|
|
8570
9256
|
var mapPreset = initialProps.mapPreset,
|
|
8571
9257
|
mapControls = initialProps.mapControls,
|
|
8572
9258
|
shouldDisplayDrawControls = initialProps.shouldDisplayDrawControls,
|
|
8573
9259
|
displaySearchButtonInMap = initialProps.displaySearchButtonInMap;
|
|
8574
9260
|
return jsx(ConfigurableMapConnect, Object.assign({}, mapPreset, {
|
|
9261
|
+
initialBbox: mapPreset == null || (_mapPreset$proj = mapPreset.proj) == null ? void 0 : _mapPreset$proj.bbox,
|
|
8575
9262
|
id: id,
|
|
8576
9263
|
"data-testid": "coreConfigurableMapConnect",
|
|
8577
9264
|
displayGetFeatureInfoButtonInMap: true,
|
|
@@ -8768,7 +9455,7 @@ var SyncGroupViewer = function SyncGroupViewer(_ref) {
|
|
|
8768
9455
|
React.useEffect(function () {
|
|
8769
9456
|
var handleKeyDown = function handleKeyDown(event) {
|
|
8770
9457
|
var target = event.target;
|
|
8771
|
-
if (target.tagName !== 'INPUT' && target.tagName !== 'TEXTAREA' && event.key === 's') {
|
|
9458
|
+
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')) {
|
|
8772
9459
|
toggleTimeScroll({
|
|
8773
9460
|
isTimeScrollingEnabled: !isTimeScrollingEnabled
|
|
8774
9461
|
});
|
|
@@ -9115,41 +9802,55 @@ var CoreThemeProvider = function CoreThemeProvider(_ref) {
|
|
|
9115
9802
|
});
|
|
9116
9803
|
};
|
|
9117
9804
|
/**
|
|
9118
|
-
* A Provider component which provides the GeoWeb
|
|
9805
|
+
* A Provider component which provides the GeoWeb store for the core.
|
|
9119
9806
|
* Note: Should only be used with core components, as the provided store is only for core.
|
|
9120
9807
|
* @param children
|
|
9121
9808
|
* @returns
|
|
9122
9809
|
*/
|
|
9123
|
-
var
|
|
9810
|
+
var CoreStoreProvider = function CoreStoreProvider(_ref2) {
|
|
9124
9811
|
var children = _ref2.children,
|
|
9125
|
-
_ref2$theme = _ref2.theme,
|
|
9126
|
-
theme = _ref2$theme === void 0 ? lightTheme : _ref2$theme,
|
|
9127
9812
|
store = _ref2.store;
|
|
9128
9813
|
return jsx(Provider, {
|
|
9814
|
+
store: store,
|
|
9815
|
+
children: jsx(SnackbarWrapperConnect, {
|
|
9816
|
+
children: children
|
|
9817
|
+
})
|
|
9818
|
+
});
|
|
9819
|
+
};
|
|
9820
|
+
/**
|
|
9821
|
+
* A Provider component which provides the GeoWeb theme and store for the core.
|
|
9822
|
+
* Note: Should only be used with core components, as the provided store is only for core.
|
|
9823
|
+
* @param children
|
|
9824
|
+
* @returns
|
|
9825
|
+
*/
|
|
9826
|
+
var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref3) {
|
|
9827
|
+
var children = _ref3.children,
|
|
9828
|
+
_ref3$theme = _ref3.theme,
|
|
9829
|
+
theme = _ref3$theme === void 0 ? lightTheme : _ref3$theme,
|
|
9830
|
+
store = _ref3.store;
|
|
9831
|
+
return jsx(CoreStoreProvider, {
|
|
9129
9832
|
store: store,
|
|
9130
9833
|
children: jsx(CoreThemeProvider, {
|
|
9131
9834
|
theme: theme,
|
|
9132
|
-
children:
|
|
9133
|
-
children: children
|
|
9134
|
-
})
|
|
9835
|
+
children: children
|
|
9135
9836
|
})
|
|
9136
9837
|
});
|
|
9137
9838
|
};
|
|
9138
|
-
var CoreI18nProvider = function CoreI18nProvider(
|
|
9139
|
-
var children =
|
|
9839
|
+
var CoreI18nProvider = function CoreI18nProvider(_ref4) {
|
|
9840
|
+
var children = _ref4.children;
|
|
9140
9841
|
initCoreReactI18n();
|
|
9141
9842
|
return jsx(I18nextProvider, {
|
|
9142
9843
|
i18n: i18n,
|
|
9143
9844
|
children: children
|
|
9144
9845
|
});
|
|
9145
9846
|
};
|
|
9146
|
-
// used for react
|
|
9847
|
+
// used for react tests
|
|
9147
9848
|
var DemoWrapper = function DemoWrapper(props) {
|
|
9148
9849
|
return jsx(CoreI18nProvider, {
|
|
9149
9850
|
children: jsx(CoreThemeProvider, Object.assign({}, props))
|
|
9150
9851
|
});
|
|
9151
9852
|
};
|
|
9152
|
-
// used for redux
|
|
9853
|
+
// used for redux tests
|
|
9153
9854
|
var DemoWrapperConnect = function DemoWrapperConnect(props) {
|
|
9154
9855
|
return jsx(CoreI18nProvider, {
|
|
9155
9856
|
children: jsx(CoreThemeStoreProvider, Object.assign({}, props))
|
|
@@ -9362,4 +10063,4 @@ var LanguageSelect = function LanguageSelect(_ref) {
|
|
|
9362
10063
|
});
|
|
9363
10064
|
};
|
|
9364
10065
|
|
|
9365
|
-
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, SearchDialog, SearchDialogConnect, SentryRecordButton, SyncGroupViewerConnect, TimeSliderConnect, ZoomControlConnect, componentsLookUp, coreTranslations, defaultBbox, defaultConfigurations, filterMapPresets, filterServices, filterTimeSeriesServices, getLanguageFromLocalStorage, languageLocalStorageKey, saveLanguageToLocalStorage, testLayers, useFetchServices, useUpdateTimeSpan, useUpdateTimestep };
|
|
10066
|
+
export { CORE_NAMESPACE, ConfigurableMapConnect, CoreI18nProvider, CoreStoreProvider, 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, getCenterOfLinkedFeature, getLanguageFromLocalStorage, languageLocalStorageKey, makeLayerInfoPayload, makePrefetchTimeSpan, saveLanguageToLocalStorage, testLayers, useFetchServices, useUpdateTimeSpan, useUpdateTimestep };
|