/usr/include/qgis/qgsogcutils.h is in libqgis-dev 2.14.11+dfsg-3+deb9u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | /***************************************************************************
qgsogcutils.h
---------------------
begin : March 2013
copyright : (C) 2013 by Martin Dobias
email : wonder dot sk at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSOGCUTILS_H
#define QGSOGCUTILS_H
class QColor;
class QDomNode;
class QDomElement;
class QDomDocument;
class QString;
#include <list>
#include <QVector>
class QgsExpression;
class QgsGeometry;
class QgsPoint;
class QgsRectangle;
#include "qgsgeometry.h"
#include "qgsexpression.h"
/**
* @brief The QgsOgcUtils class provides various utility functions for conversion between
* OGC (Open Geospatial Consortium) standards and QGIS internal representations.
*
* Currently supported standards:
* - GML2 - Geography Markup Language (import, export)
*/
class CORE_EXPORT QgsOgcUtils
{
public:
/** GML version
* @note not available in Python bindings
*/
typedef enum
{
GML_2_1_2,
GML_3_1_0,
GML_3_2_1,
} GMLVersion;
/** Static method that creates geometry from GML
@param xmlString xml representation of the geometry. GML elements are expected to be
in default namespace (\verbatim {<Point>...</Point> \endverbatim) or in
"gml" namespace (\verbatim <gml:Point>...</gml:Point> \endverbatim)
*/
static QgsGeometry* geometryFromGML( const QString& xmlString );
/** Static method that creates geometry from GML
*/
static QgsGeometry* geometryFromGML( const QDomNode& geometryNode );
/** Read rectangle from GML2 Box */
static QgsRectangle rectangleFromGMLBox( const QDomNode& boxNode );
/** Read rectangle from GML3 Envelope */
static QgsRectangle rectangleFromGMLEnvelope( const QDomNode& envelopeNode );
/** Exports the geometry to GML
@return QDomElement
@note Added in QGIS 2.14
*/
static QDomElement geometryToGML( const QgsGeometry* geometry, QDomDocument& doc,
GMLVersion gmlVersion,
const QString& srsName,
bool invertAxisOrientation,
const QString& gmlIdBase,
int precision = 17 );
/** Exports the geometry to GML2 or GML3
@return QDomElement
*/
static QDomElement geometryToGML( const QgsGeometry* geometry, QDomDocument& doc, const QString& format, int precision = 17 );
/** Exports the geometry to GML2
@return QDomElement
*/
static QDomElement geometryToGML( const QgsGeometry* geometry, QDomDocument& doc, int precision = 17 );
/** Exports the rectangle to GML2 Box
@return QDomElement
*/
static QDomElement rectangleToGMLBox( QgsRectangle* box, QDomDocument& doc, int precision = 17 );
/** Exports the rectangle to GML2 Box
@return QDomElement
@note Added in QGIS 2.14
*/
static QDomElement rectangleToGMLBox( QgsRectangle* box, QDomDocument& doc,
const QString& srsName,
bool invertAxisOrientation,
int precision = 17 );
/** Exports the rectangle to GML3 Envelope
@return QDomElement
*/
static QDomElement rectangleToGMLEnvelope( QgsRectangle* env, QDomDocument& doc, int precision = 17 );
/** Exports the rectangle to GML3 Envelope
@return QDomElement
@note Added in QGIS 2.14
*/
static QDomElement rectangleToGMLEnvelope( QgsRectangle* env, QDomDocument& doc,
const QString& srsName,
bool invertAxisOrientation,
int precision = 17 );
/** Parse XML with OGC fill into QColor */
static QColor colorFromOgcFill( const QDomElement& fillElement );
/** Parse XML with OGC filter into QGIS expression */
static QgsExpression* expressionFromOgcFilter( const QDomElement& element );
/** Creates OGC filter XML element. Supports minimum standard filter
* according to the OGC filter specs (=,!=,<,>,<=,>=,AND,OR,NOT)
* @return valid \verbatim <Filter> \endverbatim QDomElement on success,
* otherwise null QDomElement
*/
static QDomElement expressionToOgcFilter( const QgsExpression& exp, QDomDocument& doc, QString* errorMessage = nullptr );
/** OGC filter version
* @note not available in Python bindings
*/
typedef enum
{
FILTER_OGC_1_0,
FILTER_OGC_1_1,
FILTER_FES_2_0
} FilterVersion;
/** Creates OGC filter XML element. Supports minimum standard filter
* according to the OGC filter specs (=,!=,<,>,<=,>=,AND,OR,NOT)
* @return valid \verbatim <Filter> \endverbatim QDomElement on success,
* otherwise null QDomElement
* @note Added in QGIS 2.14
*/
static QDomElement expressionToOgcFilter( const QgsExpression& exp,
QDomDocument& doc,
GMLVersion gmlVersion,
FilterVersion filterVersion,
const QString& geometryName,
const QString& srsName,
bool honourAxisOrientation,
bool invertAxisOrientation,
QString* errorMessage = nullptr );
/** Creates an OGC expression XML element.
* @return valid OGC expression QDomElement on success,
* otherwise null QDomElement
* @note added in 2.14.8
*/
static QDomElement expressionToOgcExpression( const QgsExpression& exp, QDomDocument& doc, QString* errorMessage = nullptr );
/** Creates an OGC expression XML element.
* @return valid OGC expression QDomElement on success,
* otherwise null QDomElement
*/
static QDomElement expressionToOgcExpression( const QgsExpression& exp,
QDomDocument& doc,
GMLVersion gmlVersion,
FilterVersion filterVersion,
const QString& geometryName,
const QString& srsName,
bool honourAxisOrientation,
bool invertAxisOrientation,
QString* errorMessage = nullptr );
private:
/** Static method that creates geometry from GML Point */
static QgsGeometry* geometryFromGMLPoint( const QDomElement& geometryElement );
/** Static method that creates geometry from GML LineString */
static QgsGeometry* geometryFromGMLLineString( const QDomElement& geometryElement );
/** Static method that creates geometry from GML Polygon */
static QgsGeometry* geometryFromGMLPolygon( const QDomElement& geometryElement );
/** Static method that creates geometry from GML MultiPoint */
static QgsGeometry* geometryFromGMLMultiPoint( const QDomElement& geometryElement );
/** Static method that creates geometry from GML MultiLineString */
static QgsGeometry* geometryFromGMLMultiLineString( const QDomElement& geometryElement );
/** Static method that creates geometry from GML MultiPolygon */
static QgsGeometry* geometryFromGMLMultiPolygon( const QDomElement& geometryElement );
/** Reads the \verbatim <gml:coordinates> \endverbatim element and extracts the coordinates as points
@param coords list where the found coordinates are appended
@param elem the \verbatim <gml:coordinates> \endverbatim element
@return boolean for success*/
static bool readGMLCoordinates( QgsPolyline &coords, const QDomElement &elem );
/** Reads the \verbatim <gml:pos> \endverbatim or \verbatim <gml:posList> \endverbatim
and extracts the coordinates as points
@param coords list where the found coordinates are appended
@param elem the \verbatim <gml:pos> \endverbatim or
\verbatim <gml:posList> \endverbatim element
@return boolean for success*/
static bool readGMLPositions( QgsPolyline &coords, const QDomElement &elem );
/** Create a GML coordinates element from a point list.
@param points list of data points
@param doc the GML document
@return QDomElement */
static QDomElement createGMLCoordinates( const QgsPolyline &points, QDomDocument& doc );
/** Create a GML pos or posList element from a point list.
@param points list of data points
@param doc the GML document
@return QDomElement */
static QDomElement createGMLPositions( const QgsPolyline &points, QDomDocument& doc );
//! handle a generic sub-expression
static QgsExpression::Node* nodeFromOgcFilter( QDomElement &element, QString &errorMessage );
//! handle a generic binary operator
static QgsExpression::NodeBinaryOperator* nodeBinaryOperatorFromOgcFilter( QDomElement &element, QString &errorMessage );
//! handles various spatial operation tags (\verbatim <Intersects> \endverbatim, \verbatim <Touches> \endverbatim etc.)
static QgsExpression::NodeFunction* nodeSpatialOperatorFromOgcFilter( QDomElement& element, QString& errorMessage );
//! handle \verbatim <Not> \endverbatim tag
static QgsExpression::NodeUnaryOperator* nodeNotFromOgcFilter( QDomElement &element, QString &errorMessage );
//! handles \verbatim <Function> \endverbatim tag
static QgsExpression::NodeFunction* nodeFunctionFromOgcFilter( QDomElement &element, QString &errorMessage );
//! handles \verbatim <Literal> \endverbatim tag
static QgsExpression::Node* nodeLiteralFromOgcFilter( QDomElement &element, QString &errorMessage );
//! handles \verbatim <PropertyName> \endverbatim tag
static QgsExpression::NodeColumnRef* nodeColumnRefFromOgcFilter( QDomElement &element, QString &errorMessage );
//! handles \verbatim <PropertyIsBetween> \endverbatim tag
static QgsExpression::Node* nodeIsBetweenFromOgcFilter( QDomElement& element, QString& errorMessage );
//! handles \verbatim <PropertyIsNull> \endverbatim tag
static QgsExpression::NodeBinaryOperator* nodePropertyIsNullFromOgcFilter( QDomElement& element, QString& errorMessage );
};
/** Internal use by QgsOgcUtils
* @note not available in Python bindings
*/
class QgsOgcUtilsExprToFilter
{
public:
/** Constructor */
QgsOgcUtilsExprToFilter( QDomDocument& doc,
QgsOgcUtils::GMLVersion gmlVersion,
QgsOgcUtils::FilterVersion filterVersion,
const QString& geometryName,
const QString& srsName,
bool honourAxisOrientation,
bool invertAxisOrientation );
/** Convert an expression to a OGC filter */
QDomElement expressionNodeToOgcFilter( const QgsExpression::Node* node );
/** Return whether the gml: namespace is used */
bool GMLNamespaceUsed() const { return mGMLUsed; }
/** Return the error message. */
const QString& errorMessage() const { return mErrorMessage; }
private:
QDomDocument& mDoc;
bool mGMLUsed;
QgsOgcUtils::GMLVersion mGMLVersion;
QgsOgcUtils::FilterVersion mFilterVersion;
const QString& mGeometryName;
const QString& mSrsName;
bool mInvertAxisOrientation;
QString mErrorMessage;
QString mFilterPrefix;
QString mPropertyName;
int mGeomId;
QDomElement expressionUnaryOperatorToOgcFilter( const QgsExpression::NodeUnaryOperator* node );
QDomElement expressionBinaryOperatorToOgcFilter( const QgsExpression::NodeBinaryOperator* node );
QDomElement expressionLiteralToOgcFilter( const QgsExpression::NodeLiteral* node );
QDomElement expressionColumnRefToOgcFilter( const QgsExpression::NodeColumnRef* node );
QDomElement expressionInOperatorToOgcFilter( const QgsExpression::NodeInOperator* node );
QDomElement expressionFunctionToOgcFilter( const QgsExpression::NodeFunction* node );
};
#endif // QGSOGCUTILS_H
|