Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Avoid intersections in reshape tool
- Loading branch information
Showing
with
22 additions
and
0 deletions.
-
+22
−0
src/app/qgsmaptoolreshape.cpp
|
@@ -100,6 +100,28 @@ void QgsMapToolReshape::cadCanvasReleaseEvent( QgsMapMouseEvent * e ) |
|
|
reshapeReturn = geom->reshapeGeometry( points() ); |
|
|
if ( reshapeReturn == 0 ) |
|
|
{ |
|
|
//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 ) |
|
|
{ |
|
|
//not a polygon type. Impossible to get there |
|
|
} |
|
|
if ( geom->isGeosEmpty() ) //avoid intersection might have removed the whole geometry |
|
|
{ |
|
|
emit messageEmitted( tr( "The feature cannot be reshaped because resulting geometry is empty" ), QgsMessageBar::CRITICAL ); |
|
|
vlayer->destroyEditCommand(); |
|
|
stopCapturing(); |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
vlayer->changeGeometry( f.id(), geom ); |
|
|
reshapeDone = true; |
|
|
} |
|
|