@opengeoweb/webmap-react 9.25.2 → 9.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +177 -99
- package/package.json +1 -1
- package/src/lib/components/MapDraw/MapDraw.d.ts +10 -10
- package/src/lib/components/MapDraw/MapDraw.stories.d.ts +4 -0
- package/src/lib/components/MapDraw/geojsonShapes.d.ts +0 -2
- package/src/lib/components/MapDraw/mapDrawUtils.d.ts +3 -3
- package/src/lib/components/MapDraw/storyComponents/geojsonExamples.d.ts +12 -11
- package/src/lib/components/ReactMapView/ReactMapView.d.ts +1 -1
- package/src/lib/layers/defaultStorybookSettings.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { useRef, useState, useEffect } from 'react';
|
|
4
4
|
import { legendImageStore, WMImageEventType, webmapUtils, getLegendGraphicURLForLayer, getPixelCoordFromLatLong, WMJSMAP_LONLAT_EPSGCODE, getLatLongFromPixelCoord, LayerType, getWMJSMapById, debugLogger, DebugType, WMLayer, registerWMLayer, WMBBOX, getWMLayerById, WMJSMap, tilesettings } from '@opengeoweb/webmap';
|
|
5
|
-
import { CustomTooltip, CanvasComponent, ToolContainerDraggable, CustomIconButton, dateUtils } from '@opengeoweb/shared';
|
|
5
|
+
import { CustomTooltip, CanvasComponent, ToolContainerDraggable, CustomIconButton, dateUtils, PROJECTION } from '@opengeoweb/shared';
|
|
6
6
|
import i18n from 'i18next';
|
|
7
7
|
import { initReactI18next, useTranslation } from 'react-i18next';
|
|
8
8
|
import { Paper, Box, Typography, Grid, TextField, FormControl, InputLabel, Select, MenuItem, Icon as Icon$1, FormLabel, Switch, styled, Slider } from '@mui/material';
|
|
@@ -2826,10 +2826,18 @@ const findClosestCoords = (positions, mouseX, mouseY) => {
|
|
|
2826
2826
|
});
|
|
2827
2827
|
return closestIndexes;
|
|
2828
2828
|
};
|
|
2829
|
-
const checkHoverVertice = (feature, mouseX, mouseY, convertGeoCoordsToScreenCoords, ignoreCoordinateIndexInFeature) => {
|
|
2829
|
+
const checkHoverVertice = (feature, mouseX, mouseY, convertGeoCoordsToScreenCoords, ignoreCoordinateIndexInFeature, geometry = feature.geometry) => {
|
|
2830
2830
|
const maxDistance = 20;
|
|
2831
|
-
if (
|
|
2832
|
-
const
|
|
2831
|
+
if (geometry.type === 'GeometryCollection') {
|
|
2832
|
+
for (const geom of geometry.geometries) {
|
|
2833
|
+
const result = checkHoverVertice(feature, mouseX, mouseY, convertGeoCoordsToScreenCoords, ignoreCoordinateIndexInFeature, geom);
|
|
2834
|
+
if (result) {
|
|
2835
|
+
return result;
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
if (geometry.type === 'Point') {
|
|
2840
|
+
const featureCoords = geometry.coordinates;
|
|
2833
2841
|
/* Get all vertexes */
|
|
2834
2842
|
const XYCoords = convertGeoCoordsToScreenCoords([featureCoords]);
|
|
2835
2843
|
const calculatedDistance = XYCoords.length > 0 ? distance(XYCoords[0], {
|
|
@@ -2844,9 +2852,9 @@ const checkHoverVertice = (feature, mouseX, mouseY, convertGeoCoordsToScreenCoor
|
|
|
2844
2852
|
};
|
|
2845
2853
|
}
|
|
2846
2854
|
}
|
|
2847
|
-
if (
|
|
2848
|
-
for (let polygonIndex =
|
|
2849
|
-
const featureCoords =
|
|
2855
|
+
if (geometry.type === 'MultiPoint') {
|
|
2856
|
+
for (let polygonIndex = geometry.coordinates.length - 1; polygonIndex >= 0; polygonIndex -= 1) {
|
|
2857
|
+
const featureCoords = geometry.coordinates[polygonIndex];
|
|
2850
2858
|
if (featureCoords === undefined) {
|
|
2851
2859
|
// eslint-disable-next-line no-continue
|
|
2852
2860
|
continue;
|
|
@@ -2866,10 +2874,10 @@ const checkHoverVertice = (feature, mouseX, mouseY, convertGeoCoordsToScreenCoor
|
|
|
2866
2874
|
}
|
|
2867
2875
|
}
|
|
2868
2876
|
}
|
|
2869
|
-
if (
|
|
2877
|
+
if (geometry.type === 'Polygon') {
|
|
2870
2878
|
const point = [mouseX, mouseY];
|
|
2871
|
-
for (let polygonIndex =
|
|
2872
|
-
const featureCoords =
|
|
2879
|
+
for (let polygonIndex = geometry.coordinates.length - 1; polygonIndex >= 0; polygonIndex -= 1) {
|
|
2880
|
+
const featureCoords = geometry.coordinates[polygonIndex];
|
|
2873
2881
|
if (featureCoords === undefined) {
|
|
2874
2882
|
// eslint-disable-next-line no-continue
|
|
2875
2883
|
continue;
|
|
@@ -2905,10 +2913,10 @@ const checkHoverVertice = (feature, mouseX, mouseY, convertGeoCoordsToScreenCoor
|
|
|
2905
2913
|
}
|
|
2906
2914
|
}
|
|
2907
2915
|
}
|
|
2908
|
-
if (
|
|
2916
|
+
if (geometry.type === 'MultiPolygon') {
|
|
2909
2917
|
const point = [mouseX, mouseY];
|
|
2910
|
-
for (let polygonIndex =
|
|
2911
|
-
const featureCoords =
|
|
2918
|
+
for (let polygonIndex = geometry.coordinates.length - 1; polygonIndex >= 0; polygonIndex -= 1) {
|
|
2919
|
+
const featureCoords = geometry.coordinates[polygonIndex][0];
|
|
2912
2920
|
if (featureCoords === undefined) {
|
|
2913
2921
|
// eslint-disable-next-line no-continue
|
|
2914
2922
|
continue;
|
|
@@ -2933,10 +2941,9 @@ const checkHoverVertice = (feature, mouseX, mouseY, convertGeoCoordsToScreenCoor
|
|
|
2933
2941
|
}
|
|
2934
2942
|
}
|
|
2935
2943
|
}
|
|
2936
|
-
if (
|
|
2937
|
-
const featureCoords = feature.geometry.coordinates;
|
|
2944
|
+
if (geometry.type === 'LineString') {
|
|
2938
2945
|
/* Get all vertexes */
|
|
2939
|
-
const XYCoords = convertGeoCoordsToScreenCoords(
|
|
2946
|
+
const XYCoords = convertGeoCoordsToScreenCoords(geometry.coordinates);
|
|
2940
2947
|
/* Snap to the vertex closer than specified pixels */
|
|
2941
2948
|
for (let j = 0; j < XYCoords.length; j += 1) {
|
|
2942
2949
|
const coord = XYCoords[j];
|
|
@@ -3021,6 +3028,7 @@ const NEW_POINT_CREATED = translateKeyOutsideComponents('webmap-react-new-point'
|
|
|
3021
3028
|
*
|
|
3022
3029
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3023
3030
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
3031
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3024
3032
|
* */
|
|
3025
3033
|
const defaultGeoJSONStyleProperties = {
|
|
3026
3034
|
fill: '#ff7800',
|
|
@@ -3145,7 +3153,7 @@ class MapDraw extends React.PureComponent {
|
|
|
3145
3153
|
constructor(props) {
|
|
3146
3154
|
super(props);
|
|
3147
3155
|
this.handleGeoJSONUpdate = newGeoJSON => {
|
|
3148
|
-
var _a;
|
|
3156
|
+
var _a, _b;
|
|
3149
3157
|
const {
|
|
3150
3158
|
selectedFeatureIndex,
|
|
3151
3159
|
mapId
|
|
@@ -3154,13 +3162,15 @@ class MapDraw extends React.PureComponent {
|
|
|
3154
3162
|
/* Ensure that this.snappedPolygonIndex is still within the coordinates array */
|
|
3155
3163
|
if (((_a = this.geojson) === null || _a === void 0 ? void 0 : _a.features) && selectedFeatureIndex < this.geojson.features.length) {
|
|
3156
3164
|
const feature = this.getSelectedFeature();
|
|
3157
|
-
if (feature.geometry) {
|
|
3165
|
+
if (((_b = feature.geometry) === null || _b === void 0 ? void 0 : _b.type) === 'Polygon') {
|
|
3158
3166
|
const {
|
|
3159
3167
|
coordinates
|
|
3160
3168
|
} = feature.geometry;
|
|
3161
3169
|
if (Number(this.snappedPolygonIndex) > coordinates.length - 1) {
|
|
3162
3170
|
this.snappedPolygonIndex = coordinates.length - 1;
|
|
3163
3171
|
}
|
|
3172
|
+
} else {
|
|
3173
|
+
this.snappedPolygonIndex = SNAPPEDFEATURE.NONE;
|
|
3164
3174
|
}
|
|
3165
3175
|
}
|
|
3166
3176
|
const webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
@@ -3174,8 +3184,8 @@ class MapDraw extends React.PureComponent {
|
|
|
3174
3184
|
if (this.myDrawMode === DRAWMODE.POLYGON && this.myEditMode === EDITMODE.ADD_FEATURE) {
|
|
3175
3185
|
const currentFeature = this.getSelectedFeature();
|
|
3176
3186
|
const currentGeometry = currentFeature.geometry;
|
|
3177
|
-
const coordinates = currentGeometry.coordinates[0];
|
|
3178
3187
|
if (currentGeometry.type === 'Polygon') {
|
|
3188
|
+
const coordinates = currentGeometry.coordinates[0];
|
|
3179
3189
|
const firstElement = coordinates[0];
|
|
3180
3190
|
coordinates[this.mouseIsOverVertexNr] = cloneDeep(firstElement);
|
|
3181
3191
|
}
|
|
@@ -3356,7 +3366,7 @@ class MapDraw extends React.PureComponent {
|
|
|
3356
3366
|
mapId
|
|
3357
3367
|
} = this.props;
|
|
3358
3368
|
const feature = this.getSelectedFeature();
|
|
3359
|
-
if (feature) {
|
|
3369
|
+
if (feature && feature.geometry.type !== 'GeometryCollection') {
|
|
3360
3370
|
const featureCoords = feature.geometry.coordinates;
|
|
3361
3371
|
this.mouseIsOverVertexNr = featureCoords.length - 1;
|
|
3362
3372
|
}
|
|
@@ -3944,11 +3954,13 @@ class MapDraw extends React.PureComponent {
|
|
|
3944
3954
|
deletePolygonCallback
|
|
3945
3955
|
} = this.props;
|
|
3946
3956
|
const feature = this.getSelectedFeature();
|
|
3947
|
-
feature.geometry.
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3957
|
+
if (feature.geometry.type !== 'GeometryCollection') {
|
|
3958
|
+
feature.geometry.coordinates.splice(index, 1);
|
|
3959
|
+
if (deletePolygonCallback) {
|
|
3960
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3961
|
+
// @ts-ignore
|
|
3962
|
+
deletePolygonCallback();
|
|
3963
|
+
}
|
|
3952
3964
|
}
|
|
3953
3965
|
}
|
|
3954
3966
|
deleteFeature() {
|
|
@@ -4099,9 +4111,12 @@ class MapDraw extends React.PureComponent {
|
|
|
4099
4111
|
}
|
|
4100
4112
|
}
|
|
4101
4113
|
moveVertex(feature, mouseDown) {
|
|
4102
|
-
const
|
|
4114
|
+
const geometryType = feature.geometry.type;
|
|
4115
|
+
if (geometryType === 'GeometryCollection') {
|
|
4116
|
+
return undefined;
|
|
4117
|
+
}
|
|
4103
4118
|
let featureCoords = feature.geometry.coordinates[this.snappedPolygonIndex];
|
|
4104
|
-
if (
|
|
4119
|
+
if (geometryType === 'Point' || geometryType === 'MultiPoint' || geometryType === 'LineString') {
|
|
4105
4120
|
featureCoords = feature.geometry.coordinates;
|
|
4106
4121
|
}
|
|
4107
4122
|
if (!featureCoords) {
|
|
@@ -4109,7 +4124,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4109
4124
|
}
|
|
4110
4125
|
const vertexSelected = mouseDown === true && this.mouseIsOverVertexNr !== VERTEX.NONE;
|
|
4111
4126
|
if (vertexSelected || this.myEditMode === EDITMODE.ADD_FEATURE) {
|
|
4112
|
-
if (
|
|
4127
|
+
if (geometryType === 'LineString') {
|
|
4113
4128
|
this.transposeVertex(featureCoords);
|
|
4114
4129
|
// eslint-disable-next-line consistent-return
|
|
4115
4130
|
return false;
|
|
@@ -4237,7 +4252,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4237
4252
|
}
|
|
4238
4253
|
}
|
|
4239
4254
|
// eslint-disable-next-line class-methods-use-this
|
|
4240
|
-
|
|
4255
|
+
initializeFeature(feature) {
|
|
4241
4256
|
if (!feature.properties) {
|
|
4242
4257
|
feature.properties = {};
|
|
4243
4258
|
}
|
|
@@ -4247,7 +4262,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4247
4262
|
if (!feature.type) {
|
|
4248
4263
|
feature.type = 'Feature';
|
|
4249
4264
|
}
|
|
4250
|
-
if (!feature.geometry.coordinates) {
|
|
4265
|
+
if (feature.geometry.type !== 'GeometryCollection' && !feature.geometry.coordinates) {
|
|
4251
4266
|
feature.geometry.coordinates = [];
|
|
4252
4267
|
}
|
|
4253
4268
|
}
|
|
@@ -4258,7 +4273,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4258
4273
|
}
|
|
4259
4274
|
for (const geoJsonFeature of this.geojson.features) {
|
|
4260
4275
|
const feature = geoJsonFeature;
|
|
4261
|
-
this.
|
|
4276
|
+
this.initializeFeature(feature);
|
|
4262
4277
|
const featureType = feature.geometry.type;
|
|
4263
4278
|
if (featureType === 'Polygon') {
|
|
4264
4279
|
/* Loop through all polygons of the same feature */
|
|
@@ -4327,28 +4342,16 @@ class MapDraw extends React.PureComponent {
|
|
|
4327
4342
|
this.textPositions = [];
|
|
4328
4343
|
this.mouseOverPolygonCoordinates = [];
|
|
4329
4344
|
this.mouseOverPolygonFeatureIndex = -1;
|
|
4330
|
-
const
|
|
4345
|
+
const drawFeatureGeometry = (feature, featureIndex, geometry = feature.geometry) => {
|
|
4331
4346
|
var _a, _b, _c;
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
y: 0,
|
|
4336
|
-
nr: 0
|
|
4337
|
-
};
|
|
4338
|
-
if (featureType === 'Point') {
|
|
4339
|
-
const featureCoords = feature.geometry.coordinates;
|
|
4340
|
-
const XYCoords = getPixelCoordFromGeoCoord([featureCoords], mapId);
|
|
4341
|
-
if (XYCoords.length === 0) {
|
|
4342
|
-
// eslint-disable-next-line no-continue
|
|
4343
|
-
return;
|
|
4344
|
-
}
|
|
4345
|
-
for (let j = 0; j < XYCoords.length; j += 1) {
|
|
4346
|
-
this.drawPoint(ctx, XYCoords[j], this.mouseIsOverVertexNr === j && selectedFeatureIndex === featureIndex, false, isInEditMode && selectedFeatureIndex === featureIndex, feature, featureIndex);
|
|
4347
|
+
if (geometry.type === 'GeometryCollection') {
|
|
4348
|
+
for (const geom of geometry.geometries) {
|
|
4349
|
+
drawFeatureGeometry(feature, featureIndex, geom);
|
|
4347
4350
|
}
|
|
4348
4351
|
}
|
|
4349
|
-
if (
|
|
4350
|
-
const
|
|
4351
|
-
const XYCoords = getPixelCoordFromGeoCoord(
|
|
4352
|
+
if (geometry.type === 'Point' || geometry.type === 'MultiPoint') {
|
|
4353
|
+
const coordinates = geometry.type === 'Point' ? [geometry.coordinates] : geometry.coordinates;
|
|
4354
|
+
const XYCoords = getPixelCoordFromGeoCoord(coordinates, mapId);
|
|
4352
4355
|
if (XYCoords.length === 0) {
|
|
4353
4356
|
return;
|
|
4354
4357
|
}
|
|
@@ -4356,12 +4359,16 @@ class MapDraw extends React.PureComponent {
|
|
|
4356
4359
|
this.drawPoint(ctx, XYCoords[j], this.mouseIsOverVertexNr === j && selectedFeatureIndex === featureIndex, false, isInEditMode && selectedFeatureIndex === featureIndex, feature, featureIndex);
|
|
4357
4360
|
}
|
|
4358
4361
|
}
|
|
4359
|
-
if (
|
|
4360
|
-
const
|
|
4361
|
-
|
|
4362
|
+
if (geometry.type === 'MultiPolygon') {
|
|
4363
|
+
const totalMiddle = {
|
|
4364
|
+
x: 0,
|
|
4365
|
+
y: 0,
|
|
4366
|
+
nr: 0
|
|
4367
|
+
};
|
|
4368
|
+
for (const multiPoly of geometry.coordinates) {
|
|
4362
4369
|
for (let polygonIndex = 0; polygonIndex < multiPoly.length; polygonIndex += 1) {
|
|
4363
|
-
const
|
|
4364
|
-
const XYCoords = getPixelCoordFromGeoCoord(
|
|
4370
|
+
const ringCoordinates = multiPoly[polygonIndex];
|
|
4371
|
+
const XYCoords = getPixelCoordFromGeoCoord(ringCoordinates, mapId);
|
|
4365
4372
|
/* Only draw if there is stuff to show */
|
|
4366
4373
|
if (XYCoords.length === 0) {
|
|
4367
4374
|
// eslint-disable-next-line no-continue
|
|
@@ -4369,9 +4376,9 @@ class MapDraw extends React.PureComponent {
|
|
|
4369
4376
|
}
|
|
4370
4377
|
const middle = this.drawPolygon(ctx, XYCoords, featureIndex, polygonIndex);
|
|
4371
4378
|
if (middle) {
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4379
|
+
totalMiddle.x += middle.x * middle.nr;
|
|
4380
|
+
totalMiddle.y += middle.y * middle.nr;
|
|
4381
|
+
totalMiddle.nr += middle.nr;
|
|
4375
4382
|
}
|
|
4376
4383
|
if (isInEditMode) {
|
|
4377
4384
|
/* Draw all vertices on the edges of the polygons */
|
|
@@ -4385,9 +4392,9 @@ class MapDraw extends React.PureComponent {
|
|
|
4385
4392
|
}
|
|
4386
4393
|
}
|
|
4387
4394
|
}
|
|
4388
|
-
if (
|
|
4389
|
-
const mx =
|
|
4390
|
-
const my =
|
|
4395
|
+
if (totalMiddle.nr > 0) {
|
|
4396
|
+
const mx = totalMiddle.x / totalMiddle.nr;
|
|
4397
|
+
const my = totalMiddle.y / totalMiddle.nr;
|
|
4391
4398
|
if ((_a = feature.properties) === null || _a === void 0 ? void 0 : _a.text) {
|
|
4392
4399
|
this.textPositions.push({
|
|
4393
4400
|
x: mx,
|
|
@@ -4397,11 +4404,10 @@ class MapDraw extends React.PureComponent {
|
|
|
4397
4404
|
}
|
|
4398
4405
|
}
|
|
4399
4406
|
}
|
|
4400
|
-
if (
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
const featureCoords = polygonGeometry.coordinates[polygonIndex];
|
|
4407
|
+
if (geometry.type === 'Polygon') {
|
|
4408
|
+
/* Loop through all rings of the same polygon */
|
|
4409
|
+
for (let polygonIndex = 0; polygonIndex < geometry.coordinates.length; polygonIndex += 1) {
|
|
4410
|
+
const featureCoords = geometry.coordinates[polygonIndex];
|
|
4405
4411
|
const XYCoords = getPixelCoordFromGeoCoord(featureCoords, mapId);
|
|
4406
4412
|
/* Only draw if there is stuff to show */
|
|
4407
4413
|
if (XYCoords.length === 0) {
|
|
@@ -4431,9 +4437,9 @@ class MapDraw extends React.PureComponent {
|
|
|
4431
4437
|
}
|
|
4432
4438
|
}
|
|
4433
4439
|
}
|
|
4434
|
-
if (
|
|
4440
|
+
if (geometry.type === 'LineString') {
|
|
4435
4441
|
/* Loop through all line pints of the same feature */
|
|
4436
|
-
const featureCoords =
|
|
4442
|
+
const featureCoords = geometry.coordinates;
|
|
4437
4443
|
if (!featureCoords || !featureCoords.length) {
|
|
4438
4444
|
return;
|
|
4439
4445
|
}
|
|
@@ -4463,11 +4469,11 @@ class MapDraw extends React.PureComponent {
|
|
|
4463
4469
|
const feature = this.geojson.features[featureIndex];
|
|
4464
4470
|
/* Do not draw selected feature here, should be done last */
|
|
4465
4471
|
if (featureIndex !== selectedFeatureIndex) {
|
|
4466
|
-
|
|
4472
|
+
drawFeatureGeometry(feature, featureIndex);
|
|
4467
4473
|
}
|
|
4468
4474
|
}
|
|
4469
4475
|
/* Draw selected feature to display it on top */
|
|
4470
|
-
|
|
4476
|
+
drawFeatureGeometry(this.getSelectedFeature(), selectedFeatureIndex);
|
|
4471
4477
|
/* Higlight polygon with mousehover */
|
|
4472
4478
|
if (isInEditMode === true && this.mouseOverPolygonFeatureIndex === selectedFeatureIndex && this.mouseIsOverVertexNr === VERTEX.NONE && this.snappedPolygonIndex === SNAPPEDFEATURE.NONE && this.selectedEdge === EDGE.NONE || this.mouseIsOverVertexNr === VERTEX.MIDDLE_POINT_OF_FEATURE) {
|
|
4473
4479
|
const feature = this.getSelectedFeature();
|
|
@@ -4543,12 +4549,17 @@ class MapDraw extends React.PureComponent {
|
|
|
4543
4549
|
mapId
|
|
4544
4550
|
} = this.props;
|
|
4545
4551
|
const {
|
|
4546
|
-
|
|
4547
|
-
type
|
|
4552
|
+
type: geometryType
|
|
4548
4553
|
} = geometry;
|
|
4549
|
-
if (
|
|
4550
|
-
|
|
4551
|
-
|
|
4554
|
+
if (geometryType === 'GeometryCollection') {
|
|
4555
|
+
return {
|
|
4556
|
+
selectedEdge: EDGE.NONE,
|
|
4557
|
+
snappedPolygonIndex: SNAPPEDFEATURE.NONE
|
|
4558
|
+
};
|
|
4559
|
+
}
|
|
4560
|
+
if (geometryType === 'Polygon') {
|
|
4561
|
+
for (let polygonIndex = geometry.coordinates.length - 1; polygonIndex >= 0; polygonIndex -= 1) {
|
|
4562
|
+
const featureCoords = geometry.coordinates[polygonIndex];
|
|
4552
4563
|
if (featureCoords === undefined) {
|
|
4553
4564
|
// eslint-disable-next-line no-continue
|
|
4554
4565
|
continue;
|
|
@@ -4574,8 +4585,8 @@ class MapDraw extends React.PureComponent {
|
|
|
4574
4585
|
snappedPolygonIndex: SNAPPEDFEATURE.NONE
|
|
4575
4586
|
};
|
|
4576
4587
|
}
|
|
4577
|
-
if (
|
|
4578
|
-
const featureCoords = coordinates;
|
|
4588
|
+
if (geometryType === 'LineString') {
|
|
4589
|
+
const featureCoords = geometry.coordinates;
|
|
4579
4590
|
if (featureCoords === undefined) {
|
|
4580
4591
|
return {
|
|
4581
4592
|
selectedEdge: EDGE.NONE,
|
|
@@ -4822,10 +4833,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4822
4833
|
selectedFeatureIndex
|
|
4823
4834
|
} = this.props;
|
|
4824
4835
|
const feature = this.geojson.features[featureIndex];
|
|
4825
|
-
if (!(feature === null || feature === void 0 ? void 0 : feature.geometry)) {
|
|
4826
|
-
return;
|
|
4827
|
-
}
|
|
4828
|
-
if (feature.geometry.type !== 'Polygon' && feature.geometry.type !== 'MultiPolygon') {
|
|
4836
|
+
if (!(feature === null || feature === void 0 ? void 0 : feature.geometry) || XYCoords.length === 0) {
|
|
4829
4837
|
return;
|
|
4830
4838
|
}
|
|
4831
4839
|
let polyProps = feature.properties;
|
|
@@ -4892,7 +4900,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4892
4900
|
return middle;
|
|
4893
4901
|
}
|
|
4894
4902
|
initializeFeatureCoordinates(feature, type) {
|
|
4895
|
-
this.
|
|
4903
|
+
this.initializeFeature(feature);
|
|
4896
4904
|
// eslint-disable-next-line no-underscore-dangle
|
|
4897
4905
|
if (feature.properties._type) {
|
|
4898
4906
|
delete feature.properties._type;
|
|
@@ -4904,27 +4912,32 @@ class MapDraw extends React.PureComponent {
|
|
|
4904
4912
|
break;
|
|
4905
4913
|
case DRAWMODE.MULTIPOINT:
|
|
4906
4914
|
feature.geometry.type = 'MultiPoint';
|
|
4907
|
-
if (feature.geometry.coordinates.length === 0) {
|
|
4908
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4909
|
-
feature.geometry.coordinates.push([]);
|
|
4910
|
-
}
|
|
4911
4915
|
break;
|
|
4912
4916
|
case DRAWMODE.BOX:
|
|
4913
4917
|
feature.geometry.type = 'Polygon';
|
|
4914
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
4915
4918
|
feature.properties._type = 'box';
|
|
4916
4919
|
break;
|
|
4917
4920
|
case DRAWMODE.POLYGON:
|
|
4918
4921
|
feature.geometry.type = 'Polygon';
|
|
4922
|
+
break;
|
|
4923
|
+
case DRAWMODE.LINESTRING:
|
|
4924
|
+
feature.geometry.type = 'LineString';
|
|
4925
|
+
break;
|
|
4926
|
+
}
|
|
4927
|
+
// eslint-disable-next-line default-case
|
|
4928
|
+
switch (feature.geometry.type) {
|
|
4929
|
+
case 'MultiPoint':
|
|
4919
4930
|
if (feature.geometry.coordinates.length === 0) {
|
|
4920
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4921
4931
|
feature.geometry.coordinates.push([]);
|
|
4922
4932
|
}
|
|
4923
4933
|
break;
|
|
4924
|
-
case
|
|
4925
|
-
feature.
|
|
4934
|
+
case 'Polygon':
|
|
4935
|
+
if (feature.properties._type !== 'box' && feature.geometry.coordinates.length === 0) {
|
|
4936
|
+
feature.geometry.coordinates.push([]);
|
|
4937
|
+
}
|
|
4938
|
+
break;
|
|
4939
|
+
case 'LineString':
|
|
4926
4940
|
if (feature.geometry.coordinates.length === 0) {
|
|
4927
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4928
4941
|
feature.geometry.coordinates.push([]);
|
|
4929
4942
|
}
|
|
4930
4943
|
break;
|
|
@@ -5278,6 +5291,7 @@ const EditModeButton = ({
|
|
|
5278
5291
|
*
|
|
5279
5292
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5280
5293
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
5294
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
5281
5295
|
* */
|
|
5282
5296
|
const simplePolygonGeoJSON = {
|
|
5283
5297
|
type: 'FeatureCollection',
|
|
@@ -5590,6 +5604,65 @@ const intersectionFeatureBE = {
|
|
|
5590
5604
|
},
|
|
5591
5605
|
properties: defaultGeoJSONStyleProperties
|
|
5592
5606
|
};
|
|
5607
|
+
const simpleGeometryCollectionGeoJSON = {
|
|
5608
|
+
type: 'FeatureCollection',
|
|
5609
|
+
features: [{
|
|
5610
|
+
type: 'Feature',
|
|
5611
|
+
properties: {
|
|
5612
|
+
stroke: '#8F8',
|
|
5613
|
+
'stroke-width': 4,
|
|
5614
|
+
'stroke-opacity': 1,
|
|
5615
|
+
fill: '#33ccFF',
|
|
5616
|
+
'fill-opacity': 0.5,
|
|
5617
|
+
country: 'Finland',
|
|
5618
|
+
details: {
|
|
5619
|
+
identifier: '2.49.0.0.246.0.FI.240410113246.jma418B852H2nBY1ntp3',
|
|
5620
|
+
severity: 'Moderate',
|
|
5621
|
+
certainty: 'Possible',
|
|
5622
|
+
onset: '2024-04-11T12:00:00+03:00',
|
|
5623
|
+
expires: '2024-04-11T18:00:00+03:00',
|
|
5624
|
+
languages: [{
|
|
5625
|
+
language: 'fi-FI',
|
|
5626
|
+
event: 'Tuulivaroitus maa-alueille',
|
|
5627
|
+
senderName: 'Ilmatieteen laitos',
|
|
5628
|
+
headline: '',
|
|
5629
|
+
description: 'Tuulivaroitus maa-alueille: Länsituuli on voimakasta iltapäivällä, tuulen nopeus puuskissa 20 m/s.',
|
|
5630
|
+
areaDesc: 'Kainuu, Pudasjärvi, Taivalkoski, Kuusamo'
|
|
5631
|
+
}, {
|
|
5632
|
+
language: 'sv-SE',
|
|
5633
|
+
event: 'Vindvarning för landområden',
|
|
5634
|
+
senderName: 'Meteorologiska institutet',
|
|
5635
|
+
headline: '',
|
|
5636
|
+
description: 'Vindvarning för landområden: På eftermiddagen är den västliga vinden kraftigt, i vindbyarna 20 m/s.',
|
|
5637
|
+
areaDesc: 'Kainuu, Pudasjärvi, Taivalkoski, Kuusamo'
|
|
5638
|
+
}, {
|
|
5639
|
+
language: 'en-GB',
|
|
5640
|
+
event: 'Wind warning for land areas',
|
|
5641
|
+
senderName: 'Finnish Meteorological Institute',
|
|
5642
|
+
headline: '',
|
|
5643
|
+
description: 'Wind warning for land areas: In the afternoon, strong winds from west may bring strong gusts of 20 m/s.',
|
|
5644
|
+
areaDesc: 'Kainuu, Pudasjärvi, Taivalkoski, Kuusamo'
|
|
5645
|
+
}]
|
|
5646
|
+
}
|
|
5647
|
+
},
|
|
5648
|
+
geometry: {
|
|
5649
|
+
type: 'GeometryCollection',
|
|
5650
|
+
geometries: [{
|
|
5651
|
+
type: 'MultiPolygon',
|
|
5652
|
+
coordinates: [[[[29.758392564346536, 65.49273540846954], [29.71941427879389, 65.49638044528335], [29.21459755302349, 65.51209391081191], [29.170693731268035, 65.5197800533191], [29.147217916080326, 65.50275296777002], [28.633374093002843, 65.3721705402633], [28.18723681698394, 65.25672404742585], [28.14911332514444, 65.24984205608105], [28.111118852458272, 65.24063653209379], [27.693819807358636, 65.16109646665383], [27.33039713116483, 65.09068209391778], [27.332840574130387, 65.0387703089369], [27.326646217967365, 64.97976270671202], [27.157653690059732, 64.83986451042715], [27.126612443366312, 64.82736609485796], [26.916420458938006, 64.76188902343115], [26.886428080039778, 64.75000916898261], [26.467815769740625, 64.56827471246525], [26.334511209056984, 64.50150678855421], [26.305590843292137, 64.47468873954321], [26.339316861749918, 64.44776636198924], [26.504854495183764, 64.3399621504545], [26.526789567510534, 64.3210451684454], [26.64680093131525, 64.20565204411693], [26.805502956254468, 64.05176843450018], [26.822846233907782, 64.02833008717302], [26.866302819035326, 64.02149244583438], [27.25090982244751, 63.95456911474786], [27.63394361227682, 63.88676185094127], [28.01539289698782, 63.81807690948368], [28.336001020870327, 63.75944634860591], [28.36953495057645, 63.75291483074939], [28.38146960707695, 63.780308294502746], [28.453212390927888, 63.86320698957978], [28.488122426266656, 63.87072168747777], [29.061327279544, 63.87578318437369], [29.67289940508833, 63.87894724382795], [29.701281337390554, 63.87096916155944], [29.95452767634896, 63.762659061713634], [29.991551532456302, 63.74790651378042], [30.022558687101863, 63.76119168003561], [30.214883314310555, 63.81188283894816], [30.24646259407193, 63.8240131577964], [30.45743761263076, 63.98659320159419], [30.485808880817984, 64.00962934474863], [30.528497757656666, 64.05664110171924], [30.54104187728157, 64.08719012709481], [30.548808176296486, 64.12087568595071], [30.519336467341862, 64.20177024842253], [30.501794237261407, 64.23261663433796], [30.4770997493347, 64.25733643782799], [30.278855247194695, 64.32813156135076], [30.249923179452413, 64.34139133102182], [30.034923434023412, 64.50055888989162], [30.006675740312176, 64.52232084337746], [29.843095805108717, 64.6732364080745], [29.698703502979736, 64.8052603050698], [29.677920179868693, 64.82640388377037], [29.638540921311844, 64.88072887102366], [29.62541734471698, 64.90735364979494], [29.60157369391645, 64.9718516701184], [29.597607059999827, 64.9972352266183], [29.669945543777658, 65.23518451106732], [29.73413551222892, 65.44365355519507], [29.743985637492894, 65.469616744196], [29.758392564346536, 65.49273540846954]]]]
|
|
5653
|
+
}, {
|
|
5654
|
+
type: 'MultiPolygon',
|
|
5655
|
+
coordinates: [[[[27.766520457815957, 65.8195160088791], [27.73085604057836, 65.83947485866196], [27.45820033758423, 65.9493211039968], [27.430865666979813, 65.9554713265499], [27.407432994387463, 65.93839022633652], [27.17343408151436, 65.79130783497929], [27.13700155265117, 65.7748045054381], [27.043143659347365, 65.74146868282556], [26.93212618070619, 65.72018457880594], [26.770113943520442, 65.70598902727579], [26.723301465692543, 65.70590768662042], [26.387054877123173, 65.71366432114496], [26.158116226051387, 65.7257708265435], [26.154050492787476, 65.48723563080719], [26.158292174759623, 65.41018287503542], [26.226082500593677, 65.28786857013642], [26.24918073602433, 65.26064963421615], [26.311435369016323, 65.20611737168086], [26.34746159341583, 65.19097379678617], [26.47064990531538, 65.14852904702708], [26.617354013993747, 65.10039082072402], [26.658172378514152, 65.09683493161036], [26.7850977917127, 65.09445840537802], [27.33039713116483, 65.09068209391778], [27.693819807358636, 65.16109646665383], [28.111118852458272, 65.24063653209379], [28.14911332514444, 65.24984205608105], [28.141796473873793, 65.28201842856463], [28.04237271730372, 65.42610665418935], [27.942039909829926, 65.57026895303783], [27.766520457815957, 65.8195160088791]]]]
|
|
5656
|
+
}, {
|
|
5657
|
+
type: 'MultiPolygon',
|
|
5658
|
+
coordinates: [[[[29.170693731268035, 65.5197800533191], [29.130087050229307, 65.54237017185336], [28.793692264131735, 65.71359634271593], [28.549640756625106, 65.83637062837917], [28.52068592987659, 65.85585413976165], [28.48883706877227, 65.85421373746401], [28.124779448491477, 65.84111872142014], [27.79622169654993, 65.82862408942168], [27.766520457815957, 65.8195160088791], [27.942039909829926, 65.57026895303783], [28.04237271730372, 65.42610665418935], [28.141796473873793, 65.28201842856463], [28.14911332514444, 65.24984205608105], [28.18723681698394, 65.25672404742585], [28.633374093002843, 65.3721705402633], [29.147217916080326, 65.50275296777002], [29.170693731268035, 65.5197800533191]]]]
|
|
5659
|
+
}, {
|
|
5660
|
+
type: 'MultiPolygon',
|
|
5661
|
+
coordinates: [[[[29.568191250285462, 66.43045265195359], [29.527651742524338, 66.42954425078428], [29.167149655693773, 66.45472209596944], [28.72266047369712, 66.48468310371933], [28.68788794031491, 66.4858456386077], [28.686129727583417, 66.45685684583327], [28.616947548792908, 66.21978395191063], [28.57140958210226, 66.06194633146768], [28.526330219060455, 65.90427238999632], [28.52068592987659, 65.85585413976165], [28.549640756625106, 65.83637062837917], [28.793692264131735, 65.71359634271593], [29.130087050229307, 65.54237017185336], [29.170693731268035, 65.5197800533191], [29.21459755302349, 65.51209391081191], [29.71941427879389, 65.49638044528335], [29.758392564346536, 65.49273540846954], [29.803357612639658, 65.51348157207968], [30.11053968124635, 65.65921283899507], [30.124309492013527, 65.69970034115639], [30.121904515243088, 65.75312552789165], [30.108659610722114, 65.8017236758968], [30.093512380951722, 65.84734580681476], [30.05919479177051, 65.92010170197672], [29.930537319625472, 66.1076962309863], [29.91149731454561, 66.13245763550866], [29.74544846833132, 66.28135761175152], [29.5988415801629, 66.41164508252187], [29.568191250285462, 66.43045265195359]]]]
|
|
5662
|
+
}]
|
|
5663
|
+
}
|
|
5664
|
+
}]
|
|
5665
|
+
};
|
|
5593
5666
|
|
|
5594
5667
|
const drawPolyStoryStyles = {
|
|
5595
5668
|
MapDrawGeoJSONContainer: {
|
|
@@ -6001,13 +6074,13 @@ const getGeoJson = (geojson, shouldAllowMultipleShapes) => {
|
|
|
6001
6074
|
const {
|
|
6002
6075
|
geometry
|
|
6003
6076
|
} = geojson.features[0];
|
|
6004
|
-
if (geometry.type === '
|
|
6005
|
-
return geojson
|
|
6077
|
+
if (geometry.type === 'Polygon' && geometry.coordinates.length > 1) {
|
|
6078
|
+
return produce(geojson, draft => {
|
|
6079
|
+
const draftFeature = draft.features[0];
|
|
6080
|
+
draftFeature.geometry.coordinates = [draftFeature.geometry.coordinates[1]];
|
|
6081
|
+
});
|
|
6006
6082
|
}
|
|
6007
|
-
return
|
|
6008
|
-
const draftFeature = draft.features[0];
|
|
6009
|
-
draftFeature.geometry.coordinates = [draftFeature.geometry.coordinates[1]];
|
|
6010
|
-
}) : geojson;
|
|
6083
|
+
return geojson;
|
|
6011
6084
|
};
|
|
6012
6085
|
const hasFeatures = geometry => {
|
|
6013
6086
|
if (geometry.type === 'Point') {
|
|
@@ -9545,6 +9618,7 @@ $$1({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }
|
|
|
9545
9618
|
*
|
|
9546
9619
|
* Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
9547
9620
|
* Copyright 2020 - Finnish Meteorological Institute (FMI)
|
|
9621
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
9548
9622
|
* */
|
|
9549
9623
|
const getCurrentDimensionValue = (name, dimensions = []) => {
|
|
9550
9624
|
const currentDimension = dimensions.find(dim => dim.name === name);
|
|
@@ -10389,7 +10463,7 @@ class ReactMapView extends React.Component {
|
|
|
10389
10463
|
}
|
|
10390
10464
|
}
|
|
10391
10465
|
ReactMapView.defaultProps = {
|
|
10392
|
-
srs:
|
|
10466
|
+
srs: PROJECTION.EPSG_3857.value,
|
|
10393
10467
|
bbox: {
|
|
10394
10468
|
left: -2324980.5498391856,
|
|
10395
10469
|
bottom: 5890854.775012179,
|
|
@@ -10461,6 +10535,7 @@ const MapTime = ({
|
|
|
10461
10535
|
*
|
|
10462
10536
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
10463
10537
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
10538
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
10464
10539
|
* */
|
|
10465
10540
|
const MS_IN_HOUR = 3600 * 1000;
|
|
10466
10541
|
// The following is necessary to allow to assign to the CanvasRenderingContext2D ctx property
|
|
@@ -11847,6 +11922,7 @@ const LayerInfoDialog = ({
|
|
|
11847
11922
|
*
|
|
11848
11923
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
11849
11924
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
11925
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
11850
11926
|
* */
|
|
11851
11927
|
const baseLayerGrey = {
|
|
11852
11928
|
id: webmapUtils.generateLayerId(),
|
|
@@ -11890,6 +11966,7 @@ var defaultLayers = /*#__PURE__*/Object.freeze({
|
|
|
11890
11966
|
*
|
|
11891
11967
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
11892
11968
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
11969
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
11893
11970
|
* */
|
|
11894
11971
|
const DWD = {
|
|
11895
11972
|
name: 'DWD',
|
|
@@ -12025,6 +12102,7 @@ var publicServices = /*#__PURE__*/Object.freeze({
|
|
|
12025
12102
|
*
|
|
12026
12103
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
12027
12104
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
12105
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
12028
12106
|
* */
|
|
12029
12107
|
const baseLayer = {
|
|
12030
12108
|
name: 'arcGisSat',
|
|
@@ -12392,4 +12470,4 @@ var publicLayers = /*#__PURE__*/Object.freeze({
|
|
|
12392
12470
|
veiligheidsRegiosGebiedsIndelingenLabels: veiligheidsRegiosGebiedsIndelingenLabels
|
|
12393
12471
|
});
|
|
12394
12472
|
|
|
12395
|
-
export { DRAWMODE, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EDITMODE, EditModeButton as EditModeButtonField, FeatureLayers, GeoJSONTextField, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MINUTE_TO_MILLISECOND, MapControlButton, MapControls, MapDimensionSelect, MapDrawContainer, MapTime, MapView, MapViewLayer, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION, ORIGIN_REACTMAPVIEW_ONUPDATELAYERINFO, Proj4js, radarGetCapabilities_spec as RadarGetCapabilities, ReactMapView, ReactMapViewLayer, SelectField, StoryLayoutGrid, WEBMAP_REACT_NAMESPACE, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, addWMLayerPropsBasedOnChildProps, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, checkHoverFeatures, convertGeoCoordsToScreenCoords, 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, findClosestCoords, firSelectionType, formatTime, getCurrentDimensionValue, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawFunctionFromStore, getFeatureCollection, getFeatureExtent, getFeatureLayers, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerStyles, getLayerUpdateInfo, getPixelCoordFromGeoCoord, getProj4, getTimeDimension, getToolIcon, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isAGeoJSONLayer, isAMapLayer, isBetween, isGeoJSONFeatureCreatedByTool, isPointFeatureCollection, lineString, lineStringCollection, makeLayerPropListFromChildren, marksByDimension, moveFeature, opacityOptions, orderLayers, parseWMJSLayer, projectorCache, publicLayers, publicServices, registerDrawFunction, removeWMLayerFromMap, rewindGeometry, setWMLayerPropsBasedOnChildProps, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, textStyle, textStyleWithMargin, updateEditModeButtonsWithFir, useGeoJSON, useMapDrawTool, webmapReactTranslations };
|
|
12473
|
+
export { DRAWMODE, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EDITMODE, EditModeButton as EditModeButtonField, FeatureLayers, GeoJSONTextField, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MINUTE_TO_MILLISECOND, MapControlButton, MapControls, MapDimensionSelect, MapDrawContainer, MapTime, MapView, MapViewLayer, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION, ORIGIN_REACTMAPVIEW_ONUPDATELAYERINFO, Proj4js, radarGetCapabilities_spec as RadarGetCapabilities, ReactMapView, ReactMapViewLayer, SelectField, StoryLayoutGrid, WEBMAP_REACT_NAMESPACE, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, addWMLayerPropsBasedOnChildProps, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, checkHoverFeatures, convertGeoCoordsToScreenCoords, 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, findClosestCoords, firSelectionType, formatTime, getCurrentDimensionValue, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawFunctionFromStore, getFeatureCollection, getFeatureExtent, getFeatureLayers, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerStyles, getLayerUpdateInfo, getPixelCoordFromGeoCoord, getProj4, getTimeDimension, getToolIcon, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isAGeoJSONLayer, isAMapLayer, isBetween, isGeoJSONFeatureCreatedByTool, isPointFeatureCollection, lineString, lineStringCollection, makeLayerPropListFromChildren, marksByDimension, moveFeature, opacityOptions, orderLayers, parseWMJSLayer, projectorCache, publicLayers, publicServices, registerDrawFunction, removeWMLayerFromMap, rewindGeometry, setWMLayerPropsBasedOnChildProps, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, textStyle, textStyleWithMargin, updateEditModeButtonsWithFir, useGeoJSON, useMapDrawTool, webmapReactTranslations };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { FeatureCollection, GeoJsonProperties, GeometryObject, Position } from 'geojson';
|
|
3
|
-
import {
|
|
3
|
+
import { GeoFeatureStyle, Coordinate } from './geojsonShapes';
|
|
4
4
|
interface DrawStyle {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number;
|
|
@@ -23,7 +23,7 @@ export interface FeatureEvent {
|
|
|
23
23
|
mouseX: number;
|
|
24
24
|
mouseY: number;
|
|
25
25
|
isInEditMode: boolean;
|
|
26
|
-
feature:
|
|
26
|
+
feature: GeoJSON.Feature;
|
|
27
27
|
}
|
|
28
28
|
export interface MapDrawProps {
|
|
29
29
|
mapId: string;
|
|
@@ -112,8 +112,8 @@ export default class MapDraw extends React.PureComponent<MapDrawProps> {
|
|
|
112
112
|
handleDrawMode(_drawMode: string): void;
|
|
113
113
|
handleGeoJSONUpdate: (newGeoJSON: GeoJSON.FeatureCollection) => void;
|
|
114
114
|
handleExitDrawMode: (reason?: DrawModeExitCallback) => void;
|
|
115
|
-
getSelectedFeature: () =>
|
|
116
|
-
hoverVertex(feature:
|
|
115
|
+
getSelectedFeature: () => GeoJSON.Feature;
|
|
116
|
+
hoverVertex(feature: GeoJSON.Feature, mouseX: number, mouseY: number): void;
|
|
117
117
|
mouseMove(event: InputEvent): boolean;
|
|
118
118
|
triggerMouseDownTimer(event: InputEvent): void | boolean;
|
|
119
119
|
mouseDoubleClick(): void;
|
|
@@ -132,26 +132,26 @@ export default class MapDraw extends React.PureComponent<MapDrawProps> {
|
|
|
132
132
|
deleteFeature(): void;
|
|
133
133
|
mouseUp(event: InputEvent): void | boolean;
|
|
134
134
|
cancelEdit(cancelLastPoint: boolean): void;
|
|
135
|
-
moveVertex(feature:
|
|
135
|
+
moveVertex(feature: GeoJSON.Feature, mouseDown: boolean): boolean;
|
|
136
136
|
transposePolygon(featureCoords: Position[]): void;
|
|
137
137
|
transposeVertex(featureCoords: Position[]): void;
|
|
138
138
|
componentCleanup(): void;
|
|
139
|
-
|
|
139
|
+
initializeFeature(feature: GeoJSON.Feature): void;
|
|
140
140
|
validatePolys(fixPolys: boolean): void;
|
|
141
141
|
beforeDraw(ctx: CanvasRenderingContext2D): void;
|
|
142
142
|
checkDist(coord: Coordinate, polygonIndex: SNAPPEDFEATURE | number, mouseX: number, mouseY: number): boolean;
|
|
143
|
-
hoverEdge(geometry:
|
|
143
|
+
hoverEdge(geometry: GeoJSON.Geometry, mouseX: number, mouseY: number): {
|
|
144
144
|
selectedEdge: EDGE | number;
|
|
145
145
|
snappedPolygonIndex: SNAPPEDFEATURE | number;
|
|
146
146
|
};
|
|
147
147
|
drawVertice(ctx: CanvasRenderingContext2D, _coord: Coordinate, selected: boolean, middle: boolean, isInEditMode: boolean): void;
|
|
148
|
-
drawPoint(ctx: CanvasRenderingContext2D, _coord: Coordinate, selected: boolean, middle: boolean, isInEditMode: boolean, feature:
|
|
148
|
+
drawPoint(ctx: CanvasRenderingContext2D, _coord: Coordinate, selected: boolean, middle: boolean, isInEditMode: boolean, feature: GeoJSON.Feature, featureIndex: number): void;
|
|
149
149
|
drawIcon(ctx: CanvasRenderingContext2D, _coord: Coordinate, featureProperties: GeoJsonProperties): DrawStyle;
|
|
150
150
|
drawMarker(ctx: CanvasRenderingContext2D, _coord: Coordinate, selected: boolean, middle: boolean, isInEditMode: boolean, featureProperties: GeoFeatureStyle): void | DrawStyle;
|
|
151
151
|
drawLine(ctx: CanvasRenderingContext2D, XYCoords: Coordinate[], featureIndex: number, lineStringIndex: number): void | DrawStyle;
|
|
152
152
|
drawPolygon(ctx: CanvasRenderingContext2D, XYCoords: Coordinate[], featureIndex: number, polygonIndex: number): void | DrawStyle;
|
|
153
|
-
initializeFeatureCoordinates(feature:
|
|
154
|
-
checkIfFeatureIsBox(feature:
|
|
153
|
+
initializeFeatureCoordinates(feature: GeoJSON.Feature, type: string): GeoJSON.Feature;
|
|
154
|
+
checkIfFeatureIsBox(feature: GeoJSON.Feature): boolean;
|
|
155
155
|
featureHasChanged(text: string): void;
|
|
156
156
|
render(): React.ReactElement;
|
|
157
157
|
}
|
|
@@ -6,8 +6,6 @@ export declare const featurePolygon: GeoJSON.Feature<GeoJSON.Polygon>;
|
|
|
6
6
|
export declare const featureBox: GeoJSON.Feature<GeoJSON.Polygon>;
|
|
7
7
|
export declare const lineString: GeoJSON.Feature<GeoJSON.LineString>;
|
|
8
8
|
export declare const lineStringCollection: GeoJSON.FeatureCollection;
|
|
9
|
-
export type GeoJsonFeatureType = GeoJSON.Polygon | GeoJSON.MultiPoint | GeoJSON.Point | GeoJSON.LineString | GeoJSON.MultiPolygon;
|
|
10
|
-
export type GeoJsonFeature = GeoJSON.Feature<GeoJsonFeatureType>;
|
|
11
9
|
export interface GeoFeatureStyle {
|
|
12
10
|
stroke?: string;
|
|
13
11
|
fill?: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import proj4, { InterfaceProjection } from 'proj4';
|
|
2
2
|
import { Position } from 'geojson';
|
|
3
|
-
import { Coordinate
|
|
3
|
+
import { Coordinate } from './geojsonShapes';
|
|
4
4
|
export type CheckHoverFeaturesResult = {
|
|
5
5
|
coordinateIndexInFeature: number;
|
|
6
6
|
featureIndex: number;
|
|
7
|
-
feature:
|
|
7
|
+
feature: GeoJSON.Feature;
|
|
8
8
|
distance: number;
|
|
9
9
|
screenCoords: {
|
|
10
10
|
x: number;
|
|
@@ -27,7 +27,7 @@ export interface MapDrawDrawFunctionArgs {
|
|
|
27
27
|
coord: Coordinate;
|
|
28
28
|
selected: boolean;
|
|
29
29
|
isInEditMode: boolean;
|
|
30
|
-
feature:
|
|
30
|
+
feature: GeoJSON.Feature;
|
|
31
31
|
mouseX: number;
|
|
32
32
|
mouseY: number;
|
|
33
33
|
isHovered: boolean;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export declare const simplePolygonGeoJSON: GeoJSON.FeatureCollection
|
|
2
|
-
export declare const simplePointsGeojson: GeoJSON.FeatureCollection
|
|
3
|
-
export declare const simpleSmallLineStringGeoJSON: GeoJSON.FeatureCollection
|
|
4
|
-
export declare const simpleFlightRoutePointsGeoJSON: GeoJSON.FeatureCollection
|
|
5
|
-
export declare const simpleLineStringGeoJSON: GeoJSON.FeatureCollection
|
|
6
|
-
export declare const simpleBoxGeoJSON: GeoJSON.FeatureCollection
|
|
7
|
-
export declare const simpleBoxGeoJSONWrongOrder: GeoJSON.FeatureCollection
|
|
8
|
-
export declare const simpleFlightRouteLineStringGeoJSON: GeoJSON.FeatureCollection
|
|
9
|
-
export declare const simpleMultiPolygon: GeoJSON.FeatureCollection
|
|
10
|
-
export declare const intersectionFeatureNL: GeoJSON.Feature
|
|
11
|
-
export declare const intersectionFeatureBE: GeoJSON.Feature
|
|
1
|
+
export declare const simplePolygonGeoJSON: GeoJSON.FeatureCollection<GeoJSON.Polygon>;
|
|
2
|
+
export declare const simplePointsGeojson: GeoJSON.FeatureCollection<GeoJSON.Point>;
|
|
3
|
+
export declare const simpleSmallLineStringGeoJSON: GeoJSON.FeatureCollection<GeoJSON.LineString>;
|
|
4
|
+
export declare const simpleFlightRoutePointsGeoJSON: GeoJSON.FeatureCollection<GeoJSON.Point>;
|
|
5
|
+
export declare const simpleLineStringGeoJSON: GeoJSON.FeatureCollection<GeoJSON.LineString>;
|
|
6
|
+
export declare const simpleBoxGeoJSON: GeoJSON.FeatureCollection<GeoJSON.Polygon>;
|
|
7
|
+
export declare const simpleBoxGeoJSONWrongOrder: GeoJSON.FeatureCollection<GeoJSON.Polygon>;
|
|
8
|
+
export declare const simpleFlightRouteLineStringGeoJSON: GeoJSON.FeatureCollection<GeoJSON.LineString>;
|
|
9
|
+
export declare const simpleMultiPolygon: GeoJSON.FeatureCollection<GeoJSON.MultiPolygon>;
|
|
10
|
+
export declare const intersectionFeatureNL: GeoJSON.Feature<GeoJSON.Polygon>;
|
|
11
|
+
export declare const intersectionFeatureBE: GeoJSON.Feature<GeoJSON.Polygon>;
|
|
12
|
+
export declare const simpleGeometryCollectionGeoJSON: GeoJSON.FeatureCollection<GeoJSON.GeometryCollection<GeoJSON.MultiPolygon>>;
|