Skip to content

Commit

Permalink
[FIX #7533] Field calculator is slow
Browse files Browse the repository at this point in the history
Set the QgsDistanceArea only once and not for every loop cycle.
QgsCoordinateReferenceSystem::loadFromDb takes very long.
  • Loading branch information
m-kuhn committed Apr 8, 2013
1 parent 082c6ba commit a21fc5a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/app/qgsfieldcalculator.cpp
Expand Up @@ -94,6 +94,7 @@ void QgsFieldCalculator::accept()

QString calcString = builder->expressionText();
QgsExpression exp( calcString );
exp.setGeomCalculator( myDa );

if ( !mVectorLayer || !mVectorLayer->isEditable() )
return;
Expand Down Expand Up @@ -173,8 +174,6 @@ void QgsFieldCalculator::accept()
}

exp.setCurrentRowNumber( rownum );
exp.setGeomCalculator( myDa );

QVariant value = exp.evaluate( &feature );
if ( exp.hasEvalError() )
{
Expand Down

0 comments on commit a21fc5a

Please sign in to comment.