Skip to content
Permalink
Browse files

[delete part] use snapping index to find part

  • Loading branch information
3nids committed Feb 19, 2018
1 parent 42908eb commit 7701ea6c9a382bfadf185892c64fa7135e1c4260
Showing with 8 additions and 6 deletions.
  1. +8 −6 src/app/qgsmaptooldeletepart.cpp
@@ -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();

0 comments on commit 7701ea6

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