Skip to content

Commit

Permalink
Minor fixes in intersection removal for the reshape tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Mercier committed Apr 25, 2016
1 parent 44cccfc commit 181c0c4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/app/qgsmaptoolreshape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,21 @@ void QgsMapToolReshape::cadCanvasReleaseEvent( QgsMapMouseEvent * e )
//avoid intersections on polygon layers
if ( vlayer->geometryType() == QGis::Polygon )
{

//ignore all current layer features as they should be reshaped too
QMap<QgsVectorLayer*, QSet<QgsFeatureId>> ignoreFeatures;
ignoreFeatures.insert( vlayer, vlayer->allFeatureIds() );

int avoidIntersectionsReturn = geom->avoidIntersections( ignoreFeatures );
if ( avoidIntersectionsReturn == 1 )
if ( geom->avoidIntersections( ignoreFeatures ) != 0 )
{
//not a polygon type. Impossible to get there
emit messageEmitted( tr( "An error was reported during intersection removal" ), QgsMessageBar::CRITICAL );
vlayer->destroyEditCommand();
stopCapturing();
return;
}
if ( geom->isGeosEmpty() ) //avoid intersection might have removed the whole geometry

if ( geom->isGeosEmpty() ) //intersection removal might have removed the whole geometry
{
emit messageEmitted( tr( "The feature cannot be reshaped because resulting geometry is empty" ), QgsMessageBar::CRITICAL );
emit messageEmitted( tr( "The feature cannot be reshaped because the resulting geometry is empty" ), QgsMessageBar::CRITICAL );
vlayer->destroyEditCommand();
stopCapturing();
return;
Expand Down

0 comments on commit 181c0c4

Please sign in to comment.