QGIS API Documentation  2.13.0-Master
qgsogcutils.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsogcutils.h
3  ---------------------
4  begin : March 2013
5  copyright : (C) 2013 by Martin Dobias
6  email : wonder dot sk at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSOGCUTILS_H
16 #define QGSOGCUTILS_H
17 
18 class QColor;
19 class QDomNode;
20 class QDomElement;
21 class QDomDocument;
22 class QString;
23 
24 #include <list>
25 #include <QVector>
26 
27 class QgsExpression;
28 class QgsGeometry;
29 class QgsPoint;
30 class QgsRectangle;
31 
32 #include "qgsgeometry.h"
33 #include "qgsexpression.h"
34 
42 class CORE_EXPORT QgsOgcUtils
43 {
44  public:
45 
51  static QgsGeometry* geometryFromGML( const QString& xmlString );
52 
55  static QgsGeometry* geometryFromGML( const QDomNode& geometryNode );
56 
58  static QgsRectangle rectangleFromGMLBox( const QDomNode& boxNode );
59 
61  static QgsRectangle rectangleFromGMLEnvelope( const QDomNode& envelopeNode );
62 
66  static QDomElement geometryToGML( const QgsGeometry* geometry, QDomDocument& doc, const QString& format, int precision = 17 );
67 
71  static QDomElement geometryToGML( const QgsGeometry* geometry, QDomDocument& doc, int precision = 17 );
72 
76  static QDomElement rectangleToGMLBox( QgsRectangle* box, QDomDocument& doc, int precision = 17 );
77 
81  static QDomElement rectangleToGMLEnvelope( QgsRectangle* env, QDomDocument& doc, int precision = 17 );
82 
83 
85  static QColor colorFromOgcFill( const QDomElement& fillElement );
86 
88  static QgsExpression* expressionFromOgcFilter( const QDomElement& element );
89 
95  static QDomElement expressionToOgcFilter( const QgsExpression& exp, QDomDocument& doc, QString* errorMessage = nullptr );
96 
97  private:
99  static QgsGeometry* geometryFromGMLPoint( const QDomElement& geometryElement );
101  static QgsGeometry* geometryFromGMLLineString( const QDomElement& geometryElement );
103  static QgsGeometry* geometryFromGMLPolygon( const QDomElement& geometryElement );
105  static QgsGeometry* geometryFromGMLMultiPoint( const QDomElement& geometryElement );
107  static QgsGeometry* geometryFromGMLMultiLineString( const QDomElement& geometryElement );
109  static QgsGeometry* geometryFromGMLMultiPolygon( const QDomElement& geometryElement );
114  static bool readGMLCoordinates( QgsPolyline &coords, const QDomElement &elem );
121  static bool readGMLPositions( QgsPolyline &coords, const QDomElement &elem );
122 
123 
128  static QDomElement createGMLCoordinates( const QgsPolyline &points, QDomDocument& doc );
129 
134  static QDomElement createGMLPositions( const QgsPolyline &points, QDomDocument& doc );
135 
137  static QgsExpression::Node* nodeFromOgcFilter( QDomElement &element, QString &errorMessage );
139  static QgsExpression::NodeBinaryOperator* nodeBinaryOperatorFromOgcFilter( QDomElement &element, QString &errorMessage );
141  static QgsExpression::NodeFunction* nodeSpatialOperatorFromOgcFilter( QDomElement& element, QString& errorMessage );
143  static QgsExpression::NodeUnaryOperator* nodeNotFromOgcFilter( QDomElement &element, QString &errorMessage );
145  static QgsExpression::NodeFunction* nodeFunctionFromOgcFilter( QDomElement &element, QString &errorMessage );
147  static QgsExpression::Node* nodeLiteralFromOgcFilter( QDomElement &element, QString &errorMessage );
149  static QgsExpression::NodeColumnRef* nodeColumnRefFromOgcFilter( QDomElement &element, QString &errorMessage );
151  static QgsExpression::Node* nodeIsBetweenFromOgcFilter( QDomElement& element, QString& errorMessage );
153  static QgsExpression::NodeBinaryOperator* nodePropertyIsNullFromOgcFilter( QDomElement& element, QString& errorMessage );
154 
155  static QDomElement expressionNodeToOgcFilter( const QgsExpression::Node* node, QDomDocument& doc, QString& errorMessage );
156  static QDomElement expressionUnaryOperatorToOgcFilter( const QgsExpression::NodeUnaryOperator* node, QDomDocument& doc, QString& errorMessage );
157  static QDomElement expressionBinaryOperatorToOgcFilter( const QgsExpression::NodeBinaryOperator* node, QDomDocument& doc, QString& errorMessage );
158  static QDomElement expressionLiteralToOgcFilter( const QgsExpression::NodeLiteral* node, QDomDocument& doc, QString& errorMessage );
159  static QDomElement expressionColumnRefToOgcFilter( const QgsExpression::NodeColumnRef* node, QDomDocument& doc, QString& errorMessage );
160  static QDomElement expressionInOperatorToOgcFilter( const QgsExpression::NodeInOperator* node, QDomDocument& doc, QString& errorMessage );
161  static QDomElement expressionFunctionToOgcFilter( const QgsExpression::NodeFunction* node, QDomDocument& doc, QString& errorMessage );
162 
163 };
164 
165 #endif // QGSOGCUTILS_H
Class for parsing and evaluation of expressions (formerly called "search strings").
A rectangle specified with double values.
Definition: qgsrectangle.h:35
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:76
A class to represent a point.
Definition: qgspoint.h:65
The QgsOgcUtils class provides various utility functions for conversion between OGC (Open Geospatial ...
Definition: qgsogcutils.h:42