33#include <QNetworkRequest>
34#include <QNetworkReply>
80 : mConnName( connName )
86 mConnectionInfo = url;
92 if ( !username.isEmpty() )
100 if ( !authcfg.isEmpty() )
104 mConnectionInfo.append(
",authcfg=" + authcfg );
109 if ( !referer.isEmpty() )
111 mConnectionInfo.append(
",referer=" + referer );
114 if ( mService.compare( QLatin1String(
"WMS" ), Qt::CaseInsensitive ) == 0
115 || mService.compare( QLatin1String(
"WCS" ), Qt::CaseInsensitive ) == 0 )
119 else if ( mService.compare( QLatin1String(
"WFS" ), Qt::CaseInsensitive ) == 0 )
134 return mConnectionInfo;
150 addCommonConnectionSettings(
uri, settingsKey );
156 if ( settings.value( settingsKey + QStringLiteral(
"/ignoreGetMapURI" ),
false ).toBool() )
158 uri.
setParam( QStringLiteral(
"IgnoreGetMapUrl" ), QStringLiteral(
"1" ) );
160 if ( settings.value( settingsKey + QStringLiteral(
"/ignoreGetFeatureInfoURI" ),
false ).toBool() )
162 uri.
setParam( QStringLiteral(
"IgnoreGetFeatureInfoUrl" ), QStringLiteral(
"1" ) );
164 if ( settings.value( settingsKey + QStringLiteral(
"/smoothPixmapTransform" ),
false ).toBool() )
166 uri.
setParam( QStringLiteral(
"SmoothPixmapTransform" ), QStringLiteral(
"1" ) );
168 if ( settings.value( settingsKey + QStringLiteral(
"/ignoreReportedLayerExtents" ),
false ).toBool() )
170 uri.
setParam( QStringLiteral(
"IgnoreReportedLayerExtents" ), QStringLiteral(
"1" ) );
172 const QString dpiMode = settings.value( settingsKey + QStringLiteral(
"/dpiMode" ), QStringLiteral(
"all" ) ).toString();
173 if ( !dpiMode.isEmpty() )
175 uri.
setParam( QStringLiteral(
"dpiMode" ), dpiMode );
177 const QString tilePixelRatio = settings.value( settingsKey + QStringLiteral(
"/tilePixelRatio" ),
"0" ).toString();
178 if ( tilePixelRatio != QLatin1String(
"0" ) )
180 uri.
setParam( QStringLiteral(
"tilePixelRatio" ), tilePixelRatio );
188 addCommonConnectionSettings(
uri,
service, connName );
194 uri.
setParam( QStringLiteral(
"IgnoreGetMapUrl" ), QStringLiteral(
"1" ) );
198 uri.
setParam( QStringLiteral(
"IgnoreGetFeatureInfoUrl" ), QStringLiteral(
"1" ) );
202 uri.
setParam( QStringLiteral(
"SmoothPixmapTransform" ), QStringLiteral(
"1" ) );
206 uri.
setParam( QStringLiteral(
"IgnoreReportedLayerExtents" ), QStringLiteral(
"1" ) );
227 addCommonConnectionSettings(
uri, settingsKey );
231 const QString version = settings.
value( settingsKey +
"/version" ).toString();
232 if ( !version.isEmpty() )
234 uri.
setParam( QStringLiteral(
"version" ), version );
237 const QString maxnumfeatures = settings.value( settingsKey + QStringLiteral(
"/maxnumfeatures" ) ).toString();
238 if ( !maxnumfeatures.isEmpty() )
240 uri.
setParam( QStringLiteral(
"maxNumFeatures" ), maxnumfeatures );
248 addCommonConnectionSettings(
uri,
service, connName );
251 if ( !version.isEmpty() )
253 uri.
setParam( QStringLiteral(
"version" ), version );
257 if ( !maxnumFeatures.isEmpty() )
259 uri.
setParam( QStringLiteral(
"maxNumFeatures" ), maxnumFeatures );
280void QgsOwsConnection::addCommonConnectionSettings(
QgsDataSourceUri &uri,
const QString &key )
284 if ( settings.
value( key + QStringLiteral(
"/ignoreAxisOrientation" ),
false ).toBool() )
286 uri.
setParam( QStringLiteral(
"IgnoreAxisOrientation" ), QStringLiteral(
"1" ) );
288 if ( settings.
value( key + QStringLiteral(
"/invertAxisOrientation" ),
false ).toBool() )
290 uri.
setParam( QStringLiteral(
"InvertAxisOrientation" ), QStringLiteral(
"1" ) );
294void QgsOwsConnection::addCommonConnectionSettings(
QgsDataSourceUri &uri,
const QString &service,
const QString &connectionName )
299 uri.
setParam( QStringLiteral(
"IgnoreAxisOrientation" ), QStringLiteral(
"1" ) );
303 uri.
setParam( QStringLiteral(
"InvertAxisOrientation" ), QStringLiteral(
"1" ) );
@ SaveEnumFlagAsInt
The enum/flag will be saved as an integer value instead of text.
@ 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 * settingsUrlPrefix
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 QgsSettingsEntryInteger * settingsFeatureCount
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 QgsSettingsEntryString * 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.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
bool exists(const QString &dynamicKeyPart=QString()) const
Returns true if the settings is contained in the underlying QSettings.
A boolean settings entry.
A template class for enum and flag settings entry.
An integer settings entry.
A string list settings entry.
void deleteItem(const QString &item, const QStringList &parentsNamedItems=QStringList())
Deletes a named item from the named list node.
QString selectedItem(const QStringList &parentsNamedItems=QStringList())
Returns the selected named item from the named list node.
void setSelectedItem(const QString &item, const QStringList &parentsNamedItems=QStringList())
Sets the selected named item from the named list node.
QStringList items(const QStringList &parentsNamedItems=QStringList()) const
Returns the list of items.
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)