Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a message if there is an unfixable error with a geometry
  • Loading branch information
lbartoletti authored and nyalldawson committed Feb 12, 2021
1 parent 9783710 commit 282ccb9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/core/geometry/qgsgeometryeditutils.h
Expand Up @@ -71,10 +71,12 @@ class QgsGeometryEditUtils
* Alters a geometry so that it avoids intersections with features from all open vector layers.
* \param geom geometry to alter
* \param avoidIntersectionsLayers list of layers to check for intersections
* \param haveGeometryError the method will use GEOS to fix the geometries, if at least one geometry cannot be fixed, it returns false (The geometry, may not be modified.)
* \param ignoreFeatures map of layer to feature id of features to ignore
*/
static std::unique_ptr< QgsAbstractGeometry > avoidIntersections( const QgsAbstractGeometry &geom,
const QList<QgsVectorLayer *> &avoidIntersectionsLayers,
bool &haveGeometryError,
const QHash<QgsVectorLayer *, QSet<QgsFeatureId> > &ignoreFeatures = ( QHash<QgsVectorLayer *, QSet<QgsFeatureId> >() ) );
};

Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsmaptooldigitizefeature.cpp
Expand Up @@ -341,9 +341,9 @@ void QgsMapToolDigitizeFeature::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
QgsGeometry featGeom = f->geometry();
int avoidIntersectionsReturn = featGeom.avoidIntersections( avoidIntersectionsLayers );
f->setGeometry( featGeom );
if ( avoidIntersectionsReturn == 1 )
if ( avoidIntersectionsReturn == 3 )
{
//not a polygon type. Impossible to get there
emit messageEmitted( tr( "The feature has been added, but at least one geometry intersected is invalid and cannot be fixed automaticaly. The geometry added may overlap another geometry. You should fix geometries." ), Qgis::Warning );
}
if ( f->geometry().isEmpty() ) //avoid intersection might have removed the whole geometry
{
Expand Down

0 comments on commit 282ccb9

Please sign in to comment.