Skip to content
Permalink
Browse files

Merge pull request #3087 from arnaud-morvan/maptooladdfeature_avoidin…

…tersections_nullgeometry

In tool add feature, reject null geometry due to intersection avoidance
  • Loading branch information
mhugent committed May 20, 2016
2 parents ff4532c + 17fd3d8 commit b6923758bce15c500ad970884f5ebc91ba99fd36
Showing with 2 additions and 25 deletions.
  1. +2 −25 src/app/qgsmaptooladdfeature.cpp
@@ -274,32 +274,9 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
{
//not a polygon type. Impossible to get there
}
#if 0
else if ( avoidIntersectionsReturn == 2 ) //MH120131: disable this error message until there is a better way to cope with the single type / multi type problem
if ( f->constGeometry()->isGeosEmpty() ) //avoid intersection might have removed the whole geometry
{
//bail out...
emit messageEmitted( tr( "The feature could not be added because removing the polygon intersections would change the geometry type" ), QgsMessageBar::CRITICAL );
stopCapturing();
return;
}
#endif
else if ( avoidIntersectionsReturn == 3 )
{
emit messageEmitted( tr( "An error was reported during intersection removal" ), QgsMessageBar::CRITICAL );
}

if ( !f->constGeometry()->asWkb() ) //avoid intersection might have removed the whole geometry
{
QString reason;
if ( avoidIntersectionsReturn != 2 )
{
reason = tr( "The feature cannot be added because it's geometry is empty" );
}
else
{
reason = tr( "The feature cannot be added because it's geometry collapsed due to intersection avoidance" );
}
emit messageEmitted( reason, QgsMessageBar::CRITICAL );
emit messageEmitted( tr( "The feature cannot be added because it's geometry collapsed due to intersection avoidance" ), QgsMessageBar::CRITICAL );
stopCapturing();
return;
}

0 comments on commit b692375

Please sign in to comment.
You can’t perform that action at this time.