From a99b5201149b04a823ca4dcde7572f4b46688395 Mon Sep 17 00:00:00 2001 From: Blottiere Paul Date: Tue, 11 Sep 2018 10:06:28 +0100 Subject: [PATCH] Add documentation --- python/core/auto_generated/qgsogcutils.sip.in | 9 +++ src/core/qgsogcutils.h | 68 +++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/python/core/auto_generated/qgsogcutils.sip.in b/python/core/auto_generated/qgsogcutils.sip.in index 850eb3babcd5..ea0881f9c7bc 100644 --- a/python/core/auto_generated/qgsogcutils.sip.in +++ b/python/core/auto_generated/qgsogcutils.sip.in @@ -150,6 +150,15 @@ according to the OGC filter specs (=,!=,<,>,<=,>=,AND,OR,NOT) }; static QgsExpression *expressionFromOgcFilter( const QDomElement &element, FilterVersion version, QgsVectorLayer *layer = 0 ) /Factory/; +%Docstring +Returns an expression from a WFS filter embedded in a document. + +:param element: The WFS Filter +:param version: The WFS version +:param layer: Layer to use to retrieve field values from literal filters + +.. versionadded:: 3.4 +%End static QDomElement expressionToOgcExpression( const QgsExpression &exp, QDomDocument &doc, QString *errorMessage = 0 ); diff --git a/src/core/qgsogcutils.h b/src/core/qgsogcutils.h index ff95b1a5d580..5f3386aace46 100644 --- a/src/core/qgsogcutils.h +++ b/src/core/qgsogcutils.h @@ -161,6 +161,13 @@ class CORE_EXPORT QgsOgcUtils FILTER_FES_2_0 }; + /** + * Returns an expression from a WFS filter embedded in a document. + * \param element The WFS Filter + * \param version The WFS version + * \param layer Layer to use to retrieve field values from literal filters + * \since QGIS 3.4 + */ static QgsExpression *expressionFromOgcFilter( const QDomElement &element, FilterVersion version, QgsVectorLayer *layer = nullptr ) SIP_FACTORY; /** @@ -369,23 +376,84 @@ class QgsOgcUtilsExprToFilter QDomElement expressionFunctionToOgcFilter( const QgsExpressionNodeFunction *node, QgsExpression *expression, const QgsExpressionContext *context ); }; +/** + * \ingroup core + * \brief Internal use by QgsOgcUtils + * \note not available in Python bindings + * \since QGIS 3.4 + */ class QgsOgcUtilsExprFromFilter { public: + + /** + * Constructor for QgsOgcUtilsExprFromFilter. + * \param version WFS Version + * \param layer Layer to use to retrieve field values from literal filters + */ QgsOgcUtilsExprFromFilter( QgsOgcUtils::FilterVersion version = QgsOgcUtils::FILTER_OGC_1_0, QgsVectorLayer *layer = nullptr ); + /** + * Returns an expression node from a WFS filter embedded in a document + * element. A null pointer is returned when an error happened. + * \param element The WFS filter + */ QgsExpressionNode *nodeFromOgcFilter( const QDomElement &element ); + /** + * Returns the underlying error message, or an empty string in case of no + * error. + */ QString errorMessage() const; + /** + * Returns an expression node from a WFS filter embedded in a document with + * binary operators. + * + */ QgsExpressionNodeBinaryOperator *nodeBinaryOperatorFromOgcFilter( const QDomElement &element ); + + /** + * Returns an expression node from a WFS filter embedded in a document with + * spatial operators. + */ QgsExpressionNodeFunction *nodeSpatialOperatorFromOgcFilter( const QDomElement &element ); + + /** + * Returns an expression node from a WFS filter embedded in a document with + * column references. + */ QgsExpressionNodeColumnRef *nodeColumnRefFromOgcFilter( const QDomElement &element ); + + /** + * Returns an expression node from a WFS filter embedded in a document with + * literal tag. + */ QgsExpressionNode *nodeLiteralFromOgcFilter( const QDomElement &element ); + + /** + * Returns an expression node from a WFS filter embedded in a document with + * Not operator. + */ QgsExpressionNodeUnaryOperator *nodeNotFromOgcFilter( const QDomElement &element ); + + /** + * Returns an expression node from a WFS filter embedded in a document with + * IsNull operator. + */ QgsExpressionNodeBinaryOperator *nodePropertyIsNullFromOgcFilter( const QDomElement &element ); + + /** + * Returns an expression node from a WFS filter embedded in a document with + * functions. + */ QgsExpressionNodeFunction *nodeFunctionFromOgcFilter( const QDomElement &element ); + + /** + * Returns an expression node from a WFS filter embedded in a document with + * boudnaries operator. + */ QgsExpressionNode *nodeIsBetweenFromOgcFilter( const QDomElement &element ); private: