QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
33 #include <QNetworkRequest>
34 #include <QNetworkReply>
38 : mConnName( connName )
44 mConnectionInfo = url;
50 if ( !username.isEmpty() )
58 if ( !authcfg.isEmpty() )
62 mConnectionInfo.append(
",authcfg=" + authcfg );
67 if ( !referer.isEmpty() )
69 mConnectionInfo.append(
",referer=" + referer );
72 if ( mService.compare( QLatin1String(
"WMS" ), Qt::CaseInsensitive ) == 0
73 || mService.compare( QLatin1String(
"WCS" ), Qt::CaseInsensitive ) == 0 )
77 else if ( mService.compare( QLatin1String(
"WFS" ), Qt::CaseInsensitive ) == 0 )
92 return mConnectionInfo;
108 addCommonConnectionSettings(
uri, settingsKey );
114 if ( settings.value( settingsKey + QStringLiteral(
"/ignoreGetMapURI" ),
false ).toBool() )
116 uri.
setParam( QStringLiteral(
"IgnoreGetMapUrl" ), QStringLiteral(
"1" ) );
118 if ( settings.value( settingsKey + QStringLiteral(
"/ignoreGetFeatureInfoURI" ),
false ).toBool() )
120 uri.
setParam( QStringLiteral(
"IgnoreGetFeatureInfoUrl" ), QStringLiteral(
"1" ) );
122 if ( settings.value( settingsKey + QStringLiteral(
"/smoothPixmapTransform" ),
false ).toBool() )
124 uri.
setParam( QStringLiteral(
"SmoothPixmapTransform" ), QStringLiteral(
"1" ) );
126 if ( settings.value( settingsKey + QStringLiteral(
"/ignoreReportedLayerExtents" ),
false ).toBool() )
128 uri.
setParam( QStringLiteral(
"IgnoreReportedLayerExtents" ), QStringLiteral(
"1" ) );
130 const QString dpiMode = settings.value( settingsKey + QStringLiteral(
"/dpiMode" ), QStringLiteral(
"all" ) ).toString();
131 if ( !dpiMode.isEmpty() )
133 uri.
setParam( QStringLiteral(
"dpiMode" ), dpiMode );
141 addCommonConnectionSettings(
uri,
service, connName );
149 uri.
setParam( QStringLiteral(
"IgnoreGetMapUrl" ), QStringLiteral(
"1" ) );
153 uri.
setParam( QStringLiteral(
"IgnoreGetFeatureInfoUrl" ), QStringLiteral(
"1" ) );
157 uri.
setParam( QStringLiteral(
"SmoothPixmapTransform" ), QStringLiteral(
"1" ) );
161 uri.
setParam( QStringLiteral(
"IgnoreReportedLayerExtents" ), QStringLiteral(
"1" ) );
174 addCommonConnectionSettings(
uri, settingsKey );
178 const QString version = settings.
value( settingsKey +
"/version" ).toString();
179 if ( !version.isEmpty() )
181 uri.
setParam( QStringLiteral(
"version" ), version );
184 const QString maxnumfeatures = settings.value( settingsKey + QStringLiteral(
"/maxnumfeatures" ) ).toString();
185 if ( !maxnumfeatures.isEmpty() )
187 uri.
setParam( QStringLiteral(
"maxNumFeatures" ), maxnumfeatures );
195 addCommonConnectionSettings(
uri,
service, connName );
198 if ( !version.isEmpty() )
200 uri.
setParam( QStringLiteral(
"version" ), version );
204 if ( !maxnumFeatures.isEmpty() )
206 uri.
setParam( QStringLiteral(
"maxNumFeatures" ), maxnumFeatures );
231 void QgsOwsConnection::addCommonConnectionSettings(
QgsDataSourceUri &uri,
const QString &key )
235 if ( settings.
value( key + QStringLiteral(
"/ignoreAxisOrientation" ),
false ).toBool() )
237 uri.
setParam( QStringLiteral(
"IgnoreAxisOrientation" ), QStringLiteral(
"1" ) );
239 if ( settings.
value( key + QStringLiteral(
"/invertAxisOrientation" ),
false ).toBool() )
241 uri.
setParam( QStringLiteral(
"InvertAxisOrientation" ), QStringLiteral(
"1" ) );
245 void QgsOwsConnection::addCommonConnectionSettings(
QgsDataSourceUri &uri,
const QString &service,
const QString &connectionName )
250 uri.
setParam( QStringLiteral(
"IgnoreAxisOrientation" ), QStringLiteral(
"1" ) );
254 uri.
setParam( QStringLiteral(
"InvertAxisOrientation" ), QStringLiteral(
"1" ) );
QString service() const
Returns a string representing the service type, e.g.
static const QgsSettingsEntryBool settingsConnectionIgnoreGetFeatureInfoURI
static const QgsSettingsEntryString settingsConnectionVersion
Class for storing the component parts of a RDBMS data source URI (e.g. a Postgres data source).
static const QgsSettingsEntryGroup settingsServiceConnectionDetailsGroup
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
static const QgsSettingsEntryString settingsConnectionUsername
#define QgsDebugMsgLevel(str, level)
void removeAllSettingsAtBaseKey(const QStringList &dynamicKeyPartList=QStringList()) const
Removes all the settings at the base key for the given dynamicKeyPartList This means it might remove ...
static const QgsSettingsEntryString settingsConnectionAuthCfg
static const QgsSettingsEntryString settingsConnectionUrl
This class is a composition of two QSettings instances:
static const QgsSettingsEntryBool settingsConnectionInvertAxisOrientation
bool exists(const QString &dynamicKeyPart=QString()) const
Returns true if the settings is contained in the underlying QSettings.
static Q_DECL_DEPRECATED QgsDataSourceUri & addWfsConnectionSettings(QgsDataSourceUri &uri, const QString &settingsKey)
Adds uri parameters relating to the settings for a WFS connection to a QgsDataSourceUri uri.
static const QgsSettingsEntryBool settingsConnectionIgnoreAxisOrientation
static const QgsSettingsEntryString settingsConnectionMaxNumFeatures
#define Q_NOWARN_DEPRECATED_POP
void setUsername(const QString &username)
Sets the username for the URI.
void setHttpHeaders(const QgsHttpHeaders &headers)
Sets headers to headers.
static QString selectedConnection(const QString &service)
Retrieves the selected connection for the specified service.
static void deleteConnection(const QString &service, const QString &name)
Deletes the connection for the specified service with the specified name.
void setAuthConfigId(const QString &authcfg)
Sets the authentication configuration ID for the URI.
static const QgsSettingsEntryEnumFlag< Qgis::DpiMode > settingsConnectionDpiMode
static Q_DECL_DEPRECATED QgsDataSourceUri & addWmsWcsConnectionSettings(QgsDataSourceUri &uri, const QString &settingsKey)
Adds uri parameters relating to the settings for a WMS or WCS connection to a QgsDataSourceUri uri.
void setParam(const QString &key, const QString &value)
Sets a generic parameter value on the URI.
static const QgsSettingsEntryString settingsConnectionPassword
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
static const QgsSettingsEntryGroup settingsServiceConnectionCredentialsGroup
QString connectionName() const
Returns the connection name.
QByteArray encodedUri() const
Returns the complete encoded URI as a byte array.
void beginGroup(const QString &prefix, QgsSettings::Section section=QgsSettings::NoSection)
Appends prefix to the current group.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
static const QgsSettingsEntryBool settingsConnectionIgnoreGetMapURI
QgsOwsConnection(const QString &service, const QString &connName)
Constructor.
static QStringList connectionList(const QString &service)
Returns the list of connections for the specified service.
static const QgsSettingsEntryBool settingsConnectionSmoothPixmapTransform
static const QgsSettingsEntryBool settingsConnectionReportedLayerExtents
QString connectionInfo() const
Returns connection info string.
#define Q_NOWARN_DEPRECATED_PUSH
void setPassword(const QString &password)
Sets the password for the URI.
QStringList childGroups() const
Returns a list of all key top-level groups that contain keys that can be read using the QSettings obj...
static void setSelectedConnection(const QString &service, const QString &name)
Marks the specified connection for the specified service as selected.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
QgsHttpHeaders httpHeaders() const
Returns http headers.
QgsDataSourceUri uri() const
Returns the connection uri.