@@ -1921,8 +1921,7 @@ Modifies geometry to avoid intersections with the layers specified in project pr
:return: 0 in case of success,
1 if geometry is not of polygon type,
2 if avoid intersection would change the geometry type,
3 other error during intersection removal,
4 in case of success but at least one geometry intersected was invalid and fixed to perform the operation
3 at least one geometry intersected is invalid. The algorithm may not work and return the same geometry as the input. You must fix your intersecting geometries.
QgisApp::instance()->messageBar()->pushCritical( tr( "Add Feature" ), tr( "An error was reported during intersection removal." ) );
QgisApp::instance()->messageBar()->pushCritical( tr( "Add Feature" ), tr( "The feature has been added, but at least one geometry intersected is invalid. You should fix geometries." ) );
@@ -2016,8 +2016,7 @@ class CORE_EXPORT QgsGeometry
* \returns 0 in case of success,
* 1 if geometry is not of polygon type,
* 2 if avoid intersection would change the geometry type,
* 3 other error during intersection removal,
* 4 in case of success but at least one geometry intersected was invalid and fixed to perform the operation
* 3 at least one geometry intersected is invalid. The algorithm may not work and return the same geometry as the input. You must fix your intersecting geometries.
* 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 hadInvalidGeometry returns true if at least one geometry intersected was invalid.
* \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 haveInvalidGeometry returns true if at least one geometry intersected is invalid. In this case, the algorithm may not work and return the same geometry as the input. You must fix your intersecting geometries.
* \param ignoreFeatures map of layer to feature id of features to ignore
int avoidIntersectionsReturn = featGeom.avoidIntersections( avoidIntersectionsLayers );
f->setGeometry( featGeom );
switch ( avoidIntersectionsReturn )
if ( avoidIntersectionsReturn == 3 )
{
case3:
emit messageEmitted( tr( "The feature has been added, but at least one geometry intersected is invalid and cannot be fixed automatically. The geometry added may overlap another geometry. You should fix geometries." ), Qgis::Warning );
break;
case4:
emit messageEmitted( tr( "The feature has been added, but at least one geometry intersected is invalid and has been modified to perform the operation. You should fix geometries." ), Qgis::Warning );
break;
emit messageEmitted( tr( "The feature has been added, but at least one geometry intersected is invalid. You should fix geometries." ), Qgis::Warning );
}
if ( f->geometry().isEmpty() ) //avoid intersection might have removed the whole geometry