Skip to content
Permalink
Browse files

Fix broken select/identify by polygon when layer CRS <> canvas CRS

Fixes #20786

(cherry picked from commit 7c0b68a)
  • Loading branch information
nyalldawson committed Dec 20, 2018
1 parent 7ef9760 commit f62db321c55175db220f0f9799e3edad46e179a3
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/app/qgsmaptoolselectionhandler.cpp
@@ -264,8 +264,10 @@ void QgsMapToolSelectionHandler::selectPolygonPressEvent( QgsMapMouseEvent *e )
auto vectorLayer = static_cast<QgsVectorLayer *>( layer );
if ( vectorLayer->geometryType() == QgsWkbTypes::PolygonGeometry )
{
QgsRectangle r = mCanvas->mapSettings().mapToLayerCoordinates( layer, QgsRectangle( x - sr, y - sr, x + sr, y + sr ) );
QgsFeatureIterator fit = vectorLayer->getFeatures( QgsFeatureRequest().setFilterRect( r ).setFlags( QgsFeatureRequest::ExactIntersect ) );
QgsFeatureIterator fit = vectorLayer->getFeatures( QgsFeatureRequest()
.setDestinationCrs( mCanvas->mapSettings().destinationCrs(), mCanvas->mapSettings().transformContext() )
.setFilterRect( QgsRectangle( x - sr, y - sr, x + sr, y + sr ) )
.setFlags( QgsFeatureRequest::ExactIntersect ) );
QgsFeature f;
while ( fit.nextFeature( f ) )
{

0 comments on commit f62db32

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