@@ -1725,6 +1725,22 @@ static QVariant fcnDifference( const QVariantList& values, const QgsExpressionCo
1725
1725
delete geom;
1726
1726
return result;
1727
1727
}
1728
+
1729
+ static QVariant fcnReverse ( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
1730
+ {
1731
+ QgsGeometry fGeom = getGeometry ( values.at ( 0 ), parent );
1732
+ if ( fGeom .isEmpty () )
1733
+ return QVariant ();
1734
+
1735
+ QgsCurveV2* curve = dynamic_cast < QgsCurveV2* >( fGeom .geometry () );
1736
+ if ( !curve )
1737
+ return QVariant ();
1738
+
1739
+ QgsCurveV2* reversed = curve->reversed ();
1740
+ QVariant result = reversed ? QVariant::fromValue ( QgsGeometry ( reversed ) ) : QVariant ();
1741
+ return result;
1742
+ }
1743
+
1728
1744
static QVariant fcnDistance ( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
1729
1745
{
1730
1746
QgsGeometry fGeom = getGeometry ( values.at ( 0 ), parent );
@@ -2333,7 +2349,7 @@ const QStringList& QgsExpression::BuiltinFunctions()
2333
2349
<< " geom_from_gml" << " geomFromGML" << " intersects_bbox" << " bbox"
2334
2350
<< " disjoint" << " intersects" << " touches" << " crosses" << " contains"
2335
2351
<< " relate"
2336
- << " overlaps" << " within" << " buffer" << " centroid" << " bounds"
2352
+ << " overlaps" << " within" << " buffer" << " centroid" << " bounds" << " reverse "
2337
2353
<< " bounds_width" << " bounds_height" << " convex_hull" << " difference"
2338
2354
<< " distance" << " intersection" << " sym_difference" << " combine"
2339
2355
<< " union" << " geom_to_wkt" << " geomToWKT" << " geometry"
@@ -2470,6 +2486,7 @@ const QList<QgsExpression::Function*>& QgsExpression::Functions()
2470
2486
<< new StaticFunction ( " within" , 2 , fcnWithin, " GeometryGroup" )
2471
2487
<< new StaticFunction ( " buffer" , -1 , fcnBuffer, " GeometryGroup" )
2472
2488
<< new StaticFunction ( " centroid" , 1 , fcnCentroid, " GeometryGroup" )
2489
+ << new StaticFunction ( " reverse" , 1 , fcnReverse, " GeometryGroup" )
2473
2490
<< new StaticFunction ( " bounds" , 1 , fcnBounds, " GeometryGroup" )
2474
2491
<< new StaticFunction ( " num_points" , 1 , fcnGeomNumPoints, " GeometryGroup" )
2475
2492
<< new StaticFunction ( " bounds_width" , 1 , fcnBoundsWidth, " GeometryGroup" )
0 commit comments