Skip to content
Permalink
Browse files

Min/max exp functions have custom Null handler

  • Loading branch information
m-kuhn committed Dec 27, 2017
1 parent c063710 commit 272a02dfdbb1bdf728346e1df5fe286cd5d0536c
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/core/expression/qgsexpressionfunction.cpp
@@ -415,7 +415,7 @@ static QVariant fcnExpScale( const QVariantList &values, const QgsExpressionCont

static QVariant fcnMax( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
{
QVariant result;
QVariant result( QVariant::Double );
double maxVal = std::numeric_limits<double>::quiet_NaN();
for ( const QVariant &val : values )
{
@@ -439,7 +439,7 @@ static QVariant fcnMax( const QVariantList &values, const QgsExpressionContext *

static QVariant fcnMin( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
{
QVariant result;
QVariant result( QVariant::Double );
double minVal = std::numeric_limits<double>::quiet_NaN();
for ( const QVariant &val : values )
{
@@ -3941,8 +3941,8 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
sFunctions << randfFunc;

sFunctions
<< new QgsStaticExpressionFunction( QStringLiteral( "max" ), -1, fcnMax, QStringLiteral( "Math" ) )
<< new QgsStaticExpressionFunction( QStringLiteral( "min" ), -1, fcnMin, QStringLiteral( "Math" ) )
<< new QgsStaticExpressionFunction( QStringLiteral( "max" ), -1, fcnMax, QStringLiteral( "Math" ), QString(), false, QSet<QString>(), false, QStringList(), /* handlesNull = */ true )
<< new QgsStaticExpressionFunction( QStringLiteral( "min" ), -1, fcnMin, QStringLiteral( "Math" ), QString(), false, QSet<QString>(), false, QStringList(), /* handlesNull = */ true )
<< new QgsStaticExpressionFunction( QStringLiteral( "clamp" ), QgsExpressionFunction::ParameterList() << QgsExpressionFunction::Parameter( QStringLiteral( "min" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "value" ) ) << QgsExpressionFunction::Parameter( QStringLiteral( "max" ) ), fcnClamp, QStringLiteral( "Math" ) )
<< new QgsStaticExpressionFunction( QStringLiteral( "scale_linear" ), 5, fcnLinearScale, QStringLiteral( "Math" ) )
<< new QgsStaticExpressionFunction( QStringLiteral( "scale_exp" ), 6, fcnExpScale, QStringLiteral( "Math" ) )

0 comments on commit 272a02d

Please sign in to comment.
You can’t perform that action at this time.