24#define PROVIDER_KEY QStringLiteral( "vectortile" )
25#define PROVIDER_DESCRIPTION QStringLiteral( "Vector tile provider" )
27QgsVectorTileProviderMetadata::QgsVectorTileProviderMetadata()
32QIcon QgsVectorTileProviderMetadata::icon()
const
37QList<QgsDataItemProvider *> QgsVectorTileProviderMetadata::dataItemProviders()
const
39 QList< QgsDataItemProvider * > providers;
40 providers <<
new QgsVectorTileDataItemProvider;
44QMap<QString, QgsAbstractProviderConnection *> QgsVectorTileProviderMetadata::connections(
bool cached )
46 return connectionsProtected<QgsVectorTileProviderConnection, QgsVectorTileProviderConnection>( cached );
51 return new QgsVectorTileProviderConnection( name );
54void QgsVectorTileProviderMetadata::deleteConnection(
const QString &name )
56 deleteConnectionProtected<QgsVectorTileProviderConnection>( name );
61 saveConnectionProtected( connection, name );
64QgsProviderMetadata::ProviderCapabilities QgsVectorTileProviderMetadata::providerCapabilities()
const
69QVariantMap QgsVectorTileProviderMetadata::decodeUri(
const QString &uri )
const
74 QVariantMap uriComponents;
75 uriComponents.insert( QStringLiteral(
"type" ), dsUri.
param( QStringLiteral(
"type" ) ) );
76 if ( dsUri.
hasParam( QStringLiteral(
"serviceType" ) ) )
77 uriComponents.insert( QStringLiteral(
"serviceType" ), dsUri.
param( QStringLiteral(
"serviceType" ) ) );
79 if ( uriComponents[ QStringLiteral(
"type" ) ] == QLatin1String(
"mbtiles" ) ||
80 ( uriComponents[ QStringLiteral(
"type" ) ] == QLatin1String(
"xyz" ) &&
81 !dsUri.
param( QStringLiteral(
"url" ) ).startsWith( QLatin1String(
"http" ) ) ) )
83 uriComponents.insert( QStringLiteral(
"path" ), dsUri.
param( QStringLiteral(
"url" ) ) );
87 uriComponents.insert( QStringLiteral(
"url" ), dsUri.
param( QStringLiteral(
"url" ) ) );
90 if ( dsUri.
hasParam( QStringLiteral(
"zmin" ) ) )
91 uriComponents.insert( QStringLiteral(
"zmin" ), dsUri.
param( QStringLiteral(
"zmin" ) ) );
92 if ( dsUri.
hasParam( QStringLiteral(
"zmax" ) ) )
93 uriComponents.insert( QStringLiteral(
"zmax" ), dsUri.
param( QStringLiteral(
"zmax" ) ) );
97 if ( dsUri.
hasParam( QStringLiteral(
"styleUrl" ) ) )
98 uriComponents.insert( QStringLiteral(
"styleUrl" ), dsUri.
param( QStringLiteral(
"styleUrl" ) ) );
101 if ( !authcfg.isEmpty() )
102 uriComponents.insert( QStringLiteral(
"authcfg" ), authcfg );
104 return uriComponents;
107QString QgsVectorTileProviderMetadata::encodeUri(
const QVariantMap &parts )
const
110 dsUri.
setParam( QStringLiteral(
"type" ), parts.value( QStringLiteral(
"type" ) ).toString() );
111 if ( parts.contains( QStringLiteral(
"serviceType" ) ) )
112 dsUri.
setParam( QStringLiteral(
"serviceType" ), parts[ QStringLiteral(
"serviceType" ) ].toString() );
113 dsUri.
setParam( QStringLiteral(
"url" ), parts.value( parts.contains( QStringLiteral(
"path" ) ) ? QStringLiteral(
"path" ) : QStringLiteral(
"url" ) ).toString() );
115 if ( parts.contains( QStringLiteral(
"zmin" ) ) )
116 dsUri.
setParam( QStringLiteral(
"zmin" ), parts[ QStringLiteral(
"zmin" ) ].toString() );
117 if ( parts.contains( QStringLiteral(
"zmax" ) ) )
118 dsUri.
setParam( QStringLiteral(
"zmax" ), parts[ QStringLiteral(
"zmax" ) ].toString() );
122 if ( parts.contains( QStringLiteral(
"styleUrl" ) ) )
123 dsUri.
setParam( QStringLiteral(
"styleUrl" ), parts[ QStringLiteral(
"styleUrl" ) ].toString() );
125 if ( parts.contains( QStringLiteral(
"authcfg" ) ) )
126 dsUri.
setAuthConfigId( parts[ QStringLiteral(
"authcfg" ) ].toString() );
131QList<QgsMapLayerType> QgsVectorTileProviderMetadata::supportedLayerTypes()
const
The QgsAbstractProviderConnection provides an interface for data provider connections.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
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.
QgsHttpHeaders httpHeaders() const
Returns http headers.
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.
@ VectorTileLayer
Vector tile layer. Added in QGIS 3.14.