Skip to content

Commit a21fc5a

Browse files
committedApr 8, 2013
[FIX #7533] Field calculator is slow
Set the QgsDistanceArea only once and not for every loop cycle. QgsCoordinateReferenceSystem::loadFromDb takes very long.
1 parent 082c6ba commit a21fc5a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed
 

‎src/app/qgsfieldcalculator.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ void QgsFieldCalculator::accept()
9494

9595
QString calcString = builder->expressionText();
9696
QgsExpression exp( calcString );
97+
exp.setGeomCalculator( myDa );
9798

9899
if ( !mVectorLayer || !mVectorLayer->isEditable() )
99100
return;
@@ -173,8 +174,6 @@ void QgsFieldCalculator::accept()
173174
}
174175

175176
exp.setCurrentRowNumber( rownum );
176-
exp.setGeomCalculator( myDa );
177-
178177
QVariant value = exp.evaluate( &feature );
179178
if ( exp.hasEvalError() )
180179
{

0 commit comments

Comments
 (0)
Please sign in to comment.