@@ -3124,6 +3124,24 @@ static QVariant fcnIsClosed( const QVariantList &values, const QgsExpressionCont
3124
3124
return QVariant::fromValue ( curve->isClosed () );
3125
3125
}
3126
3126
3127
+ static QVariant fcnIsEmpty ( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
3128
+ {
3129
+ QgsGeometry fGeom = QgsExpressionUtils::getGeometry ( values.at ( 0 ), parent );
3130
+ if ( fGeom .isNull () )
3131
+ return QVariant ();
3132
+
3133
+ return QVariant::fromValue ( fGeom .isEmpty () );
3134
+ }
3135
+
3136
+ static QVariant fcnIsEmptyOrNull ( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
3137
+ {
3138
+ if ( values.at ( 0 ).isNull () )
3139
+ return QVariant::fromValue ( true );
3140
+
3141
+ QgsGeometry fGeom = QgsExpressionUtils::getGeometry ( values.at ( 0 ), parent );
3142
+ return QVariant::fromValue ( fGeom .isNull () || fGeom .isEmpty () );
3143
+ }
3144
+
3127
3145
static QVariant fcnRelate ( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
3128
3146
{
3129
3147
if ( values.length () < 2 || values.length () > 3 )
@@ -5661,6 +5679,8 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
5661
5679
<< new QgsStaticExpressionFunction ( QStringLiteral ( " bounds_width" ), QgsExpressionFunction::ParameterList () << QgsExpressionFunction::Parameter ( QStringLiteral ( " geom" ) ), fcnBoundsWidth, QStringLiteral ( " GeometryGroup" ) )
5662
5680
<< new QgsStaticExpressionFunction ( QStringLiteral ( " bounds_height" ), QgsExpressionFunction::ParameterList () << QgsExpressionFunction::Parameter ( QStringLiteral ( " geom" ) ), fcnBoundsHeight, QStringLiteral ( " GeometryGroup" ) )
5663
5681
<< new QgsStaticExpressionFunction ( QStringLiteral ( " is_closed" ), QgsExpressionFunction::ParameterList () << QgsExpressionFunction::Parameter ( QStringLiteral ( " geom" ) ), fcnIsClosed, QStringLiteral ( " GeometryGroup" ) )
5682
+ << new QgsStaticExpressionFunction ( QStringLiteral ( " is_empty" ), QgsExpressionFunction::ParameterList () << QgsExpressionFunction::Parameter ( QStringLiteral ( " geom" ) ), fcnIsEmpty, QStringLiteral ( " GeometryGroup" ) )
5683
+ << new QgsStaticExpressionFunction ( QStringLiteral ( " is_empty_or_null" ), QgsExpressionFunction::ParameterList () << QgsExpressionFunction::Parameter ( QStringLiteral ( " geom" ) ), fcnIsEmptyOrNull, QStringLiteral ( " GeometryGroup" ), QString (), false , QSet<QString>(), false , QStringList (), true )
5664
5684
<< new QgsStaticExpressionFunction ( QStringLiteral ( " convex_hull" ), QgsExpressionFunction::ParameterList () << QgsExpressionFunction::Parameter ( QStringLiteral ( " geometry" ) ), fcnConvexHull, QStringLiteral ( " GeometryGroup" ), QString (), false , QSet<QString>(), false , QStringList () << QStringLiteral ( " convexHull" ) )
5665
5685
<< new QgsStaticExpressionFunction ( QStringLiteral ( " oriented_bbox" ), QgsExpressionFunction::ParameterList ()
5666
5686
<< QgsExpressionFunction::Parameter ( QStringLiteral ( " geometry" ) ),
0 commit comments