@@ -1777,6 +1777,21 @@ static QVariant fcnReverse( const QVariantList& values, const QgsExpressionConte
1777
1777
return result;
1778
1778
}
1779
1779
1780
+ static QVariant fcnExteriorRing ( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
1781
+ {
1782
+ QgsGeometry fGeom = getGeometry ( values.at ( 0 ), parent );
1783
+ if ( fGeom .isEmpty () )
1784
+ return QVariant ();
1785
+
1786
+ QgsCurvePolygonV2* curvePolygon = dynamic_cast < QgsCurvePolygonV2* >( fGeom .geometry () );
1787
+ if ( !curvePolygon || !curvePolygon->exteriorRing () )
1788
+ return QVariant ();
1789
+
1790
+ QgsCurveV2* exterior = static_cast < QgsCurveV2* >( curvePolygon->exteriorRing ()->clone () );
1791
+ QVariant result = exterior ? QVariant::fromValue ( QgsGeometry ( exterior ) ) : QVariant ();
1792
+ return result;
1793
+ }
1794
+
1780
1795
static QVariant fcnDistance ( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
1781
1796
{
1782
1797
QgsGeometry fGeom = getGeometry ( values.at ( 0 ), parent );
@@ -2414,7 +2429,7 @@ const QStringList& QgsExpression::BuiltinFunctions()
2414
2429
<< " geom_from_gml" << " geomFromGML" << " intersects_bbox" << " bbox"
2415
2430
<< " disjoint" << " intersects" << " touches" << " crosses" << " contains"
2416
2431
<< " relate"
2417
- << " overlaps" << " within" << " buffer" << " centroid" << " bounds" << " reverse"
2432
+ << " overlaps" << " within" << " buffer" << " centroid" << " bounds" << " reverse" << " exterior_ring "
2418
2433
<< " bounds_width" << " bounds_height" << " convex_hull" << " difference"
2419
2434
<< " distance" << " intersection" << " sym_difference" << " combine"
2420
2435
<< " union" << " geom_to_wkt" << " geomToWKT" << " geometry"
@@ -2558,6 +2573,7 @@ const QList<QgsExpression::Function*>& QgsExpression::Functions()
2558
2573
<< new StaticFunction ( " centroid" , 1 , fcnCentroid, " GeometryGroup" )
2559
2574
<< new StaticFunction ( " point_on_surface" , 1 , fcnPointOnSurface, " GeometryGroup" )
2560
2575
<< new StaticFunction ( " reverse" , 1 , fcnReverse, " GeometryGroup" )
2576
+ << new StaticFunction ( " exterior_ring" , 1 , fcnExteriorRing, " GeometryGroup" )
2561
2577
<< new StaticFunction ( " bounds" , 1 , fcnBounds, " GeometryGroup" )
2562
2578
<< new StaticFunction ( " num_points" , 1 , fcnGeomNumPoints, " GeometryGroup" )
2563
2579
<< new StaticFunction ( " bounds_width" , 1 , fcnBoundsWidth, " GeometryGroup" )
0 commit comments