@opengeoweb/core 5.1.1 → 5.2.1

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.
Files changed (63) hide show
  1. package/index.js +1543 -1487
  2. package/package.json +7 -7
  3. package/src/lib/components/LayerManager/AddLayersButton/AddLayersButton.d.ts +3 -4
  4. package/src/lib/components/LayerManager/AddLayersPopup/AddLayersPopup.d.ts +3 -4
  5. package/src/lib/components/LayerManager/BaseLayerRow/BaseLayerRow.d.ts +2 -3
  6. package/src/lib/components/LayerManager/LayerManager.d.ts +2 -3
  7. package/src/lib/components/LayerManager/LayerManagerConnect.d.ts +5 -6
  8. package/src/lib/components/LayerManager/useFetchServices.d.ts +4 -6
  9. package/src/lib/components/Legend/LegendConnect.d.ts +0 -1
  10. package/src/lib/components/MapDraw/MapDrawTool.stories.d.ts +1 -7
  11. package/src/lib/components/MapDraw/MapDrawToolDoubleControls.stories.d.ts +6 -0
  12. package/src/lib/components/MapDraw/MapDrawToolIntersection.stories.d.ts +11 -0
  13. package/src/lib/components/MapDraw/mapDrawUtils.d.ts +1 -0
  14. package/src/lib/components/MapDraw/storyComponents/GeoJSONTextField.d.ts +3 -0
  15. package/src/lib/components/MapDraw/useMapDrawTool.d.ts +5 -4
  16. package/src/lib/components/SyncGroups/SyncGroupList.d.ts +2 -2
  17. package/src/lib/components/SyncGroups/SyncGroupViewer.d.ts +1 -2
  18. package/src/lib/components/WMSLoader/WMSLayerTree/WMSLayerTree.d.ts +2 -3
  19. package/src/lib/components/WMSLoader/WMSLayerTree/WMSLayerTreeConnect.d.ts +3 -4
  20. package/src/lib/components/WMSLoader/WMSLoader.d.ts +3 -3
  21. package/src/lib/components/WMSLoader/WMSLoaderConnect.d.ts +3 -4
  22. package/src/lib/components/WMSLoader/WMSServerList/WMSServerList.d.ts +4 -4
  23. package/src/lib/index.d.ts +2 -2
  24. package/src/lib/store/coreModuleConfig.d.ts +1 -1
  25. package/src/lib/store/generic/selectors.d.ts +2 -2
  26. package/src/lib/store/generic/synchronizationGroups/selector.d.ts +19 -0
  27. package/src/lib/store/generic/synchronizationGroups/selectors.d.ts +7 -7
  28. package/src/lib/store/generic/synchronizationGroups/types.d.ts +17 -1
  29. package/src/lib/store/generic/synchronizationGroups/utils.d.ts +1 -1
  30. package/src/lib/{utils/__mocks__/getCapabilities.d.ts → store/getCapabilities/mocks/mockGetCapabilities.d.ts} +3 -3
  31. package/src/lib/store/layerSelect/selectors.d.ts +1 -1
  32. package/src/lib/store/layerSelect/types.d.ts +11 -0
  33. package/src/lib/store/mapStore/layers/selectors.d.ts +24 -24
  34. package/src/lib/store/mapStore/layers/types.d.ts +8 -8
  35. package/src/lib/store/mapStore/map/constants.d.ts +1 -0
  36. package/src/lib/store/mapStore/map/defaultLayers.d.ts +15 -0
  37. package/src/lib/store/mapStore/map/filterLayers.d.ts +10 -0
  38. package/src/lib/{components/SyncGroups/utils.d.ts → store/mapStore/map/replaceLayerIdsToEnsureUniqueLayerIdsInStore.d.ts} +1 -1
  39. package/src/lib/store/mapStore/map/replaceLayerIdsToEnsureUniqueLayerIdsInStore.spec.d.ts +1 -0
  40. package/src/lib/store/mapStore/map/selectors.d.ts +49 -49
  41. package/src/lib/store/mapStore/service/WMS111GetCapabilitiesGeoServicesRADAR.d.ts +2 -0
  42. package/src/lib/store/mapStore/service/selectors.d.ts +6 -6
  43. package/src/lib/store/mapStore/storeTestSettings.d.ts +10 -0
  44. package/src/lib/store/mapStore/storeTestUtils.d.ts +9 -0
  45. package/src/lib/store/types.d.ts +5 -0
  46. package/src/lib/store/ui/selectors.d.ts +9 -9
  47. package/src/lib/utils/defaultConfigurations.d.ts +2 -2
  48. package/src/lib/utils/defaultTestSettings.d.ts +2 -11
  49. package/src/lib/utils/jsonPresetFilter.d.ts +7 -15
  50. package/src/lib/utils/publicLayers.d.ts +1 -14
  51. package/src/lib/utils/publicServices.d.ts +0 -5
  52. package/src/lib/utils/testUtils.d.ts +1 -8
  53. package/src/lib/components/SyncGroups/selector.d.ts +0 -20
  54. package/src/lib/components/SyncGroups/types.d.ts +0 -17
  55. package/src/lib/components/WMSLoader/services.d.ts +0 -8
  56. package/src/lib/types/types.d.ts +0 -5
  57. package/src/lib/utils/types.d.ts +0 -5
  58. /package/src/lib/{utils → store/getCapabilities}/getCapabilities.d.ts +0 -0
  59. /package/src/lib/{utils → store/getCapabilities}/getCapabilities.spec.d.ts +0 -0
  60. /package/src/lib/{utils/__mocks__ → store/getCapabilities/mocks}/WMS111GetCapabilitiesGeoServicesRADAR.d.ts +0 -0
  61. /package/src/lib/{utils → store/layerSelect}/localStorage.d.ts +0 -0
  62. /package/src/lib/{utils → store/layerSelect}/localStorage.spec.d.ts +0 -0
  63. /package/src/lib/{components/SyncGroups/utils.spec.d.ts → store/mapStore/map/filterLayers.spec.d.ts} +0 -0
package/index.js CHANGED
@@ -3,13 +3,13 @@ import { createSelector } from 'reselect';
3
3
  import _, { isEqual as isEqual$1, compact, debounce, groupBy, throttle as throttle$2, range } from 'lodash';
4
4
  import moment from 'moment';
5
5
  import { takeLatest, put, select, call, takeEvery, all, delay } from 'redux-saga/effects';
6
+ import { WMGetServiceFromStore, LayerType as LayerType$1, clearImageCache, getMapImageStore, WMBBOX, debug as debug$3, DebugType, WMJSMap, WMLayer, legendImageStore, WMImageEventType, getLegendGraphicURLForLayer } from '@opengeoweb/webmap';
6
7
  import * as React from 'react';
7
- import React__default, { Component, useRef, useState as useState$1, useEffect as useEffect$1, useCallback, createElement, PureComponent, forwardRef, useContext, createContext, Fragment, cloneElement, isValidElement, createRef, useLayoutEffect as useLayoutEffect$1 } from 'react';
8
- import { useDispatch, useSelector, connect, Provider } from 'react-redux';
9
- import { Paper, Box as Box$2, Typography, Grid, MenuItem, useTheme as useTheme$2, Button, Popper, ListItemText, ListItemIcon, FormControl, InputLabel, List, ListItemButton, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, InputAdornment, DialogActions, LinearProgress, Backdrop, ListItem, ListItemSecondaryAction, Checkbox, Switch, styled as styled$1, Slider, Menu, Tooltip, IconButton, ButtonGroup, Divider, Snackbar } from '@mui/material';
10
- import { CustomTooltip, ToolContainerDraggable, CustomIconButton, TooltipSelect, AlertIcon, useControlledTooltip, tooltipContainerStyles, sliderHeaderStyle, CustomSlider, ToggleMenu, AlertBanner, CustomAccordion, calculateDialogSizeAndPosition, CustomToggleButton, SearchHighlight, useMakeSureContainerStaysInsideWindow, withEggs } from '@opengeoweb/shared';
11
- import { legendImageStore, WMImageEventType, getLegendGraphicURLForLayer, WMGetServiceFromStore, LayerType as LayerType$1, clearImageCache, getMapImageStore, WMBBOX, debug as debug$3, DebugType, WMJSMap, WMLayer } from '@opengeoweb/webmap';
8
+ import React__default, { useCallback, useEffect as useEffect$1, createElement, PureComponent, useState as useState$1, Component, forwardRef, useContext, createContext, Fragment, cloneElement, useRef, isValidElement, createRef, useLayoutEffect as useLayoutEffect$1 } from 'react';
9
+ import { Grid, Box as Box$2, MenuItem, Typography, useTheme as useTheme$2, Button, Popper, ListItemText, ListItemIcon, FormControl, InputLabel, Paper, List, ListItemButton, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, InputAdornment, DialogActions, LinearProgress, Backdrop, ListItem, ListItemSecondaryAction, Checkbox, Switch, styled as styled$1, Slider, Menu, Tooltip, IconButton, ButtonGroup, Divider, Snackbar } from '@mui/material';
10
+ import { CustomIconButton, TooltipSelect, AlertIcon, useControlledTooltip, CustomTooltip, tooltipContainerStyles, sliderHeaderStyle, CustomSlider, ToggleMenu, AlertBanner, CustomAccordion, ToolContainerDraggable, calculateDialogSizeAndPosition, CustomToggleButton, SearchHighlight, useMakeSureContainerStaysInsideWindow, withEggs } from '@opengeoweb/shared';
12
11
  import { CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, Add, Copy, None, FastForward, AutoUpdateActive, Both, Visibility, VisibilityOff, Delete, DragHandle as DragHandle$1, Cached, Filter, Search, Clear, Info, DimensionsOther, DimensionsElevation, DimensionsRefTime, DimensionsTime, Edit, Close, Home, Minus, Layers, Equalizer, Link, LinkOff, AutoUpdateInActive, Speed, Clock, Now, Animation, Options, Pause, Play, StepForward, StepBackward, dragHandlePath, ChevronDown, ChevronUp, Location, DrawPolygon, DrawRegion, List as List$1, ChevronRight, ChevronLeft, Resize, ExitDomain, ThemeWrapper, lightTheme } from '@opengeoweb/theme';
12
+ import { useDispatch, useSelector, connect, Provider } from 'react-redux';
13
13
  import { ReactSortable } from 'react-sortablejs';
14
14
  import Box$3 from '@mui/material/Box';
15
15
  import Typography$1 from '@mui/material/Typography';
@@ -2140,6 +2140,7 @@ var defaultAnimationDelayAtStart = 250;
2140
2140
  var defaultDelay = 1000; // [ms]
2141
2141
  var defaultTimeStep = 60;
2142
2142
  var defaultSecondsPerPx = 80;
2143
+ var IS_LEGEND_OPEN_BY_DEFAULT = false;
2143
2144
 
2144
2145
  var createMap = function createMap(_ref) {
2145
2146
  var id = _ref.id,
@@ -7310,29 +7311,9 @@ function replaceLayerIds(layers, autoLayerIdOld, autoLayerIdNew) {
7310
7311
  * See the License for the specific language governing permissions and
7311
7312
  * limitations under the License.
7312
7313
  *
7313
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7314
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
7314
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7315
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
7315
7316
  * */
7316
- var isValidService = function isValidService(service) {
7317
- return Object.prototype.hasOwnProperty.call(service, 'url');
7318
- };
7319
- var parseBoolean = function parseBoolean(value) {
7320
- return typeof value === 'boolean' ? value : value === 'true';
7321
- };
7322
- var parseLayer = function parseLayer(layer) {
7323
- return Object.assign(Object.assign(Object.assign({}, layer), !layer.id && {
7324
- id: generateLayerId()
7325
- }), layer.enabled && {
7326
- enabled: parseBoolean(layer.enabled)
7327
- });
7328
- };
7329
- var createEmtpyFilteredList = function createEmtpyFilteredList(existingList) {
7330
- return {
7331
- mapLayers: existingList,
7332
- baseLayers: existingList,
7333
- overLayers: existingList
7334
- };
7335
- };
7336
7317
  var filterLayers = function filterLayers() {
7337
7318
  var layers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
7338
7319
  var layerParser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (layer) {
@@ -7367,175 +7348,24 @@ var filterLayers = function filterLayers() {
7367
7348
  return layers;
7368
7349
  }, createEmtpyFilteredList([]));
7369
7350
  };
7370
- var filterServices = function filterServices(presetArray) {
7371
- var hasServices = presetArray && Array.isArray(presetArray) && presetArray.length > 0;
7372
- var validServices = hasServices ? presetArray.filter(function (preset) {
7373
- return isValidService(preset);
7374
- }) : null;
7375
- var hasValidServices = validServices && validServices.length > 0;
7376
- var services = hasValidServices ? validServices : undefined;
7377
- return services;
7378
- };
7379
- var filterMapPresets = function filterMapPresets(initialAppPreset) {
7380
- var preset = initialAppPreset && initialAppPreset.preset || {};
7381
- var layers = preset.layers,
7382
- services = preset.services,
7383
- baseServices = preset.baseServices;
7384
- var _ref = layers ? filterLayers(layers, parseLayer) : createEmtpyFilteredList(undefined),
7385
- baseLayers = _ref.baseLayers,
7386
- mapLayers = _ref.mapLayers;
7387
- var filterredServices = services ? filterServices(services) : undefined;
7388
- var filteredBaseServices = baseServices ? filterServices(baseServices) : undefined;
7389
- var filteredPreset = {
7390
- services: filterredServices,
7391
- baseServices: filteredBaseServices,
7392
- baseLayers: baseLayers,
7393
- mapLayers: mapLayers
7351
+ var createEmtpyFilteredList = function createEmtpyFilteredList(existingList) {
7352
+ return {
7353
+ mapLayers: existingList,
7354
+ baseLayers: existingList,
7355
+ overLayers: existingList
7394
7356
  };
7395
- return filteredPreset;
7396
- };
7397
-
7398
- /* *
7399
- * Licensed under the Apache License, Version 2.0 (the "License");
7400
- * you may not use this file except in compliance with the License.
7401
- * You may obtain a copy of the License at
7402
- *
7403
- * http://www.apache.org/licenses/LICENSE-2.0
7404
- *
7405
- * Unless required by applicable law or agreed to in writing, software
7406
- * distributed under the License is distributed on an "AS IS" BASIS,
7407
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7408
- * See the License for the specific language governing permissions and
7409
- * limitations under the License.
7410
- *
7411
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7412
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
7413
- * */
7414
- var DWD = {
7415
- name: 'DWD',
7416
- url: 'https://maps.dwd.de/geoserver/ows?',
7417
- id: 'dwd'
7418
- };
7419
- var nationaalgeoregister = {
7420
- name: 'nationaalgeoregister.nl',
7421
- url: 'https://geodata.nationaalgeoregister.nl/cbsgebiedsindelingen/wms?request=GetCapabilities&service=wms',
7422
- id: 'nationaalgeoregister'
7423
- };
7424
- var KNMImsgcpp = {
7425
- name: 'KNMImsgcpp',
7426
- url: 'https://adaguc-server-msg-cpp-portal.pmc.knmi.cloud/wms?DATASET=msgrt&',
7427
- id: 'msgcpp-ogc-realtime'
7428
- };
7429
- var HeiGit = {
7430
- name: 'HeiGit',
7431
- url: 'https://maps.heigit.org/osm-wms/service',
7432
- id: 'HeiGit-osm-wms'
7433
- };
7434
- var ArcGisCanvas = {
7435
- name: 'ArcGisCanvas',
7436
- url: 'https://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/',
7437
- id: 'ArcGisCanvas'
7438
- };
7439
- var KNMIgeoservicesBaselayers = {
7440
- name: 'KNMIgeoservicesBaselayers',
7441
- url: 'https://geoservices.knmi.nl/wms?DATASET=baselayers&',
7442
- id: 'KNMIgeoservicesBaselayers'
7443
- };
7444
- var KNMIgeoservicesRadar = {
7445
- name: 'KNMIgeoservicesRadar',
7446
- url: 'https://geoservices.knmi.nl/wms?dataset=RADAR&',
7447
- id: 'KNMIgeoservicesRadar'
7448
- };
7449
- var KNMIgeoservicesObs = {
7450
- name: 'KNMIgeoservicesObs',
7451
- url: 'https://geoservices.knmi.nl/adagucserver?dataset=OBS',
7452
- id: 'KNMIgeoservicesObs'
7453
- };
7454
- var KNMIgeoservicesKlimaatAtlas = {
7455
- name: 'KNMIgeoservicesKlimaatAtlas',
7456
- url: 'https://geoservices.knmi.nl/wms?DATASET=gsie-dataset&SERVICE=WMS&',
7457
- id: 'KNMIgeoservicesKlimaatAtlas'
7458
- };
7459
- var KNMIgeoservicesHarmonie = {
7460
- name: 'KNMIgeoservicesHarmonie',
7461
- url: 'https://geoservices.knmi.nl/wms?DATASET=HARM_N25&',
7462
- id: 'KNMIgeoservicesKliKNMIgeoservicesHarmoniemaatAtlas'
7463
- };
7464
- var KNMIgeoservicesHarmonieMLService = {
7465
- name: 'KNMI Harmonie ML',
7466
- url: 'https://geoservices.knmi.nl/wms?DATASET=HARM_N25_ML&SERVICE=WMS&',
7467
- id: 'harmonieML'
7468
- };
7469
- var MetNorwayService = {
7470
- name: 'MetNorwayService',
7471
- url: 'https://wms-e1.geoweb.met.no/wms?',
7472
- id: 'MetNorwayService'
7473
- };
7474
- var FMIopenwms = {
7475
- name: 'FMIopenwms',
7476
- url: 'https://openwms.fmi.fi/geoserver/wms?',
7477
- id: 'FMIopenwms'
7478
- };
7479
- var DWDObservations = {
7480
- name: 'DWDObservations',
7481
- url: 'https://maps.dwd.de/geoserver/dwd/Wetter_Beobachtungen/ows?',
7482
- id: 'DWDObservations'
7483
- };
7484
- var DWDWarnings = {
7485
- name: 'DWDWarnings',
7486
- url: 'https://maps.dwd.de/geoserver/dwd/Warnungen_Gemeinden_vereinigt/ows?',
7487
- id: 'DWDWarnings'
7488
- };
7489
- var DWDWXProdukt = {
7490
- name: 'DWDWXProdukt',
7491
- url: 'https://maps.dwd.de/geoserver/dwd/WX-Produkt/ows?',
7492
- id: 'DWDWXProdukt'
7493
- };
7494
- var EUMETSAT = {
7495
- name: 'EUMETSAT',
7496
- url: 'https://view.eumetsat.int/geoserver/wms?',
7497
- id: 'EUMETSAT'
7498
- };
7499
- var eumetviewEUMETSAT = {
7500
- name: 'eumetviewEUMETSAT',
7501
- url: 'https://eumetview.eumetsat.int/geoserv/wms?',
7502
- id: 'eumetviewEUMETSAT'
7503
7357
  };
7504
- var ECMWFPublicService = {
7505
- name: 'ECMWF',
7506
- url: 'https://eccharts.ecmwf.int/wms/?token=public',
7507
- id: 'ecmwf'
7358
+ var parseBoolean = function parseBoolean(value) {
7359
+ return typeof value === 'boolean' ? value : value === 'true';
7508
7360
  };
7509
- var MeteoCanada = {
7510
- name: 'Meteo Canada',
7511
- url: 'https://geo.weather.gc.ca/geomet/?lang=en&',
7512
- id: 'MeteoCanada'
7361
+ var parseLayer = function parseLayer(layer) {
7362
+ return Object.assign(Object.assign(Object.assign({}, layer), !layer.id && {
7363
+ id: generateLayerId()
7364
+ }), layer.enabled && {
7365
+ enabled: parseBoolean(layer.enabled)
7366
+ });
7513
7367
  };
7514
7368
 
7515
- var publicServices = /*#__PURE__*/Object.freeze({
7516
- __proto__: null,
7517
- DWD: DWD,
7518
- nationaalgeoregister: nationaalgeoregister,
7519
- KNMImsgcpp: KNMImsgcpp,
7520
- HeiGit: HeiGit,
7521
- ArcGisCanvas: ArcGisCanvas,
7522
- KNMIgeoservicesBaselayers: KNMIgeoservicesBaselayers,
7523
- KNMIgeoservicesRadar: KNMIgeoservicesRadar,
7524
- KNMIgeoservicesObs: KNMIgeoservicesObs,
7525
- KNMIgeoservicesKlimaatAtlas: KNMIgeoservicesKlimaatAtlas,
7526
- KNMIgeoservicesHarmonie: KNMIgeoservicesHarmonie,
7527
- KNMIgeoservicesHarmonieMLService: KNMIgeoservicesHarmonieMLService,
7528
- MetNorwayService: MetNorwayService,
7529
- FMIopenwms: FMIopenwms,
7530
- DWDObservations: DWDObservations,
7531
- DWDWarnings: DWDWarnings,
7532
- DWDWXProdukt: DWDWXProdukt,
7533
- EUMETSAT: EUMETSAT,
7534
- eumetviewEUMETSAT: eumetviewEUMETSAT,
7535
- ECMWFPublicService: ECMWFPublicService,
7536
- MeteoCanada: MeteoCanada
7537
- });
7538
-
7539
7369
  /* *
7540
7370
  * Licensed under the Apache License, Version 2.0 (the "License");
7541
7371
  * you may not use this file except in compliance with the License.
@@ -7549,53 +7379,21 @@ var publicServices = /*#__PURE__*/Object.freeze({
7549
7379
  * See the License for the specific language governing permissions and
7550
7380
  * limitations under the License.
7551
7381
  *
7552
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7553
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
7382
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7383
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
7554
7384
  * */
7555
- var baseLayer$1 = {
7556
- name: 'arcGisSat',
7557
- title: 'arcGisSat',
7558
- type: 'twms',
7559
- layerType: LayerType.baseLayer,
7560
- enabled: true,
7561
- id: generateLayerId()
7562
- };
7563
- // Base Layers List
7564
7385
  var baseLayerGrey$1 = {
7565
7386
  id: generateLayerId(),
7566
7387
  name: 'WorldMap_Light_Grey_Canvas',
7567
7388
  type: 'twms',
7568
7389
  layerType: LayerType.baseLayer
7569
7390
  };
7570
- var baseLayerOpenStreetMapNL$1 = {
7571
- id: 'base-layer-2',
7572
- name: 'OpenStreetMap_NL',
7573
- type: 'twms',
7574
- layerType: LayerType.baseLayer,
7575
- enabled: true
7576
- };
7577
- var baseLayerArcGisCanvas$1 = {
7578
- service: ArcGisCanvas.url,
7579
- id: generateLayerId(),
7580
- name: 'arcGisCanvas',
7581
- type: 'twms',
7582
- enabled: true,
7583
- layerType: LayerType.baseLayer
7584
- };
7585
- var baseLayerWorldMap$1 = {
7586
- id: generateLayerId(),
7587
- name: 'WorldMap',
7588
- type: 'twms',
7589
- layerType: LayerType.baseLayer,
7590
- enabled: true
7591
- };
7592
- var baseLayerHeiGit = {
7593
- service: HeiGit.url,
7594
- id: generateLayerId(),
7595
- name: 'osm_auto:all',
7596
- layerType: LayerType.baseLayer
7597
- };
7598
7391
  // Over Layers List
7392
+ var KNMIgeoservicesBaselayers = {
7393
+ name: 'KNMIgeoservicesBaselayers',
7394
+ url: 'https://geoservices.knmi.nl/wms?DATASET=baselayers&',
7395
+ id: 'KNMIgeoservicesBaselayers'
7396
+ };
7599
7397
  var overLayer$1 = {
7600
7398
  service: KNMIgeoservicesBaselayers.url,
7601
7399
  name: 'countryborders',
@@ -7604,1109 +7402,39 @@ var overLayer$1 = {
7604
7402
  id: generateLayerId(),
7605
7403
  layerType: LayerType.overLayer
7606
7404
  };
7607
- // KNMI msgcpp List
7608
- var msgCppLayer = {
7609
- // doesn't work with https
7610
- service: KNMImsgcpp.url,
7611
- name: 'lwe_precipitation_rate',
7612
- format: 'image/png',
7613
- enabled: true,
7614
- style: 'precip-transparent/nearest',
7615
- id: generateLayerId(),
7616
- layerType: LayerType.mapLayer
7617
- };
7618
- // Nederlandse Nationaal Georegister Layers list
7619
- var veiligheidsRegiosGebiedsIndelingenLabels = {
7620
- service: nationaalgeoregister.url,
7621
- name: 'cbsgebiedsindelingen:cbs_veiligheidsregio_2020_labelpoint',
7622
- style: 'CBS_Label',
7623
- enabled: false,
7624
- layerType: LayerType.mapLayer
7625
- };
7626
- var veiligheidsRegiosGebiedsIndelingen = {
7627
- service: nationaalgeoregister.url,
7628
- name: 'cbsgebiedsindelingen:cbs_veiligheidsregio_2020_gegeneraliseerd',
7629
- style: 'CBS_Gebiedsindeling',
7630
- enabled: false,
7631
- layerType: LayerType.mapLayer
7632
- };
7633
- // KNMI Geoservices Layers List
7634
- var radarLayer$1 = {
7635
- service: KNMIgeoservicesRadar.url,
7636
- name: 'RAD_NL25_PCP_CM',
7637
- format: 'image/png',
7638
- enabled: true,
7639
- style: 'radar/nearest',
7640
- id: generateLayerId(),
7641
- layerType: LayerType.mapLayer
7642
- };
7643
- var radarLayerWithError = {
7644
- service: KNMIgeoservicesRadar.url,
7645
- name: 'radarLayer',
7646
- format: 'image/png',
7647
- enabled: true,
7648
- style: 'knmiradar/nearest',
7649
- id: generateLayerId(),
7650
- layerType: LayerType.mapLayer
7651
- };
7652
- var obsAirTemperature = {
7653
- service: KNMIgeoservicesObs.url,
7654
- name: '10M/ta',
7655
- id: generateLayerId(),
7656
- layerType: LayerType.mapLayer
7657
- };
7658
- var obsWind = {
7659
- service: KNMIgeoservicesObs.url,
7660
- name: '10M/wind',
7661
- id: generateLayerId(),
7662
- layerType: LayerType.mapLayer
7663
- };
7664
- var obsAirPressureAtSeaLevel = {
7665
- service: KNMIgeoservicesObs.url,
7666
- name: '10M/pp',
7667
- id: generateLayerId(),
7668
- layerType: LayerType.mapLayer
7669
- };
7670
- var obsRelativeHumidity = {
7671
- service: KNMIgeoservicesObs.url,
7672
- name: '10M/rh',
7673
- id: generateLayerId(),
7674
- layerType: LayerType.mapLayer
7675
- };
7676
- var obsGlobalSolarRadiation = {
7677
- service: KNMIgeoservicesObs.url,
7678
- name: '10M/qg',
7679
- id: generateLayerId(),
7680
- layerType: LayerType.mapLayer
7681
- };
7682
- var obsPrecipitationIntensityPWS = {
7683
- service: KNMIgeoservicesObs.url,
7684
- name: '10M/pg',
7685
- id: generateLayerId(),
7686
- layerType: LayerType.mapLayer
7687
- };
7688
- var harmonieRelativeHumidityPl = {
7689
- service: KNMIgeoservicesHarmonie.url,
7690
- name: 'relative_humidity__at_pl',
7691
- id: generateLayerId(),
7692
- layerType: LayerType.mapLayer,
7693
- enabled: true
7694
- };
7695
- var harmonieWindPl = {
7696
- service: KNMIgeoservicesHarmonie.url,
7697
- name: 'wind__at_pl',
7698
- id: generateLayerId(),
7699
- layerType: LayerType.mapLayer,
7700
- enabled: true
7701
- };
7702
- var harmonieAirTemperature = {
7703
- service: KNMIgeoservicesHarmonie.url,
7704
- name: 'air_temperature__at_2m',
7705
- id: generateLayerId(),
7706
- layerType: LayerType.mapLayer,
7707
- enabled: true
7708
- };
7709
- var harmoniePrecipitation = {
7710
- service: KNMIgeoservicesHarmonie.url,
7711
- name: 'precipitation_flux',
7712
- id: generateLayerId(),
7713
- layerType: LayerType.mapLayer,
7714
- enabled: true
7715
- };
7716
- var harmoniePressure = {
7717
- service: KNMIgeoservicesHarmonie.url,
7718
- name: 'air_pressure_at_sea_level',
7719
- id: generateLayerId(),
7720
- layerType: LayerType.mapLayer,
7721
- enabled: true
7722
- };
7723
- var harmonieWindFlags = {
7724
- service: KNMIgeoservicesHarmonie.url,
7725
- name: 'wind__at_10m',
7726
- enabled: true,
7727
- id: generateLayerId(),
7728
- layerType: LayerType.mapLayer
7729
- };
7730
- var klimaatAtlasTG3 = {
7731
- service: KNMIgeoservicesKlimaatAtlas.url,
7732
- name: 'TG3',
7733
- enabled: true,
7734
- id: generateLayerId(),
7735
- layerType: LayerType.mapLayer
7736
- };
7737
- // DWD Layers List
7738
- var dwdWarningLayer = {
7739
- service: DWDWarnings.url,
7740
- name: 'Warnungen_Gemeinden_vereinigt',
7741
- format: 'image/png',
7742
- // style: 'warnungen_gemeinden_vereinigt_event_seamless_param',
7743
- enabled: true,
7744
- id: generateLayerId(),
7745
- layerType: LayerType.mapLayer
7746
- };
7747
- var dwdRadarLayer = {
7748
- service: DWDWXProdukt.url,
7749
- name: 'WX-Produkt',
7750
- format: 'image/png',
7751
- enabled: true,
7752
- id: generateLayerId(),
7753
- layerType: LayerType.mapLayer
7754
- };
7755
- // this needs authentication to work
7756
- var dwdObservationsWetterLayer = {
7757
- service: DWDObservations.url,
7758
- name: 'Wetter_Beobachtungen',
7759
- style: 'Wetter_Symbole',
7760
- format: 'image/png',
7761
- enabled: true,
7762
- id: generateLayerId(),
7763
- layerType: LayerType.mapLayer
7764
- // headers: [{ name: 'Authorization', value: 'Basic ...' }]
7765
- };
7766
7405
 
7767
- var dwdObservationsWetterLayerWithHeader = {
7768
- service: DWDObservations.url,
7769
- name: 'Wetter_Beobachtungen',
7770
- style: 'Wetter_Symbole',
7771
- format: 'image/png',
7772
- enabled: true,
7773
- id: generateLayerId(),
7774
- layerType: LayerType.mapLayer,
7775
- headers: [{
7776
- name: 'authorization',
7777
- value: 'Basic aW50cmFuZXQtdXNlcjpDQnMjMTEh'
7778
- }]
7779
- };
7780
- // this needs authentication to work
7781
- var dwdObservationsWindLayer = {
7782
- service: DWDObservations.url,
7783
- name: 'Wetter_Beobachtungen',
7784
- style: 'Wetter_Wind',
7785
- format: 'image/png',
7786
- enabled: true,
7787
- id: generateLayerId(),
7788
- layerType: LayerType.mapLayer
7789
- };
7790
- // FMI open wms Layers List
7791
- var FMITemp = {
7792
- service: FMIopenwms.url,
7793
- name: 'temperature-forecast',
7794
- format: 'image/png',
7795
- enabled: true,
7796
- id: generateLayerId(),
7797
- layerType: LayerType.mapLayer
7798
- };
7799
- // Met Norway Layers List
7800
- var MetNoTemp = {
7801
- service: MetNorwayService.url,
7802
- name: 'thredds_meps_latest_wind',
7803
- format: 'image/png',
7804
- enabled: true,
7805
- id: generateLayerId(),
7806
- layerType: LayerType.mapLayer
7807
- };
7808
- var metNorwayWind1 = {
7809
- service: MetNorwayService.url,
7810
- name: 'thredds_meps_latest_wind',
7811
- format: 'image/png',
7812
- enabled: true,
7813
- id: generateLayerId(),
7814
- layerType: LayerType.mapLayer
7406
+ var _marked$4 = /*#__PURE__*/_regeneratorRuntime().mark(updateAnimation),
7407
+ _marked2$4 = /*#__PURE__*/_regeneratorRuntime().mark(handleBaseLayersSaga),
7408
+ _marked3 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$4);
7409
+ // Expects start, end time as moment object and interval in minutes
7410
+ var generateTimeList = function generateTimeList(start, end, interval) {
7411
+ var timeList = [];
7412
+ var unixStart = moment(start).utc().unix();
7413
+ var unixEnd = moment(end).utc().unix();
7414
+ var intervalSeconds = interval * 60;
7415
+ for (var j = unixStart; j <= unixEnd; j += intervalSeconds) {
7416
+ timeList.push({
7417
+ name: 'time',
7418
+ value: moment.unix(j).toISOString()
7419
+ });
7420
+ }
7421
+ return timeList;
7815
7422
  };
7816
- var metNorwayWind2 = {
7817
- service: MetNorwayService.url,
7818
- name: 'thredds_aromearctic_extracted_t',
7819
- format: 'image/png',
7820
- enabled: true,
7821
- id: generateLayerId(),
7822
- layerType: LayerType.mapLayer
7423
+ var getAnimationEndTime = function getAnimationEndTime(animationEndTime) {
7424
+ var calculateFromNow = animationEndTime.split(/[-+]/)[0] === 'NOW';
7425
+ var isAddingTime = animationEndTime.indexOf('+') !== -1;
7426
+ var timeInMinutes = moment.duration(animationEndTime.split(/[-+]/)[1]).asMinutes();
7427
+ var startingTime = calculateFromNow ? moment().utc() : moment().utc().startOf('day');
7428
+ var newAnimationEndTime = isAddingTime ? moment(startingTime).add(timeInMinutes, 'minutes').toISOString() : moment(startingTime).subtract(timeInMinutes, 'minutes').toISOString();
7429
+ return newAnimationEndTime;
7823
7430
  };
7824
- var metNorwayWind3 = {
7825
- service: MetNorwayService.url,
7826
- name: 'thredds_nk800_temperature',
7827
- format: 'image/png',
7828
- enabled: true,
7829
- id: generateLayerId(),
7830
- layerType: LayerType.mapLayer
7431
+ var isAnimationEndTimeValid = function isAnimationEndTimeValid(animationEndTime) {
7432
+ var hasValidPrefix = animationEndTime.split(/[-+]/)[0] === 'NOW' || animationEndTime.split(/[-+]/)[0] === 'TODAY';
7433
+ var hasValidDate = moment.isDuration(moment.duration(animationEndTime.split(/[-+]/)[1]));
7434
+ return hasValidPrefix && hasValidDate;
7831
7435
  };
7832
- var metNorwayLatestT = {
7833
- service: MetNorwayService.url,
7834
- name: 'thredds_meps_latest_t',
7835
- format: 'image/png',
7836
- enabled: true,
7837
- id: generateLayerId(),
7838
- layerType: LayerType.mapLayer
7839
- };
7840
- var metNorwaySalinaty = {
7841
- service: MetNorwayService.url,
7842
- name: 'thredds_barents_2_5km_1h_salinity',
7843
- format: 'image/png',
7844
- enabled: true,
7845
- id: generateLayerId(),
7846
- layerType: LayerType.mapLayer
7847
- };
7848
- var msgFesEUMETSAT = {
7849
- service: EUMETSAT.url,
7850
- name: 'msg_fes:rgb_eview',
7851
- enabled: true,
7852
- id: generateLayerId(),
7853
- layerType: LayerType.mapLayer
7854
- };
7855
- var msgNaturalenhncdEUMETSAT = {
7856
- service: eumetviewEUMETSAT.url,
7857
- name: 'meteosat:msg_naturalenhncd',
7858
- enabled: true,
7859
- id: generateLayerId(),
7860
- layerType: LayerType.mapLayer
7861
- };
7862
- var msgAshEUMETSAT = {
7863
- service: eumetviewEUMETSAT.url,
7864
- name: 'meteosat:msg_ash',
7865
- enabled: true,
7866
- id: generateLayerId(),
7867
- layerType: LayerType.mapLayer
7868
- };
7869
- var msgCthEUMETSAT = {
7870
- service: eumetviewEUMETSAT.url,
7871
- name: 'meteosat:msg_cth',
7872
- enabled: true,
7873
- id: generateLayerId(),
7874
- layerType: LayerType.mapLayer
7875
- };
7876
- var msgFogEUMETSAT = {
7877
- service: eumetviewEUMETSAT.url,
7878
- name: 'meteosat:msg_fog',
7879
- enabled: true,
7880
- id: generateLayerId(),
7881
- layerType: LayerType.mapLayer
7882
- };
7883
- var msgNaturalEUMETSAT = {
7884
- service: eumetviewEUMETSAT.url,
7885
- name: 'meteosat:msg_natural',
7886
- enabled: true,
7887
- id: generateLayerId(),
7888
- layerType: LayerType.mapLayer
7889
- };
7890
-
7891
- var publicLayers = /*#__PURE__*/Object.freeze({
7892
- __proto__: null,
7893
- baseLayer: baseLayer$1,
7894
- baseLayerGrey: baseLayerGrey$1,
7895
- baseLayerOpenStreetMapNL: baseLayerOpenStreetMapNL$1,
7896
- baseLayerArcGisCanvas: baseLayerArcGisCanvas$1,
7897
- baseLayerWorldMap: baseLayerWorldMap$1,
7898
- baseLayerHeiGit: baseLayerHeiGit,
7899
- overLayer: overLayer$1,
7900
- msgCppLayer: msgCppLayer,
7901
- veiligheidsRegiosGebiedsIndelingenLabels: veiligheidsRegiosGebiedsIndelingenLabels,
7902
- veiligheidsRegiosGebiedsIndelingen: veiligheidsRegiosGebiedsIndelingen,
7903
- radarLayer: radarLayer$1,
7904
- radarLayerWithError: radarLayerWithError,
7905
- obsAirTemperature: obsAirTemperature,
7906
- obsWind: obsWind,
7907
- obsAirPressureAtSeaLevel: obsAirPressureAtSeaLevel,
7908
- obsRelativeHumidity: obsRelativeHumidity,
7909
- obsGlobalSolarRadiation: obsGlobalSolarRadiation,
7910
- obsPrecipitationIntensityPWS: obsPrecipitationIntensityPWS,
7911
- harmonieRelativeHumidityPl: harmonieRelativeHumidityPl,
7912
- harmonieWindPl: harmonieWindPl,
7913
- harmonieAirTemperature: harmonieAirTemperature,
7914
- harmoniePrecipitation: harmoniePrecipitation,
7915
- harmoniePressure: harmoniePressure,
7916
- harmonieWindFlags: harmonieWindFlags,
7917
- klimaatAtlasTG3: klimaatAtlasTG3,
7918
- dwdWarningLayer: dwdWarningLayer,
7919
- dwdRadarLayer: dwdRadarLayer,
7920
- dwdObservationsWetterLayer: dwdObservationsWetterLayer,
7921
- dwdObservationsWetterLayerWithHeader: dwdObservationsWetterLayerWithHeader,
7922
- dwdObservationsWindLayer: dwdObservationsWindLayer,
7923
- FMITemp: FMITemp,
7924
- MetNoTemp: MetNoTemp,
7925
- metNorwayWind1: metNorwayWind1,
7926
- metNorwayWind2: metNorwayWind2,
7927
- metNorwayWind3: metNorwayWind3,
7928
- metNorwayLatestT: metNorwayLatestT,
7929
- metNorwaySalinaty: metNorwaySalinaty,
7930
- msgFesEUMETSAT: msgFesEUMETSAT,
7931
- msgNaturalenhncdEUMETSAT: msgNaturalenhncdEUMETSAT,
7932
- msgAshEUMETSAT: msgAshEUMETSAT,
7933
- msgCthEUMETSAT: msgCthEUMETSAT,
7934
- msgFogEUMETSAT: msgFogEUMETSAT,
7935
- msgNaturalEUMETSAT: msgNaturalEUMETSAT
7936
- });
7937
-
7938
- var CanvasComponent = /*#__PURE__*/function (_Component) {
7939
- _inherits(CanvasComponent, _Component);
7940
- var _super = _createSuper(CanvasComponent);
7941
- function CanvasComponent(props) {
7942
- var _this;
7943
- _classCallCheck$1(this, CanvasComponent);
7944
- _this = _super.call(this, props);
7945
- _this.canvas = null;
7946
- _this.ctx = null;
7947
- _this.currentWidth = 1;
7948
- _this.currentHeight = 1;
7949
- _this.canvascontaineroutside = null;
7950
- _this.canvascontainer = null;
7951
- _this.timer = null;
7952
- _this.redrawTimer = null;
7953
- _this.loopHasStarted = false;
7954
- _this.mounted = false;
7955
- _this.updateCanvas = _this.updateCanvas.bind(_assertThisInitialized$1(_this));
7956
- _this.handleMouseMoveEvent = _this.handleMouseMoveEvent.bind(_assertThisInitialized$1(_this));
7957
- _this.handleMouseUpEvent = _this.handleMouseUpEvent.bind(_assertThisInitialized$1(_this));
7958
- _this.handleMouseDownEvent = _this.handleMouseDownEvent.bind(_assertThisInitialized$1(_this));
7959
- _this.resize = _this.resize.bind(_assertThisInitialized$1(_this));
7960
- _this._handleWindowResize = _this._handleWindowResize.bind(_assertThisInitialized$1(_this));
7961
- _this.handleClickEvent = _this.handleClickEvent.bind(_assertThisInitialized$1(_this));
7962
- _this.handleWheelEvent = _this.handleWheelEvent.bind(_assertThisInitialized$1(_this));
7963
- _this.handleTouchStartEvent = _this.handleTouchStartEvent.bind(_assertThisInitialized$1(_this));
7964
- _this.handleTouchEndEvent = _this.handleTouchEndEvent.bind(_assertThisInitialized$1(_this));
7965
- _this.handleTouchMoveEvent = _this.handleTouchMoveEvent.bind(_assertThisInitialized$1(_this));
7966
- _this.onKeyUp = _this.onKeyUp.bind(_assertThisInitialized$1(_this));
7967
- _this.onBlur = _this.onBlur.bind(_assertThisInitialized$1(_this));
7968
- _this.onFocus = _this.onFocus.bind(_assertThisInitialized$1(_this));
7969
- _this.startLoop = _this.startLoop.bind(_assertThisInitialized$1(_this));
7970
- _this._documentKeyDown = _this._documentKeyDown.bind(_assertThisInitialized$1(_this));
7971
- _this._isFocussed = false;
7972
- _this.canvas = null;
7973
- _this.canvascontaineroutside = /*#__PURE__*/React__default.createRef();
7974
- _this.canvascontainer = /*#__PURE__*/React__default.createRef();
7975
- return _this;
7976
- }
7977
- _createClass$1(CanvasComponent, [{
7978
- key: "componentDidMount",
7979
- value: function componentDidMount() {
7980
- var _this2 = this;
7981
- this.mounted = true;
7982
- if (this.canvas) {
7983
- this.canvas.addEventListener('mousemove', this.handleMouseMoveEvent);
7984
- this.canvas.addEventListener('mouseup', this.handleMouseUpEvent);
7985
- this.canvas.addEventListener('mousedown', this.handleMouseDownEvent);
7986
- this.canvas.addEventListener('touchstart', this.handleTouchStartEvent);
7987
- this.canvas.addEventListener('touchend', this.handleTouchEndEvent);
7988
- this.canvas.addEventListener('touchmove', this.handleTouchMoveEvent);
7989
- this.canvas.addEventListener('wheel', this.handleWheelEvent);
7990
- this.canvas.addEventListener('click', this.handleClickEvent);
7991
- document.addEventListener('keydown', this._documentKeyDown, false);
7992
- this.resize();
7993
- this.updateCanvas();
7994
- }
7995
- var _this$props = this.props,
7996
- onKeyUp = _this$props.onKeyUp,
7997
- loopInterval = _this$props.redrawInterval;
7998
- if (onKeyUp) {
7999
- window.addEventListener('keyup', this.onKeyUp);
8000
- }
8001
- window.addEventListener('resize', this._handleWindowResize);
8002
- if (this.canvascontaineroutside && this.canvascontaineroutside.current && onKeyUp) {
8003
- this.canvascontaineroutside.current.focus();
8004
- }
8005
- this.timer = setInterval(function () {
8006
- _this2.resize();
8007
- }, 1000);
8008
- if (loopInterval) {
8009
- this.redrawTimer = setInterval(function () {
8010
- _this2.updateCanvas();
8011
- }, loopInterval);
8012
- }
8013
- }
8014
- }, {
8015
- key: "shouldComponentUpdate",
8016
- value: function shouldComponentUpdate() {
8017
- var _this3 = this;
8018
- window.requestAnimationFrame(function () {
8019
- _this3.updateCanvas();
8020
- });
8021
- return false;
8022
- }
8023
- }, {
8024
- key: "componentWillUnmount",
8025
- value: function componentWillUnmount() {
8026
- this.mounted = false;
8027
- window.removeEventListener('resize', this._handleWindowResize);
8028
- var onKeyUp = this.props.onKeyUp;
8029
- if (onKeyUp) {
8030
- window.removeEventListener('keyup', this.onKeyUp);
8031
- }
8032
- if (this.canvas) {
8033
- this.canvas.removeEventListener('mousedown', this.handleMouseDownEvent);
8034
- this.canvas.removeEventListener('mouseup', this.handleMouseUpEvent);
8035
- this.canvas.removeEventListener('mousemove', this.handleMouseMoveEvent);
8036
- this.canvas.removeEventListener('touchstart', this.handleTouchStartEvent);
8037
- this.canvas.removeEventListener('touchend', this.handleTouchEndEvent);
8038
- this.canvas.removeEventListener('touchmove', this.handleTouchMoveEvent);
8039
- this.canvas.removeEventListener('wheel', this.handleWheelEvent);
8040
- this.canvas.removeEventListener('click', this.handleClickEvent);
8041
- document.removeEventListener('keydown', this._documentKeyDown);
8042
- }
8043
- clearInterval(this.timer);
8044
- clearInterval(this.redrawTimer);
8045
- }
8046
- }, {
8047
- key: "onFocus",
8048
- value: function onFocus() {
8049
- var isFocussed = this.props.isFocussed;
8050
- this._isFocussed = true;
8051
- if (isFocussed) {
8052
- isFocussed(true);
8053
- }
8054
- }
8055
- }, {
8056
- key: "onBlur",
8057
- value: function onBlur() {
8058
- var isFocussed = this.props.isFocussed;
8059
- this._isFocussed = false;
8060
- if (isFocussed) {
8061
- isFocussed(false);
8062
- }
8063
- }
8064
- }, {
8065
- key: "onKeyUp",
8066
- value: function onKeyUp(event) {
8067
- var onKeyUp = this.props.onKeyUp;
8068
- if (onKeyUp) {
8069
- onKeyUp(event);
8070
- }
8071
- if (this.canvascontaineroutside && this.canvascontaineroutside.current && onKeyUp) {
8072
- if (event.code === 'Escape') {
8073
- this.canvascontaineroutside.current.focus();
8074
- }
8075
- }
8076
- }
8077
- }, {
8078
- key: "_documentKeyDown",
8079
- value: function _documentKeyDown(event) {
8080
- if (this._isFocussed) {
8081
- var onKeyDown = this.props.onKeyDown;
8082
- if (onKeyDown) {
8083
- onKeyDown(event);
8084
- }
8085
- }
8086
- }
8087
- }, {
8088
- key: "_handleWindowResize",
8089
- value: function _handleWindowResize() {
8090
- this.resize();
8091
- }
8092
- }, {
8093
- key: "startLoop",
8094
- value: function startLoop() {
8095
- var onRenderCanvas = this.props.onRenderCanvas;
8096
- if (this.mounted === false || this.loopHasStarted === false) {
8097
- return;
8098
- }
8099
- if (this.canvas) {
8100
- onRenderCanvas(this.ctx, this.currentWidth, this.currentHeight, this.canvas);
8101
- }
8102
- requestAnimationFrame(this.startLoop);
8103
- }
8104
- }, {
8105
- key: "updateCanvas",
8106
- value: function updateCanvas() {
8107
- if (!this.canvas) {
8108
- return;
8109
- }
8110
- var _this$props2 = this.props,
8111
- onRenderCanvas = _this$props2.onRenderCanvas,
8112
- loop = _this$props2.loop;
8113
- this.ctx = this.canvas.getContext('2d');
8114
- if (!this.ctx) {
8115
- return;
8116
- }
8117
- if (this.ctx.canvas.height !== this.currentHeight) {
8118
- this.ctx.canvas.height = this.currentHeight;
8119
- }
8120
- if (this.ctx.canvas.width !== this.currentWidth) {
8121
- this.ctx.canvas.width = this.currentWidth;
8122
- }
8123
- if (loop !== true) {
8124
- this.loopHasStarted = false;
8125
- onRenderCanvas(this.ctx, this.currentWidth, this.currentHeight, this.canvas);
8126
- } else if (this.loopHasStarted === false) {
8127
- this.loopHasStarted = true;
8128
- this.startLoop();
8129
- }
8130
- }
8131
- }, {
8132
- key: "resize",
8133
- value: function resize() {
8134
- var canvascontainer = this.canvascontainer,
8135
- resizeCallback = this.props.resizeCallback;
8136
- if (canvascontainer && canvascontainer.current) {
8137
- var newWidth = canvascontainer.current.clientWidth;
8138
- var newHeight = canvascontainer.current.clientHeight;
8139
- if (newWidth !== undefined && newHeight !== undefined && (this.currentWidth !== newWidth || this.currentHeight !== newHeight)) {
8140
- this.currentWidth = newWidth;
8141
- this.currentHeight = newHeight;
8142
- this.updateCanvas();
8143
- resizeCallback && resizeCallback(newWidth);
8144
- }
8145
- }
8146
- }
8147
- }, {
8148
- key: "handleMouseMoveEvent",
8149
- value: function handleMouseMoveEvent(event) {
8150
- var _this$props3 = this.props,
8151
- onMouseMove = _this$props3.onMouseMove,
8152
- onCanvasClick = _this$props3.onCanvasClick;
8153
- var x = event.offsetX;
8154
- var y = event.offsetY;
8155
- if (event.buttons === 1) {
8156
- onCanvasClick(x, y, this.currentWidth, this.currentHeight);
8157
- }
8158
- onMouseMove(x, y, event, this.currentWidth);
8159
- }
8160
- }, {
8161
- key: "handleMouseUpEvent",
8162
- value: function handleMouseUpEvent(event) {
8163
- var onMouseUp = this.props.onMouseUp;
8164
- var x = event.offsetX;
8165
- onMouseUp(x);
8166
- }
8167
- }, {
8168
- key: "handleMouseDownEvent",
8169
- value: function handleMouseDownEvent(event) {
8170
- var onMouseDown = this.props.onMouseDown;
8171
- var x = event.offsetX;
8172
- var y = event.offsetY;
8173
- onMouseDown(x, y, this.currentWidth);
8174
- }
8175
- }, {
8176
- key: "handleTouchStartEvent",
8177
- value: function handleTouchStartEvent(event) {
8178
- var onTouchStart = this.props.onTouchStart;
8179
- onTouchStart(event, this.currentWidth);
8180
- }
8181
- }, {
8182
- key: "handleTouchEndEvent",
8183
- value: function handleTouchEndEvent() {
8184
- var onTouchEnd = this.props.onTouchEnd;
8185
- onTouchEnd();
8186
- }
8187
- }, {
8188
- key: "handleTouchMoveEvent",
8189
- value: function handleTouchMoveEvent(event) {
8190
- var _this$props4 = this.props,
8191
- onTouchMove = _this$props4.onTouchMove,
8192
- onCanvasClick = _this$props4.onCanvasClick;
8193
- var touches = event && event.touches && event.touches[0];
8194
- if (touches && touches.clientX && touches.clientY) {
8195
- var x2 = event.touches[0].clientX - event.touches[0].target.offsetLeft;
8196
- var y2 = event.touches[0].clientY;
8197
- onCanvasClick(x2, y2, this.currentWidth, this.currentHeight);
8198
- }
8199
- onTouchMove(event, this.currentWidth);
8200
- }
8201
- }, {
8202
- key: "handleClickEvent",
8203
- value: function handleClickEvent(event) {
8204
- var onCanvasClick = this.props.onCanvasClick;
8205
- var x = event.offsetX;
8206
- var y = event.offsetY;
8207
- onCanvasClick(x, y, this.currentWidth, this.currentHeight);
8208
- }
8209
- }, {
8210
- key: "handleWheelEvent",
8211
- value: function handleWheelEvent(event) {
8212
- var onWheel = this.props.onWheel;
8213
- onWheel({
8214
- event: event,
8215
- deltaY: event.deltaY,
8216
- deltaX: event.deltaX,
8217
- canvasWidth: event.srcElement.width,
8218
- mouseX: event.offsetX
8219
- });
8220
- }
8221
- }, {
8222
- key: "render",
8223
- value: function render() {
8224
- var _this4 = this;
8225
- this.updateCanvas();
8226
- this._handleWindowResize();
8227
- return /*#__PURE__*/React__default.createElement("div", {
8228
- role: "button",
8229
- ref: this.canvascontaineroutside,
8230
- tabIndex: 0,
8231
- onFocus: this.onFocus,
8232
- onBlur: this.onBlur,
8233
- style: {
8234
- height: '100%',
8235
- width: '100%',
8236
- border: 'none',
8237
- display: 'block',
8238
- overflow: 'hidden'
8239
- }
8240
- }, /*#__PURE__*/React__default.createElement("div", {
8241
- ref: this.canvascontainer,
8242
- style: {
8243
- minWidth: 'inherit',
8244
- minHeight: 'inherit',
8245
- width: 'inherit',
8246
- height: 'inherit',
8247
- overflow: 'hidden',
8248
- display: 'block',
8249
- border: 'none'
8250
- }
8251
- }, /*#__PURE__*/React__default.createElement("div", {
8252
- style: {
8253
- overflow: 'visible',
8254
- width: 0,
8255
- height: 0
8256
- }
8257
- }, /*#__PURE__*/React__default.createElement("canvas", {
8258
- ref: function ref(canvas) {
8259
- _this4.canvas = canvas;
8260
- }
8261
- }))));
8262
- }
8263
- }]);
8264
- return CanvasComponent;
8265
- }(Component);
8266
- CanvasComponent.defaultProps = {
8267
- onRenderCanvas: function onRenderCanvas() {
8268
- /* intentionally left blank */
8269
- },
8270
- onCanvasClick: function onCanvasClick() {
8271
- /* intentionally left blank */
8272
- },
8273
- onMouseMove: function onMouseMove() {
8274
- /* intentionally left blank */
8275
- },
8276
- onMouseUp: function onMouseUp() {
8277
- /* intentionally left blank */
8278
- },
8279
- onMouseDown: function onMouseDown() {
8280
- /* intentionally left blank */
8281
- },
8282
- onTouchStart: function onTouchStart() {
8283
- /* intentionally left blank */
8284
- },
8285
- onTouchEnd: function onTouchEnd() {
8286
- /* intentionally left blank */
8287
- },
8288
- onTouchMove: function onTouchMove() {
8289
- /* intentionally left blank */
8290
- },
8291
- onWheel: function onWheel() {
8292
- /* intentionally left blank */
8293
- }
8294
- };
8295
-
8296
- /* *
8297
- * Licensed under the Apache License, Version 2.0 (the "License");
8298
- * you may not use this file except in compliance with the License.
8299
- * You may obtain a copy of the License at
8300
- *
8301
- * http://www.apache.org/licenses/LICENSE-2.0
8302
- *
8303
- * Unless required by applicable law or agreed to in writing, software
8304
- * distributed under the License is distributed on an "AS IS" BASIS,
8305
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8306
- * See the License for the specific language governing permissions and
8307
- * limitations under the License.
8308
- *
8309
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8310
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
8311
- * */
8312
- var LegendLayout = function LegendLayout(_ref) {
8313
- var title = _ref.title,
8314
- name = _ref.name,
8315
- dimensions = _ref.dimensions,
8316
- children = _ref.children,
8317
- height = _ref.height,
8318
- width = _ref.width,
8319
- minWidth = _ref.minWidth;
8320
- return /*#__PURE__*/React__default.createElement(Paper, {
8321
- "data-testid": "legend",
8322
- sx: {
8323
- padding: '10px',
8324
- border: '1px solid grey',
8325
- backgroundColor: '#FFF',
8326
- overflow: 'hidden',
8327
- marginBottom: 0.5
8328
- }
8329
- }, /*#__PURE__*/React__default.createElement(Box$2, {
8330
- "data-testid": "legend-title"
8331
- }, /*#__PURE__*/React__default.createElement(Typography, {
8332
- sx: {
8333
- fontFamily: 'Roboto, Helvetica, Arial',
8334
- fontSize: '10px',
8335
- minWidth: '100%',
8336
- wordWrap: 'break-word',
8337
- color: 'common.black',
8338
- whiteSpace: 'nowrap'
8339
- },
8340
- variant: "h3"
8341
- }, title)), /*#__PURE__*/React__default.createElement(CustomTooltip, {
8342
- title: title || 'loading',
8343
- placement: "top"
8344
- }, /*#__PURE__*/React__default.createElement(Box$2, {
8345
- sx: {
8346
- margin: '10px 0px 10px 0px',
8347
- height: "".concat(height, "px"),
8348
- width: "".concat(width, "px")
8349
- }
8350
- }, children)), /*#__PURE__*/React__default.createElement(Box$2, {
8351
- "data-testid": "legend-info",
8352
- sx: Object.assign({
8353
- fontFamily: 'Roboto, Helvetica, Arial',
8354
- fontSize: 10,
8355
- color: 'common.black',
8356
- overflowX: 'hidden',
8357
- wordWrap: 'break-word',
8358
- whiteSpace: 'nowrap'
8359
- }, minWidth && {
8360
- minWidth: "".concat(minWidth, "px")
8361
- })
8362
- }, dimensions && dimensions.map(function (dim) {
8363
- return /*#__PURE__*/React__default.createElement(Box$2, {
8364
- key: name + dim.name
8365
- }, dim.name === 'time' ? "".concat(dim.currentValue) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box$2, {
8366
- style: {
8367
- fontWeight: 500
8368
- }
8369
- }, dim.name, ":"), dim.currentValue, " ", dim.units));
8370
- })));
8371
- };
8372
-
8373
- var defaultCanvasWidth = 150;
8374
- var defaultCanvasHeight = 30;
8375
- /**
8376
- * Renders a legendgraphic image based on a WMImage.
8377
- *
8378
- * @param wmImage The wmImage element to render (from WMImage.js)
8379
- * @param ctx The canvas to render the image on
8380
- * @param width The width you want the image to have
8381
- * @param height The height you want the image to have
8382
- */
8383
- var renderLegendGraphic = function renderLegendGraphic(wmImage, ctx, width, height) {
8384
- ctx.beginPath();
8385
- ctx.fillStyle = 'white';
8386
- ctx.rect(0, 0, width, height);
8387
- ctx.fill();
8388
- if (wmImage) {
8389
- if (wmImage.isLoading()) {
8390
- /* Legend image is loading */
8391
- ctx.fillStyle = 'blue';
8392
- ctx.fillText('... loading ...', 10, 10);
8393
- } else if (wmImage.hasError()) {
8394
- /* Legend image has an error */
8395
- ctx.fillStyle = 'red';
8396
- ctx.fillText('error :(', 10, 10);
8397
- } else {
8398
- /* All OK, just draw the legend image */
8399
- ctx.drawImage(wmImage.getElement(), 0, 0, Math.min(wmImage.getElement().width, width), Math.min(wmImage.getElement().height, height));
8400
- }
8401
- }
8402
- };
8403
- var Legend = function Legend(_ref) {
8404
- var layer = _ref.layer;
8405
- /* Variable to remember the previous image */
8406
- var previousLegendImage = useRef(null);
8407
- /* Function to force rerender of this component when legend image loads */
8408
- var _useState = useState$1(),
8409
- _useState2 = _slicedToArray(_useState, 2),
8410
- setState = _useState2[1];
8411
- var layerId = layer && layer.id;
8412
- /* The canvas listens to the size of its container. We will update it according to the image size. */
8413
- var _useState3 = useState$1(defaultCanvasWidth),
8414
- _useState4 = _slicedToArray(_useState3, 2),
8415
- canvasContainerWidth = _useState4[0],
8416
- setCanvasContainerWidth = _useState4[1];
8417
- var _useState5 = useState$1(defaultCanvasHeight),
8418
- _useState6 = _slicedToArray(_useState5, 2),
8419
- canvasContainerHeight = _useState6[0],
8420
- setCanvasContainerHeight = _useState6[1];
8421
- var imageWidth;
8422
- var imageHeight;
8423
- /* Register callback to legendImagestore to trigger rerender when image is loaded. */
8424
- useEffect$1(function () {
8425
- legendImageStore.addImageEventCallback(function (image, id, imageEventType) {
8426
- if (imageEventType === WMImageEventType.Loaded) {
8427
- setState(null);
8428
- }
8429
- }, "Legend_".concat(layerId));
8430
- return function () {
8431
- legendImageStore.removeEventCallback("Legend_".concat(layerId));
8432
- };
8433
- }, [layerId]);
8434
- /* Should not do anything if no layer is given */
8435
- if (!layer) {
8436
- return null;
8437
- }
8438
- var isLayerEnabled = layer.enabled;
8439
- if (!isLayerEnabled) {
8440
- return null;
8441
- }
8442
- var layerOpacity = layer.opacity ? layer.opacity : 1;
8443
- /* Get the wmLayer, it has more detailed info about the WMS service,
8444
- like a title and the WMS legendgraphic url */
8445
- var wmLayer = getWMLayerById(layer.id);
8446
- return /*#__PURE__*/React__default.createElement(LegendLayout, {
8447
- title: wmLayer === null || wmLayer === void 0 ? void 0 : wmLayer.title,
8448
- name: wmLayer === null || wmLayer === void 0 ? void 0 : wmLayer.name,
8449
- dimensions: layer === null || layer === void 0 ? void 0 : layer.dimensions,
8450
- height: canvasContainerHeight,
8451
- width: canvasContainerWidth,
8452
- minWidth: defaultCanvasWidth
8453
- }, /*#__PURE__*/React__default.createElement(CanvasComponent, {
8454
- redrawInterval: 500,
8455
- onRenderCanvas: function onRenderCanvas(ctx, width, height) {
8456
- /*
8457
- Check if the wmLayer is available, this happens when the WMS GetCapabilities is loaded and parsed.
8458
- Note that we cannot use the wmLayer variable above, as this one could contain a non initialized WMJSLayer.
8459
- */
8460
- var legendWmLayer = getWMLayerById(layer.id);
8461
- var legendUrl = getLegendGraphicURLForLayer(legendWmLayer);
8462
- var image = legendImageStore.getImage(legendUrl);
8463
- /* If there is no image for the given URL, we do not want to display a legend image (e.g. outside range) */
8464
- if (!image) {
8465
- previousLegendImage.current = null;
8466
- setCanvasContainerWidth(defaultCanvasWidth);
8467
- setCanvasContainerHeight(defaultCanvasHeight);
8468
- ctx.beginPath();
8469
- ctx.fillStyle = '#fff';
8470
- ctx.rect(0, 0, width, height);
8471
- ctx.fill();
8472
- ctx.fillStyle = 'black';
8473
- if (!legendUrl) {
8474
- ctx.fillText('No legend graphic available', 5, 16);
8475
- }
8476
- } else {
8477
- /* If there is an image for the given url, and has no error, but it is not yet loading or loaded, start loading it! */
8478
- if (image && image.hasError() === false && image.isLoaded() === false && image.isLoading() === false) {
8479
- image.load(); /* Will eventually trigger the callback used in the useEffect */
8480
- }
8481
- /* If the image is ready, we can show it in the component, store it in our ref, otherwise we keep the previous image to prevent flickering */
8482
- if (image && image.isLoaded()) {
8483
- previousLegendImage.current = image;
8484
- /* Set the canvas container to the same size as the image */
8485
- imageHeight = image.getHeight();
8486
- setCanvasContainerHeight(imageHeight);
8487
- imageWidth = image.getWidth();
8488
- setCanvasContainerWidth(imageWidth);
8489
- /* Give the canvas a white background before adding the image */
8490
- ctx.fillStyle = '#fff';
8491
- ctx.rect(0, 0, width, height);
8492
- ctx.fill();
8493
- /* Set the opacity used in the layer */
8494
- ctx.globalAlpha = layerOpacity;
8495
- }
8496
- renderLegendGraphic(previousLegendImage.current, ctx, imageWidth, imageHeight);
8497
- }
8498
- }
8499
- }));
8500
- };
8501
-
8502
- /* *
8503
- * Licensed under the Apache License, Version 2.0 (the "License");
8504
- * you may not use this file except in compliance with the License.
8505
- * You may obtain a copy of the License at
8506
- *
8507
- * http://www.apache.org/licenses/LICENSE-2.0
8508
- *
8509
- * Unless required by applicable law or agreed to in writing, software
8510
- * distributed under the License is distributed on an "AS IS" BASIS,
8511
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8512
- * See the License for the specific language governing permissions and
8513
- * limitations under the License.
8514
- *
8515
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8516
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
8517
- * */
8518
- var LegendDialog = function LegendDialog(_ref) {
8519
- var layers = _ref.layers,
8520
- isOpen = _ref.isOpen,
8521
- onClose = _ref.onClose,
8522
- _ref$onMouseDown = _ref.onMouseDown,
8523
- onMouseDown = _ref$onMouseDown === void 0 ? function () {} : _ref$onMouseDown,
8524
- mapId = _ref.mapId,
8525
- _ref$showMapId = _ref.showMapId,
8526
- showMapId = _ref$showMapId === void 0 ? false : _ref$showMapId,
8527
- _ref$order = _ref.order,
8528
- order = _ref$order === void 0 ? 0 : _ref$order,
8529
- _ref$source = _ref.source,
8530
- source = _ref$source === void 0 ? 'app' : _ref$source;
8531
- return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
8532
- startPosition: {
8533
- right: 20,
8534
- top: 50
8535
- },
8536
- minWidth: 100,
8537
- onClose: onClose,
8538
- title: showMapId ? "Legend ".concat(mapId) : 'Legend',
8539
- initialMaxHeight: 440,
8540
- isOpen: isOpen,
8541
- "data-testid": "moveable-legend",
8542
- bounds: "parent",
8543
- onMouseDown: onMouseDown,
8544
- order: order,
8545
- source: source
8546
- }, /*#__PURE__*/React.createElement(Box$2, {
8547
- sx: {
8548
- padding: 0.5
8549
- }
8550
- }, layers && layers.length > 0 ? /*#__PURE__*/React.createElement(Box$2, {
8551
- "data-testid": "LegendList",
8552
- sx: {
8553
- display: 'flex',
8554
- flexDirection: 'column',
8555
- '&>div:last-child': {
8556
- marginBottom: 0
8557
- }
8558
- }
8559
- }, layers.map(function (layer) {
8560
- return /*#__PURE__*/React.createElement(Legend, {
8561
- key: layer.id,
8562
- layer: layer
8563
- });
8564
- })) : /*#__PURE__*/React.createElement(Typography, {
8565
- "data-testid": "NoLayers",
8566
- variant: "body1",
8567
- style: {
8568
- fontWeight: 500,
8569
- fontSize: 14
8570
- }
8571
- }, "No layers")));
8572
- };
8573
-
8574
- var IS_LEGEND_OPEN_BY_DEFAULT = false;
8575
- var LegendConnectComponent = function LegendConnectComponent(_ref) {
8576
- var _ref$showMapId = _ref.showMapId,
8577
- showMapId = _ref$showMapId === void 0 ? false : _ref$showMapId,
8578
- _ref$source = _ref.source,
8579
- source = _ref$source === void 0 ? 'app' : _ref$source,
8580
- _ref$mapId = _ref.mapId,
8581
- initialMapId = _ref$mapId === void 0 ? null : _ref$mapId,
8582
- _ref$multiLegend = _ref.multiLegend,
8583
- multiLegend = _ref$multiLegend === void 0 ? false : _ref$multiLegend;
8584
- var dispatch = useDispatch();
8585
- var legendType = multiLegend ? "legend-".concat(initialMapId) : "legend";
8586
- var mapIdStore = useSelector(function (store) {
8587
- return getDialogMapId(store, legendType);
8588
- });
8589
- var _React$useState = React.useState(initialMapId),
8590
- _React$useState2 = _slicedToArray(_React$useState, 2),
8591
- mapId = _React$useState2[0],
8592
- setMapId = _React$useState2[1];
8593
- React.useEffect(function () {
8594
- setMapId(mapIdStore);
8595
- }, [mapIdStore]);
8596
- var mapLayers = useSelector(function (store) {
8597
- return getMapLayers(store, mapId);
8598
- });
8599
- var isDialogOpen = useSelector(function (store) {
8600
- return getisDialogOpen(store, legendType);
8601
- });
8602
- var uiOrder = useSelector(function (store) {
8603
- return getDialogOrder(store, legendType);
8604
- });
8605
- var uiSource = useSelector(function (store) {
8606
- return getDialogSource(store, legendType);
8607
- });
8608
- var uiIsOrderedOnTop = useSelector(function (store) {
8609
- return getDialogIsOrderedOnTop(store, legendType);
8610
- });
8611
- var onClose = function onClose() {
8612
- dispatch(uiActions.setToggleOpenDialog({
8613
- type: legendType,
8614
- setOpen: false,
8615
- origin: MapActionOrigin.map,
8616
- mapId: mapId
8617
- }));
8618
- };
8619
- var registerDialog = React.useCallback(function (setOpen) {
8620
- return dispatch(uiActions.registerDialog({
8621
- type: legendType,
8622
- mapId: mapId,
8623
- setOpen: setOpen,
8624
- source: source
8625
- }));
8626
- }, [dispatch, source, legendType, mapId]);
8627
- var unregisterDialog = React.useCallback(function () {
8628
- return dispatch(uiActions.unregisterDialog({
8629
- type: legendType
8630
- }));
8631
- }, [dispatch, legendType]);
8632
- var onOrderDialog = React.useCallback(function () {
8633
- if (!uiIsOrderedOnTop) {
8634
- dispatch(uiActions.orderDialog({
8635
- type: legendType
8636
- }));
8637
- }
8638
- }, [dispatch, uiIsOrderedOnTop, legendType]);
8639
- // Register this dialog in the store
8640
- React.useEffect(function () {
8641
- registerDialog(IS_LEGEND_OPEN_BY_DEFAULT);
8642
- return function () {
8643
- unregisterDialog();
8644
- };
8645
- // eslint-disable-next-line react-hooks/exhaustive-deps
8646
- }, []);
8647
- return /*#__PURE__*/React.createElement(LegendDialog, {
8648
- layers: mapLayers,
8649
- isOpen: isDialogOpen,
8650
- onClose: onClose,
8651
- mapId: mapId,
8652
- showMapId: showMapId,
8653
- onMouseDown: onOrderDialog,
8654
- order: uiOrder,
8655
- source: uiSource
8656
- });
8657
- };
8658
- /**
8659
- * Legend component connected to the store displaying a legend for every layer shown on the active map Id
8660
- * Please note that in order to use this and open/close the dialog, every map on the screen that should be able to show
8661
- * a dialog should have the <LegendMapButtonConnect/> which is used to focus the correct map and open the dialog
8662
- *
8663
- * Expects the following props:
8664
- * @param {boolean} showMapId (optional) showMapId: boolean - show the id of the map in the dialog title of which the legend is shown in te dialog
8665
- * @param {uiTypes.Source} source (optional) source: uiTypes.Source - default is 'app', 'module' makes sure it will be shown on top of the module
8666
-
8667
- * ``` <LegendConnect legendDialogId={legendDialogId} />```
8668
- */
8669
- var LegendConnect = function LegendConnect(_a) {
8670
- var _a$showMapId = _a.showMapId,
8671
- showMapId = _a$showMapId === void 0 ? false : _a$showMapId,
8672
- props = __rest$1(_a, ["showMapId"]);
8673
- return /*#__PURE__*/React.createElement(LegendConnectComponent, Object.assign({
8674
- showMapId: showMapId
8675
- }, props));
8676
- };
8677
-
8678
- var _marked$4 = /*#__PURE__*/_regeneratorRuntime().mark(updateAnimation),
8679
- _marked2$4 = /*#__PURE__*/_regeneratorRuntime().mark(handleBaseLayersSaga),
8680
- _marked3 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$4);
8681
- // Expects start, end time as moment object and interval in minutes
8682
- var generateTimeList = function generateTimeList(start, end, interval) {
8683
- var timeList = [];
8684
- var unixStart = moment(start).utc().unix();
8685
- var unixEnd = moment(end).utc().unix();
8686
- var intervalSeconds = interval * 60;
8687
- for (var j = unixStart; j <= unixEnd; j += intervalSeconds) {
8688
- timeList.push({
8689
- name: 'time',
8690
- value: moment.unix(j).toISOString()
8691
- });
8692
- }
8693
- return timeList;
8694
- };
8695
- var getAnimationEndTime = function getAnimationEndTime(animationEndTime) {
8696
- var calculateFromNow = animationEndTime.split(/[-+]/)[0] === 'NOW';
8697
- var isAddingTime = animationEndTime.indexOf('+') !== -1;
8698
- var timeInMinutes = moment.duration(animationEndTime.split(/[-+]/)[1]).asMinutes();
8699
- var startingTime = calculateFromNow ? moment().utc() : moment().utc().startOf('day');
8700
- var newAnimationEndTime = isAddingTime ? moment(startingTime).add(timeInMinutes, 'minutes').toISOString() : moment(startingTime).subtract(timeInMinutes, 'minutes').toISOString();
8701
- return newAnimationEndTime;
8702
- };
8703
- var isAnimationEndTimeValid = function isAnimationEndTimeValid(animationEndTime) {
8704
- var hasValidPrefix = animationEndTime.split(/[-+]/)[0] === 'NOW' || animationEndTime.split(/[-+]/)[0] === 'TODAY';
8705
- var hasValidDate = moment.isDuration(moment.duration(animationEndTime.split(/[-+]/)[1]));
8706
- return hasValidPrefix && hasValidDate;
8707
- };
8708
- var validInitialAnimationStep = function validInitialAnimationStep(initialAnimationStep, draw) {
8709
- return !!initialAnimationStep && !!(draw === null || draw === void 0 ? void 0 : draw.length) && initialAnimationStep >= 0 && draw.length > initialAnimationStep;
7436
+ var validInitialAnimationStep = function validInitialAnimationStep(initialAnimationStep, draw) {
7437
+ return !!initialAnimationStep && !!(draw === null || draw === void 0 ? void 0 : draw.length) && initialAnimationStep >= 0 && draw.length > initialAnimationStep;
8710
7438
  };
8711
7439
  function updateMapDraw(mapId, draw, initialAnimationStep) {
8712
7440
  var webMap = getWMJSMapById(mapId);
@@ -15864,6 +14592,53 @@ var ConnectedTree = function ConnectedTree(_ref) {
15864
14592
  };
15865
14593
  var WMSLayerTreeConnect = connectRedux$3(ConnectedTree);
15866
14594
 
14595
+ /* *
14596
+ * Licensed under the Apache License, Version 2.0 (the "License");
14597
+ * you may not use this file except in compliance with the License.
14598
+ * You may obtain a copy of the License at
14599
+ *
14600
+ * http://www.apache.org/licenses/LICENSE-2.0
14601
+ *
14602
+ * Unless required by applicable law or agreed to in writing, software
14603
+ * distributed under the License is distributed on an "AS IS" BASIS,
14604
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14605
+ * See the License for the specific language governing permissions and
14606
+ * limitations under the License.
14607
+ *
14608
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
14609
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
14610
+ * */
14611
+ var isValidService = function isValidService(service) {
14612
+ return Object.prototype.hasOwnProperty.call(service, 'url');
14613
+ };
14614
+ var filterServices = function filterServices(presetArray) {
14615
+ var hasServices = presetArray && Array.isArray(presetArray) && presetArray.length > 0;
14616
+ var validServices = hasServices ? presetArray.filter(function (preset) {
14617
+ return isValidService(preset);
14618
+ }) : null;
14619
+ var hasValidServices = validServices && validServices.length > 0;
14620
+ var services = hasValidServices ? validServices : undefined;
14621
+ return services;
14622
+ };
14623
+ var filterMapPresets = function filterMapPresets(initialAppPreset) {
14624
+ var preset = initialAppPreset && initialAppPreset.preset || {};
14625
+ var layers = preset.layers,
14626
+ services = preset.services,
14627
+ baseServices = preset.baseServices;
14628
+ var _ref = layers ? filterLayers(layers, parseLayer) : createEmtpyFilteredList(undefined),
14629
+ baseLayers = _ref.baseLayers,
14630
+ mapLayers = _ref.mapLayers;
14631
+ var filterredServices = services ? filterServices(services) : undefined;
14632
+ var filteredBaseServices = baseServices ? filterServices(baseServices) : undefined;
14633
+ var filteredPreset = {
14634
+ services: filterredServices,
14635
+ baseServices: filteredBaseServices,
14636
+ baseLayers: baseLayers,
14637
+ mapLayers: mapLayers
14638
+ };
14639
+ return filteredPreset;
14640
+ };
14641
+
15867
14642
  var preset = {
15868
14643
  presetType: "mapPreset",
15869
14644
  presetId: "mapPreset-1",
@@ -16664,8 +15439,8 @@ var getDialogType = function getDialogType(mapId, isMultiMap, isDocked) {
16664
15439
  * a dialog should have the <LayerManagerMapButtonConnect/> which is used to focus the correct map and open the dialog
16665
15440
  *
16666
15441
  * Expects the following props:
16667
- * @param {Service[]} preloadedMapServices preloadedMapServices: array of Service objects - contains an array of Service objects that are preloaded into in the WMS Loader for maplayers
16668
- * @param {Service[]} preloadedBaseServices preloadedBaseServices: array of Service objects - contains an array of Service objects that are preloaded into in the WMS Loader fpr baselayers
15442
+ * @param {layerSelectTypes.LayerSelectService[]} preloadedMapServices preloadedMapServices: array of Service objects - contains an array of Service objects that are preloaded into in the WMS Loader for maplayers
15443
+ * @param {layerSelectTypes.LayerSelectService[]} preloadedBaseServices preloadedBaseServices: array of Service objects - contains an array of Service objects that are preloaded into in the WMS Loader fpr baselayers
16669
15444
  * @param {Layer[]} preloadedAvailableBaseLayers preloadedAvailableBaseLayers: array of Layer objects - contains an array of Layer objects (consisting solely of type baseLayer) that are available to be shown as basemaps
16670
15445
  * ``` <LayerManagerConnect />```
16671
15446
  */
@@ -18019,6 +16794,83 @@ var LayerInfoList = function LayerInfoList(_ref) {
18019
16794
  })));
18020
16795
  };
18021
16796
 
16797
+ /* *
16798
+ * Licensed under the Apache License, Version 2.0 (the "License");
16799
+ * you may not use this file except in compliance with the License.
16800
+ * You may obtain a copy of the License at
16801
+ *
16802
+ * http://www.apache.org/licenses/LICENSE-2.0
16803
+ *
16804
+ * Unless required by applicable law or agreed to in writing, software
16805
+ * distributed under the License is distributed on an "AS IS" BASIS,
16806
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16807
+ * See the License for the specific language governing permissions and
16808
+ * limitations under the License.
16809
+ *
16810
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
16811
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
16812
+ * */
16813
+ var LegendLayout = function LegendLayout(_ref) {
16814
+ var title = _ref.title,
16815
+ name = _ref.name,
16816
+ dimensions = _ref.dimensions,
16817
+ children = _ref.children,
16818
+ height = _ref.height,
16819
+ width = _ref.width,
16820
+ minWidth = _ref.minWidth;
16821
+ return /*#__PURE__*/React__default.createElement(Paper, {
16822
+ "data-testid": "legend",
16823
+ sx: {
16824
+ padding: '10px',
16825
+ border: '1px solid grey',
16826
+ backgroundColor: '#FFF',
16827
+ overflow: 'hidden',
16828
+ marginBottom: 0.5
16829
+ }
16830
+ }, /*#__PURE__*/React__default.createElement(Box$2, {
16831
+ "data-testid": "legend-title"
16832
+ }, /*#__PURE__*/React__default.createElement(Typography, {
16833
+ sx: {
16834
+ fontFamily: 'Roboto, Helvetica, Arial',
16835
+ fontSize: '10px',
16836
+ minWidth: '100%',
16837
+ wordWrap: 'break-word',
16838
+ color: 'common.black',
16839
+ whiteSpace: 'nowrap'
16840
+ },
16841
+ variant: "h3"
16842
+ }, title)), /*#__PURE__*/React__default.createElement(CustomTooltip, {
16843
+ title: title || 'loading',
16844
+ placement: "top"
16845
+ }, /*#__PURE__*/React__default.createElement(Box$2, {
16846
+ sx: {
16847
+ margin: '10px 0px 10px 0px',
16848
+ height: "".concat(height, "px"),
16849
+ width: "".concat(width, "px")
16850
+ }
16851
+ }, children)), /*#__PURE__*/React__default.createElement(Box$2, {
16852
+ "data-testid": "legend-info",
16853
+ sx: Object.assign({
16854
+ fontFamily: 'Roboto, Helvetica, Arial',
16855
+ fontSize: 10,
16856
+ color: 'common.black',
16857
+ overflowX: 'hidden',
16858
+ wordWrap: 'break-word',
16859
+ whiteSpace: 'nowrap'
16860
+ }, minWidth && {
16861
+ minWidth: "".concat(minWidth, "px")
16862
+ })
16863
+ }, dimensions && dimensions.map(function (dim) {
16864
+ return /*#__PURE__*/React__default.createElement(Box$2, {
16865
+ key: name + dim.name
16866
+ }, dim.name === 'time' ? "".concat(dim.currentValue) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box$2, {
16867
+ style: {
16868
+ fontWeight: 500
16869
+ }
16870
+ }, dim.name, ":"), dim.currentValue, " ", dim.units));
16871
+ })));
16872
+ };
16873
+
18022
16874
  /* *
18023
16875
  * Licensed under the Apache License, Version 2.0 (the "License");
18024
16876
  * you may not use this file except in compliance with the License.
@@ -19814,37 +18666,37 @@ var LayerInfoDialogConnect = function LayerInfoDialogConnect() {
19814
18666
  });
19815
18667
  };
19816
18668
 
19817
- const HookFormContext = React__default.createContext(null);
19818
- /**
19819
- * This custom hook allows you to access the form context. useFormContext is intended to be used in deeply nested structures, where it would become inconvenient to pass the context as a prop. To be used with {@link FormProvider}.
19820
- *
19821
- * @remarks
19822
- * [API](https://react-hook-form.com/api/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
19823
- *
19824
- * @returns return all useForm methods
19825
- *
19826
- * @example
19827
- * ```tsx
19828
- * function App() {
19829
- * const methods = useForm();
19830
- * const onSubmit = data => console.log(data);
19831
- *
19832
- * return (
19833
- * <FormProvider {...methods} >
19834
- * <form onSubmit={methods.handleSubmit(onSubmit)}>
19835
- * <NestedInput />
19836
- * <input type="submit" />
19837
- * </form>
19838
- * </FormProvider>
19839
- * );
19840
- * }
19841
- *
19842
- * function NestedInput() {
19843
- * const { register } = useFormContext(); // retrieve all hook methods
19844
- * return <input {...register("test")} />;
19845
- * }
19846
- * ```
19847
- */
18669
+ const HookFormContext = React__default.createContext(null);
18670
+ /**
18671
+ * This custom hook allows you to access the form context. useFormContext is intended to be used in deeply nested structures, where it would become inconvenient to pass the context as a prop. To be used with {@link FormProvider}.
18672
+ *
18673
+ * @remarks
18674
+ * [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
18675
+ *
18676
+ * @returns return all useForm methods
18677
+ *
18678
+ * @example
18679
+ * ```tsx
18680
+ * function App() {
18681
+ * const methods = useForm();
18682
+ * const onSubmit = data => console.log(data);
18683
+ *
18684
+ * return (
18685
+ * <FormProvider {...methods} >
18686
+ * <form onSubmit={methods.handleSubmit(onSubmit)}>
18687
+ * <NestedInput />
18688
+ * <input type="submit" />
18689
+ * </form>
18690
+ * </FormProvider>
18691
+ * );
18692
+ * }
18693
+ *
18694
+ * function NestedInput() {
18695
+ * const { register } = useFormContext(); // retrieve all hook methods
18696
+ * return <input {...register("test")} />;
18697
+ * }
18698
+ * ```
18699
+ */
19848
18700
  const useFormContext = () => React__default.useContext(HookFormContext);
19849
18701
 
19850
18702
  var style$2 = {
@@ -22888,6 +21740,364 @@ var drawTimeSliderLegend = function drawTimeSliderLegend(context, theme, canvasW
22888
21740
  drawNeedle(ctx, theme, canvasWidth, height, visibleTimeStart, visibleTimeEnd, selectedTimeUnix);
22889
21741
  };
22890
21742
 
21743
+ var CanvasComponent = /*#__PURE__*/function (_Component) {
21744
+ _inherits(CanvasComponent, _Component);
21745
+ var _super = _createSuper(CanvasComponent);
21746
+ function CanvasComponent(props) {
21747
+ var _this;
21748
+ _classCallCheck$1(this, CanvasComponent);
21749
+ _this = _super.call(this, props);
21750
+ _this.canvas = null;
21751
+ _this.ctx = null;
21752
+ _this.currentWidth = 1;
21753
+ _this.currentHeight = 1;
21754
+ _this.canvascontaineroutside = null;
21755
+ _this.canvascontainer = null;
21756
+ _this.timer = null;
21757
+ _this.redrawTimer = null;
21758
+ _this.loopHasStarted = false;
21759
+ _this.mounted = false;
21760
+ _this.updateCanvas = _this.updateCanvas.bind(_assertThisInitialized$1(_this));
21761
+ _this.handleMouseMoveEvent = _this.handleMouseMoveEvent.bind(_assertThisInitialized$1(_this));
21762
+ _this.handleMouseUpEvent = _this.handleMouseUpEvent.bind(_assertThisInitialized$1(_this));
21763
+ _this.handleMouseDownEvent = _this.handleMouseDownEvent.bind(_assertThisInitialized$1(_this));
21764
+ _this.resize = _this.resize.bind(_assertThisInitialized$1(_this));
21765
+ _this._handleWindowResize = _this._handleWindowResize.bind(_assertThisInitialized$1(_this));
21766
+ _this.handleClickEvent = _this.handleClickEvent.bind(_assertThisInitialized$1(_this));
21767
+ _this.handleWheelEvent = _this.handleWheelEvent.bind(_assertThisInitialized$1(_this));
21768
+ _this.handleTouchStartEvent = _this.handleTouchStartEvent.bind(_assertThisInitialized$1(_this));
21769
+ _this.handleTouchEndEvent = _this.handleTouchEndEvent.bind(_assertThisInitialized$1(_this));
21770
+ _this.handleTouchMoveEvent = _this.handleTouchMoveEvent.bind(_assertThisInitialized$1(_this));
21771
+ _this.onKeyUp = _this.onKeyUp.bind(_assertThisInitialized$1(_this));
21772
+ _this.onBlur = _this.onBlur.bind(_assertThisInitialized$1(_this));
21773
+ _this.onFocus = _this.onFocus.bind(_assertThisInitialized$1(_this));
21774
+ _this.startLoop = _this.startLoop.bind(_assertThisInitialized$1(_this));
21775
+ _this._documentKeyDown = _this._documentKeyDown.bind(_assertThisInitialized$1(_this));
21776
+ _this._isFocussed = false;
21777
+ _this.canvas = null;
21778
+ _this.canvascontaineroutside = /*#__PURE__*/React__default.createRef();
21779
+ _this.canvascontainer = /*#__PURE__*/React__default.createRef();
21780
+ return _this;
21781
+ }
21782
+ _createClass$1(CanvasComponent, [{
21783
+ key: "componentDidMount",
21784
+ value: function componentDidMount() {
21785
+ var _this2 = this;
21786
+ this.mounted = true;
21787
+ if (this.canvas) {
21788
+ this.canvas.addEventListener('mousemove', this.handleMouseMoveEvent);
21789
+ this.canvas.addEventListener('mouseup', this.handleMouseUpEvent);
21790
+ this.canvas.addEventListener('mousedown', this.handleMouseDownEvent);
21791
+ this.canvas.addEventListener('touchstart', this.handleTouchStartEvent);
21792
+ this.canvas.addEventListener('touchend', this.handleTouchEndEvent);
21793
+ this.canvas.addEventListener('touchmove', this.handleTouchMoveEvent);
21794
+ this.canvas.addEventListener('wheel', this.handleWheelEvent);
21795
+ this.canvas.addEventListener('click', this.handleClickEvent);
21796
+ document.addEventListener('keydown', this._documentKeyDown, false);
21797
+ this.resize();
21798
+ this.updateCanvas();
21799
+ }
21800
+ var _this$props = this.props,
21801
+ onKeyUp = _this$props.onKeyUp,
21802
+ loopInterval = _this$props.redrawInterval;
21803
+ if (onKeyUp) {
21804
+ window.addEventListener('keyup', this.onKeyUp);
21805
+ }
21806
+ window.addEventListener('resize', this._handleWindowResize);
21807
+ if (this.canvascontaineroutside && this.canvascontaineroutside.current && onKeyUp) {
21808
+ this.canvascontaineroutside.current.focus();
21809
+ }
21810
+ this.timer = setInterval(function () {
21811
+ _this2.resize();
21812
+ }, 1000);
21813
+ if (loopInterval) {
21814
+ this.redrawTimer = setInterval(function () {
21815
+ _this2.updateCanvas();
21816
+ }, loopInterval);
21817
+ }
21818
+ }
21819
+ }, {
21820
+ key: "shouldComponentUpdate",
21821
+ value: function shouldComponentUpdate() {
21822
+ var _this3 = this;
21823
+ window.requestAnimationFrame(function () {
21824
+ _this3.updateCanvas();
21825
+ });
21826
+ return false;
21827
+ }
21828
+ }, {
21829
+ key: "componentWillUnmount",
21830
+ value: function componentWillUnmount() {
21831
+ this.mounted = false;
21832
+ window.removeEventListener('resize', this._handleWindowResize);
21833
+ var onKeyUp = this.props.onKeyUp;
21834
+ if (onKeyUp) {
21835
+ window.removeEventListener('keyup', this.onKeyUp);
21836
+ }
21837
+ if (this.canvas) {
21838
+ this.canvas.removeEventListener('mousedown', this.handleMouseDownEvent);
21839
+ this.canvas.removeEventListener('mouseup', this.handleMouseUpEvent);
21840
+ this.canvas.removeEventListener('mousemove', this.handleMouseMoveEvent);
21841
+ this.canvas.removeEventListener('touchstart', this.handleTouchStartEvent);
21842
+ this.canvas.removeEventListener('touchend', this.handleTouchEndEvent);
21843
+ this.canvas.removeEventListener('touchmove', this.handleTouchMoveEvent);
21844
+ this.canvas.removeEventListener('wheel', this.handleWheelEvent);
21845
+ this.canvas.removeEventListener('click', this.handleClickEvent);
21846
+ document.removeEventListener('keydown', this._documentKeyDown);
21847
+ }
21848
+ clearInterval(this.timer);
21849
+ clearInterval(this.redrawTimer);
21850
+ }
21851
+ }, {
21852
+ key: "onFocus",
21853
+ value: function onFocus() {
21854
+ var isFocussed = this.props.isFocussed;
21855
+ this._isFocussed = true;
21856
+ if (isFocussed) {
21857
+ isFocussed(true);
21858
+ }
21859
+ }
21860
+ }, {
21861
+ key: "onBlur",
21862
+ value: function onBlur() {
21863
+ var isFocussed = this.props.isFocussed;
21864
+ this._isFocussed = false;
21865
+ if (isFocussed) {
21866
+ isFocussed(false);
21867
+ }
21868
+ }
21869
+ }, {
21870
+ key: "onKeyUp",
21871
+ value: function onKeyUp(event) {
21872
+ var onKeyUp = this.props.onKeyUp;
21873
+ if (onKeyUp) {
21874
+ onKeyUp(event);
21875
+ }
21876
+ if (this.canvascontaineroutside && this.canvascontaineroutside.current && onKeyUp) {
21877
+ if (event.code === 'Escape') {
21878
+ this.canvascontaineroutside.current.focus();
21879
+ }
21880
+ }
21881
+ }
21882
+ }, {
21883
+ key: "_documentKeyDown",
21884
+ value: function _documentKeyDown(event) {
21885
+ if (this._isFocussed) {
21886
+ var onKeyDown = this.props.onKeyDown;
21887
+ if (onKeyDown) {
21888
+ onKeyDown(event);
21889
+ }
21890
+ }
21891
+ }
21892
+ }, {
21893
+ key: "_handleWindowResize",
21894
+ value: function _handleWindowResize() {
21895
+ this.resize();
21896
+ }
21897
+ }, {
21898
+ key: "startLoop",
21899
+ value: function startLoop() {
21900
+ var onRenderCanvas = this.props.onRenderCanvas;
21901
+ if (this.mounted === false || this.loopHasStarted === false) {
21902
+ return;
21903
+ }
21904
+ if (this.canvas) {
21905
+ onRenderCanvas(this.ctx, this.currentWidth, this.currentHeight, this.canvas);
21906
+ }
21907
+ requestAnimationFrame(this.startLoop);
21908
+ }
21909
+ }, {
21910
+ key: "updateCanvas",
21911
+ value: function updateCanvas() {
21912
+ if (!this.canvas) {
21913
+ return;
21914
+ }
21915
+ var _this$props2 = this.props,
21916
+ onRenderCanvas = _this$props2.onRenderCanvas,
21917
+ loop = _this$props2.loop;
21918
+ this.ctx = this.canvas.getContext('2d');
21919
+ if (!this.ctx) {
21920
+ return;
21921
+ }
21922
+ if (this.ctx.canvas.height !== this.currentHeight) {
21923
+ this.ctx.canvas.height = this.currentHeight;
21924
+ }
21925
+ if (this.ctx.canvas.width !== this.currentWidth) {
21926
+ this.ctx.canvas.width = this.currentWidth;
21927
+ }
21928
+ if (loop !== true) {
21929
+ this.loopHasStarted = false;
21930
+ onRenderCanvas(this.ctx, this.currentWidth, this.currentHeight, this.canvas);
21931
+ } else if (this.loopHasStarted === false) {
21932
+ this.loopHasStarted = true;
21933
+ this.startLoop();
21934
+ }
21935
+ }
21936
+ }, {
21937
+ key: "resize",
21938
+ value: function resize() {
21939
+ var canvascontainer = this.canvascontainer,
21940
+ resizeCallback = this.props.resizeCallback;
21941
+ if (canvascontainer && canvascontainer.current) {
21942
+ var newWidth = canvascontainer.current.clientWidth;
21943
+ var newHeight = canvascontainer.current.clientHeight;
21944
+ if (newWidth !== undefined && newHeight !== undefined && (this.currentWidth !== newWidth || this.currentHeight !== newHeight)) {
21945
+ this.currentWidth = newWidth;
21946
+ this.currentHeight = newHeight;
21947
+ this.updateCanvas();
21948
+ resizeCallback && resizeCallback(newWidth);
21949
+ }
21950
+ }
21951
+ }
21952
+ }, {
21953
+ key: "handleMouseMoveEvent",
21954
+ value: function handleMouseMoveEvent(event) {
21955
+ var _this$props3 = this.props,
21956
+ onMouseMove = _this$props3.onMouseMove,
21957
+ onCanvasClick = _this$props3.onCanvasClick;
21958
+ var x = event.offsetX;
21959
+ var y = event.offsetY;
21960
+ if (event.buttons === 1) {
21961
+ onCanvasClick(x, y, this.currentWidth, this.currentHeight);
21962
+ }
21963
+ onMouseMove(x, y, event, this.currentWidth);
21964
+ }
21965
+ }, {
21966
+ key: "handleMouseUpEvent",
21967
+ value: function handleMouseUpEvent(event) {
21968
+ var onMouseUp = this.props.onMouseUp;
21969
+ var x = event.offsetX;
21970
+ onMouseUp(x);
21971
+ }
21972
+ }, {
21973
+ key: "handleMouseDownEvent",
21974
+ value: function handleMouseDownEvent(event) {
21975
+ var onMouseDown = this.props.onMouseDown;
21976
+ var x = event.offsetX;
21977
+ var y = event.offsetY;
21978
+ onMouseDown(x, y, this.currentWidth);
21979
+ }
21980
+ }, {
21981
+ key: "handleTouchStartEvent",
21982
+ value: function handleTouchStartEvent(event) {
21983
+ var onTouchStart = this.props.onTouchStart;
21984
+ onTouchStart(event, this.currentWidth);
21985
+ }
21986
+ }, {
21987
+ key: "handleTouchEndEvent",
21988
+ value: function handleTouchEndEvent() {
21989
+ var onTouchEnd = this.props.onTouchEnd;
21990
+ onTouchEnd();
21991
+ }
21992
+ }, {
21993
+ key: "handleTouchMoveEvent",
21994
+ value: function handleTouchMoveEvent(event) {
21995
+ var _this$props4 = this.props,
21996
+ onTouchMove = _this$props4.onTouchMove,
21997
+ onCanvasClick = _this$props4.onCanvasClick;
21998
+ var touches = event && event.touches && event.touches[0];
21999
+ if (touches && touches.clientX && touches.clientY) {
22000
+ var x2 = event.touches[0].clientX - event.touches[0].target.offsetLeft;
22001
+ var y2 = event.touches[0].clientY;
22002
+ onCanvasClick(x2, y2, this.currentWidth, this.currentHeight);
22003
+ }
22004
+ onTouchMove(event, this.currentWidth);
22005
+ }
22006
+ }, {
22007
+ key: "handleClickEvent",
22008
+ value: function handleClickEvent(event) {
22009
+ var onCanvasClick = this.props.onCanvasClick;
22010
+ var x = event.offsetX;
22011
+ var y = event.offsetY;
22012
+ onCanvasClick(x, y, this.currentWidth, this.currentHeight);
22013
+ }
22014
+ }, {
22015
+ key: "handleWheelEvent",
22016
+ value: function handleWheelEvent(event) {
22017
+ var onWheel = this.props.onWheel;
22018
+ onWheel({
22019
+ event: event,
22020
+ deltaY: event.deltaY,
22021
+ deltaX: event.deltaX,
22022
+ canvasWidth: event.srcElement.width,
22023
+ mouseX: event.offsetX
22024
+ });
22025
+ }
22026
+ }, {
22027
+ key: "render",
22028
+ value: function render() {
22029
+ var _this4 = this;
22030
+ this.updateCanvas();
22031
+ this._handleWindowResize();
22032
+ return /*#__PURE__*/React__default.createElement("div", {
22033
+ role: "button",
22034
+ ref: this.canvascontaineroutside,
22035
+ tabIndex: 0,
22036
+ onFocus: this.onFocus,
22037
+ onBlur: this.onBlur,
22038
+ style: {
22039
+ height: '100%',
22040
+ width: '100%',
22041
+ border: 'none',
22042
+ display: 'block',
22043
+ overflow: 'hidden'
22044
+ }
22045
+ }, /*#__PURE__*/React__default.createElement("div", {
22046
+ ref: this.canvascontainer,
22047
+ style: {
22048
+ minWidth: 'inherit',
22049
+ minHeight: 'inherit',
22050
+ width: 'inherit',
22051
+ height: 'inherit',
22052
+ overflow: 'hidden',
22053
+ display: 'block',
22054
+ border: 'none'
22055
+ }
22056
+ }, /*#__PURE__*/React__default.createElement("div", {
22057
+ style: {
22058
+ overflow: 'visible',
22059
+ width: 0,
22060
+ height: 0
22061
+ }
22062
+ }, /*#__PURE__*/React__default.createElement("canvas", {
22063
+ ref: function ref(canvas) {
22064
+ _this4.canvas = canvas;
22065
+ }
22066
+ }))));
22067
+ }
22068
+ }]);
22069
+ return CanvasComponent;
22070
+ }(Component);
22071
+ CanvasComponent.defaultProps = {
22072
+ onRenderCanvas: function onRenderCanvas() {
22073
+ /* intentionally left blank */
22074
+ },
22075
+ onCanvasClick: function onCanvasClick() {
22076
+ /* intentionally left blank */
22077
+ },
22078
+ onMouseMove: function onMouseMove() {
22079
+ /* intentionally left blank */
22080
+ },
22081
+ onMouseUp: function onMouseUp() {
22082
+ /* intentionally left blank */
22083
+ },
22084
+ onMouseDown: function onMouseDown() {
22085
+ /* intentionally left blank */
22086
+ },
22087
+ onTouchStart: function onTouchStart() {
22088
+ /* intentionally left blank */
22089
+ },
22090
+ onTouchEnd: function onTouchEnd() {
22091
+ /* intentionally left blank */
22092
+ },
22093
+ onTouchMove: function onTouchMove() {
22094
+ /* intentionally left blank */
22095
+ },
22096
+ onWheel: function onWheel() {
22097
+ /* intentionally left blank */
22098
+ }
22099
+ };
22100
+
22891
22101
  /* *
22892
22102
  * Licensed under the Apache License, Version 2.0 (the "License");
22893
22103
  * you may not use this file except in compliance with the License.
@@ -34206,6 +33416,16 @@ var getFeatureCollection = function getFeatureCollection(geoJSONFeature, shouldA
34206
33416
  features: [geoJSONFeature]
34207
33417
  });
34208
33418
  };
33419
+ // compares 2 geoJSONs and returns true if both have properties.selectionType with the same value
33420
+ var isGeoJSONFeatureCreatedByTool = function isGeoJSONFeatureCreatedByTool(existingJSON, newGeoJSON) {
33421
+ var _a, _b, _c;
33422
+ if (!existingJSON.features.length) {
33423
+ return false;
33424
+ }
33425
+ var lastUsedTool = (_a = existingJSON.features[0].properties) === null || _a === void 0 ? void 0 : _a.selectionType;
33426
+ var newTool = newGeoJSON.type === 'Feature' ? (_b = newGeoJSON.properties) === null || _b === void 0 ? void 0 : _b.selectionType : (_c = newGeoJSON.features[0].properties) === null || _c === void 0 ? void 0 : _c.selectionType;
33427
+ return lastUsedTool !== undefined && newTool !== undefined ? lastUsedTool === newTool : false;
33428
+ };
34209
33429
 
34210
33430
  var Proj4js = proj4;
34211
33431
  // Cache for for storing and reusing Proj4 instances
@@ -36144,13 +35364,24 @@ var defaultIntersectionStyleProperties = {
36144
35364
  'fill-opacity': 0.5
36145
35365
  };
36146
35366
  var emptyLineString = Object.assign(Object.assign({}, lineString.features[0]), {
36147
- properties: Object.assign({}, defaultStyleProperties)
35367
+ properties: Object.assign(Object.assign({}, defaultStyleProperties), {
35368
+ selectionType: 'linestring'
35369
+ })
36148
35370
  });
36149
35371
  var emptyPoint = Object.assign(Object.assign({}, featurePoint), {
36150
- properties: {}
36151
- }); // markers currently don't have style
35372
+ properties: {
35373
+ selectionType: 'point'
35374
+ }
35375
+ });
36152
35376
  var emptyPolygon = Object.assign(Object.assign({}, featurePolygon), {
36153
- properties: Object.assign({}, defaultStyleProperties)
35377
+ properties: Object.assign(Object.assign({}, defaultStyleProperties), {
35378
+ selectionType: 'poly'
35379
+ })
35380
+ });
35381
+ var emptyBox = Object.assign(Object.assign({}, featurePolygon), {
35382
+ properties: Object.assign(Object.assign({}, defaultStyleProperties), {
35383
+ selectionType: 'box'
35384
+ })
36154
35385
  });
36155
35386
  // TODO: improve this: without a feature, the custom shape does not work on first click
36156
35387
  var emptyIntersectionShape = Object.assign(Object.assign({}, emptyGeoJSON), {
@@ -36177,7 +35408,7 @@ var defaultBox = {
36177
35408
  value: DRAWMODE.BOX,
36178
35409
  title: 'Box',
36179
35410
  icon: /*#__PURE__*/React__default.createElement(DrawRegion, null),
36180
- shape: emptyPolygon,
35411
+ shape: emptyBox,
36181
35412
  isSelectable: true
36182
35413
  };
36183
35414
  var defaultLineString = {
@@ -36198,8 +35429,8 @@ var defaultDelete = {
36198
35429
  };
36199
35430
  var defaultModes = [defaultPoint, defaultPolygon, defaultBox, defaultLineString, defaultDelete];
36200
35431
  var useMapDrawTool = function useMapDrawTool(_ref) {
36201
- var _ref$editModes = _ref.editModes,
36202
- editModes = _ref$editModes === void 0 ? defaultModes : _ref$editModes,
35432
+ var _ref$defaultEditModes = _ref.defaultEditModes,
35433
+ defaultEditModes = _ref$defaultEditModes === void 0 ? defaultModes : _ref$defaultEditModes,
36203
35434
  _ref$shouldAllowMulti = _ref.shouldAllowMultipleshapes,
36204
35435
  shouldAllowMultipleshapes = _ref$shouldAllowMulti === void 0 ? true : _ref$shouldAllowMulti,
36205
35436
  _ref$defaultGeoJSON = _ref.defaultGeoJSON,
@@ -36208,9 +35439,7 @@ var useMapDrawTool = function useMapDrawTool(_ref) {
36208
35439
  defaultGeoJSONIntersection = _ref$defaultGeoJSONIn === void 0 ? emptyIntersectionShape : _ref$defaultGeoJSONIn,
36209
35440
  defaultGeoJSONIntersectionBounds = _ref.defaultGeoJSONIntersectionBounds,
36210
35441
  _ref$defaultGeoJSONIn2 = _ref.defaultGeoJSONIntersectionProperties,
36211
- defaultGeoJSONIntersectionProperties = _ref$defaultGeoJSONIn2 === void 0 ? defaultIntersectionStyleProperties : _ref$defaultGeoJSONIn2,
36212
- _ref$defaultActiveToo = _ref.defaultActiveTool,
36213
- defaultActiveTool = _ref$defaultActiveToo === void 0 ? '' : _ref$defaultActiveToo;
35442
+ defaultGeoJSONIntersectionProperties = _ref$defaultGeoJSONIn2 === void 0 ? defaultIntersectionStyleProperties : _ref$defaultGeoJSONIn2;
36214
35443
  // geoJSON feature collections
36215
35444
  var _React$useState = React__default.useState(defaultGeoJSON),
36216
35445
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -36225,14 +35454,14 @@ var useMapDrawTool = function useMapDrawTool(_ref) {
36225
35454
  geoJSONIntersectionBounds = _React$useState6[0],
36226
35455
  setGeoJSONIntersectionBounds = _React$useState6[1];
36227
35456
  // state
36228
- var _React$useState7 = React__default.useState(defaultActiveTool),
35457
+ var _React$useState7 = React__default.useState(defaultEditModes),
36229
35458
  _React$useState8 = _slicedToArray(_React$useState7, 2),
36230
- activeTool = _React$useState8[0],
36231
- setActiveTool = _React$useState8[1];
36232
- var _React$useState9 = React__default.useState(defaultActiveTool),
35459
+ editModes = _React$useState8[0],
35460
+ setEditModes = _React$useState8[1];
35461
+ var _React$useState9 = React__default.useState(''),
36233
35462
  _React$useState10 = _slicedToArray(_React$useState9, 2),
36234
- lastSelectedTool = _React$useState10[0],
36235
- setLastSelectedTool = _React$useState10[1];
35463
+ activeTool = _React$useState10[0],
35464
+ setActiveTool = _React$useState10[1];
36236
35465
  var _React$useState11 = React__default.useState(''),
36237
35466
  _React$useState12 = _slicedToArray(_React$useState11, 2),
36238
35467
  drawMode = _React$useState12[0],
@@ -36254,15 +35483,15 @@ var useMapDrawTool = function useMapDrawTool(_ref) {
36254
35483
  }
36255
35484
  setActiveTool(newMode.id);
36256
35485
  // updates shape
36257
- var isNewSelectedTool = newMode.id !== '' && lastSelectedTool !== newMode.id;
36258
- if (!geoJSON.features.length || shouldAllowMultipleshapes || isNewSelectedTool) {
35486
+ var isNewSelectedTool = !isGeoJSONFeatureCreatedByTool(geoJSON, newMode.shape);
35487
+ var shouldUpdateShape = !geoJSON.features.length || shouldAllowMultipleshapes || isNewSelectedTool;
35488
+ if (shouldUpdateShape) {
36259
35489
  var updatedGeoJSON = changeGeoJSON(newMode.shape);
36260
35490
  setFeatureLayerIndex(updatedGeoJSON.features.length - 1);
36261
35491
  }
36262
35492
  // handle modes and update feature layer index
36263
35493
  setDrawMode(newMode.value);
36264
35494
  setEditMode(!!newMode.value);
36265
- setLastSelectedTool(newMode.id);
36266
35495
  };
36267
35496
  var changeGeoJSON = function changeGeoJSON(updatedGeoJSON) {
36268
35497
  var geoJSONFeatureCollection = getFeatureCollection(updatedGeoJSON, shouldAllowMultipleshapes, geoJSON);
@@ -36288,11 +35517,14 @@ var useMapDrawTool = function useMapDrawTool(_ref) {
36288
35517
  setActiveTool(newActiveTool.id);
36289
35518
  }
36290
35519
  };
36291
- var reset = function reset() {
36292
- var shouldClearState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
35520
+ var deactivateTool = function deactivateTool() {
36293
35521
  setEditMode(false);
36294
35522
  setActiveTool('');
36295
35523
  setDrawMode('');
35524
+ };
35525
+ var reset = function reset() {
35526
+ var shouldClearState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
35527
+ deactivateTool();
36296
35528
  if (shouldClearState) {
36297
35529
  setGeoJSONIntersection(emptyIntersectionShape);
36298
35530
  setGeoJSON(emptyGeoJSON);
@@ -36327,7 +35559,6 @@ var useMapDrawTool = function useMapDrawTool(_ref) {
36327
35559
  setGeoJSONIntersectionBounds: onSetGeoJSONIntersectionBounds,
36328
35560
  editModes: editModes,
36329
35561
  isInEditMode: isInEditMode,
36330
- drawMode: drawMode,
36331
35562
  changeDrawMode: onSetDrawMode,
36332
35563
  setEditMode: setEditMode,
36333
35564
  featureLayerIndex: featureLayerIndex,
@@ -36336,7 +35567,9 @@ var useMapDrawTool = function useMapDrawTool(_ref) {
36336
35567
  changeActiveTool: changeActiveTool,
36337
35568
  setActiveTool: setActiveTool,
36338
35569
  layers: layers,
36339
- getLayer: getLayer
35570
+ getLayer: getLayer,
35571
+ deactivateTool: deactivateTool,
35572
+ setEditModes: setEditModes
36340
35573
  };
36341
35574
  };
36342
35575
 
@@ -37583,6 +36816,310 @@ var MapViewConnect = function MapViewConnect(_a) {
37583
36816
  }), children));
37584
36817
  };
37585
36818
 
36819
+ var defaultCanvasWidth = 150;
36820
+ var defaultCanvasHeight = 30;
36821
+ /**
36822
+ * Renders a legendgraphic image based on a WMImage.
36823
+ *
36824
+ * @param wmImage The wmImage element to render (from WMImage.js)
36825
+ * @param ctx The canvas to render the image on
36826
+ * @param width The width you want the image to have
36827
+ * @param height The height you want the image to have
36828
+ */
36829
+ var renderLegendGraphic = function renderLegendGraphic(wmImage, ctx, width, height) {
36830
+ ctx.beginPath();
36831
+ ctx.fillStyle = 'white';
36832
+ ctx.rect(0, 0, width, height);
36833
+ ctx.fill();
36834
+ if (wmImage) {
36835
+ if (wmImage.isLoading()) {
36836
+ /* Legend image is loading */
36837
+ ctx.fillStyle = 'blue';
36838
+ ctx.fillText('... loading ...', 10, 10);
36839
+ } else if (wmImage.hasError()) {
36840
+ /* Legend image has an error */
36841
+ ctx.fillStyle = 'red';
36842
+ ctx.fillText('error :(', 10, 10);
36843
+ } else {
36844
+ /* All OK, just draw the legend image */
36845
+ ctx.drawImage(wmImage.getElement(), 0, 0, Math.min(wmImage.getElement().width, width), Math.min(wmImage.getElement().height, height));
36846
+ }
36847
+ }
36848
+ };
36849
+ var Legend = function Legend(_ref) {
36850
+ var layer = _ref.layer;
36851
+ /* Variable to remember the previous image */
36852
+ var previousLegendImage = useRef(null);
36853
+ /* Function to force rerender of this component when legend image loads */
36854
+ var _useState = useState$1(),
36855
+ _useState2 = _slicedToArray(_useState, 2),
36856
+ setState = _useState2[1];
36857
+ var layerId = layer && layer.id;
36858
+ /* The canvas listens to the size of its container. We will update it according to the image size. */
36859
+ var _useState3 = useState$1(defaultCanvasWidth),
36860
+ _useState4 = _slicedToArray(_useState3, 2),
36861
+ canvasContainerWidth = _useState4[0],
36862
+ setCanvasContainerWidth = _useState4[1];
36863
+ var _useState5 = useState$1(defaultCanvasHeight),
36864
+ _useState6 = _slicedToArray(_useState5, 2),
36865
+ canvasContainerHeight = _useState6[0],
36866
+ setCanvasContainerHeight = _useState6[1];
36867
+ var imageWidth;
36868
+ var imageHeight;
36869
+ /* Register callback to legendImagestore to trigger rerender when image is loaded. */
36870
+ useEffect$1(function () {
36871
+ legendImageStore.addImageEventCallback(function (image, id, imageEventType) {
36872
+ if (imageEventType === WMImageEventType.Loaded) {
36873
+ setState(null);
36874
+ }
36875
+ }, "Legend_".concat(layerId));
36876
+ return function () {
36877
+ legendImageStore.removeEventCallback("Legend_".concat(layerId));
36878
+ };
36879
+ }, [layerId]);
36880
+ /* Should not do anything if no layer is given */
36881
+ if (!layer) {
36882
+ return null;
36883
+ }
36884
+ var isLayerEnabled = layer.enabled;
36885
+ if (!isLayerEnabled) {
36886
+ return null;
36887
+ }
36888
+ var layerOpacity = layer.opacity ? layer.opacity : 1;
36889
+ /* Get the wmLayer, it has more detailed info about the WMS service,
36890
+ like a title and the WMS legendgraphic url */
36891
+ var wmLayer = getWMLayerById(layer.id);
36892
+ return /*#__PURE__*/React__default.createElement(LegendLayout, {
36893
+ title: wmLayer === null || wmLayer === void 0 ? void 0 : wmLayer.title,
36894
+ name: wmLayer === null || wmLayer === void 0 ? void 0 : wmLayer.name,
36895
+ dimensions: layer === null || layer === void 0 ? void 0 : layer.dimensions,
36896
+ height: canvasContainerHeight,
36897
+ width: canvasContainerWidth,
36898
+ minWidth: defaultCanvasWidth
36899
+ }, /*#__PURE__*/React__default.createElement(CanvasComponent, {
36900
+ redrawInterval: 500,
36901
+ onRenderCanvas: function onRenderCanvas(ctx, width, height) {
36902
+ /*
36903
+ Check if the wmLayer is available, this happens when the WMS GetCapabilities is loaded and parsed.
36904
+ Note that we cannot use the wmLayer variable above, as this one could contain a non initialized WMJSLayer.
36905
+ */
36906
+ var legendWmLayer = getWMLayerById(layer.id);
36907
+ var legendUrl = getLegendGraphicURLForLayer(legendWmLayer);
36908
+ var image = legendImageStore.getImage(legendUrl);
36909
+ /* If there is no image for the given URL, we do not want to display a legend image (e.g. outside range) */
36910
+ if (!image) {
36911
+ previousLegendImage.current = null;
36912
+ setCanvasContainerWidth(defaultCanvasWidth);
36913
+ setCanvasContainerHeight(defaultCanvasHeight);
36914
+ ctx.beginPath();
36915
+ ctx.fillStyle = '#fff';
36916
+ ctx.rect(0, 0, width, height);
36917
+ ctx.fill();
36918
+ ctx.fillStyle = 'black';
36919
+ if (!legendUrl) {
36920
+ ctx.fillText('No legend graphic available', 5, 16);
36921
+ }
36922
+ } else {
36923
+ /* If there is an image for the given url, and has no error, but it is not yet loading or loaded, start loading it! */
36924
+ if (image && image.hasError() === false && image.isLoaded() === false && image.isLoading() === false) {
36925
+ image.load(); /* Will eventually trigger the callback used in the useEffect */
36926
+ }
36927
+ /* If the image is ready, we can show it in the component, store it in our ref, otherwise we keep the previous image to prevent flickering */
36928
+ if (image && image.isLoaded()) {
36929
+ previousLegendImage.current = image;
36930
+ /* Set the canvas container to the same size as the image */
36931
+ imageHeight = image.getHeight();
36932
+ setCanvasContainerHeight(imageHeight);
36933
+ imageWidth = image.getWidth();
36934
+ setCanvasContainerWidth(imageWidth);
36935
+ /* Give the canvas a white background before adding the image */
36936
+ ctx.fillStyle = '#fff';
36937
+ ctx.rect(0, 0, width, height);
36938
+ ctx.fill();
36939
+ /* Set the opacity used in the layer */
36940
+ ctx.globalAlpha = layerOpacity;
36941
+ }
36942
+ renderLegendGraphic(previousLegendImage.current, ctx, imageWidth, imageHeight);
36943
+ }
36944
+ }
36945
+ }));
36946
+ };
36947
+
36948
+ /* *
36949
+ * Licensed under the Apache License, Version 2.0 (the "License");
36950
+ * you may not use this file except in compliance with the License.
36951
+ * You may obtain a copy of the License at
36952
+ *
36953
+ * http://www.apache.org/licenses/LICENSE-2.0
36954
+ *
36955
+ * Unless required by applicable law or agreed to in writing, software
36956
+ * distributed under the License is distributed on an "AS IS" BASIS,
36957
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36958
+ * See the License for the specific language governing permissions and
36959
+ * limitations under the License.
36960
+ *
36961
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
36962
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
36963
+ * */
36964
+ var LegendDialog = function LegendDialog(_ref) {
36965
+ var layers = _ref.layers,
36966
+ isOpen = _ref.isOpen,
36967
+ onClose = _ref.onClose,
36968
+ _ref$onMouseDown = _ref.onMouseDown,
36969
+ onMouseDown = _ref$onMouseDown === void 0 ? function () {} : _ref$onMouseDown,
36970
+ mapId = _ref.mapId,
36971
+ _ref$showMapId = _ref.showMapId,
36972
+ showMapId = _ref$showMapId === void 0 ? false : _ref$showMapId,
36973
+ _ref$order = _ref.order,
36974
+ order = _ref$order === void 0 ? 0 : _ref$order,
36975
+ _ref$source = _ref.source,
36976
+ source = _ref$source === void 0 ? 'app' : _ref$source;
36977
+ return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
36978
+ startPosition: {
36979
+ right: 20,
36980
+ top: 50
36981
+ },
36982
+ minWidth: 100,
36983
+ onClose: onClose,
36984
+ title: showMapId ? "Legend ".concat(mapId) : 'Legend',
36985
+ initialMaxHeight: 440,
36986
+ isOpen: isOpen,
36987
+ "data-testid": "moveable-legend",
36988
+ bounds: "parent",
36989
+ onMouseDown: onMouseDown,
36990
+ order: order,
36991
+ source: source
36992
+ }, /*#__PURE__*/React.createElement(Box$2, {
36993
+ sx: {
36994
+ padding: 0.5
36995
+ }
36996
+ }, layers && layers.length > 0 ? /*#__PURE__*/React.createElement(Box$2, {
36997
+ "data-testid": "LegendList",
36998
+ sx: {
36999
+ display: 'flex',
37000
+ flexDirection: 'column',
37001
+ '&>div:last-child': {
37002
+ marginBottom: 0
37003
+ }
37004
+ }
37005
+ }, layers.map(function (layer) {
37006
+ return /*#__PURE__*/React.createElement(Legend, {
37007
+ key: layer.id,
37008
+ layer: layer
37009
+ });
37010
+ })) : /*#__PURE__*/React.createElement(Typography, {
37011
+ "data-testid": "NoLayers",
37012
+ variant: "body1",
37013
+ style: {
37014
+ fontWeight: 500,
37015
+ fontSize: 14
37016
+ }
37017
+ }, "No layers")));
37018
+ };
37019
+
37020
+ var LegendConnectComponent = function LegendConnectComponent(_ref) {
37021
+ var _ref$showMapId = _ref.showMapId,
37022
+ showMapId = _ref$showMapId === void 0 ? false : _ref$showMapId,
37023
+ _ref$source = _ref.source,
37024
+ source = _ref$source === void 0 ? 'app' : _ref$source,
37025
+ _ref$mapId = _ref.mapId,
37026
+ initialMapId = _ref$mapId === void 0 ? null : _ref$mapId,
37027
+ _ref$multiLegend = _ref.multiLegend,
37028
+ multiLegend = _ref$multiLegend === void 0 ? false : _ref$multiLegend;
37029
+ var dispatch = useDispatch();
37030
+ var legendType = multiLegend ? "legend-".concat(initialMapId) : "legend";
37031
+ var mapIdStore = useSelector(function (store) {
37032
+ return getDialogMapId(store, legendType);
37033
+ });
37034
+ var _React$useState = React.useState(initialMapId),
37035
+ _React$useState2 = _slicedToArray(_React$useState, 2),
37036
+ mapId = _React$useState2[0],
37037
+ setMapId = _React$useState2[1];
37038
+ React.useEffect(function () {
37039
+ setMapId(mapIdStore);
37040
+ }, [mapIdStore]);
37041
+ var mapLayers = useSelector(function (store) {
37042
+ return getMapLayers(store, mapId);
37043
+ });
37044
+ var isDialogOpen = useSelector(function (store) {
37045
+ return getisDialogOpen(store, legendType);
37046
+ });
37047
+ var uiOrder = useSelector(function (store) {
37048
+ return getDialogOrder(store, legendType);
37049
+ });
37050
+ var uiSource = useSelector(function (store) {
37051
+ return getDialogSource(store, legendType);
37052
+ });
37053
+ var uiIsOrderedOnTop = useSelector(function (store) {
37054
+ return getDialogIsOrderedOnTop(store, legendType);
37055
+ });
37056
+ var onClose = function onClose() {
37057
+ dispatch(uiActions.setToggleOpenDialog({
37058
+ type: legendType,
37059
+ setOpen: false,
37060
+ origin: MapActionOrigin.map,
37061
+ mapId: mapId
37062
+ }));
37063
+ };
37064
+ var registerDialog = React.useCallback(function (setOpen) {
37065
+ return dispatch(uiActions.registerDialog({
37066
+ type: legendType,
37067
+ mapId: mapId,
37068
+ setOpen: setOpen,
37069
+ source: source
37070
+ }));
37071
+ }, [dispatch, source, legendType, mapId]);
37072
+ var unregisterDialog = React.useCallback(function () {
37073
+ return dispatch(uiActions.unregisterDialog({
37074
+ type: legendType
37075
+ }));
37076
+ }, [dispatch, legendType]);
37077
+ var onOrderDialog = React.useCallback(function () {
37078
+ if (!uiIsOrderedOnTop) {
37079
+ dispatch(uiActions.orderDialog({
37080
+ type: legendType
37081
+ }));
37082
+ }
37083
+ }, [dispatch, uiIsOrderedOnTop, legendType]);
37084
+ // Register this dialog in the store
37085
+ React.useEffect(function () {
37086
+ registerDialog(IS_LEGEND_OPEN_BY_DEFAULT);
37087
+ return function () {
37088
+ unregisterDialog();
37089
+ };
37090
+ // eslint-disable-next-line react-hooks/exhaustive-deps
37091
+ }, []);
37092
+ return /*#__PURE__*/React.createElement(LegendDialog, {
37093
+ layers: mapLayers,
37094
+ isOpen: isDialogOpen,
37095
+ onClose: onClose,
37096
+ mapId: mapId,
37097
+ showMapId: showMapId,
37098
+ onMouseDown: onOrderDialog,
37099
+ order: uiOrder,
37100
+ source: uiSource
37101
+ });
37102
+ };
37103
+ /**
37104
+ * Legend component connected to the store displaying a legend for every layer shown on the active map Id
37105
+ * Please note that in order to use this and open/close the dialog, every map on the screen that should be able to show
37106
+ * a dialog should have the <LegendMapButtonConnect/> which is used to focus the correct map and open the dialog
37107
+ *
37108
+ * Expects the following props:
37109
+ * @param {boolean} showMapId (optional) showMapId: boolean - show the id of the map in the dialog title of which the legend is shown in te dialog
37110
+ * @param {uiTypes.Source} source (optional) source: uiTypes.Source - default is 'app', 'module' makes sure it will be shown on top of the module
37111
+
37112
+ * ``` <LegendConnect legendDialogId={legendDialogId} />```
37113
+ */
37114
+ var LegendConnect = function LegendConnect(_a) {
37115
+ var _a$showMapId = _a.showMapId,
37116
+ showMapId = _a$showMapId === void 0 ? false : _a$showMapId,
37117
+ props = __rest$1(_a, ["showMapId"]);
37118
+ return /*#__PURE__*/React.createElement(LegendConnectComponent, Object.assign({
37119
+ showMapId: showMapId
37120
+ }, props));
37121
+ };
37122
+
37586
37123
  /* *
37587
37124
  * Licensed under the Apache License, Version 2.0 (the "License");
37588
37125
  * you may not use this file except in compliance with the License.
@@ -58761,111 +58298,630 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
58761
58298
  * See the License for the specific language governing permissions and
58762
58299
  * limitations under the License.
58763
58300
  *
58764
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
58765
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
58301
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
58302
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
58303
+ * */
58304
+ var mapBoxStyle = function mapBoxStyle(theme) {
58305
+ return {
58306
+ boxSizing: 'border-box',
58307
+ "float": 'left',
58308
+ '& .MapViewComponent': {
58309
+ border: "1px solid ".concat(theme.palette.geowebColors.typographyAndIcons.iconLinkDisabled)
58310
+ }
58311
+ };
58312
+ };
58313
+ var MultiMapViewConnect = function MultiMapViewConnect(_ref) {
58314
+ var maps = _ref.maps,
58315
+ rows = _ref.rows,
58316
+ cols = _ref.cols,
58317
+ _ref$showTimeSlider = _ref.showTimeSlider,
58318
+ showTimeSlider = _ref$showTimeSlider === void 0 ? true : _ref$showTimeSlider,
58319
+ _ref$showZoomControls = _ref.showZoomControls,
58320
+ showZoomControls = _ref$showZoomControls === void 0 ? true : _ref$showZoomControls,
58321
+ _ref$multiLegend = _ref.multiLegend,
58322
+ multiLegend = _ref$multiLegend === void 0 ? false : _ref$multiLegend,
58323
+ _ref$showClock = _ref.showClock,
58324
+ showClock = _ref$showClock === void 0 ? true : _ref$showClock;
58325
+ var dispatch = useDispatch();
58326
+ var syncGroupAddTarget = React__default.useCallback(function (payload) {
58327
+ dispatch(genericActions.syncGroupAddTarget(payload));
58328
+ }, [dispatch]);
58329
+ var syncTargets = useSelector(function (store) {
58330
+ return getSyncGroupTargets(store);
58331
+ });
58332
+ React__default.useEffect(function () {
58333
+ maps.forEach(function (map) {
58334
+ map.syncGroupsIds && map.syncGroupsIds.forEach(function (syncGroupsId) {
58335
+ var alreadySyncedTargetIndex = syncTargets.findIndex(function (target) {
58336
+ return target.targetId === map.id && target.groupId === syncGroupsId && target.linked === true;
58337
+ });
58338
+ // Only trigger an action if the target was not yet added to the group or was not linked.
58339
+ if (alreadySyncedTargetIndex === -1) {
58340
+ syncGroupAddTarget({
58341
+ groupId: syncGroupsId,
58342
+ targetId: map.id,
58343
+ linked: true,
58344
+ origin: 'system'
58345
+ });
58346
+ }
58347
+ });
58348
+ });
58349
+ }, [maps, syncGroupAddTarget, syncTargets]);
58350
+ var mapStyle = {
58351
+ width: "".concat(Math.round(100 / cols), "%"),
58352
+ height: "".concat(Math.round(100 / rows), "%")
58353
+ };
58354
+ var firstMapId = maps[0].id;
58355
+ return /*#__PURE__*/React__default.createElement("div", {
58356
+ style: {
58357
+ height: '100%',
58358
+ position: 'relative'
58359
+ },
58360
+ "data-testid": "MultiMapViewSliderConnect"
58361
+ }, /*#__PURE__*/React__default.createElement("div", {
58362
+ style: {
58363
+ position: 'absolute',
58364
+ left: '0px',
58365
+ bottom: '0px',
58366
+ zIndex: 1000,
58367
+ width: '100%'
58368
+ }
58369
+ }, showTimeSlider && /*#__PURE__*/React__default.createElement(TimeSliderConnect, {
58370
+ sourceId: firstMapId,
58371
+ mapId: firstMapId,
58372
+ isAlwaysVisible: true
58373
+ })), !multiLegend && /*#__PURE__*/React__default.createElement(LegendConnect, {
58374
+ showMapId: true,
58375
+ mapId: firstMapId,
58376
+ multiLegend: multiLegend
58377
+ }), showClock && /*#__PURE__*/React__default.createElement(TimeSliderClockConnect, {
58378
+ mapId: firstMapId
58379
+ }), maps.map(function (map, mapIndex) {
58380
+ var mapId = map.id;
58381
+ return /*#__PURE__*/React__default.createElement(Box$2, {
58382
+ key: mapId,
58383
+ style: mapStyle,
58384
+ sx: mapBoxStyle
58385
+ }, /*#__PURE__*/React__default.createElement(ConfigurableMapConnect, {
58386
+ title: map.title || mapId,
58387
+ id: mapId,
58388
+ layers: map.layers || [],
58389
+ autoTimeStepLayerId: map.autoTimeStepLayerId,
58390
+ autoUpdateLayerId: map.autoUpdateLayerId,
58391
+ bbox: map.bbox,
58392
+ srs: map.srs,
58393
+ dimensions: map.dimensions || [],
58394
+ displayTimeInMap: map.displayTimeInMap || false,
58395
+ displayLayerManagerAndLegendButtonInMap: map.displayLayerManagerAndLegendButtonInMap,
58396
+ displayDimensionSelectButtonInMap: map.displayDimensionSelectButtonInMap,
58397
+ shouldShowZoomControls: showZoomControls && mapIndex === 0,
58398
+ showTimeSlider: false,
58399
+ disableTimeSlider: true,
58400
+ showClock: false,
58401
+ multiLegend: multiLegend
58402
+ }));
58403
+ }));
58404
+ };
58405
+
58406
+ /* *
58407
+ * Licensed under the Apache License, Version 2.0 (the "License");
58408
+ * you may not use this file except in compliance with the License.
58409
+ * You may obtain a copy of the License at
58410
+ *
58411
+ * http://www.apache.org/licenses/LICENSE-2.0
58412
+ *
58413
+ * Unless required by applicable law or agreed to in writing, software
58414
+ * distributed under the License is distributed on an "AS IS" BASIS,
58415
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
58416
+ * See the License for the specific language governing permissions and
58417
+ * limitations under the License.
58418
+ *
58419
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
58420
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
58421
+ * */
58422
+ var DWD = {
58423
+ name: 'DWD',
58424
+ url: 'https://maps.dwd.de/geoserver/ows?',
58425
+ id: 'dwd'
58426
+ };
58427
+ var nationaalgeoregister = {
58428
+ name: 'nationaalgeoregister.nl',
58429
+ url: 'https://geodata.nationaalgeoregister.nl/cbsgebiedsindelingen/wms?request=GetCapabilities&service=wms',
58430
+ id: 'nationaalgeoregister'
58431
+ };
58432
+ var KNMImsgcpp = {
58433
+ name: 'KNMImsgcpp',
58434
+ url: 'https://adaguc-server-msg-cpp-portal.pmc.knmi.cloud/wms?DATASET=msgrt&',
58435
+ id: 'msgcpp-ogc-realtime'
58436
+ };
58437
+ var HeiGit = {
58438
+ name: 'HeiGit',
58439
+ url: 'https://maps.heigit.org/osm-wms/service',
58440
+ id: 'HeiGit-osm-wms'
58441
+ };
58442
+ var ArcGisCanvas = {
58443
+ name: 'ArcGisCanvas',
58444
+ url: 'https://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/',
58445
+ id: 'ArcGisCanvas'
58446
+ };
58447
+ var KNMIgeoservicesRadar = {
58448
+ name: 'KNMIgeoservicesRadar',
58449
+ url: 'https://geoservices.knmi.nl/wms?dataset=RADAR&',
58450
+ id: 'KNMIgeoservicesRadar'
58451
+ };
58452
+ var KNMIgeoservicesObs = {
58453
+ name: 'KNMIgeoservicesObs',
58454
+ url: 'https://geoservices.knmi.nl/adagucserver?dataset=OBS',
58455
+ id: 'KNMIgeoservicesObs'
58456
+ };
58457
+ var KNMIgeoservicesKlimaatAtlas = {
58458
+ name: 'KNMIgeoservicesKlimaatAtlas',
58459
+ url: 'https://geoservices.knmi.nl/wms?DATASET=gsie-dataset&SERVICE=WMS&',
58460
+ id: 'KNMIgeoservicesKlimaatAtlas'
58461
+ };
58462
+ var KNMIgeoservicesHarmonie = {
58463
+ name: 'KNMIgeoservicesHarmonie',
58464
+ url: 'https://geoservices.knmi.nl/wms?DATASET=HARM_N25&',
58465
+ id: 'KNMIgeoservicesKliKNMIgeoservicesHarmoniemaatAtlas'
58466
+ };
58467
+ var KNMIgeoservicesHarmonieMLService = {
58468
+ name: 'KNMI Harmonie ML',
58469
+ url: 'https://geoservices.knmi.nl/wms?DATASET=HARM_N25_ML&SERVICE=WMS&',
58470
+ id: 'harmonieML'
58471
+ };
58472
+ var MetNorwayService = {
58473
+ name: 'MetNorwayService',
58474
+ url: 'https://wms-e1.geoweb.met.no/wms?',
58475
+ id: 'MetNorwayService'
58476
+ };
58477
+ var FMIopenwms = {
58478
+ name: 'FMIopenwms',
58479
+ url: 'https://openwms.fmi.fi/geoserver/wms?',
58480
+ id: 'FMIopenwms'
58481
+ };
58482
+ var DWDObservations = {
58483
+ name: 'DWDObservations',
58484
+ url: 'https://maps.dwd.de/geoserver/dwd/Wetter_Beobachtungen/ows?',
58485
+ id: 'DWDObservations'
58486
+ };
58487
+ var DWDWarnings = {
58488
+ name: 'DWDWarnings',
58489
+ url: 'https://maps.dwd.de/geoserver/dwd/Warnungen_Gemeinden_vereinigt/ows?',
58490
+ id: 'DWDWarnings'
58491
+ };
58492
+ var DWDWXProdukt = {
58493
+ name: 'DWDWXProdukt',
58494
+ url: 'https://maps.dwd.de/geoserver/dwd/WX-Produkt/ows?',
58495
+ id: 'DWDWXProdukt'
58496
+ };
58497
+ var EUMETSAT = {
58498
+ name: 'EUMETSAT',
58499
+ url: 'https://view.eumetsat.int/geoserver/wms?',
58500
+ id: 'EUMETSAT'
58501
+ };
58502
+ var eumetviewEUMETSAT = {
58503
+ name: 'eumetviewEUMETSAT',
58504
+ url: 'https://eumetview.eumetsat.int/geoserv/wms?',
58505
+ id: 'eumetviewEUMETSAT'
58506
+ };
58507
+ var ECMWFPublicService = {
58508
+ name: 'ECMWF',
58509
+ url: 'https://eccharts.ecmwf.int/wms/?token=public',
58510
+ id: 'ecmwf'
58511
+ };
58512
+ var MeteoCanada = {
58513
+ name: 'Meteo Canada',
58514
+ url: 'https://geo.weather.gc.ca/geomet/?lang=en&',
58515
+ id: 'MeteoCanada'
58516
+ };
58517
+
58518
+ var publicServices = /*#__PURE__*/Object.freeze({
58519
+ __proto__: null,
58520
+ DWD: DWD,
58521
+ nationaalgeoregister: nationaalgeoregister,
58522
+ KNMImsgcpp: KNMImsgcpp,
58523
+ HeiGit: HeiGit,
58524
+ ArcGisCanvas: ArcGisCanvas,
58525
+ KNMIgeoservicesRadar: KNMIgeoservicesRadar,
58526
+ KNMIgeoservicesObs: KNMIgeoservicesObs,
58527
+ KNMIgeoservicesKlimaatAtlas: KNMIgeoservicesKlimaatAtlas,
58528
+ KNMIgeoservicesHarmonie: KNMIgeoservicesHarmonie,
58529
+ KNMIgeoservicesHarmonieMLService: KNMIgeoservicesHarmonieMLService,
58530
+ MetNorwayService: MetNorwayService,
58531
+ FMIopenwms: FMIopenwms,
58532
+ DWDObservations: DWDObservations,
58533
+ DWDWarnings: DWDWarnings,
58534
+ DWDWXProdukt: DWDWXProdukt,
58535
+ EUMETSAT: EUMETSAT,
58536
+ eumetviewEUMETSAT: eumetviewEUMETSAT,
58537
+ ECMWFPublicService: ECMWFPublicService,
58538
+ MeteoCanada: MeteoCanada
58539
+ });
58540
+
58541
+ /* *
58542
+ * Licensed under the Apache License, Version 2.0 (the "License");
58543
+ * you may not use this file except in compliance with the License.
58544
+ * You may obtain a copy of the License at
58545
+ *
58546
+ * http://www.apache.org/licenses/LICENSE-2.0
58547
+ *
58548
+ * Unless required by applicable law or agreed to in writing, software
58549
+ * distributed under the License is distributed on an "AS IS" BASIS,
58550
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
58551
+ * See the License for the specific language governing permissions and
58552
+ * limitations under the License.
58553
+ *
58554
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
58555
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
58766
58556
  * */
58767
- var mapBoxStyle = function mapBoxStyle(theme) {
58768
- return {
58769
- boxSizing: 'border-box',
58770
- "float": 'left',
58771
- '& .MapViewComponent': {
58772
- border: "1px solid ".concat(theme.palette.geowebColors.typographyAndIcons.iconLinkDisabled)
58773
- }
58774
- };
58557
+ var baseLayer$1 = {
58558
+ name: 'arcGisSat',
58559
+ title: 'arcGisSat',
58560
+ type: 'twms',
58561
+ layerType: LayerType.baseLayer,
58562
+ enabled: true,
58563
+ id: generateLayerId()
58775
58564
  };
58776
- var MultiMapViewConnect = function MultiMapViewConnect(_ref) {
58777
- var maps = _ref.maps,
58778
- rows = _ref.rows,
58779
- cols = _ref.cols,
58780
- _ref$showTimeSlider = _ref.showTimeSlider,
58781
- showTimeSlider = _ref$showTimeSlider === void 0 ? true : _ref$showTimeSlider,
58782
- _ref$showZoomControls = _ref.showZoomControls,
58783
- showZoomControls = _ref$showZoomControls === void 0 ? true : _ref$showZoomControls,
58784
- _ref$multiLegend = _ref.multiLegend,
58785
- multiLegend = _ref$multiLegend === void 0 ? false : _ref$multiLegend,
58786
- _ref$showClock = _ref.showClock,
58787
- showClock = _ref$showClock === void 0 ? true : _ref$showClock;
58788
- var dispatch = useDispatch();
58789
- var syncGroupAddTarget = React__default.useCallback(function (payload) {
58790
- dispatch(genericActions.syncGroupAddTarget(payload));
58791
- }, [dispatch]);
58792
- var syncTargets = useSelector(function (store) {
58793
- return getSyncGroupTargets(store);
58794
- });
58795
- React__default.useEffect(function () {
58796
- maps.forEach(function (map) {
58797
- map.syncGroupsIds && map.syncGroupsIds.forEach(function (syncGroupsId) {
58798
- var alreadySyncedTargetIndex = syncTargets.findIndex(function (target) {
58799
- return target.targetId === map.id && target.groupId === syncGroupsId && target.linked === true;
58800
- });
58801
- // Only trigger an action if the target was not yet added to the group or was not linked.
58802
- if (alreadySyncedTargetIndex === -1) {
58803
- syncGroupAddTarget({
58804
- groupId: syncGroupsId,
58805
- targetId: map.id,
58806
- linked: true,
58807
- origin: 'system'
58808
- });
58809
- }
58810
- });
58811
- });
58812
- }, [maps, syncGroupAddTarget, syncTargets]);
58813
- var mapStyle = {
58814
- width: "".concat(Math.round(100 / cols), "%"),
58815
- height: "".concat(Math.round(100 / rows), "%")
58816
- };
58817
- var firstMapId = maps[0].id;
58818
- return /*#__PURE__*/React__default.createElement("div", {
58819
- style: {
58820
- height: '100%',
58821
- position: 'relative'
58822
- },
58823
- "data-testid": "MultiMapViewSliderConnect"
58824
- }, /*#__PURE__*/React__default.createElement("div", {
58825
- style: {
58826
- position: 'absolute',
58827
- left: '0px',
58828
- bottom: '0px',
58829
- zIndex: 1000,
58830
- width: '100%'
58831
- }
58832
- }, showTimeSlider && /*#__PURE__*/React__default.createElement(TimeSliderConnect, {
58833
- sourceId: firstMapId,
58834
- mapId: firstMapId,
58835
- isAlwaysVisible: true
58836
- })), !multiLegend && /*#__PURE__*/React__default.createElement(LegendConnect, {
58837
- showMapId: true,
58838
- mapId: firstMapId,
58839
- multiLegend: multiLegend
58840
- }), showClock && /*#__PURE__*/React__default.createElement(TimeSliderClockConnect, {
58841
- mapId: firstMapId
58842
- }), maps.map(function (map, mapIndex) {
58843
- var mapId = map.id;
58844
- return /*#__PURE__*/React__default.createElement(Box$2, {
58845
- key: mapId,
58846
- style: mapStyle,
58847
- sx: mapBoxStyle
58848
- }, /*#__PURE__*/React__default.createElement(ConfigurableMapConnect, {
58849
- title: map.title || mapId,
58850
- id: mapId,
58851
- layers: map.layers || [],
58852
- autoTimeStepLayerId: map.autoTimeStepLayerId,
58853
- autoUpdateLayerId: map.autoUpdateLayerId,
58854
- bbox: map.bbox,
58855
- srs: map.srs,
58856
- dimensions: map.dimensions || [],
58857
- displayTimeInMap: map.displayTimeInMap || false,
58858
- displayLayerManagerAndLegendButtonInMap: map.displayLayerManagerAndLegendButtonInMap,
58859
- displayDimensionSelectButtonInMap: map.displayDimensionSelectButtonInMap,
58860
- shouldShowZoomControls: showZoomControls && mapIndex === 0,
58861
- showTimeSlider: false,
58862
- disableTimeSlider: true,
58863
- showClock: false,
58864
- multiLegend: multiLegend
58865
- }));
58866
- }));
58565
+ // Base Layers List
58566
+ var baseLayerOpenStreetMapNL$1 = {
58567
+ id: 'base-layer-2',
58568
+ name: 'OpenStreetMap_NL',
58569
+ type: 'twms',
58570
+ layerType: LayerType.baseLayer,
58571
+ enabled: true
58572
+ };
58573
+ var baseLayerArcGisCanvas$1 = {
58574
+ service: ArcGisCanvas.url,
58575
+ id: generateLayerId(),
58576
+ name: 'arcGisCanvas',
58577
+ type: 'twms',
58578
+ enabled: true,
58579
+ layerType: LayerType.baseLayer
58580
+ };
58581
+ var baseLayerWorldMap$1 = {
58582
+ id: generateLayerId(),
58583
+ name: 'WorldMap',
58584
+ type: 'twms',
58585
+ layerType: LayerType.baseLayer,
58586
+ enabled: true
58587
+ };
58588
+ var baseLayerHeiGit = {
58589
+ service: HeiGit.url,
58590
+ id: generateLayerId(),
58591
+ name: 'osm_auto:all',
58592
+ layerType: LayerType.baseLayer
58593
+ };
58594
+ // KNMI msgcpp List
58595
+ var msgCppLayer = {
58596
+ // doesn't work with https
58597
+ service: KNMImsgcpp.url,
58598
+ name: 'lwe_precipitation_rate',
58599
+ format: 'image/png',
58600
+ enabled: true,
58601
+ style: 'precip-transparent/nearest',
58602
+ id: generateLayerId(),
58603
+ layerType: LayerType.mapLayer
58604
+ };
58605
+ // Nederlandse Nationaal Georegister Layers list
58606
+ var veiligheidsRegiosGebiedsIndelingenLabels = {
58607
+ service: nationaalgeoregister.url,
58608
+ name: 'cbsgebiedsindelingen:cbs_veiligheidsregio_2020_labelpoint',
58609
+ style: 'CBS_Label',
58610
+ enabled: false,
58611
+ layerType: LayerType.mapLayer
58612
+ };
58613
+ var veiligheidsRegiosGebiedsIndelingen = {
58614
+ service: nationaalgeoregister.url,
58615
+ name: 'cbsgebiedsindelingen:cbs_veiligheidsregio_2020_gegeneraliseerd',
58616
+ style: 'CBS_Gebiedsindeling',
58617
+ enabled: false,
58618
+ layerType: LayerType.mapLayer
58619
+ };
58620
+ // KNMI Geoservices Layers List
58621
+ var radarLayer$1 = {
58622
+ service: KNMIgeoservicesRadar.url,
58623
+ name: 'RAD_NL25_PCP_CM',
58624
+ format: 'image/png',
58625
+ enabled: true,
58626
+ style: 'radar/nearest',
58627
+ id: generateLayerId(),
58628
+ layerType: LayerType.mapLayer
58629
+ };
58630
+ var radarLayerWithError = {
58631
+ service: KNMIgeoservicesRadar.url,
58632
+ name: 'radarLayer',
58633
+ format: 'image/png',
58634
+ enabled: true,
58635
+ style: 'knmiradar/nearest',
58636
+ id: generateLayerId(),
58637
+ layerType: LayerType.mapLayer
58638
+ };
58639
+ var obsAirTemperature = {
58640
+ service: KNMIgeoservicesObs.url,
58641
+ name: '10M/ta',
58642
+ id: generateLayerId(),
58643
+ layerType: LayerType.mapLayer
58644
+ };
58645
+ var obsWind = {
58646
+ service: KNMIgeoservicesObs.url,
58647
+ name: '10M/wind',
58648
+ id: generateLayerId(),
58649
+ layerType: LayerType.mapLayer
58650
+ };
58651
+ var obsAirPressureAtSeaLevel = {
58652
+ service: KNMIgeoservicesObs.url,
58653
+ name: '10M/pp',
58654
+ id: generateLayerId(),
58655
+ layerType: LayerType.mapLayer
58656
+ };
58657
+ var obsRelativeHumidity = {
58658
+ service: KNMIgeoservicesObs.url,
58659
+ name: '10M/rh',
58660
+ id: generateLayerId(),
58661
+ layerType: LayerType.mapLayer
58662
+ };
58663
+ var obsGlobalSolarRadiation = {
58664
+ service: KNMIgeoservicesObs.url,
58665
+ name: '10M/qg',
58666
+ id: generateLayerId(),
58667
+ layerType: LayerType.mapLayer
58668
+ };
58669
+ var obsPrecipitationIntensityPWS = {
58670
+ service: KNMIgeoservicesObs.url,
58671
+ name: '10M/pg',
58672
+ id: generateLayerId(),
58673
+ layerType: LayerType.mapLayer
58674
+ };
58675
+ var harmonieRelativeHumidityPl = {
58676
+ service: KNMIgeoservicesHarmonie.url,
58677
+ name: 'relative_humidity__at_pl',
58678
+ id: generateLayerId(),
58679
+ layerType: LayerType.mapLayer,
58680
+ enabled: true
58681
+ };
58682
+ var harmonieWindPl = {
58683
+ service: KNMIgeoservicesHarmonie.url,
58684
+ name: 'wind__at_pl',
58685
+ id: generateLayerId(),
58686
+ layerType: LayerType.mapLayer,
58687
+ enabled: true
58688
+ };
58689
+ var harmonieAirTemperature = {
58690
+ service: KNMIgeoservicesHarmonie.url,
58691
+ name: 'air_temperature__at_2m',
58692
+ id: generateLayerId(),
58693
+ layerType: LayerType.mapLayer,
58694
+ enabled: true
58695
+ };
58696
+ var harmoniePrecipitation = {
58697
+ service: KNMIgeoservicesHarmonie.url,
58698
+ name: 'precipitation_flux',
58699
+ id: generateLayerId(),
58700
+ layerType: LayerType.mapLayer,
58701
+ enabled: true
58702
+ };
58703
+ var harmoniePressure = {
58704
+ service: KNMIgeoservicesHarmonie.url,
58705
+ name: 'air_pressure_at_sea_level',
58706
+ id: generateLayerId(),
58707
+ layerType: LayerType.mapLayer,
58708
+ enabled: true
58709
+ };
58710
+ var harmonieWindFlags = {
58711
+ service: KNMIgeoservicesHarmonie.url,
58712
+ name: 'wind__at_10m',
58713
+ enabled: true,
58714
+ id: generateLayerId(),
58715
+ layerType: LayerType.mapLayer
58716
+ };
58717
+ var klimaatAtlasTG3 = {
58718
+ service: KNMIgeoservicesKlimaatAtlas.url,
58719
+ name: 'TG3',
58720
+ enabled: true,
58721
+ id: generateLayerId(),
58722
+ layerType: LayerType.mapLayer
58723
+ };
58724
+ // DWD Layers List
58725
+ var dwdWarningLayer = {
58726
+ service: DWDWarnings.url,
58727
+ name: 'Warnungen_Gemeinden_vereinigt',
58728
+ format: 'image/png',
58729
+ // style: 'warnungen_gemeinden_vereinigt_event_seamless_param',
58730
+ enabled: true,
58731
+ id: generateLayerId(),
58732
+ layerType: LayerType.mapLayer
58733
+ };
58734
+ var dwdRadarLayer = {
58735
+ service: DWDWXProdukt.url,
58736
+ name: 'WX-Produkt',
58737
+ format: 'image/png',
58738
+ enabled: true,
58739
+ id: generateLayerId(),
58740
+ layerType: LayerType.mapLayer
58741
+ };
58742
+ // this needs authentication to work
58743
+ var dwdObservationsWetterLayer = {
58744
+ service: DWDObservations.url,
58745
+ name: 'Wetter_Beobachtungen',
58746
+ style: 'Wetter_Symbole',
58747
+ format: 'image/png',
58748
+ enabled: true,
58749
+ id: generateLayerId(),
58750
+ layerType: LayerType.mapLayer
58751
+ // headers: [{ name: 'Authorization', value: 'Basic ...' }]
58752
+ };
58753
+
58754
+ var dwdObservationsWetterLayerWithHeader = {
58755
+ service: DWDObservations.url,
58756
+ name: 'Wetter_Beobachtungen',
58757
+ style: 'Wetter_Symbole',
58758
+ format: 'image/png',
58759
+ enabled: true,
58760
+ id: generateLayerId(),
58761
+ layerType: LayerType.mapLayer,
58762
+ headers: [{
58763
+ name: 'authorization',
58764
+ value: 'Basic aW50cmFuZXQtdXNlcjpDQnMjMTEh'
58765
+ }]
58766
+ };
58767
+ // this needs authentication to work
58768
+ var dwdObservationsWindLayer = {
58769
+ service: DWDObservations.url,
58770
+ name: 'Wetter_Beobachtungen',
58771
+ style: 'Wetter_Wind',
58772
+ format: 'image/png',
58773
+ enabled: true,
58774
+ id: generateLayerId(),
58775
+ layerType: LayerType.mapLayer
58776
+ };
58777
+ // FMI open wms Layers List
58778
+ var FMITemp = {
58779
+ service: FMIopenwms.url,
58780
+ name: 'temperature-forecast',
58781
+ format: 'image/png',
58782
+ enabled: true,
58783
+ id: generateLayerId(),
58784
+ layerType: LayerType.mapLayer
58785
+ };
58786
+ // Met Norway Layers List
58787
+ var MetNoTemp = {
58788
+ service: MetNorwayService.url,
58789
+ name: 'thredds_meps_latest_wind',
58790
+ format: 'image/png',
58791
+ enabled: true,
58792
+ id: generateLayerId(),
58793
+ layerType: LayerType.mapLayer
58794
+ };
58795
+ var metNorwayWind1 = {
58796
+ service: MetNorwayService.url,
58797
+ name: 'thredds_meps_latest_wind',
58798
+ format: 'image/png',
58799
+ enabled: true,
58800
+ id: generateLayerId(),
58801
+ layerType: LayerType.mapLayer
58802
+ };
58803
+ var metNorwayWind2 = {
58804
+ service: MetNorwayService.url,
58805
+ name: 'thredds_aromearctic_extracted_t',
58806
+ format: 'image/png',
58807
+ enabled: true,
58808
+ id: generateLayerId(),
58809
+ layerType: LayerType.mapLayer
58810
+ };
58811
+ var metNorwayWind3 = {
58812
+ service: MetNorwayService.url,
58813
+ name: 'thredds_nk800_temperature',
58814
+ format: 'image/png',
58815
+ enabled: true,
58816
+ id: generateLayerId(),
58817
+ layerType: LayerType.mapLayer
58818
+ };
58819
+ var metNorwayLatestT = {
58820
+ service: MetNorwayService.url,
58821
+ name: 'thredds_meps_latest_t',
58822
+ format: 'image/png',
58823
+ enabled: true,
58824
+ id: generateLayerId(),
58825
+ layerType: LayerType.mapLayer
58826
+ };
58827
+ var metNorwaySalinaty = {
58828
+ service: MetNorwayService.url,
58829
+ name: 'thredds_barents_2_5km_1h_salinity',
58830
+ format: 'image/png',
58831
+ enabled: true,
58832
+ id: generateLayerId(),
58833
+ layerType: LayerType.mapLayer
58834
+ };
58835
+ var msgFesEUMETSAT = {
58836
+ service: EUMETSAT.url,
58837
+ name: 'msg_fes:rgb_eview',
58838
+ enabled: true,
58839
+ id: generateLayerId(),
58840
+ layerType: LayerType.mapLayer
58841
+ };
58842
+ var msgNaturalenhncdEUMETSAT = {
58843
+ service: eumetviewEUMETSAT.url,
58844
+ name: 'meteosat:msg_naturalenhncd',
58845
+ enabled: true,
58846
+ id: generateLayerId(),
58847
+ layerType: LayerType.mapLayer
58848
+ };
58849
+ var msgAshEUMETSAT = {
58850
+ service: eumetviewEUMETSAT.url,
58851
+ name: 'meteosat:msg_ash',
58852
+ enabled: true,
58853
+ id: generateLayerId(),
58854
+ layerType: LayerType.mapLayer
58855
+ };
58856
+ var msgCthEUMETSAT = {
58857
+ service: eumetviewEUMETSAT.url,
58858
+ name: 'meteosat:msg_cth',
58859
+ enabled: true,
58860
+ id: generateLayerId(),
58861
+ layerType: LayerType.mapLayer
58862
+ };
58863
+ var msgFogEUMETSAT = {
58864
+ service: eumetviewEUMETSAT.url,
58865
+ name: 'meteosat:msg_fog',
58866
+ enabled: true,
58867
+ id: generateLayerId(),
58868
+ layerType: LayerType.mapLayer
58869
+ };
58870
+ var msgNaturalEUMETSAT = {
58871
+ service: eumetviewEUMETSAT.url,
58872
+ name: 'meteosat:msg_natural',
58873
+ enabled: true,
58874
+ id: generateLayerId(),
58875
+ layerType: LayerType.mapLayer
58867
58876
  };
58868
58877
 
58878
+ var publicLayers = /*#__PURE__*/Object.freeze({
58879
+ __proto__: null,
58880
+ baseLayer: baseLayer$1,
58881
+ baseLayerOpenStreetMapNL: baseLayerOpenStreetMapNL$1,
58882
+ baseLayerArcGisCanvas: baseLayerArcGisCanvas$1,
58883
+ baseLayerWorldMap: baseLayerWorldMap$1,
58884
+ baseLayerHeiGit: baseLayerHeiGit,
58885
+ msgCppLayer: msgCppLayer,
58886
+ veiligheidsRegiosGebiedsIndelingenLabels: veiligheidsRegiosGebiedsIndelingenLabels,
58887
+ veiligheidsRegiosGebiedsIndelingen: veiligheidsRegiosGebiedsIndelingen,
58888
+ radarLayer: radarLayer$1,
58889
+ radarLayerWithError: radarLayerWithError,
58890
+ obsAirTemperature: obsAirTemperature,
58891
+ obsWind: obsWind,
58892
+ obsAirPressureAtSeaLevel: obsAirPressureAtSeaLevel,
58893
+ obsRelativeHumidity: obsRelativeHumidity,
58894
+ obsGlobalSolarRadiation: obsGlobalSolarRadiation,
58895
+ obsPrecipitationIntensityPWS: obsPrecipitationIntensityPWS,
58896
+ harmonieRelativeHumidityPl: harmonieRelativeHumidityPl,
58897
+ harmonieWindPl: harmonieWindPl,
58898
+ harmonieAirTemperature: harmonieAirTemperature,
58899
+ harmoniePrecipitation: harmoniePrecipitation,
58900
+ harmoniePressure: harmoniePressure,
58901
+ harmonieWindFlags: harmonieWindFlags,
58902
+ klimaatAtlasTG3: klimaatAtlasTG3,
58903
+ dwdWarningLayer: dwdWarningLayer,
58904
+ dwdRadarLayer: dwdRadarLayer,
58905
+ dwdObservationsWetterLayer: dwdObservationsWetterLayer,
58906
+ dwdObservationsWetterLayerWithHeader: dwdObservationsWetterLayerWithHeader,
58907
+ dwdObservationsWindLayer: dwdObservationsWindLayer,
58908
+ FMITemp: FMITemp,
58909
+ MetNoTemp: MetNoTemp,
58910
+ metNorwayWind1: metNorwayWind1,
58911
+ metNorwayWind2: metNorwayWind2,
58912
+ metNorwayWind3: metNorwayWind3,
58913
+ metNorwayLatestT: metNorwayLatestT,
58914
+ metNorwaySalinaty: metNorwaySalinaty,
58915
+ msgFesEUMETSAT: msgFesEUMETSAT,
58916
+ msgNaturalenhncdEUMETSAT: msgNaturalenhncdEUMETSAT,
58917
+ msgAshEUMETSAT: msgAshEUMETSAT,
58918
+ msgCthEUMETSAT: msgCthEUMETSAT,
58919
+ msgFogEUMETSAT: msgFogEUMETSAT,
58920
+ msgNaturalEUMETSAT: msgNaturalEUMETSAT,
58921
+ overLayer: overLayer$1,
58922
+ baseLayerGrey: baseLayerGrey$1
58923
+ });
58924
+
58869
58925
  var useGetLatestReferenceTime = function useGetLatestReferenceTime(inputLayer) {
58870
58926
  var _React$useState = React.useState(''),
58871
58927
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -61510,4 +61566,4 @@ var MapWarningProperties = function MapWarningProperties(_ref) {
61510
61566
  * */
61511
61567
  var mapActions = Object.assign(Object.assign(Object.assign({}, layerActions), mapActions$1), serviceActions);
61512
61568
 
61513
- export { AppWrapperConnect, ConfigurableMapConnect, CoreThemeProvider, CoreThemeStoreProvider, DRAWMODE, EDITMODE, HarmonieTempAndPrecipPreset, LayerManager, BaseLayerRow as LayerManagerBaseLayerRow, LayerManagerConnect, DescriptionRow as LayerManagerDescriptionRow, HeaderOptions as LayerManagerHeaderOptions, LayerContainerRow as LayerManagerLayerContainerRow, LayerManagerMapButtonConnect, LayerSelectConnect, Legend, LegendConnect, LegendMapButtonConnect, MapControlButton, MapControls, MapDrawContainer, MapView, MapViewConnect, MapViewLayer, MapWarningProperties, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, ReactMapView, ReactMapViewLayer, RouterWrapperConnect, SnackbarWrapperConnect, SyncGroupViewerConnect, index$2 as SyncGroups, TimeSlider, BackwardForwardStepButtonConnect as TimeSliderBackwardForwardStepButtonConnect, TimeSliderButtonsConnect, TimeSliderConnect, TimeSliderLite, OptionsMenuButtonConnect as TimeSliderOptionsMenuButtonConnect, PlayButtonConnect as TimeSliderPlayButtonConnect, ZoomControlConnect, ZoomControls, addFeatureProperties, appActions, checkHoverFeatures, componentsLookUp, coreModuleConfig, createInterSections, dateFormat, defaultBbox, defaultBox, defaultConfigurations, defaultDelete, defaultPoint, defaultPolygon, distance, emptyGeoJSON, featureBox, featureMultiPoint, featurePoint, featurePolygon, filterLayers, filterMapPresets, filterNonTimeDimensions, filterServices, generateLayerId, generateMapId, generateTimesliderId, selectors$1 as genericSelectors, getDrawFunctionFromStore, getFeatureCollection, getFirstTimeStepForLayerId, getGeoJson, getLastTimeStepForLayerId, getNextTimeStepForLayerId, getPreviousTimeStepForLayerId, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, intersectGeoJSONS, layerActions, reducer$7 as layerReducer, selectors$4 as layerSelectors, types$3 as layerTypes, lineString, mapActions, enums as mapEnums, moduleConfig as mapModuleConfig, selectors as mapSelectors, types$2 as mapTypes, utils$1 as mapUtils, parseBoolean, parseLayer, publicLayers, publicServices, registerDrawFunction, registerWMJSMap, registerWMLayer, routerActions, selectors$5 as serviceSelectors, snackbarActions, store, genericActions as syncGroupActions, selectors$2 as syncGroupsSelectors, synchronizationGroupConfig as synchronizationGroupModuleConfig, synchronizationGroupConfig as synchronizationGroupsConfig, testLayers, timeSliderUtils, uiActions, uiModuleConfig, reducer$6 as uiReducer, selectors$3 as uiSelectors, types$1 as uiTypes, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, useFetchServices, useMapDrawTool, useSetupDialog, reducer$5 as webmapReducer };
61569
+ export { AppWrapperConnect, ConfigurableMapConnect, CoreThemeProvider, CoreThemeStoreProvider, DRAWMODE, EDITMODE, FilterType, HarmonieTempAndPrecipPreset, LayerManager, BaseLayerRow as LayerManagerBaseLayerRow, LayerManagerConnect, DescriptionRow as LayerManagerDescriptionRow, HeaderOptions as LayerManagerHeaderOptions, LayerContainerRow as LayerManagerLayerContainerRow, LayerManagerMapButtonConnect, LayerSelectConnect, Legend, LegendConnect, LegendMapButtonConnect, MapControlButton, MapControls, MapDrawContainer, MapView, MapViewConnect, MapViewLayer, MapWarningProperties, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, ReactMapView, ReactMapViewLayer, RouterWrapperConnect, SnackbarWrapperConnect, SyncGroupViewerConnect, index$2 as SyncGroups, TimeSlider, BackwardForwardStepButtonConnect as TimeSliderBackwardForwardStepButtonConnect, TimeSliderButtonsConnect, TimeSliderConnect, TimeSliderLite, OptionsMenuButtonConnect as TimeSliderOptionsMenuButtonConnect, PlayButtonConnect as TimeSliderPlayButtonConnect, ZoomControlConnect, ZoomControls, addFeatureProperties, appActions, checkHoverFeatures, componentsLookUp, coreModuleConfig, createInterSections, dateFormat, defaultBbox, defaultBox, defaultConfigurations, defaultDelete, defaultPoint, defaultPolygon, distance, emptyGeoJSON, featureBox, featureMultiPoint, featurePoint, featurePolygon, filterMapPresets, filterNonTimeDimensions, filterServices, generateLayerId, generateMapId, generateTimesliderId, selectors$1 as genericSelectors, getDrawFunctionFromStore, getFeatureCollection, getFirstTimeStepForLayerId, getGeoJson, getLastTimeStepForLayerId, getNextTimeStepForLayerId, getPreviousTimeStepForLayerId, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, intersectGeoJSONS, isGeoJSONFeatureCreatedByTool, layerActions, reducer$7 as layerReducer, selectors$4 as layerSelectors, types$3 as layerTypes, lineString, mapActions, enums as mapEnums, moduleConfig as mapModuleConfig, selectors as mapSelectors, types$2 as mapTypes, utils$1 as mapUtils, publicLayers, publicServices, registerDrawFunction, registerWMJSMap, registerWMLayer, routerActions, selectors$5 as serviceSelectors, snackbarActions, store, genericActions as syncGroupActions, selectors$2 as syncGroupsSelectors, synchronizationGroupConfig as synchronizationGroupModuleConfig, synchronizationGroupConfig as synchronizationGroupsConfig, testLayers, timeSliderUtils, uiActions, uiModuleConfig, reducer$6 as uiReducer, selectors$3 as uiSelectors, types$1 as uiTypes, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, useFetchServices, useMapDrawTool, useSetupDialog, reducer$5 as webmapReducer };