24 #define PROVIDER_KEY QStringLiteral( "vectortile" )
25 #define PROVIDER_DESCRIPTION QStringLiteral( "Vector tile provider" )
27 QgsVectorTileProviderMetadata::QgsVectorTileProviderMetadata()
32 QIcon QgsVectorTileProviderMetadata::icon()
const
37 QList<QgsDataItemProvider *> QgsVectorTileProviderMetadata::dataItemProviders()
const
39 QList< QgsDataItemProvider * > providers;
40 providers <<
new QgsVectorTileDataItemProvider;
44 QMap<QString, QgsAbstractProviderConnection *> QgsVectorTileProviderMetadata::connections(
bool cached )
46 return connectionsProtected<QgsVectorTileProviderConnection, QgsVectorTileProviderConnection>( cached );
51 return new QgsVectorTileProviderConnection( name );
54 void QgsVectorTileProviderMetadata::deleteConnection(
const QString &name )
56 deleteConnectionProtected<QgsVectorTileProviderConnection>( name );
61 saveConnectionProtected( connection, name );
64 QgsProviderMetadata::ProviderCapabilities QgsVectorTileProviderMetadata::providerCapabilities()
const
69 QVariantMap 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;
107 QString 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() );
131 QList<QgsMapLayerType> QgsVectorTileProviderMetadata::supportedLayerTypes()
const