Skip to content

Commit

Permalink
[delete part] use snapping index to find part
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 19, 2018
1 parent 42908eb commit 7701ea6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/app/qgsmaptooldeletepart.cpp
Expand Up @@ -160,15 +160,17 @@ QgsGeometry QgsMapToolDeletePart::partUnderPoint( QPoint point, QgsFeatureId &fi
}
case QgsWkbTypes::PolygonGeometry:
{
QgsPointXY layerCoords = toLayerCoordinates( vlayer, point );
double searchRadius = QgsTolerance::vertexSearchRadius( mCanvas->currentLayer(), mCanvas->mapSettings() );
QgsRectangle selectRect( layerCoords.x() - searchRadius, layerCoords.y() - searchRadius,
layerCoords.x() + searchRadius, layerCoords.y() + searchRadius );
QgsFeatureIterator fit = vlayer->getFeatures( QgsFeatureRequest().setFilterRect( selectRect ) );
fit.nextFeature( f );
QgsPointLocator::Match match = mCanvas->snappingUtils()->snapToCurrentLayer( point, QgsPointLocator::Area );
if ( !match.isValid() )
return geomPart;

vlayer->getFeatures( QgsFeatureRequest().setFilterFid( match.featureId() ) ).nextFeature( f );
QgsGeometry g = f.geometry();
if ( g.isNull() )
return geomPart;

QgsPointXY layerCoords = toLayerCoordinates( vlayer, point );

if ( !g.isMultipart() )
{
fid = f.id();
Expand Down

0 comments on commit 7701ea6

Please sign in to comment.