33#include <QNetworkRequest>
34#include <QNetworkReply>
78 : mConnName( connName )
84 mConnectionInfo = url;
90 if ( !username.isEmpty() )
98 if ( !authcfg.isEmpty() )
102 mConnectionInfo.append(
",authcfg=" + authcfg );
107 if ( !referer.isEmpty() )
109 mConnectionInfo.append(
",referer=" + referer );
112 if ( mService.compare( QLatin1String(
"WMS" ), Qt::CaseInsensitive ) == 0
113 || mService.compare( QLatin1String(
"WCS" ), Qt::CaseInsensitive ) == 0 )
117 else if ( mService.compare( QLatin1String(
"WFS" ), Qt::CaseInsensitive ) == 0 )
132 return mConnectionInfo;
148 addCommonConnectionSettings(
uri, settingsKey );
154 if ( settings.value( settingsKey + QStringLiteral(
"/ignoreGetMapURI" ),
false ).toBool() )
156 uri.
setParam( QStringLiteral(
"IgnoreGetMapUrl" ), QStringLiteral(
"1" ) );
158 if ( settings.value( settingsKey + QStringLiteral(
"/ignoreGetFeatureInfoURI" ),
false ).toBool() )
160 uri.
setParam( QStringLiteral(
"IgnoreGetFeatureInfoUrl" ), QStringLiteral(
"1" ) );
162 if ( settings.value( settingsKey + QStringLiteral(
"/smoothPixmapTransform" ),
false ).toBool() )
164 uri.
setParam( QStringLiteral(
"SmoothPixmapTransform" ), QStringLiteral(
"1" ) );
166 if ( settings.value( settingsKey + QStringLiteral(
"/ignoreReportedLayerExtents" ),
false ).toBool() )
168 uri.
setParam( QStringLiteral(
"IgnoreReportedLayerExtents" ), QStringLiteral(
"1" ) );
170 const QString dpiMode = settings.value( settingsKey + QStringLiteral(
"/dpiMode" ), QStringLiteral(
"all" ) ).toString();
171 if ( !dpiMode.isEmpty() )
173 uri.
setParam( QStringLiteral(
"dpiMode" ), dpiMode );
175 const QString tilePixelRatio = settings.value( settingsKey + QStringLiteral(
"/tilePixelRatio" ),
"0" ).toString();
176 if ( tilePixelRatio != QLatin1String(
"0" ) )
178 uri.
setParam( QStringLiteral(
"tilePixelRatio" ), tilePixelRatio );
186 addCommonConnectionSettings(
uri,
service, connName );
192 uri.
setParam( QStringLiteral(
"IgnoreGetMapUrl" ), QStringLiteral(
"1" ) );
196 uri.
setParam( QStringLiteral(
"IgnoreGetFeatureInfoUrl" ), QStringLiteral(
"1" ) );
200 uri.
setParam( QStringLiteral(
"SmoothPixmapTransform" ), QStringLiteral(
"1" ) );
204 uri.
setParam( QStringLiteral(
"IgnoreReportedLayerExtents" ), QStringLiteral(
"1" ) );
221 addCommonConnectionSettings(
uri, settingsKey );
225 const QString version = settings.
value( settingsKey +
"/version" ).toString();
226 if ( !version.isEmpty() )
228 uri.
setParam( QStringLiteral(
"version" ), version );
231 const QString maxnumfeatures = settings.value( settingsKey + QStringLiteral(
"/maxnumfeatures" ) ).toString();
232 if ( !maxnumfeatures.isEmpty() )
234 uri.
setParam( QStringLiteral(
"maxNumFeatures" ), maxnumfeatures );
242 addCommonConnectionSettings(
uri,
service, connName );
245 if ( !version.isEmpty() )
247 uri.
setParam( QStringLiteral(
"version" ), version );
251 if ( !maxnumFeatures.isEmpty() )
253 uri.
setParam( QStringLiteral(
"maxNumFeatures" ), maxnumFeatures );
274void QgsOwsConnection::addCommonConnectionSettings(
QgsDataSourceUri &uri,
const QString &key )
278 if ( settings.
value( key + QStringLiteral(
"/ignoreAxisOrientation" ),
false ).toBool() )
280 uri.
setParam( QStringLiteral(
"IgnoreAxisOrientation" ), QStringLiteral(
"1" ) );
282 if ( settings.
value( key + QStringLiteral(
"/invertAxisOrientation" ),
false ).toBool() )
284 uri.
setParam( QStringLiteral(
"InvertAxisOrientation" ), QStringLiteral(
"1" ) );
288void QgsOwsConnection::addCommonConnectionSettings(
QgsDataSourceUri &uri,
const QString &service,
const QString &connectionName )
293 uri.
setParam( QStringLiteral(
"IgnoreAxisOrientation" ), QStringLiteral(
"1" ) );
297 uri.
setParam( QStringLiteral(
"InvertAxisOrientation" ), QStringLiteral(
"1" ) );
@ Undefined
Undefined (not scale)
static const QgsSettingsEntryString * settingsUsername
static const QgsSettingsEntryString * settingsUrl
static const QgsSettingsEntryString * settingsPassword
static const QgsSettingsEntryVariantMap * settingsHeaders
static const QgsSettingsEntryString * settingsContentEndpoint
static const QgsSettingsEntryString * settingsAuthcfg
static const QgsSettingsEntryString * settingsCommunityEndpoint
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 * settingsPreferCoordinatesForWfsT11
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 QgsSettingsEntryBool * settingsPagingEnabled
static const QgsSettingsEntryString * settingsMaxNumFeatures
static QgsSettingsTreeNamedListNode * sTreeOwsConnections
static const QgsSettingsEntryBool * settingsIgnoreGetFeatureInfoURI
static const QgsSettingsEntryString * settingsPassword
static const QgsSettingsEntryBool * settingsReportedLayerExtents
static void setSelectedConnection(const QString &service, const QString &name)
Marks the specified connection for the specified service as selected.
static const QgsSettingsEntryEnumFlag< Qgis::DpiMode > * settingsDpiMode
static const QgsSettingsEntryBool * settingsIgnoreAxisOrientation
static const QgsSettingsEntryBool * settingsInvertAxisOrientation
static const QgsSettingsEntryString * settingsVersion
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 * settingsPagesize
static const QgsSettingsEntryString * settingsAuthCfg
static const QgsSettingsEntryEnumFlag< Qgis::TilePixelRatio > * settingsTilePixelRatio
static const QgsSettingsEntryVariantMap * settingsHeaders
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.
QString connectionName() const
Returns the connection name.
static const QgsSettingsEntryString * settingsUsername
static const QgsSettingsEntryBool * settingsSmoothPixmapTransform
static const QgsSettingsEntryString * settingsUrl
static QString selectedConnection(const QString &service)
Retrieves the selected connection for the specified service.
static const QgsSettingsEntryBool * settingsIgnoreGetMapURI
QgsOwsConnection(const QString &service, const QString &connName)
Constructor.
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.
A boolean settings entry.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
An integer settings entry.
A string list settings entry.
QString selectedItem(const QStringList &parentsNamedItems=QStringList()) SIP_THROW(QgsSettingsException)
Returns the selected named item from the named list node.
QStringList items(const QStringList &parentsNamedItems=QStringList()) const SIP_THROW(QgsSettingsException)
Returns the list of items.
void deleteItem(const QString &item, const QStringList &parentsNamedItems=QStringList()) SIP_THROW(QgsSettingsException)
Deletes a named item from the named list node.
void setSelectedItem(const QString &item, const QStringList &parentsNamedItems=QStringList()) SIP_THROW(QgsSettingsException)
Sets the selected named item from the named list node.
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
static const QgsSettingsEntryString * settingsPassword
static const QgsSettingsEntryDouble * settingsTilePixelRatio
static const QgsSettingsEntryString * settingsInterpretation
static const QgsSettingsEntryString * settingsUsername
static const QgsSettingsEntryString * settingsAuthcfg
static const QgsSettingsEntryInteger * settingsZmin
static const QgsSettingsEntryBool * settingsHidden
static const QgsSettingsEntryInteger * settingsZmax
static const QgsSettingsEntryString * settingsUrl
static const QgsSettingsEntryVariantMap * settingsHeaders
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH
#define QgsDebugMsgLevel(str, level)