18 #include "qgis_core.h"
28 #include <QDomElement>
29 #include <QStringList>
79 } AxisOrientationLogic;
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;