28 #include <QImageReader> 
   29 #include <QRegularExpression> 
   34   QUrl queryUrl( baseurl );
 
   35   QUrlQuery query( queryUrl );
 
   36   query.addQueryItem( QStringLiteral( 
"f" ), QStringLiteral( 
"json" ) );
 
   37   queryUrl.setQuery( query );
 
   38   return queryServiceJSON( queryUrl, authcfg, errorTitle, errorText, requestHeaders );
 
   44   QUrl queryUrl( layerurl );
 
   45   QUrlQuery query( queryUrl );
 
   46   query.addQueryItem( QStringLiteral( 
"f" ), QStringLiteral( 
"json" ) );
 
   47   queryUrl.setQuery( query );
 
   48   return queryServiceJSON( queryUrl, authcfg, errorTitle, errorText, requestHeaders );
 
   54   QUrl queryUrl( layerurl + 
"/query" );
 
   55   QUrlQuery query( queryUrl );
 
   56   query.addQueryItem( QStringLiteral( 
"f" ), QStringLiteral( 
"json" ) );
 
   57   query.addQueryItem( QStringLiteral( 
"where" ), QStringLiteral( 
"1=1" ) );
 
   58   query.addQueryItem( QStringLiteral( 
"returnIdsOnly" ), QStringLiteral( 
"true" ) );
 
   61     query.addQueryItem( QStringLiteral( 
"geometry" ), QStringLiteral( 
"%1,%2,%3,%4" )
 
   64     query.addQueryItem( QStringLiteral( 
"geometryType" ), QStringLiteral( 
"esriGeometryEnvelope" ) );
 
   65     query.addQueryItem( QStringLiteral( 
"spatialRel" ), QStringLiteral( 
"esriSpatialRelEnvelopeIntersects" ) );
 
   67   queryUrl.setQuery( query );
 
   68   return queryServiceJSON( queryUrl, authcfg, errorTitle, errorText, requestHeaders );
 
   72     bool fetchGeometry, 
const QStringList &fetchAttributes,
 
   73     bool fetchM, 
bool fetchZ,
 
   78   for ( 
const int id : objectIds )
 
   80     ids.append( QString::number( 
id ) );
 
   82   QUrl queryUrl( layerurl + 
"/query" );
 
   83   QUrlQuery query( queryUrl );
 
   84   query.addQueryItem( QStringLiteral( 
"f" ), QStringLiteral( 
"json" ) );
 
   85   query.addQueryItem( QStringLiteral( 
"objectIds" ), ids.join( QLatin1Char( 
',' ) ) );
 
   86   const QString wkid = 
crs.indexOf( QLatin1Char( 
':' ) ) >= 0 ? 
crs.split( 
':' )[1] : QString();
 
   87   query.addQueryItem( QStringLiteral( 
"inSR" ), wkid );
 
   88   query.addQueryItem( QStringLiteral( 
"outSR" ), wkid );
 
   90   query.addQueryItem( QStringLiteral( 
"returnGeometry" ), fetchGeometry ? QStringLiteral( 
"true" ) : QStringLiteral( 
"false" ) );
 
   93   if ( fetchAttributes.isEmpty() )
 
   94     outFields = QStringLiteral( 
"*" );
 
   96     outFields = fetchAttributes.join( 
',' );
 
   97   query.addQueryItem( QStringLiteral( 
"outFields" ), outFields );
 
   99   query.addQueryItem( QStringLiteral( 
"returnM" ), fetchM ? QStringLiteral( 
"true" ) : QStringLiteral( 
"false" ) );
 
  100   query.addQueryItem( QStringLiteral( 
"returnZ" ), fetchZ ? QStringLiteral( 
"true" ) : QStringLiteral( 
"false" ) );
 
  101   if ( !filterRect.
isNull() )
 
  103     query.addQueryItem( QStringLiteral( 
"geometry" ), QStringLiteral( 
"%1,%2,%3,%4" )
 
  104                         .arg( filterRect.
xMinimum(), 0, 
'f', -1 ).arg( filterRect.
yMinimum(), 0, 
'f', -1 )
 
  105                         .arg( filterRect.
xMaximum(), 0, 
'f', -1 ).arg( filterRect.
yMaximum(), 0, 
'f', -1 ) );
 
  106     query.addQueryItem( QStringLiteral( 
"geometryType" ), QStringLiteral( 
"esriGeometryEnvelope" ) );
 
  107     query.addQueryItem( QStringLiteral( 
"spatialRel" ), QStringLiteral( 
"esriSpatialRelEnvelopeIntersects" ) );
 
  109   queryUrl.setQuery( query );
 
  110   return queryServiceJSON( queryUrl,  authcfg, errorTitle, errorText, requestHeaders, feedback );
 
  115   QUrl queryUrl( layerurl + 
"/query" );
 
  116   QUrlQuery query( queryUrl );
 
  117   query.addQueryItem( QStringLiteral( 
"f" ), QStringLiteral( 
"json" ) );
 
  118   query.addQueryItem( QStringLiteral( 
"where" ), QStringLiteral( 
"1=1" ) );
 
  119   query.addQueryItem( QStringLiteral( 
"returnIdsOnly" ), QStringLiteral( 
"true" ) );
 
  120   query.addQueryItem( QStringLiteral( 
"geometry" ), QStringLiteral( 
"%1,%2,%3,%4" )
 
  121                       .arg( filterRect.
xMinimum(), 0, 
'f', -1 ).arg( filterRect.
yMinimum(), 0, 
'f', -1 )
 
  122                       .arg( filterRect.
xMaximum(), 0, 
'f', -1 ).arg( filterRect.
yMaximum(), 0, 
'f', -1 ) );
 
  123   query.addQueryItem( QStringLiteral( 
"geometryType" ), QStringLiteral( 
"esriGeometryEnvelope" ) );
 
  124   query.addQueryItem( QStringLiteral( 
"spatialRel" ), QStringLiteral( 
"esriSpatialRelEnvelopeIntersects" ) );
 
  125   queryUrl.setQuery( query );
 
  126   const QVariantMap objectIdData = 
queryServiceJSON( queryUrl, authcfg, errorTitle, errorText, requestHeaders, feedback );
 
  128   if ( objectIdData.isEmpty() )
 
  130     return QList<quint32>();
 
  134   const QVariantList objectIdsList = objectIdData[QStringLiteral( 
"objectIds" )].toList();
 
  135   ids.reserve( objectIdsList.size() );
 
  136   for ( 
const QVariant &objectId : objectIdsList )
 
  138     ids << objectId.toInt();
 
  145   const QUrl url = parseUrl( u );
 
  147   QNetworkRequest request( url );
 
  149   for ( 
auto it = requestHeaders.constBegin(); it != requestHeaders.constEnd(); ++it )
 
  151     request.setRawHeader( it.key().toUtf8(), it.value().toUtf8() );
 
  165     errorTitle = QStringLiteral( 
"Network error" );
 
  172     *contentType = content.
rawHeader( 
"Content-Type" );
 
  178   const QByteArray reply = 
queryService( url, authcfg, errorTitle, errorText, requestHeaders, feedback );
 
  179   if ( !errorTitle.isEmpty() )
 
  181     return QVariantMap();
 
  184     return QVariantMap();
 
  188   const QJsonDocument doc = QJsonDocument::fromJson( reply, &err );
 
  191     errorTitle = QStringLiteral( 
"Parsing error" );
 
  192     errorText = err.errorString();
 
  193     QgsDebugMsg( QStringLiteral( 
"Parsing error: %1" ).arg( err.errorString() ) );
 
  194     return QVariantMap();
 
  196   const QVariantMap res = doc.object().toVariantMap();
 
  197   if ( res.contains( QStringLiteral( 
"error" ) ) )
 
  199     const QVariantMap error = res.value( QStringLiteral( 
"error" ) ).toMap();
 
  200     errorText = error.value( QStringLiteral( 
"message" ) ).toString();
 
  201     errorTitle = QObject::tr( 
"Error %1" ).arg( error.value( QStringLiteral( 
"code" ) ).toString() );
 
  202     return QVariantMap();
 
  207 QUrl QgsArcGisRestQueryUtils::parseUrl( 
const QUrl &url )
 
  209   QUrl modifiedUrl( url );
 
  210   if ( modifiedUrl.toString().contains( QLatin1String( 
"fake_qgis_http_endpoint" ) ) )
 
  213     QString modifiedUrlString = modifiedUrl.toString();
 
  215     modifiedUrlString = QUrl::fromPercentEncoding( modifiedUrlString.toUtf8() );
 
  216     modifiedUrlString.replace( QLatin1String( 
"fake_qgis_http_endpoint/" ), QLatin1String( 
"fake_qgis_http_endpoint_" ) );
 
  217     QgsDebugMsg( QStringLiteral( 
"Get %1" ).arg( modifiedUrlString ) );
 
  218     modifiedUrlString = modifiedUrlString.mid( QStringLiteral( 
"http://" ).size() );
 
  219     QString args = modifiedUrlString.mid( modifiedUrlString.indexOf( 
'?' ) );
 
  220     if ( modifiedUrlString.size() > 150 )
 
  222       args = QCryptographicHash::hash( args.toUtf8(), QCryptographicHash::Md5 ).toHex();
 
  226       args.replace( QLatin1String( 
"?" ), QLatin1String( 
"_" ) );
 
  227       args.replace( QLatin1String( 
"&" ), QLatin1String( 
"_" ) );
 
  228       args.replace( QLatin1String( 
"<" ), QLatin1String( 
"_" ) );
 
  229       args.replace( QLatin1String( 
">" ), QLatin1String( 
"_" ) );
 
  230       args.replace( QLatin1String( 
"'" ), QLatin1String( 
"_" ) );
 
  231       args.replace( QLatin1String( 
"\"" ), QLatin1String( 
"_" ) );
 
  232       args.replace( QLatin1String( 
" " ), QLatin1String( 
"_" ) );
 
  233       args.replace( QLatin1String( 
":" ), QLatin1String( 
"_" ) );
 
  234       args.replace( QLatin1String( 
"/" ), QLatin1String( 
"_" ) );
 
  235       args.replace( QLatin1String( 
"\n" ), QLatin1String( 
"_" ) );
 
  240     if ( modifiedUrlString[1] == 
'/' )
 
  242       modifiedUrlString = modifiedUrlString[0] + 
":/" + modifiedUrlString.mid( 2 );
 
  245     modifiedUrlString = modifiedUrlString.mid( 0, modifiedUrlString.indexOf( 
'?' ) ) + args;
 
  246     QgsDebugMsg( QStringLiteral( 
"Get %1 (after laundering)" ).arg( modifiedUrlString ) );
 
  247     modifiedUrl = QUrl::fromLocalFile( modifiedUrlString );
 
  253 void QgsArcGisRestQueryUtils::adjustBaseUrl( QString &baseUrl, 
const QString &name )
 
  255   const QStringList parts = name.split( 
'/' );
 
  257   for ( 
const QString &part : parts )
 
  259     if ( !checkString.isEmpty() )
 
  260       checkString += QString( 
'/' );
 
  263     if ( baseUrl.indexOf( QRegularExpression( checkString.replace( 
'/', QLatin1String( 
"\\/" ) ) + QStringLiteral( 
"\\/?$" ) ) ) > -1 )
 
  265       baseUrl = baseUrl.left( baseUrl.length() - checkString.length() - 1 );
 
  273   QString base( baseUrl );
 
  274   bool baseChecked = 
false;
 
  275   if ( !base.endsWith( 
'/' ) )
 
  276     base += QLatin1Char( 
'/' );
 
  278   const QStringList folderList = serviceData.value( QStringLiteral( 
"folders" ) ).toStringList();
 
  279   for ( 
const QString &folder : folderList )
 
  283       adjustBaseUrl( base, folder );
 
  286     visitor( folder, base + folder );
 
  292   QString base( baseUrl );
 
  293   bool baseChecked = 
false;
 
  294   if ( !base.endsWith( 
'/' ) )
 
  295     base += QLatin1Char( 
'/' );
 
  297   const QVariantList serviceList = serviceData.value( QStringLiteral( 
"services" ) ).toList();
 
  298   for ( 
const QVariant &service : serviceList )
 
  300     const QVariantMap serviceMap = service.toMap();
 
  301     const QString serviceType = serviceMap.value( QStringLiteral( 
"type" ) ).toString();
 
  302     if ( serviceType != QLatin1String( 
"MapServer" ) && serviceType != QLatin1String( 
"ImageServer" ) && serviceType != QLatin1String( 
"FeatureServer" ) )
 
  307     const QString serviceName = serviceMap.value( QStringLiteral( 
"name" ) ).toString();
 
  308     const QString displayName = serviceName.split( 
'/' ).last();
 
  311       adjustBaseUrl( base, serviceName );
 
  315     visitor( displayName, base + serviceName + 
'/' + serviceType, serviceType, type );
 
  319 void QgsArcGisRestQueryUtils::addLayerItems( 
const std::function<
void ( 
const QString &, 
ServiceTypeFilter, 
QgsWkbTypes::GeometryType, 
const QString &, 
const QString &, 
const QString &, 
const QString &, 
bool, 
const QString &, 
const QString & )> &visitor, 
const QVariantMap &serviceData, 
const QString &parentUrl, 
const QString &parentSupportedFormats, 
const ServiceTypeFilter filter )
 
  324   const QList<QByteArray> supportedFormats = QImageReader::supportedImageFormats();
 
  325   const QStringList supportedImageFormatTypes = serviceData.value( QStringLiteral( 
"supportedImageFormatTypes" ) ).toString().isEmpty() ? parentSupportedFormats.split( 
',' ) : serviceData.value( QStringLiteral( 
"supportedImageFormatTypes" ) ).toString().split( 
',' );
 
  326   QString format = supportedImageFormatTypes.value( 0 );
 
  327   for ( 
const QString &encoding : supportedImageFormatTypes )
 
  329     for ( 
const QByteArray &fmt : supportedFormats )
 
  331       if ( encoding.startsWith( fmt, Qt::CaseInsensitive ) )
 
  341   const QStringList capabilities = serviceData.value( QStringLiteral( 
"capabilities" ) ).toString().split( 
',' );
 
  344   const bool serviceMayHaveQueryCapability = capabilities.contains( QStringLiteral( 
"Query" ) ) ||
 
  345       serviceData.value( QStringLiteral( 
"serviceDataType" ) ).toString().startsWith( QLatin1String( 
"esriImageService" ) );
 
  347   const bool serviceMayRenderMaps = capabilities.contains( QStringLiteral( 
"Map" ) ) ||
 
  348                                     serviceData.value( QStringLiteral( 
"serviceDataType" ) ).toString().startsWith( QLatin1String( 
"esriImageService" ) );
 
  350   const QVariantList layerInfoList = serviceData.value( QStringLiteral( 
"layers" ) ).toList();
 
  351   for ( 
const QVariant &layerInfo : layerInfoList )
 
  353     const QVariantMap layerInfoMap = layerInfo.toMap();
 
  354     const QString 
id = layerInfoMap.value( QStringLiteral( 
"id" ) ).toString();
 
  355     const QString parentLayerId = layerInfoMap.value( QStringLiteral( 
"parentLayerId" ) ).toString();
 
  356     const QString name = layerInfoMap.value( QStringLiteral( 
"name" ) ).toString();
 
  357     const QString description = layerInfoMap.value( QStringLiteral( 
"description" ) ).toString();
 
  360     if ( serviceMayRenderMaps && ( filter == 
Raster || filter == 
AllTypes ) )
 
  362       if ( !layerInfoMap.value( QStringLiteral( 
"subLayerIds" ) ).toList().empty() )
 
  372     if ( serviceMayHaveQueryCapability && ( filter == 
Vector || filter == 
AllTypes ) )
 
  374       const QString geometryType = layerInfoMap.value( QStringLiteral( 
"geometryType" ) ).toString();
 
  385       if ( serviceMayRenderMaps )
 
  387         if ( geometryType.isEmpty() )
 
  395       if ( !layerInfoMap.value( QStringLiteral( 
"subLayerIds" ) ).toList().empty() )
 
  407   if ( filter != 
Vector && layerInfoList.count() > 1 && serviceData.contains( QStringLiteral( 
"supportedImageFormatTypes" ) ) )
 
  409     const QString name = QStringLiteral( 
"(%1)" ).arg( QObject::tr( 
"All layers" ) );
 
  410     const QString description = serviceData.value( QStringLiteral( 
"Comments" ) ).toString();
 
  415   if ( serviceData.value( QStringLiteral( 
"serviceDataType" ) ).toString().startsWith( QLatin1String( 
"esriImageService" ) ) )
 
  417     const QString name = serviceData.value( QStringLiteral( 
"name" ) ).toString();
 
  418     const QString description = serviceData.value( QStringLiteral( 
"description" ) ).toString();
 
  430 QgsArcGisAsyncQuery::QgsArcGisAsyncQuery( QObject *parent )
 
  435 QgsArcGisAsyncQuery::~QgsArcGisAsyncQuery()
 
  438     mReply->deleteLater();
 
  441 void QgsArcGisAsyncQuery::start( 
const QUrl &url, 
const QString &authCfg, QByteArray *result, 
bool allowCache, 
const QgsStringMap &headers )
 
  444   QNetworkRequest request( url );
 
  446   for ( 
auto it = headers.constBegin(); it != headers.constEnd(); ++it )
 
  448     request.setRawHeader( it.key().toUtf8(), it.value().toUtf8() );
 
  453     const QString error = tr( 
"network request update failed for authentication config" );
 
  454     emit failed( QStringLiteral( 
"Network" ), error );
 
  461     request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache );
 
  462     request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, 
true );
 
  465   connect( mReply, &QNetworkReply::finished, 
this, &QgsArcGisAsyncQuery::handleReply );
 
  468 void QgsArcGisAsyncQuery::handleReply()
 
  470   mReply->deleteLater();
 
  472   if ( mReply->error() != QNetworkReply::NoError )
 
  474     QgsDebugMsg( QStringLiteral( 
"Network error: %1" ).arg( mReply->errorString() ) );
 
  475     emit failed( QStringLiteral( 
"Network error" ), mReply->errorString() );
 
  480   const QVariant redirect = mReply->attribute( QNetworkRequest::RedirectionTargetAttribute );
 
  481   if ( !redirect.isNull() )
 
  483     QNetworkRequest request = mReply->request();
 
  485     QgsDebugMsg( 
"redirecting to " + redirect.toUrl().toString() );
 
  486     request.setUrl( redirect.toUrl() );
 
  488     connect( mReply, &QNetworkReply::finished, 
this, &QgsArcGisAsyncQuery::handleReply );
 
  492   *mResult = mReply->readAll();
 
  501 QgsArcGisAsyncParallelQuery::QgsArcGisAsyncParallelQuery( 
const QString &authcfg, 
const QgsStringMap &requestHeaders, QObject *parent )
 
  503   , mAuthCfg( authcfg )
 
  504   , mRequestHeaders( requestHeaders )
 
  508 void QgsArcGisAsyncParallelQuery::start( 
const QVector<QUrl> &urls, QVector<QByteArray> *results, 
bool allowCache )
 
  510   Q_ASSERT( results->size() == urls.size() );
 
  512   mPendingRequests = mResults->size();
 
  513   for ( 
int i = 0, n = urls.size(); i < n; ++i )
 
  515     QNetworkRequest request( urls[i] );
 
  519     for ( 
auto it = mRequestHeaders.constBegin(); it != mRequestHeaders.constEnd(); ++it )
 
  521       request.setRawHeader( it.key().toUtf8(), it.value().toUtf8() );
 
  525       const QString error = tr( 
"network request update failed for authentication config" );
 
  526       mErrors.append( error );
 
  531     request.setAttribute( QNetworkRequest::HttpPipeliningAllowedAttribute, 
true );
 
  534       request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache );
 
  535       request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, 
true );
 
  536       request.setRawHeader( 
"Connection", 
"keep-alive" );
 
  539     reply->setProperty( 
"idx", i );
 
  540     connect( reply, &QNetworkReply::finished, 
this, &QgsArcGisAsyncParallelQuery::handleReply );
 
  544 void QgsArcGisAsyncParallelQuery::handleReply()
 
  546   QNetworkReply *reply = qobject_cast<QNetworkReply *>( QObject::sender() );
 
  547   const QVariant redirect = reply->attribute( QNetworkRequest::RedirectionTargetAttribute );
 
  548   const int idx = reply->property( 
"idx" ).toInt();
 
  549   reply->deleteLater();
 
  550   if ( reply->error() != QNetworkReply::NoError )
 
  553     mErrors.append( reply->errorString() );
 
  556   else if ( !redirect.isNull() )
 
  559     QNetworkRequest request = reply->request();
 
  561     QgsDebugMsg( 
"redirecting to " + redirect.toUrl().toString() );
 
  562     request.setUrl( redirect.toUrl() );
 
  564     reply->setProperty( 
"idx", idx );
 
  565     connect( reply, &QNetworkReply::finished, 
this, &QgsArcGisAsyncParallelQuery::handleReply );
 
  570     ( *mResults )[idx] = reply->readAll();
 
  573   if ( mPendingRequests == 0 )
 
  575     emit finished( mErrors );
 
static QgsAuthManager * authManager()
Returns the application's authentication manager instance.
static void visitFolderItems(const std::function< void(const QString &folderName, const QString &url)> &visitor, const QVariantMap &serviceData, const QString &baseUrl)
Calls the specified visitor function on all folder items found within the given service data.
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)
Calls the specified visitor function on all layer items found within the given service data.
static QList< quint32 > getObjectIdsByExtent(const QString &layerurl, const QgsRectangle &filterRect, QString &errorTitle, QString &errorText, const QString &authcfg, const QgsStringMap &requestHeaders=QgsStringMap(), QgsFeedback *feedback=nullptr)
Gets a list of object IDs which fall within the specified extent.
static QVariantMap getObjectIds(const QString &layerurl, const QString &authcfg, QString &errorTitle, QString &errorText, const QMap< QString, QString > &requestHeaders=QMap< QString, QString >(), const QgsRectangle &bbox=QgsRectangle())
Retrieves all object IDs for the specified layer URL.
static QVariantMap queryServiceJSON(const QUrl &url, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsStringMap &requestHeaders=QgsStringMap(), QgsFeedback *feedback=nullptr)
Performs a blocking request to a URL and returns the retrieved JSON content.
ServiceTypeFilter
Service types.
static QVariantMap getLayerInfo(const QString &layerurl, const QString &authcfg, QString &errorTitle, QString &errorText, const QMap< QString, QString > &requestHeaders=QMap< QString, QString >())
Retrieves JSON layer info for the specified layer URL.
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)
Calls the specified visitor function on all service items found within the given service data.
static QVariantMap getServiceInfo(const QString &baseurl, const QString &authcfg, QString &errorTitle, QString &errorText, const QMap< QString, QString > &requestHeaders=QMap< QString, QString >())
Retrieves JSON service info for the specified base URL.
static QByteArray queryService(const QUrl &url, const QString &authcfg, QString &errorTitle, QString &errorText, const QgsStringMap &requestHeaders=QgsStringMap(), QgsFeedback *feedback=nullptr, QString *contentType=nullptr)
Performs a blocking request to a URL and returns the retrieved data.
static QVariantMap getObjects(const QString &layerurl, const QString &authcfg, const QList< quint32 > &objectIds, const QString &crs, bool fetchGeometry, const QStringList &fetchAttributes, bool fetchM, bool fetchZ, const QgsRectangle &filterRect, QString &errorTitle, QString &errorText, const QgsStringMap &requestHeaders=QgsStringMap(), QgsFeedback *feedback=nullptr)
Retrieves all matching objects from the specified layer URL.
static QgsCoordinateReferenceSystem convertSpatialReference(const QVariantMap &spatialReferenceMap)
Converts a spatial reference JSON definition to a QgsCoordinateReferenceSystem value.
static QgsWkbTypes::Type convertGeometryType(const QString &type)
Converts an ESRI REST geometry type to a WKB type.
bool updateNetworkRequest(QNetworkRequest &request, const QString &authcfg, const QString &dataprovider=QString())
Provider call to update a QNetworkRequest with an authentication config.
A thread safe class for performing blocking (sync) network requests, with full support for QGIS proxy...
ErrorCode get(QNetworkRequest &request, bool forceRefresh=false, QgsFeedback *feedback=nullptr)
Performs a "get" operation on the specified request.
void setAuthCfg(const QString &authCfg)
Sets the authentication config id which should be used during the request.
QString errorMessage() const
Returns the error message string, after a get() or post() request has been made.
@ NoError
No error was encountered.
QgsNetworkReplyContent reply() const
Returns the content of the network reply, after a get() or post() request has been made.
QString authid() const
Returns the authority identifier for the CRS.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
bool isCanceled() const SIP_HOLDGIL
Tells whether the operation has been canceled already.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
static QgsNetworkAccessManager * instance(Qt::ConnectionType connectionType=Qt::BlockingQueuedConnection)
Returns a pointer to the active QgsNetworkAccessManager for the current thread.
Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between...
QByteArray content() const
Returns the reply content.
QByteArray rawHeader(const QByteArray &headerName) const
Returns the content of the header with the specified headerName, or an empty QByteArray if the specif...
A rectangle specified with double values.
double yMaximum() const SIP_HOLDGIL
Returns the y maximum value (top side of rectangle).
double xMaximum() const SIP_HOLDGIL
Returns the x maximum value (right side of rectangle).
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
static GeometryType geometryType(Type type) SIP_HOLDGIL
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
Type
The WKB type describes the number of dimensions a geometry has.
QMap< QString, QString > QgsStringMap
#define QgsSetRequestInitiatorClass(request, _class)
#define QgsSetRequestInitiatorId(request, str)
const QgsCoordinateReferenceSystem & crs