@opengeoweb/core 9.37.0 → 10.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 CHANGED
@@ -1,20 +1,20 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { useState, useCallback, useRef } from 'react';
3
+ import React__default, { useState, useCallback, useRef, 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, circularProgressClasses, 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
- 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, ExitDomain, Info, Search, Exclamation, MyLocation, Close, ThemeWrapper, lightTheme, FlagBritain, FlagNetherlands, FlagFinland, FlagNorway } from '@opengeoweb/theme';
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, TimeSlider, onsetNewDateDebounced, getFilteredTime, ControlButtons, OptionsMenu, TimeSliderClock } from '@opengeoweb/timeslider';
10
- import { WEBMAP_REACT_NAMESPACE, webmapReactTranslations, WEBMAP_NAMESPACE, webmapTranslations, LayerInfoButton, LayerInfoDialog, MapControlButton, MapDimensionSelect, dimensionConfig, DimensionSelectDialog, DimensionSelectButton, ZoomControls, MapView, MapViewLayer, LegendDialog, LegendButton, registerDrawFunction, emptyGeoJSON, MapControls, publicLayers } from '@opengeoweb/webmap-react';
10
+ import { WEBMAP_REACT_NAMESPACE, webmapReactTranslations, WEBMAP_NAMESPACE, webmapTranslations, LayerInfoButton, LayerInfoDialog, MapControlButton, MapDimensionSelect, dimensionConfig, DimensionSelectDialog, DimensionSelectButton, registerDrawFunction, ZoomControls, LegendDialog, LegendButton, MapView, MapViewLayer, MapControls, emptyGeoJSON, 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, drawtoolSelectors, syncConstants, loadingIndicatorActions, syncGroupsSelectors, defaultLayers, mapStoreActions, getSingularDrawtoolDrawLayerId, syncGroupsSelector, syncGroupsActions, routerUtils } from '@opengeoweb/store';
15
- import { webmapUtils, WMGetServiceFromStore, getCapabilities, LayerType, handleDateUtilsISOString, wmServiceListener, EVENT_GETCAPABILITIES_START, EVENT_GETCAPABILITIES_READY, getWMSGetFeatureInfoRequestURL, WMLayer } from '@opengeoweb/webmap';
14
+ import { layerTypes, layerUtils, mapSelectors, layerActions, layerSelectors, serviceSelectors, serviceActions, mapActions, mapEnums, uiSelectors, uiTypes, useSetupDialog, filterLayers, getUserAddedServices, uiActions, genericSelectors, genericActions, drawtoolSelectors, syncConstants, loadingIndicatorActions, syncGroupsSelectors, 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, getWMSGetFeatureInfoRequestURL, handleDateUtilsISOString, wmServiceListener, EVENT_GETCAPABILITIES_START, EVENT_GETCAPABILITIES_READY, WMLayer } from '@opengeoweb/webmap';
16
17
  import { Box as Box$1, styled as styled$1 } from '@mui/system';
17
- import _, { isEqual, debounce, range } from 'lodash';
18
18
  import { LayerSelectButtonConnect, LayerSelectConnect } from '@opengeoweb/layer-select';
19
19
  import axios from 'axios';
20
20
  import DOMPurify from 'dompurify';
@@ -103,19 +103,19 @@ var fi = {
103
103
  "add-layer-popup-available-services": "Käytettävissä olevat palvelut",
104
104
  "add-layer-popup-available-layers": "Palvelusta {{serviceName}} saatavilla olevat karttatasot",
105
105
  "add-layer-popup-reload-layers": "Lataa palvelun karttatasot uudelleen",
106
- "layermanager-title": "Layer Manager",
106
+ "layermanager-title": "Karttatasot",
107
107
  "layermanager-baselayers-title": "Pohjakartta",
108
108
  "layermanager-baselayers-no-available": "Palvelu ei käytettävissä",
109
109
  "layermanager-acceptance-time": "Hyväksymisaika",
110
110
  "layermanager-dimensions-total-values": "Dimension arvon ({{total_dimensions}} valinnat)",
111
111
  "layermanager-dimensions-title": "Dimensiot",
112
112
  "layermanager-dimension-title": "Dimensiot",
113
- "layermanager-opacity-title": "Läpinäkyvyys",
114
- "layermanager-opacity-tooltip-prefix": "Läpinäkyvyys: ",
113
+ "layermanager-opacity-title": "Peittävyys",
114
+ "layermanager-opacity-tooltip-prefix": "Peittävyys: ",
115
115
  "layermanager-style-title": "Tyyli",
116
116
  "layermanager-layer-error": "Karttatason lataaminen epäonnistui: tasoa ei löytynyt palvelimelta",
117
117
  "layermanager-layer": "Karttataso",
118
- "layermanager-layer-toggle": "Vaihda läpinäkyvyyden tilaa",
118
+ "layermanager-layer-toggle": "Karttatason näkyvyys",
119
119
  "layermanager-layer-select": "Avaa karttataso valitsin",
120
120
  "layermanager-layer-drag": "Raahaa",
121
121
  "layermanager-layer-leading": "Johtava karttataso",
@@ -900,9 +900,7 @@ var layerManagerStyle = {
900
900
  // opacity
901
901
  '.column-4': Object.assign({
902
902
  width: "calc(" + flexibleAreaWidth + " * 0.15)"
903
- }, columnCollapseStyle, {
904
- flexGrow: 0
905
- }),
903
+ }, columnCollapseStyle),
906
904
  // dimensions
907
905
  '.column-5': Object.assign({
908
906
  width: "calc(" + flexibleAreaWidth + " * 0.35)"
@@ -1070,30 +1068,39 @@ var RowItemCollapse$1 = function RowItemCollapse(_ref) {
1070
1068
  var _useCoreTranslation = useCoreTranslation(),
1071
1069
  t = _useCoreTranslation.t;
1072
1070
  var hoverId = columnClasses.columnHeader + "-" + className;
1073
- return jsx(CustomTooltip, {
1074
- title: collapsedColumns != null && collapsedColumns[className] ? t('column-expand', {
1075
- title: title
1076
- }) : t('column-collapse'),
1077
- children: jsx(Grid2, {
1078
- id: hoverId,
1079
- className: columnClasses.columnHeader + " " + className,
1080
- style: Object.assign({}, (collapsedColumns == null ? void 0 : collapsedColumns[className]) && {
1081
- width: '24px',
1082
- flexGrow: 0
1083
- }),
1084
- onClick: function onClick() {
1085
- onToggleCollapsed(className);
1086
- },
1087
- children: collapsedColumns != null && collapsedColumns[className] ? jsx(ColumnCollapsed, {}) : jsxs(Fragment, {
1088
- children: [jsx(Box, {
1089
- sx: styles$3.text,
1090
- children: title
1091
- }), jsx(ColumnCollapse, {
1092
- className: "column-hover-icon"
1093
- })]
1071
+ return jsx(Box, {
1072
+ id: hoverId,
1073
+ style: Object.assign({}, (collapsedColumns == null ? void 0 : collapsedColumns[className]) && {
1074
+ width: '24px',
1075
+ flexGrow: 0
1076
+ }),
1077
+ className: columnClasses.columnHeader + " " + className,
1078
+ children: jsx(CustomTooltip, {
1079
+ title: collapsedColumns != null && collapsedColumns[className] ? t('column-expand', {
1080
+ title: title
1081
+ }) : t('column-collapse'),
1082
+ children: jsx(Grid2, {
1083
+ className: columnClasses.columnHeader + " " + className,
1084
+ style: Object.assign({}, (collapsedColumns == null ? void 0 : collapsedColumns[className]) && {
1085
+ width: '24px',
1086
+ flexGrow: 0
1087
+ }),
1088
+ onClick: function onClick() {
1089
+ var _document$getElementB;
1090
+ onToggleCollapsed(className);
1091
+ (_document$getElementB = document.getElementById(hoverId)) == null || _document$getElementB.dispatchEvent(new Event('mouseleave'));
1092
+ },
1093
+ children: collapsedColumns != null && collapsedColumns[className] ? jsx(ColumnCollapsed, {}) : jsxs(Fragment, {
1094
+ children: [jsx(Box, {
1095
+ sx: styles$3.text,
1096
+ children: title
1097
+ }), jsx(ColumnCollapse, {
1098
+ className: "column-hover-icon"
1099
+ })]
1100
+ })
1094
1101
  })
1095
- })
1096
- }, collapsedColumns != null && collapsedColumns[className] ? 'Expand' : 'Collapse');
1102
+ }, collapsedColumns != null && collapsedColumns[className] ? 'Expand' : 'Collapse')
1103
+ });
1097
1104
  };
1098
1105
  var styles$3 = {
1099
1106
  text: function text(theme) {
@@ -1653,7 +1660,7 @@ var OpacitySelect = function OpacitySelect(_ref) {
1653
1660
  marks: marks,
1654
1661
  onChange: function onChange(event, newValue) {
1655
1662
  event.stopPropagation();
1656
- onLayerChangeOpacity(newValue);
1663
+ onLayerChangeOpacity(isArray(newValue) ? newValue[0] : newValue);
1657
1664
  },
1658
1665
  onKeyDown: onKeyDownSlider,
1659
1666
  onBlur: function onBlur(event) {
@@ -2834,10 +2841,13 @@ var RenderLayersConnect = function RenderLayersConnect(_ref) {
2834
2841
  case 0:
2835
2842
  _context.prev = 0;
2836
2843
  _context.next = 3;
2837
- return getCapabilities.getLayersFlattenedFromService(serviceUrl);
2844
+ return queryWMSLayers(serviceUrl);
2838
2845
  case 3:
2839
2846
  _layers = _context.sent;
2840
- wmService = WMGetServiceFromStore(serviceUrl);
2847
+ _context.next = 6;
2848
+ return queryWMSServiceInfo(serviceUrl);
2849
+ case 6:
2850
+ wmService = _context.sent;
2841
2851
  serviceSetLayers({
2842
2852
  id: wmService.id,
2843
2853
  name: wmService.title,
@@ -2846,17 +2856,17 @@ var RenderLayersConnect = function RenderLayersConnect(_ref) {
2846
2856
  scope: 'user',
2847
2857
  "abstract": wmService["abstract"]
2848
2858
  });
2849
- _context.next = 11;
2859
+ _context.next = 13;
2850
2860
  break;
2851
- case 8:
2852
- _context.prev = 8;
2861
+ case 10:
2862
+ _context.prev = 10;
2853
2863
  _context.t0 = _context["catch"](0);
2854
- console.warn(_context.t0.message);
2855
- case 11:
2864
+ console.warn(_context.t0 instanceof Error ? _context.t0.message : 'addService failed');
2865
+ case 13:
2856
2866
  case "end":
2857
2867
  return _context.stop();
2858
2868
  }
2859
- }, _callee, null, [[0, 8]]);
2869
+ }, _callee, null, [[0, 10]]);
2860
2870
  }));
2861
2871
  return function addService(_x) {
2862
2872
  return _ref2.apply(this, arguments);
@@ -3652,7 +3662,7 @@ var BaseLayers = function BaseLayers(_ref) {
3652
3662
  // If already in selectedBaseLayers based on name or id, keep current id
3653
3663
  var constructLayerId = function constructLayerId(baseLayer, selectedBaseLayers) {
3654
3664
  var foundLayer = selectedBaseLayers.find(function (selectedBaseLayer) {
3655
- return baseLayer.id === selectedBaseLayer.id || baseLayer.name === selectedBaseLayer.name;
3665
+ return (baseLayer == null ? void 0 : baseLayer.id) === (selectedBaseLayer == null ? void 0 : selectedBaseLayer.id) || baseLayer.name === selectedBaseLayer.name;
3656
3666
  });
3657
3667
  return foundLayer ? foundLayer.id : webmapUtils.generateLayerId();
3658
3668
  };
@@ -3669,7 +3679,7 @@ var constructListAvailableBaseLayers = function constructListAvailableBaseLayers
3669
3679
  // Ensure that current selected baselayer(s) are in the baseLayersWithMapId array, otherwise add them
3670
3680
  return selectedBaseLayers.reduce(function (list, selectedBaseLayer) {
3671
3681
  var foundLayer = baseLayersWithMapId.find(function (layer) {
3672
- return layer.id === selectedBaseLayer.id;
3682
+ return layer.id === (selectedBaseLayer == null ? void 0 : selectedBaseLayer.id);
3673
3683
  });
3674
3684
  if (foundLayer) {
3675
3685
  return list;
@@ -3839,17 +3849,40 @@ var WMSLayerTree = function WMSLayerTree(_ref) {
3839
3849
  React.useEffect(function () {
3840
3850
  var isMounted = true;
3841
3851
  setIsLoading(true);
3842
- getCapabilities.getLayersFromService(service.url, forceReload).then(function (layerTreeFromPromise) {
3843
- if (isMounted) {
3844
- setLayerTree(layerTreeFromPromise);
3845
- setIsLoading(false);
3846
- }
3847
- })["catch"](function (error) {
3848
- if (isMounted) {
3849
- setLayerTree(error.toString());
3850
- setIsLoading(false);
3851
- }
3852
- });
3852
+ var makeServiceQuery = /*#__PURE__*/function () {
3853
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3854
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3855
+ while (1) switch (_context.prev = _context.next) {
3856
+ case 0:
3857
+ if (!forceReload) {
3858
+ _context.next = 3;
3859
+ break;
3860
+ }
3861
+ _context.next = 3;
3862
+ return invalidateWMSGetCapabilities(service.url);
3863
+ case 3:
3864
+ queryWMSLayersTree(service.url).then(function (layerTreeFromPromise) {
3865
+ if (isMounted) {
3866
+ setLayerTree(layerTreeFromPromise);
3867
+ setIsLoading(false);
3868
+ }
3869
+ })["catch"](function (error) {
3870
+ if (isMounted) {
3871
+ setLayerTree(error.toString());
3872
+ setIsLoading(false);
3873
+ }
3874
+ });
3875
+ case 4:
3876
+ case "end":
3877
+ return _context.stop();
3878
+ }
3879
+ }, _callee);
3880
+ }));
3881
+ return function makeServiceQuery() {
3882
+ return _ref2.apply(this, arguments);
3883
+ };
3884
+ }();
3885
+ void makeServiceQuery();
3853
3886
  return function () {
3854
3887
  isMounted = false;
3855
3888
  setForceReload(false);
@@ -4295,7 +4328,7 @@ var AddLayersPopup = function AddLayersPopup(_ref) {
4295
4328
  // Check if valid URL was passed
4296
4329
  } else if (validateServiceUrl(serviceURL)) {
4297
4330
  // Check if service is WMS server
4298
- getCapabilities.getLayersFromService(serviceURL).then(function (layerTreeFromPromise) {
4331
+ queryWMSLayersTree(serviceURL).then(function (layerTreeFromPromise) {
4299
4332
  // Shorten URL as a naming backup
4300
4333
  var shortenedURL = serviceURL.substring(serviceURL.indexOf('//') + 2, serviceURL.indexOf('?'));
4301
4334
  handleAddToList(layerTreeFromPromise.title || layerTreeFromPromise.name || shortenedURL);
@@ -4674,9 +4707,9 @@ var ProjectionSelect = function ProjectionSelect(_ref) {
4674
4707
  value: currentProjection,
4675
4708
  list: availableProjections,
4676
4709
  currentIndex: index,
4677
- onChange: function onChange(e) {
4678
- e.stopPropagation();
4679
- selectProjection(e.target.value);
4710
+ onChange: function onChange(event) {
4711
+ event.stopPropagation();
4712
+ selectProjection(event.target.value);
4680
4713
  },
4681
4714
  onChangeMouseWheel: function onChangeMouseWheel(e) {
4682
4715
  return selectProjection(e.value);
@@ -4895,36 +4928,45 @@ var LayerManager = function LayerManager(_ref) {
4895
4928
  });
4896
4929
  };
4897
4930
 
4898
- /* *
4899
- * Licensed under the Apache License, Version 2.0 (the "License");
4900
- * you may not use this file except in compliance with the License.
4901
- * You may obtain a copy of the License at
4902
- *
4903
- * http://www.apache.org/licenses/LICENSE-2.0
4904
- *
4905
- * Unless required by applicable law or agreed to in writing, software
4906
- * distributed under the License is distributed on an "AS IS" BASIS,
4907
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4908
- * See the License for the specific language governing permissions and
4909
- * limitations under the License.
4910
- *
4911
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4912
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
4913
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4914
- * */
4915
- var getServicesToLoad = function getServicesToLoad(services) {
4916
- return services.map(function (service) {
4917
- var wmService = WMGetServiceFromStore(service.url);
4918
- var scope = service.scope ? service.scope : 'system';
4919
- return {
4920
- id: wmService.id,
4921
- name: service.name,
4922
- url: service.url,
4923
- scope: scope,
4924
- "abstract": service["abstract"] || wmService["abstract"]
4925
- };
4926
- });
4927
- };
4931
+ var getServicesToLoad = /*#__PURE__*/function () {
4932
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(services) {
4933
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
4934
+ while (1) switch (_context2.prev = _context2.next) {
4935
+ case 0:
4936
+ return _context2.abrupt("return", Promise.all(services.map( /*#__PURE__*/function () {
4937
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(service) {
4938
+ var scope;
4939
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
4940
+ while (1) switch (_context.prev = _context.next) {
4941
+ case 0:
4942
+ scope = service.scope ? service.scope : 'system';
4943
+ return _context.abrupt("return", {
4944
+ id: getWMSServiceId(service.url),
4945
+ name: service.name,
4946
+ url: service.url,
4947
+ scope: scope,
4948
+ "abstract": service["abstract"]
4949
+ });
4950
+ case 2:
4951
+ case "end":
4952
+ return _context.stop();
4953
+ }
4954
+ }, _callee);
4955
+ }));
4956
+ return function (_x2) {
4957
+ return _ref2.apply(this, arguments);
4958
+ };
4959
+ }())));
4960
+ case 1:
4961
+ case "end":
4962
+ return _context2.stop();
4963
+ }
4964
+ }, _callee2);
4965
+ }));
4966
+ return function getServicesToLoad(_x) {
4967
+ return _ref.apply(this, arguments);
4968
+ };
4969
+ }();
4928
4970
  var useFetchServices = function useFetchServices(dialogType, preloadedServices, shouldDisableFetch) {
4929
4971
  if (preloadedServices === void 0) {
4930
4972
  preloadedServices = preloadedDefaultMapServices;
@@ -4947,7 +4989,7 @@ var useFetchServices = function useFetchServices(dialogType, preloadedServices,
4947
4989
  React.useEffect(function () {
4948
4990
  if (!shouldDisableFetch && isOpenInStore && preloadedServices && preloadedServices.length > 0 && !services.length) {
4949
4991
  var allServicesToLoad = mergePresetsAndUserAddedServices(preloadedServices, getUserAddedServices());
4950
- fetchInitialServices(getServicesToLoad(allServicesToLoad));
4992
+ void getServicesToLoad(allServicesToLoad).then(fetchInitialServices);
4951
4993
  }
4952
4994
  // eslint-disable-next-line react-hooks/exhaustive-deps
4953
4995
  }, [isOpenInStore, services]);
@@ -5309,38 +5351,6 @@ var MultiMapMultiDimensionSelectConnect = function MultiMapMultiDimensionSelectC
5309
5351
  });
5310
5352
  };
5311
5353
 
5312
- var ZoomControlConnect = function ZoomControlConnect(_ref) {
5313
- var mapId = _ref.mapId;
5314
- var isVisible = useSelector(function (store) {
5315
- return mapSelectors.isZoomControlsVisible(store, mapId);
5316
- });
5317
- var adagucRef = React.useRef(null);
5318
- React.useEffect(function () {
5319
- var webmapjs = webmapUtils.getWMJSMapById(mapId);
5320
- if (!webmapjs) {
5321
- return;
5322
- }
5323
- adagucRef.current = webmapjs;
5324
- }, [mapId]);
5325
- var onZoomIn = function onZoomIn() {
5326
- return adagucRef.current.zoomIn(undefined);
5327
- };
5328
- var onZoomOut = function onZoomOut() {
5329
- return adagucRef.current.zoomOut();
5330
- };
5331
- var onZoomReset = function onZoomReset() {
5332
- return adagucRef.current.zoomToLayer(adagucRef.current.getActiveLayer());
5333
- };
5334
- if (!isVisible) {
5335
- return null;
5336
- }
5337
- return jsx(ZoomControls, {
5338
- onZoomIn: onZoomIn,
5339
- onZoomOut: onZoomOut,
5340
- onZoomReset: onZoomReset
5341
- });
5342
- };
5343
-
5344
5354
  /* *
5345
5355
  * Licensed under the Apache License, Version 2.0 (the "License");
5346
5356
  * you may not use this file except in compliance with the License.
@@ -5586,393 +5596,297 @@ var useKeyboardZoomAndPan = function useKeyboardZoomAndPan(mapIsActive, mapId, m
5586
5596
  };
5587
5597
  var PAN_STEP_PERCENTAGE = 0.02;
5588
5598
 
5589
- var _excluded$2 = ["mapId", "children"];
5590
- var ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION = 'ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION';
5591
- /**
5592
- * Connected component used to display the map and selected layers.
5593
- * Includes options to disable the map controls and legend.
5594
- *
5595
- * Expects the following props:
5596
- * @param {string} mapId mapId: string - Id of the map
5597
- * @param {object} [controls.zoomControls] **optional** controls: object - toggle the map controls, zoomControls defaults to true
5598
- * @param {boolean} [displayTimeInMap] **optional** displayTimeInMap: boolean, toggles the mapTime, defaults to true
5599
- * @param {boolean} [showScaleBar] **optional** showScaleBar: boolean, toggles the scaleBar, defaults to true
5600
- * @example
5601
- * ```<MapViewConnect mapId={mapId} controls={{ zoomControls: false }} displayTimeInMap={false} showScaleBar={false}/>```
5602
- */
5603
- var MapViewConnect = function MapViewConnect(_ref) {
5599
+ var SearchControlButtonConnect = function SearchControlButtonConnect(_ref) {
5604
5600
  var mapId = _ref.mapId,
5605
- children = _ref.children,
5606
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
5607
- var mapRef = React.useRef(null);
5608
- var store = useStore();
5609
- var mapDimensions = useSelector(function (store) {
5610
- return mapSelectors.getMapDimensions(store, mapId);
5611
- });
5612
- var layers = useSelector(function (store) {
5613
- return mapSelectors.getMapLayers(store, mapId);
5614
- });
5615
- var baseLayers = useSelector(function (store) {
5616
- return mapSelectors.getMapBaseLayers(store, mapId);
5617
- });
5618
- var overLayers = useSelector(function (store) {
5619
- return mapSelectors.getMapOverLayers(store, mapId);
5620
- });
5621
- var featureLayers = useSelector(function (store) {
5622
- return mapSelectors.getMapFeatureLayers(store, mapId);
5623
- });
5624
- var linkedFeatures = useSelector(function (store) {
5625
- var _store$syncronization;
5626
- return genericSelectors.selectLinkedFeatures((_store$syncronization = store.syncronizationGroupStore) == null ? void 0 : _store$syncronization.linkedState, mapId);
5627
- });
5628
- var bbox = useSelector(function (store) {
5629
- return mapSelectors.getBbox(store, mapId);
5630
- });
5631
- var srs = useSelector(function (store) {
5632
- return mapSelectors.getSrs(store, mapId);
5633
- });
5634
- var activeLayerId = useSelector(function (store) {
5635
- return mapSelectors.getActiveLayerId(store, mapId);
5636
- });
5637
- var animationDelay = useSelector(function (store) {
5638
- return mapSelectors.getMapAnimationDelay(store, mapId);
5639
- });
5640
- var mapPinLocation = useSelector(function (store) {
5641
- return mapSelectors.getPinLocation(store, mapId);
5642
- });
5643
- var linkedPanelId = useSelector(function (store) {
5644
- return genericSelectors.selectLinkedPanelId(store, mapId);
5645
- });
5646
- var selectedFeatureCoordinates = useSelector(function (store) {
5647
- return genericSelectors.getSelectedFeature(store.syncronizationGroupStore, linkedPanelId);
5648
- });
5649
- var disableMapPin = useSelector(function (store) {
5650
- return mapSelectors.getDisableMapPin(store, mapId);
5601
+ _ref$source = _ref.source,
5602
+ source = _ref$source === void 0 ? 'app' : _ref$source;
5603
+ var _useCoreTranslation = useCoreTranslation(),
5604
+ t = _useCoreTranslation.t;
5605
+ var dispatch = useDispatch();
5606
+ var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
5607
+ var currentActiveMapId = useSelector(function (store) {
5608
+ return uiSelectors.getDialogMapId(store, dialogType);
5651
5609
  });
5652
- var displayMapPin = useSelector(function (store) {
5653
- return mapSelectors.getDisplayMapPin(store, mapId);
5610
+ var isOpenInStore = useSelector(function (store) {
5611
+ return uiSelectors.getisDialogOpen(store, dialogType);
5654
5612
  });
5655
- var timestep = useSelector(function (store) {
5656
- return mapSelectors.getMapTimeStep(store, mapId);
5613
+ var openSearchDialog = React__default.useCallback(function () {
5614
+ dispatch(uiActions.setActiveMapIdForDialog({
5615
+ type: dialogType,
5616
+ mapId: mapId,
5617
+ setOpen: currentActiveMapId !== mapId ? true : !isOpenInStore,
5618
+ source: source
5619
+ }));
5620
+ }, [currentActiveMapId, dialogType, dispatch, isOpenInStore, mapId, source]);
5621
+ return jsx(MapControlButton, {
5622
+ onClick: openSearchDialog,
5623
+ title: t('search-title'),
5624
+ "aria-label": t('search-title-aria'),
5625
+ isActive: isOpenInStore,
5626
+ children: jsx(Search, {})
5657
5627
  });
5628
+ };
5629
+
5630
+ var MY_LOCATION = 'MyLocation';
5631
+ var locationOptions = {
5632
+ enableHighAccuracy: false,
5633
+ timeout: 5000,
5634
+ maximumAge: 0
5635
+ };
5636
+ var circleDrawFunction = function circleDrawFunction(args, fillColor, radius) {
5637
+ if (fillColor === void 0) {
5638
+ fillColor = '#88F';
5639
+ }
5640
+ if (radius === void 0) {
5641
+ radius = 12;
5642
+ }
5643
+ var ctx = args.context,
5644
+ coord = args.coord;
5645
+ ctx.strokeStyle = '#000';
5646
+ ctx.fillStyle = fillColor || '#88F';
5647
+ ctx.lineWidth = 1;
5648
+ ctx.beginPath();
5649
+ ctx.arc(coord.x, coord.y, radius || 10, 0, 2 * Math.PI);
5650
+ ctx.fill();
5651
+ ctx.stroke();
5652
+ ctx.fillStyle = '#000';
5653
+ ctx.beginPath();
5654
+ ctx.arc(coord.x, coord.y, 2, 0, 2 * Math.PI);
5655
+ ctx.fill();
5656
+ };
5657
+ var MyMapLocation = function MyMapLocation(_ref) {
5658
+ var _sx;
5659
+ var mapId = _ref.mapId,
5660
+ isLoading = _ref.isLoading,
5661
+ hasFailed = _ref.hasFailed,
5662
+ setIsLoading = _ref.setIsLoading,
5663
+ setHasFailed = _ref.setHasFailed;
5664
+ var _useCoreTranslation = useCoreTranslation(),
5665
+ t = _useCoreTranslation.t;
5658
5666
  var dispatch = useDispatch();
5659
- var mapChangeDimension = React.useCallback(function (mapDimensionPayload) {
5660
- if (mapDimensionPayload.dimension) {
5661
- var wmjsMap = webmapUtils.getWMJSMapById(mapId);
5662
- if (!wmjsMap) {
5663
- return;
5664
- }
5665
- var dimension = wmjsMap.getDimension(mapDimensionPayload.dimension.name);
5666
- if (dimension && dimension.currentValue === mapDimensionPayload.dimension.currentValue) {
5667
- return;
5667
+ var layersBelongsToCurrentMapId = useSelector(function (store) {
5668
+ return layerSelectors.getLayersByMapId(store, mapId || '');
5669
+ });
5670
+ var layerLocation = layersBelongsToCurrentMapId.find(function (layer) {
5671
+ var _layer$geojson$featur;
5672
+ if (layer.geojson && layer.geojson.features[0] && layer.geojson.features[0].properties && (_layer$geojson$featur = layer.geojson.features[0].properties) != null && _layer$geojson$featur.name) {
5673
+ if (layer.geojson.features[0].properties.name === MY_LOCATION) {
5674
+ return layer;
5668
5675
  }
5669
5676
  }
5670
- dispatch(mapActions.mapChangeDimension(mapDimensionPayload));
5671
- }, [dispatch, mapId]);
5672
- var setTime = React.useCallback(function (setTimePayload) {
5673
- var _wmjsMap$getDimension;
5674
- var wmjsMap = webmapUtils.getWMJSMapById(mapId);
5675
- /* Check if the map not already has this value set, otherwise this component will re-render */
5676
- if (wmjsMap && wmjsMap.getDimension('time') && ((_wmjsMap$getDimension = wmjsMap.getDimension('time')) == null ? void 0 : _wmjsMap$getDimension.currentValue) === setTimePayload.value) {
5677
- return;
5678
- }
5679
- dispatch(genericActions.setTime(setTimePayload));
5680
- }, [dispatch, mapId]);
5681
- var updateLayerInformation = React.useCallback(function (payload) {
5682
- dispatch(layerActions.onUpdateLayerInformation(payload));
5683
- }, [dispatch]);
5684
- var registerMap = React.useCallback(function (payload) {
5685
- dispatch(mapActions.registerMap(payload));
5686
- }, [dispatch]);
5687
- var unregisterMap = React.useCallback(function (payload) {
5688
- dispatch(mapActions.unregisterMap(payload));
5689
- }, [dispatch]);
5690
- var genericSetBbox = React.useCallback(function (payload) {
5691
- dispatch(genericActions.setBbox(payload));
5692
- }, [dispatch]);
5693
- var syncGroupAddSource = React.useCallback(function (payload) {
5694
- dispatch(genericActions.syncGroupAddSource(payload));
5695
- }, [dispatch]);
5696
- var syncGroupRemoveSource = React.useCallback(function (payload) {
5697
- dispatch(genericActions.syncGroupRemoveSource(payload));
5698
- }, [dispatch]);
5699
- var layerError = React.useCallback(function (payload) {
5700
- dispatch(layerActions.layerError(payload));
5701
- }, [dispatch]);
5702
- var mapPinChangeLocation = React.useCallback(function (payload) {
5703
- dispatch(mapActions.setMapPinLocation(payload));
5704
- }, [dispatch]);
5705
- var setSelectedFeature = React.useCallback(function (payload) {
5706
- dispatch(layerActions.setSelectedFeature(payload));
5707
- }, [dispatch]);
5708
- var handleFeatureSelect = function handleFeatureSelect(mapId, featureId) {
5709
- dispatch(genericActions.addSharedData({
5710
- panelId: mapId,
5711
- data: {
5712
- selectedFeatureId: featureId || ''
5713
- }
5714
- }));
5715
- };
5716
- var updateFeature = React.useCallback(function (_ref2) {
5717
- var geojson = _ref2.geojson,
5718
- reason = _ref2.reason,
5719
- layerId = _ref2.layerId;
5720
- var activeDrawToolId = drawtoolSelectors.getActiveDrawToolId(store.getState());
5721
- var activeDrawMode = drawtoolSelectors.getActiveDrawMode(store.getState(), activeDrawToolId);
5722
- dispatch(layerActions.updateFeature({
5723
- geojson: geojson,
5724
- reason: reason,
5725
- layerId: layerId,
5726
- shouldAllowMultipleShapes: drawtoolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId),
5727
- geoJSONIntersectionLayerId: drawtoolSelectors.getGeoJSONIntersectionLayerId(store.getState(), activeDrawToolId),
5728
- geoJSONIntersectionBoundsLayerId: drawtoolSelectors.getGeoJSONIntersectionBoundsLayerId(store.getState(), activeDrawToolId),
5729
- selectionType: activeDrawMode == null ? void 0 : activeDrawMode.selectionType
5730
- }));
5731
- }, [dispatch, store]);
5732
- var exitFeatureDrawMode = React.useCallback(function (_ref3) {
5733
- var reason = _ref3.reason,
5734
- layerId = _ref3.layerId;
5735
- var activeDrawToolId = drawtoolSelectors.getActiveDrawToolId(store.getState());
5736
- dispatch(layerActions.exitFeatureDrawMode({
5737
- reason: reason,
5738
- layerId: layerId,
5739
- shouldAllowMultipleShapes: drawtoolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId)
5740
- }));
5741
- }, [dispatch, store]);
5742
- var isActiveWindowId = useSelector(function (store) {
5743
- return uiSelectors.getIsActiveWindowId(store, mapId);
5677
+ return undefined;
5744
5678
  });
5745
- useKeyboardZoomAndPan(isActiveWindowId, mapId, mapRef.current);
5746
- useTouchZoomPan(isActiveWindowId, mapId);
5747
- var unRegister = React.useCallback(function (mapId) {
5748
- unregisterMap({
5749
- mapId: mapId
5750
- });
5751
- syncGroupRemoveSource({
5752
- id: mapId
5753
- });
5754
- }, [syncGroupRemoveSource, unregisterMap]);
5755
- React.useEffect(function () {
5756
- registerMap({
5757
- mapId: mapId
5758
- });
5759
- syncGroupAddSource({
5760
- id: mapId,
5761
- type: [syncConstants.SYNCGROUPS_TYPE_SETTIME, syncConstants.SYNCGROUPS_TYPE_SETBBOX]
5762
- });
5763
- dispatch(loadingIndicatorActions.setGetMapIsLoading({
5764
- id: mapId,
5765
- isGetMapLoading: false
5766
- }));
5767
- }, [dispatch, mapId, registerMap, syncGroupAddSource]);
5768
- var onGetMapLoadStart = React.useCallback(function () {
5769
- dispatch(loadingIndicatorActions.setGetMapIsLoading({
5770
- id: mapId,
5771
- isGetMapLoading: true
5772
- }));
5773
- }, [dispatch, mapId]);
5774
- var onGetMapLoadReady = React.useCallback(function () {
5775
- dispatch(loadingIndicatorActions.setGetMapIsLoading({
5776
- id: mapId,
5777
- isGetMapLoading: false
5778
- }));
5779
- }, [dispatch, mapId]);
5780
- var onGetCapabilitiesLoadStart = React.useCallback(function () {
5781
- dispatch(loadingIndicatorActions.setGetCapabilitiesIsLoading({
5782
- id: mapId,
5783
- isGetCapabilitiesLoading: true
5784
- }));
5785
- }, [dispatch, mapId]);
5786
- var onGetCapabilitiesLoadReady = React.useCallback(function () {
5787
- dispatch(loadingIndicatorActions.setGetCapabilitiesIsLoading({
5788
- id: mapId,
5789
- isGetCapabilitiesLoading: false
5790
- }));
5791
- }, [dispatch, mapId]);
5792
- var isTimeScrollingEnabled = useSelector(syncGroupsSelectors.isTimeScrollingEnabled);
5793
- var _useSelector = useSelector(function (state) {
5794
- return genericSelectors.selectSharedData(state, linkedPanelId);
5795
- }),
5796
- hoverId = _useSelector.hoverId;
5797
- var debouncedSetHoverFeature = React.useMemo(function () {
5798
- return debounce(function (featureId) {
5799
- return dispatch(genericActions.addSharedData({
5800
- panelId: linkedPanelId,
5801
- data: {
5802
- hoverId: featureId
5803
- }
5679
+ var layerLocationId = (layerLocation == null ? void 0 : layerLocation.id) || '';
5680
+ var circleDrawFunctionId = useRef(registerDrawFunction(circleDrawFunction));
5681
+ var handleLocationClick = function handleLocationClick() {
5682
+ setIsLoading(true);
5683
+ if (mapId && layerLocationId !== '') {
5684
+ dispatch(layerActions.layerDelete({
5685
+ mapId: mapId,
5686
+ layerId: layerLocationId
5804
5687
  }));
5805
- }, 200);
5806
- }, [dispatch, linkedPanelId]);
5807
- return jsx("div", {
5808
- style: {
5809
- height: '100%'
5810
- },
5811
- ref: mapRef,
5812
- children: jsxs(MapView, Object.assign({}, props, {
5813
- mapId: mapId,
5814
- linkedFeatures: {
5815
- type: 'FeatureCollection',
5816
- features: linkedFeatures.flatMap(function (feature) {
5817
- return feature.geoJSON.features;
5818
- })
5819
- },
5820
- isTimeScrollingEnabled: isTimeScrollingEnabled,
5821
- srs: srs,
5822
- bbox: bbox,
5823
- mapPinLocation: displayMapPin ? selectedFeatureCoordinates || mapPinLocation : undefined,
5824
- dimensions: mapDimensions,
5825
- activeLayerId: activeLayerId,
5826
- animationDelay: animationDelay,
5827
- timestep: timestep,
5828
- displayMapPin: displayMapPin,
5829
- disableMapPin: disableMapPin,
5830
- onMapChangeDimension: function onMapChangeDimension(mapDimensionPayload) {
5831
- if (mapDimensionPayload && mapDimensionPayload.dimension && mapDimensionPayload.dimension.name && mapDimensionPayload.dimension.name === 'time') {
5832
- setTime({
5833
- sourceId: mapId,
5834
- origin: mapDimensionPayload.origin + "==> " + ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION,
5835
- value: handleDateUtilsISOString(mapDimensionPayload.dimension.currentValue)
5836
- });
5837
- } else {
5838
- mapChangeDimension(mapDimensionPayload);
5839
- }
5840
- },
5841
- onUpdateLayerInformation: updateLayerInformation,
5842
- onMapPinChangeLocation: mapPinChangeLocation,
5843
- onMapZoomEnd: function onMapZoomEnd(a) {
5844
- genericSetBbox({
5845
- bbox: a.bbox,
5846
- srs: a.srs,
5847
- sourceId: mapId,
5848
- origin: mapEnums.MapActionOrigin.map,
5849
- mapId: mapId
5850
- });
5851
- },
5852
- onWMJSMount: function onWMJSMount(mapId) {
5688
+ setIsLoading(false);
5689
+ } else if (navigator.geolocation && mapId && layerLocationId === '' && circleDrawFunctionId) {
5690
+ navigator.geolocation.getCurrentPosition(function (success) {
5691
+ setIsLoading(false);
5692
+ setHasFailed(false);
5693
+ var _success$coords = success.coords,
5694
+ latitude = _success$coords.latitude,
5695
+ longitude = _success$coords.longitude;
5696
+ var geojson = {
5697
+ type: 'FeatureCollection',
5698
+ features: [{
5699
+ type: 'Feature',
5700
+ properties: {
5701
+ name: MY_LOCATION,
5702
+ drawFunctionId: circleDrawFunctionId.current
5703
+ },
5704
+ geometry: {
5705
+ type: 'Point',
5706
+ coordinates: [longitude, latitude]
5707
+ }
5708
+ }]
5709
+ };
5710
+ var layerId = webmapUtils.generateLayerId();
5711
+ dispatch(layerActions.addLayer({
5712
+ mapId: mapId,
5713
+ layer: {
5714
+ geojson: geojson,
5715
+ layerType: LayerType.featureLayer
5716
+ },
5717
+ layerId: layerId,
5718
+ origin: MY_LOCATION
5719
+ }));
5853
5720
  var wmjsMap = webmapUtils.getWMJSMapById(mapId);
5854
5721
  if (!wmjsMap) {
5855
5722
  return;
5856
5723
  }
5857
- wmjsMap.getListener().addEventListener('onloadstart', onGetMapLoadStart);
5858
- wmjsMap.getListener().addEventListener('onloadready', onGetMapLoadReady);
5859
- wmServiceListener.addEventListener(EVENT_GETCAPABILITIES_START, onGetCapabilitiesLoadStart, true);
5860
- wmServiceListener.addEventListener(EVENT_GETCAPABILITIES_READY, onGetCapabilitiesLoadReady, true);
5861
- },
5862
- onWMJSUnMount: function onWMJSUnMount(mapId) {
5863
- unRegister(mapId);
5864
- wmServiceListener.removeEventListener(EVENT_GETCAPABILITIES_START, onGetCapabilitiesLoadStart);
5865
- wmServiceListener.removeEventListener(EVENT_GETCAPABILITIES_READY, onGetCapabilitiesLoadReady);
5724
+ wmjsMap.calculateBoundingBoxAndZoom(latitude, longitude);
5725
+ }, function (error) {
5726
+ setIsLoading(false);
5727
+ setHasFailed(true);
5728
+ console.warn(t('search-error', {
5729
+ error: error.message
5730
+ }));
5731
+ }, locationOptions);
5732
+ }
5733
+ };
5734
+ var chooseIcon = function chooseIcon() {
5735
+ return hasFailed ? jsx(Exclamation, {
5736
+ style: {
5737
+ color: 'red'
5866
5738
  },
5867
- children: [baseLayers.map(function (layer) {
5868
- return jsx(MapViewLayer, Object.assign({
5869
- id: "baselayer-" + layer.id,
5870
- onLayerError: function onLayerError(_, error) {
5871
- layerError({
5872
- layerId: layer.id,
5873
- error: Error("" + error)
5874
- });
5875
- }
5876
- }, layer), layer.id);
5877
- }), layers.map(function (layer) {
5878
- return jsx(MapViewLayer, Object.assign({
5879
- id: "layer-" + layer.id,
5880
- onLayerError: function onLayerError(_, error) {
5881
- layerError({
5882
- layerId: layer.id,
5883
- error: Error("" + error)
5884
- });
5885
- }
5886
- }, layer), layer.id);
5887
- }), linkedFeatures == null ? void 0 : linkedFeatures.map(function (feature) {
5888
- return jsx(MapViewLayer, {
5889
- id: feature.id,
5890
- geojson: feature == null ? void 0 : feature.geoJSON,
5891
- onHoverFeature: function onHoverFeature(hoverInfo) {
5892
- if (hoverInfo === undefined && hoverId !== undefined) {
5893
- debouncedSetHoverFeature();
5894
- } else if (hoverInfo != null && hoverInfo.feature && feature.originalId !== hoverId) {
5895
- debouncedSetHoverFeature(feature.originalId);
5896
- }
5897
- },
5898
- onClickFeature: function onClickFeature(event) {
5899
- var _event$feature$proper;
5900
- var isClickOutsideFeature = !event || !event.feature;
5901
- if (isClickOutsideFeature) {
5902
- if (mapPinLocation) {
5903
- handleFeatureSelect(linkedPanelId, undefined);
5904
- }
5905
- return;
5906
- }
5907
- // Handle clicks on station
5908
- var clickedFeatureName = (_event$feature$proper = event.feature.properties) == null ? void 0 : _event$feature$proper.name;
5909
- var features = linkedFeatures[0].geoJSON.features;
5910
- var clickedFeatureIndex = features.findIndex(function (feature) {
5911
- var _feature$properties;
5912
- return ((_feature$properties = feature.properties) == null ? void 0 : _feature$properties.name) === clickedFeatureName;
5913
- });
5914
- if (disableMapPin === false) {
5915
- var _selectedFeature$id;
5916
- var selectedFeature = features[clickedFeatureIndex];
5917
- handleFeatureSelect(linkedPanelId, (_selectedFeature$id = selectedFeature.id) == null ? void 0 : _selectedFeature$id.toString());
5918
- }
5919
- }
5920
- }, feature.id);
5921
- }), featureLayers.map(function (layer) {
5922
- return jsx(MapViewLayer, Object.assign({
5923
- id: "featurelayer-" + layer.id,
5924
- onLayerError: function onLayerError(_, error) {
5925
- layerError({
5926
- layerId: layer.id,
5927
- error: Error("" + error)
5928
- });
5929
- },
5930
- onClickFeature: function onClickFeature(event) {
5931
- var isClickOutsideFeature = !event;
5932
- if (isClickOutsideFeature && !layer.isInEditMode) {
5933
- setSelectedFeature({
5934
- layerId: layer.id,
5935
- selectedFeatureIndex: undefined
5936
- });
5937
- return;
5938
- }
5939
- if ((event == null ? void 0 : event.isInEditMode) === false) {
5940
- setSelectedFeature({
5941
- layerId: layer.id,
5942
- selectedFeatureIndex: event.featureIndex
5943
- });
5944
- }
5739
+ "aria-label": "location error"
5740
+ }) : jsx(MyLocation, {
5741
+ "aria-label": "location default"
5742
+ });
5743
+ };
5744
+ return jsx("div", {
5745
+ children: isLoading ? jsxs(Fragment, {
5746
+ children: [jsx(CircularProgress, {
5747
+ value: 100,
5748
+ variant: "determinate",
5749
+ sx: {
5750
+ height: '100%',
5751
+ width: '100%',
5752
+ color: function color(theme) {
5753
+ return theme.palette.mode === 'light' ? '#1a90ff' : '#bad4ff';
5945
5754
  },
5946
- updateGeojson: function updateGeojson(geojson, reason) {
5947
- updateFeature({
5948
- geojson: geojson,
5949
- layerId: layer.id,
5950
- reason: reason
5951
- });
5755
+ padding: '8px'
5756
+ },
5757
+ thickness: 6,
5758
+ "aria-label": "location loading"
5759
+ }), jsx(CircularProgress, {
5760
+ variant: "indeterminate",
5761
+ disableShrink: true,
5762
+ sx: (_sx = {
5763
+ height: '100%',
5764
+ width: '100%',
5765
+ color: function color(theme) {
5766
+ return theme.palette.mode === 'light' ? '#bad4ff' : '#45556F';
5952
5767
  },
5953
- exitDrawModeCallback: function exitDrawModeCallback(reason) {
5954
- return exitFeatureDrawMode({
5955
- reason: reason,
5956
- layerId: layer.id
5957
- });
5958
- }
5959
- }, layer), layer.id);
5960
- }), overLayers.map(function (layer) {
5961
- return jsx(MapViewLayer, Object.assign({
5962
- id: "baselayer-" + layer.id,
5963
- onLayerError: function onLayerError(_, error) {
5964
- layerError({
5965
- layerId: layer.id,
5966
- error: Error("" + error)
5967
- });
5968
- }
5969
- }, layer), layer.id);
5970
- }), children]
5971
- }))
5768
+ animationDuration: '1000ms',
5769
+ position: 'absolute',
5770
+ left: 0
5771
+ }, _sx["& ." + circularProgressClasses.circle] = {
5772
+ strokeLinecap: 'round'
5773
+ }, _sx.padding = '8px', _sx),
5774
+ thickness: 6
5775
+ })]
5776
+ }) : jsx(CustomIconButton, {
5777
+ title: t('search-find-location'),
5778
+ "aria-label": MY_LOCATION,
5779
+ onClick: handleLocationClick,
5780
+ isSelected: layerLocationId !== '',
5781
+ size: "large",
5782
+ children: chooseIcon()
5783
+ })
5784
+ });
5785
+ };
5786
+
5787
+ var SearchDialog = function SearchDialog(_ref) {
5788
+ var isOpen = _ref.isOpen,
5789
+ onClose = _ref.onClose,
5790
+ _ref$mapId = _ref.mapId,
5791
+ mapId = _ref$mapId === void 0 ? '' : _ref$mapId;
5792
+ var _useCoreTranslation = useCoreTranslation(),
5793
+ t = _useCoreTranslation.t;
5794
+ var _useState = useState(false),
5795
+ isLoading = _useState[0],
5796
+ setIsLoading = _useState[1];
5797
+ var _useState2 = useState(false),
5798
+ hasFailed = _useState2[0],
5799
+ setHasFailed = _useState2[1];
5800
+ return isOpen && mapId ? jsxs(Box$1, {
5801
+ sx: {
5802
+ display: 'flex',
5803
+ flexDirection: 'row',
5804
+ alignItems: 'center',
5805
+ position: 'absolute',
5806
+ pointerEvents: 'all',
5807
+ zIndex: 999,
5808
+ left: 50,
5809
+ top: 15,
5810
+ borderBottom: '1px solid grey',
5811
+ backgroundColor: function backgroundColor(theme) {
5812
+ return theme.palette.background.paper;
5813
+ }
5814
+ },
5815
+ children: [jsx(MyMapLocation, {
5816
+ mapId: mapId,
5817
+ isLoading: isLoading,
5818
+ hasFailed: hasFailed,
5819
+ setIsLoading: setIsLoading,
5820
+ setHasFailed: setHasFailed
5821
+ }), jsx(TextField, {
5822
+ id: "dummy-search-field",
5823
+ label: t('search-title'),
5824
+ variant: "filled",
5825
+ slotProps: {
5826
+ input: {
5827
+ disableUnderline: true,
5828
+ endAdornment: jsx(InputAdornment, {
5829
+ position: "end",
5830
+ children: jsx(CustomIconButton, {
5831
+ tooltipTitle: t('actions-close'),
5832
+ edge: "end",
5833
+ onClick: onClose,
5834
+ size: "large",
5835
+ children: jsx(Close, {})
5836
+ })
5837
+ })
5838
+ }
5839
+ }
5840
+ })]
5841
+ }) : null;
5842
+ };
5843
+
5844
+ var SearchControlConnect = function SearchControlConnect(_ref) {
5845
+ var mapId = _ref.mapId;
5846
+ var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
5847
+ var _useSetupDialog = useSetupDialog(dialogType),
5848
+ isDialogOpen = _useSetupDialog.isDialogOpen,
5849
+ onCloseDialog = _useSetupDialog.onCloseDialog;
5850
+ return jsx(SearchDialog, {
5851
+ isOpen: isDialogOpen,
5852
+ onClose: onCloseDialog,
5853
+ mapId: mapId
5854
+ });
5855
+ };
5856
+
5857
+ var ZoomControlConnect = function ZoomControlConnect(_ref) {
5858
+ var mapId = _ref.mapId;
5859
+ var isVisible = useSelector(function (store) {
5860
+ return mapSelectors.isZoomControlsVisible(store, mapId);
5861
+ });
5862
+ var adagucRef = React.useRef(null);
5863
+ React.useEffect(function () {
5864
+ var webmapjs = webmapUtils.getWMJSMapById(mapId);
5865
+ if (!webmapjs) {
5866
+ return;
5867
+ }
5868
+ adagucRef.current = webmapjs;
5869
+ }, [mapId]);
5870
+ var onZoomIn = function onZoomIn() {
5871
+ return adagucRef.current.zoomIn(undefined);
5872
+ };
5873
+ var onZoomOut = function onZoomOut() {
5874
+ return adagucRef.current.zoomOut();
5875
+ };
5876
+ var onZoomReset = function onZoomReset() {
5877
+ return adagucRef.current.zoomToLayer(adagucRef.current.getActiveLayer());
5878
+ };
5879
+ if (!isVisible) {
5880
+ return null;
5881
+ }
5882
+ return jsx(ZoomControls, {
5883
+ onZoomIn: onZoomIn,
5884
+ onZoomOut: onZoomOut,
5885
+ onZoomReset: onZoomReset
5972
5886
  });
5973
5887
  };
5974
5888
 
5975
- var _excluded$1 = ["showMapId"];
5889
+ var _excluded$2 = ["showMapId"];
5976
5890
  var LegendConnectComponent = function LegendConnectComponent(_ref) {
5977
5891
  var _ref$showMapId = _ref.showMapId,
5978
5892
  showMapId = _ref$showMapId === void 0 ? false : _ref$showMapId,
@@ -6026,7 +5940,7 @@ var LegendConnectComponent = function LegendConnectComponent(_ref) {
6026
5940
  var LegendConnect = function LegendConnect(_ref2) {
6027
5941
  var _ref2$showMapId = _ref2.showMapId,
6028
5942
  showMapId = _ref2$showMapId === void 0 ? false : _ref2$showMapId,
6029
- props = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
5943
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded$2);
6030
5944
  return jsx(LegendConnectComponent, Object.assign({
6031
5945
  showMapId: showMapId
6032
5946
  }, props));
@@ -6215,7 +6129,7 @@ var GetFeatureInfoDialog = function GetFeatureInfoDialog(_ref) {
6215
6129
  case 9:
6216
6130
  _context.prev = 9;
6217
6131
  _context.t0 = _context["catch"](0);
6218
- errorMessage = _context.t0.message;
6132
+ errorMessage = _context.t0 instanceof Error ? _context.t0.message : 'fetchLayerInfo failed';
6219
6133
  updateLayerResult({
6220
6134
  layerId: layerId,
6221
6135
  data: errorMessage,
@@ -6422,261 +6336,434 @@ var GetFeatureInfoButtonConnect = function GetFeatureInfoButtonConnect(_ref) {
6422
6336
  });
6423
6337
  };
6424
6338
 
6425
- var SearchControlButtonConnect = function SearchControlButtonConnect(_ref) {
6339
+ var _excluded$1 = ["mapId", "children", "controls"];
6340
+ var ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION = 'ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION';
6341
+ /**
6342
+ * Connected component used to display the map and selected layers.
6343
+ * Includes options to disable the map controls and legend.
6344
+ *
6345
+ * Expects the following props:
6346
+ * @param {string} mapId mapId: string - Id of the map
6347
+ * @param {object} [controls.zoomControls] **optional** controls: object - toggle the map controls, zoomControls defaults to true
6348
+ * @param {boolean} [displayTimeInMap] **optional** displayTimeInMap: boolean, toggles the mapTime, defaults to true
6349
+ * @param {boolean} [showScaleBar] **optional** showScaleBar: boolean, toggles the scaleBar, defaults to true
6350
+ * @example
6351
+ * ```<MapViewConnect mapId={mapId} controls={{ zoomControls: false }} displayTimeInMap={false} showScaleBar={false}/>```
6352
+ */
6353
+ var MapViewConnect = function MapViewConnect(_ref) {
6354
+ var _linkedFeatures$conca;
6426
6355
  var mapId = _ref.mapId,
6427
- _ref$source = _ref.source,
6428
- source = _ref$source === void 0 ? 'app' : _ref$source;
6429
- var _useCoreTranslation = useCoreTranslation(),
6430
- t = _useCoreTranslation.t;
6431
- var dispatch = useDispatch();
6432
- var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
6433
- var currentActiveMapId = useSelector(function (store) {
6434
- return uiSelectors.getDialogMapId(store, dialogType);
6356
+ children = _ref.children,
6357
+ _ref$controls = _ref.controls,
6358
+ controls = _ref$controls === void 0 ? {
6359
+ mapControlsPositionTop: 0,
6360
+ zoomControls: true
6361
+ } : _ref$controls,
6362
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
6363
+ var mapRef = React.useRef(null);
6364
+ var store = useStore();
6365
+ var mapDimensions = useSelector(function (store) {
6366
+ return mapSelectors.getMapDimensions(store, mapId);
6435
6367
  });
6436
- var isOpenInStore = useSelector(function (store) {
6437
- return uiSelectors.getisDialogOpen(store, dialogType);
6368
+ var layers = useSelector(function (store) {
6369
+ return mapSelectors.getMapLayers(store, mapId);
6438
6370
  });
6439
- var openSearchDialog = React__default.useCallback(function () {
6440
- dispatch(uiActions.setActiveMapIdForDialog({
6441
- type: dialogType,
6442
- mapId: mapId,
6443
- setOpen: currentActiveMapId !== mapId ? true : !isOpenInStore,
6444
- source: source
6445
- }));
6446
- }, [currentActiveMapId, dialogType, dispatch, isOpenInStore, mapId, source]);
6447
- return jsx(MapControlButton, {
6448
- onClick: openSearchDialog,
6449
- title: t('search-title'),
6450
- "aria-label": t('search-title-aria'),
6451
- isActive: isOpenInStore,
6452
- children: jsx(Search, {})
6371
+ var baseLayers = useSelector(function (store) {
6372
+ return mapSelectors.getMapBaseLayers(store, mapId);
6453
6373
  });
6454
- };
6455
-
6456
- var MY_LOCATION = 'MyLocation';
6457
- var locationOptions = {
6458
- enableHighAccuracy: false,
6459
- timeout: 5000,
6460
- maximumAge: 0
6461
- };
6462
- var circleDrawFunction = function circleDrawFunction(args, fillColor, radius) {
6463
- if (fillColor === void 0) {
6464
- fillColor = '#88F';
6465
- }
6466
- if (radius === void 0) {
6467
- radius = 12;
6468
- }
6469
- var ctx = args.context,
6470
- coord = args.coord;
6471
- ctx.strokeStyle = '#000';
6472
- ctx.fillStyle = fillColor || '#88F';
6473
- ctx.lineWidth = 1;
6474
- ctx.beginPath();
6475
- ctx.arc(coord.x, coord.y, radius || 10, 0, 2 * Math.PI);
6476
- ctx.fill();
6477
- ctx.stroke();
6478
- ctx.fillStyle = '#000';
6479
- ctx.beginPath();
6480
- ctx.arc(coord.x, coord.y, 2, 0, 2 * Math.PI);
6481
- ctx.fill();
6482
- };
6483
- var MyMapLocation = function MyMapLocation(_ref) {
6484
- var _sx;
6485
- var mapId = _ref.mapId,
6486
- isLoading = _ref.isLoading,
6487
- hasFailed = _ref.hasFailed,
6488
- setIsLoading = _ref.setIsLoading,
6489
- setHasFailed = _ref.setHasFailed;
6490
- var _useCoreTranslation = useCoreTranslation(),
6491
- t = _useCoreTranslation.t;
6492
- var dispatch = useDispatch();
6493
- var layersBelongsToCurrentMapId = useSelector(function (store) {
6494
- return layerSelectors.getLayersByMapId(store, mapId || '');
6374
+ var overLayers = useSelector(function (store) {
6375
+ return mapSelectors.getMapOverLayers(store, mapId);
6495
6376
  });
6496
- var layerLocation = layersBelongsToCurrentMapId.find(function (layer) {
6497
- var _layer$geojson$featur;
6498
- if (layer.geojson && layer.geojson.features[0] && layer.geojson.features[0].properties && (_layer$geojson$featur = layer.geojson.features[0].properties) != null && _layer$geojson$featur.name) {
6499
- if (layer.geojson.features[0].properties.name === MY_LOCATION) {
6500
- return layer;
6377
+ var featureLayers = useSelector(function (store) {
6378
+ return mapSelectors.getMapFeatureLayers(store, mapId);
6379
+ });
6380
+ var linkedFeatures = useSelector(function (store) {
6381
+ var _store$syncGroups;
6382
+ return genericSelectors.selectLinkedFeatures((_store$syncGroups = store.syncGroups) == null ? void 0 : _store$syncGroups.linkedState, mapId);
6383
+ });
6384
+ var linkedFormFeatures = useSelector(function (store) {
6385
+ var _store$syncGroups2;
6386
+ return genericSelectors.selectLinkedFormFeatures((_store$syncGroups2 = store.syncGroups) == null ? void 0 : _store$syncGroups2.linkedState, mapId);
6387
+ });
6388
+ var bbox = useSelector(function (store) {
6389
+ return mapSelectors.getBbox(store, mapId);
6390
+ });
6391
+ var srs = useSelector(function (store) {
6392
+ return mapSelectors.getSrs(store, mapId);
6393
+ });
6394
+ var activeLayerId = useSelector(function (store) {
6395
+ return mapSelectors.getActiveLayerId(store, mapId);
6396
+ });
6397
+ var animationDelay = useSelector(function (store) {
6398
+ return mapSelectors.getMapAnimationDelay(store, mapId);
6399
+ });
6400
+ var mapPinLocation = useSelector(function (store) {
6401
+ return mapSelectors.getPinLocation(store, mapId);
6402
+ });
6403
+ var linkedPanelId = useSelector(function (store) {
6404
+ return genericSelectors.selectLinkedPanelId(store, mapId);
6405
+ });
6406
+ var selectedFeatureCoordinates = useSelector(function (store) {
6407
+ return genericSelectors.getSelectedFeature(store.syncGroups, linkedPanelId);
6408
+ });
6409
+ var disableMapPin = useSelector(function (store) {
6410
+ return mapSelectors.getDisableMapPin(store, mapId);
6411
+ });
6412
+ var displayMapPin = useSelector(function (store) {
6413
+ return mapSelectors.getDisplayMapPin(store, mapId);
6414
+ });
6415
+ var timestep = useSelector(function (store) {
6416
+ return mapSelectors.getMapTimeStep(store, mapId);
6417
+ });
6418
+ var dispatch = useDispatch();
6419
+ var mapChangeDimension = React.useCallback(function (mapDimensionPayload) {
6420
+ if (mapDimensionPayload.dimension) {
6421
+ var wmjsMap = webmapUtils.getWMJSMapById(mapId);
6422
+ if (!wmjsMap) {
6423
+ return;
6424
+ }
6425
+ var dimension = wmjsMap.getDimension(mapDimensionPayload.dimension.name);
6426
+ if (dimension && dimension.currentValue === mapDimensionPayload.dimension.currentValue) {
6427
+ return;
6501
6428
  }
6502
6429
  }
6503
- return undefined;
6430
+ dispatch(mapActions.mapChangeDimension(mapDimensionPayload));
6431
+ }, [dispatch, mapId]);
6432
+ var setTime = React.useCallback(function (setTimePayload) {
6433
+ var _wmjsMap$getDimension;
6434
+ var wmjsMap = webmapUtils.getWMJSMapById(mapId);
6435
+ /* Check if the map not already has this value set, otherwise this component will re-render */
6436
+ if (wmjsMap && wmjsMap.getDimension('time') && ((_wmjsMap$getDimension = wmjsMap.getDimension('time')) == null ? void 0 : _wmjsMap$getDimension.currentValue) === setTimePayload.value) {
6437
+ return;
6438
+ }
6439
+ dispatch(genericActions.setTime(setTimePayload));
6440
+ }, [dispatch, mapId]);
6441
+ var updateLayerInformation = React.useCallback(function (payload) {
6442
+ dispatch(layerActions.onUpdateLayerInformation(payload));
6443
+ }, [dispatch]);
6444
+ var registerMap = React.useCallback(function (payload) {
6445
+ dispatch(mapActions.registerMap(payload));
6446
+ }, [dispatch]);
6447
+ var unregisterMap = React.useCallback(function (payload) {
6448
+ dispatch(mapActions.unregisterMap(payload));
6449
+ }, [dispatch]);
6450
+ var genericSetBbox = React.useCallback(function (payload) {
6451
+ dispatch(genericActions.setBbox(payload));
6452
+ }, [dispatch]);
6453
+ var syncGroupAddSource = React.useCallback(function (payload) {
6454
+ dispatch(genericActions.syncGroupAddSource(payload));
6455
+ }, [dispatch]);
6456
+ var syncGroupRemoveSource = React.useCallback(function (payload) {
6457
+ dispatch(genericActions.syncGroupRemoveSource(payload));
6458
+ }, [dispatch]);
6459
+ var layerError = React.useCallback(function (payload) {
6460
+ dispatch(layerActions.layerError(payload));
6461
+ }, [dispatch]);
6462
+ var mapPinChangeLocation = React.useCallback(function (payload) {
6463
+ dispatch(mapActions.setMapPinLocation(payload));
6464
+ }, [dispatch]);
6465
+ var setSelectedFeature = React.useCallback(function (payload) {
6466
+ dispatch(layerActions.setSelectedFeature(payload));
6467
+ }, [dispatch]);
6468
+ var handleFeatureSelect = function handleFeatureSelect(mapId, featureId) {
6469
+ dispatch(genericActions.addSharedData({
6470
+ panelId: mapId,
6471
+ data: {
6472
+ selectedFeatureId: featureId || ''
6473
+ }
6474
+ }));
6475
+ };
6476
+ var updateFeature = React.useCallback(function (_ref2) {
6477
+ var geojson = _ref2.geojson,
6478
+ reason = _ref2.reason,
6479
+ layerId = _ref2.layerId;
6480
+ var activeDrawToolId = drawtoolSelectors.getActiveDrawToolId(store.getState());
6481
+ var activeDrawMode = drawtoolSelectors.getActiveDrawMode(store.getState(), activeDrawToolId);
6482
+ dispatch(layerActions.updateFeature({
6483
+ geojson: geojson,
6484
+ reason: reason,
6485
+ layerId: layerId,
6486
+ shouldAllowMultipleShapes: drawtoolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId),
6487
+ geoJSONIntersectionLayerId: drawtoolSelectors.getGeoJSONIntersectionLayerId(store.getState(), activeDrawToolId),
6488
+ geoJSONIntersectionBoundsLayerId: drawtoolSelectors.getGeoJSONIntersectionBoundsLayerId(store.getState(), activeDrawToolId),
6489
+ selectionType: activeDrawMode == null ? void 0 : activeDrawMode.selectionType
6490
+ }));
6491
+ }, [dispatch, store]);
6492
+ var exitFeatureDrawMode = React.useCallback(function (_ref3) {
6493
+ var reason = _ref3.reason,
6494
+ layerId = _ref3.layerId;
6495
+ var activeDrawToolId = drawtoolSelectors.getActiveDrawToolId(store.getState());
6496
+ dispatch(layerActions.exitFeatureDrawMode({
6497
+ reason: reason,
6498
+ layerId: layerId,
6499
+ shouldAllowMultipleShapes: drawtoolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId)
6500
+ }));
6501
+ }, [dispatch, store]);
6502
+ var isActiveWindowId = useSelector(function (store) {
6503
+ return uiSelectors.getIsActiveWindowId(store, mapId);
6504
6504
  });
6505
- var layerLocationId = (layerLocation == null ? void 0 : layerLocation.id) || '';
6506
- var circleDrawFunctionId = useRef(registerDrawFunction(circleDrawFunction));
6507
- var handleLocationClick = function handleLocationClick() {
6508
- setIsLoading(true);
6509
- if (mapId && layerLocationId !== '') {
6510
- dispatch(layerActions.layerDelete({
6511
- mapId: mapId,
6512
- layerId: layerLocationId
6505
+ useKeyboardZoomAndPan(isActiveWindowId, mapId, mapRef.current);
6506
+ useTouchZoomPan(isActiveWindowId, mapId);
6507
+ var unRegister = React.useCallback(function (mapId) {
6508
+ unregisterMap({
6509
+ mapId: mapId
6510
+ });
6511
+ syncGroupRemoveSource({
6512
+ id: mapId
6513
+ });
6514
+ }, [syncGroupRemoveSource, unregisterMap]);
6515
+ React.useEffect(function () {
6516
+ registerMap({
6517
+ mapId: mapId
6518
+ });
6519
+ syncGroupAddSource({
6520
+ id: mapId,
6521
+ type: [syncConstants.SYNCGROUPS_TYPE_SETTIME, syncConstants.SYNCGROUPS_TYPE_SETBBOX]
6522
+ });
6523
+ dispatch(loadingIndicatorActions.setGetMapIsLoading({
6524
+ id: mapId,
6525
+ isGetMapLoading: false
6526
+ }));
6527
+ }, [dispatch, mapId, registerMap, syncGroupAddSource]);
6528
+ var onGetMapLoadStart = React.useCallback(function () {
6529
+ dispatch(loadingIndicatorActions.setGetMapIsLoading({
6530
+ id: mapId,
6531
+ isGetMapLoading: true
6532
+ }));
6533
+ }, [dispatch, mapId]);
6534
+ var onGetMapLoadReady = React.useCallback(function () {
6535
+ dispatch(loadingIndicatorActions.setGetMapIsLoading({
6536
+ id: mapId,
6537
+ isGetMapLoading: false
6538
+ }));
6539
+ }, [dispatch, mapId]);
6540
+ var onGetCapabilitiesLoadStart = React.useCallback(function () {
6541
+ dispatch(loadingIndicatorActions.setGetCapabilitiesIsLoading({
6542
+ id: mapId,
6543
+ isGetCapabilitiesLoading: true
6544
+ }));
6545
+ }, [dispatch, mapId]);
6546
+ var onGetCapabilitiesLoadReady = React.useCallback(function () {
6547
+ dispatch(loadingIndicatorActions.setGetCapabilitiesIsLoading({
6548
+ id: mapId,
6549
+ isGetCapabilitiesLoading: false
6550
+ }));
6551
+ }, [dispatch, mapId]);
6552
+ var isTimeScrollingEnabled = useSelector(syncGroupsSelectors.isTimeScrollingEnabled);
6553
+ var _useSelector = useSelector(function (state) {
6554
+ return genericSelectors.selectSharedData(state, linkedPanelId);
6555
+ }),
6556
+ hoverId = _useSelector.hoverId;
6557
+ var debouncedSetHoverFeature = React.useMemo(function () {
6558
+ return debounce(function (featureId) {
6559
+ return dispatch(genericActions.addSharedData({
6560
+ panelId: linkedPanelId,
6561
+ data: {
6562
+ hoverId: featureId
6563
+ }
6513
6564
  }));
6514
- setIsLoading(false);
6515
- } else if (navigator.geolocation && mapId && layerLocationId === '' && circleDrawFunctionId) {
6516
- navigator.geolocation.getCurrentPosition(function (success) {
6517
- setIsLoading(false);
6518
- setHasFailed(false);
6519
- var _success$coords = success.coords,
6520
- latitude = _success$coords.latitude,
6521
- longitude = _success$coords.longitude;
6522
- var geojson = {
6523
- type: 'FeatureCollection',
6524
- features: [{
6525
- type: 'Feature',
6526
- properties: {
6527
- name: MY_LOCATION,
6528
- drawFunctionId: circleDrawFunctionId.current
6529
- },
6530
- geometry: {
6531
- type: 'Point',
6532
- coordinates: [longitude, latitude]
6565
+ }, 200);
6566
+ }, [dispatch, linkedPanelId]);
6567
+ return jsxs("div", {
6568
+ style: {
6569
+ height: '100%'
6570
+ },
6571
+ ref: mapRef,
6572
+ children: [jsxs(MapView, Object.assign({}, props, {
6573
+ mapId: mapId,
6574
+ controls: {},
6575
+ linkedFeatures: {
6576
+ type: 'FeatureCollection',
6577
+ features: linkedFeatures.flatMap(function (feature) {
6578
+ return feature.geoJSON.features;
6579
+ })
6580
+ },
6581
+ isTimeScrollingEnabled: isTimeScrollingEnabled,
6582
+ srs: srs,
6583
+ bbox: bbox,
6584
+ mapPinLocation: displayMapPin ? selectedFeatureCoordinates || mapPinLocation : undefined,
6585
+ dimensions: mapDimensions,
6586
+ activeLayerId: activeLayerId,
6587
+ animationDelay: animationDelay,
6588
+ timestep: timestep,
6589
+ displayMapPin: displayMapPin,
6590
+ disableMapPin: disableMapPin,
6591
+ onMapChangeDimension: function onMapChangeDimension(mapDimensionPayload) {
6592
+ if (mapDimensionPayload && mapDimensionPayload.dimension && mapDimensionPayload.dimension.name && mapDimensionPayload.dimension.name === 'time') {
6593
+ setTime({
6594
+ sourceId: mapId,
6595
+ origin: mapDimensionPayload.origin + "==> " + ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION,
6596
+ value: handleDateUtilsISOString(mapDimensionPayload.dimension.currentValue)
6597
+ });
6598
+ } else {
6599
+ mapChangeDimension(mapDimensionPayload);
6600
+ }
6601
+ },
6602
+ onUpdateLayerInformation: updateLayerInformation,
6603
+ onMapPinChangeLocation: mapPinChangeLocation,
6604
+ onMapZoomEnd: function onMapZoomEnd(a) {
6605
+ genericSetBbox({
6606
+ bbox: a.bbox,
6607
+ srs: a.srs,
6608
+ sourceId: mapId,
6609
+ origin: mapEnums.MapActionOrigin.map,
6610
+ mapId: mapId
6611
+ });
6612
+ },
6613
+ onWMJSMount: function onWMJSMount(mapId) {
6614
+ var wmjsMap = webmapUtils.getWMJSMapById(mapId);
6615
+ if (!wmjsMap) {
6616
+ return;
6617
+ }
6618
+ wmjsMap.getListener().addEventListener('onloadstart', onGetMapLoadStart);
6619
+ wmjsMap.getListener().addEventListener('onloadready', onGetMapLoadReady);
6620
+ wmServiceListener.addEventListener(EVENT_GETCAPABILITIES_START, onGetCapabilitiesLoadStart, true);
6621
+ wmServiceListener.addEventListener(EVENT_GETCAPABILITIES_READY, onGetCapabilitiesLoadReady, true);
6622
+ },
6623
+ onWMJSUnMount: function onWMJSUnMount(mapId) {
6624
+ unRegister(mapId);
6625
+ wmServiceListener.removeEventListener(EVENT_GETCAPABILITIES_START, onGetCapabilitiesLoadStart);
6626
+ wmServiceListener.removeEventListener(EVENT_GETCAPABILITIES_READY, onGetCapabilitiesLoadReady);
6627
+ },
6628
+ children: [baseLayers.map(function (layer) {
6629
+ return jsx(MapViewLayer, Object.assign({
6630
+ id: "baselayer-" + layer.id,
6631
+ onLayerError: function onLayerError(_, error) {
6632
+ layerError({
6633
+ layerId: layer.id,
6634
+ error: Error("" + error)
6635
+ });
6636
+ }
6637
+ }, layer), layer.id);
6638
+ }), layers.map(function (layer) {
6639
+ return jsx(MapViewLayer, Object.assign({
6640
+ id: "layer-" + layer.id,
6641
+ onLayerError: function onLayerError(_, error) {
6642
+ layerError({
6643
+ layerId: layer.id,
6644
+ error: Error("" + error)
6645
+ });
6646
+ }
6647
+ }, layer), layer.id);
6648
+ }), (_linkedFeatures$conca = linkedFeatures.concat(linkedFormFeatures)) == null ? void 0 : _linkedFeatures$conca.map(function (feature) {
6649
+ return jsx(MapViewLayer, {
6650
+ id: feature.id,
6651
+ geojson: feature == null ? void 0 : feature.geoJSON,
6652
+ onHoverFeature: function onHoverFeature(hoverInfo) {
6653
+ if (hoverInfo === undefined && hoverId !== undefined) {
6654
+ debouncedSetHoverFeature();
6655
+ } else if (hoverInfo != null && hoverInfo.feature && feature.originalId !== hoverId) {
6656
+ debouncedSetHoverFeature(feature.originalId);
6533
6657
  }
6534
- }]
6535
- };
6536
- var layerId = webmapUtils.generateLayerId();
6537
- dispatch(layerActions.addLayer({
6538
- mapId: mapId,
6539
- layer: {
6540
- geojson: geojson,
6541
- layerType: LayerType.featureLayer
6542
6658
  },
6543
- layerId: layerId,
6544
- origin: MY_LOCATION
6545
- }));
6546
- var wmjsMap = webmapUtils.getWMJSMapById(mapId);
6547
- if (!wmjsMap) {
6548
- return;
6549
- }
6550
- wmjsMap.calculateBoundingBoxAndZoom(latitude, longitude);
6551
- }, function (error) {
6552
- setIsLoading(false);
6553
- setHasFailed(true);
6554
- console.warn(t('search-error', {
6555
- error: error.message
6556
- }));
6557
- }, locationOptions);
6558
- }
6559
- };
6560
- var chooseIcon = function chooseIcon() {
6561
- return hasFailed ? jsx(Exclamation, {
6562
- style: {
6563
- color: 'red'
6564
- },
6565
- "aria-label": "location error"
6566
- }) : jsx(MyLocation, {
6567
- "aria-label": "location default"
6568
- });
6569
- };
6570
- return jsx("div", {
6571
- children: isLoading ? jsxs(Fragment, {
6572
- children: [jsx(CircularProgress, {
6573
- value: 100,
6574
- variant: "determinate",
6575
- sx: {
6576
- height: '100%',
6577
- width: '100%',
6578
- color: function color(theme) {
6579
- return theme.palette.mode === 'light' ? '#1a90ff' : '#bad4ff';
6659
+ onClickFeature: function onClickFeature(event) {
6660
+ var _event$feature$proper;
6661
+ var isClickOutsideFeature = !event || !event.feature;
6662
+ if (isClickOutsideFeature) {
6663
+ if (mapPinLocation) {
6664
+ handleFeatureSelect(linkedPanelId, undefined);
6665
+ }
6666
+ return;
6667
+ }
6668
+ // Handle clicks on station
6669
+ var clickedFeatureName = (_event$feature$proper = event.feature.properties) == null ? void 0 : _event$feature$proper.name;
6670
+ var features = linkedFeatures[0].geoJSON.features;
6671
+ var clickedFeatureIndex = features.findIndex(function (feature) {
6672
+ var _feature$properties;
6673
+ return ((_feature$properties = feature.properties) == null ? void 0 : _feature$properties.name) === clickedFeatureName;
6674
+ });
6675
+ if (disableMapPin === false) {
6676
+ var _selectedFeature$id;
6677
+ var selectedFeature = features[clickedFeatureIndex];
6678
+ handleFeatureSelect(linkedPanelId, (_selectedFeature$id = selectedFeature.id) == null ? void 0 : _selectedFeature$id.toString());
6679
+ }
6680
+ }
6681
+ }, feature.id);
6682
+ }), featureLayers.map(function (layer) {
6683
+ return jsx(MapViewLayer, Object.assign({
6684
+ id: "featurelayer-" + layer.id,
6685
+ onLayerError: function onLayerError(_, error) {
6686
+ layerError({
6687
+ layerId: layer.id,
6688
+ error: Error("" + error)
6689
+ });
6580
6690
  },
6581
- padding: '8px'
6582
- },
6583
- thickness: 6,
6584
- "aria-label": "location loading"
6585
- }), jsx(CircularProgress, {
6586
- variant: "indeterminate",
6587
- disableShrink: true,
6588
- sx: (_sx = {
6589
- height: '100%',
6590
- width: '100%',
6591
- color: function color(theme) {
6592
- return theme.palette.mode === 'light' ? '#bad4ff' : '#45556F';
6691
+ onClickFeature: function onClickFeature(event) {
6692
+ var isClickOutsideFeature = !event;
6693
+ if (isClickOutsideFeature && !layer.isInEditMode) {
6694
+ setSelectedFeature({
6695
+ layerId: layer.id,
6696
+ selectedFeatureIndex: undefined
6697
+ });
6698
+ return;
6699
+ }
6700
+ if ((event == null ? void 0 : event.isInEditMode) === false) {
6701
+ setSelectedFeature({
6702
+ layerId: layer.id,
6703
+ selectedFeatureIndex: event.featureIndex
6704
+ });
6705
+ }
6593
6706
  },
6594
- animationDuration: '1000ms',
6595
- position: 'absolute',
6596
- left: 0
6597
- }, _sx["& ." + circularProgressClasses.circle] = {
6598
- strokeLinecap: 'round'
6599
- }, _sx.padding = '8px', _sx),
6600
- thickness: 6
6601
- })]
6602
- }) : jsx(CustomIconButton, {
6603
- title: t('search-find-location'),
6604
- "aria-label": MY_LOCATION,
6605
- onClick: handleLocationClick,
6606
- isSelected: layerLocationId !== '',
6607
- size: "large",
6608
- children: chooseIcon()
6609
- })
6610
- });
6611
- };
6612
-
6613
- var SearchDialog = function SearchDialog(_ref) {
6614
- var isOpen = _ref.isOpen,
6615
- onClose = _ref.onClose,
6616
- _ref$mapId = _ref.mapId,
6617
- mapId = _ref$mapId === void 0 ? '' : _ref$mapId;
6618
- var _useCoreTranslation = useCoreTranslation(),
6619
- t = _useCoreTranslation.t;
6620
- var _useState = useState(false),
6621
- isLoading = _useState[0],
6622
- setIsLoading = _useState[1];
6623
- var _useState2 = useState(false),
6624
- hasFailed = _useState2[0],
6625
- setHasFailed = _useState2[1];
6626
- return isOpen && mapId ? jsxs(Box$1, {
6627
- sx: {
6628
- display: 'flex',
6629
- flexDirection: 'row',
6630
- alignItems: 'center',
6631
- position: 'absolute',
6632
- pointerEvents: 'all',
6633
- zIndex: 999,
6634
- left: 50,
6635
- top: 15,
6636
- borderBottom: '1px solid grey',
6637
- backgroundColor: function backgroundColor(theme) {
6638
- return theme.palette.background.paper;
6639
- }
6640
- },
6641
- children: [jsx(MyMapLocation, {
6707
+ updateGeojson: function updateGeojson(geojson, reason) {
6708
+ updateFeature({
6709
+ geojson: geojson,
6710
+ layerId: layer.id,
6711
+ reason: reason
6712
+ });
6713
+ },
6714
+ exitDrawModeCallback: function exitDrawModeCallback(reason) {
6715
+ return exitFeatureDrawMode({
6716
+ reason: reason,
6717
+ layerId: layer.id
6718
+ });
6719
+ }
6720
+ }, layer), layer.id);
6721
+ }), overLayers.map(function (layer) {
6722
+ return jsx(MapViewLayer, Object.assign({
6723
+ id: "baselayer-" + layer.id,
6724
+ onLayerError: function onLayerError(_, error) {
6725
+ layerError({
6726
+ layerId: layer.id,
6727
+ error: Error("" + error)
6728
+ });
6729
+ }
6730
+ }, layer), layer.id);
6731
+ }), children]
6732
+ })), jsxs(MapControls, {
6733
+ "data-testid": "mapControls",
6734
+ style: {
6735
+ top: controls == null ? void 0 : controls.mapControlsPositionTop
6736
+ },
6737
+ children: [(controls == null ? void 0 : controls.search) && jsx(SearchControlButtonConnect, {
6738
+ mapId: mapId
6739
+ }), (controls == null ? void 0 : controls.zoomControls) && jsx(ZoomControlConnect, {
6740
+ mapId: mapId
6741
+ }), (controls == null ? void 0 : controls.layerManagerAndLegend) && jsxs(Fragment, {
6742
+ children: [jsx(LayerManagerMapButtonConnect, {
6743
+ mapId: mapId
6744
+ }), jsx(LegendMapButtonConnect, {
6745
+ mapId: mapId,
6746
+ multiLegend: controls == null ? void 0 : controls.multiLegend
6747
+ })]
6748
+ }), (controls == null ? void 0 : controls.dimensionSelect) && jsx(MultiDimensionSelectMapButtonsConnect, {
6749
+ mapId: mapId
6750
+ }), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoButtonConnect, {
6751
+ mapId: mapId
6752
+ }), controls == null ? void 0 : controls.additionalMapControls]
6753
+ }), (controls == null ? void 0 : controls.multiLegend) && jsx(LegendConnect, {
6754
+ showMapId: true,
6642
6755
  mapId: mapId,
6643
- isLoading: isLoading,
6644
- hasFailed: hasFailed,
6645
- setIsLoading: setIsLoading,
6646
- setHasFailed: setHasFailed
6647
- }), jsx(TextField, {
6648
- id: "dummy-search-field",
6649
- label: t('search-title'),
6650
- variant: "filled",
6651
- slotProps: {
6652
- input: {
6653
- disableUnderline: true,
6654
- endAdornment: jsx(InputAdornment, {
6655
- position: "end",
6656
- children: jsx(CustomIconButton, {
6657
- tooltipTitle: t('actions-close'),
6658
- edge: "end",
6659
- onClick: onClose,
6660
- size: "large",
6661
- children: jsx(Close, {})
6662
- })
6663
- })
6664
- }
6665
- }
6756
+ multiLegend: controls == null ? void 0 : controls.multiLegend
6757
+ }), jsx(SearchControlConnect, {
6758
+ mapId: mapId
6759
+ }), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoConnect, {
6760
+ showMapId: true,
6761
+ mapId: mapId
6762
+ }), jsx(LayerManagerConnect, {
6763
+ mapId: mapId,
6764
+ bounds: "parent",
6765
+ isDocked: true
6666
6766
  })]
6667
- }) : null;
6668
- };
6669
-
6670
- var SearchControlConnect = function SearchControlConnect(_ref) {
6671
- var mapId = _ref.mapId;
6672
- var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
6673
- var _useSetupDialog = useSetupDialog(dialogType),
6674
- isDialogOpen = _useSetupDialog.isDialogOpen,
6675
- onCloseDialog = _useSetupDialog.onCloseDialog;
6676
- return jsx(SearchDialog, {
6677
- isOpen: isDialogOpen,
6678
- onClose: onCloseDialog,
6679
- mapId: mapId
6680
6767
  });
6681
6768
  };
6682
6769
 
@@ -7635,7 +7722,8 @@ var titleStyle = function titleStyle(theme) {
7635
7722
  zIndex: 50,
7636
7723
  color: theme.palette.common.black,
7637
7724
  whiteSpace: 'nowrap',
7638
- userSelect: 'none'
7725
+ userSelect: 'none',
7726
+ textShadow: '1px 1px 2px #ffffffE6, -1px 1px 2px #ffffffE6, -1px -1px 2px #ffffffE6, 1px -1px 2px #ffffffE6'
7639
7727
  };
7640
7728
  };
7641
7729
  var defaultBbox = {
@@ -7758,7 +7846,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
7758
7846
  }));
7759
7847
  }
7760
7848
  if (shouldDisplayDrawControls) {
7761
- dispatch(mapStoreActions.addLayer({
7849
+ dispatch(layerActions.addLayer({
7762
7850
  mapId: mapId,
7763
7851
  layer: {
7764
7852
  geojson: emptyGeoJSON,
@@ -7770,7 +7858,18 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
7770
7858
  }
7771
7859
  // eslint-disable-next-line react-hooks/exhaustive-deps
7772
7860
  }, []);
7773
- var mapControlsPositionTop = title ? 24 : 8;
7861
+ var mapControlConfig = useMemo(function () {
7862
+ return {
7863
+ mapControlsPositionTop: title ? 24 : 8,
7864
+ search: displaySearchButtonInMap,
7865
+ zoomControls: shouldShowZoomControls,
7866
+ layerManagerAndLegend: displayLayerManagerAndLegendButtonInMap,
7867
+ multiLegend: multiLegend,
7868
+ dimensionSelect: displayDimensionSelectButtonInMap,
7869
+ getFeatureInfo: displayGetFeatureInfoButtonInMap,
7870
+ additionalMapControls: mapControls
7871
+ };
7872
+ }, [title, displaySearchButtonInMap, shouldShowZoomControls, displayLayerManagerAndLegendButtonInMap, multiLegend, displayDimensionSelectButtonInMap, displayGetFeatureInfoButtonInMap, mapControls]);
7774
7873
  return React__default.useMemo(function () {
7775
7874
  renderCounter.count(ConfigurableMapConnect.name + "_" + mapId);
7776
7875
  return jsxs(Box, {
@@ -7786,25 +7885,6 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
7786
7885
  "data-testid": "mapTitle",
7787
7886
  sx: titleStyle,
7788
7887
  children: title
7789
- }), jsxs(MapControls, {
7790
- "data-testid": "mapControls",
7791
- style: {
7792
- top: mapControlsPositionTop
7793
- },
7794
- children: [displaySearchButtonInMap && jsx(SearchControlButtonConnect, {
7795
- mapId: mapId
7796
- }), jsx(ZoomControlConnect, {
7797
- mapId: id
7798
- }), displayLayerManagerAndLegendButtonInMap && jsx(LayerManagerMapButtonConnect, {
7799
- mapId: mapId
7800
- }), displayLayerManagerAndLegendButtonInMap && jsx(LegendMapButtonConnect, {
7801
- mapId: mapId,
7802
- multiLegend: multiLegend
7803
- }), displayDimensionSelectButtonInMap && jsx(MultiDimensionSelectMapButtonsConnect, {
7804
- mapId: mapId
7805
- }), displayGetFeatureInfoButtonInMap && jsx(GetFeatureInfoButtonConnect, {
7806
- mapId: mapId
7807
- }), mapControls]
7808
7888
  }), !disableTimeSlider && jsx(Box, {
7809
7889
  sx: {
7810
7890
  position: 'absolute',
@@ -7819,7 +7899,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
7819
7899
  mapWindowRef: mapWindowRef
7820
7900
  })
7821
7901
  }), jsx(MapViewConnect, {
7822
- controls: {},
7902
+ controls: mapControlConfig,
7823
7903
  displayTimeInMap: displayTimeInMap,
7824
7904
  showScaleBar: false,
7825
7905
  shouldAutoFetch: shouldAutoFetch,
@@ -7827,24 +7907,11 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
7827
7907
  shouldDisablePrefetching: shouldDisablePrefetching,
7828
7908
  tileServerSettings: tileServerSettings,
7829
7909
  children: children
7830
- }), multiLegend && jsx(LegendConnect, {
7831
- showMapId: true,
7832
- mapId: mapId,
7833
- multiLegend: multiLegend
7834
- }), jsx(SearchControlConnect, {
7835
- mapId: mapId
7836
7910
  }), showClock && jsx(TimeSliderClockConnect, {
7837
7911
  mapId: mapId
7838
- }), displayGetFeatureInfoButtonInMap && jsx(GetFeatureInfoConnect, {
7839
- showMapId: true,
7840
- mapId: mapId
7841
- }), jsx(LayerManagerConnect, {
7842
- mapId: mapId,
7843
- bounds: "parent",
7844
- isDocked: true
7845
7912
  })]
7846
7913
  });
7847
- }, [mapId, title, mapControlsPositionTop, displaySearchButtonInMap, id, displayLayerManagerAndLegendButtonInMap, multiLegend, displayDimensionSelectButtonInMap, displayGetFeatureInfoButtonInMap, tileServerSettings, mapControls, disableTimeSlider, displayTimeInMap, shouldAutoFetch, shouldDisablePrefetching, children, showClock]);
7914
+ }, [mapId, title, id, mapControlConfig, tileServerSettings, disableTimeSlider, displayTimeInMap, shouldAutoFetch, shouldDisablePrefetching, children, showClock]);
7848
7915
  };
7849
7916
 
7850
7917
  var mapBoxStyle = function mapBoxStyle(theme) {
@@ -7923,7 +7990,7 @@ var MultiMapViewConnect = function MultiMapViewConnect(_ref) {
7923
7990
  isAlwaysVisible: true,
7924
7991
  mapWindowRef: multiMapWindowRef
7925
7992
  })
7926
- }), !multiLegend && jsx(LegendConnect, {
7993
+ }), jsx(LegendConnect, {
7927
7994
  showMapId: true,
7928
7995
  mapId: firstMapId,
7929
7996
  multiLegend: multiLegend
@@ -7964,7 +8031,7 @@ var useGetLatestReferenceTime = function useGetLatestReferenceTime(inputLayer) {
7964
8031
  setLatestReferenceTime = _React$useState[1];
7965
8032
  React.useEffect(function () {
7966
8033
  var wmLayer = new WMLayer(Object.assign({}, inputLayer));
7967
- wmLayer.parseLayerPromise().then(function (layer) {
8034
+ wmLayer.parseLayer().then(function (layer) {
7968
8035
  var refTimeDim = layer.getDimension('reference_time');
7969
8036
  var lastRefTime = refTimeDim.getLastValue();
7970
8037
  setLatestReferenceTime(lastRefTime);
@@ -8004,23 +8071,24 @@ var makeMapPreset = function makeMapPreset(timeIncrement, uniqueId, referenceTim
8004
8071
  title: "FC +" + timeIncrement,
8005
8072
  displayTimeInMap: true,
8006
8073
  bbox: {
8007
- left: -129849.7860570465,
8008
- bottom: 6180677.243149376,
8009
- right: 1215891.3289626688,
8010
- top: 7540256.313079321
8074
+ left: -638936.0386164065,
8075
+ bottom: 6068439.661512798,
8076
+ right: 1613044.3568348314,
8077
+ top: 7876599.103115981
8011
8078
  },
8012
8079
  srs: PROJECTION.EPSG_3857.value,
8013
8080
  componentType: 'MultiMap',
8014
8081
  layers: layers.map(function (layer, index) {
8015
8082
  return Object.assign({}, layer, {
8016
8083
  id: uniqueId + "-" + index,
8017
- dimensions: [{
8084
+ /* Set time dimensions if layer type is not overLayer */
8085
+ dimensions: layer.layerType !== LayerType.overLayer ? [{
8018
8086
  name: 'reference_time',
8019
8087
  currentValue: referenceTime
8020
8088
  }, {
8021
8089
  name: 'time',
8022
8090
  currentValue: mapTime
8023
- }]
8091
+ }] : []
8024
8092
  });
8025
8093
  }),
8026
8094
  displayLayerManagerAndLegendButtonInMap: displayLayerManagerAndLegendButtonInMap,
@@ -8038,8 +8106,10 @@ var ModelRunInterval = function ModelRunInterval(_ref) {
8038
8106
  _ref$multiLegend = _ref.multiLegend,
8039
8107
  multiLegend = _ref$multiLegend === void 0 ? false : _ref$multiLegend;
8040
8108
  var displayLayerManagerAndLegendButtonInAllMaps = !useHasSyncGroupWithLayerActions(syncGroupsIds);
8041
- /* Get latest reference time for this layer */
8042
- var latestReferenceTime = useGetLatestReferenceTime(layers[0]);
8109
+ /* Get latest reference time for layer that is not an overLayer */
8110
+ var latestReferenceTime = useGetLatestReferenceTime(layers.find(function (layer) {
8111
+ return layer.layerType !== LayerType.overLayer;
8112
+ }));
8043
8113
  if (latestReferenceTime === '') {
8044
8114
  return jsx("div", {
8045
8115
  children: "Loading..."
@@ -8071,7 +8141,7 @@ var useGetReferenceTimes = function useGetReferenceTimes(inputLayer) {
8071
8141
  React.useEffect(function () {
8072
8142
  var referenceTimes = [];
8073
8143
  var wmLayer = new WMLayer(Object.assign({}, inputLayer));
8074
- wmLayer.parseLayerPromise().then(function (layer) {
8144
+ wmLayer.parseLayer().then(function (layer) {
8075
8145
  var refTimeDim = layer.getDimension('reference_time');
8076
8146
  /* Loop through all values of the dimension.
8077
8147
  A map cannot be used for iterating, as the dimension values are not in an array (it is an API). */