@opengeoweb/webmap-react 9.25.3 → 9.27.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 +184 -105
- package/package.json +4 -2
- package/src/index.d.ts +2 -0
- 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/components/ReactMapView/types.d.ts +1 -0
- package/src/lib/layers/defaultStorybookSettings.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { WEBMAP_NAMESPACE, webmapTranslations, legendImageStore, WMImageEventType, webmapUtils, getLegendGraphicURLForLayer, getPixelCoordFromLatLong, WMJSMAP_LONLAT_EPSGCODE, getLatLongFromPixelCoord, LayerType, getWMJSMapById, debugLogger, DebugType, WMLayer, registerWMLayer, WMBBOX, getWMLayerById, WMJSMap, tilesettings } from '@opengeoweb/webmap';
|
|
2
|
+
export { WEBMAP_NAMESPACE, webmapTranslations } from '@opengeoweb/webmap';
|
|
1
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import React__default, { useRef, useState, useEffect } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { CustomTooltip, CanvasComponent, ToolContainerDraggable, CustomIconButton, dateUtils } from '@opengeoweb/shared';
|
|
6
|
+
import { CustomTooltip, CanvasComponent, ToolContainerDraggable, CustomIconButton, dateUtils, PROJECTION } from '@opengeoweb/shared';
|
|
6
7
|
import i18n from 'i18next';
|
|
7
8
|
import { initReactI18next, useTranslation } from 'react-i18next';
|
|
8
9
|
import { Paper, Box, Typography, Grid, TextField, FormControl, InputLabel, Select, MenuItem, Icon as Icon$1, FormLabel, Switch, styled, Slider } from '@mui/material';
|
|
@@ -1832,16 +1833,20 @@ i18n.use(initReactI18next).init({
|
|
|
1832
1833
|
},
|
|
1833
1834
|
resources: {
|
|
1834
1835
|
en: {
|
|
1835
|
-
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.en
|
|
1836
|
+
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.en,
|
|
1837
|
+
[WEBMAP_NAMESPACE]: webmapTranslations.en
|
|
1836
1838
|
},
|
|
1837
1839
|
fi: {
|
|
1838
|
-
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.fi
|
|
1840
|
+
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.fi,
|
|
1841
|
+
[WEBMAP_NAMESPACE]: webmapTranslations.fi
|
|
1839
1842
|
},
|
|
1840
1843
|
no: {
|
|
1841
|
-
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.no
|
|
1844
|
+
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.no,
|
|
1845
|
+
[WEBMAP_NAMESPACE]: webmapTranslations.no
|
|
1842
1846
|
},
|
|
1843
1847
|
nl: {
|
|
1844
|
-
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.nl
|
|
1848
|
+
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.nl,
|
|
1849
|
+
[WEBMAP_NAMESPACE]: webmapTranslations.nl
|
|
1845
1850
|
}
|
|
1846
1851
|
}
|
|
1847
1852
|
});
|
|
@@ -2826,10 +2831,18 @@ const findClosestCoords = (positions, mouseX, mouseY) => {
|
|
|
2826
2831
|
});
|
|
2827
2832
|
return closestIndexes;
|
|
2828
2833
|
};
|
|
2829
|
-
const checkHoverVertice = (feature, mouseX, mouseY, convertGeoCoordsToScreenCoords, ignoreCoordinateIndexInFeature) => {
|
|
2834
|
+
const checkHoverVertice = (feature, mouseX, mouseY, convertGeoCoordsToScreenCoords, ignoreCoordinateIndexInFeature, geometry = feature.geometry) => {
|
|
2830
2835
|
const maxDistance = 20;
|
|
2831
|
-
if (
|
|
2832
|
-
const
|
|
2836
|
+
if (geometry.type === 'GeometryCollection') {
|
|
2837
|
+
for (const geom of geometry.geometries) {
|
|
2838
|
+
const result = checkHoverVertice(feature, mouseX, mouseY, convertGeoCoordsToScreenCoords, ignoreCoordinateIndexInFeature, geom);
|
|
2839
|
+
if (result) {
|
|
2840
|
+
return result;
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
if (geometry.type === 'Point') {
|
|
2845
|
+
const featureCoords = geometry.coordinates;
|
|
2833
2846
|
/* Get all vertexes */
|
|
2834
2847
|
const XYCoords = convertGeoCoordsToScreenCoords([featureCoords]);
|
|
2835
2848
|
const calculatedDistance = XYCoords.length > 0 ? distance(XYCoords[0], {
|
|
@@ -2844,9 +2857,9 @@ const checkHoverVertice = (feature, mouseX, mouseY, convertGeoCoordsToScreenCoor
|
|
|
2844
2857
|
};
|
|
2845
2858
|
}
|
|
2846
2859
|
}
|
|
2847
|
-
if (
|
|
2848
|
-
for (let polygonIndex =
|
|
2849
|
-
const featureCoords =
|
|
2860
|
+
if (geometry.type === 'MultiPoint') {
|
|
2861
|
+
for (let polygonIndex = geometry.coordinates.length - 1; polygonIndex >= 0; polygonIndex -= 1) {
|
|
2862
|
+
const featureCoords = geometry.coordinates[polygonIndex];
|
|
2850
2863
|
if (featureCoords === undefined) {
|
|
2851
2864
|
// eslint-disable-next-line no-continue
|
|
2852
2865
|
continue;
|
|
@@ -2866,10 +2879,10 @@ const checkHoverVertice = (feature, mouseX, mouseY, convertGeoCoordsToScreenCoor
|
|
|
2866
2879
|
}
|
|
2867
2880
|
}
|
|
2868
2881
|
}
|
|
2869
|
-
if (
|
|
2882
|
+
if (geometry.type === 'Polygon') {
|
|
2870
2883
|
const point = [mouseX, mouseY];
|
|
2871
|
-
for (let polygonIndex =
|
|
2872
|
-
const featureCoords =
|
|
2884
|
+
for (let polygonIndex = geometry.coordinates.length - 1; polygonIndex >= 0; polygonIndex -= 1) {
|
|
2885
|
+
const featureCoords = geometry.coordinates[polygonIndex];
|
|
2873
2886
|
if (featureCoords === undefined) {
|
|
2874
2887
|
// eslint-disable-next-line no-continue
|
|
2875
2888
|
continue;
|
|
@@ -2905,10 +2918,10 @@ const checkHoverVertice = (feature, mouseX, mouseY, convertGeoCoordsToScreenCoor
|
|
|
2905
2918
|
}
|
|
2906
2919
|
}
|
|
2907
2920
|
}
|
|
2908
|
-
if (
|
|
2921
|
+
if (geometry.type === 'MultiPolygon') {
|
|
2909
2922
|
const point = [mouseX, mouseY];
|
|
2910
|
-
for (let polygonIndex =
|
|
2911
|
-
const featureCoords =
|
|
2923
|
+
for (let polygonIndex = geometry.coordinates.length - 1; polygonIndex >= 0; polygonIndex -= 1) {
|
|
2924
|
+
const featureCoords = geometry.coordinates[polygonIndex][0];
|
|
2912
2925
|
if (featureCoords === undefined) {
|
|
2913
2926
|
// eslint-disable-next-line no-continue
|
|
2914
2927
|
continue;
|
|
@@ -2933,10 +2946,9 @@ const checkHoverVertice = (feature, mouseX, mouseY, convertGeoCoordsToScreenCoor
|
|
|
2933
2946
|
}
|
|
2934
2947
|
}
|
|
2935
2948
|
}
|
|
2936
|
-
if (
|
|
2937
|
-
const featureCoords = feature.geometry.coordinates;
|
|
2949
|
+
if (geometry.type === 'LineString') {
|
|
2938
2950
|
/* Get all vertexes */
|
|
2939
|
-
const XYCoords = convertGeoCoordsToScreenCoords(
|
|
2951
|
+
const XYCoords = convertGeoCoordsToScreenCoords(geometry.coordinates);
|
|
2940
2952
|
/* Snap to the vertex closer than specified pixels */
|
|
2941
2953
|
for (let j = 0; j < XYCoords.length; j += 1) {
|
|
2942
2954
|
const coord = XYCoords[j];
|
|
@@ -3146,7 +3158,7 @@ class MapDraw extends React.PureComponent {
|
|
|
3146
3158
|
constructor(props) {
|
|
3147
3159
|
super(props);
|
|
3148
3160
|
this.handleGeoJSONUpdate = newGeoJSON => {
|
|
3149
|
-
var _a;
|
|
3161
|
+
var _a, _b;
|
|
3150
3162
|
const {
|
|
3151
3163
|
selectedFeatureIndex,
|
|
3152
3164
|
mapId
|
|
@@ -3155,13 +3167,15 @@ class MapDraw extends React.PureComponent {
|
|
|
3155
3167
|
/* Ensure that this.snappedPolygonIndex is still within the coordinates array */
|
|
3156
3168
|
if (((_a = this.geojson) === null || _a === void 0 ? void 0 : _a.features) && selectedFeatureIndex < this.geojson.features.length) {
|
|
3157
3169
|
const feature = this.getSelectedFeature();
|
|
3158
|
-
if (feature.geometry) {
|
|
3170
|
+
if (((_b = feature.geometry) === null || _b === void 0 ? void 0 : _b.type) === 'Polygon') {
|
|
3159
3171
|
const {
|
|
3160
3172
|
coordinates
|
|
3161
3173
|
} = feature.geometry;
|
|
3162
3174
|
if (Number(this.snappedPolygonIndex) > coordinates.length - 1) {
|
|
3163
3175
|
this.snappedPolygonIndex = coordinates.length - 1;
|
|
3164
3176
|
}
|
|
3177
|
+
} else {
|
|
3178
|
+
this.snappedPolygonIndex = SNAPPEDFEATURE.NONE;
|
|
3165
3179
|
}
|
|
3166
3180
|
}
|
|
3167
3181
|
const webmapjs = webmapUtils.getWMJSMapById(mapId);
|
|
@@ -3175,8 +3189,8 @@ class MapDraw extends React.PureComponent {
|
|
|
3175
3189
|
if (this.myDrawMode === DRAWMODE.POLYGON && this.myEditMode === EDITMODE.ADD_FEATURE) {
|
|
3176
3190
|
const currentFeature = this.getSelectedFeature();
|
|
3177
3191
|
const currentGeometry = currentFeature.geometry;
|
|
3178
|
-
const coordinates = currentGeometry.coordinates[0];
|
|
3179
3192
|
if (currentGeometry.type === 'Polygon') {
|
|
3193
|
+
const coordinates = currentGeometry.coordinates[0];
|
|
3180
3194
|
const firstElement = coordinates[0];
|
|
3181
3195
|
coordinates[this.mouseIsOverVertexNr] = cloneDeep(firstElement);
|
|
3182
3196
|
}
|
|
@@ -3357,7 +3371,7 @@ class MapDraw extends React.PureComponent {
|
|
|
3357
3371
|
mapId
|
|
3358
3372
|
} = this.props;
|
|
3359
3373
|
const feature = this.getSelectedFeature();
|
|
3360
|
-
if (feature) {
|
|
3374
|
+
if (feature && feature.geometry.type !== 'GeometryCollection') {
|
|
3361
3375
|
const featureCoords = feature.geometry.coordinates;
|
|
3362
3376
|
this.mouseIsOverVertexNr = featureCoords.length - 1;
|
|
3363
3377
|
}
|
|
@@ -3945,11 +3959,13 @@ class MapDraw extends React.PureComponent {
|
|
|
3945
3959
|
deletePolygonCallback
|
|
3946
3960
|
} = this.props;
|
|
3947
3961
|
const feature = this.getSelectedFeature();
|
|
3948
|
-
feature.geometry.
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3962
|
+
if (feature.geometry.type !== 'GeometryCollection') {
|
|
3963
|
+
feature.geometry.coordinates.splice(index, 1);
|
|
3964
|
+
if (deletePolygonCallback) {
|
|
3965
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3966
|
+
// @ts-ignore
|
|
3967
|
+
deletePolygonCallback();
|
|
3968
|
+
}
|
|
3953
3969
|
}
|
|
3954
3970
|
}
|
|
3955
3971
|
deleteFeature() {
|
|
@@ -4100,9 +4116,12 @@ class MapDraw extends React.PureComponent {
|
|
|
4100
4116
|
}
|
|
4101
4117
|
}
|
|
4102
4118
|
moveVertex(feature, mouseDown) {
|
|
4103
|
-
const
|
|
4119
|
+
const geometryType = feature.geometry.type;
|
|
4120
|
+
if (geometryType === 'GeometryCollection') {
|
|
4121
|
+
return undefined;
|
|
4122
|
+
}
|
|
4104
4123
|
let featureCoords = feature.geometry.coordinates[this.snappedPolygonIndex];
|
|
4105
|
-
if (
|
|
4124
|
+
if (geometryType === 'Point' || geometryType === 'MultiPoint' || geometryType === 'LineString') {
|
|
4106
4125
|
featureCoords = feature.geometry.coordinates;
|
|
4107
4126
|
}
|
|
4108
4127
|
if (!featureCoords) {
|
|
@@ -4110,7 +4129,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4110
4129
|
}
|
|
4111
4130
|
const vertexSelected = mouseDown === true && this.mouseIsOverVertexNr !== VERTEX.NONE;
|
|
4112
4131
|
if (vertexSelected || this.myEditMode === EDITMODE.ADD_FEATURE) {
|
|
4113
|
-
if (
|
|
4132
|
+
if (geometryType === 'LineString') {
|
|
4114
4133
|
this.transposeVertex(featureCoords);
|
|
4115
4134
|
// eslint-disable-next-line consistent-return
|
|
4116
4135
|
return false;
|
|
@@ -4238,7 +4257,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4238
4257
|
}
|
|
4239
4258
|
}
|
|
4240
4259
|
// eslint-disable-next-line class-methods-use-this
|
|
4241
|
-
|
|
4260
|
+
initializeFeature(feature) {
|
|
4242
4261
|
if (!feature.properties) {
|
|
4243
4262
|
feature.properties = {};
|
|
4244
4263
|
}
|
|
@@ -4248,7 +4267,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4248
4267
|
if (!feature.type) {
|
|
4249
4268
|
feature.type = 'Feature';
|
|
4250
4269
|
}
|
|
4251
|
-
if (!feature.geometry.coordinates) {
|
|
4270
|
+
if (feature.geometry.type !== 'GeometryCollection' && !feature.geometry.coordinates) {
|
|
4252
4271
|
feature.geometry.coordinates = [];
|
|
4253
4272
|
}
|
|
4254
4273
|
}
|
|
@@ -4259,7 +4278,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4259
4278
|
}
|
|
4260
4279
|
for (const geoJsonFeature of this.geojson.features) {
|
|
4261
4280
|
const feature = geoJsonFeature;
|
|
4262
|
-
this.
|
|
4281
|
+
this.initializeFeature(feature);
|
|
4263
4282
|
const featureType = feature.geometry.type;
|
|
4264
4283
|
if (featureType === 'Polygon') {
|
|
4265
4284
|
/* Loop through all polygons of the same feature */
|
|
@@ -4328,28 +4347,16 @@ class MapDraw extends React.PureComponent {
|
|
|
4328
4347
|
this.textPositions = [];
|
|
4329
4348
|
this.mouseOverPolygonCoordinates = [];
|
|
4330
4349
|
this.mouseOverPolygonFeatureIndex = -1;
|
|
4331
|
-
const
|
|
4350
|
+
const drawFeatureGeometry = (feature, featureIndex, geometry = feature.geometry) => {
|
|
4332
4351
|
var _a, _b, _c;
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
y: 0,
|
|
4337
|
-
nr: 0
|
|
4338
|
-
};
|
|
4339
|
-
if (featureType === 'Point') {
|
|
4340
|
-
const featureCoords = feature.geometry.coordinates;
|
|
4341
|
-
const XYCoords = getPixelCoordFromGeoCoord([featureCoords], mapId);
|
|
4342
|
-
if (XYCoords.length === 0) {
|
|
4343
|
-
// eslint-disable-next-line no-continue
|
|
4344
|
-
return;
|
|
4345
|
-
}
|
|
4346
|
-
for (let j = 0; j < XYCoords.length; j += 1) {
|
|
4347
|
-
this.drawPoint(ctx, XYCoords[j], this.mouseIsOverVertexNr === j && selectedFeatureIndex === featureIndex, false, isInEditMode && selectedFeatureIndex === featureIndex, feature, featureIndex);
|
|
4352
|
+
if (geometry.type === 'GeometryCollection') {
|
|
4353
|
+
for (const geom of geometry.geometries) {
|
|
4354
|
+
drawFeatureGeometry(feature, featureIndex, geom);
|
|
4348
4355
|
}
|
|
4349
4356
|
}
|
|
4350
|
-
if (
|
|
4351
|
-
const
|
|
4352
|
-
const XYCoords = getPixelCoordFromGeoCoord(
|
|
4357
|
+
if (geometry.type === 'Point' || geometry.type === 'MultiPoint') {
|
|
4358
|
+
const coordinates = geometry.type === 'Point' ? [geometry.coordinates] : geometry.coordinates;
|
|
4359
|
+
const XYCoords = getPixelCoordFromGeoCoord(coordinates, mapId);
|
|
4353
4360
|
if (XYCoords.length === 0) {
|
|
4354
4361
|
return;
|
|
4355
4362
|
}
|
|
@@ -4357,12 +4364,16 @@ class MapDraw extends React.PureComponent {
|
|
|
4357
4364
|
this.drawPoint(ctx, XYCoords[j], this.mouseIsOverVertexNr === j && selectedFeatureIndex === featureIndex, false, isInEditMode && selectedFeatureIndex === featureIndex, feature, featureIndex);
|
|
4358
4365
|
}
|
|
4359
4366
|
}
|
|
4360
|
-
if (
|
|
4361
|
-
const
|
|
4362
|
-
|
|
4367
|
+
if (geometry.type === 'MultiPolygon') {
|
|
4368
|
+
const totalMiddle = {
|
|
4369
|
+
x: 0,
|
|
4370
|
+
y: 0,
|
|
4371
|
+
nr: 0
|
|
4372
|
+
};
|
|
4373
|
+
for (const multiPoly of geometry.coordinates) {
|
|
4363
4374
|
for (let polygonIndex = 0; polygonIndex < multiPoly.length; polygonIndex += 1) {
|
|
4364
|
-
const
|
|
4365
|
-
const XYCoords = getPixelCoordFromGeoCoord(
|
|
4375
|
+
const ringCoordinates = multiPoly[polygonIndex];
|
|
4376
|
+
const XYCoords = getPixelCoordFromGeoCoord(ringCoordinates, mapId);
|
|
4366
4377
|
/* Only draw if there is stuff to show */
|
|
4367
4378
|
if (XYCoords.length === 0) {
|
|
4368
4379
|
// eslint-disable-next-line no-continue
|
|
@@ -4370,9 +4381,9 @@ class MapDraw extends React.PureComponent {
|
|
|
4370
4381
|
}
|
|
4371
4382
|
const middle = this.drawPolygon(ctx, XYCoords, featureIndex, polygonIndex);
|
|
4372
4383
|
if (middle) {
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4384
|
+
totalMiddle.x += middle.x * middle.nr;
|
|
4385
|
+
totalMiddle.y += middle.y * middle.nr;
|
|
4386
|
+
totalMiddle.nr += middle.nr;
|
|
4376
4387
|
}
|
|
4377
4388
|
if (isInEditMode) {
|
|
4378
4389
|
/* Draw all vertices on the edges of the polygons */
|
|
@@ -4386,9 +4397,9 @@ class MapDraw extends React.PureComponent {
|
|
|
4386
4397
|
}
|
|
4387
4398
|
}
|
|
4388
4399
|
}
|
|
4389
|
-
if (
|
|
4390
|
-
const mx =
|
|
4391
|
-
const my =
|
|
4400
|
+
if (totalMiddle.nr > 0) {
|
|
4401
|
+
const mx = totalMiddle.x / totalMiddle.nr;
|
|
4402
|
+
const my = totalMiddle.y / totalMiddle.nr;
|
|
4392
4403
|
if ((_a = feature.properties) === null || _a === void 0 ? void 0 : _a.text) {
|
|
4393
4404
|
this.textPositions.push({
|
|
4394
4405
|
x: mx,
|
|
@@ -4398,11 +4409,10 @@ class MapDraw extends React.PureComponent {
|
|
|
4398
4409
|
}
|
|
4399
4410
|
}
|
|
4400
4411
|
}
|
|
4401
|
-
if (
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
const featureCoords = polygonGeometry.coordinates[polygonIndex];
|
|
4412
|
+
if (geometry.type === 'Polygon') {
|
|
4413
|
+
/* Loop through all rings of the same polygon */
|
|
4414
|
+
for (let polygonIndex = 0; polygonIndex < geometry.coordinates.length; polygonIndex += 1) {
|
|
4415
|
+
const featureCoords = geometry.coordinates[polygonIndex];
|
|
4406
4416
|
const XYCoords = getPixelCoordFromGeoCoord(featureCoords, mapId);
|
|
4407
4417
|
/* Only draw if there is stuff to show */
|
|
4408
4418
|
if (XYCoords.length === 0) {
|
|
@@ -4432,9 +4442,9 @@ class MapDraw extends React.PureComponent {
|
|
|
4432
4442
|
}
|
|
4433
4443
|
}
|
|
4434
4444
|
}
|
|
4435
|
-
if (
|
|
4445
|
+
if (geometry.type === 'LineString') {
|
|
4436
4446
|
/* Loop through all line pints of the same feature */
|
|
4437
|
-
const featureCoords =
|
|
4447
|
+
const featureCoords = geometry.coordinates;
|
|
4438
4448
|
if (!featureCoords || !featureCoords.length) {
|
|
4439
4449
|
return;
|
|
4440
4450
|
}
|
|
@@ -4464,11 +4474,11 @@ class MapDraw extends React.PureComponent {
|
|
|
4464
4474
|
const feature = this.geojson.features[featureIndex];
|
|
4465
4475
|
/* Do not draw selected feature here, should be done last */
|
|
4466
4476
|
if (featureIndex !== selectedFeatureIndex) {
|
|
4467
|
-
|
|
4477
|
+
drawFeatureGeometry(feature, featureIndex);
|
|
4468
4478
|
}
|
|
4469
4479
|
}
|
|
4470
4480
|
/* Draw selected feature to display it on top */
|
|
4471
|
-
|
|
4481
|
+
drawFeatureGeometry(this.getSelectedFeature(), selectedFeatureIndex);
|
|
4472
4482
|
/* Higlight polygon with mousehover */
|
|
4473
4483
|
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) {
|
|
4474
4484
|
const feature = this.getSelectedFeature();
|
|
@@ -4544,12 +4554,17 @@ class MapDraw extends React.PureComponent {
|
|
|
4544
4554
|
mapId
|
|
4545
4555
|
} = this.props;
|
|
4546
4556
|
const {
|
|
4547
|
-
|
|
4548
|
-
type
|
|
4557
|
+
type: geometryType
|
|
4549
4558
|
} = geometry;
|
|
4550
|
-
if (
|
|
4551
|
-
|
|
4552
|
-
|
|
4559
|
+
if (geometryType === 'GeometryCollection') {
|
|
4560
|
+
return {
|
|
4561
|
+
selectedEdge: EDGE.NONE,
|
|
4562
|
+
snappedPolygonIndex: SNAPPEDFEATURE.NONE
|
|
4563
|
+
};
|
|
4564
|
+
}
|
|
4565
|
+
if (geometryType === 'Polygon') {
|
|
4566
|
+
for (let polygonIndex = geometry.coordinates.length - 1; polygonIndex >= 0; polygonIndex -= 1) {
|
|
4567
|
+
const featureCoords = geometry.coordinates[polygonIndex];
|
|
4553
4568
|
if (featureCoords === undefined) {
|
|
4554
4569
|
// eslint-disable-next-line no-continue
|
|
4555
4570
|
continue;
|
|
@@ -4575,8 +4590,8 @@ class MapDraw extends React.PureComponent {
|
|
|
4575
4590
|
snappedPolygonIndex: SNAPPEDFEATURE.NONE
|
|
4576
4591
|
};
|
|
4577
4592
|
}
|
|
4578
|
-
if (
|
|
4579
|
-
const featureCoords = coordinates;
|
|
4593
|
+
if (geometryType === 'LineString') {
|
|
4594
|
+
const featureCoords = geometry.coordinates;
|
|
4580
4595
|
if (featureCoords === undefined) {
|
|
4581
4596
|
return {
|
|
4582
4597
|
selectedEdge: EDGE.NONE,
|
|
@@ -4823,10 +4838,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4823
4838
|
selectedFeatureIndex
|
|
4824
4839
|
} = this.props;
|
|
4825
4840
|
const feature = this.geojson.features[featureIndex];
|
|
4826
|
-
if (!(feature === null || feature === void 0 ? void 0 : feature.geometry)) {
|
|
4827
|
-
return;
|
|
4828
|
-
}
|
|
4829
|
-
if (feature.geometry.type !== 'Polygon' && feature.geometry.type !== 'MultiPolygon') {
|
|
4841
|
+
if (!(feature === null || feature === void 0 ? void 0 : feature.geometry) || XYCoords.length === 0) {
|
|
4830
4842
|
return;
|
|
4831
4843
|
}
|
|
4832
4844
|
let polyProps = feature.properties;
|
|
@@ -4893,7 +4905,7 @@ class MapDraw extends React.PureComponent {
|
|
|
4893
4905
|
return middle;
|
|
4894
4906
|
}
|
|
4895
4907
|
initializeFeatureCoordinates(feature, type) {
|
|
4896
|
-
this.
|
|
4908
|
+
this.initializeFeature(feature);
|
|
4897
4909
|
// eslint-disable-next-line no-underscore-dangle
|
|
4898
4910
|
if (feature.properties._type) {
|
|
4899
4911
|
delete feature.properties._type;
|
|
@@ -4905,27 +4917,32 @@ class MapDraw extends React.PureComponent {
|
|
|
4905
4917
|
break;
|
|
4906
4918
|
case DRAWMODE.MULTIPOINT:
|
|
4907
4919
|
feature.geometry.type = 'MultiPoint';
|
|
4908
|
-
if (feature.geometry.coordinates.length === 0) {
|
|
4909
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4910
|
-
feature.geometry.coordinates.push([]);
|
|
4911
|
-
}
|
|
4912
4920
|
break;
|
|
4913
4921
|
case DRAWMODE.BOX:
|
|
4914
4922
|
feature.geometry.type = 'Polygon';
|
|
4915
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
4916
4923
|
feature.properties._type = 'box';
|
|
4917
4924
|
break;
|
|
4918
4925
|
case DRAWMODE.POLYGON:
|
|
4919
4926
|
feature.geometry.type = 'Polygon';
|
|
4927
|
+
break;
|
|
4928
|
+
case DRAWMODE.LINESTRING:
|
|
4929
|
+
feature.geometry.type = 'LineString';
|
|
4930
|
+
break;
|
|
4931
|
+
}
|
|
4932
|
+
// eslint-disable-next-line default-case
|
|
4933
|
+
switch (feature.geometry.type) {
|
|
4934
|
+
case 'MultiPoint':
|
|
4920
4935
|
if (feature.geometry.coordinates.length === 0) {
|
|
4921
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4922
4936
|
feature.geometry.coordinates.push([]);
|
|
4923
4937
|
}
|
|
4924
4938
|
break;
|
|
4925
|
-
case
|
|
4926
|
-
feature.
|
|
4939
|
+
case 'Polygon':
|
|
4940
|
+
if (feature.properties._type !== 'box' && feature.geometry.coordinates.length === 0) {
|
|
4941
|
+
feature.geometry.coordinates.push([]);
|
|
4942
|
+
}
|
|
4943
|
+
break;
|
|
4944
|
+
case 'LineString':
|
|
4927
4945
|
if (feature.geometry.coordinates.length === 0) {
|
|
4928
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4929
4946
|
feature.geometry.coordinates.push([]);
|
|
4930
4947
|
}
|
|
4931
4948
|
break;
|
|
@@ -5592,6 +5609,65 @@ const intersectionFeatureBE = {
|
|
|
5592
5609
|
},
|
|
5593
5610
|
properties: defaultGeoJSONStyleProperties
|
|
5594
5611
|
};
|
|
5612
|
+
const simpleGeometryCollectionGeoJSON = {
|
|
5613
|
+
type: 'FeatureCollection',
|
|
5614
|
+
features: [{
|
|
5615
|
+
type: 'Feature',
|
|
5616
|
+
properties: {
|
|
5617
|
+
stroke: '#8F8',
|
|
5618
|
+
'stroke-width': 4,
|
|
5619
|
+
'stroke-opacity': 1,
|
|
5620
|
+
fill: '#33ccFF',
|
|
5621
|
+
'fill-opacity': 0.5,
|
|
5622
|
+
country: 'Finland',
|
|
5623
|
+
details: {
|
|
5624
|
+
identifier: '2.49.0.0.246.0.FI.240410113246.jma418B852H2nBY1ntp3',
|
|
5625
|
+
severity: 'Moderate',
|
|
5626
|
+
certainty: 'Possible',
|
|
5627
|
+
onset: '2024-04-11T12:00:00+03:00',
|
|
5628
|
+
expires: '2024-04-11T18:00:00+03:00',
|
|
5629
|
+
languages: [{
|
|
5630
|
+
language: 'fi-FI',
|
|
5631
|
+
event: 'Tuulivaroitus maa-alueille',
|
|
5632
|
+
senderName: 'Ilmatieteen laitos',
|
|
5633
|
+
headline: '',
|
|
5634
|
+
description: 'Tuulivaroitus maa-alueille: Länsituuli on voimakasta iltapäivällä, tuulen nopeus puuskissa 20 m/s.',
|
|
5635
|
+
areaDesc: 'Kainuu, Pudasjärvi, Taivalkoski, Kuusamo'
|
|
5636
|
+
}, {
|
|
5637
|
+
language: 'sv-SE',
|
|
5638
|
+
event: 'Vindvarning för landområden',
|
|
5639
|
+
senderName: 'Meteorologiska institutet',
|
|
5640
|
+
headline: '',
|
|
5641
|
+
description: 'Vindvarning för landområden: På eftermiddagen är den västliga vinden kraftigt, i vindbyarna 20 m/s.',
|
|
5642
|
+
areaDesc: 'Kainuu, Pudasjärvi, Taivalkoski, Kuusamo'
|
|
5643
|
+
}, {
|
|
5644
|
+
language: 'en-GB',
|
|
5645
|
+
event: 'Wind warning for land areas',
|
|
5646
|
+
senderName: 'Finnish Meteorological Institute',
|
|
5647
|
+
headline: '',
|
|
5648
|
+
description: 'Wind warning for land areas: In the afternoon, strong winds from west may bring strong gusts of 20 m/s.',
|
|
5649
|
+
areaDesc: 'Kainuu, Pudasjärvi, Taivalkoski, Kuusamo'
|
|
5650
|
+
}]
|
|
5651
|
+
}
|
|
5652
|
+
},
|
|
5653
|
+
geometry: {
|
|
5654
|
+
type: 'GeometryCollection',
|
|
5655
|
+
geometries: [{
|
|
5656
|
+
type: 'MultiPolygon',
|
|
5657
|
+
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]]]]
|
|
5658
|
+
}, {
|
|
5659
|
+
type: 'MultiPolygon',
|
|
5660
|
+
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]]]]
|
|
5661
|
+
}, {
|
|
5662
|
+
type: 'MultiPolygon',
|
|
5663
|
+
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]]]]
|
|
5664
|
+
}, {
|
|
5665
|
+
type: 'MultiPolygon',
|
|
5666
|
+
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]]]]
|
|
5667
|
+
}]
|
|
5668
|
+
}
|
|
5669
|
+
}]
|
|
5670
|
+
};
|
|
5595
5671
|
|
|
5596
5672
|
const drawPolyStoryStyles = {
|
|
5597
5673
|
MapDrawGeoJSONContainer: {
|
|
@@ -6003,13 +6079,13 @@ const getGeoJson = (geojson, shouldAllowMultipleShapes) => {
|
|
|
6003
6079
|
const {
|
|
6004
6080
|
geometry
|
|
6005
6081
|
} = geojson.features[0];
|
|
6006
|
-
if (geometry.type === '
|
|
6007
|
-
return geojson
|
|
6082
|
+
if (geometry.type === 'Polygon' && geometry.coordinates.length > 1) {
|
|
6083
|
+
return produce(geojson, draft => {
|
|
6084
|
+
const draftFeature = draft.features[0];
|
|
6085
|
+
draftFeature.geometry.coordinates = [draftFeature.geometry.coordinates[1]];
|
|
6086
|
+
});
|
|
6008
6087
|
}
|
|
6009
|
-
return
|
|
6010
|
-
const draftFeature = draft.features[0];
|
|
6011
|
-
draftFeature.geometry.coordinates = [draftFeature.geometry.coordinates[1]];
|
|
6012
|
-
}) : geojson;
|
|
6088
|
+
return geojson;
|
|
6013
6089
|
};
|
|
6014
6090
|
const hasFeatures = geometry => {
|
|
6015
6091
|
if (geometry.type === 'Point') {
|
|
@@ -10203,7 +10279,8 @@ class ReactMapView extends React.Component {
|
|
|
10203
10279
|
listeners,
|
|
10204
10280
|
srs,
|
|
10205
10281
|
bbox,
|
|
10206
|
-
onMapPinChangeLocation
|
|
10282
|
+
onMapPinChangeLocation,
|
|
10283
|
+
shouldDisablePrefetching
|
|
10207
10284
|
} = this.props;
|
|
10208
10285
|
/* Check if we have something to mount IWMJSMap on */
|
|
10209
10286
|
if (this.adagucWebMapJSRef.current === null) {
|
|
@@ -10217,6 +10294,7 @@ class ReactMapView extends React.Component {
|
|
|
10217
10294
|
webmapUtils.unRegisterWMJSMap(mapId);
|
|
10218
10295
|
}
|
|
10219
10296
|
const wmjsMap = new WMJSMap(this.adagucWebMapJSRef.current);
|
|
10297
|
+
wmjsMap.shouldPrefetch = !shouldDisablePrefetching;
|
|
10220
10298
|
this.adaguc.currentChildren = [];
|
|
10221
10299
|
this.adaguc.baseLayers = [];
|
|
10222
10300
|
webmapUtils.registerWMJSMap(wmjsMap, mapId);
|
|
@@ -10392,7 +10470,7 @@ class ReactMapView extends React.Component {
|
|
|
10392
10470
|
}
|
|
10393
10471
|
}
|
|
10394
10472
|
ReactMapView.defaultProps = {
|
|
10395
|
-
srs:
|
|
10473
|
+
srs: PROJECTION.EPSG_3857.value,
|
|
10396
10474
|
bbox: {
|
|
10397
10475
|
left: -2324980.5498391856,
|
|
10398
10476
|
bottom: 5890854.775012179,
|
|
@@ -10758,6 +10836,7 @@ const MapView = _a => {
|
|
|
10758
10836
|
children: jsx(ReactMapView, Object.assign({}, reactMapViewProps, {
|
|
10759
10837
|
showLegend: false,
|
|
10760
10838
|
displayTimeInMap: false,
|
|
10839
|
+
shouldDisablePrefetching: props.shouldDisablePrefetching,
|
|
10761
10840
|
onWMJSMount: id => {
|
|
10762
10841
|
const webMapJS = webmapUtils.getWMJSMapById(id);
|
|
10763
10842
|
if (!webMapJS) {
|
|
@@ -12399,4 +12478,4 @@ var publicLayers = /*#__PURE__*/Object.freeze({
|
|
|
12399
12478
|
veiligheidsRegiosGebiedsIndelingenLabels: veiligheidsRegiosGebiedsIndelingenLabels
|
|
12400
12479
|
});
|
|
12401
12480
|
|
|
12402
|
-
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 };
|
|
12481
|
+
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
|
{
|
|
2
2
|
"name": "@opengeoweb/webmap-react",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.27.0",
|
|
4
4
|
"description": "GeoWeb react wrapper for webmap",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
"react-i18next": "^14.1.2"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"react": "18"
|
|
26
|
+
"react": "18",
|
|
27
|
+
"@emotion/react": "*",
|
|
28
|
+
"@emotion/styled": "*"
|
|
27
29
|
},
|
|
28
30
|
"module": "./index.esm.js",
|
|
29
31
|
"type": "module",
|
package/src/index.d.ts
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>>;
|
|
@@ -26,6 +26,7 @@ export interface ReactMapViewProps {
|
|
|
26
26
|
showLayerInfo?: boolean;
|
|
27
27
|
disableMapPin?: boolean;
|
|
28
28
|
holdShiftToScroll?: boolean;
|
|
29
|
+
shouldDisablePrefetching?: boolean;
|
|
29
30
|
onWMJSMount?: (mapId: string) => void;
|
|
30
31
|
onWMJSUnMount?: (mapId: string) => void;
|
|
31
32
|
onMapChangeDimension?: (payload: SetMapDimensionPayload) => void;
|