Skip to content

Commit

Permalink
Much faster zoom to selection on large PostGIS layers
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 5, 2015
1 parent 33fe0e2 commit 6772ffb
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,17 +619,16 @@ QgsRectangle QgsVectorLayer::boundingBoxOfSelected()
QgsFeature fet;
if ( mDataProvider->capabilities() & QgsVectorDataProvider::SelectAtId )
{
Q_FOREACH ( QgsFeatureId fid, mSelectedFeatureIds )
QgsFeatureIterator fit = getFeatures( QgsFeatureRequest()
.setFilterFids( mSelectedFeatureIds )
.setSubsetOfAttributes( QgsAttributeList() ) );

while ( fit.nextFeature( fet ) )
{
if ( getFeatures( QgsFeatureRequest()
.setFilterFid( fid )
.setSubsetOfAttributes( QgsAttributeList() ) )
.nextFeature( fet ) &&
fet.constGeometry() )
{
r = fet.constGeometry()->boundingBox();
retval.combineExtentWith( &r );
}
if ( !fet.constGeometry() || fet.constGeometry()->isEmpty() )
continue;
r = fet.constGeometry()->boundingBox();
retval.combineExtentWith( &r );
}
}
else
Expand Down

0 comments on commit 6772ffb

Please sign in to comment.