Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Show warning when adding more than 1 part to single geometry layers
  • Loading branch information
tudorbarascu authored and 3nids committed Jan 16, 2017
1 parent 50e5d97 commit e7c9b74
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/qgsmaptooladdpart.cpp
Expand Up @@ -65,6 +65,10 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent * e )
return;
}

bool isGeometryEmpty = false;
if ( vlayer->selectedFeatures()[0].geometry().isEmpty() )
isGeometryEmpty = true;

if ( !checkSelection() )
{
stopCapturing();
Expand Down Expand Up @@ -194,6 +198,12 @@ void QgsMapToolAddPart::cadCanvasReleaseEvent( QgsMapMouseEvent * e )
vlayer->endEditCommand();

vlayer->triggerRepaint();

if (( !isGeometryEmpty ) && QgsWkbTypes::isSingleType( vlayer->wkbType() ) )
{
emit messageEmitted( tr( "Add part: Feature geom is single part and you've added more than one" ), QgsMessageBar::WARNING );
}

return;
}

Expand Down

0 comments on commit e7c9b74

Please sign in to comment.