Skip to content

Commit

Permalink
added pi as a selectable constant
Browse files Browse the repository at this point in the history
pi can be found under Math in Fieldcalculator
  • Loading branch information
mach0 committed Mar 31, 2013
1 parent 8ba1999 commit b99ff61
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/qgsexpression.cpp
Expand Up @@ -948,6 +948,11 @@ static QVariant fcnRound( const QVariantList& values , QgsFeature *f, QgsExpress
return QVariant();
}

static QVariant fcnPi( const QVariantList& values , QgsFeature *f, QgsExpression* parent )
{
return M_PI;
}

static QVariant fcnScale( const QVariantList&, QgsFeature*, QgsExpression* parent )
{
return QVariant( parent->scale() );
Expand Down Expand Up @@ -1045,6 +1050,7 @@ const QList<QgsExpression::Function*> &QgsExpression::Functions()
<< new StaticFunction( "log10", 1, fcnLog10, QObject::tr( "Math" ) )
<< new StaticFunction( "log", 2, fcnLog, QObject::tr( "Math" ) )
<< new StaticFunction( "round", -1, fcnRound, QObject::tr( "Math" ) )
<< new StaticFunction( "$pi", 0, fcnPi, QObject::tr( "Math" ) )
<< new StaticFunction( "toint", 1, fcnToInt, QObject::tr( "Conversions" ) )
<< new StaticFunction( "toreal", 1, fcnToReal, QObject::tr( "Conversions" ) )
<< new StaticFunction( "tostring", 1, fcnToString, QObject::tr( "Conversions" ) )
Expand Down

0 comments on commit b99ff61

Please sign in to comment.