Skip to content

Commit b99ff61

Browse files
committed
added pi as a selectable constant
pi can be found under Math in Fieldcalculator
1 parent 8ba1999 commit b99ff61

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/core/qgsexpression.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,11 @@ static QVariant fcnRound( const QVariantList& values , QgsFeature *f, QgsExpress
948948
return QVariant();
949949
}
950950

951+
static QVariant fcnPi( const QVariantList& values , QgsFeature *f, QgsExpression* parent )
952+
{
953+
return M_PI;
954+
}
955+
951956
static QVariant fcnScale( const QVariantList&, QgsFeature*, QgsExpression* parent )
952957
{
953958
return QVariant( parent->scale() );
@@ -1045,6 +1050,7 @@ const QList<QgsExpression::Function*> &QgsExpression::Functions()
10451050
<< new StaticFunction( "log10", 1, fcnLog10, QObject::tr( "Math" ) )
10461051
<< new StaticFunction( "log", 2, fcnLog, QObject::tr( "Math" ) )
10471052
<< new StaticFunction( "round", -1, fcnRound, QObject::tr( "Math" ) )
1053+
<< new StaticFunction( "$pi", 0, fcnPi, QObject::tr( "Math" ) )
10481054
<< new StaticFunction( "toint", 1, fcnToInt, QObject::tr( "Conversions" ) )
10491055
<< new StaticFunction( "toreal", 1, fcnToReal, QObject::tr( "Conversions" ) )
10501056
<< new StaticFunction( "tostring", 1, fcnToString, QObject::tr( "Conversions" ) )

0 commit comments

Comments
 (0)