15 #ifndef QGSARCGISRESTQUERY_H
16 #define QGSARCGISRESTQUERY_H
20 #include "qgis_core.h"
26 #include <QVariantMap>
54 static QVariantMap getServiceInfo(
const QString &baseurl,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QgsHttpHeaders &requestHeaders =
QgsHttpHeaders() );
59 static QVariantMap getLayerInfo(
const QString &layerurl,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QgsHttpHeaders &requestHeaders =
QgsHttpHeaders() );
64 static QVariantMap getObjectIds(
const QString &layerurl,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QgsHttpHeaders &requestHeaders =
QgsHttpHeaders(),
70 static QVariantMap getObjects(
const QString &layerurl,
const QString &authcfg,
const QList<quint32> &objectIds,
const QString &
crs,
71 bool fetchGeometry,
const QStringList &fetchAttributes,
bool fetchM,
bool fetchZ,
77 static QList<quint32> getObjectIdsByExtent(
const QString &layerurl,
const QgsRectangle &filterRect, QString &errorTitle, QString &errorText,
const QString &authcfg,
const QgsHttpHeaders &requestHeaders =
QgsHttpHeaders(),
QgsFeedback *feedback =
nullptr );
82 static QByteArray queryService(
const QUrl &url,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QgsHttpHeaders &requestHeaders =
QgsHttpHeaders(),
QgsFeedback *feedback =
nullptr, QString *contentType =
nullptr );
87 static QVariantMap queryServiceJSON(
const QUrl &url,
const QString &authcfg, QString &errorTitle, QString &errorText,
const QgsHttpHeaders &requestHeaders =
QgsHttpHeaders(),
QgsFeedback *feedback =
nullptr );
92 static void visitFolderItems(
const std::function<
void (
const QString &folderName,
const QString &url )> &visitor,
const QVariantMap &serviceData,
const QString &baseUrl );
97 static void visitServiceItems(
const std::function<
void (
const QString &serviceName,
const QString &url,
const QString &service, ServiceTypeFilter serviceType )> &visitor,
const QVariantMap &serviceData,
const QString &baseUrl );
102 static void addLayerItems(
const std::function<
void (
const QString &parentLayerId, ServiceTypeFilter serviceType,
QgsWkbTypes::GeometryType geometryType,
const QString &layerId,
const QString &name,
const QString &description,
const QString &url,
bool isParentLayer,
const QString &authid,
const QString &format )> &visitor,
const QVariantMap &serviceData,
const QString &parentUrl,
const QString &parentSupportedFormats,
const ServiceTypeFilter filter = AllTypes );
106 static QUrl parseUrl(
const QUrl &url );
107 static void adjustBaseUrl( QString &baseUrl,
const QString &name );
109 friend class TestQgsArcGisRestUtils;
113 class CORE_EXPORT QgsArcGisAsyncQuery :
public QObject
117 QgsArcGisAsyncQuery( QObject *parent =
nullptr );
118 ~QgsArcGisAsyncQuery()
override;
120 void start(
const QUrl &url,
const QString &authCfg, QByteArray *result,
bool allowCache =
false,
const QgsStringMap &headers =
QgsStringMap() );
123 void failed( QString errorTitle, QString errorName );
128 QNetworkReply *mReply =
nullptr;
129 QByteArray *mResult =
nullptr;
132 class CORE_EXPORT QgsArcGisAsyncParallelQuery :
public QObject
136 QgsArcGisAsyncParallelQuery(
const QString &authcfg,
const QgsHttpHeaders &requestHeaders, QObject *parent =
nullptr );
137 void start(
const QVector<QUrl> &urls, QVector<QByteArray> *results,
bool allowCache =
false );
140 void finished( QStringList errors );
145 QVector<QByteArray> *mResults =
nullptr;
146 int mPendingRequests = 0;
Utility functions for querying ArcGIS REST services.
ServiceTypeFilter
Service types.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
A rectangle specified with double values.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
QMap< QString, QString > QgsStringMap
const QgsCoordinateReferenceSystem & crs