@opengeoweb/core 10.2.1-spike-ol.3 → 11.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 +69 -707
- package/package.json +26 -35
- package/src/lib/components/ComponentsLookUp/componentsLookUp.d.ts +3 -1
- package/src/lib/components/ConfigurableMapConnect/ConfigurableMapConnect.d.ts +1 -2
- package/src/lib/components/FeatureInfo/utils.d.ts +1 -4
- package/src/lib/components/MapViewConnect/MapViewConnect.d.ts +2 -4
- package/src/lib/components/MapViewConnect/index.d.ts +0 -1
- package/src/lib/components/SyncGroups/SyncGroupViewer.d.ts +1 -1
- package/src/lib/store/index.d.ts +1 -0
- package/src/lib/store/store.d.ts +13 -0
- package/src/lib/utils/location-api/fakeApi.d.ts +1 -1
- package/src/lib/utils/testUtils.d.ts +1 -4
- package/src/lib/components/MapDrawToolRedux/OpenLayersFeatureLayerConnect.d.ts +0 -13
- package/src/lib/components/MapViewConnect/OlMapViewConnect.d.ts +0 -16
- package/src/lib/components/MapViewConnect/OlMapViewLayerConnect.d.ts +0 -8
- package/src/lib/components/MapViewConnect/olMapUtils.d.ts +0 -5
- package/src/lib/components/MapViewConnect/olMapUtils.spec.d.ts +0 -1
- package/src/lib/components/MapViewConnect/useGetOpenlayersView.d.ts +0 -9
package/index.esm.js
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { useState, useCallback, useEffect,
|
|
3
|
+
import React__default, { useState, useCallback, useEffect, 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,
|
|
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';
|
|
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,
|
|
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';
|
|
15
15
|
import _, { isArray, isEqual, debounce, range } from 'lodash';
|
|
16
|
-
import { webmapUtils, queryWMSServiceInfo, queryWMSLayers, queryWMSLayersTree, invalidateWMSGetCapabilities, LayerType, getWMSServiceId, generateLayerId, getWMJSMapById, getWMSGetFeatureInfoRequestURL,
|
|
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';
|
|
24
23
|
import DOMPurify from 'dompurify';
|
|
25
|
-
import { unByKey } from 'ol/Observable';
|
|
26
|
-
import { toLonLat } from 'ol/proj';
|
|
27
24
|
import { snackbarTypes, snackbarActions, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
|
|
28
25
|
import { useNavigate } from 'react-router-dom';
|
|
29
26
|
import * as Sentry from '@sentry/react';
|
|
@@ -188,7 +185,7 @@ var no = {
|
|
|
188
185
|
"add-layer-popup-available-services": "Tilgjengelige tjenester",
|
|
189
186
|
"add-layer-popup-available-layers": "Tilgjengelige tjenester for {{serviceName}}",
|
|
190
187
|
"add-layer-popup-reload-layers": "Oppdater lag fra tjeneste",
|
|
191
|
-
"layermanager-title": "
|
|
188
|
+
"layermanager-title": "Kartlag",
|
|
192
189
|
"layermanager-baselayers-title": "Basislag",
|
|
193
190
|
"layermanager-baselayers-no-available": "Ingen tjenester tilgjengelig",
|
|
194
191
|
"layermanager-acceptance-time": "Aksep.tid",
|
|
@@ -197,7 +194,7 @@ var no = {
|
|
|
197
194
|
"layermanager-dimension-title": "Dimensjon",
|
|
198
195
|
"layermanager-opacity-title": "Gj.sikt",
|
|
199
196
|
"layermanager-opacity-tooltip-prefix": "Gjennomsiktighet: ",
|
|
200
|
-
"layermanager-style-title": "
|
|
197
|
+
"layermanager-style-title": "Stil",
|
|
201
198
|
"layermanager-layer-error": "Dette laget kunne ikke bli lastet inn, det eksisterer ikke på serveren",
|
|
202
199
|
"layermanager-layer": "Lag",
|
|
203
200
|
"layermanager-layer-toggle": "Vis/skjul",
|
|
@@ -5750,29 +5747,32 @@ var getLocationDetail = function getLocationDetail(id, source) {
|
|
|
5750
5747
|
return fetch(locationBaseUrl + "/locationdetail?id=" + id + "&source=" + source).then(handleResponse);
|
|
5751
5748
|
};
|
|
5752
5749
|
|
|
5753
|
-
/* *
|
|
5754
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5755
|
-
* you may not use this file except in compliance with the License.
|
|
5756
|
-
* You may obtain a copy of the License at
|
|
5757
|
-
*
|
|
5758
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5759
|
-
*
|
|
5760
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
5761
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5762
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5763
|
-
* See the License for the specific language governing permissions and
|
|
5764
|
-
* limitations under the License.
|
|
5765
|
-
*
|
|
5766
|
-
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5767
|
-
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
5768
|
-
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
5769
|
-
* */
|
|
5770
5750
|
var useLocationList = function useLocationList(search) {
|
|
5771
5751
|
return useQuery({
|
|
5772
5752
|
queryKey: ['location-list', search],
|
|
5773
|
-
queryFn: function
|
|
5774
|
-
|
|
5775
|
-
|
|
5753
|
+
queryFn: function () {
|
|
5754
|
+
var _queryFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
5755
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5756
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5757
|
+
case 0:
|
|
5758
|
+
if (!(search.length > 0)) {
|
|
5759
|
+
_context.next = 2;
|
|
5760
|
+
break;
|
|
5761
|
+
}
|
|
5762
|
+
return _context.abrupt("return", getLocationList(search));
|
|
5763
|
+
case 2:
|
|
5764
|
+
return _context.abrupt("return", []);
|
|
5765
|
+
case 3:
|
|
5766
|
+
case "end":
|
|
5767
|
+
return _context.stop();
|
|
5768
|
+
}
|
|
5769
|
+
}, _callee);
|
|
5770
|
+
}));
|
|
5771
|
+
function queryFn() {
|
|
5772
|
+
return _queryFn.apply(this, arguments);
|
|
5773
|
+
}
|
|
5774
|
+
return queryFn;
|
|
5775
|
+
}()
|
|
5776
5776
|
});
|
|
5777
5777
|
};
|
|
5778
5778
|
var useLocationDetail = function useLocationDetail(id, source) {
|
|
@@ -5820,11 +5820,11 @@ var SearchDialog = function SearchDialog(_ref) {
|
|
|
5820
5820
|
locationDetail = _useLocationDetail.data,
|
|
5821
5821
|
isFetchingDetail = _useLocationDetail.isFetching;
|
|
5822
5822
|
useEffect(function () {
|
|
5823
|
-
if (isFetchingDetail) {
|
|
5823
|
+
if (isFetchingDetail || !isOpen) {
|
|
5824
5824
|
return;
|
|
5825
5825
|
}
|
|
5826
5826
|
onSelectLocation(selectedValue ? locationDetail : undefined);
|
|
5827
|
-
}, [locationDetail, onSelectLocation, selectedValue, isFetchingDetail]);
|
|
5827
|
+
}, [locationDetail, onSelectLocation, selectedValue, isFetchingDetail, isOpen]);
|
|
5828
5828
|
return isOpen && mapId ? jsxs(Box, {
|
|
5829
5829
|
sx: {
|
|
5830
5830
|
display: 'flex',
|
|
@@ -5873,6 +5873,9 @@ var SearchDialog = function SearchDialog(_ref) {
|
|
|
5873
5873
|
getOptionLabel: function getOptionLabel(option) {
|
|
5874
5874
|
return option.name;
|
|
5875
5875
|
},
|
|
5876
|
+
getOptionKey: function getOptionKey(option) {
|
|
5877
|
+
return option.id + option.name;
|
|
5878
|
+
},
|
|
5876
5879
|
filterOptions: function filterOptions(x) {
|
|
5877
5880
|
return x;
|
|
5878
5881
|
},
|
|
@@ -5984,7 +5987,7 @@ var geometryStyling = {
|
|
|
5984
5987
|
'stroke-opacity': 1,
|
|
5985
5988
|
'stroke-width': 4
|
|
5986
5989
|
};
|
|
5987
|
-
var makeGeoJSONFeatureFromLocation = function makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId
|
|
5990
|
+
var makeGeoJSONFeatureFromLocation = function makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId) {
|
|
5988
5991
|
var _location$geometry;
|
|
5989
5992
|
var collection = {
|
|
5990
5993
|
type: 'FeatureCollection',
|
|
@@ -6001,8 +6004,7 @@ var makeGeoJSONFeatureFromLocation = function makeGeoJSONFeatureFromLocation(loc
|
|
|
6001
6004
|
properties: {
|
|
6002
6005
|
name: location.name,
|
|
6003
6006
|
drawFunctionId: drawFunctionId,
|
|
6004
|
-
hoverDrawFunctionId: hoverDrawFunctionId
|
|
6005
|
-
mapFeatureClass: mapFeatureClass
|
|
6007
|
+
hoverDrawFunctionId: hoverDrawFunctionId
|
|
6006
6008
|
},
|
|
6007
6009
|
geometry: {
|
|
6008
6010
|
type: 'Point',
|
|
@@ -6068,20 +6070,14 @@ var hoverDrawFunction = function hoverDrawFunction(args) {
|
|
|
6068
6070
|
};
|
|
6069
6071
|
var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
|
|
6070
6072
|
var dispatch = useDispatch();
|
|
6071
|
-
var
|
|
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;
|
|
6073
|
+
var layerId = React__default.useRef(generateLayerId()).current;
|
|
6078
6074
|
var isMapPresent = useSelector(function (store) {
|
|
6079
6075
|
return mapSelectors.getIsMapPresent(store, mapId);
|
|
6080
6076
|
});
|
|
6081
6077
|
var isLayerPresent = useSelector(function (store) {
|
|
6082
|
-
return layerSelectors.getIsLayerPresent(store,
|
|
6078
|
+
return layerSelectors.getIsLayerPresent(store, layerId);
|
|
6083
6079
|
});
|
|
6084
|
-
var shouldAddLayer = isMapPresent && !isLayerPresent
|
|
6080
|
+
var shouldAddLayer = isMapPresent && !isLayerPresent;
|
|
6085
6081
|
React__default.useEffect(function () {
|
|
6086
6082
|
if (shouldAddLayer) {
|
|
6087
6083
|
dispatch(layerActions.addLayer({
|
|
@@ -6098,8 +6094,7 @@ var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
|
|
|
6098
6094
|
var drawFunctionId = React__default.useRef(registerDrawFunction(drawFunction)).current;
|
|
6099
6095
|
var hoverDrawFunctionId = React__default.useRef(registerDrawFunction(hoverDrawFunction)).current;
|
|
6100
6096
|
var updateGeoJSON = React__default.useCallback(function (location) {
|
|
6101
|
-
var
|
|
6102
|
-
var geojson = location ? makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId, mapFeatureClass) : emptyGeoJSON;
|
|
6097
|
+
var geojson = location ? makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId) : emptyGeoJSON;
|
|
6103
6098
|
dispatch(layerActions.updateFeature({
|
|
6104
6099
|
layerId: layerId,
|
|
6105
6100
|
geojson: geojson
|
|
@@ -6109,10 +6104,8 @@ var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
|
|
|
6109
6104
|
var webMap = getWMJSMapById(mapId);
|
|
6110
6105
|
if (webMap) {
|
|
6111
6106
|
webMap.calculateBoundingBoxAndZoom(location.lat, location.lon);
|
|
6112
|
-
} else if (map) {
|
|
6113
|
-
setMapCenter(map, location.lon, location.lat);
|
|
6114
6107
|
}
|
|
6115
|
-
}, [mapId
|
|
6108
|
+
}, [mapId]);
|
|
6116
6109
|
var onUpdateLocation = React__default.useCallback(function (location) {
|
|
6117
6110
|
updateGeoJSON(location);
|
|
6118
6111
|
if (location) {
|
|
@@ -6302,50 +6295,30 @@ var getTitle = function getTitle(layerId) {
|
|
|
6302
6295
|
var wmjsLayer = webmapUtils.getWMLayerById(layerId);
|
|
6303
6296
|
return wmjsLayer ? wmjsLayer.title || wmjsLayer.name : layerId;
|
|
6304
6297
|
};
|
|
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
|
-
};
|
|
6331
6298
|
/**
|
|
6332
6299
|
* Make a list of GFI Layers to display.
|
|
6333
6300
|
* @param layers
|
|
6334
6301
|
* @param mapId
|
|
6335
6302
|
* @returns
|
|
6336
6303
|
*/
|
|
6337
|
-
var getLayersToUpdate = function getLayersToUpdate(
|
|
6304
|
+
var getLayersToUpdate = function getLayersToUpdate(layers, mapId) {
|
|
6338
6305
|
var wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
6339
|
-
if (!layers || layers.length === 0
|
|
6306
|
+
if (!wmjsMap || !layers || layers.length === 0) {
|
|
6340
6307
|
return [];
|
|
6341
6308
|
}
|
|
6342
6309
|
return layers.filter(function (layer) {
|
|
6343
6310
|
return layer && layer.enabled && !!webmapUtils.getWMLayerById(layer.id);
|
|
6344
6311
|
}).map(function (layer) {
|
|
6345
|
-
|
|
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();
|
|
6346
6319
|
return {
|
|
6347
6320
|
layerId: layer.id,
|
|
6348
|
-
url:
|
|
6321
|
+
url: getWMSGetFeatureInfoRequestURL(wmjsLayer, wmjsMap.getMapPin().getXY().x, wmjsMap.getMapPin().getXY().y, 'text/html'),
|
|
6349
6322
|
title: getTitle(layer.id)
|
|
6350
6323
|
};
|
|
6351
6324
|
});
|
|
@@ -6413,7 +6386,7 @@ var GetFeatureInfoDialog = function GetFeatureInfoDialog(_ref) {
|
|
|
6413
6386
|
triggerRerender("" + layerId + isLoading);
|
|
6414
6387
|
};
|
|
6415
6388
|
/* Build a layerlist array with a set of arguments per layer to do the query for */
|
|
6416
|
-
var layerToUpdateList = isOpen
|
|
6389
|
+
var layerToUpdateList = isOpen ? getLayersToUpdate(layers, mapId) : [];
|
|
6417
6390
|
/*
|
|
6418
6391
|
Build a string based on the GFI urls. If this changes for whatever reason we need to update.
|
|
6419
6392
|
These strings can change very often, therefore they need to be debounced and only use the most recent result must be used.
|
|
@@ -6656,7 +6629,7 @@ var GetFeatureInfoButtonConnect = function GetFeatureInfoButtonConnect(_ref) {
|
|
|
6656
6629
|
});
|
|
6657
6630
|
};
|
|
6658
6631
|
|
|
6659
|
-
var _excluded$1 = ["mapId", "children", "controls"
|
|
6632
|
+
var _excluded$1 = ["mapId", "children", "controls"];
|
|
6660
6633
|
var ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION = 'ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION';
|
|
6661
6634
|
/**
|
|
6662
6635
|
* Connected component used to display the map and selected layers.
|
|
@@ -6678,9 +6651,8 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
6678
6651
|
controls = _ref$controls === void 0 ? {
|
|
6679
6652
|
mapControlsPositionTop: 0,
|
|
6680
6653
|
zoomControls: true
|
|
6681
|
-
} : _ref$controls
|
|
6682
|
-
_ref
|
|
6683
|
-
var props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
6654
|
+
} : _ref$controls,
|
|
6655
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
6684
6656
|
var mapRef = React.useRef(null);
|
|
6685
6657
|
var store = useStore();
|
|
6686
6658
|
var mapDimensions = useSelector(function (store) {
|
|
@@ -6952,7 +6924,7 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
6952
6924
|
onLayerError: function onLayerError(_, error) {
|
|
6953
6925
|
layerError({
|
|
6954
6926
|
layerId: layer.id,
|
|
6955
|
-
error:
|
|
6927
|
+
error: (error == null ? void 0 : error.message) || 'unknown error'
|
|
6956
6928
|
});
|
|
6957
6929
|
}
|
|
6958
6930
|
}, layer), layer.id);
|
|
@@ -6962,7 +6934,7 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
6962
6934
|
onLayerError: function onLayerError(_, error) {
|
|
6963
6935
|
layerError({
|
|
6964
6936
|
layerId: layer.id,
|
|
6965
|
-
error:
|
|
6937
|
+
error: (error == null ? void 0 : error.message) || 'unknown error'
|
|
6966
6938
|
});
|
|
6967
6939
|
}
|
|
6968
6940
|
}, layer), layer.id);
|
|
@@ -7006,7 +6978,7 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
7006
6978
|
onLayerError: function onLayerError(_, error) {
|
|
7007
6979
|
layerError({
|
|
7008
6980
|
layerId: layer.id,
|
|
7009
|
-
error:
|
|
6981
|
+
error: (error == null ? void 0 : error.message) || 'unknown error'
|
|
7010
6982
|
});
|
|
7011
6983
|
},
|
|
7012
6984
|
onClickFeature: function onClickFeature(event) {
|
|
@@ -7045,7 +7017,7 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
7045
7017
|
onLayerError: function onLayerError(_, error) {
|
|
7046
7018
|
layerError({
|
|
7047
7019
|
layerId: layer.id,
|
|
7048
|
-
error:
|
|
7020
|
+
error: (error == null ? void 0 : error.message) || 'unknown error'
|
|
7049
7021
|
});
|
|
7050
7022
|
}
|
|
7051
7023
|
}, layer), layer.id);
|
|
@@ -7088,601 +7060,6 @@ var MapViewConnect = function MapViewConnect(_ref) {
|
|
|
7088
7060
|
});
|
|
7089
7061
|
};
|
|
7090
7062
|
|
|
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
|
-
|
|
7686
7063
|
/* *
|
|
7687
7064
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7688
7065
|
* you may not use this file except in compliance with the License.
|
|
@@ -8665,7 +8042,7 @@ var TimeSliderClockConnect = function TimeSliderClockConnect(_ref) {
|
|
|
8665
8042
|
});
|
|
8666
8043
|
};
|
|
8667
8044
|
|
|
8668
|
-
var _excluded = ["id", "dockedLayerManagerSize", "title", "layers", "dimensions", "shouldAutoUpdate", "shouldAnimate", "shouldAutoFetch", "
|
|
8045
|
+
var _excluded = ["id", "dockedLayerManagerSize", "title", "layers", "dimensions", "shouldAutoUpdate", "shouldAnimate", "shouldAutoFetch", "bbox", "srs", "shouldShowZoomControls", "displayMapPin", "showTimeSlider", "disableTimeSlider", "displayTimeInMap", "displayLayerManagerAndLegendButtonInMap", "displayDimensionSelectButtonInMap", "multiLegend", "shouldShowLayerManager", "shouldShowDockedLayerManager", "showClock", "displayGetFeatureInfoButtonInMap", "shouldDisplayDrawControls", "displaySearchButtonInMap", "mapControls", "children", "shouldDisablePrefetching", "tileServerSettings"];
|
|
8669
8046
|
var titleStyle = function titleStyle(theme) {
|
|
8670
8047
|
return {
|
|
8671
8048
|
position: 'absolute',
|
|
@@ -8700,8 +8077,8 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8700
8077
|
shouldAnimate = _ref$shouldAnimate === void 0 ? false : _ref$shouldAnimate,
|
|
8701
8078
|
_ref$shouldAutoFetch = _ref.shouldAutoFetch,
|
|
8702
8079
|
shouldAutoFetch = _ref$shouldAutoFetch === void 0 ? true : _ref$shouldAutoFetch,
|
|
8703
|
-
_ref$
|
|
8704
|
-
|
|
8080
|
+
_ref$bbox = _ref.bbox,
|
|
8081
|
+
bbox = _ref$bbox === void 0 ? defaultBbox.bbox : _ref$bbox,
|
|
8705
8082
|
_ref$srs = _ref.srs,
|
|
8706
8083
|
srs = _ref$srs === void 0 ? defaultBbox.srs : _ref$srs,
|
|
8707
8084
|
_ref$shouldShowZoomCo = _ref.shouldShowZoomControls,
|
|
@@ -8730,8 +8107,6 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8730
8107
|
shouldDisplayDrawControls = _ref$shouldDisplayDra === void 0 ? false : _ref$shouldDisplayDra,
|
|
8731
8108
|
_ref$displaySearchBut = _ref.displaySearchButtonInMap,
|
|
8732
8109
|
displaySearchButtonInMap = _ref$displaySearchBut === void 0 ? false : _ref$displaySearchBut,
|
|
8733
|
-
_ref$useOl = _ref.useOl,
|
|
8734
|
-
useOl = _ref$useOl === void 0 ? true : _ref$useOl,
|
|
8735
8110
|
mapControls = _ref.mapControls,
|
|
8736
8111
|
children = _ref.children,
|
|
8737
8112
|
shouldDisablePrefetching = _ref.shouldDisablePrefetching,
|
|
@@ -8760,7 +8135,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8760
8135
|
var mapPreset = Object.assign({
|
|
8761
8136
|
layers: updatedLayers,
|
|
8762
8137
|
proj: {
|
|
8763
|
-
bbox:
|
|
8138
|
+
bbox: bbox,
|
|
8764
8139
|
srs: srs
|
|
8765
8140
|
},
|
|
8766
8141
|
dimensions: dimensions,
|
|
@@ -8851,17 +8226,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8851
8226
|
sourceId: id,
|
|
8852
8227
|
mapWindowRef: mapWindowRef
|
|
8853
8228
|
})
|
|
8854
|
-
}),
|
|
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, {
|
|
8229
|
+
}), jsx(MapViewConnect, {
|
|
8865
8230
|
controls: mapControlConfig,
|
|
8866
8231
|
displayTimeInMap: displayTimeInMap,
|
|
8867
8232
|
showScaleBar: false,
|
|
@@ -8874,7 +8239,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
8874
8239
|
mapId: mapId
|
|
8875
8240
|
})]
|
|
8876
8241
|
});
|
|
8877
|
-
}, [mapId, title, id,
|
|
8242
|
+
}, [mapId, title, id, mapControlConfig, tileServerSettings, disableTimeSlider, displayTimeInMap, shouldAutoFetch, shouldDisablePrefetching, children, showClock]);
|
|
8878
8243
|
};
|
|
8879
8244
|
|
|
8880
8245
|
var mapBoxStyle = function mapBoxStyle(theme) {
|
|
@@ -8970,7 +8335,7 @@ var MultiMapViewConnect = function MultiMapViewConnect(_ref) {
|
|
|
8970
8335
|
layers: map.layers || [],
|
|
8971
8336
|
autoTimeStepLayerId: map.autoTimeStepLayerId,
|
|
8972
8337
|
autoUpdateLayerId: map.autoUpdateLayerId,
|
|
8973
|
-
|
|
8338
|
+
bbox: map.bbox,
|
|
8974
8339
|
srs: map.srs,
|
|
8975
8340
|
dimensions: map.dimensions || [],
|
|
8976
8341
|
displayTimeInMap: map.displayTimeInMap || false,
|
|
@@ -9202,20 +8567,17 @@ var componentsLookUp = function componentsLookUp(_ref) {
|
|
|
9202
8567
|
switch (componentType) {
|
|
9203
8568
|
case 'Map':
|
|
9204
8569
|
{
|
|
9205
|
-
var _mapPreset$proj;
|
|
9206
8570
|
var mapPreset = initialProps.mapPreset,
|
|
9207
8571
|
mapControls = initialProps.mapControls,
|
|
9208
8572
|
shouldDisplayDrawControls = initialProps.shouldDisplayDrawControls,
|
|
9209
8573
|
displaySearchButtonInMap = initialProps.displaySearchButtonInMap;
|
|
9210
8574
|
return jsx(ConfigurableMapConnect, Object.assign({}, mapPreset, {
|
|
9211
|
-
initialBbox: mapPreset == null || (_mapPreset$proj = mapPreset.proj) == null ? void 0 : _mapPreset$proj.bbox,
|
|
9212
8575
|
id: id,
|
|
9213
8576
|
"data-testid": "coreConfigurableMapConnect",
|
|
9214
8577
|
displayGetFeatureInfoButtonInMap: true,
|
|
9215
8578
|
shouldDisplayDrawControls: shouldDisplayDrawControls,
|
|
9216
8579
|
displaySearchButtonInMap: displaySearchButtonInMap,
|
|
9217
|
-
mapControls: mapControls
|
|
9218
|
-
useOl: isOpenLayersEnabled()
|
|
8580
|
+
mapControls: mapControls
|
|
9219
8581
|
}));
|
|
9220
8582
|
}
|
|
9221
8583
|
case 'MultiMap':
|
|
@@ -9406,7 +8768,7 @@ var SyncGroupViewer = function SyncGroupViewer(_ref) {
|
|
|
9406
8768
|
React.useEffect(function () {
|
|
9407
8769
|
var handleKeyDown = function handleKeyDown(event) {
|
|
9408
8770
|
var target = event.target;
|
|
9409
|
-
if (target.tagName !== 'INPUT' && target.tagName !== 'TEXTAREA' &&
|
|
8771
|
+
if (target.tagName !== 'INPUT' && target.tagName !== 'TEXTAREA' && event.key === 's') {
|
|
9410
8772
|
toggleTimeScroll({
|
|
9411
8773
|
isTimeScrollingEnabled: !isTimeScrollingEnabled
|
|
9412
8774
|
});
|
|
@@ -10000,4 +9362,4 @@ var LanguageSelect = function LanguageSelect(_ref) {
|
|
|
10000
9362
|
});
|
|
10001
9363
|
};
|
|
10002
9364
|
|
|
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,
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "GeoWeb Core library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,45 +8,36 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@
|
|
12
|
-
"
|
|
13
|
-
"@
|
|
14
|
-
"@
|
|
15
|
-
"@mui/x-date-pickers": "7.26.0",
|
|
11
|
+
"@opengeoweb/shared": "*",
|
|
12
|
+
"react-redux": "^8.1.3",
|
|
13
|
+
"@opengeoweb/store": "*",
|
|
14
|
+
"@opengeoweb/timeslider": "*",
|
|
16
15
|
"@reduxjs/toolkit": "^1.9.7",
|
|
17
|
-
"@
|
|
18
|
-
"@
|
|
19
|
-
"@
|
|
20
|
-
"@storybook/react": "8.4.2",
|
|
21
|
-
"@tanstack/query-core": "5.62.7",
|
|
22
|
-
"@tanstack/react-query": "^5.62.7",
|
|
23
|
-
"@testing-library/react": "16.0.1",
|
|
24
|
-
"@testing-library/user-event": "14.5.2",
|
|
25
|
-
"@turf/turf": "7.2.0",
|
|
16
|
+
"@opengeoweb/webmap-react": "*",
|
|
17
|
+
"@opengeoweb/webmap": "*",
|
|
18
|
+
"@opengeoweb/theme": "*",
|
|
26
19
|
"axios": "^1.7.7",
|
|
27
|
-
"
|
|
28
|
-
"dompurify": "^3.0.6",
|
|
29
|
-
"i18next": "^23.11.5",
|
|
30
|
-
"immer": "10.1.1",
|
|
31
|
-
"jest-canvas-mock": "2.5.2",
|
|
32
|
-
"jest-date-mock": "1.0.10",
|
|
20
|
+
"@opengeoweb/layer-select": "*",
|
|
33
21
|
"lodash": "^4.17.21",
|
|
34
|
-
"msw": "^1.3.3",
|
|
35
|
-
"msw-storybook-addon": "1.10.0",
|
|
36
|
-
"ol": "^10.4.0",
|
|
37
|
-
"proj4": "2.15.0",
|
|
38
|
-
"re-resizable": "6.10.3",
|
|
39
|
-
"react": "18.3.1",
|
|
40
|
-
"react-draggable": "^4.4.6",
|
|
41
|
-
"react-hook-form": "7.50.1",
|
|
42
|
-
"react-i18next": "^15.1.1",
|
|
43
|
-
"react-redux": "^8.1.3",
|
|
44
|
-
"react-resize-detector": "9.1.1",
|
|
45
|
-
"react-router-dom": "^6.21.0",
|
|
46
22
|
"react-sortablejs": "^6.1.4",
|
|
47
|
-
"react-window": "1.8.10",
|
|
48
23
|
"sortablejs": "^1.15.1",
|
|
49
|
-
"
|
|
24
|
+
"@mui/system": "^6.1.1",
|
|
25
|
+
"@opengeoweb/snackbar": "*",
|
|
26
|
+
"react-router-dom": "^6.21.0",
|
|
27
|
+
"react-draggable": "^4.4.6",
|
|
28
|
+
"i18next": "^23.11.5",
|
|
29
|
+
"react-i18next": "^15.1.1",
|
|
30
|
+
"dompurify": "^3.0.6",
|
|
31
|
+
"@mui/material": "^6.1.1",
|
|
32
|
+
"@sentry/react": "^8.34.0",
|
|
33
|
+
"@opengeoweb/authentication": "*",
|
|
34
|
+
"@tanstack/react-query": "^5.62.7",
|
|
35
|
+
"@opengeoweb/api": "*"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": "18",
|
|
39
|
+
"@emotion/react": "*",
|
|
40
|
+
"@emotion/styled": "*"
|
|
50
41
|
},
|
|
51
42
|
"module": "./index.esm.js",
|
|
52
43
|
"type": "module",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { mapTypes } from '@opengeoweb/store';
|
|
3
|
-
import { PlotPreset, TimeSeriesService } from '@opengeoweb/shared';
|
|
3
|
+
import { PlotPreset, TimeSeriesPresetLocation, TimeSeriesService } from '@opengeoweb/shared';
|
|
4
4
|
import { InitialHarmTempAndPrecipProps } from '../MultiMapViewConnect/HarmoniePresets';
|
|
5
5
|
import { ModelRunIntervalProps } from '../MultiMapViewConnect/ModelRunInterval';
|
|
6
6
|
interface InitialMultiMapProps {
|
|
@@ -24,6 +24,8 @@ export interface InitialMapProps {
|
|
|
24
24
|
export interface InitialTimeSeriesProps {
|
|
25
25
|
plotPreset: PlotPreset;
|
|
26
26
|
services: TimeSeriesService[];
|
|
27
|
+
predefinedLocations?: TimeSeriesPresetLocation[];
|
|
28
|
+
hideLocationMarkers?: boolean;
|
|
27
29
|
}
|
|
28
30
|
export type InitialProps = InitialMapProps | InitialMultiMapProps | InitialHarmTempAndPrecipProps | ModelRunIntervalProps | mapTypes.MapPresetInitialProps | InitialSliderProps | InitialTimeSeriesProps | Record<string, unknown>;
|
|
29
31
|
/**
|
|
@@ -21,7 +21,7 @@ export interface ConfigurableMapConnectProps {
|
|
|
21
21
|
tileServerSettings?: TileServerSettings;
|
|
22
22
|
autoUpdateLayerId?: string;
|
|
23
23
|
autoTimeStepLayerId?: string;
|
|
24
|
-
|
|
24
|
+
bbox?: mapTypes.Bbox;
|
|
25
25
|
srs?: string;
|
|
26
26
|
dimensions?: mapTypes.Dimension[];
|
|
27
27
|
animationPayload?: mapTypes.AnimationPayloadType;
|
|
@@ -43,6 +43,5 @@ export interface ConfigurableMapConnectProps {
|
|
|
43
43
|
children?: React.ReactNode;
|
|
44
44
|
mapControls?: React.ReactNode;
|
|
45
45
|
shouldDisablePrefetching?: boolean;
|
|
46
|
-
useOl?: boolean;
|
|
47
46
|
}
|
|
48
47
|
export declare const ConfigurableMapConnect: React.FC<ConfigurableMapConnectProps>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { layerTypes } from '@opengeoweb/store';
|
|
2
|
-
import { IWMJSMap } from '@opengeoweb/webmap';
|
|
3
|
-
import { MapLocation } from '@opengeoweb/webmap-react';
|
|
4
2
|
export interface GFIResult {
|
|
5
3
|
data: string;
|
|
6
4
|
isLoading: boolean;
|
|
@@ -10,11 +8,10 @@ export interface GFILayer {
|
|
|
10
8
|
url: string;
|
|
11
9
|
title: string;
|
|
12
10
|
}
|
|
13
|
-
export declare const getFeatureInfoUrl: (layer: layerTypes.Layer, wmjsMap: IWMJSMap | undefined, mapPinLocation: MapLocation | null) => string | undefined;
|
|
14
11
|
/**
|
|
15
12
|
* Make a list of GFI Layers to display.
|
|
16
13
|
* @param layers
|
|
17
14
|
* @param mapId
|
|
18
15
|
* @returns
|
|
19
16
|
*/
|
|
20
|
-
export declare const getLayersToUpdate: (
|
|
17
|
+
export declare const getLayersToUpdate: (layers: layerTypes.Layer[], mapId: string) => GFILayer[];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Bbox } from '@opengeoweb/webmap';
|
|
3
2
|
import { MapViewProps } from '@opengeoweb/webmap-react';
|
|
4
|
-
export interface
|
|
3
|
+
export interface MapControls {
|
|
5
4
|
mapControlsPositionTop?: number;
|
|
6
5
|
search?: boolean;
|
|
7
6
|
zoomControls?: boolean;
|
|
@@ -14,12 +13,11 @@ export interface MapControlsProps {
|
|
|
14
13
|
export interface MapViewConnectProps extends MapViewProps {
|
|
15
14
|
mapId: string;
|
|
16
15
|
displayTimeInMap?: boolean;
|
|
17
|
-
controls?:
|
|
16
|
+
controls?: MapControls;
|
|
18
17
|
showScaleBar?: boolean;
|
|
19
18
|
children?: React.ReactNode;
|
|
20
19
|
showLayerInfo?: boolean;
|
|
21
20
|
passiveMap?: boolean;
|
|
22
|
-
initialBbox?: Bbox;
|
|
23
21
|
}
|
|
24
22
|
export declare const ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION = "ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION";
|
|
25
23
|
export declare const ORIGIN_REACTMAPVIEWCONNECT_ONUPDATELAYERINFO = "ORIGIN_REACTMAPVIEWCONNECT_ONUPDATELAYERINFO";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './store';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SnackbarModuleStore } from '@opengeoweb/snackbar';
|
|
2
|
+
import { WebMapStateModuleState, SynchronizationGroupModuleState, UIModuleState } from '@opengeoweb/store';
|
|
3
|
+
import { ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
|
|
4
|
+
export declare const coreReducerMap: {
|
|
5
|
+
webmap: import("redux").Reducer<import("dist/libs/store/src/store/map/types").WebMapState, import("redux").AnyAction>;
|
|
6
|
+
services: import("redux").Reducer<import("dist/libs/store/src/store/map/types").ServiceState, import("redux").AnyAction>;
|
|
7
|
+
layers: import("redux").Reducer<import("dist/libs/store/src/store/map/types").LayerState, import("redux").AnyAction>;
|
|
8
|
+
syncGroups: import("redux").Reducer<import("dist/libs/store/src/store/generic/syncGroups/types").SynchronizationGroupState, import("redux").AnyAction>;
|
|
9
|
+
ui: import("redux").Reducer<import("dist/libs/store/src/store/ui/types").UIStoreType, import("redux").AnyAction>;
|
|
10
|
+
snackbar: import("redux").Reducer<import("dist/libs/snackbar/src/lib/store/types").SnackbarState, import("redux").AnyAction>;
|
|
11
|
+
};
|
|
12
|
+
export declare const coreMiddlewares: import("@reduxjs/toolkit").ListenerMiddleware<import("@opengeoweb/store").CoreAppStore, import("@reduxjs/toolkit").ThunkDispatch<import("@opengeoweb/store").CoreAppStore, unknown, import("redux").AnyAction>, unknown>[];
|
|
13
|
+
export declare const createMockStore: (mockState?: WebMapStateModuleState | SynchronizationGroupModuleState | UIModuleState | SnackbarModuleStore) => ToolkitStore;
|
|
@@ -67,4 +67,4 @@ export declare const fakeLocationDetailList: ({
|
|
|
67
67
|
properties: {};
|
|
68
68
|
};
|
|
69
69
|
})[];
|
|
70
|
-
export declare const locationApiEndpoints: import("msw").
|
|
70
|
+
export declare const locationApiEndpoints: import("msw").HttpHandler[];
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { WebMapStateModuleState, syncGroupsTypes, uiTypes } from '@opengeoweb/store';
|
|
3
|
-
import { Store } from '@reduxjs/toolkit';
|
|
1
|
+
import { WebMapStateModuleState } from '@opengeoweb/store';
|
|
4
2
|
export declare const mockStateMapWithDimensions: (layer: import("dist/libs/store/src/store/map/types").Layer, mapId: string) => WebMapStateModuleState;
|
|
5
3
|
export declare const mockStateMapWithDimensionsWithoutLayers: (mapId: string) => WebMapStateModuleState;
|
|
6
|
-
export declare const createMockStore: (mockState?: WebMapStateModuleState & snackbarTypes.SnackbarModuleStore & syncGroupsTypes.SynchronizationGroupModuleState & uiTypes.UIModuleState) => Store;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { layerTypes } from '@opengeoweb/store';
|
|
3
|
-
import { StyleLike } from 'ol/style/Style';
|
|
4
|
-
import { HoverSelect } from '@opengeoweb/webmap-react';
|
|
5
|
-
interface OpenLayersFeatureLayerConnectProps {
|
|
6
|
-
layer: layerTypes.FeatureLayer;
|
|
7
|
-
layerId?: string;
|
|
8
|
-
zIndex: number;
|
|
9
|
-
style: StyleLike;
|
|
10
|
-
hoverSelect?: HoverSelect;
|
|
11
|
-
}
|
|
12
|
-
export declare const OpenLayersFeatureLayerConnect: React.FC<OpenLayersFeatureLayerConnectProps>;
|
|
13
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { MapViewConnectProps } from './MapViewConnect';
|
|
3
|
-
/**
|
|
4
|
-
* Connected component used to display the map and selected layers.
|
|
5
|
-
* Includes options to disable the map controls and legend.
|
|
6
|
-
*
|
|
7
|
-
* Expects the following props:
|
|
8
|
-
* @param {string} mapId mapId: string - Id of the map
|
|
9
|
-
* @param {object} [controls.zoomControls] **optional** controls: object - toggle the map controls, zoomControls defaults to true
|
|
10
|
-
* @param {boolean} [displayTimeInMap] **optional** displayTimeInMap: boolean, toggles the mapTime, defaults to true
|
|
11
|
-
* @param {boolean} [showScaleBar] **optional** showScaleBar: boolean, toggles the scaleBar, defaults to true
|
|
12
|
-
* @example
|
|
13
|
-
* ```<MapViewConnect mapId={mapId} controls={{ zoomControls: false }} displayTimeInMap={false} showScaleBar={false}/>```
|
|
14
|
-
*/
|
|
15
|
-
declare const OlMapViewConnect: React.FC<MapViewConnectProps>;
|
|
16
|
-
export default OlMapViewConnect;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface OlMapViewLayerConnectProps {
|
|
3
|
-
layerId: string | undefined;
|
|
4
|
-
mapId: string;
|
|
5
|
-
zIndex: number;
|
|
6
|
-
debugMode: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare const OlMapViewLayerConnect: (layerProps: OlMapViewLayerConnectProps) => React.ReactElement | null;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { TimeSliderStartCenterEndTime } from '@opengeoweb/store';
|
|
2
|
-
import { Dimension } from '@opengeoweb/webmap';
|
|
3
|
-
import { OnInitializeLayerProps, TimeContextType, UpdateLayerInfoPayload } from '@opengeoweb/webmap-react';
|
|
4
|
-
export declare const makePrefetchTimeSpan: (timeSliderStartCenterEndTime: TimeSliderStartCenterEndTime, animationStartTime: string | undefined, animationEndTime: string | undefined, isAnimating: boolean) => TimeContextType;
|
|
5
|
-
export declare const makeLayerInfoPayload: (payload: OnInitializeLayerProps, mapDimensions: Dimension[], mapId: string) => UpdateLayerInfoPayload;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CoreAppStore } from '@opengeoweb/store';
|
|
2
|
-
import { Store } from '@reduxjs/toolkit';
|
|
3
|
-
import { View } from 'ol';
|
|
4
|
-
interface UseGetOpenLayersViewValue {
|
|
5
|
-
view?: View;
|
|
6
|
-
name?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const useGetOpenlayersView: (mapId: string, store: Store<CoreAppStore>) => UseGetOpenLayersViewValue;
|
|
9
|
-
export {};
|