@opengeoweb/core 10.2.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 +785 -71
- package/package.json +3 -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/olMapUtils.spec.d.ts +1 -0
- package/src/lib/components/MapViewConnect/useGetOpenlayersView.d.ts +9 -0
- package/src/lib/components/Search/types.d.ts +1 -1
- package/src/lib/components/Search/utils.d.ts +2 -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/fakeApi.d.ts +31 -1
- package/src/lib/utils/location-api/hooks.d.ts +1 -6
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
|
-
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, emptyGeoJSON, registerDrawFunction,
|
|
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,
|
|
15
|
-
import _, { isArray, isEqual,
|
|
16
|
-
import { webmapUtils, queryWMSServiceInfo, queryWMSLayers, queryWMSLayersTree, invalidateWMSGetCapabilities, LayerType, getWMSServiceId, generateLayerId, getWMJSMapById, getWMSGetFeatureInfoRequestURL, handleDateUtilsISOString, wmServiceListener, EVENT_GETCAPABILITIES_START, EVENT_GETCAPABILITIES_READY, WMLayer } from '@opengeoweb/webmap';
|
|
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 _, { isArray, isEqual, debounce, range } from 'lodash';
|
|
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
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';
|
|
@@ -5769,13 +5772,16 @@ var useLocationList = function useLocationList(search) {
|
|
|
5769
5772
|
queryKey: ['location-list', search],
|
|
5770
5773
|
queryFn: function queryFn() {
|
|
5771
5774
|
return getLocationList(search);
|
|
5772
|
-
}
|
|
5773
|
-
enabled: !!search
|
|
5775
|
+
}
|
|
5774
5776
|
});
|
|
5775
5777
|
};
|
|
5776
|
-
var useLocationDetail = function useLocationDetail(
|
|
5777
|
-
|
|
5778
|
-
|
|
5778
|
+
var useLocationDetail = function useLocationDetail(id, source) {
|
|
5779
|
+
if (id === void 0) {
|
|
5780
|
+
id = '';
|
|
5781
|
+
}
|
|
5782
|
+
if (source === void 0) {
|
|
5783
|
+
source = '';
|
|
5784
|
+
}
|
|
5779
5785
|
return useQuery({
|
|
5780
5786
|
queryKey: ['location-detail', {
|
|
5781
5787
|
id: id,
|
|
@@ -5810,14 +5816,15 @@ var SearchDialog = function SearchDialog(_ref) {
|
|
|
5810
5816
|
var debouncedInputValue = useDebounce(inputValue, 300);
|
|
5811
5817
|
var _useLocationList = useLocationList(debouncedInputValue),
|
|
5812
5818
|
locationListData = _useLocationList.data;
|
|
5813
|
-
var _useLocationDetail = useLocationDetail(
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
}),
|
|
5817
|
-
locationDetail = _useLocationDetail.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;
|
|
5818
5822
|
useEffect(function () {
|
|
5819
|
-
|
|
5820
|
-
|
|
5823
|
+
if (isFetchingDetail) {
|
|
5824
|
+
return;
|
|
5825
|
+
}
|
|
5826
|
+
onSelectLocation(selectedValue ? locationDetail : undefined);
|
|
5827
|
+
}, [locationDetail, onSelectLocation, selectedValue, isFetchingDetail]);
|
|
5821
5828
|
return isOpen && mapId ? jsxs(Box, {
|
|
5822
5829
|
sx: {
|
|
5823
5830
|
display: 'flex',
|
|
@@ -5937,6 +5944,7 @@ var myLocationDrawFunction = function myLocationDrawFunction(args) {
|
|
|
5937
5944
|
var ctx = args.context,
|
|
5938
5945
|
coord = args.coord;
|
|
5939
5946
|
// Draw outer circle
|
|
5947
|
+
ctx.strokeStyle = '#fff';
|
|
5940
5948
|
ctx.fillStyle = '#fff';
|
|
5941
5949
|
ctx.shadowColor = '#00000080';
|
|
5942
5950
|
ctx.shadowBlur = 4;
|
|
@@ -5953,6 +5961,7 @@ var myLocationDrawFunction = function myLocationDrawFunction(args) {
|
|
|
5953
5961
|
var selectedLocationDrawFunction = function selectedLocationDrawFunction(args) {
|
|
5954
5962
|
var ctx = args.context,
|
|
5955
5963
|
coord = args.coord;
|
|
5964
|
+
ctx.strokeStyle = '#051039';
|
|
5956
5965
|
ctx.fillStyle = '#051039';
|
|
5957
5966
|
ctx.beginPath();
|
|
5958
5967
|
var topRadius = 7;
|
|
@@ -5968,21 +5977,48 @@ var selectedLocationDrawFunction = function selectedLocationDrawFunction(args) {
|
|
|
5968
5977
|
ctx.arc(coord.x, coord.y - topHeight, topRadius / 2.5, Math.PI * 2, 0);
|
|
5969
5978
|
ctx.fill();
|
|
5970
5979
|
};
|
|
5971
|
-
var
|
|
5972
|
-
|
|
5973
|
-
|
|
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 = {
|
|
5974
6000
|
type: 'Feature',
|
|
5975
6001
|
properties: {
|
|
5976
6002
|
name: location.name,
|
|
5977
6003
|
drawFunctionId: drawFunctionId,
|
|
5978
|
-
hoverDrawFunctionId: hoverDrawFunctionId
|
|
6004
|
+
hoverDrawFunctionId: hoverDrawFunctionId,
|
|
6005
|
+
mapFeatureClass: mapFeatureClass
|
|
5979
6006
|
},
|
|
5980
6007
|
geometry: {
|
|
5981
6008
|
type: 'Point',
|
|
5982
6009
|
coordinates: [location.lon, location.lat]
|
|
5983
6010
|
}
|
|
5984
|
-
}
|
|
5985
|
-
|
|
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;
|
|
5986
6022
|
};
|
|
5987
6023
|
var fitText = function fitText(ctx, text, x, y, lineheight) {
|
|
5988
6024
|
var lines = text.split('\n');
|
|
@@ -6019,6 +6055,7 @@ var hoverDrawFunction = function hoverDrawFunction(args) {
|
|
|
6019
6055
|
ctx.font = fontSize + "px Roboto";
|
|
6020
6056
|
var x = coord.x,
|
|
6021
6057
|
y = coord.y;
|
|
6058
|
+
ctx.strokeStyle = '#000';
|
|
6022
6059
|
ctx.fillStyle = '#000';
|
|
6023
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);
|
|
6024
6061
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -6031,14 +6068,20 @@ var hoverDrawFunction = function hoverDrawFunction(args) {
|
|
|
6031
6068
|
};
|
|
6032
6069
|
var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
|
|
6033
6070
|
var dispatch = useDispatch();
|
|
6034
|
-
var
|
|
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;
|
|
6035
6078
|
var isMapPresent = useSelector(function (store) {
|
|
6036
6079
|
return mapSelectors.getIsMapPresent(store, mapId);
|
|
6037
6080
|
});
|
|
6038
6081
|
var isLayerPresent = useSelector(function (store) {
|
|
6039
|
-
return layerSelectors.getIsLayerPresent(store,
|
|
6082
|
+
return layerSelectors.getIsLayerPresent(store, layerIdRef.current);
|
|
6040
6083
|
});
|
|
6041
|
-
var shouldAddLayer = isMapPresent && !isLayerPresent;
|
|
6084
|
+
var shouldAddLayer = isMapPresent && !isLayerPresent && layerId;
|
|
6042
6085
|
React__default.useEffect(function () {
|
|
6043
6086
|
if (shouldAddLayer) {
|
|
6044
6087
|
dispatch(layerActions.addLayer({
|
|
@@ -6055,7 +6098,8 @@ var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
|
|
|
6055
6098
|
var drawFunctionId = React__default.useRef(registerDrawFunction(drawFunction)).current;
|
|
6056
6099
|
var hoverDrawFunctionId = React__default.useRef(registerDrawFunction(hoverDrawFunction)).current;
|
|
6057
6100
|
var updateGeoJSON = React__default.useCallback(function (location) {
|
|
6058
|
-
var
|
|
6101
|
+
var mapFeatureClass = (location == null ? void 0 : location.source) === 'MyMapLocation' ? MapFeatureClass.MyLocation : MapFeatureClass.GenericMarker;
|
|
6102
|
+
var geojson = location ? makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId, mapFeatureClass) : emptyGeoJSON;
|
|
6059
6103
|
dispatch(layerActions.updateFeature({
|
|
6060
6104
|
layerId: layerId,
|
|
6061
6105
|
geojson: geojson
|
|
@@ -6065,8 +6109,10 @@ var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
|
|
|
6065
6109
|
var webMap = getWMJSMapById(mapId);
|
|
6066
6110
|
if (webMap) {
|
|
6067
6111
|
webMap.calculateBoundingBoxAndZoom(location.lat, location.lon);
|
|
6112
|
+
} else if (map) {
|
|
6113
|
+
setMapCenter(map, location.lon, location.lat);
|
|
6068
6114
|
}
|
|
6069
|
-
}, [mapId]);
|
|
6115
|
+
}, [mapId, map]);
|
|
6070
6116
|
var onUpdateLocation = React__default.useCallback(function (location) {
|
|
6071
6117
|
updateGeoJSON(location);
|
|
6072
6118
|
if (location) {
|
|
@@ -6256,30 +6302,50 @@ var getTitle = function getTitle(layerId) {
|
|
|
6256
6302
|
var wmjsLayer = webmapUtils.getWMLayerById(layerId);
|
|
6257
6303
|
return wmjsLayer ? wmjsLayer.title || wmjsLayer.name : layerId;
|
|
6258
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
|
+
};
|
|
6259
6331
|
/**
|
|
6260
6332
|
* Make a list of GFI Layers to display.
|
|
6261
6333
|
* @param layers
|
|
6262
6334
|
* @param mapId
|
|
6263
6335
|
* @returns
|
|
6264
6336
|
*/
|
|
6265
|
-
var getLayersToUpdate = function getLayersToUpdate(layers, mapId) {
|
|
6337
|
+
var getLayersToUpdate = function getLayersToUpdate(mapPinLocation, layers, mapId) {
|
|
6266
6338
|
var wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
6267
|
-
if (!
|
|
6339
|
+
if (!layers || layers.length === 0 || !wmjsMap && !mapPinLocation) {
|
|
6268
6340
|
return [];
|
|
6269
6341
|
}
|
|
6270
6342
|
return layers.filter(function (layer) {
|
|
6271
6343
|
return layer && layer.enabled && !!webmapUtils.getWMLayerById(layer.id);
|
|
6272
6344
|
}).map(function (layer) {
|
|
6273
|
-
|
|
6274
|
-
We need a wmjsLayer to build the getfeatureinfo url (getWMSGetFeatureInfoRequestURL function).
|
|
6275
|
-
But it seems that its dimension are lazely updated (by ReactMapView).
|
|
6276
|
-
Therefore make a clone of this layer and set its dimensions based on the layer object.
|
|
6277
|
-
Otherwise we risk making a getfeatureinfo call with outdated dimension values.
|
|
6278
|
-
*/
|
|
6279
|
-
var wmjsLayer = webmapUtils.getWMLayerById(layer.id).cloneLayer();
|
|
6345
|
+
var url = getFeatureInfoUrl(layer, wmjsMap, mapPinLocation);
|
|
6280
6346
|
return {
|
|
6281
6347
|
layerId: layer.id,
|
|
6282
|
-
url:
|
|
6348
|
+
url: url,
|
|
6283
6349
|
title: getTitle(layer.id)
|
|
6284
6350
|
};
|
|
6285
6351
|
});
|
|
@@ -6347,7 +6413,7 @@ var GetFeatureInfoDialog = function GetFeatureInfoDialog(_ref) {
|
|
|
6347
6413
|
triggerRerender("" + layerId + isLoading);
|
|
6348
6414
|
};
|
|
6349
6415
|
/* Build a layerlist array with a set of arguments per layer to do the query for */
|
|
6350
|
-
var layerToUpdateList = isOpen ? getLayersToUpdate(layers, mapId) : [];
|
|
6416
|
+
var layerToUpdateList = isOpen && mapPinLocation ? getLayersToUpdate(mapPinLocation, layers, mapId) : [];
|
|
6351
6417
|
/*
|
|
6352
6418
|
Build a string based on the GFI urls. If this changes for whatever reason we need to update.
|
|
6353
6419
|
These strings can change very often, therefore they need to be debounced and only use the most recent result must be used.
|
|
@@ -6590,7 +6656,7 @@ var GetFeatureInfoButtonConnect = function GetFeatureInfoButtonConnect(_ref) {
|
|
|
6590
6656
|
});
|
|
6591
6657
|
};
|
|
6592
6658
|
|
|
6593
|
-
var _excluded$1 = ["mapId", "children", "controls"];
|
|
6659
|
+
var _excluded$1 = ["mapId", "children", "controls", "initialBbox"];
|
|
6594
6660
|
var ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION = 'ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION';
|
|
6595
6661
|
/**
|
|
6596
6662
|
* Connected component used to display the map and selected layers.
|
|
@@ -6612,8 +6678,9 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
6612
6678
|
controls = _ref$controls === void 0 ? {
|
|
6613
6679
|
mapControlsPositionTop: 0,
|
|
6614
6680
|
zoomControls: true
|
|
6615
|
-
} : _ref$controls
|
|
6616
|
-
|
|
6681
|
+
} : _ref$controls;
|
|
6682
|
+
_ref.initialBbox;
|
|
6683
|
+
var props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
6617
6684
|
var mapRef = React.useRef(null);
|
|
6618
6685
|
var store = useStore();
|
|
6619
6686
|
var mapDimensions = useSelector(function (store) {
|
|
@@ -6731,26 +6798,26 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
6731
6798
|
var geojson = _ref2.geojson,
|
|
6732
6799
|
reason = _ref2.reason,
|
|
6733
6800
|
layerId = _ref2.layerId;
|
|
6734
|
-
var activeDrawToolId =
|
|
6735
|
-
var activeDrawMode =
|
|
6801
|
+
var activeDrawToolId = drawingToolSelectors.getActiveDrawToolId(store.getState());
|
|
6802
|
+
var activeDrawMode = drawingToolSelectors.getActiveDrawMode(store.getState(), activeDrawToolId);
|
|
6736
6803
|
dispatch(layerActions.updateFeature({
|
|
6737
6804
|
geojson: geojson,
|
|
6738
6805
|
reason: reason,
|
|
6739
6806
|
layerId: layerId,
|
|
6740
|
-
shouldAllowMultipleShapes:
|
|
6741
|
-
geoJSONIntersectionLayerId:
|
|
6742
|
-
geoJSONIntersectionBoundsLayerId:
|
|
6807
|
+
shouldAllowMultipleShapes: drawingToolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId),
|
|
6808
|
+
geoJSONIntersectionLayerId: drawingToolSelectors.getGeoJSONIntersectionLayerId(store.getState(), activeDrawToolId),
|
|
6809
|
+
geoJSONIntersectionBoundsLayerId: drawingToolSelectors.getGeoJSONIntersectionBoundsLayerId(store.getState(), activeDrawToolId),
|
|
6743
6810
|
selectionType: activeDrawMode == null ? void 0 : activeDrawMode.selectionType
|
|
6744
6811
|
}));
|
|
6745
6812
|
}, [dispatch, store]);
|
|
6746
6813
|
var exitFeatureDrawMode = React.useCallback(function (_ref3) {
|
|
6747
6814
|
var reason = _ref3.reason,
|
|
6748
6815
|
layerId = _ref3.layerId;
|
|
6749
|
-
var activeDrawToolId =
|
|
6816
|
+
var activeDrawToolId = drawingToolSelectors.getActiveDrawToolId(store.getState());
|
|
6750
6817
|
dispatch(layerActions.exitFeatureDrawMode({
|
|
6751
6818
|
reason: reason,
|
|
6752
6819
|
layerId: layerId,
|
|
6753
|
-
shouldAllowMultipleShapes:
|
|
6820
|
+
shouldAllowMultipleShapes: drawingToolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId)
|
|
6754
6821
|
}));
|
|
6755
6822
|
}, [dispatch, store]);
|
|
6756
6823
|
var isActiveWindowId = useSelector(function (store) {
|
|
@@ -7021,6 +7088,601 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
7021
7088
|
});
|
|
7022
7089
|
};
|
|
7023
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();
|
|
7572
|
+
}
|
|
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,
|
|
7615
|
+
mapId: mapId
|
|
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
|
|
7626
|
+
}
|
|
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
|
|
7636
|
+
}
|
|
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, {
|
|
7653
|
+
mapId: mapId
|
|
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, {
|
|
7673
|
+
mapId: mapId
|
|
7674
|
+
}), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoConnect, {
|
|
7675
|
+
showMapId: true,
|
|
7676
|
+
mapId: mapId
|
|
7677
|
+
}), jsx(LayerManagerConnect, {
|
|
7678
|
+
mapId: mapId,
|
|
7679
|
+
bounds: "parent",
|
|
7680
|
+
isDocked: true
|
|
7681
|
+
})]
|
|
7682
|
+
})
|
|
7683
|
+
});
|
|
7684
|
+
};
|
|
7685
|
+
|
|
7024
7686
|
/* *
|
|
7025
7687
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7026
7688
|
* you may not use this file except in compliance with the License.
|
|
@@ -7513,7 +8175,8 @@ var TimeSliderLegendConnect = function TimeSliderLegendConnect(_ref) {
|
|
|
7513
8175
|
onSetTimeSliderSpan = _ref.onSetTimeSliderSpan,
|
|
7514
8176
|
unfilteredSelectedTime = _ref.unfilteredSelectedTime,
|
|
7515
8177
|
setUnfilteredSelectedTime = _ref.setUnfilteredSelectedTime,
|
|
7516
|
-
mapWindowRef = _ref.mapWindowRef
|
|
8178
|
+
mapWindowRef = _ref.mapWindowRef,
|
|
8179
|
+
adjustSelectedTimeOnWheel = _ref.adjustSelectedTimeOnWheel;
|
|
7517
8180
|
var isTimeScrollingEnabled = useSelector(syncGroupsSelectors.isTimeScrollingEnabled);
|
|
7518
8181
|
var centerTime = useSelector(function (store) {
|
|
7519
8182
|
return mapSelectors.getMapTimeSliderCenterTime(store, mapId);
|
|
@@ -7645,7 +8308,8 @@ var TimeSliderLegendConnect = function TimeSliderLegendConnect(_ref) {
|
|
|
7645
8308
|
}));
|
|
7646
8309
|
}
|
|
7647
8310
|
}
|
|
7648
|
-
}
|
|
8311
|
+
},
|
|
8312
|
+
adjustSelectedTimeOnWheel: adjustSelectedTimeOnWheel
|
|
7649
8313
|
});
|
|
7650
8314
|
};
|
|
7651
8315
|
|
|
@@ -7720,7 +8384,7 @@ var useUpdateTimeSpan = function useUpdateTimeSpan(mapId, myOnSetTimeSliderSpan)
|
|
|
7720
8384
|
updateTimeSliderSpan(_spanInSeconds, _newCenterTime, _newSecondsPerPx);
|
|
7721
8385
|
}
|
|
7722
8386
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7723
|
-
}, [autoTimeStepLayerId, isTimeSpanAuto,
|
|
8387
|
+
}, [autoTimeStepLayerId, isTimeSpanAuto, mapId]);
|
|
7724
8388
|
};
|
|
7725
8389
|
var timeToIso = function timeToIso(selectedTime) {
|
|
7726
8390
|
return handleDateUtilsISOString(dateUtils.fromUnix(selectedTime).toISOString());
|
|
@@ -7801,9 +8465,6 @@ var TimeSliderConnect = function TimeSliderConnect(_ref) {
|
|
|
7801
8465
|
});
|
|
7802
8466
|
useUpdateTimestep(mapId);
|
|
7803
8467
|
useUpdateTimeSpan(mapId, onSetTimeSliderSpan);
|
|
7804
|
-
var makeFilteredSelectedTime = function makeFilteredSelectedTime(timeValue) {
|
|
7805
|
-
return getFilteredTime(timeValue, timeStep, dataStartTime, dataEndTime);
|
|
7806
|
-
};
|
|
7807
8468
|
// Local state for unfiltered selected time
|
|
7808
8469
|
var _React$useState = React.useState(selectedTime),
|
|
7809
8470
|
unfilteredSelectedTime = _React$useState[0],
|
|
@@ -7811,7 +8472,7 @@ var TimeSliderConnect = function TimeSliderConnect(_ref) {
|
|
|
7811
8472
|
// Reference to the last time value set by this timeslider
|
|
7812
8473
|
var lastTimeValueAsSetByThisTimeSlider = React.useRef();
|
|
7813
8474
|
// Set new time in the redux state
|
|
7814
|
-
var _onSetNewDate = function
|
|
8475
|
+
var _onSetNewDate = React.useCallback(function (newDate) {
|
|
7815
8476
|
// Remember that this timeslider has set this time
|
|
7816
8477
|
lastTimeValueAsSetByThisTimeSlider.current = newDate;
|
|
7817
8478
|
if (isAnimating) {
|
|
@@ -7824,7 +8485,7 @@ var TimeSliderConnect = function TimeSliderConnect(_ref) {
|
|
|
7824
8485
|
origin: 'TimeSliderConnect',
|
|
7825
8486
|
value: handleDateUtilsISOString(newDate)
|
|
7826
8487
|
}));
|
|
7827
|
-
};
|
|
8488
|
+
}, [dispatch, isAnimating, mapId, sourceId]);
|
|
7828
8489
|
// Update local state when time is updated outside of this component, e.g. during animation or syncgroups
|
|
7829
8490
|
React.useEffect(function () {
|
|
7830
8491
|
var selectedTimeAsIsoString = timeToIso(selectedTime);
|
|
@@ -7833,13 +8494,16 @@ var TimeSliderConnect = function TimeSliderConnect(_ref) {
|
|
|
7833
8494
|
}
|
|
7834
8495
|
}, [selectedTime]);
|
|
7835
8496
|
// Function used by timeslider components to update the unfiltered selected time
|
|
7836
|
-
var setUnfilteredSelectedTime = function
|
|
8497
|
+
var setUnfilteredSelectedTime = React.useCallback(function (unfilteredSelectedTimeFromComponents) {
|
|
8498
|
+
var makeFilteredSelectedTime = function makeFilteredSelectedTime(timeValue) {
|
|
8499
|
+
return getFilteredTime(timeValue, timeStep, dataStartTime, dataEndTime);
|
|
8500
|
+
};
|
|
7837
8501
|
setUnfilteredSelectedTimeViaState(unfilteredSelectedTimeFromComponents);
|
|
7838
8502
|
var filteredIsoTime = makeFilteredSelectedTime(unfilteredSelectedTimeFromComponents);
|
|
7839
8503
|
if (selectedTime !== filteredIsoTime) {
|
|
7840
8504
|
onsetNewDateDebounced(timeToIso(filteredIsoTime), _onSetNewDate);
|
|
7841
8505
|
}
|
|
7842
|
-
};
|
|
8506
|
+
}, [dataEndTime, dataStartTime, _onSetNewDate, selectedTime, timeStep]);
|
|
7843
8507
|
// Move animation bar when user changes time using time picker
|
|
7844
8508
|
// Animation bar however cannot be moved into a time where there is no data
|
|
7845
8509
|
var moveAnimationUsingCalendar = function moveAnimationUsingCalendar(newTime) {
|
|
@@ -7865,6 +8529,40 @@ var TimeSliderConnect = function TimeSliderConnect(_ref) {
|
|
|
7865
8529
|
setUnfilteredSelectedTime(newSelectedTime);
|
|
7866
8530
|
moveAnimationUsingCalendar(newSelectedTime);
|
|
7867
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]);
|
|
7868
8566
|
return jsx(TimeSlider, {
|
|
7869
8567
|
timeStep: timeStep,
|
|
7870
8568
|
dataStartTime: dataStartTime,
|
|
@@ -7894,7 +8592,8 @@ var TimeSliderConnect = function TimeSliderConnect(_ref) {
|
|
|
7894
8592
|
onSetTimeSliderSpan: onSetTimeSliderSpan,
|
|
7895
8593
|
unfilteredSelectedTime: unfilteredSelectedTime,
|
|
7896
8594
|
setUnfilteredSelectedTime: setUnfilteredSelectedTime,
|
|
7897
|
-
mapWindowRef: mapWindowRef
|
|
8595
|
+
mapWindowRef: mapWindowRef,
|
|
8596
|
+
adjustSelectedTimeOnWheel: adjustSelectedTimeOnWheel
|
|
7898
8597
|
}),
|
|
7899
8598
|
mapIsActive: mapIsActive,
|
|
7900
8599
|
onToggleTimeSlider: onToggleTimeSliderVisibility,
|
|
@@ -7966,7 +8665,7 @@ var TimeSliderClockConnect = function TimeSliderClockConnect(_ref) {
|
|
|
7966
8665
|
});
|
|
7967
8666
|
};
|
|
7968
8667
|
|
|
7969
|
-
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"];
|
|
7970
8669
|
var titleStyle = function titleStyle(theme) {
|
|
7971
8670
|
return {
|
|
7972
8671
|
position: 'absolute',
|
|
@@ -8001,8 +8700,8 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8001
8700
|
shouldAnimate = _ref$shouldAnimate === void 0 ? false : _ref$shouldAnimate,
|
|
8002
8701
|
_ref$shouldAutoFetch = _ref.shouldAutoFetch,
|
|
8003
8702
|
shouldAutoFetch = _ref$shouldAutoFetch === void 0 ? true : _ref$shouldAutoFetch,
|
|
8004
|
-
_ref$
|
|
8005
|
-
|
|
8703
|
+
_ref$initialBbox = _ref.initialBbox,
|
|
8704
|
+
initialBbox = _ref$initialBbox === void 0 ? defaultBbox.bbox : _ref$initialBbox,
|
|
8006
8705
|
_ref$srs = _ref.srs,
|
|
8007
8706
|
srs = _ref$srs === void 0 ? defaultBbox.srs : _ref$srs,
|
|
8008
8707
|
_ref$shouldShowZoomCo = _ref.shouldShowZoomControls,
|
|
@@ -8031,6 +8730,8 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8031
8730
|
shouldDisplayDrawControls = _ref$shouldDisplayDra === void 0 ? false : _ref$shouldDisplayDra,
|
|
8032
8731
|
_ref$displaySearchBut = _ref.displaySearchButtonInMap,
|
|
8033
8732
|
displaySearchButtonInMap = _ref$displaySearchBut === void 0 ? false : _ref$displaySearchBut,
|
|
8733
|
+
_ref$useOl = _ref.useOl,
|
|
8734
|
+
useOl = _ref$useOl === void 0 ? true : _ref$useOl,
|
|
8034
8735
|
mapControls = _ref.mapControls,
|
|
8035
8736
|
children = _ref.children,
|
|
8036
8737
|
shouldDisablePrefetching = _ref.shouldDisablePrefetching,
|
|
@@ -8059,7 +8760,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8059
8760
|
var mapPreset = Object.assign({
|
|
8060
8761
|
layers: updatedLayers,
|
|
8061
8762
|
proj: {
|
|
8062
|
-
bbox:
|
|
8763
|
+
bbox: initialBbox,
|
|
8063
8764
|
srs: srs
|
|
8064
8765
|
},
|
|
8065
8766
|
dimensions: dimensions,
|
|
@@ -8150,7 +8851,17 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8150
8851
|
sourceId: id,
|
|
8151
8852
|
mapWindowRef: mapWindowRef
|
|
8152
8853
|
})
|
|
8153
|
-
}), 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, {
|
|
8154
8865
|
controls: mapControlConfig,
|
|
8155
8866
|
displayTimeInMap: displayTimeInMap,
|
|
8156
8867
|
showScaleBar: false,
|
|
@@ -8163,7 +8874,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8163
8874
|
mapId: mapId
|
|
8164
8875
|
})]
|
|
8165
8876
|
});
|
|
8166
|
-
}, [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]);
|
|
8167
8878
|
};
|
|
8168
8879
|
|
|
8169
8880
|
var mapBoxStyle = function mapBoxStyle(theme) {
|
|
@@ -8259,7 +8970,7 @@ var MultiMapViewConnect = function MultiMapViewConnect(_ref) {
|
|
|
8259
8970
|
layers: map.layers || [],
|
|
8260
8971
|
autoTimeStepLayerId: map.autoTimeStepLayerId,
|
|
8261
8972
|
autoUpdateLayerId: map.autoUpdateLayerId,
|
|
8262
|
-
|
|
8973
|
+
initialBbox: map.bbox,
|
|
8263
8974
|
srs: map.srs,
|
|
8264
8975
|
dimensions: map.dimensions || [],
|
|
8265
8976
|
displayTimeInMap: map.displayTimeInMap || false,
|
|
@@ -8491,17 +9202,20 @@ var componentsLookUp = function componentsLookUp(_ref) {
|
|
|
8491
9202
|
switch (componentType) {
|
|
8492
9203
|
case 'Map':
|
|
8493
9204
|
{
|
|
9205
|
+
var _mapPreset$proj;
|
|
8494
9206
|
var mapPreset = initialProps.mapPreset,
|
|
8495
9207
|
mapControls = initialProps.mapControls,
|
|
8496
9208
|
shouldDisplayDrawControls = initialProps.shouldDisplayDrawControls,
|
|
8497
9209
|
displaySearchButtonInMap = initialProps.displaySearchButtonInMap;
|
|
8498
9210
|
return jsx(ConfigurableMapConnect, Object.assign({}, mapPreset, {
|
|
9211
|
+
initialBbox: mapPreset == null || (_mapPreset$proj = mapPreset.proj) == null ? void 0 : _mapPreset$proj.bbox,
|
|
8499
9212
|
id: id,
|
|
8500
9213
|
"data-testid": "coreConfigurableMapConnect",
|
|
8501
9214
|
displayGetFeatureInfoButtonInMap: true,
|
|
8502
9215
|
shouldDisplayDrawControls: shouldDisplayDrawControls,
|
|
8503
9216
|
displaySearchButtonInMap: displaySearchButtonInMap,
|
|
8504
|
-
mapControls: mapControls
|
|
9217
|
+
mapControls: mapControls,
|
|
9218
|
+
useOl: isOpenLayersEnabled()
|
|
8505
9219
|
}));
|
|
8506
9220
|
}
|
|
8507
9221
|
case 'MultiMap':
|
|
@@ -8692,7 +9406,7 @@ var SyncGroupViewer = function SyncGroupViewer(_ref) {
|
|
|
8692
9406
|
React.useEffect(function () {
|
|
8693
9407
|
var handleKeyDown = function handleKeyDown(event) {
|
|
8694
9408
|
var target = event.target;
|
|
8695
|
-
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')) {
|
|
8696
9410
|
toggleTimeScroll({
|
|
8697
9411
|
isTimeScrollingEnabled: !isTimeScrollingEnabled
|
|
8698
9412
|
});
|
|
@@ -9286,4 +10000,4 @@ var LanguageSelect = function LanguageSelect(_ref) {
|
|
|
9286
10000
|
});
|
|
9287
10001
|
};
|
|
9288
10002
|
|
|
9289
|
-
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 };
|
|
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 };
|