Skip to content
Permalink
Browse files

Optimize feature iteration

  • Loading branch information
uclaros authored and nyalldawson committed Mar 31, 2021
1 parent 49954fb commit 25b710b3c9e72ddd1454e4ad9917f84b76ef4956
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/app/qgsmaptoolrotatefeature.cpp
@@ -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 );
}

0 comments on commit 25b710b

Please sign in to comment.