QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
Classes | Public Types | Public Member Functions | List of all members
QgsGmlStreamingParser Class Reference

This class builds features from GML data in a streaming way. More...

#include <qgsgml.h>

Classes

class  LayerProperties
 Layer properties. More...
 

Public Types

enum  AxisOrientationLogic { Honour_EPSG_if_urn , Honour_EPSG , Ignore_EPSG }
 Axis orientation logic. More...
 
typedef QPair< QgsFeature *, QString > QgsGmlFeaturePtrGmlIdPair
 

Public Member Functions

 QgsGmlStreamingParser (const QgsGmlStreamingParser &other)=delete
 QgsGmlStreamingParser cannot be copied. More...
 
 QgsGmlStreamingParser (const QList< LayerProperties > &layerProperties, const QgsFields &fields, const QMap< QString, QPair< QString, QString > > &fieldNameToSrcLayerNameFieldNameMap, AxisOrientationLogic axisOrientationLogic=Honour_EPSG_if_urn, bool invertAxisOrientation=false)
 Constructor for a join layer, or dealing with renamed fields. More...
 
 QgsGmlStreamingParser (const QString &typeName, const QString &geometryAttribute, const QgsFields &fields, AxisOrientationLogic axisOrientationLogic=Honour_EPSG_if_urn, bool invertAxisOrientation=false)
 Constructor. More...
 
 ~QgsGmlStreamingParser ()
 
QString exceptionText () const
 Returns the exception text. More...
 
QVector< QgsGmlFeaturePtrGmlIdPairgetAndStealReadyFeatures ()
 Returns the list of features that have been completely parsed. More...
 
int getEPSGCode () const
 Returns the EPSG code, or 0 if unknown. More...
 
bool isException () const
 Returns whether the document parser is a OGC exception. More...
 
bool isTruncatedResponse () const
 Returns whether a "truncatedResponse" element is found. More...
 
const QgsRectanglelayerExtent () const
 Returns layer bounding box. More...
 
int numberMatched () const
 Returns WFS 2.0 "numberMatched" attribute, or -1 if invalid/not found. More...
 
int numberReturned () const
 Returns WFS 2.0 "numberReturned" or WFS 1.1 "numberOfFeatures" attribute, or -1 if invalid/not found. More...
 
QgsGmlStreamingParseroperator= (const QgsGmlStreamingParser &other)=delete
 QgsGmlStreamingParser cannot be copied. More...
 
bool processData (const QByteArray &data, bool atEnd)
 Process a new chunk of data. More...
 
bool processData (const QByteArray &data, bool atEnd, QString &errorMsg)
 Process a new chunk of data. More...
 
void setFieldsXPath (const QMap< QString, QPair< QString, bool >> &fieldNameToSrcLayerNameFieldNameMap, const QMap< QString, QString > &namespacePrefixToURIMap)
 Define the XPath of the attributes and whether they are made of nested content. More...
 
QString srsName () const
 Returns the value of the srsName attribute. More...
 
Qgis::WkbType wkbType () const
 Returns the geometry type. More...
 

Detailed Description

This class builds features from GML data in a streaming way.

The caller must call processData() as soon it has new content from the source. At any point, it can call getAndStealReadyFeatures() to collect the features that have been completely parsed.

Note
not available in Python bindings

Definition at line 54 of file qgsgml.h.

Member Typedef Documentation

◆ QgsGmlFeaturePtrGmlIdPair

Definition at line 58 of file qgsgml.h.

Member Enumeration Documentation

◆ AxisOrientationLogic

Axis orientation logic.

Enumerator
Honour_EPSG_if_urn 

Honour EPSG axis order only if srsName is of the form urn:ogc:def:crs:EPSG:

Honour_EPSG 

Honour EPSG axis order.

Ignore_EPSG 

Ignore EPSG axis order.

Definition at line 77 of file qgsgml.h.

Constructor & Destructor Documentation

◆ QgsGmlStreamingParser() [1/3]

QgsGmlStreamingParser::QgsGmlStreamingParser ( const QString &  typeName,
const QString &  geometryAttribute,
const QgsFields fields,
AxisOrientationLogic  axisOrientationLogic = Honour_EPSG_if_urn,
bool  invertAxisOrientation = false 
)

Constructor.

Definition at line 281 of file qgsgml.cpp.

◆ QgsGmlStreamingParser() [2/3]

QgsGmlStreamingParser::QgsGmlStreamingParser ( const QList< LayerProperties > &  layerProperties,
const QgsFields fields,
const QMap< QString, QPair< QString, QString > > &  fieldNameToSrcLayerNameFieldNameMap,
AxisOrientationLogic  axisOrientationLogic = Honour_EPSG_if_urn,
bool  invertAxisOrientation = false 
)

Constructor for a join layer, or dealing with renamed fields.

Definition at line 343 of file qgsgml.cpp.

◆ ~QgsGmlStreamingParser()

QgsGmlStreamingParser::~QgsGmlStreamingParser ( )

Definition at line 435 of file qgsgml.cpp.

◆ QgsGmlStreamingParser() [3/3]

QgsGmlStreamingParser::QgsGmlStreamingParser ( const QgsGmlStreamingParser other)
delete

QgsGmlStreamingParser cannot be copied.

Member Function Documentation

◆ exceptionText()

QString QgsGmlStreamingParser::exceptionText ( ) const
inline

Returns the exception text.

Definition at line 158 of file qgsgml.h.

◆ getAndStealReadyFeatures()

QVector< QgsGmlStreamingParser::QgsGmlFeaturePtrGmlIdPair > QgsGmlStreamingParser::getAndStealReadyFeatures ( )

Returns the list of features that have been completely parsed.

This can be called at any point. This will empty the list maintained internally by the parser, so that features already returned will no longer be returned by later calls.

Definition at line 505 of file qgsgml.cpp.

◆ getEPSGCode()

int QgsGmlStreamingParser::getEPSGCode ( ) const
inline

Returns the EPSG code, or 0 if unknown.

Definition at line 137 of file qgsgml.h.

◆ isException()

bool QgsGmlStreamingParser::isException ( ) const
inline

Returns whether the document parser is a OGC exception.

Definition at line 155 of file qgsgml.h.

◆ isTruncatedResponse()

bool QgsGmlStreamingParser::isTruncatedResponse ( ) const
inline

Returns whether a "truncatedResponse" element is found.

Definition at line 161 of file qgsgml.h.

◆ layerExtent()

const QgsRectangle& QgsGmlStreamingParser::layerExtent ( ) const
inline

Returns layer bounding box.

Definition at line 143 of file qgsgml.h.

◆ numberMatched()

int QgsGmlStreamingParser::numberMatched ( ) const
inline

Returns WFS 2.0 "numberMatched" attribute, or -1 if invalid/not found.

Definition at line 149 of file qgsgml.h.

◆ numberReturned()

int QgsGmlStreamingParser::numberReturned ( ) const
inline

Returns WFS 2.0 "numberReturned" or WFS 1.1 "numberOfFeatures" attribute, or -1 if invalid/not found.

Definition at line 152 of file qgsgml.h.

◆ operator=()

QgsGmlStreamingParser& QgsGmlStreamingParser::operator= ( const QgsGmlStreamingParser other)
delete

QgsGmlStreamingParser cannot be copied.

◆ processData() [1/2]

bool QgsGmlStreamingParser::processData ( const QByteArray &  data,
bool  atEnd 
)

Process a new chunk of data.

atEnd must be set to true when this is the last chunk of data.

Definition at line 449 of file qgsgml.cpp.

◆ processData() [2/2]

bool QgsGmlStreamingParser::processData ( const QByteArray &  data,
bool  atEnd,
QString &  errorMsg 
)

Process a new chunk of data.

atEnd must be set to true when this is the last chunk of data.

Definition at line 460 of file qgsgml.cpp.

◆ setFieldsXPath()

void QgsGmlStreamingParser::setFieldsXPath ( const QMap< QString, QPair< QString, bool >> &  fieldNameToSrcLayerNameFieldNameMap,
const QMap< QString, QString > &  namespacePrefixToURIMap 
)

Define the XPath of the attributes and whether they are made of nested content.

Also provides a map from namespace prefix to namespace URI, to help decoding the XPath.

Definition at line 422 of file qgsgml.cpp.

◆ srsName()

QString QgsGmlStreamingParser::srsName ( ) const
inline

Returns the value of the srsName attribute.

Definition at line 140 of file qgsgml.h.

◆ wkbType()

Qgis::WkbType QgsGmlStreamingParser::wkbType ( ) const
inline

Returns the geometry type.

Definition at line 146 of file qgsgml.h.


The documentation for this class was generated from the following files: