@opengeoweb/webmap-react 9.8.0 → 9.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/index.esm.js +754 -552
  2. package/package.json +4 -5
  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/MapDraw.d.ts +4 -4
  15. package/src/lib/components/MapDraw/MapDrawContainer.d.ts +2 -2
  16. package/src/lib/components/MapDraw/geojsonShapes.d.ts +4 -4
  17. package/src/lib/components/MapDraw/mapDrawUtils.d.ts +2 -2
  18. package/src/lib/components/MapDraw/storyComponents/FeatureLayers.d.ts +2 -1
  19. package/src/lib/components/MapDraw/storyComponents/IntersectionSelect.d.ts +2 -2
  20. package/src/lib/components/MapDraw/storyComponents/SelectField.d.ts +2 -2
  21. package/src/lib/components/MapDrawTool/MapDrawTool.stories.d.ts +1 -0
  22. package/src/lib/components/MapDrawTool/storyExamplesMapDrawTool.d.ts +5 -3
  23. package/src/lib/components/MapDrawTool/storyExamplesMapDrawToolIntersection.d.ts +2 -1
  24. package/src/lib/components/MapDrawTool/storyExamplesMapDrawToolMultipleDrawTools.d.ts +1 -1
  25. package/src/lib/components/MapDrawTool/types.d.ts +6 -2
  26. package/src/lib/components/MapDrawTool/useMapDrawTool.d.ts +9 -64
  27. package/src/lib/components/MapDrawTool/utils.d.ts +23 -6
  28. package/src/lib/components/ReactMapView/ReactMapView.d.ts +1 -0
  29. package/src/lib/components/ReactMapView/types.d.ts +1 -0
  30. package/src/lib/components/index.d.ts +1 -1
  31. package/src/lib/storyshots/Storyshots.spec.d.ts +1 -0
  32. package/src/lib/components/CanvasComponent/CanvasComponent.d.ts +0 -71
  33. package/src/lib/components/CanvasComponent/CanvasComponentDynamic.stories.d.ts +0 -6
  34. package/src/lib/components/CanvasComponent/CanvasComponentStatic.stories.d.ts +0 -6
  35. package/src/lib/components/CanvasComponent/index.d.ts +0 -1
  36. /package/src/lib/components/{CanvasComponent/CanvasComponent.spec.d.ts → MapDimensionSelect/DimensionSelectButton.spec.d.ts} +0 -0
package/index.esm.js CHANGED
@@ -1,377 +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';
11
- import produce from 'immer';
10
+ import { Delete, Edit, DrawRegion, DrawPolygon, Location, DrawFIRLand, ArrowUp, Home, Add, Minus, Equalizer, DimensionsElevation, Link, LinkOff } from '@opengeoweb/theme';
11
+ import { produce } from 'immer';
12
12
  import { debounce } from 'throttle-debounce';
13
- import { differenceInMinutes } from 'date-fns';
14
13
  import { useResizeDetector } from 'react-resize-detector';
15
14
 
16
- /* *
17
- * Licensed under the Apache License, Version 2.0 (the "License");
18
- * you may not use this file except in compliance with the License.
19
- * You may obtain a copy of the License at
20
- *
21
- * http://www.apache.org/licenses/LICENSE-2.0
22
- *
23
- * Unless required by applicable law or agreed to in writing, software
24
- * distributed under the License is distributed on an "AS IS" BASIS,
25
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
- * See the License for the specific language governing permissions and
27
- * limitations under the License.
28
- *
29
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
30
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
31
- * */
32
- class CanvasComponent extends Component {
33
- constructor(props) {
34
- super(props);
35
- this.canvas = null;
36
- this.ctx = null;
37
- this.currentWidth = 1;
38
- this.currentHeight = 1;
39
- this.canvascontaineroutside = null;
40
- this.canvascontainer = null;
41
- this.timer = null;
42
- this.redrawTimer = null;
43
- this.loopHasStarted = false;
44
- this.mounted = false;
45
- this.updateCanvas = this.updateCanvas.bind(this);
46
- this.handleMouseMoveEvent = this.handleMouseMoveEvent.bind(this);
47
- this.handleMouseUpEvent = this.handleMouseUpEvent.bind(this);
48
- this.handleMouseDownEvent = this.handleMouseDownEvent.bind(this);
49
- this.resize = this.resize.bind(this);
50
- this._handleWindowResize = this._handleWindowResize.bind(this);
51
- this.handleClickEvent = this.handleClickEvent.bind(this);
52
- this.handleWheelEvent = this.handleWheelEvent.bind(this);
53
- this.handleTouchStartEvent = this.handleTouchStartEvent.bind(this);
54
- this.handleTouchEndEvent = this.handleTouchEndEvent.bind(this);
55
- this.handleTouchMoveEvent = this.handleTouchMoveEvent.bind(this);
56
- this.onKeyUp = this.onKeyUp.bind(this);
57
- this.onBlur = this.onBlur.bind(this);
58
- this.onFocus = this.onFocus.bind(this);
59
- this.startLoop = this.startLoop.bind(this);
60
- this._documentKeyDown = this._documentKeyDown.bind(this);
61
- this._isFocussed = false;
62
- this.canvas = null;
63
- this.canvascontaineroutside = /*#__PURE__*/React__default.createRef();
64
- this.canvascontainer = /*#__PURE__*/React__default.createRef();
65
- }
66
- componentDidMount() {
67
- this.mounted = true;
68
- if (this.canvas) {
69
- this.canvas.addEventListener('mousemove', this.handleMouseMoveEvent);
70
- this.canvas.addEventListener('mouseup', this.handleMouseUpEvent);
71
- this.canvas.addEventListener('mousedown', this.handleMouseDownEvent);
72
- this.canvas.addEventListener('touchstart', this.handleTouchStartEvent);
73
- this.canvas.addEventListener('touchend', this.handleTouchEndEvent);
74
- this.canvas.addEventListener('touchmove', this.handleTouchMoveEvent);
75
- this.canvas.addEventListener('wheel', this.handleWheelEvent);
76
- this.canvas.addEventListener('click', this.handleClickEvent);
77
- document.addEventListener('keydown', this._documentKeyDown, false);
78
- this.resize();
79
- this.updateCanvas();
80
- }
81
- const {
82
- onKeyUp,
83
- redrawInterval: loopInterval
84
- } = this.props;
85
- if (onKeyUp) {
86
- window.addEventListener('keyup', this.onKeyUp);
87
- }
88
- window.addEventListener('resize', this._handleWindowResize);
89
- if (this.canvascontaineroutside && this.canvascontaineroutside.current && onKeyUp) {
90
- this.canvascontaineroutside.current.focus();
91
- }
92
- this.timer = setInterval(() => {
93
- this.resize();
94
- }, 1000);
95
- if (loopInterval) {
96
- this.redrawTimer = setInterval(() => {
97
- this.updateCanvas();
98
- }, loopInterval);
99
- }
100
- }
101
- shouldComponentUpdate() {
102
- window.requestAnimationFrame(() => {
103
- this.updateCanvas();
104
- });
105
- return false;
106
- }
107
- componentWillUnmount() {
108
- this.mounted = false;
109
- window.removeEventListener('resize', this._handleWindowResize);
110
- const {
111
- onKeyUp
112
- } = this.props;
113
- if (onKeyUp) {
114
- window.removeEventListener('keyup', this.onKeyUp);
115
- }
116
- if (this.canvas) {
117
- this.canvas.removeEventListener('mousedown', this.handleMouseDownEvent);
118
- this.canvas.removeEventListener('mouseup', this.handleMouseUpEvent);
119
- this.canvas.removeEventListener('mousemove', this.handleMouseMoveEvent);
120
- this.canvas.removeEventListener('touchstart', this.handleTouchStartEvent);
121
- this.canvas.removeEventListener('touchend', this.handleTouchEndEvent);
122
- this.canvas.removeEventListener('touchmove', this.handleTouchMoveEvent);
123
- this.canvas.removeEventListener('wheel', this.handleWheelEvent);
124
- this.canvas.removeEventListener('click', this.handleClickEvent);
125
- document.removeEventListener('keydown', this._documentKeyDown);
126
- }
127
- clearInterval(this.timer);
128
- clearInterval(this.redrawTimer);
129
- }
130
- handleMouseMoveEvent(event) {
131
- const {
132
- onMouseMove,
133
- onCanvasClick
134
- } = this.props;
135
- const x = event.offsetX;
136
- const y = event.offsetY;
137
- if (event.buttons === 1) {
138
- onCanvasClick(x, y, this.currentWidth, this.currentHeight);
139
- }
140
- onMouseMove(x, y, event, this.currentWidth);
141
- }
142
- handleMouseUpEvent(event) {
143
- const {
144
- onMouseUp
145
- } = this.props;
146
- const x = event.offsetX;
147
- onMouseUp(x);
148
- }
149
- handleMouseDownEvent(event) {
150
- const {
151
- onMouseDown
152
- } = this.props;
153
- const x = event.offsetX;
154
- const y = event.offsetY;
155
- onMouseDown(x, y, this.currentWidth);
156
- }
157
- handleTouchStartEvent(event) {
158
- const {
159
- onTouchStart
160
- } = this.props;
161
- onTouchStart(event, this.currentWidth);
162
- }
163
- handleTouchEndEvent() {
164
- const {
165
- onTouchEnd
166
- } = this.props;
167
- onTouchEnd();
168
- }
169
- handleTouchMoveEvent(event) {
170
- const {
171
- onTouchMove,
172
- onCanvasClick
173
- } = this.props;
174
- const touches = event && event.touches && event.touches[0];
175
- if (touches && touches.clientX && touches.clientY) {
176
- const x2 = event.touches[0].clientX - event.touches[0].target.offsetLeft;
177
- const y2 = event.touches[0].clientY;
178
- onCanvasClick(x2, y2, this.currentWidth, this.currentHeight);
179
- }
180
- onTouchMove(event, this.currentWidth);
181
- }
182
- handleClickEvent(event) {
183
- const {
184
- onCanvasClick
185
- } = this.props;
186
- const x = event.offsetX;
187
- const y = event.offsetY;
188
- onCanvasClick(x, y, this.currentWidth, this.currentHeight);
189
- }
190
- handleWheelEvent(event) {
191
- const {
192
- onWheel
193
- } = this.props;
194
- onWheel({
195
- event,
196
- deltaY: event.deltaY,
197
- deltaX: event.deltaX,
198
- canvasWidth: event.srcElement.width,
199
- mouseX: event.offsetX
200
- });
201
- }
202
- onFocus() {
203
- const {
204
- isFocussed
205
- } = this.props;
206
- this._isFocussed = true;
207
- if (isFocussed) {
208
- isFocussed(true);
209
- }
210
- }
211
- onBlur() {
212
- const {
213
- isFocussed
214
- } = this.props;
215
- this._isFocussed = false;
216
- if (isFocussed) {
217
- isFocussed(false);
218
- }
219
- }
220
- onKeyUp(event) {
221
- const {
222
- onKeyUp
223
- } = this.props;
224
- if (onKeyUp) {
225
- onKeyUp(event);
226
- }
227
- if (this.canvascontaineroutside && this.canvascontaineroutside.current && onKeyUp) {
228
- if (event.code === 'Escape') {
229
- this.canvascontaineroutside.current.focus();
230
- }
231
- }
232
- }
233
- _documentKeyDown(event) {
234
- if (this._isFocussed) {
235
- const {
236
- onKeyDown
237
- } = this.props;
238
- if (onKeyDown) {
239
- onKeyDown(event);
240
- }
241
- }
242
- }
243
- _handleWindowResize() {
244
- this.resize();
245
- }
246
- startLoop() {
247
- const {
248
- onRenderCanvas
249
- } = this.props;
250
- if (this.mounted === false || this.loopHasStarted === false) {
251
- return;
252
- }
253
- if (this.canvas) {
254
- onRenderCanvas(this.ctx, this.currentWidth, this.currentHeight, this.canvas);
255
- }
256
- requestAnimationFrame(this.startLoop);
257
- }
258
- updateCanvas() {
259
- if (!this.canvas) {
260
- return;
261
- }
262
- const {
263
- onRenderCanvas,
264
- loop
265
- } = this.props;
266
- this.ctx = this.canvas.getContext('2d');
267
- if (!this.ctx) {
268
- return;
269
- }
270
- if (this.ctx.canvas.height !== this.currentHeight) {
271
- this.ctx.canvas.height = this.currentHeight;
272
- }
273
- if (this.ctx.canvas.width !== this.currentWidth) {
274
- this.ctx.canvas.width = this.currentWidth;
275
- }
276
- if (loop !== true) {
277
- this.loopHasStarted = false;
278
- onRenderCanvas(this.ctx, this.currentWidth, this.currentHeight, this.canvas);
279
- } else if (this.loopHasStarted === false) {
280
- this.loopHasStarted = true;
281
- this.startLoop();
282
- }
283
- }
284
- resize() {
285
- const {
286
- canvascontainer,
287
- props: {
288
- resizeCallback
289
- }
290
- } = this;
291
- if (canvascontainer && canvascontainer.current) {
292
- const newWidth = canvascontainer.current.clientWidth;
293
- const newHeight = canvascontainer.current.clientHeight;
294
- if (newWidth !== undefined && newHeight !== undefined && (this.currentWidth !== newWidth || this.currentHeight !== newHeight)) {
295
- this.currentWidth = newWidth;
296
- this.currentHeight = newHeight;
297
- this.updateCanvas();
298
- resizeCallback && resizeCallback(newWidth);
299
- }
300
- }
301
- }
302
- render() {
303
- this.updateCanvas();
304
- this._handleWindowResize();
305
- return /*#__PURE__*/React__default.createElement("div", {
306
- role: "button",
307
- ref: this.canvascontaineroutside,
308
- tabIndex: 0,
309
- onFocus: this.onFocus,
310
- onBlur: this.onBlur,
311
- style: {
312
- height: '100%',
313
- width: '100%',
314
- border: 'none',
315
- display: 'block',
316
- overflow: 'hidden'
317
- }
318
- }, /*#__PURE__*/React__default.createElement("div", {
319
- ref: this.canvascontainer,
320
- style: {
321
- minWidth: 'inherit',
322
- minHeight: 'inherit',
323
- width: 'inherit',
324
- height: 'inherit',
325
- overflow: 'hidden',
326
- display: 'block',
327
- border: 'none'
328
- },
329
- "data-testid": "canvas-container"
330
- }, /*#__PURE__*/React__default.createElement("div", {
331
- style: {
332
- overflow: 'visible',
333
- width: 0,
334
- height: 0
335
- },
336
- role: "presentation",
337
- "aria-label": "canvas"
338
- }, /*#__PURE__*/React__default.createElement("canvas", {
339
- ref: canvas => {
340
- this.canvas = canvas;
341
- }
342
- }))));
343
- }
344
- }
345
- CanvasComponent.defaultProps = {
346
- onRenderCanvas: () => {
347
- /* intentionally left blank */
348
- },
349
- onCanvasClick: () => {
350
- /* intentionally left blank */
351
- },
352
- onMouseMove: () => {
353
- /* intentionally left blank */
354
- },
355
- onMouseUp: () => {
356
- /* intentionally left blank */
357
- },
358
- onMouseDown: () => {
359
- /* intentionally left blank */
360
- },
361
- onTouchStart: () => {
362
- /* intentionally left blank */
363
- },
364
- onTouchEnd: () => {
365
- /* intentionally left blank */
366
- },
367
- onTouchMove: () => {
368
- /* intentionally left blank */
369
- },
370
- onWheel: () => {
371
- /* intentionally left blank */
372
- }
373
- };
374
-
375
15
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
376
16
 
377
17
  var fails$i = function (exec) {
@@ -3053,12 +2693,14 @@ class MapDraw extends React.PureComponent {
3053
2693
  isInEditMode,
3054
2694
  isInDeleteMode,
3055
2695
  drawMode,
3056
- mapId
2696
+ mapId,
2697
+ selectedFeatureIndex
3057
2698
  } = this.props;
3058
2699
  const prevGeojson = prevProps && prevProps.geojson;
3059
2700
  const prevIsInEditMode = prevProps && prevProps.isInEditMode;
3060
2701
  const prevIsInDeleteMode = prevProps && prevProps.isInDeleteMode;
3061
2702
  const prevDrawMode = prevProps && prevProps.drawMode;
2703
+ const prevSelectedFeatureIndex = prevProps && prevProps.selectedFeatureIndex;
3062
2704
  /* Handle geojson update */
3063
2705
  if (geojson !== prevGeojson) {
3064
2706
  this.handleGeoJSONUpdate(geojson);
@@ -3087,6 +2729,9 @@ class MapDraw extends React.PureComponent {
3087
2729
  this.myEditMode = EDITMODE.EMPTY;
3088
2730
  }
3089
2731
  }
2732
+ if (selectedFeatureIndex !== prevSelectedFeatureIndex) {
2733
+ webmapUtils.getWMJSMapById(mapId).draw('MapDraw::componentDidUpdateSelectedFeatureIndex');
2734
+ }
3090
2735
  /* Handle new drawmode */
3091
2736
  if (drawMode !== prevDrawMode) {
3092
2737
  /* Handle drawmode */
@@ -3137,14 +2782,14 @@ class MapDraw extends React.PureComponent {
3137
2782
  const XYCoords = [];
3138
2783
  const from = getProj4(proj.lonlat);
3139
2784
  const to = getProj4(proj.crs);
3140
- for (let j = 0; j < featureCoords.length; j += 1) {
3141
- if (featureCoords[j].length < 2) {
2785
+ for (const featureCoord of featureCoords) {
2786
+ if (featureCoord.length < 2) {
3142
2787
  // eslint-disable-next-line no-continue
3143
2788
  continue;
3144
2789
  }
3145
2790
  let coordinates = {
3146
- x: featureCoords[j][0],
3147
- y: featureCoords[j][1]
2791
+ x: featureCoord[0],
2792
+ y: featureCoord[1]
3148
2793
  };
3149
2794
  coordinates = proj.proj4.transform(from, to, coordinates);
3150
2795
  const x = width * (coordinates.x - bbox.left) / (bbox.right - bbox.left);
@@ -3876,11 +3521,9 @@ class MapDraw extends React.PureComponent {
3876
3521
  const incY = this.mouseGeoCoord.y - this.snappedGeoCoords.y;
3877
3522
  this.snappedGeoCoords.x = this.mouseGeoCoord.x;
3878
3523
  this.snappedGeoCoords.y = this.mouseGeoCoord.y;
3879
- for (let j = 0; j < featureCoords.length; j += 1) {
3880
- /* eslint-disable-next-line no-param-reassign */
3881
- featureCoords[j][0] += incX;
3882
- /* eslint-disable-next-line no-param-reassign */
3883
- featureCoords[j][1] += incY;
3524
+ for (const featureCoord of featureCoords) {
3525
+ featureCoord[0] += incX;
3526
+ featureCoord[1] += incY;
3884
3527
  }
3885
3528
  if (this.myEditMode !== EDITMODE.ADD_FEATURE) {
3886
3529
  this.somethingWasDragged = DRAGMODE.FEATURE;
@@ -4002,18 +3645,18 @@ class MapDraw extends React.PureComponent {
4002
3645
  if (!this.geojson || !this.geojson.features || !this.geojson.features.length) {
4003
3646
  return;
4004
3647
  }
4005
- for (let featureIndex = 0; featureIndex < this.geojson.features.length; featureIndex += 1) {
3648
+ for (const geoJsonFeature of this.geojson.features) {
4006
3649
  if (!this.geojson.features) {
4007
3650
  this.geojson.features = [];
4008
3651
  }
4009
- const feature = this.geojson.features[featureIndex];
3652
+ const feature = geoJsonFeature;
4010
3653
  this.validateFeature(feature);
4011
3654
  const featureType = feature.geometry.type;
4012
3655
  if (featureType === 'Polygon') {
4013
3656
  /* Loop through all polygons of the same feature */
4014
3657
  const polygonGeometry = feature.geometry;
4015
- for (let polygonIndex = 0; polygonIndex < polygonGeometry.coordinates.length; polygonIndex += 1) {
4016
- let featureCoords = polygonGeometry.coordinates[polygonIndex];
3658
+ for (const polyCoordinates of polygonGeometry.coordinates) {
3659
+ let featureCoords = polyCoordinates;
4017
3660
  /* Remove duplicates */
4018
3661
  if (!this.checkIfFeatureIsBox(feature)) {
4019
3662
  for (let coordIndex = featureCoords.length - 2; coordIndex >= 0; coordIndex -= 1) {
@@ -4131,8 +3774,7 @@ class MapDraw extends React.PureComponent {
4131
3774
  }
4132
3775
  if (featureType === 'MultiPolygon') {
4133
3776
  const multiPolygonGeometry = feature.geometry;
4134
- for (let multiPolygonIndex = 0; multiPolygonIndex < multiPolygonGeometry.coordinates.length; multiPolygonIndex += 1) {
4135
- const multiPoly = multiPolygonGeometry.coordinates[multiPolygonIndex];
3777
+ for (const multiPoly of multiPolygonGeometry.coordinates) {
4136
3778
  for (let polygonIndex = 0; polygonIndex < multiPoly.length; polygonIndex += 1) {
4137
3779
  const featureCoords = multiPoly[polygonIndex];
4138
3780
  const XYCoords = this.getPixelCoordFromGeoCoord(featureCoords);
@@ -4257,12 +3899,12 @@ class MapDraw extends React.PureComponent {
4257
3899
  }
4258
3900
  }
4259
3901
  /* Draw labels */
4260
- for (let j = 0; j < this.textPositions.length; j += 1) {
3902
+ for (const textPosition of this.textPositions) {
4261
3903
  const {
4262
3904
  x,
4263
3905
  y,
4264
3906
  text
4265
- } = this.textPositions[j];
3907
+ } = textPosition;
4266
3908
  ctx.fillStyle = 'black';
4267
3909
  ctx.font = '12px Arial';
4268
3910
  ctx.fillText(text, x, y);
@@ -4641,14 +4283,14 @@ class MapDraw extends React.PureComponent {
4641
4283
  } = this.props;
4642
4284
  const webmapjs = webmapUtils.getWMJSMapById(mapId);
4643
4285
  const XYCoords = [];
4644
- for (let j = 0; j < featureCoords.length; j += 1) {
4645
- if (featureCoords[j].length < 2) {
4286
+ for (const featureCoord of featureCoords) {
4287
+ if (featureCoord.length < 2) {
4646
4288
  // eslint-disable-next-line no-continue
4647
4289
  continue;
4648
4290
  }
4649
4291
  const coord = webmapjs.getPixelCoordFromLatLong({
4650
- x: featureCoords[j][0],
4651
- y: featureCoords[j][1]
4292
+ x: featureCoord[0],
4293
+ y: featureCoord[1]
4652
4294
  });
4653
4295
  XYCoords.push(coord);
4654
4296
  }
@@ -4826,12 +4468,17 @@ const GeoJSONTextField = ({
4826
4468
  const FeatureLayers = ({
4827
4469
  geojson,
4828
4470
  onChangeLayerIndex,
4829
- activeFeatureLayerIndex
4471
+ activeFeatureLayerIndex,
4472
+ getToolIcon
4830
4473
  }) => {
4831
- const featureLayerList = geojson ? Array.from(Array(geojson.features.length).keys()).map(index => ({
4832
- key: index,
4833
- value: `feature ${index + 1}: ${geojson.features[index].geometry.type}`
4834
- })) : [];
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
+ }) : [];
4835
4482
  return /*#__PURE__*/React__default.createElement(Grid, {
4836
4483
  item: true,
4837
4484
  sm: 12
@@ -4848,13 +4495,22 @@ const FeatureLayers = ({
4848
4495
  value: (featureLayerList.length ? activeFeatureLayerIndex : '').toString(),
4849
4496
  onChange: event => {
4850
4497
  const featureNr = parseInt(event.target.value, 10);
4851
- onChangeLayerIndex(featureNr);
4498
+ onChangeLayerIndex(featureNr, geojson.features[featureNr]);
4499
+ },
4500
+ sx: {
4501
+ '.MuiSelect-select': {
4502
+ display: 'flex'
4503
+ }
4852
4504
  }
4853
4505
  }, featureLayerList.map(listItem => {
4854
4506
  return /*#__PURE__*/React__default.createElement(MenuItem, {
4855
- key: listItem.key,
4856
- value: listItem.key
4857
- }, 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);
4858
4514
  }))));
4859
4515
  };
4860
4516
 
@@ -4900,6 +4556,22 @@ const EditModeButton = ({
4900
4556
  }, "press ESC to exit draw mode")))));
4901
4557
  };
4902
4558
 
4559
+ /* *
4560
+ * Licensed under the Apache License, Version 2.0 (the "License");
4561
+ * you may not use this file except in compliance with the License.
4562
+ * You may obtain a copy of the License at
4563
+ *
4564
+ * http://www.apache.org/licenses/LICENSE-2.0
4565
+ *
4566
+ * Unless required by applicable law or agreed to in writing, software
4567
+ * distributed under the License is distributed on an "AS IS" BASIS,
4568
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4569
+ * See the License for the specific language governing permissions and
4570
+ * limitations under the License.
4571
+ *
4572
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4573
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
4574
+ * */
4903
4575
  const simplePolygonGeoJSON = {
4904
4576
  type: 'FeatureCollection',
4905
4577
  features: [{
@@ -5201,9 +4873,7 @@ const intersectionFeatureNL = {
5201
4873
  type: 'Polygon',
5202
4874
  coordinates: [[[5.0, 55.0], [4.331914, 55.332644], [3.368817, 55.764314], [2.761908, 54.379261], [3.15576, 52.913554], [2.000002, 51.500002], [3.370001, 51.369722], [3.370527, 51.36867], [3.362223, 51.320002], [3.36389, 51.313608], [3.373613, 51.309999], [3.952501, 51.214441], [4.397501, 51.452776], [5.078611, 51.391665], [5.848333, 51.139444], [5.651667, 50.824717], [6.011797, 50.757273], [5.934168, 51.036386], [6.222223, 51.361666], [5.94639, 51.811663], [6.405001, 51.830828], [7.053095, 52.237764], [7.031389, 52.268885], [7.063612, 52.346109], [7.065557, 52.385828], [7.133055, 52.888887], [7.14218, 52.898244], [7.191667, 53.3], [6.5, 53.666667], [6.500002, 55.000002], [5.0, 55.0]]]
5203
4875
  },
5204
- properties: Object.assign(Object.assign({}, defaultGeoJSONStyleProperties), {
5205
- selectionType: 'fir'
5206
- })
4876
+ properties: defaultGeoJSONStyleProperties
5207
4877
  };
5208
4878
  const intersectionFeatureBE = {
5209
4879
  type: 'Feature',
@@ -5211,9 +4881,7 @@ const intersectionFeatureBE = {
5211
4881
  type: 'Polygon',
5212
4882
  coordinates: [[[4.83163899984, 51.4375169997], [4.83971700004, 51.4211280003], [4.78471399965, 51.4327609998], [4.7811030004, 51.4302970004], [4.77944200025, 51.4175190002], [4.80665799987, 51.4100140003], [4.88973599992, 51.4160859998], [4.90944699968, 51.4091530002], [4.97808600027, 51.4238780003], [5.01693300026, 51.4755610004], [5.03137199972, 51.4852999999], [5.04139699977, 51.4866750004], [5.05027800013, 51.4747000003], [5.06139400013, 51.4719500003], [5.10058599984, 51.4399779999], [5.07663599975, 51.3988970003], [5.07864199963, 51.3916780001], [5.12780000027, 51.3497389997], [5.14000300004, 51.3208609998], [5.14945799989, 51.3171939998], [5.178908, 51.3166780003], [5.22806699979, 51.3122110002], [5.22523100031, 51.2688940001], [5.25029999985, 51.2633360001], [5.32971099986, 51.2621920004], [5.34724199982, 51.2694670004], [5.38752200024, 51.2677470002], [5.46779400039, 51.2827610001], [5.517222, 51.2958330004], [5.54250799964, 51.2769170004], [5.55780600005, 51.2639109996], [5.55666699968, 51.2558330003], [5.5572329997, 51.2313669998], [5.5591809996, 51.2244330002], [5.64942199993, 51.2016859998], [5.65555300027, 51.1964140004], [5.71055599976, 51.1822219997], [5.73553599969, 51.1916609998], [5.77696099985, 51.180258], [5.77942500016, 51.1694279997], [5.82806899958, 51.1669640003], [5.85500000045, 51.1510939996], [5.85601899978, 51.1473080004], [5.8472219997, 51.1352779996], [5.81695299958, 51.1225030004], [5.84056100009, 51.1058309996], [5.80641099997, 51.0958610003], [5.80280299996, 51.093339], [5.80222800042, 51.0616560003], [5.7752999997, 51.0597080004], [5.77140299985, 51.0475029997], [5.76332499965, 51.0394250004], [5.76303899995, 51.0352999999], [5.7747280003, 51.028594], [5.77696099985, 51.0258470001], [5.76418599978, 50.9899779999], [5.74802800019, 50.9819579997], [5.72276099962, 50.9652829996], [5.72390600026, 50.9577779998], [5.72831700043, 50.9561169996], [5.74418900032, 50.9577779998], [5.72974999996, 50.9141749999], [5.7150249999, 50.9105669999], [5.68406700039, 50.8831669999], [5.66555600021, 50.8769439998], [5.65331699968, 50.8783079997], [5.64776099977, 50.8677670001], [5.63750299976, 50.8502920001], [5.63945299976, 50.8430719999], [5.6472220001, 50.8324999998], [5.70001400015, 50.8069169999], [5.70052799957, 50.8033079999], [5.69806400015, 50.7999859996], [5.69694399977, 50.7897220002], [5.6933110004, 50.762514], [5.69308099969, 50.7591919997], [5.73719699984, 50.7594190003], [5.76195000009, 50.7763810001], [5.7747280003, 50.7816500002], [5.77862200001, 50.7794169998], [5.77999699956, 50.7758639996], [5.79747499977, 50.7694469996], [5.80417800041, 50.7647499997], [5.83888900033, 50.7616669996], [5.84720599986, 50.7669250002], [5.85471099971, 50.7591919997], [5.88307199997, 50.7664109999], [5.89250000037, 50.7544440002], [5.93251899955, 50.756956], [5.99888899983, 50.7538889998], [6.01163300026, 50.7566690003], [6.01611400006, 50.765264], [6.06666700028, 50.7166670001], [6.11666700018, 50.7333329997], [6.16666700008, 50.6666670002], [6.2500000002, 50.6499999996], [6.28333300042, 50.6166670003], [6.2500000002, 50.5999999997], [6.2500000002, 50.583333], [6.2000000003, 50.5499999998], [6.1986110001, 50.5194439999], [6.2500000002, 50.4833330002], [6.35, 50.4666669997], [6.37388899998, 50.4349999999], [6.38333300022, 50.4333330003], [6.40833300017, 50.3333329996], [6.3000000001, 50.316667], [6.29916700036, 50.303056], [6.23166700013, 50.2388889997], [6.1500000004, 50.1499999997], [6.13301100026, 50.1268060003], [6.11655799965, 50.0714689998], [6.12647199998, 50.0711830001], [6.11322499973, 50.0586359998], [6.13316099998, 50.0435579996], [6.14093299956, 49.9935890002], [6.16349999973, 49.9814360001], [6.15971699974, 49.9746389996], [6.17998600005, 49.9583389997], [6.18282499967, 49.9675310001], [6.18998899999, 49.9667970004], [6.21388899958, 49.955556], [6.22060299983, 49.9355170004], [6.22500000025, 49.9083329996], [6.23418300015, 49.897519], [6.30860799956, 49.8644609999], [6.32110000006, 49.8483030003], [6.32195800006, 49.8399940002], [6.34109700043, 49.8475000001], [6.36917200009, 49.8419420001], [6.4435970004, 49.8094560003], [6.50307200017, 49.8072219998], [6.51304200039, 49.8041860001], [6.5222080004, 49.8111170004], [6.52140600029, 49.7974810002], [6.50668100023, 49.7863670003], [6.51751099963, 49.7580609999], [6.49997799959, 49.7419610003], [6.5166500004, 49.7194439997], [6.49779999987, 49.7203029998], [6.50141100002, 49.7060940001], [6.46111099957, 49.6916670003], [6.42085300017, 49.6658169999], [6.42056400033, 49.6602579998], [6.43805600028, 49.6541670004], [6.42499999985, 49.638889], [6.42499999985, 49.6333330001], [6.37944399984, 49.5969440002], [6.3719220001, 49.5872059999], [6.3750139997, 49.5822220002], [6.36137800039, 49.5752889998], [6.37335300044, 49.549161], [6.36779699963, 49.5422280004], [6.36166700023, 49.4543310003], [6.2805329999, 49.4930689997], [6.21666699998, 49.5000000001], [6.15304999986, 49.5025220004], [6.15969699972, 49.4933560004], [6.12251400002, 49.4839029997], [6.11804199974, 49.469692], [6.09054199961, 49.4530749999], [6.06916899965, 49.4633329999], [6.04321399973, 49.4534189996], [5.9999999998, 49.4500000002], [5.95833300017, 49.4833330004], [5.8511029997, 49.5052720004], [5.80858100021, 49.5446939999], [5.75833299967, 49.5361109998], [5.48333300022, 49.5000000001], [5.4000000001, 49.6083330002], [5.31666699998, 49.6166669996], [5.3000000003, 49.6666670004], [5.17499999965, 49.6916670003], [5.06666699958, 49.7583329999], [5.0, 49.7833329998], [4.8500000003, 49.7833329998], [4.85833299967, 49.9166669999], [4.8000000004, 49.9500000001], [4.83888899963, 50.0472220004], [4.87222199985, 50.088889], [4.86749999973, 50.1152780002], [4.87022799962, 50.1267969999], [4.89647500042, 50.1402000001], [4.88140799988, 50.1486169998], [4.87752199964, 50.1560970003], [4.85856400043, 50.1539169996], [4.83766699993, 50.1585920002], [4.82454400001, 50.1676309998], [4.81676900029, 50.1657609999], [4.80753599989, 50.1536059996], [4.76428099987, 50.1377080003], [4.7499999996, 50.1180559997], [4.74027800003, 50.1083330001], [4.73317799996, 50.1093419998], [4.71540300045, 50.0977579998], [4.68333300002, 50.0], [4.48333300042, 49.9333330004], [4.18333300012, 49.9500000001], [4.12499999995, 50.0166669997], [4.14888899993, 50.0347220004], [4.1999999998, 50.0999999998], [4.11666699968, 50.1499999997], [4.16666699958, 50.2500000004], [4.17222200035, 50.2833329997], [4.01666699988, 50.3500000002], [3.9000000004, 50.316667], [3.79166700033, 50.3333329996], [3.7099999997, 50.3083329997], [3.6599999998, 50.3719440004], [3.61666699978, 50.4833330002], [3.40499999995, 50.4633329997], [3.27666700028, 50.5300000002], [3.22499999995, 50.6783330004], [3.11666699988, 50.7833329996], [2.8999999997, 50.7000000004], [2.81666699958, 50.7250000003], [2.71666699978, 50.8000000002], [2.63333299962, 50.8166669999], [2.5500000004, 51.0833329999], [1.9999999997, 51.1166670002], [1.9999999997, 51.4999999997], [3.0000000004, 51.4086179998], [3.10027800043, 51.3994440003], [3.36388899988, 51.3736109997], [3.38724200032, 51.3413280003], [3.38377200038, 51.3313580001], [3.36248900007, 51.3184579996], [3.37401700018, 51.3050059998], [3.36470599978, 51.3019560004], [3.36492800013, 51.2987639998], [3.3813890002, 51.2836109997], [3.42589999969, 51.2589609998], [3.43277200003, 51.2486970004], [3.45504400008, 51.2451440002], [3.49817799991, 51.2463390004], [3.53010600009, 51.2507780001], [3.52079199955, 51.2930780001], [3.52611400036, 51.2955750002], [3.54363099967, 51.2896110003], [3.56447200028, 51.2968220001], [3.58376100037, 51.2897499996], [3.58575599974, 51.3012609998], [3.59285000043, 51.3063919999], [3.6037139996, 51.3037579998], [3.64140600029, 51.2876689998], [3.65204699997, 51.2872530004], [3.65847799976, 51.2835080004], [3.69151399977, 51.2815669999], [3.71390800005, 51.2744940002], [3.73109999967, 51.2727249996], [3.75780600005, 51.2722750004], [3.76866900007, 51.2646470003], [3.77842500031, 51.2670030001], [3.79084200006, 51.2625669997], [3.79061899967, 51.2514719997], [3.79039700022, 51.2199890003], [3.80370000035, 51.2145779999], [3.84560600022, 51.2120829999], [3.86400799987, 51.2141639997], [3.87886100043, 51.2273390002], [3.88846099978, 51.2265610003], [3.88839700042, 51.217214], [3.88462800018, 51.2088920003], [3.91278600007, 51.209725], [3.92298299997, 51.220958], [3.9300779998, 51.2226220003], [3.93916899995, 51.2165219996], [3.94870299984, 51.215828], [3.97109700013, 51.2215139996], [4.10833300027, 51.2708330004], [4.25143300013, 51.3750060002], [4.33391100039, 51.3766670004], [4.34307800045, 51.3647500003], [4.3469750003, 51.3625169999], [4.41859199972, 51.3591360004], [4.43165799972, 51.3644639997], [4.42805599998, 51.3744440004], [4.3966499996, 51.4169469999], [4.40942499966, 51.4375169997], [4.40805000011, 51.440839], [4.39389999959, 51.4502919998], [4.46528900019, 51.4716639997], [4.4986109999, 51.4788890001], [4.51250000007, 51.4805559997], [4.54556100034, 51.4850140002], [4.54498900004, 51.4627830002], [4.53805599958, 51.4524690003], [4.53530599957, 51.4397500002], [4.62361099965, 51.4272219998], [4.67166899992, 51.4274890004], [4.67304400038, 51.4308109998], [4.66863300021, 51.440839], [4.68415800029, 51.4494329997], [4.69859699975, 51.4644440004], [4.76918600033, 51.502775], [4.80833299977, 51.4999999997], [4.8408059999, 51.4830670003], [4.84470299974, 51.4614079998], [4.83696700003, 51.4569389996], [4.83163899984, 51.4375169997]]]
5213
4883
  },
5214
- properties: Object.assign(Object.assign({}, defaultGeoJSONStyleProperties), {
5215
- selectionType: 'fir-be'
5216
- })
4884
+ properties: defaultGeoJSONStyleProperties
5217
4885
  };
5218
4886
 
5219
4887
  const drawPolyStoryStyles = {
@@ -5464,7 +5132,7 @@ const getGeoJSONPropertyValue = (property, properties, polygonDrawMode, defaultP
5464
5132
  * @param {number} featureLayerIndex - feature layer index
5465
5133
  * @param {string} text - reason of change
5466
5134
  */
5467
- const moveFeature = (currentGeoJSON, newGeoJSON, featureLayerIndex, reason) => {
5135
+ const moveFeature = (currentGeoJSON, newGeoJSON, featureLayerIndex, reason, selectionType) => {
5468
5136
  const feature = newGeoJSON.features[featureLayerIndex];
5469
5137
  const currentFeature = currentGeoJSON.features[featureLayerIndex];
5470
5138
  if (feature) {
@@ -5473,38 +5141,86 @@ const moveFeature = (currentGeoJSON, newGeoJSON, featureLayerIndex, reason) => {
5473
5141
  } = feature;
5474
5142
  if (geometry.type === 'Polygon' && geometry.coordinates.length > 1 && reason === NEW_FEATURE_CREATED) {
5475
5143
  const lastCoordinate = geometry.coordinates.pop();
5476
- const copyFeature = Object.assign(Object.assign({}, feature), {
5144
+ const copyFeature = Object.assign(Object.assign(Object.assign({}, feature), {
5477
5145
  geometry: Object.assign(Object.assign({}, geometry), {
5478
5146
  coordinates: [lastCoordinate]
5479
5147
  })
5148
+ }), selectionType && {
5149
+ properties: Object.assign(Object.assign({}, feature.properties), {
5150
+ selectionType
5151
+ })
5480
5152
  });
5481
5153
  newGeoJSON.features.push(copyFeature);
5482
5154
  return newGeoJSON.features.length - 1;
5483
5155
  }
5484
5156
  if (geometry.type === 'LineString' && geometry.coordinates.length > 2 && reason === NEW_LINESTRING_CREATED) {
5485
5157
  const lastCoordinate = geometry.coordinates.pop();
5486
- const copyFeature = Object.assign(Object.assign({}, feature), {
5158
+ const copyFeature = Object.assign(Object.assign(Object.assign({}, feature), {
5487
5159
  geometry: Object.assign(Object.assign({}, geometry), {
5488
5160
  coordinates: [lastCoordinate, lastCoordinate]
5489
5161
  })
5162
+ }), selectionType && {
5163
+ properties: Object.assign(Object.assign({}, feature.properties), {
5164
+ selectionType
5165
+ })
5490
5166
  });
5491
5167
  newGeoJSON.features.push(copyFeature);
5492
5168
  return newGeoJSON.features.length - 1;
5493
5169
  }
5494
5170
  if (geometry.type === 'Point' && currentFeature && currentFeature.geometry.type === 'Point' && currentFeature.geometry.coordinates.length > 0 && reason === NEW_POINT_CREATED) {
5495
- 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);
5496
5177
  return newGeoJSON.features.length - 1;
5497
5178
  }
5498
5179
  }
5499
5180
  return undefined;
5500
5181
  };
5501
5182
  /**
5502
- * 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.
5184
+ * @param a Feature A
5185
+ * @param b Feature B
5186
+ * @returns The intersection of the two features.
5187
+ */
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.
5503
5219
  * @param a Feature A
5504
5220
  * @param b Feature B
5505
5221
  * @returns The intersection of the two features.
5506
5222
  */
5507
- const intersectGeoJSONS = (a, b, geoJSONProperties = {
5223
+ const intersectPolygonGeoJSONS = (a, b, geoJSONProperties = {
5508
5224
  stroke: '#FF0000',
5509
5225
  'stroke-width': 10.0,
5510
5226
  'stroke-opacity': 1,
@@ -5534,6 +5250,9 @@ const intersectGeoJSONS = (a, b, geoJSONProperties = {
5534
5250
  }] : [intersection]
5535
5251
  }, geoJSONProperties);
5536
5252
  };
5253
+ const isPointFeatureCollection = geojson => {
5254
+ return geojson.features[0].geometry.type === 'Point';
5255
+ };
5537
5256
  /**
5538
5257
  * Adds the intersectionStart and intersectionEnd properties to the GeoJSONS structure
5539
5258
  * @param geoJSONs
@@ -5548,7 +5267,10 @@ const createInterSections = (geojson, otherGeoJSON, geoJSONproperties = {
5548
5267
  }) => {
5549
5268
  const intersections = produce(geojson, () => {
5550
5269
  try {
5551
- 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);
5552
5274
  } catch (error) {
5553
5275
  return addFeatureProperties(geojson, geoJSONproperties);
5554
5276
  }
@@ -5570,11 +5292,38 @@ const getGeoJson = (geojson, shouldAllowMultipleShapes) => {
5570
5292
  draftFeature.geometry.coordinates = [draftFeature.geometry.coordinates[1]];
5571
5293
  }) : geojson;
5572
5294
  };
5295
+ const hasFeatures = geometry => {
5296
+ if (geometry.type === 'Point') {
5297
+ return geometry.coordinates.length > 0;
5298
+ }
5299
+ if (geometry.type === 'LineString' || geometry.type === 'Polygon') {
5300
+ return geometry.coordinates[0].length > 0;
5301
+ }
5302
+ return false;
5303
+ };
5304
+ const getLastEmptyFeatureIndex = geoJSONFeatureCollection => {
5305
+ const totalFeatures = geoJSONFeatureCollection.features.length;
5306
+ if (totalFeatures > 0) {
5307
+ const lastFeatureIndex = totalFeatures - 1;
5308
+ const lastFeature = geoJSONFeatureCollection.features[lastFeatureIndex];
5309
+ if (!hasFeatures(lastFeature.geometry)) {
5310
+ return lastFeatureIndex;
5311
+ }
5312
+ }
5313
+ return undefined;
5314
+ };
5573
5315
  const getFeatureCollection = (geoJSONFeature, shouldAllowMultipleShapes, geoJSONFeatureCollection = emptyGeoJSON) => {
5574
5316
  if (geoJSONFeature.type === 'FeatureCollection') {
5575
5317
  return geoJSONFeature;
5576
5318
  }
5577
5319
  if (shouldAllowMultipleShapes) {
5320
+ const lastFeatureIndex = getLastEmptyFeatureIndex(geoJSONFeatureCollection);
5321
+ if (lastFeatureIndex !== undefined) {
5322
+ // replace last feature if it's an empty shape
5323
+ return Object.assign(Object.assign({}, geoJSONFeatureCollection), {
5324
+ features: geoJSONFeatureCollection.features.map((feature, index) => index === lastFeatureIndex ? geoJSONFeature : feature)
5325
+ });
5326
+ }
5578
5327
  return Object.assign(Object.assign({}, geoJSONFeatureCollection), {
5579
5328
  features: geoJSONFeatureCollection.features.concat(geoJSONFeature)
5580
5329
  });
@@ -5583,15 +5332,14 @@ const getFeatureCollection = (geoJSONFeature, shouldAllowMultipleShapes, geoJSON
5583
5332
  features: [geoJSONFeature]
5584
5333
  });
5585
5334
  };
5586
- // compares 2 geoJSONs and returns true if both have properties.selectionType with the same value
5587
- const isGeoJSONFeatureCreatedByTool = (existingJSON, newGeoJSON) => {
5588
- var _a, _b, _c;
5335
+ // check if geoJSON has same selectionType in properties as passed selectionType
5336
+ const isGeoJSONFeatureCreatedByTool = (existingJSON, selectionType, featureLayerIndex = 0) => {
5337
+ var _a;
5589
5338
  if (!existingJSON.features.length) {
5590
5339
  return false;
5591
5340
  }
5592
- const lastUsedTool = (_a = existingJSON.features[0].properties) === null || _a === void 0 ? void 0 : _a.selectionType;
5593
- const 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;
5594
- return lastUsedTool !== undefined && newTool !== undefined ? lastUsedTool === newTool : false;
5341
+ const lastUsedTool = (_a = existingJSON.features[featureLayerIndex].properties) === null || _a === void 0 ? void 0 : _a.selectionType;
5342
+ return lastUsedTool !== undefined && selectionType !== undefined ? lastUsedTool === selectionType : false;
5595
5343
  };
5596
5344
  const rewindGeometry = geoJSON => {
5597
5345
  return produce(geoJSON, geoJSONDraft => {
@@ -5607,45 +5355,53 @@ const rewindGeometry = geoJSON => {
5607
5355
  }
5608
5356
  });
5609
5357
  };
5358
+ const addGeoJSONPropertiesToFeature = (geoJSONFeature, newProperties) => Object.assign(Object.assign({}, geoJSONFeature), {
5359
+ properties: Object.assign(Object.assign({}, geoJSONFeature.properties), newProperties)
5360
+ });
5361
+ const addGeoJSONProperties = (geoJSON, newProperties) => {
5362
+ if (geoJSON.type === 'Feature') {
5363
+ return addGeoJSONPropertiesToFeature(geoJSON, newProperties);
5364
+ }
5365
+ return Object.assign(Object.assign({}, geoJSON), {
5366
+ features: geoJSON.features.map(feature => addGeoJSONPropertiesToFeature(feature, newProperties))
5367
+ });
5368
+ };
5369
+ const addSelectionTypeToGeoJSON = (geoJSON, selectionType) => {
5370
+ return addGeoJSONProperties(geoJSON, {
5371
+ selectionType
5372
+ });
5373
+ };
5610
5374
 
5611
5375
  const defaultIntersectionStyleProperties = Object.assign(Object.assign({}, defaultGeoJSONStyleProperties), {
5612
5376
  'fill-opacity': 0.5
5613
5377
  });
5614
5378
  const emptyLineString = Object.assign(Object.assign({}, lineString.features[0]), {
5615
- properties: Object.assign(Object.assign({}, defaultGeoJSONStyleProperties), {
5616
- selectionType: 'linestring'
5617
- })
5379
+ properties: defaultGeoJSONStyleProperties
5618
5380
  });
5619
5381
  const emptyPoint = Object.assign(Object.assign({}, featurePoint), {
5620
- properties: Object.assign(Object.assign({}, defaultGeoJSONStyleProperties), {
5621
- selectionType: 'point'
5622
- })
5382
+ properties: defaultGeoJSONStyleProperties
5623
5383
  });
5624
5384
  const emptyPolygon = Object.assign(Object.assign({}, featurePolygon), {
5625
- properties: Object.assign(Object.assign({}, defaultGeoJSONStyleProperties), {
5626
- selectionType: 'poly'
5627
- })
5385
+ properties: defaultGeoJSONStyleProperties
5628
5386
  });
5629
5387
  const emptyBox = Object.assign(Object.assign({}, featurePolygon), {
5630
- properties: Object.assign(Object.assign({}, defaultGeoJSONStyleProperties), {
5631
- selectionType: 'box'
5632
- })
5388
+ properties: defaultGeoJSONStyleProperties
5633
5389
  });
5634
5390
  // TODO: improve this: without a feature, the custom shape does not work on first click
5635
5391
  const emptyIntersectionShape = Object.assign(Object.assign({}, emptyGeoJSON), {
5636
5392
  features: [featurePolygon]
5637
5393
  });
5638
- const getIcon = drawModeId => {
5639
- switch (drawModeId) {
5640
- case 'drawtools-point':
5394
+ const getIcon = selectionType => {
5395
+ switch (selectionType) {
5396
+ case 'point':
5641
5397
  return /*#__PURE__*/React__default.createElement(Location, null);
5642
- case 'drawtools-polygon':
5398
+ case 'poly':
5643
5399
  return /*#__PURE__*/React__default.createElement(DrawPolygon, null);
5644
- case 'drawtools-box':
5400
+ case 'box':
5645
5401
  return /*#__PURE__*/React__default.createElement(DrawRegion, null);
5646
- case 'drawtools-linestring':
5402
+ case 'linestring':
5647
5403
  return /*#__PURE__*/React__default.createElement(Edit, null);
5648
- case 'drawtools-delete':
5404
+ case 'delete':
5649
5405
  return /*#__PURE__*/React__default.createElement(Delete, null);
5650
5406
  default:
5651
5407
  return null;
@@ -5656,35 +5412,40 @@ const defaultPoint = {
5656
5412
  value: DRAWMODE.POINT,
5657
5413
  title: 'Point',
5658
5414
  shape: emptyPoint,
5659
- isSelectable: true
5415
+ isSelectable: true,
5416
+ selectionType: 'point'
5660
5417
  };
5661
5418
  const defaultPolygon = {
5662
5419
  drawModeId: 'drawtools-polygon',
5663
5420
  value: DRAWMODE.POLYGON,
5664
5421
  title: 'Polygon',
5665
5422
  shape: emptyPolygon,
5666
- isSelectable: true
5423
+ isSelectable: true,
5424
+ selectionType: 'poly'
5667
5425
  };
5668
5426
  const defaultBox = {
5669
5427
  drawModeId: 'drawtools-box',
5670
5428
  value: DRAWMODE.BOX,
5671
5429
  title: 'Box',
5672
5430
  shape: emptyBox,
5673
- isSelectable: true
5431
+ isSelectable: true,
5432
+ selectionType: 'box'
5674
5433
  };
5675
5434
  const defaultLineString = {
5676
5435
  drawModeId: 'drawtools-linestring',
5677
5436
  value: DRAWMODE.LINESTRING,
5678
5437
  title: 'LineString',
5679
5438
  shape: emptyLineString,
5680
- isSelectable: true
5439
+ isSelectable: true,
5440
+ selectionType: 'linestring'
5681
5441
  };
5682
5442
  const defaultDelete = {
5683
5443
  drawModeId: 'drawtools-delete',
5684
5444
  value: 'DELETE',
5685
5445
  title: 'Delete',
5686
5446
  shape: emptyGeoJSON,
5687
- isSelectable: false
5447
+ isSelectable: false,
5448
+ selectionType: 'delete'
5688
5449
  };
5689
5450
  const defaultModes = [defaultPoint, defaultPolygon, defaultBox, defaultLineString, defaultDelete];
5690
5451
  const currentlySupportedDrawModes = [defaultPolygon, defaultDelete];
@@ -5712,11 +5473,8 @@ const useMapDrawTool = ({
5712
5473
  const changeProperties = styleProperties => {
5713
5474
  // update all modes with new properties
5714
5475
  const newModes = drawModes.map(mode => {
5715
- const shape = mode.shape.type === 'Feature' ? Object.assign(Object.assign({}, mode.shape), {
5716
- properties: Object.assign(Object.assign({}, mode.shape.properties), styleProperties)
5717
- }) : addFeatureProperties(mode.shape, styleProperties);
5718
5476
  return Object.assign(Object.assign({}, mode), {
5719
- shape
5477
+ shape: addGeoJSONProperties(mode.shape, styleProperties)
5720
5478
  });
5721
5479
  });
5722
5480
  setDrawModes(newModes);
@@ -5739,10 +5497,10 @@ const useMapDrawTool = ({
5739
5497
  }
5740
5498
  setActiveTool(newMode.isSelectable ? newMode.drawModeId : '');
5741
5499
  // updates shape
5742
- const isNewSelectedTool = !isGeoJSONFeatureCreatedByTool(geoJSON, newMode.shape);
5743
- const shouldUpdateShape = !geoJSON.features.length || _shouldAllowMultipleShapes || isNewSelectedTool;
5500
+ const isNewSelectedTool = !isGeoJSONFeatureCreatedByTool(geoJSON, newMode.selectionType, featureLayerIndex);
5501
+ const shouldUpdateShape = !geoJSON.features.length || isNewSelectedTool || !newMode.isSelectable;
5744
5502
  if (shouldUpdateShape) {
5745
- const updatedGeoJSON = changeGeoJSON(newMode.shape);
5503
+ const updatedGeoJSON = changeGeoJSON(addSelectionTypeToGeoJSON(newMode.shape, newMode.selectionType));
5746
5504
  setFeatureLayerIndex(updatedGeoJSON.features.length - 1);
5747
5505
  }
5748
5506
  // handle modes and update feature layer index
@@ -5753,7 +5511,9 @@ const useMapDrawTool = ({
5753
5511
  const geoJSONFeatureCollection = getFeatureCollection(updatedGeoJSON, _shouldAllowMultipleShapes, geoJSON);
5754
5512
  const newGeoJSON = getGeoJson(geoJSONFeatureCollection, _shouldAllowMultipleShapes);
5755
5513
  if (_shouldAllowMultipleShapes) {
5756
- 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);
5757
5517
  if (newFeatureIndex !== undefined) {
5758
5518
  setFeatureLayerIndex(newFeatureIndex);
5759
5519
  }
@@ -5777,10 +5537,21 @@ const useMapDrawTool = ({
5777
5537
  setActiveTool(newActiveTool.drawModeId);
5778
5538
  }
5779
5539
  };
5540
+ const removeLastEmptyShape = () => {
5541
+ const lastFeatureIndex = getLastEmptyFeatureIndex(geoJSON);
5542
+ if (lastFeatureIndex !== undefined) {
5543
+ const newGeoJSON = Object.assign(Object.assign({}, geoJSON), {
5544
+ features: geoJSON.features.filter((_feature, index) => index !== lastFeatureIndex)
5545
+ });
5546
+ setGeoJSON(newGeoJSON);
5547
+ setFeatureLayerIndex(newGeoJSON.features.length > 0 ? newGeoJSON.features.length - 1 : 0);
5548
+ }
5549
+ };
5780
5550
  const deactivateTool = () => {
5781
5551
  setEditMode(false);
5782
5552
  setActiveTool('');
5783
5553
  setDrawMode('');
5554
+ removeLastEmptyShape();
5784
5555
  };
5785
5556
  const reset = (shouldClearState = false) => {
5786
5557
  deactivateTool();
@@ -5834,21 +5605,21 @@ const useMapDrawTool = ({
5834
5605
  };
5835
5606
  };
5836
5607
 
5837
- 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'];
5838
5609
  const fillOptions = [defaultGeoJSONStyleProperties.fill, '#6e1e91', '#FF00FF', '#33ccFF', '#8F8'];
5839
- const strokeWidthOptions = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
5840
- const getToolIcon = id => {
5841
- const defaultIcon = getIcon(id);
5610
+ const strokeWidthOptions = ['10', '9', '8', '7', '6', '5', '4', '3', '2', '1'];
5611
+ const getToolIcon = selectionType => {
5612
+ const defaultIcon = getIcon(selectionType);
5842
5613
  if (defaultIcon) {
5843
5614
  return defaultIcon;
5844
5615
  }
5845
- if (id === 'tool-fir') {
5616
+ if (selectionType === shapeButtonNL$2.selectionType) {
5846
5617
  return /*#__PURE__*/React__default.createElement(DrawFIRLand, null);
5847
5618
  }
5848
- if (id === 'tool-custom-line') {
5619
+ if (selectionType === customLineButton.selectionType) {
5849
5620
  return /*#__PURE__*/React__default.createElement(ArrowUp, null);
5850
5621
  }
5851
- return /*#__PURE__*/React__default.createElement(DrawFIRLand, null);
5622
+ return /*#__PURE__*/React__default.createElement("div", null);
5852
5623
  };
5853
5624
  // custom buttons
5854
5625
  const shapeButtonNL$2 = {
@@ -5856,7 +5627,8 @@ const shapeButtonNL$2 = {
5856
5627
  value: DRAWMODE.POLYGON,
5857
5628
  title: 'Custom FIR NL polygon',
5858
5629
  shape: intersectionFeatureNL,
5859
- isSelectable: false
5630
+ isSelectable: false,
5631
+ selectionType: 'custom-fir'
5860
5632
  };
5861
5633
  const customLineButton = {
5862
5634
  drawModeId: 'tool-custom-line',
@@ -5868,9 +5640,12 @@ const customLineButton = {
5868
5640
  type: 'LineString',
5869
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]]
5870
5642
  },
5871
- properties: defaultGeoJSONStyleProperties
5643
+ properties: Object.assign(Object.assign({}, defaultGeoJSONStyleProperties), {
5644
+ selectionType: 'custom-line'
5645
+ })
5872
5646
  },
5873
- isSelectable: false
5647
+ isSelectable: false,
5648
+ selectionType: 'custom-line'
5874
5649
  };
5875
5650
  const basicExampleDrawOptions = {
5876
5651
  defaultDrawModes: [...defaultModes, shapeButtonNL$2, customLineButton],
@@ -5903,16 +5678,158 @@ const basicExampleMultipleShapeDrawOptions = {
5903
5678
  })
5904
5679
  }))
5905
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
+ });
5906
5823
 
5907
- const getIntersectionToolIcon = id => {
5908
- const defaultIcon = getIcon(id);
5824
+ const getIntersectionToolIcon = selectionType => {
5825
+ const defaultIcon = getIcon(selectionType);
5909
5826
  if (defaultIcon) {
5910
5827
  return defaultIcon;
5911
5828
  }
5912
- if (id === 'fir-nl') {
5829
+ if (selectionType === shapeButtonNL$1.selectionType) {
5913
5830
  return /*#__PURE__*/React__default.createElement(DrawFIRLand, null);
5914
5831
  }
5915
- if (id === 'fir-be') {
5832
+ if (selectionType === shapeButtonBE$1.selectionType) {
5916
5833
  return /*#__PURE__*/React__default.createElement(DrawFIRLand, {
5917
5834
  sx: {
5918
5835
  transform: `scaleY(-1)`
@@ -5927,14 +5844,16 @@ const shapeButtonNL$1 = {
5927
5844
  value: DRAWMODE.POLYGON,
5928
5845
  title: 'Custom FIR NL polygon',
5929
5846
  shape: intersectionFeatureNL,
5930
- isSelectable: false
5847
+ isSelectable: false,
5848
+ selectionType: 'fir-NL'
5931
5849
  };
5932
5850
  const shapeButtonBE$1 = {
5933
5851
  drawModeId: 'fir-be',
5934
5852
  value: DRAWMODE.POLYGON,
5935
5853
  title: 'Custom FIR BE polygon',
5936
5854
  shape: intersectionFeatureBE,
5937
- isSelectable: false
5855
+ isSelectable: false,
5856
+ selectionType: 'fir-BE'
5938
5857
  };
5939
5858
  const geoJSONIntersectionBoundsStyle$1 = {
5940
5859
  stroke: '#000000',
@@ -6025,7 +5944,7 @@ const exampleIntersectionWithShapeOptions = {
6025
5944
  defaultGeoJSONIntersectionProperties: featurePropsIntersectionEnd
6026
5945
  };
6027
5946
 
6028
- const firButtonDrawId = 'fir-button';
5947
+ const firSelectionType = 'fir';
6029
5948
  // styles and shapes
6030
5949
  const featurePropertiesStart = defaultGeoJSONStyleProperties;
6031
5950
  const featurePropertiesEnd = {
@@ -6045,33 +5964,31 @@ const geoJSONIntersectionBoundsStyle = {
6045
5964
  const intersectionShapeNL = {
6046
5965
  type: 'FeatureCollection',
6047
5966
  features: [Object.assign(Object.assign({}, intersectionFeatureNL), {
6048
- properties: Object.assign(Object.assign({}, geoJSONIntersectionBoundsStyle), {
6049
- selectionType: 'fir'
6050
- })
5967
+ properties: Object.assign({}, geoJSONIntersectionBoundsStyle)
6051
5968
  })]
6052
5969
  };
6053
5970
  const intersectionShapeBE = {
6054
5971
  type: 'FeatureCollection',
6055
5972
  features: [Object.assign(Object.assign({}, intersectionFeatureBE), {
6056
- properties: Object.assign(Object.assign({}, geoJSONIntersectionBoundsStyle), {
6057
- selectionType: 'fir'
6058
- })
5973
+ properties: Object.assign({}, geoJSONIntersectionBoundsStyle)
6059
5974
  })]
6060
5975
  };
6061
5976
  // custom buttons
6062
5977
  const shapeButtonNL = {
6063
- drawModeId: firButtonDrawId,
5978
+ drawModeId: 'fir-tool-NL',
6064
5979
  value: DRAWMODE.POLYGON,
6065
5980
  title: 'Custom FIR NL polygon',
6066
5981
  shape: intersectionShapeNL,
6067
- isSelectable: false
5982
+ isSelectable: false,
5983
+ selectionType: firSelectionType
6068
5984
  };
6069
5985
  const shapeButtonBE = {
6070
- drawModeId: firButtonDrawId,
5986
+ drawModeId: 'fir-tool-BE',
6071
5987
  value: DRAWMODE.POLYGON,
6072
5988
  title: 'Custom FIR BE polygon',
6073
5989
  shape: intersectionShapeBE,
6074
- isSelectable: false
5990
+ isSelectable: false,
5991
+ selectionType: firSelectionType
6075
5992
  };
6076
5993
  const exampleIntersectionsMultiDrawTool = [{
6077
5994
  title: 'NL',
@@ -6082,13 +5999,13 @@ const exampleIntersectionsMultiDrawTool = [{
6082
5999
  }];
6083
6000
  const getDoubleControlToolIcon = drawMode => {
6084
6001
  const {
6085
- drawModeId
6002
+ selectionType
6086
6003
  } = drawMode;
6087
- const defaultIcon = getIcon(drawModeId);
6004
+ const defaultIcon = getIcon(selectionType);
6088
6005
  if (defaultIcon) {
6089
6006
  return defaultIcon;
6090
6007
  }
6091
- if (drawModeId === firButtonDrawId) {
6008
+ if (selectionType === firSelectionType) {
6092
6009
  return /*#__PURE__*/React__default.createElement(DrawFIRLand, {
6093
6010
  sx: Object.assign({}, drawMode.title === shapeButtonBE.title && {
6094
6011
  transform: `scaleY(-1)`
@@ -6121,7 +6038,7 @@ const getFirTitle = isNL => isNL ? shapeButtonNL.title : shapeButtonBE.title;
6121
6038
  const updateEditModeButtonsWithFir = (drawModes, newFirGeoJSON) => {
6122
6039
  const isNL = newFirGeoJSON === intersectionShapeNL;
6123
6040
  return drawModes.map(mode => {
6124
- if (mode.drawModeId === firButtonDrawId) {
6041
+ if (mode.selectionType === firSelectionType) {
6125
6042
  return Object.assign(Object.assign({}, mode), {
6126
6043
  shape: getUpdatedFirShape(isNL),
6127
6044
  title: getFirTitle(isNL)
@@ -7611,7 +7528,7 @@ function getIsInsideAcceptanceTime(acceptanceTimeInMinutes, mapDimensions, layer
7611
7528
  if (acceptanceTimeInMinutes === undefined || !mapCurrentTime || !layerCurrentTime) {
7612
7529
  return true;
7613
7530
  }
7614
- const minutesBetween = differenceInMinutes(new Date(mapCurrentTime), new Date(layerCurrentTime));
7531
+ const minutesBetween = dateUtils.differenceInMinutes(new Date(mapCurrentTime), new Date(layerCurrentTime));
7615
7532
  if (Math.abs(minutesBetween) > acceptanceTimeInMinutes) {
7616
7533
  return false;
7617
7534
  }
@@ -7683,8 +7600,8 @@ const setWMLayerPropsBasedOnChildProps = (child, wmLayer, mapViewProps) => {
7683
7600
  }
7684
7601
  /* Set the dimensions of the ADAGUC WMJSLayer */
7685
7602
  if (child.dimensions !== undefined) {
7686
- for (let d = 0; d < child.dimensions.length; d += 1) {
7687
- const dim = child.dimensions[d];
7603
+ for (const childDimension of child.dimensions) {
7604
+ const dim = childDimension;
7688
7605
  const wmjsDim = wmLayer.getDimension(dim.name);
7689
7606
  if (wmjsDim) {
7690
7607
  if (wmjsDim.currentValue !== dim.currentValue) {
@@ -7778,7 +7695,7 @@ const orderLayers = (wmjsMap, _reactMapViewLayers) => {
7778
7695
  const getDisplayText = currentAdagucTime => {
7779
7696
  const timeFormat = 'eee dd MMM yyyy HH:mm [UTC]';
7780
7697
  const adagucTime = dateUtils.utc(currentAdagucTime);
7781
- const adagucTimeFormatted = dateUtils.dateToString(adagucTime, timeFormat);
7698
+ const adagucTimeFormatted = dateUtils.dateToString(adagucTime, timeFormat) || '';
7782
7699
  return adagucTimeFormatted;
7783
7700
  };
7784
7701
  const ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION = 'ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION';
@@ -7870,7 +7787,8 @@ class ReactMapView extends React.Component {
7870
7787
  }
7871
7788
  componentWillUnmount() {
7872
7789
  const {
7873
- mapId
7790
+ mapId,
7791
+ onWMJSUnMount
7874
7792
  } = this.props;
7875
7793
  window.removeEventListener('resize', this.handleWindowResize);
7876
7794
  this.clearRefetchTimer();
@@ -7882,6 +7800,7 @@ class ReactMapView extends React.Component {
7882
7800
  this.adaguc.baseLayers = [];
7883
7801
  this.adaguc.oldbbox = new WMBBOX();
7884
7802
  this.adaguc.currentChildren = [];
7803
+ onWMJSUnMount && onWMJSUnMount(mapId);
7885
7804
  }
7886
7805
  handleWindowResize() {
7887
7806
  this.resize();
@@ -7980,8 +7899,7 @@ class ReactMapView extends React.Component {
7980
7899
  /* Check map dimensions */
7981
7900
  if (!prevProps || prevProps.dimensions !== props.dimensions) {
7982
7901
  if (props.dimensions) {
7983
- for (let d = 0; d < props.dimensions.length; d += 1) {
7984
- const propDimension = props.dimensions[d];
7902
+ for (const propDimension of props.dimensions) {
7985
7903
  const mapDim = wmjsMap.getDimension(propDimension.name);
7986
7904
  if (mapDim && mapDim.currentValue !== propDimension.currentValue || !mapDim) {
7987
7905
  wmjsMap.setDimension(propDimension.name, propDimension.currentValue, false, false);
@@ -8323,6 +8241,7 @@ ReactMapView.defaultProps = {
8323
8241
  displayMapPin: false,
8324
8242
  disableMapPin: false,
8325
8243
  onWMJSMount: () => {},
8244
+ onWMJSUnMount: () => {},
8326
8245
  onMapChangeDimension: () => {
8327
8246
  /* nothing */
8328
8247
  },
@@ -8855,6 +8774,289 @@ const MapWarningProperties = ({
8855
8774
  }, "Identifier: ", selectedFeatureProperties.identifier))));
8856
8775
  };
8857
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
+
8858
9060
  /* *
8859
9061
  * Licensed under the Apache License, Version 2.0 (the "License");
8860
9062
  * you may not use this file except in compliance with the License.
@@ -8893,9 +9095,9 @@ const overLayer = {
8893
9095
  };
8894
9096
 
8895
9097
  var defaultLayers = /*#__PURE__*/Object.freeze({
8896
- __proto__: null,
8897
- baseLayerGrey: baseLayerGrey,
8898
- overLayer: overLayer
9098
+ __proto__: null,
9099
+ baseLayerGrey: baseLayerGrey,
9100
+ overLayer: overLayer
8899
9101
  });
8900
9102
 
8901
9103
  /* *
@@ -9011,26 +9213,26 @@ const MeteoCanada = {
9011
9213
  };
9012
9214
 
9013
9215
  var publicServices = /*#__PURE__*/Object.freeze({
9014
- __proto__: null,
9015
- DWD: DWD,
9016
- nationaalgeoregister: nationaalgeoregister,
9017
- KNMImsgcpp: KNMImsgcpp,
9018
- HeiGit: HeiGit,
9019
- ArcGisCanvas: ArcGisCanvas,
9020
- KNMIgeoservicesRadar: KNMIgeoservicesRadar,
9021
- KNMIgeoservicesObs: KNMIgeoservicesObs,
9022
- KNMIgeoservicesKlimaatAtlas: KNMIgeoservicesKlimaatAtlas,
9023
- KNMIgeoservicesHarmonie: KNMIgeoservicesHarmonie,
9024
- KNMIgeoservicesHarmonieMLService: KNMIgeoservicesHarmonieMLService,
9025
- MetNorwayService: MetNorwayService,
9026
- FMIopenwms: FMIopenwms,
9027
- DWDObservations: DWDObservations,
9028
- DWDWarnings: DWDWarnings,
9029
- DWDWXProdukt: DWDWXProdukt,
9030
- EUMETSAT: EUMETSAT,
9031
- eumetviewEUMETSAT: eumetviewEUMETSAT,
9032
- ECMWFPublicService: ECMWFPublicService,
9033
- 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
9034
9236
  });
9035
9237
 
9036
9238
  /* *
@@ -9370,49 +9572,49 @@ const msgNaturalEUMETSAT = {
9370
9572
  };
9371
9573
 
9372
9574
  var publicLayers = /*#__PURE__*/Object.freeze({
9373
- __proto__: null,
9374
- defaultLayers: defaultLayers,
9375
- baseLayer: baseLayer,
9376
- baseLayerOpenStreetMapNL: baseLayerOpenStreetMapNL,
9377
- baseLayerArcGisCanvas: baseLayerArcGisCanvas,
9378
- baseLayerWorldMap: baseLayerWorldMap,
9379
- baseLayerHeiGit: baseLayerHeiGit,
9380
- msgCppLayer: msgCppLayer,
9381
- veiligheidsRegiosGebiedsIndelingenLabels: veiligheidsRegiosGebiedsIndelingenLabels,
9382
- veiligheidsRegiosGebiedsIndelingen: veiligheidsRegiosGebiedsIndelingen,
9383
- radarLayer: radarLayer,
9384
- radarLayerWithError: radarLayerWithError,
9385
- obsAirTemperature: obsAirTemperature,
9386
- obsWind: obsWind,
9387
- obsAirPressureAtSeaLevel: obsAirPressureAtSeaLevel,
9388
- obsRelativeHumidity: obsRelativeHumidity,
9389
- obsGlobalSolarRadiation: obsGlobalSolarRadiation,
9390
- obsPrecipitationIntensityPWS: obsPrecipitationIntensityPWS,
9391
- harmonieRelativeHumidityPl: harmonieRelativeHumidityPl,
9392
- harmonieWindPl: harmonieWindPl,
9393
- harmonieAirTemperature: harmonieAirTemperature,
9394
- harmoniePrecipitation: harmoniePrecipitation,
9395
- harmoniePressure: harmoniePressure,
9396
- harmonieWindFlags: harmonieWindFlags,
9397
- klimaatAtlasTG3: klimaatAtlasTG3,
9398
- dwdWarningLayer: dwdWarningLayer,
9399
- dwdRadarLayer: dwdRadarLayer,
9400
- dwdObservationsWetterLayer: dwdObservationsWetterLayer,
9401
- dwdObservationsWetterLayerWithHeader: dwdObservationsWetterLayerWithHeader,
9402
- dwdObservationsWindLayer: dwdObservationsWindLayer,
9403
- FMITemp: FMITemp,
9404
- MetNoTemp: MetNoTemp,
9405
- metNorwayWind1: metNorwayWind1,
9406
- metNorwayWind2: metNorwayWind2,
9407
- metNorwayWind3: metNorwayWind3,
9408
- metNorwayLatestT: metNorwayLatestT,
9409
- metNorwaySalinaty: metNorwaySalinaty,
9410
- msgFesEUMETSAT: msgFesEUMETSAT,
9411
- msgNaturalenhncdEUMETSAT: msgNaturalenhncdEUMETSAT,
9412
- msgAshEUMETSAT: msgAshEUMETSAT,
9413
- msgCthEUMETSAT: msgCthEUMETSAT,
9414
- msgFogEUMETSAT: msgFogEUMETSAT,
9415
- 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
9416
9618
  });
9417
9619
 
9418
- 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, 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, firButtonDrawId, formatTime, getDoubleControlToolIcon, getDrawFunctionFromStore, getFeatureCollection, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, 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 };