added pi as a selectable constant

pi can be found under Math in Fieldcalculator
This commit is contained in:
Werner Macho 2013-03-31 12:40:03 +02:00
parent 8ba1999515
commit b99ff610eb

View File

@ -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() );
@ -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" ) )