@opengeoweb/webmap-react 9.9.0 → 9.10.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 (27) hide show
  1. package/index.esm.js +594 -453
  2. package/package.json +2 -2
  3. package/src/lib/components/MapDimensionSelect/DimensionSelectButton.d.ts +8 -0
  4. package/src/lib/components/MapDimensionSelect/DimensionSelectDialog.d.ts +14 -0
  5. package/src/lib/components/MapDimensionSelect/DimensionSelectDialog.stories.d.ts +29 -0
  6. package/src/lib/components/MapDimensionSelect/DimensionSelectSlider.d.ts +14 -0
  7. package/src/lib/components/MapDimensionSelect/DimensionSelectSlider.spec.d.ts +1 -0
  8. package/src/lib/components/MapDimensionSelect/MapDimensionSelect.d.ts +11 -0
  9. package/src/lib/components/MapDimensionSelect/MapDimensionSelect.spec.d.ts +1 -0
  10. package/src/lib/components/MapDimensionSelect/MapDimensionSelect.stories.d.ts +7 -0
  11. package/src/lib/components/MapDimensionSelect/index.d.ts +6 -0
  12. package/src/lib/components/MapDimensionSelect/utils.d.ts +17 -0
  13. package/src/lib/components/MapDimensionSelect/utils.spec.d.ts +1 -0
  14. package/src/lib/components/MapDraw/storyComponents/FeatureLayers.d.ts +2 -1
  15. package/src/lib/components/MapDraw/storyComponents/SelectField.d.ts +2 -2
  16. package/src/lib/components/MapDrawTool/MapDrawTool.stories.d.ts +1 -0
  17. package/src/lib/components/MapDrawTool/storyExamplesMapDrawTool.d.ts +3 -2
  18. package/src/lib/components/MapDrawTool/utils.d.ts +18 -4
  19. package/src/lib/components/ReactMapView/ReactMapView.d.ts +1 -0
  20. package/src/lib/components/ReactMapView/types.d.ts +1 -0
  21. package/src/lib/components/index.d.ts +1 -1
  22. package/src/lib/storyshots/Storyshots.spec.d.ts +1 -0
  23. package/src/lib/components/CanvasComponent/CanvasComponent.d.ts +0 -71
  24. package/src/lib/components/CanvasComponent/CanvasComponentDynamic.stories.d.ts +0 -6
  25. package/src/lib/components/CanvasComponent/CanvasComponentStatic.stories.d.ts +0 -6
  26. package/src/lib/components/CanvasComponent/index.d.ts +0 -1
  27. /package/src/lib/components/{CanvasComponent/CanvasComponent.spec.d.ts → MapDimensionSelect/DimensionSelectButton.spec.d.ts} +0 -0
package/index.esm.js CHANGED
@@ -1,376 +1,17 @@
1
1
  import * as React from 'react';
2
- import React__default, { Component, useRef, useState, useEffect } from 'react';
2
+ import React__default, { useRef, useState, useEffect } from 'react';
3
3
  import { legendImageStore, WMImageEventType, webmapUtils, getLegendGraphicURLForLayer, getMapImageStore, getWMJSMapById, debugLogger, DebugType, LayerType, WMLayer, registerWMLayer, WMBBOX, getWMLayerById, WMJSMap, tilesettings } from '@opengeoweb/webmap';
4
- import { Paper, Box, Typography, Grid, TextField, FormControl, InputLabel, Select, MenuItem, FormLabel, Switch } from '@mui/material';
5
- import { CustomTooltip, ToolContainerDraggable, dateUtils, CustomIconButton } from '@opengeoweb/shared';
4
+ import { CustomTooltip, CanvasComponent, ToolContainerDraggable, dateUtils, CustomIconButton } from '@opengeoweb/shared';
5
+ import { Paper, Box, Typography, Grid, TextField, FormControl, InputLabel, Select, MenuItem, Icon as Icon$1, FormLabel, Switch, styled, Slider } from '@mui/material';
6
6
  import _, { cloneDeep } from 'lodash';
7
7
  import proj4 from 'proj4';
8
8
  import * as turf from '@turf/turf';
9
9
  import { polygonToLineString, booleanClockwise, rewind } from '@turf/turf';
10
- import { Delete, Edit, DrawRegion, DrawPolygon, Location, DrawFIRLand, ArrowUp, Home, Add, Minus } from '@opengeoweb/theme';
10
+ import { Delete, Edit, DrawRegion, DrawPolygon, Location, DrawFIRLand, ArrowUp, Home, Add, Minus, Equalizer, DimensionsElevation, Link, LinkOff } from '@opengeoweb/theme';
11
11
  import { produce } from 'immer';
12
12
  import { debounce } from 'throttle-debounce';
13
13
  import { useResizeDetector } from 'react-resize-detector';
14
14
 
15
- /* *
16
- * Licensed under the Apache License, Version 2.0 (the "License");
17
- * you may not use this file except in compliance with the License.
18
- * You may obtain a copy of the License at
19
- *
20
- * http://www.apache.org/licenses/LICENSE-2.0
21
- *
22
- * Unless required by applicable law or agreed to in writing, software
23
- * distributed under the License is distributed on an "AS IS" BASIS,
24
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
- * See the License for the specific language governing permissions and
26
- * limitations under the License.
27
- *
28
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
29
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
30
- * */
31
- class CanvasComponent extends Component {
32
- constructor(props) {
33
- super(props);
34
- this.canvas = null;
35
- this.ctx = null;
36
- this.currentWidth = 1;
37
- this.currentHeight = 1;
38
- this.canvascontaineroutside = null;
39
- this.canvascontainer = null;
40
- this.timer = null;
41
- this.redrawTimer = null;
42
- this.loopHasStarted = false;
43
- this.mounted = false;
44
- this.updateCanvas = this.updateCanvas.bind(this);
45
- this.handleMouseMoveEvent = this.handleMouseMoveEvent.bind(this);
46
- this.handleMouseUpEvent = this.handleMouseUpEvent.bind(this);
47
- this.handleMouseDownEvent = this.handleMouseDownEvent.bind(this);
48
- this.resize = this.resize.bind(this);
49
- this._handleWindowResize = this._handleWindowResize.bind(this);
50
- this.handleClickEvent = this.handleClickEvent.bind(this);
51
- this.handleWheelEvent = this.handleWheelEvent.bind(this);
52
- this.handleTouchStartEvent = this.handleTouchStartEvent.bind(this);
53
- this.handleTouchEndEvent = this.handleTouchEndEvent.bind(this);
54
- this.handleTouchMoveEvent = this.handleTouchMoveEvent.bind(this);
55
- this.onKeyUp = this.onKeyUp.bind(this);
56
- this.onBlur = this.onBlur.bind(this);
57
- this.onFocus = this.onFocus.bind(this);
58
- this.startLoop = this.startLoop.bind(this);
59
- this._documentKeyDown = this._documentKeyDown.bind(this);
60
- this._isFocussed = false;
61
- this.canvas = null;
62
- this.canvascontaineroutside = /*#__PURE__*/React__default.createRef();
63
- this.canvascontainer = /*#__PURE__*/React__default.createRef();
64
- }
65
- componentDidMount() {
66
- this.mounted = true;
67
- if (this.canvas) {
68
- this.canvas.addEventListener('mousemove', this.handleMouseMoveEvent);
69
- this.canvas.addEventListener('mouseup', this.handleMouseUpEvent);
70
- this.canvas.addEventListener('mousedown', this.handleMouseDownEvent);
71
- this.canvas.addEventListener('touchstart', this.handleTouchStartEvent);
72
- this.canvas.addEventListener('touchend', this.handleTouchEndEvent);
73
- this.canvas.addEventListener('touchmove', this.handleTouchMoveEvent);
74
- this.canvas.addEventListener('wheel', this.handleWheelEvent);
75
- this.canvas.addEventListener('click', this.handleClickEvent);
76
- document.addEventListener('keydown', this._documentKeyDown, false);
77
- this.resize();
78
- this.updateCanvas();
79
- }
80
- const {
81
- onKeyUp,
82
- redrawInterval: loopInterval
83
- } = this.props;
84
- if (onKeyUp) {
85
- window.addEventListener('keyup', this.onKeyUp);
86
- }
87
- window.addEventListener('resize', this._handleWindowResize);
88
- if (this.canvascontaineroutside && this.canvascontaineroutside.current && onKeyUp) {
89
- this.canvascontaineroutside.current.focus();
90
- }
91
- this.timer = setInterval(() => {
92
- this.resize();
93
- }, 1000);
94
- if (loopInterval) {
95
- this.redrawTimer = setInterval(() => {
96
- this.updateCanvas();
97
- }, loopInterval);
98
- }
99
- }
100
- shouldComponentUpdate() {
101
- window.requestAnimationFrame(() => {
102
- this.updateCanvas();
103
- });
104
- return false;
105
- }
106
- componentWillUnmount() {
107
- this.mounted = false;
108
- window.removeEventListener('resize', this._handleWindowResize);
109
- const {
110
- onKeyUp
111
- } = this.props;
112
- if (onKeyUp) {
113
- window.removeEventListener('keyup', this.onKeyUp);
114
- }
115
- if (this.canvas) {
116
- this.canvas.removeEventListener('mousedown', this.handleMouseDownEvent);
117
- this.canvas.removeEventListener('mouseup', this.handleMouseUpEvent);
118
- this.canvas.removeEventListener('mousemove', this.handleMouseMoveEvent);
119
- this.canvas.removeEventListener('touchstart', this.handleTouchStartEvent);
120
- this.canvas.removeEventListener('touchend', this.handleTouchEndEvent);
121
- this.canvas.removeEventListener('touchmove', this.handleTouchMoveEvent);
122
- this.canvas.removeEventListener('wheel', this.handleWheelEvent);
123
- this.canvas.removeEventListener('click', this.handleClickEvent);
124
- document.removeEventListener('keydown', this._documentKeyDown);
125
- }
126
- clearInterval(this.timer);
127
- clearInterval(this.redrawTimer);
128
- }
129
- handleMouseMoveEvent(event) {
130
- const {
131
- onMouseMove,
132
- onCanvasClick
133
- } = this.props;
134
- const x = event.offsetX;
135
- const y = event.offsetY;
136
- if (event.buttons === 1) {
137
- onCanvasClick(x, y, this.currentWidth, this.currentHeight);
138
- }
139
- onMouseMove(x, y, event, this.currentWidth);
140
- }
141
- handleMouseUpEvent(event) {
142
- const {
143
- onMouseUp
144
- } = this.props;
145
- const x = event.offsetX;
146
- onMouseUp(x);
147
- }
148
- handleMouseDownEvent(event) {
149
- const {
150
- onMouseDown
151
- } = this.props;
152
- const x = event.offsetX;
153
- const y = event.offsetY;
154
- onMouseDown(x, y, this.currentWidth);
155
- }
156
- handleTouchStartEvent(event) {
157
- const {
158
- onTouchStart
159
- } = this.props;
160
- onTouchStart(event, this.currentWidth);
161
- }
162
- handleTouchEndEvent() {
163
- const {
164
- onTouchEnd
165
- } = this.props;
166
- onTouchEnd();
167
- }
168
- handleTouchMoveEvent(event) {
169
- const {
170
- onTouchMove,
171
- onCanvasClick
172
- } = this.props;
173
- const touches = event && event.touches && event.touches[0];
174
- if (touches && touches.clientX && touches.clientY) {
175
- const x2 = event.touches[0].clientX - event.touches[0].target.offsetLeft;
176
- const y2 = event.touches[0].clientY;
177
- onCanvasClick(x2, y2, this.currentWidth, this.currentHeight);
178
- }
179
- onTouchMove(event, this.currentWidth);
180
- }
181
- handleClickEvent(event) {
182
- const {
183
- onCanvasClick
184
- } = this.props;
185
- const x = event.offsetX;
186
- const y = event.offsetY;
187
- onCanvasClick(x, y, this.currentWidth, this.currentHeight);
188
- }
189
- handleWheelEvent(event) {
190
- const {
191
- onWheel
192
- } = this.props;
193
- onWheel({
194
- event,
195
- deltaY: event.deltaY,
196
- deltaX: event.deltaX,
197
- canvasWidth: event.srcElement.width,
198
- mouseX: event.offsetX
199
- });
200
- }
201
- onFocus() {
202
- const {
203
- isFocussed
204
- } = this.props;
205
- this._isFocussed = true;
206
- if (isFocussed) {
207
- isFocussed(true);
208
- }
209
- }
210
- onBlur() {
211
- const {
212
- isFocussed
213
- } = this.props;
214
- this._isFocussed = false;
215
- if (isFocussed) {
216
- isFocussed(false);
217
- }
218
- }
219
- onKeyUp(event) {
220
- const {
221
- onKeyUp
222
- } = this.props;
223
- if (onKeyUp) {
224
- onKeyUp(event);
225
- }
226
- if (this.canvascontaineroutside && this.canvascontaineroutside.current && onKeyUp) {
227
- if (event.code === 'Escape') {
228
- this.canvascontaineroutside.current.focus();
229
- }
230
- }
231
- }
232
- _documentKeyDown(event) {
233
- if (this._isFocussed) {
234
- const {
235
- onKeyDown
236
- } = this.props;
237
- if (onKeyDown) {
238
- onKeyDown(event);
239
- }
240
- }
241
- }
242
- _handleWindowResize() {
243
- this.resize();
244
- }
245
- startLoop() {
246
- const {
247
- onRenderCanvas
248
- } = this.props;
249
- if (this.mounted === false || this.loopHasStarted === false) {
250
- return;
251
- }
252
- if (this.canvas) {
253
- onRenderCanvas(this.ctx, this.currentWidth, this.currentHeight, this.canvas);
254
- }
255
- requestAnimationFrame(this.startLoop);
256
- }
257
- updateCanvas() {
258
- if (!this.canvas) {
259
- return;
260
- }
261
- const {
262
- onRenderCanvas,
263
- loop
264
- } = this.props;
265
- this.ctx = this.canvas.getContext('2d');
266
- if (!this.ctx) {
267
- return;
268
- }
269
- if (this.ctx.canvas.height !== this.currentHeight) {
270
- this.ctx.canvas.height = this.currentHeight;
271
- }
272
- if (this.ctx.canvas.width !== this.currentWidth) {
273
- this.ctx.canvas.width = this.currentWidth;
274
- }
275
- if (loop !== true) {
276
- this.loopHasStarted = false;
277
- onRenderCanvas(this.ctx, this.currentWidth, this.currentHeight, this.canvas);
278
- } else if (this.loopHasStarted === false) {
279
- this.loopHasStarted = true;
280
- this.startLoop();
281
- }
282
- }
283
- resize() {
284
- const {
285
- canvascontainer,
286
- props: {
287
- resizeCallback
288
- }
289
- } = this;
290
- if (canvascontainer && canvascontainer.current) {
291
- const newWidth = canvascontainer.current.clientWidth;
292
- const newHeight = canvascontainer.current.clientHeight;
293
- if (newWidth !== undefined && newHeight !== undefined && (this.currentWidth !== newWidth || this.currentHeight !== newHeight)) {
294
- this.currentWidth = newWidth;
295
- this.currentHeight = newHeight;
296
- this.updateCanvas();
297
- resizeCallback && resizeCallback(newWidth);
298
- }
299
- }
300
- }
301
- render() {
302
- this.updateCanvas();
303
- this._handleWindowResize();
304
- return /*#__PURE__*/React__default.createElement("div", {
305
- role: "button",
306
- ref: this.canvascontaineroutside,
307
- tabIndex: 0,
308
- onFocus: this.onFocus,
309
- onBlur: this.onBlur,
310
- style: {
311
- height: '100%',
312
- width: '100%',
313
- border: 'none',
314
- display: 'block',
315
- overflow: 'hidden'
316
- }
317
- }, /*#__PURE__*/React__default.createElement("div", {
318
- ref: this.canvascontainer,
319
- style: {
320
- minWidth: 'inherit',
321
- minHeight: 'inherit',
322
- width: 'inherit',
323
- height: 'inherit',
324
- overflow: 'hidden',
325
- display: 'block',
326
- border: 'none'
327
- },
328
- "data-testid": "canvas-container"
329
- }, /*#__PURE__*/React__default.createElement("div", {
330
- style: {
331
- overflow: 'visible',
332
- width: 0,
333
- height: 0
334
- },
335
- role: "presentation",
336
- "aria-label": "canvas"
337
- }, /*#__PURE__*/React__default.createElement("canvas", {
338
- ref: canvas => {
339
- this.canvas = canvas;
340
- }
341
- }))));
342
- }
343
- }
344
- CanvasComponent.defaultProps = {
345
- onRenderCanvas: () => {
346
- /* intentionally left blank */
347
- },
348
- onCanvasClick: () => {
349
- /* intentionally left blank */
350
- },
351
- onMouseMove: () => {
352
- /* intentionally left blank */
353
- },
354
- onMouseUp: () => {
355
- /* intentionally left blank */
356
- },
357
- onMouseDown: () => {
358
- /* intentionally left blank */
359
- },
360
- onTouchStart: () => {
361
- /* intentionally left blank */
362
- },
363
- onTouchEnd: () => {
364
- /* intentionally left blank */
365
- },
366
- onTouchMove: () => {
367
- /* intentionally left blank */
368
- },
369
- onWheel: () => {
370
- /* intentionally left blank */
371
- }
372
- };
373
-
374
15
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
375
16
 
376
17
  var fails$i = function (exec) {
@@ -4827,12 +4468,17 @@ const GeoJSONTextField = ({
4827
4468
  const FeatureLayers = ({
4828
4469
  geojson,
4829
4470
  onChangeLayerIndex,
4830
- activeFeatureLayerIndex
4471
+ activeFeatureLayerIndex,
4472
+ getToolIcon
4831
4473
  }) => {
4832
- const featureLayerList = geojson ? Array.from(Array(geojson.features.length).keys()).map(index => ({
4833
- key: index,
4834
- value: `feature ${index + 1}: ${geojson.features[index].geometry.type}`
4835
- })) : [];
4474
+ const featureLayerList = geojson ? Array.from(Array(geojson.features.length).keys()).map(index => {
4475
+ var _a;
4476
+ return {
4477
+ index,
4478
+ value: (_a = geojson.features[index].properties) === null || _a === void 0 ? void 0 : _a.selectionType,
4479
+ label: `${index + 1}: ${geojson.features[index].geometry.type}`
4480
+ };
4481
+ }) : [];
4836
4482
  return /*#__PURE__*/React__default.createElement(Grid, {
4837
4483
  item: true,
4838
4484
  sm: 12
@@ -4849,13 +4495,22 @@ const FeatureLayers = ({
4849
4495
  value: (featureLayerList.length ? activeFeatureLayerIndex : '').toString(),
4850
4496
  onChange: event => {
4851
4497
  const featureNr = parseInt(event.target.value, 10);
4852
- onChangeLayerIndex(featureNr);
4498
+ onChangeLayerIndex(featureNr, geojson.features[featureNr]);
4499
+ },
4500
+ sx: {
4501
+ '.MuiSelect-select': {
4502
+ display: 'flex'
4503
+ }
4853
4504
  }
4854
4505
  }, featureLayerList.map(listItem => {
4855
4506
  return /*#__PURE__*/React__default.createElement(MenuItem, {
4856
- key: listItem.key,
4857
- value: listItem.key
4858
- }, listItem.value);
4507
+ key: listItem.index,
4508
+ value: listItem.index
4509
+ }, /*#__PURE__*/React__default.createElement(Icon$1, {
4510
+ sx: {
4511
+ transform: 'scale(0.9)'
4512
+ }
4513
+ }, getToolIcon(listItem.value)), listItem.label);
4859
4514
  }))));
4860
4515
  };
4861
4516
 
@@ -5477,7 +5132,7 @@ const getGeoJSONPropertyValue = (property, properties, polygonDrawMode, defaultP
5477
5132
  * @param {number} featureLayerIndex - feature layer index
5478
5133
  * @param {string} text - reason of change
5479
5134
  */
5480
- const moveFeature = (currentGeoJSON, newGeoJSON, featureLayerIndex, reason) => {
5135
+ const moveFeature = (currentGeoJSON, newGeoJSON, featureLayerIndex, reason, selectionType) => {
5481
5136
  const feature = newGeoJSON.features[featureLayerIndex];
5482
5137
  const currentFeature = currentGeoJSON.features[featureLayerIndex];
5483
5138
  if (feature) {
@@ -5486,38 +5141,86 @@ const moveFeature = (currentGeoJSON, newGeoJSON, featureLayerIndex, reason) => {
5486
5141
  } = feature;
5487
5142
  if (geometry.type === 'Polygon' && geometry.coordinates.length > 1 && reason === NEW_FEATURE_CREATED) {
5488
5143
  const lastCoordinate = geometry.coordinates.pop();
5489
- const copyFeature = Object.assign(Object.assign({}, feature), {
5144
+ const copyFeature = Object.assign(Object.assign(Object.assign({}, feature), {
5490
5145
  geometry: Object.assign(Object.assign({}, geometry), {
5491
5146
  coordinates: [lastCoordinate]
5492
5147
  })
5148
+ }), selectionType && {
5149
+ properties: Object.assign(Object.assign({}, feature.properties), {
5150
+ selectionType
5151
+ })
5493
5152
  });
5494
5153
  newGeoJSON.features.push(copyFeature);
5495
5154
  return newGeoJSON.features.length - 1;
5496
5155
  }
5497
5156
  if (geometry.type === 'LineString' && geometry.coordinates.length > 2 && reason === NEW_LINESTRING_CREATED) {
5498
5157
  const lastCoordinate = geometry.coordinates.pop();
5499
- const copyFeature = Object.assign(Object.assign({}, feature), {
5158
+ const copyFeature = Object.assign(Object.assign(Object.assign({}, feature), {
5500
5159
  geometry: Object.assign(Object.assign({}, geometry), {
5501
5160
  coordinates: [lastCoordinate, lastCoordinate]
5502
5161
  })
5162
+ }), selectionType && {
5163
+ properties: Object.assign(Object.assign({}, feature.properties), {
5164
+ selectionType
5165
+ })
5503
5166
  });
5504
5167
  newGeoJSON.features.push(copyFeature);
5505
5168
  return newGeoJSON.features.length - 1;
5506
5169
  }
5507
5170
  if (geometry.type === 'Point' && currentFeature && currentFeature.geometry.type === 'Point' && currentFeature.geometry.coordinates.length > 0 && reason === NEW_POINT_CREATED) {
5508
- newGeoJSON.features.push(currentFeature);
5171
+ const copyFeature = Object.assign(Object.assign({}, currentFeature), selectionType && {
5172
+ properties: Object.assign(Object.assign({}, feature.properties), {
5173
+ selectionType
5174
+ })
5175
+ });
5176
+ newGeoJSON.features.push(copyFeature);
5509
5177
  return newGeoJSON.features.length - 1;
5510
5178
  }
5511
5179
  }
5512
5180
  return undefined;
5513
5181
  };
5514
5182
  /**
5515
- * Returns the intersection of two features. In case of a polygon, only the first feature is used.
5183
+ * Returns the intersection of two point features. In case of a polygon, only the first feature is used.
5516
5184
  * @param a Feature A
5517
5185
  * @param b Feature B
5518
5186
  * @returns The intersection of the two features.
5519
5187
  */
5520
- const intersectGeoJSONS = (a, b, geoJSONProperties = {
5188
+ const intersectPointGeoJSONS = (a, b, geoJSONProperties = {
5189
+ stroke: '#FF0000',
5190
+ 'stroke-width': 10.0,
5191
+ 'stroke-opacity': 1,
5192
+ fill: '#0000FF',
5193
+ 'fill-opacity': 1.0
5194
+ }) => {
5195
+ const featureA = turf.feature(a.features[0].geometry);
5196
+ const featureB = turf.feature(b.features[0].geometry);
5197
+ const options = {
5198
+ tolerance: 0.001,
5199
+ highQuality: true
5200
+ };
5201
+ const simplifiedB = turf.simplify(featureB, options);
5202
+ const isInside = turf.booleanPointInPolygon(a.features[0].geometry, simplifiedB);
5203
+ return addFeatureProperties({
5204
+ type: 'FeatureCollection',
5205
+ features: !isInside ? [{
5206
+ type: 'Feature',
5207
+ properties: {
5208
+ selectionType: 'point'
5209
+ },
5210
+ geometry: {
5211
+ type: 'Point',
5212
+ coordinates: []
5213
+ }
5214
+ }] : [featureA]
5215
+ }, geoJSONProperties);
5216
+ };
5217
+ /**
5218
+ * Returns the intersection of two (multi) polygon features. In case of a polygon, only the first feature is used.
5219
+ * @param a Feature A
5220
+ * @param b Feature B
5221
+ * @returns The intersection of the two features.
5222
+ */
5223
+ const intersectPolygonGeoJSONS = (a, b, geoJSONProperties = {
5521
5224
  stroke: '#FF0000',
5522
5225
  'stroke-width': 10.0,
5523
5226
  'stroke-opacity': 1,
@@ -5547,6 +5250,9 @@ const intersectGeoJSONS = (a, b, geoJSONProperties = {
5547
5250
  }] : [intersection]
5548
5251
  }, geoJSONProperties);
5549
5252
  };
5253
+ const isPointFeatureCollection = geojson => {
5254
+ return geojson.features[0].geometry.type === 'Point';
5255
+ };
5550
5256
  /**
5551
5257
  * Adds the intersectionStart and intersectionEnd properties to the GeoJSONS structure
5552
5258
  * @param geoJSONs
@@ -5561,7 +5267,10 @@ const createInterSections = (geojson, otherGeoJSON, geoJSONproperties = {
5561
5267
  }) => {
5562
5268
  const intersections = produce(geojson, () => {
5563
5269
  try {
5564
- return addFeatureProperties(intersectGeoJSONS(geojson, otherGeoJSON), geoJSONproperties);
5270
+ if (isPointFeatureCollection(geojson)) {
5271
+ return addFeatureProperties(intersectPointGeoJSONS(geojson, otherGeoJSON), geoJSONproperties);
5272
+ }
5273
+ return addFeatureProperties(intersectPolygonGeoJSONS(geojson, otherGeoJSON), geoJSONproperties);
5565
5274
  } catch (error) {
5566
5275
  return addFeatureProperties(geojson, geoJSONproperties);
5567
5276
  }
@@ -5789,7 +5498,7 @@ const useMapDrawTool = ({
5789
5498
  setActiveTool(newMode.isSelectable ? newMode.drawModeId : '');
5790
5499
  // updates shape
5791
5500
  const isNewSelectedTool = !isGeoJSONFeatureCreatedByTool(geoJSON, newMode.selectionType, featureLayerIndex);
5792
- const shouldUpdateShape = !geoJSON.features.length || isNewSelectedTool;
5501
+ const shouldUpdateShape = !geoJSON.features.length || isNewSelectedTool || !newMode.isSelectable;
5793
5502
  if (shouldUpdateShape) {
5794
5503
  const updatedGeoJSON = changeGeoJSON(addSelectionTypeToGeoJSON(newMode.shape, newMode.selectionType));
5795
5504
  setFeatureLayerIndex(updatedGeoJSON.features.length - 1);
@@ -5802,7 +5511,9 @@ const useMapDrawTool = ({
5802
5511
  const geoJSONFeatureCollection = getFeatureCollection(updatedGeoJSON, _shouldAllowMultipleShapes, geoJSON);
5803
5512
  const newGeoJSON = getGeoJson(geoJSONFeatureCollection, _shouldAllowMultipleShapes);
5804
5513
  if (_shouldAllowMultipleShapes) {
5805
- const newFeatureIndex = moveFeature(geoJSON, newGeoJSON, featureLayerIndex, reason);
5514
+ const activeDrawTool = drawModes.find(mode => mode.drawModeId === activeTool);
5515
+ const selectionType = activeDrawTool === null || activeDrawTool === void 0 ? void 0 : activeDrawTool.selectionType;
5516
+ const newFeatureIndex = moveFeature(geoJSON, newGeoJSON, featureLayerIndex, reason, selectionType);
5806
5517
  if (newFeatureIndex !== undefined) {
5807
5518
  setFeatureLayerIndex(newFeatureIndex);
5808
5519
  }
@@ -5894,9 +5605,9 @@ const useMapDrawTool = ({
5894
5605
  };
5895
5606
  };
5896
5607
 
5897
- const opacityOptions = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0];
5608
+ const opacityOptions = ['100', '90', '80', '70', '60', '50', '40', '30', '20', '10', '0'];
5898
5609
  const fillOptions = [defaultGeoJSONStyleProperties.fill, '#6e1e91', '#FF00FF', '#33ccFF', '#8F8'];
5899
- const strokeWidthOptions = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
5610
+ const strokeWidthOptions = ['10', '9', '8', '7', '6', '5', '4', '3', '2', '1'];
5900
5611
  const getToolIcon = selectionType => {
5901
5612
  const defaultIcon = getIcon(selectionType);
5902
5613
  if (defaultIcon) {
@@ -5908,7 +5619,7 @@ const getToolIcon = selectionType => {
5908
5619
  if (selectionType === customLineButton.selectionType) {
5909
5620
  return /*#__PURE__*/React__default.createElement(ArrowUp, null);
5910
5621
  }
5911
- return /*#__PURE__*/React__default.createElement(DrawFIRLand, null);
5622
+ return /*#__PURE__*/React__default.createElement("div", null);
5912
5623
  };
5913
5624
  // custom buttons
5914
5625
  const shapeButtonNL$2 = {
@@ -5929,7 +5640,9 @@ const customLineButton = {
5929
5640
  type: 'LineString',
5930
5641
  coordinates: [[4.136829504703722, 50.944730810381465], [4.450134704406403, 53.81224530783831], [2.5703035061903217, 53.78911570560625], [5.252979278644519, 56.722490281934554], [8.758081200318252, 53.85846624679025], [6.290802752659646, 53.84691579421783], [6.623689527343743, 51.0556380592049], [4.136829504703722, 50.95706693142843]]
5931
5642
  },
5932
- properties: defaultGeoJSONStyleProperties
5643
+ properties: Object.assign(Object.assign({}, defaultGeoJSONStyleProperties), {
5644
+ selectionType: 'custom-line'
5645
+ })
5933
5646
  },
5934
5647
  isSelectable: false,
5935
5648
  selectionType: 'custom-line'
@@ -5965,6 +5678,148 @@ const basicExampleMultipleShapeDrawOptions = {
5965
5678
  })
5966
5679
  }))
5967
5680
  };
5681
+ const basicExampleMultipleShapeWithValuesDrawOptions = Object.assign(Object.assign({}, basicExampleMultipleShapeDrawOptions), {
5682
+ defaultGeoJSON: {
5683
+ type: 'FeatureCollection',
5684
+ features: [{
5685
+ type: 'Feature',
5686
+ properties: {
5687
+ fill: '#33ccFF',
5688
+ 'fill-opacity': 0.7,
5689
+ stroke: '#8F8',
5690
+ 'stroke-width': 4,
5691
+ 'stroke-opacity': 1,
5692
+ selectionType: 'box'
5693
+ },
5694
+ geometry: {
5695
+ type: 'Polygon',
5696
+ coordinates: [[[-2.1980359430346246, 57.20029287883823], [-2.1980359430346246, 55.903312387397165], [0.20402079718587424, 55.903312387397165], [0.20402079718587424, 57.20029287883823], [-2.1980359430346246, 57.20029287883823]]]
5697
+ }
5698
+ }, {
5699
+ type: 'Feature',
5700
+ properties: {
5701
+ fill: '#33ccFF',
5702
+ 'fill-opacity': 0.7,
5703
+ stroke: '#8F8',
5704
+ 'stroke-width': 4,
5705
+ 'stroke-opacity': 1,
5706
+ selectionType: 'poly'
5707
+ },
5708
+ geometry: {
5709
+ type: 'Polygon',
5710
+ coordinates: [[[0.9181457740081845, 55.88511120390367], [2.378855953872001, 57.226659207134794], [3.612344550201447, 55.903312387397165], [0.9181457740081845, 55.88511120390367], [3.612344550201447, 55.903312387397165], [0.9181457740081845, 55.88511120390367]]]
5711
+ }
5712
+ }, {
5713
+ type: 'Feature',
5714
+ properties: {
5715
+ fill: '#33ccFF',
5716
+ 'fill-opacity': 0.7,
5717
+ stroke: '#8F8',
5718
+ 'stroke-width': 4,
5719
+ 'stroke-opacity': 1,
5720
+ selectionType: 'point'
5721
+ },
5722
+ geometry: {
5723
+ type: 'Point',
5724
+ coordinates: [5.446347331586017, 56.5975874650108]
5725
+ }
5726
+ }, {
5727
+ type: 'Feature',
5728
+ properties: {
5729
+ fill: '#33ccFF',
5730
+ 'fill-opacity': 0.7,
5731
+ stroke: '#8F8',
5732
+ 'stroke-width': 4,
5733
+ 'stroke-opacity': 1,
5734
+ selectionType: 'linestring'
5735
+ },
5736
+ geometry: {
5737
+ type: 'LineString',
5738
+ coordinates: [[6.955747850778628, 57.15630712609812], [9.666176740081486, 55.98511209901979], [6.7772166065730515, 55.96694931494649], [9.633716513862291, 57.253006702542514], [9.633716513862291, 57.253006702542514]]
5739
+ }
5740
+ }, {
5741
+ type: 'Feature',
5742
+ geometry: {
5743
+ type: 'Polygon',
5744
+ coordinates: [[[-0.20986630818094482, 54.77174384201191], [-0.8779523081809448, 55.10438784201191], [-1.8410493081809447, 55.53605784201191], [-2.4479583081809433, 54.15100484201191], [-2.0541063081809448, 52.685297842011906], [-3.209864308180943, 51.27174584201191], [-1.8398653081809448, 51.14146584201191], [-1.8393393081809446, 51.14041384201191], [-1.8476433081809445, 51.09174584201191], [-1.8459763081809446, 51.08535184201191], [-1.8362533081809445, 51.081742842011906], [-1.2573653081809448, 50.98618484201191], [-0.812365308180945, 51.22451984201191], [-0.13125530818094439, 51.16340884201191], [0.6384666918190558, 50.911187842011906], [0.44180069181905546, 50.59646084201191], [0.8019306918190554, 50.529016842011906], [0.7243016918190552, 50.80812984201191], [1.0123566918190556, 51.13340984201191], [0.7365236918190547, 51.58340684201191], [1.1951346918190564, 51.602571842011905], [1.843228691819056, 52.00950784201191], [1.821522691819056, 52.040628842011905], [1.853745691819056, 52.11785284201191], [1.8556906918190572, 52.157571842011905], [1.9231886918190562, 52.660630842011905], [1.932313691819057, 52.669987842011906], [1.9818006918190565, 53.071743842011905], [1.290133691819056, 53.438410842011905], [1.2901356918190563, 54.77174584201191], [-0.20986630818094482, 54.77174384201191]]]
5745
+ },
5746
+ properties: {
5747
+ fill: '#33ccFF',
5748
+ 'fill-opacity': 0.5,
5749
+ stroke: '#8F8',
5750
+ 'stroke-width': 4,
5751
+ 'stroke-opacity': 1,
5752
+ selectionType: 'custom-fir'
5753
+ }
5754
+ }, {
5755
+ type: 'Feature',
5756
+ geometry: {
5757
+ type: 'LineString',
5758
+ coordinates: [[4.136829504703722, 50.944730810381465], [4.450134704406403, 53.81224530783831], [2.5703035061903217, 53.78911570560625], [5.252979278644519, 56.722490281934554], [8.758081200318252, 53.85846624679025], [6.290802752659646, 53.84691579421783], [6.623689527343743, 51.0556380592049], [4.136829504703722, 50.95706693142843]]
5759
+ },
5760
+ properties: {
5761
+ fill: '#33ccFF',
5762
+ 'fill-opacity': 0.5,
5763
+ stroke: '#8F8',
5764
+ 'stroke-width': 4,
5765
+ 'stroke-opacity': 1,
5766
+ selectionType: 'custom-line'
5767
+ }
5768
+ }, {
5769
+ type: 'Feature',
5770
+ properties: {
5771
+ fill: '#6e1e91',
5772
+ 'fill-opacity': 0.5,
5773
+ stroke: '#8F8',
5774
+ 'stroke-width': 4,
5775
+ 'stroke-opacity': 1
5776
+ },
5777
+ geometry: {
5778
+ type: 'Point',
5779
+ coordinates: [3.9694070386126015, 53.40680002840567]
5780
+ }
5781
+ }, {
5782
+ type: 'Feature',
5783
+ properties: {
5784
+ fill: '#6e1e91',
5785
+ 'fill-opacity': 0.5,
5786
+ stroke: '#8F8',
5787
+ 'stroke-width': 4,
5788
+ 'stroke-opacity': 1
5789
+ },
5790
+ geometry: {
5791
+ type: 'Polygon',
5792
+ coordinates: [[[3.790875794407024, 52.29939515934869], [5.5761882364628, 53.811222537395366], [6.095551855969935, 52.16022302393104], [3.790875794407024, 52.29939515934869]]]
5793
+ }
5794
+ }, {
5795
+ type: 'Feature',
5796
+ properties: {
5797
+ fill: '#6e1e91',
5798
+ 'fill-opacity': 0.5,
5799
+ stroke: '#8F8',
5800
+ 'stroke-width': 4,
5801
+ 'stroke-opacity': 1
5802
+ },
5803
+ geometry: {
5804
+ type: 'Polygon',
5805
+ coordinates: [[[6.890827398340236, 53.73448815953251], [6.890827398340236, 52.18013147265132], [9.682406853191086, 52.18013147265132], [9.682406853191086, 53.73448815953251], [6.890827398340236, 53.73448815953251]]]
5806
+ }
5807
+ }, {
5808
+ type: 'Feature',
5809
+ properties: {
5810
+ fill: '#6e1e91',
5811
+ 'fill-opacity': 0.5,
5812
+ stroke: '#8F8',
5813
+ 'stroke-width': 4,
5814
+ 'stroke-opacity': 1
5815
+ },
5816
+ geometry: {
5817
+ type: 'LineString',
5818
+ coordinates: [[10.396531830013394, 53.71528264245669], [10.510142621780581, 52.03060087360206], [11.402798842808469, 52.408438794651005], [11.922162462315605, 53.290538521680475], [11.922162462315605, 53.30023909261376], [12.084463593411584, 54.10724495817889]]
5819
+ }
5820
+ }]
5821
+ }
5822
+ });
5968
5823
 
5969
5824
  const getIntersectionToolIcon = selectionType => {
5970
5825
  const defaultIcon = getIcon(selectionType);
@@ -7932,7 +7787,8 @@ class ReactMapView extends React.Component {
7932
7787
  }
7933
7788
  componentWillUnmount() {
7934
7789
  const {
7935
- mapId
7790
+ mapId,
7791
+ onWMJSUnMount
7936
7792
  } = this.props;
7937
7793
  window.removeEventListener('resize', this.handleWindowResize);
7938
7794
  this.clearRefetchTimer();
@@ -7944,6 +7800,7 @@ class ReactMapView extends React.Component {
7944
7800
  this.adaguc.baseLayers = [];
7945
7801
  this.adaguc.oldbbox = new WMBBOX();
7946
7802
  this.adaguc.currentChildren = [];
7803
+ onWMJSUnMount && onWMJSUnMount(mapId);
7947
7804
  }
7948
7805
  handleWindowResize() {
7949
7806
  this.resize();
@@ -8384,6 +8241,7 @@ ReactMapView.defaultProps = {
8384
8241
  displayMapPin: false,
8385
8242
  disableMapPin: false,
8386
8243
  onWMJSMount: () => {},
8244
+ onWMJSUnMount: () => {},
8387
8245
  onMapChangeDimension: () => {
8388
8246
  /* nothing */
8389
8247
  },
@@ -8916,6 +8774,289 @@ const MapWarningProperties = ({
8916
8774
  }, "Identifier: ", selectedFeatureProperties.identifier))));
8917
8775
  };
8918
8776
 
8777
+ const dimensionConfig = [{
8778
+ name: 'elevation',
8779
+ label: 'Vertical level',
8780
+ defaultUnit: 'hPa',
8781
+ reversed: true,
8782
+ iconType: 'IconLevels'
8783
+ }, {
8784
+ name: 'ensemble_member',
8785
+ label: 'Ensemble member',
8786
+ defaultUnit: 'member',
8787
+ reversed: false,
8788
+ iconType: 'IconEnsemble'
8789
+ }, {
8790
+ name: 'probability',
8791
+ label: 'Probability',
8792
+ defaultUnit: '%',
8793
+ reversed: false,
8794
+ iconType: 'IconLevels'
8795
+ }, {
8796
+ name: 'level',
8797
+ label: 'Level',
8798
+ defaultUnit: 'level',
8799
+ reversed: false,
8800
+ iconType: 'IconLevels'
8801
+ }];
8802
+ const getDimensionIcon = iconType => {
8803
+ if (iconType === 'IconEnsemble') {
8804
+ return Equalizer;
8805
+ }
8806
+ return DimensionsElevation;
8807
+ };
8808
+ const marksByDimension = dim => {
8809
+ if (!dim || !dim.name) {
8810
+ return [];
8811
+ }
8812
+ const dimCnf = dimensionConfig.find(cnf => cnf.name === dim.name);
8813
+ const defaultUnit = dimCnf ? dimCnf.defaultUnit : '';
8814
+ const marks = [];
8815
+ if (dim && dim.size) {
8816
+ for (let i = 0; i < dim.size(); i += 1) {
8817
+ marks.push({
8818
+ value: Number(dim.getValueForIndex(i)) || dim.getValueForIndex(i),
8819
+ label: `${Number(dim.getValueForIndex(i)) || dim.getValueForIndex(i)} ${dim.unitSymbol ? dim.unitSymbol : defaultUnit}`
8820
+ });
8821
+ }
8822
+ }
8823
+ return marks;
8824
+ };
8825
+
8826
+ /* *
8827
+ * Licensed under the Apache License, Version 2.0 (the "License");
8828
+ * you may not use this file except in compliance with the License.
8829
+ * You may obtain a copy of the License at
8830
+ *
8831
+ * http://www.apache.org/licenses/LICENSE-2.0
8832
+ *
8833
+ * Unless required by applicable law or agreed to in writing, software
8834
+ * distributed under the License is distributed on an "AS IS" BASIS,
8835
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8836
+ * See the License for the specific language governing permissions and
8837
+ * limitations under the License.
8838
+ *
8839
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8840
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
8841
+ * */
8842
+ const DimensionSelectButton = ({
8843
+ dimension,
8844
+ onClickDimensionButton,
8845
+ isActive: _isActive = false
8846
+ }) => {
8847
+ const dimConfig = dimensionConfig.find(cnf => cnf.name === dimension);
8848
+ const Icon = getDimensionIcon(dimConfig && dimConfig.iconType || 'IconLevels');
8849
+ const title = `Show ${dimConfig ? dimConfig.label.toLowerCase() : dimension.toLowerCase()}`;
8850
+ return /*#__PURE__*/React.createElement(MapControlButton, {
8851
+ title: title,
8852
+ "data-testid": `dimensionMapBtn-${dimension}`,
8853
+ onClick: onClickDimensionButton,
8854
+ isActive: _isActive
8855
+ }, /*#__PURE__*/React.createElement(Icon, null));
8856
+ };
8857
+
8858
+ /* *
8859
+ * Licensed under the Apache License, Version 2.0 (the "License");
8860
+ * you may not use this file except in compliance with the License.
8861
+ * You may obtain a copy of the License at
8862
+ *
8863
+ * http://www.apache.org/licenses/LICENSE-2.0
8864
+ *
8865
+ * Unless required by applicable law or agreed to in writing, software
8866
+ * distributed under the License is distributed on an "AS IS" BASIS,
8867
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8868
+ * See the License for the specific language governing permissions and
8869
+ * limitations under the License.
8870
+ *
8871
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8872
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
8873
+ * */
8874
+ const DimensionSelectDialog = ({
8875
+ isOpen,
8876
+ order: _order = 0,
8877
+ onMouseDown,
8878
+ onClose,
8879
+ source: _source = 'app',
8880
+ dimensionName,
8881
+ index: _index = 0,
8882
+ children
8883
+ }) => {
8884
+ const dimConfig = dimensionConfig.find(cnf => cnf.name === dimensionName);
8885
+ const title = dimConfig ? dimConfig.label : dimensionName;
8886
+ const topPos = _index * 32 + 164; // index * btn height + offset top of window
8887
+ return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
8888
+ startPosition: {
8889
+ left: 50,
8890
+ top: topPos
8891
+ },
8892
+ minWidth: 180,
8893
+ title: title,
8894
+ isOpen: isOpen,
8895
+ "data-testid": `multidimensionContent-${title}`,
8896
+ onClose: onClose,
8897
+ bounds: "parent",
8898
+ onMouseDown: onMouseDown,
8899
+ order: _order,
8900
+ source: _source
8901
+ }, /*#__PURE__*/React.createElement("div", {
8902
+ style: {
8903
+ padding: 4
8904
+ }
8905
+ }, /*#__PURE__*/React.createElement(Grid, {
8906
+ container: true,
8907
+ direction: "row"
8908
+ }, children)));
8909
+ };
8910
+
8911
+ const SmallFontSlider = styled(Slider)(() => ({
8912
+ '& .MuiSlider-markLabel': {
8913
+ fontSize: '80%'
8914
+ }
8915
+ }));
8916
+ const DimensionSelectSlider = ({
8917
+ marks,
8918
+ layerTitle,
8919
+ reverse: _reverse = false,
8920
+ isDisabled: _isDisabled = false,
8921
+ managedValue: _managedValue = null,
8922
+ validSelection: _validSelection = true,
8923
+ alertColor: _alertColor = 'red',
8924
+ onChangeDimensionValue
8925
+ }) => {
8926
+ const [currentIndex, setCurrentIndex] = useState(0);
8927
+ if (!marks || !marks.length) {
8928
+ return null;
8929
+ }
8930
+ const sortedMarks = [...marks].sort((a, b) => Number(typeof a.value === 'number' && typeof b.value === 'number' && a.value - b.value));
8931
+ const adaptedMarks = _reverse ? sortedMarks.reverse() : sortedMarks;
8932
+ const values = adaptedMarks.map(m => m.value);
8933
+ // using index as values in slider to get constant spacing between marks
8934
+ const indexLabelMarks = adaptedMarks.map((m, index) => {
8935
+ return {
8936
+ value: index,
8937
+ label: m.label
8938
+ };
8939
+ });
8940
+ const sliderValue = _managedValue !== null ? values.findIndex(v => v === _managedValue) : currentIndex;
8941
+ const upDownNavigation = event => {
8942
+ if (event.key === 'ArrowLeft' || event.key === 'ArrowRight' || event.metaKey || event.ctrlKey) {
8943
+ event.preventDefault();
8944
+ }
8945
+ };
8946
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Box, {
8947
+ "data-testid": "slider-dimensionSelect",
8948
+ sx: {
8949
+ height: '320px',
8950
+ margin: '10px',
8951
+ marginLeft: '-5px',
8952
+ minWidth: 120,
8953
+ fontSize: '90%'
8954
+ }
8955
+ }, /*#__PURE__*/React.createElement(Box, {
8956
+ component: "span",
8957
+ m: 1
8958
+ }, /*#__PURE__*/React.createElement(SmallFontSlider, {
8959
+ "data-testid": "verticalSlider",
8960
+ orientation: "vertical",
8961
+ "aria-labelledby": "vertical-slider",
8962
+ step: null,
8963
+ min: 0,
8964
+ max: indexLabelMarks.length - 1,
8965
+ marks: indexLabelMarks,
8966
+ style: !_validSelection ? {
8967
+ color: _alertColor
8968
+ } : {},
8969
+ disabled: _isDisabled,
8970
+ value: sliderValue,
8971
+ onKeyDown: upDownNavigation,
8972
+ onChange: (e, val) => {
8973
+ onChangeDimensionValue(values[val].toString());
8974
+ if (!_managedValue) {
8975
+ setCurrentIndex(val);
8976
+ }
8977
+ }
8978
+ }))), /*#__PURE__*/React.createElement(CustomTooltip, {
8979
+ title: layerTitle
8980
+ }, /*#__PURE__*/React.createElement(Typography, {
8981
+ variant: "body2",
8982
+ sx: {
8983
+ paddingLeft: '10px',
8984
+ maxWidth: 130,
8985
+ overflow: 'hidden',
8986
+ textOverflow: 'ellipsis'
8987
+ }
8988
+ }, layerTitle)));
8989
+ };
8990
+
8991
+ /* *
8992
+ * Licensed under the Apache License, Version 2.0 (the "License");
8993
+ * you may not use this file except in compliance with the License.
8994
+ * You may obtain a copy of the License at
8995
+ *
8996
+ * http://www.apache.org/licenses/LICENSE-2.0
8997
+ *
8998
+ * Unless required by applicable law or agreed to in writing, software
8999
+ * distributed under the License is distributed on an "AS IS" BASIS,
9000
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9001
+ * See the License for the specific language governing permissions and
9002
+ * limitations under the License.
9003
+ *
9004
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
9005
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
9006
+ * */
9007
+ const Icon = ({
9008
+ isLayerDimensionSynced
9009
+ }) => isLayerDimensionSynced ? ( /*#__PURE__*/React.createElement(Link, {
9010
+ "data-testid": "syncIcon"
9011
+ })) : ( /*#__PURE__*/React.createElement(LinkOff, {
9012
+ "data-testid": "syncDisIcon"
9013
+ }));
9014
+ const MapDimensionSelect = ({
9015
+ layerId,
9016
+ dimensionName,
9017
+ handleDimensionValueChanged,
9018
+ handleSyncChanged,
9019
+ layerDimension
9020
+ }) => {
9021
+ const wmLayer = webmapUtils.getWMLayerById(layerId);
9022
+ const dimConfig = dimensionConfig.find(cnf => cnf.name === dimensionName);
9023
+ if (!layerDimension || !wmLayer) {
9024
+ return null;
9025
+ }
9026
+ const wmsDimension = wmLayer.getDimension(dimensionName);
9027
+ if (!wmsDimension) {
9028
+ return null;
9029
+ }
9030
+ const layerTitle = wmLayer.title;
9031
+ const marks = marksByDimension(wmsDimension);
9032
+ const isLayerDimensionSynced = layerDimension.synced !== undefined && layerDimension.synced === true;
9033
+ const tooltipTitle = isLayerDimensionSynced ? 'Click to disconnect layer' : 'Click to connect layer';
9034
+ return /*#__PURE__*/React.createElement(Grid, {
9035
+ key: layerId,
9036
+ item: true,
9037
+ xs: "auto"
9038
+ }, /*#__PURE__*/React.createElement(CustomIconButton, {
9039
+ tooltipTitle: tooltipTitle,
9040
+ onClick: () => handleSyncChanged(layerId, dimensionName, layerDimension.currentValue, !layerDimension.synced),
9041
+ sx: {
9042
+ margin: '5px'
9043
+ },
9044
+ "data-testid": "syncButton"
9045
+ }, /*#__PURE__*/React.createElement(Icon, {
9046
+ isLayerDimensionSynced: isLayerDimensionSynced
9047
+ })), /*#__PURE__*/React.createElement(DimensionSelectSlider, {
9048
+ marks: marks,
9049
+ layerTitle: layerTitle,
9050
+ reverse: dimConfig ? dimConfig.reversed : false,
9051
+ managedValue: Number(layerDimension.currentValue) || layerDimension.currentValue,
9052
+ onChangeDimensionValue: value => {
9053
+ handleDimensionValueChanged(layerId, dimensionName, value);
9054
+ },
9055
+ isDisabled: false,
9056
+ validSelection: layerDimension.synced === false || !(layerDimension.validSyncSelection !== undefined && layerDimension.validSyncSelection === false)
9057
+ }));
9058
+ };
9059
+
8919
9060
  /* *
8920
9061
  * Licensed under the Apache License, Version 2.0 (the "License");
8921
9062
  * you may not use this file except in compliance with the License.
@@ -8954,9 +9095,9 @@ const overLayer = {
8954
9095
  };
8955
9096
 
8956
9097
  var defaultLayers = /*#__PURE__*/Object.freeze({
8957
- __proto__: null,
8958
- baseLayerGrey: baseLayerGrey,
8959
- overLayer: overLayer
9098
+ __proto__: null,
9099
+ baseLayerGrey: baseLayerGrey,
9100
+ overLayer: overLayer
8960
9101
  });
8961
9102
 
8962
9103
  /* *
@@ -9072,26 +9213,26 @@ const MeteoCanada = {
9072
9213
  };
9073
9214
 
9074
9215
  var publicServices = /*#__PURE__*/Object.freeze({
9075
- __proto__: null,
9076
- DWD: DWD,
9077
- nationaalgeoregister: nationaalgeoregister,
9078
- KNMImsgcpp: KNMImsgcpp,
9079
- HeiGit: HeiGit,
9080
- ArcGisCanvas: ArcGisCanvas,
9081
- KNMIgeoservicesRadar: KNMIgeoservicesRadar,
9082
- KNMIgeoservicesObs: KNMIgeoservicesObs,
9083
- KNMIgeoservicesKlimaatAtlas: KNMIgeoservicesKlimaatAtlas,
9084
- KNMIgeoservicesHarmonie: KNMIgeoservicesHarmonie,
9085
- KNMIgeoservicesHarmonieMLService: KNMIgeoservicesHarmonieMLService,
9086
- MetNorwayService: MetNorwayService,
9087
- FMIopenwms: FMIopenwms,
9088
- DWDObservations: DWDObservations,
9089
- DWDWarnings: DWDWarnings,
9090
- DWDWXProdukt: DWDWXProdukt,
9091
- EUMETSAT: EUMETSAT,
9092
- eumetviewEUMETSAT: eumetviewEUMETSAT,
9093
- ECMWFPublicService: ECMWFPublicService,
9094
- MeteoCanada: MeteoCanada
9216
+ __proto__: null,
9217
+ DWD: DWD,
9218
+ nationaalgeoregister: nationaalgeoregister,
9219
+ KNMImsgcpp: KNMImsgcpp,
9220
+ HeiGit: HeiGit,
9221
+ ArcGisCanvas: ArcGisCanvas,
9222
+ KNMIgeoservicesRadar: KNMIgeoservicesRadar,
9223
+ KNMIgeoservicesObs: KNMIgeoservicesObs,
9224
+ KNMIgeoservicesKlimaatAtlas: KNMIgeoservicesKlimaatAtlas,
9225
+ KNMIgeoservicesHarmonie: KNMIgeoservicesHarmonie,
9226
+ KNMIgeoservicesHarmonieMLService: KNMIgeoservicesHarmonieMLService,
9227
+ MetNorwayService: MetNorwayService,
9228
+ FMIopenwms: FMIopenwms,
9229
+ DWDObservations: DWDObservations,
9230
+ DWDWarnings: DWDWarnings,
9231
+ DWDWXProdukt: DWDWXProdukt,
9232
+ EUMETSAT: EUMETSAT,
9233
+ eumetviewEUMETSAT: eumetviewEUMETSAT,
9234
+ ECMWFPublicService: ECMWFPublicService,
9235
+ MeteoCanada: MeteoCanada
9095
9236
  });
9096
9237
 
9097
9238
  /* *
@@ -9431,49 +9572,49 @@ const msgNaturalEUMETSAT = {
9431
9572
  };
9432
9573
 
9433
9574
  var publicLayers = /*#__PURE__*/Object.freeze({
9434
- __proto__: null,
9435
- defaultLayers: defaultLayers,
9436
- baseLayer: baseLayer,
9437
- baseLayerOpenStreetMapNL: baseLayerOpenStreetMapNL,
9438
- baseLayerArcGisCanvas: baseLayerArcGisCanvas,
9439
- baseLayerWorldMap: baseLayerWorldMap,
9440
- baseLayerHeiGit: baseLayerHeiGit,
9441
- msgCppLayer: msgCppLayer,
9442
- veiligheidsRegiosGebiedsIndelingenLabels: veiligheidsRegiosGebiedsIndelingenLabels,
9443
- veiligheidsRegiosGebiedsIndelingen: veiligheidsRegiosGebiedsIndelingen,
9444
- radarLayer: radarLayer,
9445
- radarLayerWithError: radarLayerWithError,
9446
- obsAirTemperature: obsAirTemperature,
9447
- obsWind: obsWind,
9448
- obsAirPressureAtSeaLevel: obsAirPressureAtSeaLevel,
9449
- obsRelativeHumidity: obsRelativeHumidity,
9450
- obsGlobalSolarRadiation: obsGlobalSolarRadiation,
9451
- obsPrecipitationIntensityPWS: obsPrecipitationIntensityPWS,
9452
- harmonieRelativeHumidityPl: harmonieRelativeHumidityPl,
9453
- harmonieWindPl: harmonieWindPl,
9454
- harmonieAirTemperature: harmonieAirTemperature,
9455
- harmoniePrecipitation: harmoniePrecipitation,
9456
- harmoniePressure: harmoniePressure,
9457
- harmonieWindFlags: harmonieWindFlags,
9458
- klimaatAtlasTG3: klimaatAtlasTG3,
9459
- dwdWarningLayer: dwdWarningLayer,
9460
- dwdRadarLayer: dwdRadarLayer,
9461
- dwdObservationsWetterLayer: dwdObservationsWetterLayer,
9462
- dwdObservationsWetterLayerWithHeader: dwdObservationsWetterLayerWithHeader,
9463
- dwdObservationsWindLayer: dwdObservationsWindLayer,
9464
- FMITemp: FMITemp,
9465
- MetNoTemp: MetNoTemp,
9466
- metNorwayWind1: metNorwayWind1,
9467
- metNorwayWind2: metNorwayWind2,
9468
- metNorwayWind3: metNorwayWind3,
9469
- metNorwayLatestT: metNorwayLatestT,
9470
- metNorwaySalinaty: metNorwaySalinaty,
9471
- msgFesEUMETSAT: msgFesEUMETSAT,
9472
- msgNaturalenhncdEUMETSAT: msgNaturalenhncdEUMETSAT,
9473
- msgAshEUMETSAT: msgAshEUMETSAT,
9474
- msgCthEUMETSAT: msgCthEUMETSAT,
9475
- msgFogEUMETSAT: msgFogEUMETSAT,
9476
- msgNaturalEUMETSAT: msgNaturalEUMETSAT
9575
+ __proto__: null,
9576
+ defaultLayers: defaultLayers,
9577
+ baseLayer: baseLayer,
9578
+ baseLayerOpenStreetMapNL: baseLayerOpenStreetMapNL,
9579
+ baseLayerArcGisCanvas: baseLayerArcGisCanvas,
9580
+ baseLayerWorldMap: baseLayerWorldMap,
9581
+ baseLayerHeiGit: baseLayerHeiGit,
9582
+ msgCppLayer: msgCppLayer,
9583
+ veiligheidsRegiosGebiedsIndelingenLabels: veiligheidsRegiosGebiedsIndelingenLabels,
9584
+ veiligheidsRegiosGebiedsIndelingen: veiligheidsRegiosGebiedsIndelingen,
9585
+ radarLayer: radarLayer,
9586
+ radarLayerWithError: radarLayerWithError,
9587
+ obsAirTemperature: obsAirTemperature,
9588
+ obsWind: obsWind,
9589
+ obsAirPressureAtSeaLevel: obsAirPressureAtSeaLevel,
9590
+ obsRelativeHumidity: obsRelativeHumidity,
9591
+ obsGlobalSolarRadiation: obsGlobalSolarRadiation,
9592
+ obsPrecipitationIntensityPWS: obsPrecipitationIntensityPWS,
9593
+ harmonieRelativeHumidityPl: harmonieRelativeHumidityPl,
9594
+ harmonieWindPl: harmonieWindPl,
9595
+ harmonieAirTemperature: harmonieAirTemperature,
9596
+ harmoniePrecipitation: harmoniePrecipitation,
9597
+ harmoniePressure: harmoniePressure,
9598
+ harmonieWindFlags: harmonieWindFlags,
9599
+ klimaatAtlasTG3: klimaatAtlasTG3,
9600
+ dwdWarningLayer: dwdWarningLayer,
9601
+ dwdRadarLayer: dwdRadarLayer,
9602
+ dwdObservationsWetterLayer: dwdObservationsWetterLayer,
9603
+ dwdObservationsWetterLayerWithHeader: dwdObservationsWetterLayerWithHeader,
9604
+ dwdObservationsWindLayer: dwdObservationsWindLayer,
9605
+ FMITemp: FMITemp,
9606
+ MetNoTemp: MetNoTemp,
9607
+ metNorwayWind1: metNorwayWind1,
9608
+ metNorwayWind2: metNorwayWind2,
9609
+ metNorwayWind3: metNorwayWind3,
9610
+ metNorwayLatestT: metNorwayLatestT,
9611
+ metNorwaySalinaty: metNorwaySalinaty,
9612
+ msgFesEUMETSAT: msgFesEUMETSAT,
9613
+ msgNaturalenhncdEUMETSAT: msgNaturalenhncdEUMETSAT,
9614
+ msgAshEUMETSAT: msgAshEUMETSAT,
9615
+ msgCthEUMETSAT: msgCthEUMETSAT,
9616
+ msgFogEUMETSAT: msgFogEUMETSAT,
9617
+ msgNaturalEUMETSAT: msgNaturalEUMETSAT
9477
9618
  });
9478
9619
 
9479
- export { CanvasComponent, DRAWMODE, EDITMODE, EditModeButton as EditModeButtonField, FeatureLayers, GeoJSONTextField, IntersectionSelect, Legend, LegendDialog, LegendLayout, MapControlButton, MapControls, MapDrawContainer, MapTime, MapView, MapViewLayer, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION, ORIGIN_REACTMAPVIEW_ONUPDATELAYERINFO, ReactMapView, ReactMapViewLayer, SelectField, StoryLayoutGrid, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, checkHoverFeatures, createInterSections, currentlySupportedDrawModes, defaultBox, defaultDelete, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultModes, defaultPoint, defaultPolygon, defaultTimeFormat, distance, drawPolyStoryStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, featureBox, featureMultiPoint, featurePoint, featurePolygon, fillOptions, firSelectionType, formatTime, getDoubleControlToolIcon, getDrawFunctionFromStore, getFeatureCollection, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getLastEmptyFeatureIndex, getTimeDimension, getToolIcon, intersectGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isGeoJSONFeatureCreatedByTool, lineString, moveFeature, opacityOptions, publicLayers, publicServices, registerDrawFunction, rewindGeometry, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, updateEditModeButtonsWithFir, useGeoJSON, useMapDrawTool };
9620
+ export { DRAWMODE, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EDITMODE, EditModeButton as EditModeButtonField, FeatureLayers, GeoJSONTextField, IntersectionSelect, Legend, LegendDialog, LegendLayout, MapControlButton, MapControls, MapDimensionSelect, MapDrawContainer, MapTime, MapView, MapViewLayer, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION, ORIGIN_REACTMAPVIEW_ONUPDATELAYERINFO, ReactMapView, ReactMapViewLayer, SelectField, StoryLayoutGrid, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, checkHoverFeatures, createInterSections, currentlySupportedDrawModes, defaultBox, defaultDelete, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultModes, defaultPoint, defaultPolygon, defaultTimeFormat, dimensionConfig, distance, drawPolyStoryStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, featureBox, featureMultiPoint, featurePoint, featurePolygon, fillOptions, firSelectionType, formatTime, getDoubleControlToolIcon, getDrawFunctionFromStore, getFeatureCollection, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getLastEmptyFeatureIndex, getTimeDimension, getToolIcon, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isGeoJSONFeatureCreatedByTool, isPointFeatureCollection, lineString, marksByDimension, moveFeature, opacityOptions, publicLayers, publicServices, registerDrawFunction, rewindGeometry, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, updateEditModeButtonsWithFir, useGeoJSON, useMapDrawTool };