diff --git a/package.json b/package.json index 9a6596e67..ab5a24fc8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "qwc2", - "version": "2024.02.29-master", + "version": "2024.03.04-master", "description": "QGIS Web Client 2 core", "author": "Sourcepole AG", "license": "BSD-2-Clause", @@ -24,7 +24,6 @@ "flat": "^6.0.1", "formdata-json": "^1.0.0", "geojson-bounding-box": "^0.2.0", - "geojson-polygon-self-intersections": "^1.2.1", "html-react-parser": "^5.0.7", "ismobilejs": "^1.1.1", "jszip": "^3.10.1", @@ -59,6 +58,7 @@ "react-swipeable": "^7.0.1", "redux-logger": "^3.0.6", "reselect": "^5.0.1", + "simplepolygon": "^1.2.3", "sortablejs": "^1.15.1", "stream-browserify": "^3.0.0", "svgpath": "^2.6.0", diff --git a/plugins/map/RedliningSupport.jsx b/plugins/map/RedliningSupport.jsx index 267a2aae5..2904cdd4c 100644 --- a/plugins/map/RedliningSupport.jsx +++ b/plugins/map/RedliningSupport.jsx @@ -9,8 +9,6 @@ import React from 'react'; import {connect} from 'react-redux'; -import polySelfIntersections from 'geojson-polygon-self-intersections'; -import isEmpty from 'lodash.isempty'; import ol from 'openlayers'; import PropTypes from 'prop-types'; import {createSelector} from 'reselect'; @@ -541,7 +539,7 @@ class RedliningSupport extends React.Component { if ( (feature.shape === "Text" && !feature.properties.label) || (feature.shape === "Circle" && feature.circleParams.radius === 0) || - (feature.geometry?.type === "Polygon" && (!isEmpty(polySelfIntersections(feature).geometry.coordinates) || this.currentFeature.getGeometry().getArea() === 0)) + (feature.geometry?.type === "Polygon" && this.currentFeature.getGeometry().getArea() === 0) ) { if (!newFeature) { this.props.removeLayerFeatures(this.props.redlining.layer, [feature.id]); diff --git a/utils/VectorLayerUtils.js b/utils/VectorLayerUtils.js index ae2464cf2..6e3a49aa0 100644 --- a/utils/VectorLayerUtils.js +++ b/utils/VectorLayerUtils.js @@ -10,6 +10,7 @@ import geojsonBbox from 'geojson-bounding-box'; import isEmpty from 'lodash.isempty'; import {getDefaultImageStyle} from 'ol/format/KML'; import ol from 'openlayers'; +import simplepolygon from 'simplepolygon'; import svgpath from 'svgpath'; import {v1 as uuidv1} from 'uuid'; @@ -42,7 +43,10 @@ const VectorLayerUtils = { if (layer.type !== 'vector' || (layer.features || []).length === 0 || layer.visibility === false || layer.skipPrint === true) { continue; } - for (const feature of layer.features) { + const features = layer.features.map(feature => + feature.geometry.type === "Polygon" ? simplepolygon(feature).features.map(f => ({...feature, geometry: f.geometry})) : feature + ).flat(); + for (const feature of features) { if (!VectorLayerUtils.validateGeometry(feature.geometry)) { continue; }