23 #define PROVIDER_KEY QStringLiteral( "vectortile" )
24 #define PROVIDER_DESCRIPTION QStringLiteral( "Vector tile provider" )
26 QgsVectorTileProviderMetadata::QgsVectorTileProviderMetadata()
31 QList<QgsDataItemProvider *> QgsVectorTileProviderMetadata::dataItemProviders()
const
33 QList< QgsDataItemProvider * > providers;
34 providers <<
new QgsVectorTileDataItemProvider;
38 QMap<QString, QgsAbstractProviderConnection *> QgsVectorTileProviderMetadata::connections(
bool cached )
40 return connectionsProtected<QgsVectorTileProviderConnection, QgsVectorTileProviderConnection>( cached );
45 return new QgsVectorTileProviderConnection( name );
48 void QgsVectorTileProviderMetadata::deleteConnection(
const QString &name )
50 deleteConnectionProtected<QgsVectorTileProviderConnection>( name );
55 saveConnectionProtected( connection, name );
58 QgsProviderMetadata::ProviderCapabilities QgsVectorTileProviderMetadata::providerCapabilities()
const
63 QVariantMap QgsVectorTileProviderMetadata::decodeUri(
const QString &uri )
const
68 QVariantMap uriComponents;
69 uriComponents.insert( QStringLiteral(
"type" ), dsUri.
param( QStringLiteral(
"type" ) ) );
70 if ( dsUri.
hasParam( QStringLiteral(
"serviceType" ) ) )
71 uriComponents.insert( QStringLiteral(
"serviceType" ), dsUri.
param( QStringLiteral(
"serviceType" ) ) );
73 if ( uriComponents[ QStringLiteral(
"type" ) ] == QLatin1String(
"mbtiles" ) ||
74 ( uriComponents[ QStringLiteral(
"type" ) ] == QLatin1String(
"xyz" ) &&
75 !dsUri.
param( QStringLiteral(
"url" ) ).startsWith( QLatin1String(
"http" ) ) ) )
77 uriComponents.insert( QStringLiteral(
"path" ), dsUri.
param( QStringLiteral(
"url" ) ) );
81 uriComponents.insert( QStringLiteral(
"url" ), dsUri.
param( QStringLiteral(
"url" ) ) );
84 if ( dsUri.
hasParam( QStringLiteral(
"zmin" ) ) )
85 uriComponents.insert( QStringLiteral(
"zmin" ), dsUri.
param( QStringLiteral(
"zmin" ) ) );
86 if ( dsUri.
hasParam( QStringLiteral(
"zmax" ) ) )
87 uriComponents.insert( QStringLiteral(
"zmax" ), dsUri.
param( QStringLiteral(
"zmax" ) ) );
89 if ( dsUri.
hasParam( QStringLiteral(
"referer" ) ) )
90 uriComponents.insert( QStringLiteral(
"referer" ), dsUri.
param( QStringLiteral(
"referer" ) ) );
91 if ( dsUri.
hasParam( QStringLiteral(
"styleUrl" ) ) )
92 uriComponents.insert( QStringLiteral(
"styleUrl" ), dsUri.
param( QStringLiteral(
"styleUrl" ) ) );
95 if ( !authcfg.isEmpty() )
96 uriComponents.insert( QStringLiteral(
"authcfg" ), authcfg );
101 QString QgsVectorTileProviderMetadata::encodeUri(
const QVariantMap &parts )
const
104 dsUri.
setParam( QStringLiteral(
"type" ), parts.value( QStringLiteral(
"type" ) ).toString() );
105 if ( parts.contains( QStringLiteral(
"serviceType" ) ) )
106 dsUri.
setParam( QStringLiteral(
"serviceType" ), parts[ QStringLiteral(
"serviceType" ) ].toString() );
107 dsUri.
setParam( QStringLiteral(
"url" ), parts.value( parts.contains( QStringLiteral(
"path" ) ) ? QStringLiteral(
"path" ) : QStringLiteral(
"url" ) ).toString() );
109 if ( parts.contains( QStringLiteral(
"zmin" ) ) )
110 dsUri.
setParam( QStringLiteral(
"zmin" ), parts[ QStringLiteral(
"zmin" ) ].toString() );
111 if ( parts.contains( QStringLiteral(
"zmax" ) ) )
112 dsUri.
setParam( QStringLiteral(
"zmax" ), parts[ QStringLiteral(
"zmax" ) ].toString() );
114 if ( parts.contains( QStringLiteral(
"referer" ) ) )
115 dsUri.
setParam( QStringLiteral(
"referer" ), parts[ QStringLiteral(
"referer" ) ].toString() );
116 if ( parts.contains( QStringLiteral(
"styleUrl" ) ) )
117 dsUri.
setParam( QStringLiteral(
"styleUrl" ), parts[ QStringLiteral(
"styleUrl" ) ].toString() );
119 if ( parts.contains( QStringLiteral(
"authcfg" ) ) )
120 dsUri.
setAuthConfigId( parts[ QStringLiteral(
"authcfg" ) ].toString() );
The QgsAbstractProviderConnection provides an interface for data provider connections.
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.
bool hasParam(const QString &key) const
Returns true if a parameter with the specified key exists.
void setEncodedUri(const QByteArray &uri)
Sets the complete encoded uri.
void setAuthConfigId(const QString &authcfg)
Sets the authentication configuration ID for the URI.
QString param(const QString &key) const
Returns a generic parameter value corresponding to the specified key.
void setParam(const QString &key, const QString &value)
Sets a generic parameter value on the URI.
QString authConfigId() const
Returns any associated authentication configuration ID stored in the URI.