@@ -2376,6 +2376,17 @@ static QVariant fcnYMax( const QVariantList &values, const QgsExpressionContext
23762376 return QVariant::fromValue ( geom.boundingBox ().yMaximum () );
23772377}
23782378
2379+ static QVariant fcnFlipCoordinates ( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
2380+ {
2381+ QgsGeometry geom = QgsExpressionUtils::getGeometry ( values.at ( 0 ), parent );
2382+ if ( geom.isNull () )
2383+ return QVariant ();
2384+
2385+ std::unique_ptr< QgsAbstractGeometry > flipped ( geom.constGet ()->clone () );
2386+ flipped->swapXy ();
2387+ return QVariant::fromValue ( QgsGeometry ( std::move ( flipped ) ) );
2388+ }
2389+
23792390static QVariant fcnIsClosed ( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
23802391{
23812392 QgsGeometry fGeom = QgsExpressionUtils::getGeometry ( values.at ( 0 ), parent );
@@ -4228,6 +4239,7 @@ const QList<QgsExpressionFunction *> &QgsExpression::Functions()
42284239 << new QgsStaticExpressionFunction ( QStringLiteral ( " y_max" ), 1 , fcnYMax, QStringLiteral ( " GeometryGroup" ), QString (), false , QSet<QString>(), false , QStringList () << QStringLiteral ( " ymax" ) )
42294240 << new QgsStaticExpressionFunction ( QStringLiteral ( " geom_from_wkt" ), 1 , fcnGeomFromWKT, QStringLiteral ( " GeometryGroup" ), QString (), false , QSet<QString>(), false , QStringList () << QStringLiteral ( " geomFromWKT" ) )
42304241 << new QgsStaticExpressionFunction ( QStringLiteral ( " geom_from_gml" ), 1 , fcnGeomFromGML, QStringLiteral ( " GeometryGroup" ), QString (), false , QSet<QString>(), false , QStringList () << QStringLiteral ( " geomFromGML" ) )
4242+ << new QgsStaticExpressionFunction ( QStringLiteral ( " flip_coordinates" ), 1 , fcnFlipCoordinates, QStringLiteral ( " GeometryGroup" ) )
42314243 << new QgsStaticExpressionFunction ( QStringLiteral ( " relate" ), -1 , fcnRelate, QStringLiteral ( " GeometryGroup" ) )
42324244 << new QgsStaticExpressionFunction ( QStringLiteral ( " intersects_bbox" ), 2 , fcnBbox, QStringLiteral ( " GeometryGroup" ), QString (), false , QSet<QString>(), false , QStringList () << QStringLiteral ( " bbox" ) )
42334245 << new QgsStaticExpressionFunction ( QStringLiteral ( " disjoint" ), 2 , fcnDisjoint, QStringLiteral ( " GeometryGroup" ) )
0 commit comments