Skip to content

Commit

Permalink
Fix performance issues with moving selection on canvas (Funded by goo…
Browse files Browse the repository at this point in the history
…d will)

Fix #11197
  • Loading branch information
m-kuhn committed Sep 22, 2014
1 parent 96e39f7 commit 68c49fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolmovefeature.cpp
Expand Up @@ -120,9 +120,9 @@ void QgsMapToolMoveFeature::canvasPressEvent( QMouseEvent * e )
mMovedFeatures = vlayer->selectedFeaturesIds();

mRubberBand = createRubberBand( vlayer->geometryType() );
for ( int i = 0; i < vlayer->selectedFeatureCount(); i++ )
Q_FOREACH( const QgsFeature& feat, vlayer->selectedFeatures() )
{
mRubberBand->addGeometry( vlayer->selectedFeatures()[i].geometry(), vlayer );
mRubberBand->addGeometry( feat.geometry(), vlayer );
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -2305,10 +2305,14 @@ QgsFeatureList QgsVectorLayer::selectedFeatures()
if ( geometryType() == QGis::NoGeometry )
req.setFlags( QgsFeatureRequest::NoGeometry );

foreach ( QgsFeatureId fid, mSelectedFeatureIds )
req.setFilterFids( mSelectedFeatureIds );

QgsFeatureIterator it = getFeatures( req );

QgsFeature f;
while ( it.nextFeature( f ) )
{
features.push_back( QgsFeature() );
getFeatures( req.setFilterFid( fid ) ).nextFeature( features.back() );
features.push_back( f );
}

return features;
Expand Down

0 comments on commit 68c49fe

Please sign in to comment.