@opengeoweb/core 10.0.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/index.esm.js +1056 -764
- package/package.json +6 -2
- package/src/lib/components/LayerManager/LayerContainerRow/LayerRow/LayerRow.d.ts +2 -3
- package/src/lib/components/MapViewConnect/MapViewConnect.d.ts +11 -3
- package/src/lib/components/Providers/Providers.d.ts +0 -2
- package/src/lib/components/Search/MyMapLocation.d.ts +5 -6
- package/src/lib/components/Search/SearchDialog.d.ts +4 -1
- package/src/lib/components/Search/{SearchControl.stories.d.ts → SearchDialog.stories.d.ts} +4 -4
- package/src/lib/components/Search/SearchDialogConnect.d.ts +5 -0
- package/src/lib/components/Search/SearchDialogConnect.spec.d.ts +1 -0
- package/src/lib/components/Search/SearchDialogConnect.stories.d.ts +7 -0
- package/src/lib/components/Search/index.d.ts +1 -1
- package/src/lib/components/Search/types.d.ts +13 -0
- package/src/lib/components/Search/utils.d.ts +6 -0
- package/src/lib/components/SyncGroups/SimpleTimeSliderConnect.d.ts +2 -2
- package/src/lib/components/TimeSliderConnect/TimeSliderButtonsConnect/AutoUpdateButtonConnect.d.ts +2 -2
- package/src/lib/components/TimeSliderConnect/TimeSliderButtonsConnect/PlayButtonConnect.d.ts +4 -4
- package/src/lib/components/TimeSliderConnect/TimeSliderCurrentTimeBoxConnect.d.ts +1 -1
- package/src/lib/utils/defaultConfigurations.d.ts +3 -3
- package/src/lib/utils/location-api/api.d.ts +3 -0
- package/src/lib/utils/location-api/fakeApi.d.ts +40 -0
- package/src/lib/utils/location-api/hooks.d.ts +9 -0
- package/src/lib/utils/testUtils.d.ts +2 -2
- package/src/lib/components/Search/SearchControlConnect.d.ts +0 -5
- /package/src/lib/components/{Search/SearchControlConnect.spec.d.ts → MultiMapViewConnect/HarmoniePresets/HarmonieTempAndPrecipPreset.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { useState, useCallback,
|
|
4
|
-
import { Grid2, Box, MenuItem, Typography, useTheme, Popper, Fade, Tooltip, styled, LinearProgress, FormControl, InputLabel, Paper, List, ListItemButton, ListItemText, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, InputAdornment, DialogActions, Button,
|
|
3
|
+
import React__default, { useState, useCallback, useEffect, useMemo } from 'react';
|
|
4
|
+
import { Grid2, Box, MenuItem, Typography, useTheme, Popper, Fade, Tooltip, styled, LinearProgress, FormControl, InputLabel, Paper, List, ListItemButton, ListItemText, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, InputAdornment, DialogActions, Button, Autocomplete, ListItemIcon, Checkbox, Switch, Select } from '@mui/material';
|
|
5
5
|
import { SHARED_NAMESPACE, sharedTranslations, CustomIconButton, CustomTooltip, TooltipSelect, AlertIcon, sliderHeaderStyle, CustomSlider, ToggleMenu, tooltipContainerStyles, renderCounter, AlertBanner, CustomAccordion, PROJECTION, calculateStartSize, useWheelStopPropagation, ToolContainerDraggable, useDebounce, dateUtils, ErrorBoundary } from '@opengeoweb/shared';
|
|
6
|
-
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,
|
|
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,
|
|
10
|
+
import { WEBMAP_REACT_NAMESPACE, webmapReactTranslations, WEBMAP_NAMESPACE, webmapTranslations, LayerInfoButton, LayerInfoDialog, MapControlButton, MapDimensionSelect, dimensionConfig, DimensionSelectDialog, DimensionSelectButton, emptyGeoJSON, registerDrawFunction, simplePointsGeojson, 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, drawtoolSelectors, syncConstants, loadingIndicatorActions, syncGroupsSelectors, defaultLayers,
|
|
15
|
-
import
|
|
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, cloneDeep, debounce, range } from 'lodash';
|
|
16
|
+
import { webmapUtils, queryWMSServiceInfo, queryWMSLayers, queryWMSLayersTree, invalidateWMSGetCapabilities, LayerType, getWMSServiceId, generateLayerId, getWMJSMapById, getWMSGetFeatureInfoRequestURL, handleDateUtilsISOString, wmServiceListener, EVENT_GETCAPABILITIES_START, EVENT_GETCAPABILITIES_READY, WMLayer } from '@opengeoweb/webmap';
|
|
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
|
+
import { useQuery, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
20
|
+
import { getConfig } from '@opengeoweb/authentication';
|
|
21
|
+
import { handleResponse } from '@opengeoweb/api';
|
|
19
22
|
import axios from 'axios';
|
|
20
23
|
import DOMPurify from 'dompurify';
|
|
21
24
|
import { snackbarTypes, snackbarActions, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
|
|
@@ -65,10 +68,13 @@ var en = {
|
|
|
65
68
|
"wms-loader-error-http": "Use https or allow Mixed Content in your browser to use this WMS service",
|
|
66
69
|
"wms-loader-error-valid-service": "Please enter a valid WMS service",
|
|
67
70
|
"wms-loader-error-valid-url": "Please enter a valid URL",
|
|
68
|
-
"search-title": "
|
|
69
|
-
"search-title-aria": "
|
|
70
|
-
"search-
|
|
71
|
-
"search-
|
|
71
|
+
"search-title": "Find location",
|
|
72
|
+
"search-title-aria": "Find location on the map",
|
|
73
|
+
"search-my-location": "Find my location",
|
|
74
|
+
"search-title-long": "Find location, area, postal code, GPS, ...",
|
|
75
|
+
"search-no-results": "No results",
|
|
76
|
+
"my-location": "My location",
|
|
77
|
+
"search-clear": "Clear",
|
|
72
78
|
"syncgroups-title": "Sync",
|
|
73
79
|
"syncgroups-zoom": "ZoomPane",
|
|
74
80
|
"syncgroups-timeslider": "Timeslider",
|
|
@@ -103,19 +109,19 @@ var fi = {
|
|
|
103
109
|
"add-layer-popup-available-services": "Käytettävissä olevat palvelut",
|
|
104
110
|
"add-layer-popup-available-layers": "Palvelusta {{serviceName}} saatavilla olevat karttatasot",
|
|
105
111
|
"add-layer-popup-reload-layers": "Lataa palvelun karttatasot uudelleen",
|
|
106
|
-
"layermanager-title": "
|
|
112
|
+
"layermanager-title": "Karttatasot",
|
|
107
113
|
"layermanager-baselayers-title": "Pohjakartta",
|
|
108
114
|
"layermanager-baselayers-no-available": "Palvelu ei käytettävissä",
|
|
109
115
|
"layermanager-acceptance-time": "Hyväksymisaika",
|
|
110
116
|
"layermanager-dimensions-total-values": "Dimension arvon ({{total_dimensions}} valinnat)",
|
|
111
117
|
"layermanager-dimensions-title": "Dimensiot",
|
|
112
118
|
"layermanager-dimension-title": "Dimensiot",
|
|
113
|
-
"layermanager-opacity-title": "
|
|
114
|
-
"layermanager-opacity-tooltip-prefix": "
|
|
119
|
+
"layermanager-opacity-title": "Peittävyys",
|
|
120
|
+
"layermanager-opacity-tooltip-prefix": "Peittävyys: ",
|
|
115
121
|
"layermanager-style-title": "Tyyli",
|
|
116
122
|
"layermanager-layer-error": "Karttatason lataaminen epäonnistui: tasoa ei löytynyt palvelimelta",
|
|
117
123
|
"layermanager-layer": "Karttataso",
|
|
118
|
-
"layermanager-layer-toggle": "
|
|
124
|
+
"layermanager-layer-toggle": "Karttatason näkyvyys",
|
|
119
125
|
"layermanager-layer-select": "Avaa karttataso valitsin",
|
|
120
126
|
"layermanager-layer-drag": "Raahaa",
|
|
121
127
|
"layermanager-layer-leading": "Johtava karttataso",
|
|
@@ -140,8 +146,11 @@ var fi = {
|
|
|
140
146
|
"wms-loader-error-valid-url": "Lisää toimiva URL",
|
|
141
147
|
"search-title": "Etsi",
|
|
142
148
|
"search-title-aria": "Karttahaku",
|
|
143
|
-
"search-
|
|
144
|
-
"search-
|
|
149
|
+
"search-my-location": "Etsi sijaintini",
|
|
150
|
+
"search-title-long": "Find location, area, postal code, GPS, ...",
|
|
151
|
+
"search-no-results": "No results",
|
|
152
|
+
"my-location": "My location",
|
|
153
|
+
"search-clear": "Clear",
|
|
145
154
|
"syncgroups-title": "Sync",
|
|
146
155
|
"syncgroups-zoom": "ZoomPane",
|
|
147
156
|
"syncgroups-timeslider": "TimeSlider",
|
|
@@ -213,8 +222,11 @@ var no = {
|
|
|
213
222
|
"wms-loader-error-valid-url": "Vennligst skriv inn en gyldig URL",
|
|
214
223
|
"search-title": "Søk",
|
|
215
224
|
"search-title-aria": "Kart søk",
|
|
216
|
-
"search-
|
|
217
|
-
"search-
|
|
225
|
+
"search-my-location": "Finn min lokasjon",
|
|
226
|
+
"search-title-long": "Find location, area, postal code, GPS, ...",
|
|
227
|
+
"search-no-results": "No results",
|
|
228
|
+
"my-location": "Min lokasjon",
|
|
229
|
+
"search-clear": "Clear",
|
|
218
230
|
"syncgroups-title": "Synkroniser",
|
|
219
231
|
"syncgroups-zoom": "Zoom/Paner",
|
|
220
232
|
"syncgroups-timeslider": "Timeslider",
|
|
@@ -286,8 +298,11 @@ var nl = {
|
|
|
286
298
|
"wms-loader-error-valid-url": "Voer een geldige URL in",
|
|
287
299
|
"search-title": "Zoeken",
|
|
288
300
|
"search-title-aria": "Zoeken op de kaart",
|
|
289
|
-
"search-
|
|
290
|
-
"search-
|
|
301
|
+
"search-my-location": "Vind mijn locatie",
|
|
302
|
+
"search-title-long": "Vind locatie, gebied, postcode, GPS, ...",
|
|
303
|
+
"search-no-results": "Geen resultaten",
|
|
304
|
+
"my-location": "Mijn locatie",
|
|
305
|
+
"search-clear": "Wissen",
|
|
291
306
|
"syncgroups-title": "Synchroniseren",
|
|
292
307
|
"syncgroups-zoom": "Zoomvenster",
|
|
293
308
|
"syncgroups-timeslider": "Timeslider",
|
|
@@ -1660,7 +1675,7 @@ var OpacitySelect = function OpacitySelect(_ref) {
|
|
|
1660
1675
|
marks: marks,
|
|
1661
1676
|
onChange: function onChange(event, newValue) {
|
|
1662
1677
|
event.stopPropagation();
|
|
1663
|
-
onLayerChangeOpacity(newValue);
|
|
1678
|
+
onLayerChangeOpacity(isArray(newValue) ? newValue[0] : newValue);
|
|
1664
1679
|
},
|
|
1665
1680
|
onKeyDown: onKeyDownSlider,
|
|
1666
1681
|
onBlur: function onBlur(event) {
|
|
@@ -2861,7 +2876,7 @@ var RenderLayersConnect = function RenderLayersConnect(_ref) {
|
|
|
2861
2876
|
case 10:
|
|
2862
2877
|
_context.prev = 10;
|
|
2863
2878
|
_context.t0 = _context["catch"](0);
|
|
2864
|
-
console.warn(_context.t0.message);
|
|
2879
|
+
console.warn(_context.t0 instanceof Error ? _context.t0.message : 'addService failed');
|
|
2865
2880
|
case 13:
|
|
2866
2881
|
case "end":
|
|
2867
2882
|
return _context.stop();
|
|
@@ -3662,7 +3677,7 @@ var BaseLayers = function BaseLayers(_ref) {
|
|
|
3662
3677
|
// If already in selectedBaseLayers based on name or id, keep current id
|
|
3663
3678
|
var constructLayerId = function constructLayerId(baseLayer, selectedBaseLayers) {
|
|
3664
3679
|
var foundLayer = selectedBaseLayers.find(function (selectedBaseLayer) {
|
|
3665
|
-
return baseLayer.id === selectedBaseLayer.id || baseLayer.name === selectedBaseLayer.name;
|
|
3680
|
+
return (baseLayer == null ? void 0 : baseLayer.id) === (selectedBaseLayer == null ? void 0 : selectedBaseLayer.id) || baseLayer.name === selectedBaseLayer.name;
|
|
3666
3681
|
});
|
|
3667
3682
|
return foundLayer ? foundLayer.id : webmapUtils.generateLayerId();
|
|
3668
3683
|
};
|
|
@@ -3679,7 +3694,7 @@ var constructListAvailableBaseLayers = function constructListAvailableBaseLayers
|
|
|
3679
3694
|
// Ensure that current selected baselayer(s) are in the baseLayersWithMapId array, otherwise add them
|
|
3680
3695
|
return selectedBaseLayers.reduce(function (list, selectedBaseLayer) {
|
|
3681
3696
|
var foundLayer = baseLayersWithMapId.find(function (layer) {
|
|
3682
|
-
return layer.id === selectedBaseLayer.id;
|
|
3697
|
+
return layer.id === (selectedBaseLayer == null ? void 0 : selectedBaseLayer.id);
|
|
3683
3698
|
});
|
|
3684
3699
|
if (foundLayer) {
|
|
3685
3700
|
return list;
|
|
@@ -4707,9 +4722,9 @@ var ProjectionSelect = function ProjectionSelect(_ref) {
|
|
|
4707
4722
|
value: currentProjection,
|
|
4708
4723
|
list: availableProjections,
|
|
4709
4724
|
currentIndex: index,
|
|
4710
|
-
onChange: function onChange(
|
|
4711
|
-
|
|
4712
|
-
selectProjection(
|
|
4725
|
+
onChange: function onChange(event) {
|
|
4726
|
+
event.stopPropagation();
|
|
4727
|
+
selectProjection(event.target.value);
|
|
4713
4728
|
},
|
|
4714
4729
|
onChangeMouseWheel: function onChangeMouseWheel(e) {
|
|
4715
4730
|
return selectProjection(e.value);
|
|
@@ -5351,38 +5366,6 @@ var MultiMapMultiDimensionSelectConnect = function MultiMapMultiDimensionSelectC
|
|
|
5351
5366
|
});
|
|
5352
5367
|
};
|
|
5353
5368
|
|
|
5354
|
-
var ZoomControlConnect = function ZoomControlConnect(_ref) {
|
|
5355
|
-
var mapId = _ref.mapId;
|
|
5356
|
-
var isVisible = useSelector(function (store) {
|
|
5357
|
-
return mapSelectors.isZoomControlsVisible(store, mapId);
|
|
5358
|
-
});
|
|
5359
|
-
var adagucRef = React.useRef(null);
|
|
5360
|
-
React.useEffect(function () {
|
|
5361
|
-
var webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
5362
|
-
if (!webmapjs) {
|
|
5363
|
-
return;
|
|
5364
|
-
}
|
|
5365
|
-
adagucRef.current = webmapjs;
|
|
5366
|
-
}, [mapId]);
|
|
5367
|
-
var onZoomIn = function onZoomIn() {
|
|
5368
|
-
return adagucRef.current.zoomIn(undefined);
|
|
5369
|
-
};
|
|
5370
|
-
var onZoomOut = function onZoomOut() {
|
|
5371
|
-
return adagucRef.current.zoomOut();
|
|
5372
|
-
};
|
|
5373
|
-
var onZoomReset = function onZoomReset() {
|
|
5374
|
-
return adagucRef.current.zoomToLayer(adagucRef.current.getActiveLayer());
|
|
5375
|
-
};
|
|
5376
|
-
if (!isVisible) {
|
|
5377
|
-
return null;
|
|
5378
|
-
}
|
|
5379
|
-
return jsx(ZoomControls, {
|
|
5380
|
-
onZoomIn: onZoomIn,
|
|
5381
|
-
onZoomOut: onZoomOut,
|
|
5382
|
-
onZoomReset: onZoomReset
|
|
5383
|
-
});
|
|
5384
|
-
};
|
|
5385
|
-
|
|
5386
5369
|
/* *
|
|
5387
5370
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5388
5371
|
* you may not use this file except in compliance with the License.
|
|
@@ -5628,398 +5611,536 @@ var useKeyboardZoomAndPan = function useKeyboardZoomAndPan(mapIsActive, mapId, m
|
|
|
5628
5611
|
};
|
|
5629
5612
|
var PAN_STEP_PERCENTAGE = 0.02;
|
|
5630
5613
|
|
|
5631
|
-
var
|
|
5632
|
-
var ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION = 'ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION';
|
|
5633
|
-
/**
|
|
5634
|
-
* Connected component used to display the map and selected layers.
|
|
5635
|
-
* Includes options to disable the map controls and legend.
|
|
5636
|
-
*
|
|
5637
|
-
* Expects the following props:
|
|
5638
|
-
* @param {string} mapId mapId: string - Id of the map
|
|
5639
|
-
* @param {object} [controls.zoomControls] **optional** controls: object - toggle the map controls, zoomControls defaults to true
|
|
5640
|
-
* @param {boolean} [displayTimeInMap] **optional** displayTimeInMap: boolean, toggles the mapTime, defaults to true
|
|
5641
|
-
* @param {boolean} [showScaleBar] **optional** showScaleBar: boolean, toggles the scaleBar, defaults to true
|
|
5642
|
-
* @example
|
|
5643
|
-
* ```<MapViewConnect mapId={mapId} controls={{ zoomControls: false }} displayTimeInMap={false} showScaleBar={false}/>```
|
|
5644
|
-
*/
|
|
5645
|
-
var MapViewConnect = function MapViewConnect(_ref) {
|
|
5646
|
-
var _linkedFeatures$conca;
|
|
5614
|
+
var SearchControlButtonConnect = function SearchControlButtonConnect(_ref) {
|
|
5647
5615
|
var mapId = _ref.mapId,
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
var
|
|
5651
|
-
|
|
5652
|
-
var
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
return mapSelectors.getMapLayers(store, mapId);
|
|
5657
|
-
});
|
|
5658
|
-
var baseLayers = useSelector(function (store) {
|
|
5659
|
-
return mapSelectors.getMapBaseLayers(store, mapId);
|
|
5660
|
-
});
|
|
5661
|
-
var overLayers = useSelector(function (store) {
|
|
5662
|
-
return mapSelectors.getMapOverLayers(store, mapId);
|
|
5663
|
-
});
|
|
5664
|
-
var featureLayers = useSelector(function (store) {
|
|
5665
|
-
return mapSelectors.getMapFeatureLayers(store, mapId);
|
|
5666
|
-
});
|
|
5667
|
-
var linkedFeatures = useSelector(function (store) {
|
|
5668
|
-
var _store$syncronization;
|
|
5669
|
-
return genericSelectors.selectLinkedFeatures((_store$syncronization = store.syncronizationGroupStore) == null ? void 0 : _store$syncronization.linkedState, mapId);
|
|
5670
|
-
});
|
|
5671
|
-
var linkedFormFeatures = useSelector(function (store) {
|
|
5672
|
-
var _store$syncronization2;
|
|
5673
|
-
return genericSelectors.selectLinkedFormFeatures((_store$syncronization2 = store.syncronizationGroupStore) == null ? void 0 : _store$syncronization2.linkedState, mapId);
|
|
5674
|
-
});
|
|
5675
|
-
var bbox = useSelector(function (store) {
|
|
5676
|
-
return mapSelectors.getBbox(store, mapId);
|
|
5677
|
-
});
|
|
5678
|
-
var srs = useSelector(function (store) {
|
|
5679
|
-
return mapSelectors.getSrs(store, mapId);
|
|
5680
|
-
});
|
|
5681
|
-
var activeLayerId = useSelector(function (store) {
|
|
5682
|
-
return mapSelectors.getActiveLayerId(store, mapId);
|
|
5683
|
-
});
|
|
5684
|
-
var animationDelay = useSelector(function (store) {
|
|
5685
|
-
return mapSelectors.getMapAnimationDelay(store, mapId);
|
|
5686
|
-
});
|
|
5687
|
-
var mapPinLocation = useSelector(function (store) {
|
|
5688
|
-
return mapSelectors.getPinLocation(store, mapId);
|
|
5616
|
+
_ref$source = _ref.source,
|
|
5617
|
+
source = _ref$source === void 0 ? 'app' : _ref$source;
|
|
5618
|
+
var _useCoreTranslation = useCoreTranslation(),
|
|
5619
|
+
t = _useCoreTranslation.t;
|
|
5620
|
+
var dispatch = useDispatch();
|
|
5621
|
+
var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
|
|
5622
|
+
var currentActiveMapId = useSelector(function (store) {
|
|
5623
|
+
return uiSelectors.getDialogMapId(store, dialogType);
|
|
5689
5624
|
});
|
|
5690
|
-
var
|
|
5691
|
-
return
|
|
5625
|
+
var isOpenInStore = useSelector(function (store) {
|
|
5626
|
+
return uiSelectors.getisDialogOpen(store, dialogType);
|
|
5692
5627
|
});
|
|
5693
|
-
var
|
|
5694
|
-
|
|
5628
|
+
var openSearchDialog = React__default.useCallback(function () {
|
|
5629
|
+
dispatch(uiActions.setActiveMapIdForDialog({
|
|
5630
|
+
type: dialogType,
|
|
5631
|
+
mapId: mapId,
|
|
5632
|
+
setOpen: currentActiveMapId !== mapId ? true : !isOpenInStore,
|
|
5633
|
+
source: source
|
|
5634
|
+
}));
|
|
5635
|
+
}, [currentActiveMapId, dialogType, dispatch, isOpenInStore, mapId, source]);
|
|
5636
|
+
return jsx(MapControlButton, {
|
|
5637
|
+
onClick: openSearchDialog,
|
|
5638
|
+
title: t('search-title'),
|
|
5639
|
+
"aria-label": t('search-title-aria'),
|
|
5640
|
+
isActive: isOpenInStore,
|
|
5641
|
+
children: jsx(Search, {})
|
|
5695
5642
|
});
|
|
5696
|
-
|
|
5697
|
-
|
|
5643
|
+
};
|
|
5644
|
+
|
|
5645
|
+
var MY_LOCATION = 'My location';
|
|
5646
|
+
var locationOptions = {
|
|
5647
|
+
enableHighAccuracy: false,
|
|
5648
|
+
timeout: 10000,
|
|
5649
|
+
maximumAge: 0
|
|
5650
|
+
};
|
|
5651
|
+
var MyMapLocation = function MyMapLocation(_ref) {
|
|
5652
|
+
var _ref$mapId = _ref.mapId,
|
|
5653
|
+
mapId = _ref$mapId === void 0 ? '' : _ref$mapId,
|
|
5654
|
+
_ref$isSelected = _ref.isSelected,
|
|
5655
|
+
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
5656
|
+
_ref$onUpdateMyLocati = _ref.onUpdateMyLocation,
|
|
5657
|
+
onUpdateMyLocation = _ref$onUpdateMyLocati === void 0 ? function () {} : _ref$onUpdateMyLocati;
|
|
5658
|
+
var theme = useTheme();
|
|
5659
|
+
var _useState = useState(false),
|
|
5660
|
+
isLoading = _useState[0],
|
|
5661
|
+
setIsLoading = _useState[1];
|
|
5662
|
+
var _useState2 = useState(false),
|
|
5663
|
+
hasFailed = _useState2[0],
|
|
5664
|
+
setHasFailed = _useState2[1];
|
|
5665
|
+
var _useCoreTranslation = useCoreTranslation(),
|
|
5666
|
+
t = _useCoreTranslation.t;
|
|
5667
|
+
var handleLocationClick = function handleLocationClick() {
|
|
5668
|
+
if (mapId && isSelected) {
|
|
5669
|
+
onUpdateMyLocation(undefined);
|
|
5670
|
+
} else if (navigator.geolocation && mapId && !isSelected) {
|
|
5671
|
+
setIsLoading(true);
|
|
5672
|
+
setHasFailed(false);
|
|
5673
|
+
navigator.geolocation.getCurrentPosition(function (success) {
|
|
5674
|
+
setIsLoading(false);
|
|
5675
|
+
var _success$coords = success.coords,
|
|
5676
|
+
latitude = _success$coords.latitude,
|
|
5677
|
+
longitude = _success$coords.longitude;
|
|
5678
|
+
var location = {
|
|
5679
|
+
lat: latitude,
|
|
5680
|
+
lon: longitude,
|
|
5681
|
+
name: MY_LOCATION,
|
|
5682
|
+
source: 'MyMapLocation',
|
|
5683
|
+
id: MY_LOCATION
|
|
5684
|
+
};
|
|
5685
|
+
onUpdateMyLocation(location);
|
|
5686
|
+
}, function () {
|
|
5687
|
+
setIsLoading(false);
|
|
5688
|
+
setHasFailed(true);
|
|
5689
|
+
onUpdateMyLocation(undefined);
|
|
5690
|
+
}, locationOptions);
|
|
5691
|
+
}
|
|
5692
|
+
};
|
|
5693
|
+
var chooseIcon = function chooseIcon() {
|
|
5694
|
+
return hasFailed ? jsx(Exclamation, {
|
|
5695
|
+
style: {
|
|
5696
|
+
color: theme.palette.geowebColors.functional.error
|
|
5697
|
+
},
|
|
5698
|
+
"aria-label": "location error"
|
|
5699
|
+
}) : jsx(MyLocation, {
|
|
5700
|
+
"aria-label": "location default"
|
|
5701
|
+
});
|
|
5702
|
+
};
|
|
5703
|
+
return jsx(Box, {
|
|
5704
|
+
sx: {
|
|
5705
|
+
height: 40,
|
|
5706
|
+
padding: 1
|
|
5707
|
+
},
|
|
5708
|
+
children: isLoading ? jsx(CircularProgress, {
|
|
5709
|
+
size: 24,
|
|
5710
|
+
"aria-label": "Location loading",
|
|
5711
|
+
color: "secondary"
|
|
5712
|
+
}) : jsx(CustomIconButton, {
|
|
5713
|
+
tooltipTitle: t('search-my-location'),
|
|
5714
|
+
"aria-label": t('search-my-location'),
|
|
5715
|
+
onClick: handleLocationClick,
|
|
5716
|
+
isSelected: isSelected,
|
|
5717
|
+
variant: "tool",
|
|
5718
|
+
size: "small",
|
|
5719
|
+
children: chooseIcon()
|
|
5720
|
+
})
|
|
5698
5721
|
});
|
|
5699
|
-
|
|
5700
|
-
|
|
5722
|
+
};
|
|
5723
|
+
|
|
5724
|
+
/* *
|
|
5725
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5726
|
+
* you may not use this file except in compliance with the License.
|
|
5727
|
+
* You may obtain a copy of the License at
|
|
5728
|
+
*
|
|
5729
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5730
|
+
*
|
|
5731
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5732
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5733
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5734
|
+
* See the License for the specific language governing permissions and
|
|
5735
|
+
* limitations under the License.
|
|
5736
|
+
*
|
|
5737
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5738
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
5739
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
5740
|
+
* */
|
|
5741
|
+
var config = getConfig();
|
|
5742
|
+
var locationBaseUrl = config.GW_LOCATION_BASE_URL || '';
|
|
5743
|
+
var getLocationList = function getLocationList(search) {
|
|
5744
|
+
return fetch(locationBaseUrl + "/locations?search=" + search).then(handleResponse);
|
|
5745
|
+
};
|
|
5746
|
+
var getLocationDetail = function getLocationDetail(id, source) {
|
|
5747
|
+
return fetch(locationBaseUrl + "/locationdetail?id=" + id + "&source=" + source).then(handleResponse);
|
|
5748
|
+
};
|
|
5749
|
+
|
|
5750
|
+
/* *
|
|
5751
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5752
|
+
* you may not use this file except in compliance with the License.
|
|
5753
|
+
* You may obtain a copy of the License at
|
|
5754
|
+
*
|
|
5755
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5756
|
+
*
|
|
5757
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5758
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5759
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5760
|
+
* See the License for the specific language governing permissions and
|
|
5761
|
+
* limitations under the License.
|
|
5762
|
+
*
|
|
5763
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5764
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
5765
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
5766
|
+
* */
|
|
5767
|
+
var useLocationList = function useLocationList(search) {
|
|
5768
|
+
return useQuery({
|
|
5769
|
+
queryKey: ['location-list', search],
|
|
5770
|
+
queryFn: function queryFn() {
|
|
5771
|
+
return getLocationList(search);
|
|
5772
|
+
},
|
|
5773
|
+
enabled: !!search
|
|
5701
5774
|
});
|
|
5702
|
-
|
|
5703
|
-
|
|
5775
|
+
};
|
|
5776
|
+
var useLocationDetail = function useLocationDetail(_ref) {
|
|
5777
|
+
var id = _ref.id,
|
|
5778
|
+
source = _ref.source;
|
|
5779
|
+
return useQuery({
|
|
5780
|
+
queryKey: ['location-detail', {
|
|
5781
|
+
id: id,
|
|
5782
|
+
source: source
|
|
5783
|
+
}],
|
|
5784
|
+
queryFn: function queryFn() {
|
|
5785
|
+
return getLocationDetail(id, source);
|
|
5786
|
+
},
|
|
5787
|
+
enabled: !!id
|
|
5704
5788
|
});
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5789
|
+
};
|
|
5790
|
+
|
|
5791
|
+
var SearchDialog = function SearchDialog(_ref) {
|
|
5792
|
+
var isOpen = _ref.isOpen,
|
|
5793
|
+
_ref$mapId = _ref.mapId,
|
|
5794
|
+
mapId = _ref$mapId === void 0 ? '' : _ref$mapId,
|
|
5795
|
+
_ref$onSelectLocation = _ref.onSelectLocation,
|
|
5796
|
+
onSelectLocation = _ref$onSelectLocation === void 0 ? function () {} : _ref$onSelectLocation,
|
|
5797
|
+
_ref$onUpdateMyLocati = _ref.onUpdateMyLocation,
|
|
5798
|
+
onUpdateMyLocation = _ref$onUpdateMyLocati === void 0 ? function () {} : _ref$onUpdateMyLocati,
|
|
5799
|
+
_ref$isMyLocationSele = _ref.isMyLocationSelected,
|
|
5800
|
+
isMyLocationSelected = _ref$isMyLocationSele === void 0 ? false : _ref$isMyLocationSele;
|
|
5801
|
+
var theme = useTheme();
|
|
5802
|
+
var _useCoreTranslation = useCoreTranslation(),
|
|
5803
|
+
t = _useCoreTranslation.t;
|
|
5804
|
+
var _useState = useState(''),
|
|
5805
|
+
inputValue = _useState[0],
|
|
5806
|
+
setInputValue = _useState[1];
|
|
5807
|
+
var _useState2 = useState(null),
|
|
5808
|
+
selectedValue = _useState2[0],
|
|
5809
|
+
setSelectedValue = _useState2[1];
|
|
5810
|
+
var debouncedInputValue = useDebounce(inputValue, 300);
|
|
5811
|
+
var _useLocationList = useLocationList(debouncedInputValue),
|
|
5812
|
+
locationListData = _useLocationList.data;
|
|
5813
|
+
var _useLocationDetail = useLocationDetail({
|
|
5814
|
+
id: (selectedValue == null ? void 0 : selectedValue.id) || '',
|
|
5815
|
+
source: (selectedValue == null ? void 0 : selectedValue.source) || ''
|
|
5816
|
+
}),
|
|
5817
|
+
locationDetail = _useLocationDetail.data;
|
|
5818
|
+
useEffect(function () {
|
|
5819
|
+
onSelectLocation(locationDetail);
|
|
5820
|
+
}, [locationDetail, onSelectLocation]);
|
|
5821
|
+
return isOpen && mapId ? jsxs(Box, {
|
|
5822
|
+
sx: {
|
|
5823
|
+
display: 'flex',
|
|
5824
|
+
flexDirection: 'row',
|
|
5825
|
+
alignItems: 'center',
|
|
5826
|
+
position: 'absolute',
|
|
5827
|
+
pointerEvents: 'all',
|
|
5828
|
+
zIndex: 99,
|
|
5829
|
+
left: 50,
|
|
5830
|
+
top: 8,
|
|
5831
|
+
backgroundColor: theme.palette.geowebColors.textInputField["default"].fill,
|
|
5832
|
+
height: 40,
|
|
5833
|
+
boxShadow: theme.shadows[6],
|
|
5834
|
+
width: 'calc(100% - 50px)',
|
|
5835
|
+
maxWidth: 380
|
|
5836
|
+
},
|
|
5837
|
+
children: [jsx(MyMapLocation, {
|
|
5838
|
+
mapId: mapId,
|
|
5839
|
+
onUpdateMyLocation: onUpdateMyLocation,
|
|
5840
|
+
isSelected: isMyLocationSelected
|
|
5841
|
+
}), jsx(Autocomplete, {
|
|
5842
|
+
disablePortal: true,
|
|
5843
|
+
selectOnFocus: true,
|
|
5844
|
+
sx: {
|
|
5845
|
+
width: '100%',
|
|
5846
|
+
'&.MuiAutocomplete-root .MuiFilledInput-root': {
|
|
5847
|
+
height: 40,
|
|
5848
|
+
padding: '0px!important',
|
|
5849
|
+
'&:before, &:hover:before': {
|
|
5850
|
+
borderColor: 'transparent'
|
|
5851
|
+
}
|
|
5852
|
+
},
|
|
5853
|
+
'&.MuiAutocomplete-root .MuiInputLabel-root': {
|
|
5854
|
+
lineHeight: '16px',
|
|
5855
|
+
maxWidth: 'calc(100% - 40px)',
|
|
5856
|
+
':not(.MuiInputLabel-shrink)': {
|
|
5857
|
+
transform: 'translate(12px, 12px) scale(1)'
|
|
5858
|
+
}
|
|
5859
|
+
},
|
|
5860
|
+
'&.MuiAutocomplete-root .MuiFilledInput-input': {
|
|
5861
|
+
lineHeight: '20px',
|
|
5862
|
+
paddingLeft: '12px',
|
|
5863
|
+
paddingTop: '20px'
|
|
5864
|
+
}
|
|
5865
|
+
},
|
|
5866
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
5867
|
+
return option.name;
|
|
5868
|
+
},
|
|
5869
|
+
filterOptions: function filterOptions(x) {
|
|
5870
|
+
return x;
|
|
5871
|
+
},
|
|
5872
|
+
options: locationListData || [],
|
|
5873
|
+
noOptionsText: t('search-no-results'),
|
|
5874
|
+
popupIcon: null,
|
|
5875
|
+
clearIcon: null,
|
|
5876
|
+
onChange: function onChange(_event, newValue) {
|
|
5877
|
+
if (newValue && typeof newValue !== 'string') {
|
|
5878
|
+
setSelectedValue(newValue);
|
|
5879
|
+
setInputValue(newValue.name);
|
|
5880
|
+
}
|
|
5881
|
+
},
|
|
5882
|
+
value: selectedValue,
|
|
5883
|
+
inputValue: inputValue,
|
|
5884
|
+
isOptionEqualToValue: function isOptionEqualToValue(option, value) {
|
|
5885
|
+
return option.id === value.id;
|
|
5886
|
+
},
|
|
5887
|
+
renderInput: function renderInput(params) {
|
|
5888
|
+
return jsx(TextField, Object.assign({}, params, {
|
|
5889
|
+
autoFocus: true,
|
|
5890
|
+
size: "medium",
|
|
5891
|
+
label: t('search-title-long'),
|
|
5892
|
+
fullWidth: true,
|
|
5893
|
+
variant: "filled",
|
|
5894
|
+
onChange: function onChange(event) {
|
|
5895
|
+
setInputValue(event.target.value);
|
|
5896
|
+
if (selectedValue) {
|
|
5897
|
+
setSelectedValue(null);
|
|
5898
|
+
}
|
|
5899
|
+
},
|
|
5900
|
+
InputProps: Object.assign({}, params.InputProps, {
|
|
5901
|
+
endAdornment: jsx(CustomIconButton, {
|
|
5902
|
+
tooltipTitle: t('search-clear'),
|
|
5903
|
+
onClick: function onClick() {
|
|
5904
|
+
setInputValue('');
|
|
5905
|
+
setSelectedValue(null);
|
|
5906
|
+
},
|
|
5907
|
+
sx: {
|
|
5908
|
+
marginRight: 1
|
|
5909
|
+
},
|
|
5910
|
+
children: jsx(Close, {})
|
|
5911
|
+
})
|
|
5912
|
+
})
|
|
5913
|
+
}));
|
|
5715
5914
|
}
|
|
5915
|
+
})]
|
|
5916
|
+
}) : null;
|
|
5917
|
+
};
|
|
5918
|
+
|
|
5919
|
+
/* *
|
|
5920
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5921
|
+
* you may not use this file except in compliance with the License.
|
|
5922
|
+
* You may obtain a copy of the License at
|
|
5923
|
+
*
|
|
5924
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5925
|
+
*
|
|
5926
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5927
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5928
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5929
|
+
* See the License for the specific language governing permissions and
|
|
5930
|
+
* limitations under the License.
|
|
5931
|
+
*
|
|
5932
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5933
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
5934
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
5935
|
+
* */
|
|
5936
|
+
var myLocationDrawFunction = function myLocationDrawFunction(args) {
|
|
5937
|
+
var ctx = args.context,
|
|
5938
|
+
coord = args.coord;
|
|
5939
|
+
// Draw outer circle
|
|
5940
|
+
ctx.fillStyle = '#fff';
|
|
5941
|
+
ctx.shadowColor = '#00000080';
|
|
5942
|
+
ctx.shadowBlur = 4;
|
|
5943
|
+
ctx.beginPath();
|
|
5944
|
+
ctx.arc(coord.x, coord.y, 14, 0, 2 * Math.PI);
|
|
5945
|
+
ctx.fill();
|
|
5946
|
+
ctx.shadowBlur = 0;
|
|
5947
|
+
// Draw inner circle
|
|
5948
|
+
ctx.fillStyle = '#186dff';
|
|
5949
|
+
ctx.beginPath();
|
|
5950
|
+
ctx.arc(coord.x, coord.y, 10, 0, 2 * Math.PI);
|
|
5951
|
+
ctx.fill();
|
|
5952
|
+
};
|
|
5953
|
+
var selectedLocationDrawFunction = function selectedLocationDrawFunction(args) {
|
|
5954
|
+
var ctx = args.context,
|
|
5955
|
+
coord = args.coord;
|
|
5956
|
+
ctx.fillStyle = '#051039';
|
|
5957
|
+
ctx.beginPath();
|
|
5958
|
+
var topRadius = 7;
|
|
5959
|
+
var topHeight = 2 * topRadius;
|
|
5960
|
+
ctx.arc(coord.x, coord.y - topHeight, topRadius, Math.PI, Math.PI * 2);
|
|
5961
|
+
ctx.bezierCurveTo(coord.x + topRadius, coord.y - topHeight, coord.x + topRadius / 1.6, coord.y - topRadius, coord.x, coord.y);
|
|
5962
|
+
ctx.bezierCurveTo(coord.x, coord.y, coord.x - topRadius / 1.6, coord.y - topRadius, coord.x - topRadius, coord.y - topHeight);
|
|
5963
|
+
ctx.stroke();
|
|
5964
|
+
ctx.fill();
|
|
5965
|
+
/* Fill center circle */
|
|
5966
|
+
ctx.fillStyle = '#FFF';
|
|
5967
|
+
ctx.beginPath();
|
|
5968
|
+
ctx.arc(coord.x, coord.y - topHeight, topRadius / 2.5, Math.PI * 2, 0);
|
|
5969
|
+
ctx.fill();
|
|
5970
|
+
};
|
|
5971
|
+
var makeGeoJSONFeatureFromLocation = function makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId) {
|
|
5972
|
+
var newGeoJSON = cloneDeep(simplePointsGeojson);
|
|
5973
|
+
newGeoJSON.features = [{
|
|
5974
|
+
type: 'Feature',
|
|
5975
|
+
properties: {
|
|
5976
|
+
name: location.name,
|
|
5977
|
+
drawFunctionId: drawFunctionId,
|
|
5978
|
+
hoverDrawFunctionId: hoverDrawFunctionId
|
|
5979
|
+
},
|
|
5980
|
+
geometry: {
|
|
5981
|
+
type: 'Point',
|
|
5982
|
+
coordinates: [location.lon, location.lat]
|
|
5716
5983
|
}
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
var
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
var
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
var
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5984
|
+
}];
|
|
5985
|
+
return newGeoJSON;
|
|
5986
|
+
};
|
|
5987
|
+
var fitText = function fitText(ctx, text, x, y, lineheight) {
|
|
5988
|
+
var lines = text.split('\n');
|
|
5989
|
+
for (var i = 0; i < lines.length; i += 1) {
|
|
5990
|
+
ctx.fillText(lines[i], x, y + i * lineheight);
|
|
5991
|
+
}
|
|
5992
|
+
};
|
|
5993
|
+
var roundRect = function roundRect(ctx, w, h, x, y, radius) {
|
|
5994
|
+
if (radius === void 0) {
|
|
5995
|
+
radius = 2;
|
|
5996
|
+
}
|
|
5997
|
+
var r = x + w;
|
|
5998
|
+
var b = y + h;
|
|
5999
|
+
ctx.beginPath();
|
|
6000
|
+
ctx.moveTo(x + radius, y);
|
|
6001
|
+
ctx.lineTo(r - radius, y);
|
|
6002
|
+
ctx.quadraticCurveTo(r, y, r, y + radius);
|
|
6003
|
+
ctx.lineTo(r, y + h - radius);
|
|
6004
|
+
ctx.quadraticCurveTo(r, b, r - radius, b);
|
|
6005
|
+
ctx.lineTo(x + radius, b);
|
|
6006
|
+
ctx.quadraticCurveTo(x, b, x, b - radius);
|
|
6007
|
+
ctx.lineTo(x, y + radius);
|
|
6008
|
+
ctx.quadraticCurveTo(x, y, x + radius, y);
|
|
6009
|
+
ctx.stroke();
|
|
6010
|
+
ctx.fill();
|
|
6011
|
+
};
|
|
6012
|
+
var hoverDrawFunction = function hoverDrawFunction(args) {
|
|
6013
|
+
var ctx = args.context,
|
|
6014
|
+
coord = args.coord,
|
|
6015
|
+
feature = args.feature;
|
|
6016
|
+
var fontSize = 16;
|
|
6017
|
+
var padding = 20;
|
|
6018
|
+
// eslint-disable-next-line no-param-reassign
|
|
6019
|
+
ctx.font = fontSize + "px Roboto";
|
|
6020
|
+
var x = coord.x,
|
|
6021
|
+
y = coord.y;
|
|
6022
|
+
ctx.fillStyle = '#000';
|
|
6023
|
+
roundRect(ctx, ctx.measureText(feature.properties.name).width + padding, fontSize + padding, x - padding * 0.5 - ctx.measureText(feature.properties.name).width * 0.5, y + padding);
|
|
6024
|
+
// eslint-disable-next-line no-param-reassign
|
|
6025
|
+
ctx.fillStyle = '#FFF';
|
|
6026
|
+
// eslint-disable-next-line no-param-reassign
|
|
6027
|
+
ctx.textAlign = 'left';
|
|
6028
|
+
if (feature && feature.properties) {
|
|
6029
|
+
fitText(ctx, feature.properties.name, x - ctx.measureText(feature.properties.name).width * 0.5, y + padding * 2, fontSize);
|
|
6030
|
+
}
|
|
6031
|
+
};
|
|
6032
|
+
var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
|
|
6033
|
+
var dispatch = useDispatch();
|
|
6034
|
+
var layerId = React__default.useRef(generateLayerId()).current;
|
|
6035
|
+
var isMapPresent = useSelector(function (store) {
|
|
6036
|
+
return mapSelectors.getIsMapPresent(store, mapId);
|
|
6037
|
+
});
|
|
6038
|
+
var isLayerPresent = useSelector(function (store) {
|
|
6039
|
+
return layerSelectors.getIsLayerPresent(store, layerId);
|
|
6040
|
+
});
|
|
6041
|
+
var shouldAddLayer = isMapPresent && !isLayerPresent;
|
|
6042
|
+
React__default.useEffect(function () {
|
|
6043
|
+
if (shouldAddLayer) {
|
|
6044
|
+
dispatch(layerActions.addLayer({
|
|
6045
|
+
mapId: mapId,
|
|
6046
|
+
layerId: layerId,
|
|
6047
|
+
layer: {
|
|
6048
|
+
geojson: emptyGeoJSON,
|
|
6049
|
+
layerType: LayerType.featureLayer
|
|
6050
|
+
},
|
|
6051
|
+
origin: 'SearchDialogConnect'
|
|
6052
|
+
}));
|
|
6053
|
+
}
|
|
6054
|
+
}, [dispatch, layerId, mapId, shouldAddLayer]);
|
|
6055
|
+
var drawFunctionId = React__default.useRef(registerDrawFunction(drawFunction)).current;
|
|
6056
|
+
var hoverDrawFunctionId = React__default.useRef(registerDrawFunction(hoverDrawFunction)).current;
|
|
6057
|
+
var updateGeoJSON = React__default.useCallback(function (location) {
|
|
6058
|
+
var geojson = location ? makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId) : emptyGeoJSON;
|
|
5769
6059
|
dispatch(layerActions.updateFeature({
|
|
5770
|
-
geojson: geojson,
|
|
5771
|
-
reason: reason,
|
|
5772
6060
|
layerId: layerId,
|
|
5773
|
-
|
|
5774
|
-
geoJSONIntersectionLayerId: drawtoolSelectors.getGeoJSONIntersectionLayerId(store.getState(), activeDrawToolId),
|
|
5775
|
-
geoJSONIntersectionBoundsLayerId: drawtoolSelectors.getGeoJSONIntersectionBoundsLayerId(store.getState(), activeDrawToolId),
|
|
5776
|
-
selectionType: activeDrawMode == null ? void 0 : activeDrawMode.selectionType
|
|
6061
|
+
geojson: geojson
|
|
5777
6062
|
}));
|
|
5778
|
-
}, [dispatch,
|
|
5779
|
-
var
|
|
5780
|
-
var
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
6063
|
+
}, [dispatch, drawFunctionId, hoverDrawFunctionId, layerId]);
|
|
6064
|
+
var zoomToFeature = React__default.useCallback(function (location) {
|
|
6065
|
+
var webMap = getWMJSMapById(mapId);
|
|
6066
|
+
if (webMap) {
|
|
6067
|
+
webMap.calculateBoundingBoxAndZoom(location.lat, location.lon);
|
|
6068
|
+
}
|
|
6069
|
+
}, [mapId]);
|
|
6070
|
+
var onUpdateLocation = React__default.useCallback(function (location) {
|
|
6071
|
+
updateGeoJSON(location);
|
|
6072
|
+
if (location) {
|
|
6073
|
+
zoomToFeature(location);
|
|
6074
|
+
}
|
|
6075
|
+
}, [updateGeoJSON, zoomToFeature]);
|
|
6076
|
+
return [onUpdateLocation];
|
|
6077
|
+
};
|
|
6078
|
+
|
|
6079
|
+
var SearchDialogConnect = function SearchDialogConnect(_ref) {
|
|
6080
|
+
var _ref$mapId = _ref.mapId,
|
|
6081
|
+
mapId = _ref$mapId === void 0 ? '' : _ref$mapId;
|
|
6082
|
+
var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
|
|
6083
|
+
var _useSetupDialog = useSetupDialog(dialogType),
|
|
6084
|
+
isDialogOpen = _useSetupDialog.isDialogOpen;
|
|
6085
|
+
var _useDrawOnMap = useDrawOnMap(mapId, selectedLocationDrawFunction),
|
|
6086
|
+
updateMapPin = _useDrawOnMap[0];
|
|
6087
|
+
var _useDrawOnMap2 = useDrawOnMap(mapId, myLocationDrawFunction),
|
|
6088
|
+
updateMyLocation = _useDrawOnMap2[0];
|
|
6089
|
+
var mapLayers = useSelector(function (store) {
|
|
6090
|
+
return layerSelectors.getLayersByMapId(store, mapId);
|
|
5791
6091
|
});
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
6092
|
+
var myLocationLayer = mapLayers.find(function (layer) {
|
|
6093
|
+
var _layer$geojson;
|
|
6094
|
+
if ((_layer$geojson = layer.geojson) != null && (_layer$geojson = _layer$geojson.features[0]) != null && (_layer$geojson = _layer$geojson.properties) != null && _layer$geojson.name) {
|
|
6095
|
+
if (layer.geojson.features[0].properties.name === MY_LOCATION) {
|
|
6096
|
+
return true;
|
|
6097
|
+
}
|
|
6098
|
+
}
|
|
6099
|
+
return false;
|
|
6100
|
+
});
|
|
6101
|
+
var isMyLocationSelected = !!myLocationLayer;
|
|
6102
|
+
return jsx(SearchDialog, {
|
|
6103
|
+
isOpen: isDialogOpen,
|
|
6104
|
+
mapId: mapId,
|
|
6105
|
+
onSelectLocation: updateMapPin,
|
|
6106
|
+
onUpdateMyLocation: updateMyLocation,
|
|
6107
|
+
isMyLocationSelected: isMyLocationSelected
|
|
6108
|
+
});
|
|
6109
|
+
};
|
|
6110
|
+
|
|
6111
|
+
var ZoomControlConnect = function ZoomControlConnect(_ref) {
|
|
6112
|
+
var mapId = _ref.mapId;
|
|
6113
|
+
var isVisible = useSelector(function (store) {
|
|
6114
|
+
return mapSelectors.isZoomControlsVisible(store, mapId);
|
|
6115
|
+
});
|
|
6116
|
+
var adagucRef = React.useRef(null);
|
|
5802
6117
|
React.useEffect(function () {
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
}
|
|
5815
|
-
var
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
}
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
}));
|
|
5826
|
-
}, [dispatch, mapId]);
|
|
5827
|
-
var onGetCapabilitiesLoadStart = React.useCallback(function () {
|
|
5828
|
-
dispatch(loadingIndicatorActions.setGetCapabilitiesIsLoading({
|
|
5829
|
-
id: mapId,
|
|
5830
|
-
isGetCapabilitiesLoading: true
|
|
5831
|
-
}));
|
|
5832
|
-
}, [dispatch, mapId]);
|
|
5833
|
-
var onGetCapabilitiesLoadReady = React.useCallback(function () {
|
|
5834
|
-
dispatch(loadingIndicatorActions.setGetCapabilitiesIsLoading({
|
|
5835
|
-
id: mapId,
|
|
5836
|
-
isGetCapabilitiesLoading: false
|
|
5837
|
-
}));
|
|
5838
|
-
}, [dispatch, mapId]);
|
|
5839
|
-
var isTimeScrollingEnabled = useSelector(syncGroupsSelectors.isTimeScrollingEnabled);
|
|
5840
|
-
var _useSelector = useSelector(function (state) {
|
|
5841
|
-
return genericSelectors.selectSharedData(state, linkedPanelId);
|
|
5842
|
-
}),
|
|
5843
|
-
hoverId = _useSelector.hoverId;
|
|
5844
|
-
var debouncedSetHoverFeature = React.useMemo(function () {
|
|
5845
|
-
return debounce(function (featureId) {
|
|
5846
|
-
return dispatch(genericActions.addSharedData({
|
|
5847
|
-
panelId: linkedPanelId,
|
|
5848
|
-
data: {
|
|
5849
|
-
hoverId: featureId
|
|
5850
|
-
}
|
|
5851
|
-
}));
|
|
5852
|
-
}, 200);
|
|
5853
|
-
}, [dispatch, linkedPanelId]);
|
|
5854
|
-
return jsx("div", {
|
|
5855
|
-
style: {
|
|
5856
|
-
height: '100%'
|
|
5857
|
-
},
|
|
5858
|
-
ref: mapRef,
|
|
5859
|
-
children: jsxs(MapView, Object.assign({}, props, {
|
|
5860
|
-
mapId: mapId,
|
|
5861
|
-
linkedFeatures: {
|
|
5862
|
-
type: 'FeatureCollection',
|
|
5863
|
-
features: linkedFeatures.flatMap(function (feature) {
|
|
5864
|
-
return feature.geoJSON.features;
|
|
5865
|
-
})
|
|
5866
|
-
},
|
|
5867
|
-
isTimeScrollingEnabled: isTimeScrollingEnabled,
|
|
5868
|
-
srs: srs,
|
|
5869
|
-
bbox: bbox,
|
|
5870
|
-
mapPinLocation: displayMapPin ? selectedFeatureCoordinates || mapPinLocation : undefined,
|
|
5871
|
-
dimensions: mapDimensions,
|
|
5872
|
-
activeLayerId: activeLayerId,
|
|
5873
|
-
animationDelay: animationDelay,
|
|
5874
|
-
timestep: timestep,
|
|
5875
|
-
displayMapPin: displayMapPin,
|
|
5876
|
-
disableMapPin: disableMapPin,
|
|
5877
|
-
onMapChangeDimension: function onMapChangeDimension(mapDimensionPayload) {
|
|
5878
|
-
if (mapDimensionPayload && mapDimensionPayload.dimension && mapDimensionPayload.dimension.name && mapDimensionPayload.dimension.name === 'time') {
|
|
5879
|
-
setTime({
|
|
5880
|
-
sourceId: mapId,
|
|
5881
|
-
origin: mapDimensionPayload.origin + "==> " + ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION,
|
|
5882
|
-
value: handleDateUtilsISOString(mapDimensionPayload.dimension.currentValue)
|
|
5883
|
-
});
|
|
5884
|
-
} else {
|
|
5885
|
-
mapChangeDimension(mapDimensionPayload);
|
|
5886
|
-
}
|
|
5887
|
-
},
|
|
5888
|
-
onUpdateLayerInformation: updateLayerInformation,
|
|
5889
|
-
onMapPinChangeLocation: mapPinChangeLocation,
|
|
5890
|
-
onMapZoomEnd: function onMapZoomEnd(a) {
|
|
5891
|
-
genericSetBbox({
|
|
5892
|
-
bbox: a.bbox,
|
|
5893
|
-
srs: a.srs,
|
|
5894
|
-
sourceId: mapId,
|
|
5895
|
-
origin: mapEnums.MapActionOrigin.map,
|
|
5896
|
-
mapId: mapId
|
|
5897
|
-
});
|
|
5898
|
-
},
|
|
5899
|
-
onWMJSMount: function onWMJSMount(mapId) {
|
|
5900
|
-
var wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
5901
|
-
if (!wmjsMap) {
|
|
5902
|
-
return;
|
|
5903
|
-
}
|
|
5904
|
-
wmjsMap.getListener().addEventListener('onloadstart', onGetMapLoadStart);
|
|
5905
|
-
wmjsMap.getListener().addEventListener('onloadready', onGetMapLoadReady);
|
|
5906
|
-
wmServiceListener.addEventListener(EVENT_GETCAPABILITIES_START, onGetCapabilitiesLoadStart, true);
|
|
5907
|
-
wmServiceListener.addEventListener(EVENT_GETCAPABILITIES_READY, onGetCapabilitiesLoadReady, true);
|
|
5908
|
-
},
|
|
5909
|
-
onWMJSUnMount: function onWMJSUnMount(mapId) {
|
|
5910
|
-
unRegister(mapId);
|
|
5911
|
-
wmServiceListener.removeEventListener(EVENT_GETCAPABILITIES_START, onGetCapabilitiesLoadStart);
|
|
5912
|
-
wmServiceListener.removeEventListener(EVENT_GETCAPABILITIES_READY, onGetCapabilitiesLoadReady);
|
|
5913
|
-
},
|
|
5914
|
-
children: [baseLayers.map(function (layer) {
|
|
5915
|
-
return jsx(MapViewLayer, Object.assign({
|
|
5916
|
-
id: "baselayer-" + layer.id,
|
|
5917
|
-
onLayerError: function onLayerError(_, error) {
|
|
5918
|
-
layerError({
|
|
5919
|
-
layerId: layer.id,
|
|
5920
|
-
error: Error("" + error)
|
|
5921
|
-
});
|
|
5922
|
-
}
|
|
5923
|
-
}, layer), layer.id);
|
|
5924
|
-
}), layers.map(function (layer) {
|
|
5925
|
-
return jsx(MapViewLayer, Object.assign({
|
|
5926
|
-
id: "layer-" + layer.id,
|
|
5927
|
-
onLayerError: function onLayerError(_, error) {
|
|
5928
|
-
layerError({
|
|
5929
|
-
layerId: layer.id,
|
|
5930
|
-
error: Error("" + error)
|
|
5931
|
-
});
|
|
5932
|
-
}
|
|
5933
|
-
}, layer), layer.id);
|
|
5934
|
-
}), (_linkedFeatures$conca = linkedFeatures.concat(linkedFormFeatures)) == null ? void 0 : _linkedFeatures$conca.map(function (feature) {
|
|
5935
|
-
return jsx(MapViewLayer, {
|
|
5936
|
-
id: feature.id,
|
|
5937
|
-
geojson: feature == null ? void 0 : feature.geoJSON,
|
|
5938
|
-
onHoverFeature: function onHoverFeature(hoverInfo) {
|
|
5939
|
-
if (hoverInfo === undefined && hoverId !== undefined) {
|
|
5940
|
-
debouncedSetHoverFeature();
|
|
5941
|
-
} else if (hoverInfo != null && hoverInfo.feature && feature.originalId !== hoverId) {
|
|
5942
|
-
debouncedSetHoverFeature(feature.originalId);
|
|
5943
|
-
}
|
|
5944
|
-
},
|
|
5945
|
-
onClickFeature: function onClickFeature(event) {
|
|
5946
|
-
var _event$feature$proper;
|
|
5947
|
-
var isClickOutsideFeature = !event || !event.feature;
|
|
5948
|
-
if (isClickOutsideFeature) {
|
|
5949
|
-
if (mapPinLocation) {
|
|
5950
|
-
handleFeatureSelect(linkedPanelId, undefined);
|
|
5951
|
-
}
|
|
5952
|
-
return;
|
|
5953
|
-
}
|
|
5954
|
-
// Handle clicks on station
|
|
5955
|
-
var clickedFeatureName = (_event$feature$proper = event.feature.properties) == null ? void 0 : _event$feature$proper.name;
|
|
5956
|
-
var features = linkedFeatures[0].geoJSON.features;
|
|
5957
|
-
var clickedFeatureIndex = features.findIndex(function (feature) {
|
|
5958
|
-
var _feature$properties;
|
|
5959
|
-
return ((_feature$properties = feature.properties) == null ? void 0 : _feature$properties.name) === clickedFeatureName;
|
|
5960
|
-
});
|
|
5961
|
-
if (disableMapPin === false) {
|
|
5962
|
-
var _selectedFeature$id;
|
|
5963
|
-
var selectedFeature = features[clickedFeatureIndex];
|
|
5964
|
-
handleFeatureSelect(linkedPanelId, (_selectedFeature$id = selectedFeature.id) == null ? void 0 : _selectedFeature$id.toString());
|
|
5965
|
-
}
|
|
5966
|
-
}
|
|
5967
|
-
}, feature.id);
|
|
5968
|
-
}), featureLayers.map(function (layer) {
|
|
5969
|
-
return jsx(MapViewLayer, Object.assign({
|
|
5970
|
-
id: "featurelayer-" + layer.id,
|
|
5971
|
-
onLayerError: function onLayerError(_, error) {
|
|
5972
|
-
layerError({
|
|
5973
|
-
layerId: layer.id,
|
|
5974
|
-
error: Error("" + error)
|
|
5975
|
-
});
|
|
5976
|
-
},
|
|
5977
|
-
onClickFeature: function onClickFeature(event) {
|
|
5978
|
-
var isClickOutsideFeature = !event;
|
|
5979
|
-
if (isClickOutsideFeature && !layer.isInEditMode) {
|
|
5980
|
-
setSelectedFeature({
|
|
5981
|
-
layerId: layer.id,
|
|
5982
|
-
selectedFeatureIndex: undefined
|
|
5983
|
-
});
|
|
5984
|
-
return;
|
|
5985
|
-
}
|
|
5986
|
-
if ((event == null ? void 0 : event.isInEditMode) === false) {
|
|
5987
|
-
setSelectedFeature({
|
|
5988
|
-
layerId: layer.id,
|
|
5989
|
-
selectedFeatureIndex: event.featureIndex
|
|
5990
|
-
});
|
|
5991
|
-
}
|
|
5992
|
-
},
|
|
5993
|
-
updateGeojson: function updateGeojson(geojson, reason) {
|
|
5994
|
-
updateFeature({
|
|
5995
|
-
geojson: geojson,
|
|
5996
|
-
layerId: layer.id,
|
|
5997
|
-
reason: reason
|
|
5998
|
-
});
|
|
5999
|
-
},
|
|
6000
|
-
exitDrawModeCallback: function exitDrawModeCallback(reason) {
|
|
6001
|
-
return exitFeatureDrawMode({
|
|
6002
|
-
reason: reason,
|
|
6003
|
-
layerId: layer.id
|
|
6004
|
-
});
|
|
6005
|
-
}
|
|
6006
|
-
}, layer), layer.id);
|
|
6007
|
-
}), overLayers.map(function (layer) {
|
|
6008
|
-
return jsx(MapViewLayer, Object.assign({
|
|
6009
|
-
id: "baselayer-" + layer.id,
|
|
6010
|
-
onLayerError: function onLayerError(_, error) {
|
|
6011
|
-
layerError({
|
|
6012
|
-
layerId: layer.id,
|
|
6013
|
-
error: Error("" + error)
|
|
6014
|
-
});
|
|
6015
|
-
}
|
|
6016
|
-
}, layer), layer.id);
|
|
6017
|
-
}), children]
|
|
6018
|
-
}))
|
|
6118
|
+
var webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
6119
|
+
if (!webmapjs) {
|
|
6120
|
+
return;
|
|
6121
|
+
}
|
|
6122
|
+
adagucRef.current = webmapjs;
|
|
6123
|
+
}, [mapId]);
|
|
6124
|
+
var onZoomIn = function onZoomIn() {
|
|
6125
|
+
return adagucRef.current.zoomIn(undefined);
|
|
6126
|
+
};
|
|
6127
|
+
var onZoomOut = function onZoomOut() {
|
|
6128
|
+
return adagucRef.current.zoomOut();
|
|
6129
|
+
};
|
|
6130
|
+
var onZoomReset = function onZoomReset() {
|
|
6131
|
+
return adagucRef.current.zoomToLayer(adagucRef.current.getActiveLayer());
|
|
6132
|
+
};
|
|
6133
|
+
if (!isVisible) {
|
|
6134
|
+
return null;
|
|
6135
|
+
}
|
|
6136
|
+
return jsx(ZoomControls, {
|
|
6137
|
+
onZoomIn: onZoomIn,
|
|
6138
|
+
onZoomOut: onZoomOut,
|
|
6139
|
+
onZoomReset: onZoomReset
|
|
6019
6140
|
});
|
|
6020
6141
|
};
|
|
6021
6142
|
|
|
6022
|
-
var _excluded$
|
|
6143
|
+
var _excluded$2 = ["showMapId"];
|
|
6023
6144
|
var LegendConnectComponent = function LegendConnectComponent(_ref) {
|
|
6024
6145
|
var _ref$showMapId = _ref.showMapId,
|
|
6025
6146
|
showMapId = _ref$showMapId === void 0 ? false : _ref$showMapId,
|
|
@@ -6073,7 +6194,7 @@ var LegendConnectComponent = function LegendConnectComponent(_ref) {
|
|
|
6073
6194
|
var LegendConnect = function LegendConnect(_ref2) {
|
|
6074
6195
|
var _ref2$showMapId = _ref2.showMapId,
|
|
6075
6196
|
showMapId = _ref2$showMapId === void 0 ? false : _ref2$showMapId,
|
|
6076
|
-
props = _objectWithoutPropertiesLoose(_ref2, _excluded$
|
|
6197
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded$2);
|
|
6077
6198
|
return jsx(LegendConnectComponent, Object.assign({
|
|
6078
6199
|
showMapId: showMapId
|
|
6079
6200
|
}, props));
|
|
@@ -6262,7 +6383,7 @@ var GetFeatureInfoDialog = function GetFeatureInfoDialog(_ref) {
|
|
|
6262
6383
|
case 9:
|
|
6263
6384
|
_context.prev = 9;
|
|
6264
6385
|
_context.t0 = _context["catch"](0);
|
|
6265
|
-
errorMessage = _context.t0.message;
|
|
6386
|
+
errorMessage = _context.t0 instanceof Error ? _context.t0.message : 'fetchLayerInfo failed';
|
|
6266
6387
|
updateLayerResult({
|
|
6267
6388
|
layerId: layerId,
|
|
6268
6389
|
data: errorMessage,
|
|
@@ -6451,279 +6572,452 @@ var GetFeatureInfoButtonConnect = function GetFeatureInfoButtonConnect(_ref) {
|
|
|
6451
6572
|
var isOpenInStore = useSelector(function (store) {
|
|
6452
6573
|
return uiSelectors.getisDialogOpen(store, gfiType);
|
|
6453
6574
|
});
|
|
6454
|
-
var openGfiDialog = React.useCallback(function () {
|
|
6455
|
-
dispatch(uiActions.setActiveMapIdForDialog({
|
|
6456
|
-
type: gfiType,
|
|
6457
|
-
mapId: mapId,
|
|
6458
|
-
setOpen: !isOpenInStore,
|
|
6459
|
-
source: source,
|
|
6460
|
-
origin: mapEnums.MapActionOrigin.map
|
|
6461
|
-
}));
|
|
6462
|
-
}, [mapId, dispatch, isOpenInStore, source, gfiType]);
|
|
6463
|
-
return jsx(MapControlButton, {
|
|
6464
|
-
title: t('feature_info_location_info'),
|
|
6465
|
-
"data-testid": "open-getfeatureinfo",
|
|
6466
|
-
onClick: openGfiDialog,
|
|
6467
|
-
isActive: isOpenInStore,
|
|
6468
|
-
children: jsx(Info, {})
|
|
6575
|
+
var openGfiDialog = React.useCallback(function () {
|
|
6576
|
+
dispatch(uiActions.setActiveMapIdForDialog({
|
|
6577
|
+
type: gfiType,
|
|
6578
|
+
mapId: mapId,
|
|
6579
|
+
setOpen: !isOpenInStore,
|
|
6580
|
+
source: source,
|
|
6581
|
+
origin: mapEnums.MapActionOrigin.map
|
|
6582
|
+
}));
|
|
6583
|
+
}, [mapId, dispatch, isOpenInStore, source, gfiType]);
|
|
6584
|
+
return jsx(MapControlButton, {
|
|
6585
|
+
title: t('feature_info_location_info'),
|
|
6586
|
+
"data-testid": "open-getfeatureinfo",
|
|
6587
|
+
onClick: openGfiDialog,
|
|
6588
|
+
isActive: isOpenInStore,
|
|
6589
|
+
children: jsx(Info, {})
|
|
6590
|
+
});
|
|
6591
|
+
};
|
|
6592
|
+
|
|
6593
|
+
var _excluded$1 = ["mapId", "children", "controls"];
|
|
6594
|
+
var ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION = 'ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION';
|
|
6595
|
+
/**
|
|
6596
|
+
* Connected component used to display the map and selected layers.
|
|
6597
|
+
* Includes options to disable the map controls and legend.
|
|
6598
|
+
*
|
|
6599
|
+
* Expects the following props:
|
|
6600
|
+
* @param {string} mapId mapId: string - Id of the map
|
|
6601
|
+
* @param {object} [controls.zoomControls] **optional** controls: object - toggle the map controls, zoomControls defaults to true
|
|
6602
|
+
* @param {boolean} [displayTimeInMap] **optional** displayTimeInMap: boolean, toggles the mapTime, defaults to true
|
|
6603
|
+
* @param {boolean} [showScaleBar] **optional** showScaleBar: boolean, toggles the scaleBar, defaults to true
|
|
6604
|
+
* @example
|
|
6605
|
+
* ```<MapViewConnect mapId={mapId} controls={{ zoomControls: false }} displayTimeInMap={false} showScaleBar={false}/>```
|
|
6606
|
+
*/
|
|
6607
|
+
var MapViewConnect = function MapViewConnect(_ref) {
|
|
6608
|
+
var _linkedFeatures$conca;
|
|
6609
|
+
var mapId = _ref.mapId,
|
|
6610
|
+
children = _ref.children,
|
|
6611
|
+
_ref$controls = _ref.controls,
|
|
6612
|
+
controls = _ref$controls === void 0 ? {
|
|
6613
|
+
mapControlsPositionTop: 0,
|
|
6614
|
+
zoomControls: true
|
|
6615
|
+
} : _ref$controls,
|
|
6616
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
6617
|
+
var mapRef = React.useRef(null);
|
|
6618
|
+
var store = useStore();
|
|
6619
|
+
var mapDimensions = useSelector(function (store) {
|
|
6620
|
+
return mapSelectors.getMapDimensions(store, mapId);
|
|
6621
|
+
});
|
|
6622
|
+
var layers = useSelector(function (store) {
|
|
6623
|
+
return mapSelectors.getMapLayers(store, mapId);
|
|
6624
|
+
});
|
|
6625
|
+
var baseLayers = useSelector(function (store) {
|
|
6626
|
+
return mapSelectors.getMapBaseLayers(store, mapId);
|
|
6627
|
+
});
|
|
6628
|
+
var overLayers = useSelector(function (store) {
|
|
6629
|
+
return mapSelectors.getMapOverLayers(store, mapId);
|
|
6630
|
+
});
|
|
6631
|
+
var featureLayers = useSelector(function (store) {
|
|
6632
|
+
return mapSelectors.getMapFeatureLayers(store, mapId);
|
|
6633
|
+
});
|
|
6634
|
+
var linkedFeatures = useSelector(function (store) {
|
|
6635
|
+
var _store$syncGroups;
|
|
6636
|
+
return genericSelectors.selectLinkedFeatures((_store$syncGroups = store.syncGroups) == null ? void 0 : _store$syncGroups.linkedState, mapId);
|
|
6637
|
+
});
|
|
6638
|
+
var linkedFormFeatures = useSelector(function (store) {
|
|
6639
|
+
var _store$syncGroups2;
|
|
6640
|
+
return genericSelectors.selectLinkedFormFeatures((_store$syncGroups2 = store.syncGroups) == null ? void 0 : _store$syncGroups2.linkedState, mapId);
|
|
6641
|
+
});
|
|
6642
|
+
var bbox = useSelector(function (store) {
|
|
6643
|
+
return mapSelectors.getBbox(store, mapId);
|
|
6644
|
+
});
|
|
6645
|
+
var srs = useSelector(function (store) {
|
|
6646
|
+
return mapSelectors.getSrs(store, mapId);
|
|
6647
|
+
});
|
|
6648
|
+
var activeLayerId = useSelector(function (store) {
|
|
6649
|
+
return mapSelectors.getActiveLayerId(store, mapId);
|
|
6650
|
+
});
|
|
6651
|
+
var animationDelay = useSelector(function (store) {
|
|
6652
|
+
return mapSelectors.getMapAnimationDelay(store, mapId);
|
|
6469
6653
|
});
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
var SearchControlButtonConnect = function SearchControlButtonConnect(_ref) {
|
|
6473
|
-
var mapId = _ref.mapId,
|
|
6474
|
-
_ref$source = _ref.source,
|
|
6475
|
-
source = _ref$source === void 0 ? 'app' : _ref$source;
|
|
6476
|
-
var _useCoreTranslation = useCoreTranslation(),
|
|
6477
|
-
t = _useCoreTranslation.t;
|
|
6478
|
-
var dispatch = useDispatch();
|
|
6479
|
-
var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
|
|
6480
|
-
var currentActiveMapId = useSelector(function (store) {
|
|
6481
|
-
return uiSelectors.getDialogMapId(store, dialogType);
|
|
6654
|
+
var mapPinLocation = useSelector(function (store) {
|
|
6655
|
+
return mapSelectors.getPinLocation(store, mapId);
|
|
6482
6656
|
});
|
|
6483
|
-
var
|
|
6484
|
-
return
|
|
6657
|
+
var linkedPanelId = useSelector(function (store) {
|
|
6658
|
+
return genericSelectors.selectLinkedPanelId(store, mapId);
|
|
6485
6659
|
});
|
|
6486
|
-
var
|
|
6487
|
-
|
|
6488
|
-
type: dialogType,
|
|
6489
|
-
mapId: mapId,
|
|
6490
|
-
setOpen: currentActiveMapId !== mapId ? true : !isOpenInStore,
|
|
6491
|
-
source: source
|
|
6492
|
-
}));
|
|
6493
|
-
}, [currentActiveMapId, dialogType, dispatch, isOpenInStore, mapId, source]);
|
|
6494
|
-
return jsx(MapControlButton, {
|
|
6495
|
-
onClick: openSearchDialog,
|
|
6496
|
-
title: t('search-title'),
|
|
6497
|
-
"aria-label": t('search-title-aria'),
|
|
6498
|
-
isActive: isOpenInStore,
|
|
6499
|
-
children: jsx(Search, {})
|
|
6660
|
+
var selectedFeatureCoordinates = useSelector(function (store) {
|
|
6661
|
+
return genericSelectors.getSelectedFeature(store.syncGroups, linkedPanelId);
|
|
6500
6662
|
});
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
var MY_LOCATION = 'MyLocation';
|
|
6504
|
-
var locationOptions = {
|
|
6505
|
-
enableHighAccuracy: false,
|
|
6506
|
-
timeout: 5000,
|
|
6507
|
-
maximumAge: 0
|
|
6508
|
-
};
|
|
6509
|
-
var circleDrawFunction = function circleDrawFunction(args, fillColor, radius) {
|
|
6510
|
-
if (fillColor === void 0) {
|
|
6511
|
-
fillColor = '#88F';
|
|
6512
|
-
}
|
|
6513
|
-
if (radius === void 0) {
|
|
6514
|
-
radius = 12;
|
|
6515
|
-
}
|
|
6516
|
-
var ctx = args.context,
|
|
6517
|
-
coord = args.coord;
|
|
6518
|
-
ctx.strokeStyle = '#000';
|
|
6519
|
-
ctx.fillStyle = fillColor || '#88F';
|
|
6520
|
-
ctx.lineWidth = 1;
|
|
6521
|
-
ctx.beginPath();
|
|
6522
|
-
ctx.arc(coord.x, coord.y, radius || 10, 0, 2 * Math.PI);
|
|
6523
|
-
ctx.fill();
|
|
6524
|
-
ctx.stroke();
|
|
6525
|
-
ctx.fillStyle = '#000';
|
|
6526
|
-
ctx.beginPath();
|
|
6527
|
-
ctx.arc(coord.x, coord.y, 2, 0, 2 * Math.PI);
|
|
6528
|
-
ctx.fill();
|
|
6529
|
-
};
|
|
6530
|
-
var MyMapLocation = function MyMapLocation(_ref) {
|
|
6531
|
-
var _sx;
|
|
6532
|
-
var mapId = _ref.mapId,
|
|
6533
|
-
isLoading = _ref.isLoading,
|
|
6534
|
-
hasFailed = _ref.hasFailed,
|
|
6535
|
-
setIsLoading = _ref.setIsLoading,
|
|
6536
|
-
setHasFailed = _ref.setHasFailed;
|
|
6537
|
-
var _useCoreTranslation = useCoreTranslation(),
|
|
6538
|
-
t = _useCoreTranslation.t;
|
|
6539
|
-
var dispatch = useDispatch();
|
|
6540
|
-
var layersBelongsToCurrentMapId = useSelector(function (store) {
|
|
6541
|
-
return layerSelectors.getLayersByMapId(store, mapId || '');
|
|
6663
|
+
var disableMapPin = useSelector(function (store) {
|
|
6664
|
+
return mapSelectors.getDisableMapPin(store, mapId);
|
|
6542
6665
|
});
|
|
6543
|
-
var
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6666
|
+
var displayMapPin = useSelector(function (store) {
|
|
6667
|
+
return mapSelectors.getDisplayMapPin(store, mapId);
|
|
6668
|
+
});
|
|
6669
|
+
var timestep = useSelector(function (store) {
|
|
6670
|
+
return mapSelectors.getMapTimeStep(store, mapId);
|
|
6671
|
+
});
|
|
6672
|
+
var dispatch = useDispatch();
|
|
6673
|
+
var mapChangeDimension = React.useCallback(function (mapDimensionPayload) {
|
|
6674
|
+
if (mapDimensionPayload.dimension) {
|
|
6675
|
+
var wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
6676
|
+
if (!wmjsMap) {
|
|
6677
|
+
return;
|
|
6678
|
+
}
|
|
6679
|
+
var dimension = wmjsMap.getDimension(mapDimensionPayload.dimension.name);
|
|
6680
|
+
if (dimension && dimension.currentValue === mapDimensionPayload.dimension.currentValue) {
|
|
6681
|
+
return;
|
|
6548
6682
|
}
|
|
6549
6683
|
}
|
|
6550
|
-
|
|
6684
|
+
dispatch(mapActions.mapChangeDimension(mapDimensionPayload));
|
|
6685
|
+
}, [dispatch, mapId]);
|
|
6686
|
+
var setTime = React.useCallback(function (setTimePayload) {
|
|
6687
|
+
var _wmjsMap$getDimension;
|
|
6688
|
+
var wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
6689
|
+
/* Check if the map not already has this value set, otherwise this component will re-render */
|
|
6690
|
+
if (wmjsMap && wmjsMap.getDimension('time') && ((_wmjsMap$getDimension = wmjsMap.getDimension('time')) == null ? void 0 : _wmjsMap$getDimension.currentValue) === setTimePayload.value) {
|
|
6691
|
+
return;
|
|
6692
|
+
}
|
|
6693
|
+
dispatch(genericActions.setTime(setTimePayload));
|
|
6694
|
+
}, [dispatch, mapId]);
|
|
6695
|
+
var updateLayerInformation = React.useCallback(function (payload) {
|
|
6696
|
+
dispatch(layerActions.onUpdateLayerInformation(payload));
|
|
6697
|
+
}, [dispatch]);
|
|
6698
|
+
var registerMap = React.useCallback(function (payload) {
|
|
6699
|
+
dispatch(mapActions.registerMap(payload));
|
|
6700
|
+
}, [dispatch]);
|
|
6701
|
+
var unregisterMap = React.useCallback(function (payload) {
|
|
6702
|
+
dispatch(mapActions.unregisterMap(payload));
|
|
6703
|
+
}, [dispatch]);
|
|
6704
|
+
var genericSetBbox = React.useCallback(function (payload) {
|
|
6705
|
+
dispatch(genericActions.setBbox(payload));
|
|
6706
|
+
}, [dispatch]);
|
|
6707
|
+
var syncGroupAddSource = React.useCallback(function (payload) {
|
|
6708
|
+
dispatch(genericActions.syncGroupAddSource(payload));
|
|
6709
|
+
}, [dispatch]);
|
|
6710
|
+
var syncGroupRemoveSource = React.useCallback(function (payload) {
|
|
6711
|
+
dispatch(genericActions.syncGroupRemoveSource(payload));
|
|
6712
|
+
}, [dispatch]);
|
|
6713
|
+
var layerError = React.useCallback(function (payload) {
|
|
6714
|
+
dispatch(layerActions.layerError(payload));
|
|
6715
|
+
}, [dispatch]);
|
|
6716
|
+
var mapPinChangeLocation = React.useCallback(function (payload) {
|
|
6717
|
+
dispatch(mapActions.setMapPinLocation(payload));
|
|
6718
|
+
}, [dispatch]);
|
|
6719
|
+
var setSelectedFeature = React.useCallback(function (payload) {
|
|
6720
|
+
dispatch(layerActions.setSelectedFeature(payload));
|
|
6721
|
+
}, [dispatch]);
|
|
6722
|
+
var handleFeatureSelect = function handleFeatureSelect(mapId, featureId) {
|
|
6723
|
+
dispatch(genericActions.addSharedData({
|
|
6724
|
+
panelId: mapId,
|
|
6725
|
+
data: {
|
|
6726
|
+
selectedFeatureId: featureId || ''
|
|
6727
|
+
}
|
|
6728
|
+
}));
|
|
6729
|
+
};
|
|
6730
|
+
var updateFeature = React.useCallback(function (_ref2) {
|
|
6731
|
+
var geojson = _ref2.geojson,
|
|
6732
|
+
reason = _ref2.reason,
|
|
6733
|
+
layerId = _ref2.layerId;
|
|
6734
|
+
var activeDrawToolId = drawtoolSelectors.getActiveDrawToolId(store.getState());
|
|
6735
|
+
var activeDrawMode = drawtoolSelectors.getActiveDrawMode(store.getState(), activeDrawToolId);
|
|
6736
|
+
dispatch(layerActions.updateFeature({
|
|
6737
|
+
geojson: geojson,
|
|
6738
|
+
reason: reason,
|
|
6739
|
+
layerId: layerId,
|
|
6740
|
+
shouldAllowMultipleShapes: drawtoolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId),
|
|
6741
|
+
geoJSONIntersectionLayerId: drawtoolSelectors.getGeoJSONIntersectionLayerId(store.getState(), activeDrawToolId),
|
|
6742
|
+
geoJSONIntersectionBoundsLayerId: drawtoolSelectors.getGeoJSONIntersectionBoundsLayerId(store.getState(), activeDrawToolId),
|
|
6743
|
+
selectionType: activeDrawMode == null ? void 0 : activeDrawMode.selectionType
|
|
6744
|
+
}));
|
|
6745
|
+
}, [dispatch, store]);
|
|
6746
|
+
var exitFeatureDrawMode = React.useCallback(function (_ref3) {
|
|
6747
|
+
var reason = _ref3.reason,
|
|
6748
|
+
layerId = _ref3.layerId;
|
|
6749
|
+
var activeDrawToolId = drawtoolSelectors.getActiveDrawToolId(store.getState());
|
|
6750
|
+
dispatch(layerActions.exitFeatureDrawMode({
|
|
6751
|
+
reason: reason,
|
|
6752
|
+
layerId: layerId,
|
|
6753
|
+
shouldAllowMultipleShapes: drawtoolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId)
|
|
6754
|
+
}));
|
|
6755
|
+
}, [dispatch, store]);
|
|
6756
|
+
var isActiveWindowId = useSelector(function (store) {
|
|
6757
|
+
return uiSelectors.getIsActiveWindowId(store, mapId);
|
|
6551
6758
|
});
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
var
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6759
|
+
useKeyboardZoomAndPan(isActiveWindowId, mapId, mapRef.current);
|
|
6760
|
+
useTouchZoomPan(isActiveWindowId, mapId);
|
|
6761
|
+
var unRegister = React.useCallback(function (mapId) {
|
|
6762
|
+
unregisterMap({
|
|
6763
|
+
mapId: mapId
|
|
6764
|
+
});
|
|
6765
|
+
syncGroupRemoveSource({
|
|
6766
|
+
id: mapId
|
|
6767
|
+
});
|
|
6768
|
+
}, [syncGroupRemoveSource, unregisterMap]);
|
|
6769
|
+
React.useEffect(function () {
|
|
6770
|
+
registerMap({
|
|
6771
|
+
mapId: mapId
|
|
6772
|
+
});
|
|
6773
|
+
syncGroupAddSource({
|
|
6774
|
+
id: mapId,
|
|
6775
|
+
type: [syncConstants.SYNCGROUPS_TYPE_SETTIME, syncConstants.SYNCGROUPS_TYPE_SETBBOX]
|
|
6776
|
+
});
|
|
6777
|
+
dispatch(loadingIndicatorActions.setGetMapIsLoading({
|
|
6778
|
+
id: mapId,
|
|
6779
|
+
isGetMapLoading: false
|
|
6780
|
+
}));
|
|
6781
|
+
}, [dispatch, mapId, registerMap, syncGroupAddSource]);
|
|
6782
|
+
var onGetMapLoadStart = React.useCallback(function () {
|
|
6783
|
+
dispatch(loadingIndicatorActions.setGetMapIsLoading({
|
|
6784
|
+
id: mapId,
|
|
6785
|
+
isGetMapLoading: true
|
|
6786
|
+
}));
|
|
6787
|
+
}, [dispatch, mapId]);
|
|
6788
|
+
var onGetMapLoadReady = React.useCallback(function () {
|
|
6789
|
+
dispatch(loadingIndicatorActions.setGetMapIsLoading({
|
|
6790
|
+
id: mapId,
|
|
6791
|
+
isGetMapLoading: false
|
|
6792
|
+
}));
|
|
6793
|
+
}, [dispatch, mapId]);
|
|
6794
|
+
var onGetCapabilitiesLoadStart = React.useCallback(function () {
|
|
6795
|
+
dispatch(loadingIndicatorActions.setGetCapabilitiesIsLoading({
|
|
6796
|
+
id: mapId,
|
|
6797
|
+
isGetCapabilitiesLoading: true
|
|
6798
|
+
}));
|
|
6799
|
+
}, [dispatch, mapId]);
|
|
6800
|
+
var onGetCapabilitiesLoadReady = React.useCallback(function () {
|
|
6801
|
+
dispatch(loadingIndicatorActions.setGetCapabilitiesIsLoading({
|
|
6802
|
+
id: mapId,
|
|
6803
|
+
isGetCapabilitiesLoading: false
|
|
6804
|
+
}));
|
|
6805
|
+
}, [dispatch, mapId]);
|
|
6806
|
+
var isTimeScrollingEnabled = useSelector(syncGroupsSelectors.isTimeScrollingEnabled);
|
|
6807
|
+
var _useSelector = useSelector(function (state) {
|
|
6808
|
+
return genericSelectors.selectSharedData(state, linkedPanelId);
|
|
6809
|
+
}),
|
|
6810
|
+
hoverId = _useSelector.hoverId;
|
|
6811
|
+
var debouncedSetHoverFeature = React.useMemo(function () {
|
|
6812
|
+
return debounce(function (featureId) {
|
|
6813
|
+
return dispatch(genericActions.addSharedData({
|
|
6814
|
+
panelId: linkedPanelId,
|
|
6815
|
+
data: {
|
|
6816
|
+
hoverId: featureId
|
|
6817
|
+
}
|
|
6560
6818
|
}));
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6819
|
+
}, 200);
|
|
6820
|
+
}, [dispatch, linkedPanelId]);
|
|
6821
|
+
return jsxs("div", {
|
|
6822
|
+
style: {
|
|
6823
|
+
height: '100%'
|
|
6824
|
+
},
|
|
6825
|
+
ref: mapRef,
|
|
6826
|
+
children: [jsxs(MapView, Object.assign({}, props, {
|
|
6827
|
+
mapId: mapId,
|
|
6828
|
+
controls: {},
|
|
6829
|
+
linkedFeatures: {
|
|
6830
|
+
type: 'FeatureCollection',
|
|
6831
|
+
features: linkedFeatures.flatMap(function (feature) {
|
|
6832
|
+
return feature.geoJSON.features;
|
|
6833
|
+
})
|
|
6834
|
+
},
|
|
6835
|
+
isTimeScrollingEnabled: isTimeScrollingEnabled,
|
|
6836
|
+
srs: srs,
|
|
6837
|
+
bbox: bbox,
|
|
6838
|
+
mapPinLocation: displayMapPin ? selectedFeatureCoordinates || mapPinLocation : undefined,
|
|
6839
|
+
dimensions: mapDimensions,
|
|
6840
|
+
activeLayerId: activeLayerId,
|
|
6841
|
+
animationDelay: animationDelay,
|
|
6842
|
+
timestep: timestep,
|
|
6843
|
+
displayMapPin: displayMapPin,
|
|
6844
|
+
disableMapPin: disableMapPin,
|
|
6845
|
+
onMapChangeDimension: function onMapChangeDimension(mapDimensionPayload) {
|
|
6846
|
+
if (mapDimensionPayload && mapDimensionPayload.dimension && mapDimensionPayload.dimension.name && mapDimensionPayload.dimension.name === 'time') {
|
|
6847
|
+
setTime({
|
|
6848
|
+
sourceId: mapId,
|
|
6849
|
+
origin: mapDimensionPayload.origin + "==> " + ORIGIN_REACTMAPVIEWCONNECT_ONMAPCHANGEDIMENSION,
|
|
6850
|
+
value: handleDateUtilsISOString(mapDimensionPayload.dimension.currentValue)
|
|
6851
|
+
});
|
|
6852
|
+
} else {
|
|
6853
|
+
mapChangeDimension(mapDimensionPayload);
|
|
6854
|
+
}
|
|
6855
|
+
},
|
|
6856
|
+
onUpdateLayerInformation: updateLayerInformation,
|
|
6857
|
+
onMapPinChangeLocation: mapPinChangeLocation,
|
|
6858
|
+
onMapZoomEnd: function onMapZoomEnd(a) {
|
|
6859
|
+
genericSetBbox({
|
|
6860
|
+
bbox: a.bbox,
|
|
6861
|
+
srs: a.srs,
|
|
6862
|
+
sourceId: mapId,
|
|
6863
|
+
origin: mapEnums.MapActionOrigin.map,
|
|
6864
|
+
mapId: mapId
|
|
6865
|
+
});
|
|
6866
|
+
},
|
|
6867
|
+
onWMJSMount: function onWMJSMount(mapId) {
|
|
6593
6868
|
var wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
6594
6869
|
if (!wmjsMap) {
|
|
6595
6870
|
return;
|
|
6596
6871
|
}
|
|
6597
|
-
wmjsMap.
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
console.warn(t('search-error', {
|
|
6602
|
-
error: error.message
|
|
6603
|
-
}));
|
|
6604
|
-
}, locationOptions);
|
|
6605
|
-
}
|
|
6606
|
-
};
|
|
6607
|
-
var chooseIcon = function chooseIcon() {
|
|
6608
|
-
return hasFailed ? jsx(Exclamation, {
|
|
6609
|
-
style: {
|
|
6610
|
-
color: 'red'
|
|
6872
|
+
wmjsMap.getListener().addEventListener('onloadstart', onGetMapLoadStart);
|
|
6873
|
+
wmjsMap.getListener().addEventListener('onloadready', onGetMapLoadReady);
|
|
6874
|
+
wmServiceListener.addEventListener(EVENT_GETCAPABILITIES_START, onGetCapabilitiesLoadStart, true);
|
|
6875
|
+
wmServiceListener.addEventListener(EVENT_GETCAPABILITIES_READY, onGetCapabilitiesLoadReady, true);
|
|
6611
6876
|
},
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6877
|
+
onWMJSUnMount: function onWMJSUnMount(mapId) {
|
|
6878
|
+
unRegister(mapId);
|
|
6879
|
+
wmServiceListener.removeEventListener(EVENT_GETCAPABILITIES_START, onGetCapabilitiesLoadStart);
|
|
6880
|
+
wmServiceListener.removeEventListener(EVENT_GETCAPABILITIES_READY, onGetCapabilitiesLoadReady);
|
|
6881
|
+
},
|
|
6882
|
+
children: [baseLayers.map(function (layer) {
|
|
6883
|
+
return jsx(MapViewLayer, Object.assign({
|
|
6884
|
+
id: "baselayer-" + layer.id,
|
|
6885
|
+
onLayerError: function onLayerError(_, error) {
|
|
6886
|
+
layerError({
|
|
6887
|
+
layerId: layer.id,
|
|
6888
|
+
error: Error("" + error)
|
|
6889
|
+
});
|
|
6890
|
+
}
|
|
6891
|
+
}, layer), layer.id);
|
|
6892
|
+
}), layers.map(function (layer) {
|
|
6893
|
+
return jsx(MapViewLayer, Object.assign({
|
|
6894
|
+
id: "layer-" + layer.id,
|
|
6895
|
+
onLayerError: function onLayerError(_, error) {
|
|
6896
|
+
layerError({
|
|
6897
|
+
layerId: layer.id,
|
|
6898
|
+
error: Error("" + error)
|
|
6899
|
+
});
|
|
6900
|
+
}
|
|
6901
|
+
}, layer), layer.id);
|
|
6902
|
+
}), (_linkedFeatures$conca = linkedFeatures.concat(linkedFormFeatures)) == null ? void 0 : _linkedFeatures$conca.map(function (feature) {
|
|
6903
|
+
return jsx(MapViewLayer, {
|
|
6904
|
+
id: feature.id,
|
|
6905
|
+
geojson: feature == null ? void 0 : feature.geoJSON,
|
|
6906
|
+
onHoverFeature: function onHoverFeature(hoverInfo) {
|
|
6907
|
+
if (hoverInfo === undefined && hoverId !== undefined) {
|
|
6908
|
+
debouncedSetHoverFeature();
|
|
6909
|
+
} else if (hoverInfo != null && hoverInfo.feature && feature.originalId !== hoverId) {
|
|
6910
|
+
debouncedSetHoverFeature(feature.originalId);
|
|
6911
|
+
}
|
|
6627
6912
|
},
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6913
|
+
onClickFeature: function onClickFeature(event) {
|
|
6914
|
+
var _event$feature$proper;
|
|
6915
|
+
var isClickOutsideFeature = !event || !event.feature;
|
|
6916
|
+
if (isClickOutsideFeature) {
|
|
6917
|
+
if (mapPinLocation) {
|
|
6918
|
+
handleFeatureSelect(linkedPanelId, undefined);
|
|
6919
|
+
}
|
|
6920
|
+
return;
|
|
6921
|
+
}
|
|
6922
|
+
// Handle clicks on station
|
|
6923
|
+
var clickedFeatureName = (_event$feature$proper = event.feature.properties) == null ? void 0 : _event$feature$proper.name;
|
|
6924
|
+
var features = linkedFeatures[0].geoJSON.features;
|
|
6925
|
+
var clickedFeatureIndex = features.findIndex(function (feature) {
|
|
6926
|
+
var _feature$properties;
|
|
6927
|
+
return ((_feature$properties = feature.properties) == null ? void 0 : _feature$properties.name) === clickedFeatureName;
|
|
6928
|
+
});
|
|
6929
|
+
if (disableMapPin === false) {
|
|
6930
|
+
var _selectedFeature$id;
|
|
6931
|
+
var selectedFeature = features[clickedFeatureIndex];
|
|
6932
|
+
handleFeatureSelect(linkedPanelId, (_selectedFeature$id = selectedFeature.id) == null ? void 0 : _selectedFeature$id.toString());
|
|
6933
|
+
}
|
|
6934
|
+
}
|
|
6935
|
+
}, feature.id);
|
|
6936
|
+
}), featureLayers.map(function (layer) {
|
|
6937
|
+
return jsx(MapViewLayer, Object.assign({
|
|
6938
|
+
id: "featurelayer-" + layer.id,
|
|
6939
|
+
onLayerError: function onLayerError(_, error) {
|
|
6940
|
+
layerError({
|
|
6941
|
+
layerId: layer.id,
|
|
6942
|
+
error: Error("" + error)
|
|
6943
|
+
});
|
|
6640
6944
|
},
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
}
|
|
6687
|
-
|
|
6688
|
-
|
|
6945
|
+
onClickFeature: function onClickFeature(event) {
|
|
6946
|
+
var isClickOutsideFeature = !event;
|
|
6947
|
+
if (isClickOutsideFeature && !layer.isInEditMode) {
|
|
6948
|
+
setSelectedFeature({
|
|
6949
|
+
layerId: layer.id,
|
|
6950
|
+
selectedFeatureIndex: undefined
|
|
6951
|
+
});
|
|
6952
|
+
return;
|
|
6953
|
+
}
|
|
6954
|
+
if ((event == null ? void 0 : event.isInEditMode) === false) {
|
|
6955
|
+
setSelectedFeature({
|
|
6956
|
+
layerId: layer.id,
|
|
6957
|
+
selectedFeatureIndex: event.featureIndex
|
|
6958
|
+
});
|
|
6959
|
+
}
|
|
6960
|
+
},
|
|
6961
|
+
updateGeojson: function updateGeojson(geojson, reason) {
|
|
6962
|
+
updateFeature({
|
|
6963
|
+
geojson: geojson,
|
|
6964
|
+
layerId: layer.id,
|
|
6965
|
+
reason: reason
|
|
6966
|
+
});
|
|
6967
|
+
},
|
|
6968
|
+
exitDrawModeCallback: function exitDrawModeCallback(reason) {
|
|
6969
|
+
return exitFeatureDrawMode({
|
|
6970
|
+
reason: reason,
|
|
6971
|
+
layerId: layer.id
|
|
6972
|
+
});
|
|
6973
|
+
}
|
|
6974
|
+
}, layer), layer.id);
|
|
6975
|
+
}), overLayers.map(function (layer) {
|
|
6976
|
+
return jsx(MapViewLayer, Object.assign({
|
|
6977
|
+
id: "baselayer-" + layer.id,
|
|
6978
|
+
onLayerError: function onLayerError(_, error) {
|
|
6979
|
+
layerError({
|
|
6980
|
+
layerId: layer.id,
|
|
6981
|
+
error: Error("" + error)
|
|
6982
|
+
});
|
|
6983
|
+
}
|
|
6984
|
+
}, layer), layer.id);
|
|
6985
|
+
}), children]
|
|
6986
|
+
})), jsxs(MapControls, {
|
|
6987
|
+
"data-testid": "mapControls",
|
|
6988
|
+
style: {
|
|
6989
|
+
top: controls == null ? void 0 : controls.mapControlsPositionTop
|
|
6990
|
+
},
|
|
6991
|
+
children: [(controls == null ? void 0 : controls.search) && jsx(SearchControlButtonConnect, {
|
|
6992
|
+
mapId: mapId
|
|
6993
|
+
}), (controls == null ? void 0 : controls.zoomControls) && jsx(ZoomControlConnect, {
|
|
6994
|
+
mapId: mapId
|
|
6995
|
+
}), (controls == null ? void 0 : controls.layerManagerAndLegend) && jsxs(Fragment, {
|
|
6996
|
+
children: [jsx(LayerManagerMapButtonConnect, {
|
|
6997
|
+
mapId: mapId
|
|
6998
|
+
}), jsx(LegendMapButtonConnect, {
|
|
6999
|
+
mapId: mapId,
|
|
7000
|
+
multiLegend: controls == null ? void 0 : controls.multiLegend
|
|
7001
|
+
})]
|
|
7002
|
+
}), (controls == null ? void 0 : controls.dimensionSelect) && jsx(MultiDimensionSelectMapButtonsConnect, {
|
|
7003
|
+
mapId: mapId
|
|
7004
|
+
}), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoButtonConnect, {
|
|
7005
|
+
mapId: mapId
|
|
7006
|
+
}), controls == null ? void 0 : controls.additionalMapControls]
|
|
7007
|
+
}), (controls == null ? void 0 : controls.multiLegend) && jsx(LegendConnect, {
|
|
7008
|
+
showMapId: true,
|
|
6689
7009
|
mapId: mapId,
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
disableUnderline: true,
|
|
6701
|
-
endAdornment: jsx(InputAdornment, {
|
|
6702
|
-
position: "end",
|
|
6703
|
-
children: jsx(CustomIconButton, {
|
|
6704
|
-
tooltipTitle: t('actions-close'),
|
|
6705
|
-
edge: "end",
|
|
6706
|
-
onClick: onClose,
|
|
6707
|
-
size: "large",
|
|
6708
|
-
children: jsx(Close, {})
|
|
6709
|
-
})
|
|
6710
|
-
})
|
|
6711
|
-
}
|
|
6712
|
-
}
|
|
7010
|
+
multiLegend: controls == null ? void 0 : controls.multiLegend
|
|
7011
|
+
}), (controls == null ? void 0 : controls.search) && jsx(SearchDialogConnect, {
|
|
7012
|
+
mapId: mapId
|
|
7013
|
+
}), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoConnect, {
|
|
7014
|
+
showMapId: true,
|
|
7015
|
+
mapId: mapId
|
|
7016
|
+
}), jsx(LayerManagerConnect, {
|
|
7017
|
+
mapId: mapId,
|
|
7018
|
+
bounds: "parent",
|
|
7019
|
+
isDocked: true
|
|
6713
7020
|
})]
|
|
6714
|
-
}) : null;
|
|
6715
|
-
};
|
|
6716
|
-
|
|
6717
|
-
var SearchControlConnect = function SearchControlConnect(_ref) {
|
|
6718
|
-
var mapId = _ref.mapId;
|
|
6719
|
-
var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
|
|
6720
|
-
var _useSetupDialog = useSetupDialog(dialogType),
|
|
6721
|
-
isDialogOpen = _useSetupDialog.isDialogOpen,
|
|
6722
|
-
onCloseDialog = _useSetupDialog.onCloseDialog;
|
|
6723
|
-
return jsx(SearchDialog, {
|
|
6724
|
-
isOpen: isDialogOpen,
|
|
6725
|
-
onClose: onCloseDialog,
|
|
6726
|
-
mapId: mapId
|
|
6727
7021
|
});
|
|
6728
7022
|
};
|
|
6729
7023
|
|
|
@@ -6941,7 +7235,8 @@ var TimeSpanButtonConnect = function TimeSpanButtonConnect(_ref) {
|
|
|
6941
7235
|
}));
|
|
6942
7236
|
dispatch(mapActions.setTimeSliderSpan({
|
|
6943
7237
|
mapId: mapId,
|
|
6944
|
-
timeSliderSpan: spanInSeconds
|
|
7238
|
+
timeSliderSpan: spanInSeconds,
|
|
7239
|
+
origin: mapEnums.MapActionOrigin.map
|
|
6945
7240
|
}));
|
|
6946
7241
|
dispatch(mapActions.setTimeSliderCenterTime({
|
|
6947
7242
|
mapId: mapId,
|
|
@@ -7410,10 +7705,7 @@ var useUpdateTimeSpan = function useUpdateTimeSpan(mapId, myOnSetTimeSliderSpan)
|
|
|
7410
7705
|
}
|
|
7411
7706
|
};
|
|
7412
7707
|
React.useEffect(function () {
|
|
7413
|
-
if (
|
|
7414
|
-
return;
|
|
7415
|
-
}
|
|
7416
|
-
if (isTimeSpanAuto && autoTimeStepLayerId) {
|
|
7708
|
+
if (isTimeSpanAuto && autoTimeStepLayerId && activeLayerTimeDimension) {
|
|
7417
7709
|
var _getTimeBounds = getTimeBounds([activeLayerTimeDimension]),
|
|
7418
7710
|
startTime = _getTimeBounds.startTime,
|
|
7419
7711
|
endTime = _getTimeBounds.endTime;
|
|
@@ -7682,7 +7974,8 @@ var titleStyle = function titleStyle(theme) {
|
|
|
7682
7974
|
zIndex: 50,
|
|
7683
7975
|
color: theme.palette.common.black,
|
|
7684
7976
|
whiteSpace: 'nowrap',
|
|
7685
|
-
userSelect: 'none'
|
|
7977
|
+
userSelect: 'none',
|
|
7978
|
+
textShadow: '1px 1px 2px #ffffffE6, -1px 1px 2px #ffffffE6, -1px -1px 2px #ffffffE6, 1px -1px 2px #ffffffE6'
|
|
7686
7979
|
};
|
|
7687
7980
|
};
|
|
7688
7981
|
var defaultBbox = {
|
|
@@ -7805,7 +8098,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
7805
8098
|
}));
|
|
7806
8099
|
}
|
|
7807
8100
|
if (shouldDisplayDrawControls) {
|
|
7808
|
-
dispatch(
|
|
8101
|
+
dispatch(layerActions.addLayer({
|
|
7809
8102
|
mapId: mapId,
|
|
7810
8103
|
layer: {
|
|
7811
8104
|
geojson: emptyGeoJSON,
|
|
@@ -7817,7 +8110,18 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
7817
8110
|
}
|
|
7818
8111
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7819
8112
|
}, []);
|
|
7820
|
-
var
|
|
8113
|
+
var mapControlConfig = useMemo(function () {
|
|
8114
|
+
return {
|
|
8115
|
+
mapControlsPositionTop: title ? 24 : 8,
|
|
8116
|
+
search: displaySearchButtonInMap,
|
|
8117
|
+
zoomControls: shouldShowZoomControls,
|
|
8118
|
+
layerManagerAndLegend: displayLayerManagerAndLegendButtonInMap,
|
|
8119
|
+
multiLegend: multiLegend,
|
|
8120
|
+
dimensionSelect: displayDimensionSelectButtonInMap,
|
|
8121
|
+
getFeatureInfo: displayGetFeatureInfoButtonInMap,
|
|
8122
|
+
additionalMapControls: mapControls
|
|
8123
|
+
};
|
|
8124
|
+
}, [title, displaySearchButtonInMap, shouldShowZoomControls, displayLayerManagerAndLegendButtonInMap, multiLegend, displayDimensionSelectButtonInMap, displayGetFeatureInfoButtonInMap, mapControls]);
|
|
7821
8125
|
return React__default.useMemo(function () {
|
|
7822
8126
|
renderCounter.count(ConfigurableMapConnect.name + "_" + mapId);
|
|
7823
8127
|
return jsxs(Box, {
|
|
@@ -7833,25 +8137,6 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
7833
8137
|
"data-testid": "mapTitle",
|
|
7834
8138
|
sx: titleStyle,
|
|
7835
8139
|
children: title
|
|
7836
|
-
}), jsxs(MapControls, {
|
|
7837
|
-
"data-testid": "mapControls",
|
|
7838
|
-
style: {
|
|
7839
|
-
top: mapControlsPositionTop
|
|
7840
|
-
},
|
|
7841
|
-
children: [displaySearchButtonInMap && jsx(SearchControlButtonConnect, {
|
|
7842
|
-
mapId: mapId
|
|
7843
|
-
}), jsx(ZoomControlConnect, {
|
|
7844
|
-
mapId: id
|
|
7845
|
-
}), displayLayerManagerAndLegendButtonInMap && jsx(LayerManagerMapButtonConnect, {
|
|
7846
|
-
mapId: mapId
|
|
7847
|
-
}), displayLayerManagerAndLegendButtonInMap && jsx(LegendMapButtonConnect, {
|
|
7848
|
-
mapId: mapId,
|
|
7849
|
-
multiLegend: multiLegend
|
|
7850
|
-
}), displayDimensionSelectButtonInMap && jsx(MultiDimensionSelectMapButtonsConnect, {
|
|
7851
|
-
mapId: mapId
|
|
7852
|
-
}), displayGetFeatureInfoButtonInMap && jsx(GetFeatureInfoButtonConnect, {
|
|
7853
|
-
mapId: mapId
|
|
7854
|
-
}), mapControls]
|
|
7855
8140
|
}), !disableTimeSlider && jsx(Box, {
|
|
7856
8141
|
sx: {
|
|
7857
8142
|
position: 'absolute',
|
|
@@ -7866,7 +8151,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
7866
8151
|
mapWindowRef: mapWindowRef
|
|
7867
8152
|
})
|
|
7868
8153
|
}), jsx(MapViewConnect, {
|
|
7869
|
-
controls:
|
|
8154
|
+
controls: mapControlConfig,
|
|
7870
8155
|
displayTimeInMap: displayTimeInMap,
|
|
7871
8156
|
showScaleBar: false,
|
|
7872
8157
|
shouldAutoFetch: shouldAutoFetch,
|
|
@@ -7874,24 +8159,11 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_ref) {
|
|
|
7874
8159
|
shouldDisablePrefetching: shouldDisablePrefetching,
|
|
7875
8160
|
tileServerSettings: tileServerSettings,
|
|
7876
8161
|
children: children
|
|
7877
|
-
}), multiLegend && jsx(LegendConnect, {
|
|
7878
|
-
showMapId: true,
|
|
7879
|
-
mapId: mapId,
|
|
7880
|
-
multiLegend: multiLegend
|
|
7881
|
-
}), jsx(SearchControlConnect, {
|
|
7882
|
-
mapId: mapId
|
|
7883
8162
|
}), showClock && jsx(TimeSliderClockConnect, {
|
|
7884
8163
|
mapId: mapId
|
|
7885
|
-
}), displayGetFeatureInfoButtonInMap && jsx(GetFeatureInfoConnect, {
|
|
7886
|
-
showMapId: true,
|
|
7887
|
-
mapId: mapId
|
|
7888
|
-
}), jsx(LayerManagerConnect, {
|
|
7889
|
-
mapId: mapId,
|
|
7890
|
-
bounds: "parent",
|
|
7891
|
-
isDocked: true
|
|
7892
8164
|
})]
|
|
7893
8165
|
});
|
|
7894
|
-
}, [mapId, title,
|
|
8166
|
+
}, [mapId, title, id, mapControlConfig, tileServerSettings, disableTimeSlider, displayTimeInMap, shouldAutoFetch, shouldDisablePrefetching, children, showClock]);
|
|
7895
8167
|
};
|
|
7896
8168
|
|
|
7897
8169
|
var mapBoxStyle = function mapBoxStyle(theme) {
|
|
@@ -7970,7 +8242,7 @@ var MultiMapViewConnect = function MultiMapViewConnect(_ref) {
|
|
|
7970
8242
|
isAlwaysVisible: true,
|
|
7971
8243
|
mapWindowRef: multiMapWindowRef
|
|
7972
8244
|
})
|
|
7973
|
-
}),
|
|
8245
|
+
}), jsx(LegendConnect, {
|
|
7974
8246
|
showMapId: true,
|
|
7975
8247
|
mapId: firstMapId,
|
|
7976
8248
|
multiLegend: multiLegend
|
|
@@ -8051,23 +8323,24 @@ var makeMapPreset = function makeMapPreset(timeIncrement, uniqueId, referenceTim
|
|
|
8051
8323
|
title: "FC +" + timeIncrement,
|
|
8052
8324
|
displayTimeInMap: true,
|
|
8053
8325
|
bbox: {
|
|
8054
|
-
left: -
|
|
8055
|
-
bottom:
|
|
8056
|
-
right:
|
|
8057
|
-
top:
|
|
8326
|
+
left: -638936.0386164065,
|
|
8327
|
+
bottom: 6068439.661512798,
|
|
8328
|
+
right: 1613044.3568348314,
|
|
8329
|
+
top: 7876599.103115981
|
|
8058
8330
|
},
|
|
8059
8331
|
srs: PROJECTION.EPSG_3857.value,
|
|
8060
8332
|
componentType: 'MultiMap',
|
|
8061
8333
|
layers: layers.map(function (layer, index) {
|
|
8062
8334
|
return Object.assign({}, layer, {
|
|
8063
8335
|
id: uniqueId + "-" + index,
|
|
8064
|
-
dimensions
|
|
8336
|
+
/* Set time dimensions if layer type is not overLayer */
|
|
8337
|
+
dimensions: layer.layerType !== LayerType.overLayer ? [{
|
|
8065
8338
|
name: 'reference_time',
|
|
8066
8339
|
currentValue: referenceTime
|
|
8067
8340
|
}, {
|
|
8068
8341
|
name: 'time',
|
|
8069
8342
|
currentValue: mapTime
|
|
8070
|
-
}]
|
|
8343
|
+
}] : []
|
|
8071
8344
|
});
|
|
8072
8345
|
}),
|
|
8073
8346
|
displayLayerManagerAndLegendButtonInMap: displayLayerManagerAndLegendButtonInMap,
|
|
@@ -8085,8 +8358,10 @@ var ModelRunInterval = function ModelRunInterval(_ref) {
|
|
|
8085
8358
|
_ref$multiLegend = _ref.multiLegend,
|
|
8086
8359
|
multiLegend = _ref$multiLegend === void 0 ? false : _ref$multiLegend;
|
|
8087
8360
|
var displayLayerManagerAndLegendButtonInAllMaps = !useHasSyncGroupWithLayerActions(syncGroupsIds);
|
|
8088
|
-
/* Get latest reference time for
|
|
8089
|
-
var latestReferenceTime = useGetLatestReferenceTime(layers
|
|
8361
|
+
/* Get latest reference time for layer that is not an overLayer */
|
|
8362
|
+
var latestReferenceTime = useGetLatestReferenceTime(layers.find(function (layer) {
|
|
8363
|
+
return layer.layerType !== LayerType.overLayer;
|
|
8364
|
+
}));
|
|
8090
8365
|
if (latestReferenceTime === '') {
|
|
8091
8366
|
return jsx("div", {
|
|
8092
8367
|
children: "Loading..."
|
|
@@ -8115,6 +8390,9 @@ var useGetReferenceTimes = function useGetReferenceTimes(inputLayer) {
|
|
|
8115
8390
|
var _React$useState = React.useState([]),
|
|
8116
8391
|
referenceTimes = _React$useState[0],
|
|
8117
8392
|
setReferenceTimes = _React$useState[1];
|
|
8393
|
+
var _React$useState2 = React.useState(null),
|
|
8394
|
+
error = _React$useState2[0],
|
|
8395
|
+
setError = _React$useState2[1];
|
|
8118
8396
|
React.useEffect(function () {
|
|
8119
8397
|
var referenceTimes = [];
|
|
8120
8398
|
var wmLayer = new WMLayer(Object.assign({}, inputLayer));
|
|
@@ -8127,9 +8405,14 @@ var useGetReferenceTimes = function useGetReferenceTimes(inputLayer) {
|
|
|
8127
8405
|
referenceTimes.push(referenceTimeValue);
|
|
8128
8406
|
}
|
|
8129
8407
|
setReferenceTimes(referenceTimes);
|
|
8130
|
-
})["catch"](
|
|
8408
|
+
})["catch"](function (error) {
|
|
8409
|
+
setError(error);
|
|
8410
|
+
});
|
|
8131
8411
|
}, [inputLayer]);
|
|
8132
|
-
return
|
|
8412
|
+
return {
|
|
8413
|
+
referenceTimes: referenceTimes,
|
|
8414
|
+
error: error
|
|
8415
|
+
};
|
|
8133
8416
|
};
|
|
8134
8417
|
var HarmonieTempAndPrecipPreset = function HarmonieTempAndPrecipPreset(_ref) {
|
|
8135
8418
|
var layers = _ref.layers,
|
|
@@ -8138,7 +8421,14 @@ var HarmonieTempAndPrecipPreset = function HarmonieTempAndPrecipPreset(_ref) {
|
|
|
8138
8421
|
var displayLayerManagerAndLegendButtonInAllTopRows = !useHasSyncGroupWithLayerActions(layers && layers.topRowSyncGroups);
|
|
8139
8422
|
var displayLayerManagerAndLegendButtonInAllBottomRows = !useHasSyncGroupWithLayerActions(layers && layers.bottomRowSyncGroups);
|
|
8140
8423
|
/* Get all the reference times for this layer */
|
|
8141
|
-
var
|
|
8424
|
+
var _useGetReferenceTimes = useGetReferenceTimes(layers.topRow),
|
|
8425
|
+
referenceTimes = _useGetReferenceTimes.referenceTimes,
|
|
8426
|
+
error = _useGetReferenceTimes.error;
|
|
8427
|
+
if (error) {
|
|
8428
|
+
return jsx(AlertBanner, {
|
|
8429
|
+
title: error.message
|
|
8430
|
+
});
|
|
8431
|
+
}
|
|
8142
8432
|
if (referenceTimes.length === 0) {
|
|
8143
8433
|
return jsx("div", {
|
|
8144
8434
|
children: "Loading..."
|
|
@@ -8733,17 +9023,19 @@ var CoreThemeProvider = function CoreThemeProvider(_ref) {
|
|
|
8733
9023
|
var children = _ref.children,
|
|
8734
9024
|
_ref$theme = _ref.theme,
|
|
8735
9025
|
theme = _ref$theme === void 0 ? lightTheme : _ref$theme;
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
9026
|
+
var queryClient = new QueryClient({
|
|
9027
|
+
defaultOptions: {
|
|
9028
|
+
queries: {
|
|
9029
|
+
retry: false
|
|
9030
|
+
}
|
|
9031
|
+
}
|
|
8739
9032
|
});
|
|
8740
|
-
|
|
8741
|
-
var ThemeWrapperWithModules = function ThemeWrapperWithModules(_ref2) {
|
|
8742
|
-
var theme = _ref2.theme,
|
|
8743
|
-
children = _ref2.children;
|
|
8744
|
-
return jsx(CoreThemeProvider, {
|
|
9033
|
+
return jsx(ThemeWrapper, {
|
|
8745
9034
|
theme: theme,
|
|
8746
|
-
children:
|
|
9035
|
+
children: jsx(QueryClientProvider, {
|
|
9036
|
+
client: queryClient,
|
|
9037
|
+
children: children
|
|
9038
|
+
})
|
|
8747
9039
|
});
|
|
8748
9040
|
};
|
|
8749
9041
|
/**
|
|
@@ -8752,14 +9044,14 @@ var ThemeWrapperWithModules = function ThemeWrapperWithModules(_ref2) {
|
|
|
8752
9044
|
* @param children
|
|
8753
9045
|
* @returns
|
|
8754
9046
|
*/
|
|
8755
|
-
var CoreThemeStoreProvider = function CoreThemeStoreProvider(
|
|
8756
|
-
var children =
|
|
8757
|
-
|
|
8758
|
-
theme =
|
|
8759
|
-
store =
|
|
9047
|
+
var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref2) {
|
|
9048
|
+
var children = _ref2.children,
|
|
9049
|
+
_ref2$theme = _ref2.theme,
|
|
9050
|
+
theme = _ref2$theme === void 0 ? lightTheme : _ref2$theme,
|
|
9051
|
+
store = _ref2.store;
|
|
8760
9052
|
return jsx(Provider, {
|
|
8761
9053
|
store: store,
|
|
8762
|
-
children: jsx(
|
|
9054
|
+
children: jsx(CoreThemeProvider, {
|
|
8763
9055
|
theme: theme,
|
|
8764
9056
|
children: jsx(SnackbarWrapperConnect, {
|
|
8765
9057
|
children: children
|
|
@@ -8767,8 +9059,8 @@ var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref3) {
|
|
|
8767
9059
|
})
|
|
8768
9060
|
});
|
|
8769
9061
|
};
|
|
8770
|
-
var CoreI18nProvider = function CoreI18nProvider(
|
|
8771
|
-
var children =
|
|
9062
|
+
var CoreI18nProvider = function CoreI18nProvider(_ref3) {
|
|
9063
|
+
var children = _ref3.children;
|
|
8772
9064
|
initCoreReactI18n();
|
|
8773
9065
|
return jsx(I18nextProvider, {
|
|
8774
9066
|
i18n: i18n,
|
|
@@ -8994,4 +9286,4 @@ var LanguageSelect = function LanguageSelect(_ref) {
|
|
|
8994
9286
|
});
|
|
8995
9287
|
};
|
|
8996
9288
|
|
|
8997
|
-
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,
|
|
9289
|
+
export { CORE_NAMESPACE, ConfigurableMapConnect, CoreI18nProvider, CoreThemeProvider, CoreThemeStoreProvider, DemoWrapper, DemoWrapperConnect, HarmonieTempAndPrecipPreset, LanguageSelect, LayerInfoButtonConnect, LayerInfoDialogConnect, LayerManager, BaseLayerRow as LayerManagerBaseLayerRow, LayerManagerConnect, DescriptionRow as LayerManagerDescriptionRow, HeaderOptions as LayerManagerHeaderOptions, LayerContainerRow as LayerManagerLayerContainerRow, LayerManagerMapButtonConnect, LegendConnect, LegendMapButtonConnect, MapViewConnect, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, MyMapLocation, RouterWrapperConnect, SearchControlButtonConnect, SearchDialog, SearchDialogConnect, SentryRecordButton, SyncGroupViewerConnect, TimeSliderConnect, ZoomControlConnect, componentsLookUp, coreTranslations, defaultBbox, defaultConfigurations, filterMapPresets, filterServices, filterTimeSeriesServices, getLanguageFromLocalStorage, languageLocalStorageKey, saveLanguageToLocalStorage, testLayers, useFetchServices, useUpdateTimeSpan, useUpdateTimestep };
|