@@ -1628,6 +1628,19 @@ static QVariant fcnYMax( const QVariantList& values, const QgsExpressionContext*
1628
1628
return QVariant::fromValue ( geom.boundingBox ().yMaximum () );
1629
1629
}
1630
1630
1631
+ static QVariant fcnIsClosed ( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
1632
+ {
1633
+ QgsGeometry fGeom = getGeometry ( values.at ( 0 ), parent );
1634
+ if ( fGeom .isEmpty () )
1635
+ return QVariant ();
1636
+
1637
+ QgsCurveV2* curve = dynamic_cast < QgsCurveV2* >( fGeom .geometry () );
1638
+ if ( !curve )
1639
+ return QVariant ();
1640
+
1641
+ return QVariant::fromValue ( curve->isClosed () );
1642
+ }
1643
+
1631
1644
static QVariant fcnRelate ( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
1632
1645
{
1633
1646
if ( values.length () < 2 || values.length () > 3 )
@@ -2430,7 +2443,7 @@ const QStringList& QgsExpression::BuiltinFunctions()
2430
2443
<< " disjoint" << " intersects" << " touches" << " crosses" << " contains"
2431
2444
<< " relate"
2432
2445
<< " overlaps" << " within" << " buffer" << " centroid" << " bounds" << " reverse" << " exterior_ring"
2433
- << " bounds_width" << " bounds_height" << " convex_hull" << " difference"
2446
+ << " bounds_width" << " bounds_height" << " is_closed " << " convex_hull" << " difference"
2434
2447
<< " distance" << " intersection" << " sym_difference" << " combine"
2435
2448
<< " union" << " geom_to_wkt" << " geomToWKT" << " geometry"
2436
2449
<< " transform" << " get_feature" << " getFeature"
@@ -2578,6 +2591,7 @@ const QList<QgsExpression::Function*>& QgsExpression::Functions()
2578
2591
<< new StaticFunction ( " num_points" , 1 , fcnGeomNumPoints, " GeometryGroup" )
2579
2592
<< new StaticFunction ( " bounds_width" , 1 , fcnBoundsWidth, " GeometryGroup" )
2580
2593
<< new StaticFunction ( " bounds_height" , 1 , fcnBoundsHeight, " GeometryGroup" )
2594
+ << new StaticFunction ( " is_closed" , 1 , fcnIsClosed, " GeometryGroup" )
2581
2595
<< new StaticFunction ( " convex_hull" , 1 , fcnConvexHull, " GeometryGroup" , QString (), false , QStringList (), false , QStringList () << " convexHull" )
2582
2596
<< new StaticFunction ( " difference" , 2 , fcnDifference, " GeometryGroup" )
2583
2597
<< new StaticFunction ( " distance" , 2 , fcnDistance, " GeometryGroup" )
0 commit comments