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 );
231void 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" ) );
245void QgsOwsConnection::addCommonConnectionSettings(
QgsDataSourceUri &uri,
const QString &service,
const QString &connectionName )
250 uri.
setParam( QStringLiteral(
"IgnoreAxisOrientation" ), QStringLiteral(
"1" ) );
254 uri.
setParam( QStringLiteral(
"InvertAxisOrientation" ), QStringLiteral(
"1" ) );
Class for storing the component parts of a RDBMS data source URI (e.g.
QByteArray encodedUri() const
Returns the complete encoded URI as a byte array.
void setAuthConfigId(const QString &authcfg)
Sets the authentication configuration ID for the URI.
QgsHttpHeaders httpHeaders() const
Returns http headers.
void setUsername(const QString &username)
Sets the username for the URI.
void setParam(const QString &key, const QString &value)
Sets a generic parameter value on the URI.
void setHttpHeaders(const QgsHttpHeaders &headers)
Sets headers to headers.
void setPassword(const QString &password)
Sets the password for the URI.
static const QgsSettingsEntryBool settingsConnectionIgnoreGetMapURI
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.
static QStringList connectionList(const QString &service)
Returns the list of connections for the specified service.
static const QgsSettingsEntryString settingsConnectionUrl
static const QgsSettingsEntryString settingsConnectionPassword
static const QgsSettingsEntryEnumFlag< Qgis::DpiMode > settingsConnectionDpiMode
static void setSelectedConnection(const QString &service, const QString &name)
Marks the specified connection for the specified service as selected.
static const QgsSettingsEntryBool settingsConnectionIgnoreGetFeatureInfoURI
static const QgsSettingsEntryString settingsConnectionVersion
static const QgsSettingsEntryString settingsConnectionUsername
static const QgsSettingsEntryGroup settingsServiceConnectionDetailsGroup
static const QgsSettingsEntryBool settingsConnectionReportedLayerExtents
QString connectionInfo() const
Returns connection info string.
static void deleteConnection(const QString &service, const QString &name)
Deletes the connection for the specified service with the specified name.
static const QgsSettingsEntryString settingsConnectionMaxNumFeatures
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 settingsConnectionSmoothPixmapTransform
QString connectionName() const
Returns the connection name.
static QString selectedConnection(const QString &service)
Retrieves the selected connection for the specified service.
QgsOwsConnection(const QString &service, const QString &connName)
Constructor.
static const QgsSettingsEntryBool settingsConnectionIgnoreAxisOrientation
static const QgsSettingsEntryGroup settingsServiceConnectionCredentialsGroup
static const QgsSettingsEntryString settingsConnectionAuthCfg
static const QgsSettingsEntryBool settingsConnectionInvertAxisOrientation
QgsDataSourceUri uri() const
Returns the connection uri.
QString service() const
Returns a string representing the service type, e.g.
bool exists(const QString &dynamicKeyPart=QString()) const
Returns true if the settings is contained in the underlying QSettings.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
void removeAllSettingsAtBaseKey(const QStringList &dynamicKeyPartList=QStringList()) const
Removes all the settings at the base key for the given dynamicKeyPartList This means it might remove ...
This class is a composition of two QSettings instances:
QStringList childGroups() const
Returns a list of all key top-level groups that contain keys that can be read using the QSettings obj...
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void beginGroup(const QString &prefix, QgsSettings::Section section=QgsSettings::NoSection)
Appends prefix to the current group.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH
#define QgsDebugMsgLevel(str, level)