18 #include "qgis_core.h" 28 #include <QDomElement> 29 #include <QStringList> 83 const QString &geometryAttribute,
85 AxisOrientationLogic axisOrientationLogic = Honour_EPSG_if_urn,
86 bool invertAxisOrientation =
false );
91 const QMap< QString, QPair<QString, QString> > &mapFieldNameToSrcLayerNameFieldName,
92 AxisOrientationLogic axisOrientationLogic = Honour_EPSG_if_urn,
93 bool invertAxisOrientation =
false );
104 bool processData(
const QByteArray &data,
bool atEnd, QString &errorMsg );
109 bool processData(
const QByteArray &data,
bool atEnd );
116 QVector<QgsGmlFeaturePtrGmlIdPair> getAndStealReadyFeatures();
171 void startElement(
const XML_Char *el,
const XML_Char **attr );
172 void endElement(
const XML_Char *el );
173 void characters(
const XML_Char *chars,
int len );
174 static void start(
void *data,
const XML_Char *el,
const XML_Char **attr )
178 static void end(
void *data,
const XML_Char *el )
182 static void chars(
void *data,
const XML_Char *chars,
int len )
188 void setAttribute(
const QString &name,
const QString &value );
198 int readEpsgFromAttribute(
int &epsgNr,
const XML_Char **attr );
206 QString readAttribute(
const QString &attributeName,
const XML_Char **attr )
const;
208 bool createBBoxFromCoordinateString(
QgsRectangle &bb,
const QString &coordString )
const;
216 int pointsFromCoordinateString( QList<QgsPointXY> &points,
const QString &coordString )
const;
225 int pointsFromPosListString( QList<QgsPointXY> &points,
const QString &coordString,
int dimension )
const;
227 int pointsFromString( QList<QgsPointXY> &points,
const QString &coordString )
const;
229 int getLineWKB(
QgsWkbPtr &wkbPtr,
const QList<QgsPointXY> &lineCoordinates )
const;
230 int getRingWKB(
QgsWkbPtr &wkbPtr,
const QList<QgsPointXY> &ringCoordinates )
const;
238 int createMultiLineFromFragments();
239 int createMultiPointFromFragments();
240 int createPolygonFromFragments();
241 int createMultiPolygonFromFragments();
243 int totalWKBFragmentSize()
const;
246 ParseMode modeStackTop() {
return mParseModeStack.isEmpty() ? None : mParseModeStack.top(); }
249 ParseMode modeStackPop() {
return mParseModeStack.isEmpty() ? None : mParseModeStack.pop(); }
255 QVector<QgsGmlFeaturePtrGmlIdPair> mFeatureList;
258 QList<LayerProperties> mLayerProperties;
259 QMap< QString, LayerProperties > mMapTypeNameToProperties;
263 QByteArray mTypeNameBA;
264 const char *mTypeNamePtr =
nullptr;
265 size_t mTypeNameUTF8Len;
272 QString mGeometryAttribute;
273 QByteArray mGeometryAttributeBA;
274 const char *mGeometryAttributePtr =
nullptr;
275 size_t mGeometryAttributeUTF8Len;
278 QMap<QString, QPair<int, QgsField> > mThematicAttributes;
281 QString mExceptionText;
282 bool mTruncatedResponse;
285 int mFeatureTupleDepth;
286 QString mCurrentTypename;
287 QStack<ParseMode> mParseModeStack;
292 QVector<QVariant> mCurrentAttributes;
293 QString mCurrentFeatureId;
298 bool mBoundedByNullFound;
305 QList< QList<QgsWkbPtr> > mCurrentWKBFragments;
306 QString mAttributeName;
309 QString mCoordinateSeparator;
311 QString mTupleSeparator;
313 QStack<int> mDimensionStack;
325 QString mGMLNameSpaceURI;
326 const char *mGMLNameSpaceURIPtr =
nullptr;
328 AxisOrientationLogic mAxisOrientationLogic;
330 bool mInvertAxisOrientationRequest;
332 bool mInvertAxisOrientation;
338 std::string mGeometryString;
340 bool mFoundUnhandledGeometryElement;
352 class CORE_EXPORT
QgsGml :
public QObject
358 const QString &geometryAttribute,
373 int getFeatures(
const QString &uri,
376 const QString &userName = QString(),
377 const QString &password = QString(),
378 const QString &authcfg = QString() )
SIP_PYNAME( getFeaturesUri );
387 QMap<QgsFeatureId, QgsFeature * >
featuresMap()
const {
return mFeatures; }
390 QMap<QgsFeatureId, QString >
idsMap()
const {
return mIdMap; }
398 void dataReadProgress(
int progress );
399 void totalStepsUpdate(
int totalSteps );
401 void dataProgressAndSteps(
int progress,
int totalSteps );
408 void handleProgressEvent( qint64 progress, qint64 totalSteps );
418 void calculateExtentFromFeatures();
420 void fillMapsFromParser();
432 QMap<QgsFeatureId, QgsFeature * > mFeatures;
437 QMap<QgsFeatureId, QString > mIdMap;
int getEPSGCode() const
Returns the EPSG code, or 0 if unknown.
A rectangle specified with double values.
AxisOrientationLogic
Axis orientation logic.
int numberReturned() const
Returns WFS 2.0 "numberReturned" or WFS 1.1 "numberOfFeatures" attribute, or -1 if invalid/not found...
QString srsName() const
Returns the value of the srsName attribute.
A class to represent a 2D point.
int numberMatched() const
Returns WFS 2.0 "numberMatched" attribute, or -1 if invalid/not found.
Container of fields for a vector layer.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
const QgsCoordinateReferenceSystem & crs
QMap< QgsFeatureId, QgsFeature *> featuresMap() const
Gets parsed features for given type name.
bool isException() const
Returns whether the document parser is a OGC exception.
Type
The WKB type describes the number of dimensions a geometry has.
This class reads data from a WFS server or alternatively from a GML file.
QString exceptionText() const
Returns the exception text.
QMap< QgsFeatureId, QString > idsMap() const
Gets feature ids map.
Honour EPSG axis order only if srsName is of the form urn:ogc:def:crs:EPSG: *.
QString mGeometryAttribute
Geometry attribute name.
const QgsRectangle & layerExtent() const
Returns layer bounding box.
QPair< QgsFeature *, QString > QgsGmlFeaturePtrGmlIdPair
bool isTruncatedResponse() const
Returns whether a "truncatedResponse" element is found.
This class represents a coordinate reference system (CRS).
QgsWkbTypes::Type wkbType() const
Returns the geometry type.
This class builds features from GML data in a streaming way.