Skip to content

Commit

Permalink
Optimize feature iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
uclaros authored and nyalldawson committed Mar 31, 2021
1 parent 49954fb commit 25b710b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/app/qgsmaptoolrotatefeature.cpp
Expand Up @@ -395,12 +395,14 @@ void QgsMapToolRotateFeature::applyRotation( double rotation )

vlayer->beginEditCommand( tr( "Features Rotated" ) );

const auto constMRotatedFeatures = mRotatedFeatures;
for ( QgsFeatureId id : constMRotatedFeatures )
QgsFeatureRequest request;
request.setFilterFids( mRotatedFeatures ).setNoAttributes();
QgsFeatureIterator fi = vlayer->getFeatures( request );
QgsFeature f;
while ( fi.nextFeature( f ) )
{
QgsFeature feat;
vlayer->getFeatures( QgsFeatureRequest().setFilterFid( id ) ).nextFeature( feat );
QgsGeometry geom = feat.geometry();
QgsFeatureId id = f.id();
QgsGeometry geom = f.geometry();
geom.rotate( mRotation, anchorPoint );
vlayer->changeGeometry( id, geom );
}
Expand Down

0 comments on commit 25b710b

Please sign in to comment.