42 , mTransformContext( options.transformContext )
56 void QgsVectorTileLayer::setDataSourcePrivate(
const QString &dataSource,
const QString &baseName,
const QString &,
const QgsDataProvider::ProviderOptions &, QgsDataProvider::ReadFlags )
60 mDataProvider.reset();
65 bool QgsVectorTileLayer::loadDataSource()
72 mSourceType = dsUri.
param( QStringLiteral(
"type" ) );
73 mSourcePath = dsUri.
param( QStringLiteral(
"url" ) );
74 if ( mSourceType == QLatin1String(
"xyz" ) && dsUri.
param( QStringLiteral(
"serviceType" ) ) == QLatin1String(
"arcgis" ) )
76 if ( !setupArcgisVectorTileServiceConnection( mSourcePath, dsUri ) )
79 else if ( mSourceType == QLatin1String(
"xyz" ) )
83 QgsDebugMsg( QStringLiteral(
"Invalid format of URL for XYZ source: " ) + mSourcePath );
89 if ( dsUri.
hasParam( QStringLiteral(
"zmin" ) ) )
90 zMin = dsUri.
param( QStringLiteral(
"zmin" ) ).toInt();
93 if ( dsUri.
hasParam( QStringLiteral(
"zmax" ) ) )
94 zMax = dsUri.
param( QStringLiteral(
"zmax" ) ).toInt();
97 setExtent(
QgsRectangle( -20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892 ) );
99 else if ( mSourceType == QLatin1String(
"mbtiles" ) )
102 if ( !reader.open() )
104 QgsDebugMsg( QStringLiteral(
"failed to open MBTiles file: " ) + mSourcePath );
108 const QString format = reader.metadataValue( QStringLiteral(
"format" ) );
109 if ( format != QLatin1String(
"pbf" ) )
111 QgsDebugMsg( QStringLiteral(
"Cannot open MBTiles for vector tiles. Format = " ) + format );
115 QgsDebugMsgLevel( QStringLiteral(
"name: " ) + reader.metadataValue( QStringLiteral(
"name" ) ), 2 );
116 bool minZoomOk, maxZoomOk;
117 const int minZoom = reader.metadataValue( QStringLiteral(
"minzoom" ) ).toInt( &minZoomOk );
118 const int maxZoom = reader.metadataValue( QStringLiteral(
"maxzoom" ) ).toInt( &maxZoomOk );
128 ct.setBallparkTransformsAreAppropriate(
true );
129 r = ct.transformBoundingBox( r );
134 QgsDebugMsg( QStringLiteral(
"Unknown source type: " ) + mSourceType );
139 const QgsDataProvider::ReadFlags
flags;
140 mDataProvider.reset(
new QgsVectorTileDataProvider( providerOptions,
flags ) );
146 bool QgsVectorTileLayer::setupArcgisVectorTileServiceConnection(
const QString &uri,
const QgsDataSourceUri &dataSourceUri )
152 query.addQueryItem( QStringLiteral(
"f" ), QStringLiteral(
"pjson" ) );
153 url.setQuery( query );
155 QNetworkRequest request = QNetworkRequest( url );
160 switch ( networkRequest.get( request ) )
172 const QByteArray raw = content.
content();
176 const QJsonDocument doc = QJsonDocument::fromJson( raw, &err );
181 mArcgisLayerConfiguration = doc.object().toVariantMap();
182 if ( mArcgisLayerConfiguration.contains( QStringLiteral(
"error" ) ) )
187 mArcgisLayerConfiguration.insert( QStringLiteral(
"serviceUri" ), uri );
188 mSourcePath = uri +
'/' + mArcgisLayerConfiguration.value( QStringLiteral(
"tiles" ) ).toList().value( 0 ).toString();
191 QgsDebugMsg( QStringLiteral(
"Invalid format of URL for XYZ source: " ) + mSourcePath );
199 if ( dataSourceUri.
hasParam( QStringLiteral(
"zmin" ) ) )
202 if ( dataSourceUri.
hasParam( QStringLiteral(
"zmax" ) ) )
205 const QVariantMap fullExtent = mArcgisLayerConfiguration.value( QStringLiteral(
"fullExtent" ) ).toMap();
206 if ( !fullExtent.isEmpty() )
209 fullExtent.value( QStringLiteral(
"xmin" ) ).toDouble(),
210 fullExtent.value( QStringLiteral(
"ymin" ) ).toDouble(),
211 fullExtent.value( QStringLiteral(
"xmax" ) ).toDouble(),
212 fullExtent.value( QStringLiteral(
"ymax" ) ).toDouble()
219 setExtent( extentTransform.transformBoundingBox( fullExtentRect ) );
223 QgsDebugMsg( QStringLiteral(
"Could not transform layer fullExtent to layer CRS" ) );
232 setExtent( extentTransform.transformBoundingBox(
QgsRectangle( -20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892 ) ) );
236 QgsDebugMsg( QStringLiteral(
"Could not transform layer extent to layer CRS" ) );
256 return mDataProvider.get();
261 return mDataProvider.get();
273 const QDomElement matrixSetElement = layerNode.firstChildElement( QStringLiteral(
"matrixSet" ) );
274 if ( !matrixSetElement.isNull() )
276 mMatrixSet.
readXml( matrixSetElement, context );
290 QDomElement mapLayerNode = layerNode.toElement();
293 mapLayerNode.appendChild( mMatrixSet.
writeXml( doc, context ) );
298 QDomElement provider = doc.createElement( QStringLiteral(
"provider" ) );
299 const QDomText providerText = doc.createTextNode(
providerType() );
300 provider.appendChild( providerText );
301 mapLayerNode.appendChild( provider );
312 const QDomElement elem = node.toElement();
316 const QDomElement elemRenderer = elem.firstChildElement( QStringLiteral(
"renderer" ) );
317 if ( elemRenderer.isNull() )
319 errorMessage = tr(
"Missing <renderer> tag" );
322 const QString rendererType = elemRenderer.attribute( QStringLiteral(
"type" ) );
327 if ( rendererType == QLatin1String(
"basic" ) )
331 errorMessage = tr(
"Unknown renderer type: " ) + rendererType;
335 r->
readXml( elemRenderer, context );
339 if ( categories.testFlag(
Labeling ) )
342 const QDomElement elemLabeling = elem.firstChildElement( QStringLiteral(
"labeling" ) );
343 if ( !elemLabeling.isNull() )
345 const QString labelingType = elemLabeling.attribute( QStringLiteral(
"type" ) );
347 if ( labelingType == QLatin1String(
"basic" ) )
351 errorMessage = tr(
"Unknown labeling type: " ) + rendererType;
365 const QDomNode blendModeNode = node.namedItem( QStringLiteral(
"blendMode" ) );
366 if ( !blendModeNode.isNull() )
368 const QDomElement e = blendModeNode.toElement();
376 const QDomNode layerOpacityNode = node.namedItem( QStringLiteral(
"layerOpacity" ) );
377 if ( !layerOpacityNode.isNull() )
379 const QDomElement e = layerOpacityNode.toElement();
389 Q_UNUSED( errorMessage )
390 QDomElement elem = node.toElement();
396 QDomElement elemRenderer = doc.createElement( QStringLiteral(
"renderer" ) );
397 elemRenderer.setAttribute( QStringLiteral(
"type" ), mRenderer->type() );
400 mRenderer->writeXml( elemRenderer, context );
402 elem.appendChild( elemRenderer );
405 if ( mLabeling && categories.testFlag(
Labeling ) )
407 QDomElement elemLabeling = doc.createElement( QStringLiteral(
"labeling" ) );
408 elemLabeling.setAttribute( QStringLiteral(
"type" ), mLabeling->type() );
409 mLabeling->writeXml( elemLabeling, context );
410 elem.appendChild( elemLabeling );
416 QDomElement blendModeElem = doc.createElement( QStringLiteral(
"blendMode" ) );
418 blendModeElem.appendChild( blendModeText );
419 node.appendChild( blendModeElem );
425 QDomElement layerOpacityElem = doc.createElement( QStringLiteral(
"layerOpacity" ) );
426 const QDomText layerOpacityText = doc.createTextNode( QString::number(
opacity() ) );
427 layerOpacityElem.appendChild( layerOpacityText );
428 node.appendChild( layerOpacityElem );
446 QStringList warnings;
457 if ( !dsUri.
param( QStringLiteral(
"styleUrl" ) ).isEmpty() )
459 styleUrl = dsUri.
param( QStringLiteral(
"styleUrl" ) );
461 else if ( mSourceType == QLatin1String(
"xyz" ) && dsUri.
param( QStringLiteral(
"serviceType" ) ) == QLatin1String(
"arcgis" ) )
464 styleUrl = mArcgisLayerConfiguration.value( QStringLiteral(
"serviceUri" ) ).toString()
465 +
'/' + mArcgisLayerConfiguration.value( QStringLiteral(
"defaultStyles" ) ).toString();
468 if ( !styleUrl.isEmpty() )
470 QNetworkRequest request = QNetworkRequest( QUrl( styleUrl ) );
475 switch ( networkRequest.
get( request ) )
483 error = QObject::tr(
"Error retrieving default style" );
497 if ( styleDefinition.contains( QStringLiteral(
"sprite" ) ) )
500 QString spriteUriBase;
501 if ( styleDefinition.value( QStringLiteral(
"sprite" ) ).toString().startsWith( QLatin1String(
"http" ) ) )
503 spriteUriBase = styleDefinition.value( QStringLiteral(
"sprite" ) ).toString();
507 spriteUriBase = styleUrl +
'/' + styleDefinition.value( QStringLiteral(
"sprite" ) ).toString();
510 for (
int resolution = 2; resolution > 0; resolution-- )
512 QUrl spriteUrl = QUrl( spriteUriBase );
513 spriteUrl.setPath( spriteUrl.path() + QStringLiteral(
"%1.json" ).arg( resolution > 1 ? QStringLiteral(
"@%1x" ).arg( resolution ) : QString() ) );
514 QNetworkRequest request = QNetworkRequest( spriteUrl );
517 switch ( networkRequest.
get( request ) )
525 QUrl spriteUrl = QUrl( spriteUriBase );
526 spriteUrl.setPath( spriteUrl.path() + QStringLiteral(
"%1.png" ).arg( resolution > 1 ? QStringLiteral(
"@%1x" ).arg( resolution ) : QString() ) );
527 QNetworkRequest request = QNetworkRequest( spriteUrl );
530 switch ( networkRequest.
get( request ) )
535 const QImage spriteImage( QImage::fromData( imageContent.
content() ) );
536 context.
setSprites( spriteImage, spriteDefinition );
575 bool resultFlag =
false;
585 if ( mSourceType == QLatin1String(
"xyz" ) && dsUri.
param( QStringLiteral(
"serviceType" ) ) == QLatin1String(
"arcgis" ) )
589 metadata.
setIdentifier( mArcgisLayerConfiguration.value( QStringLiteral(
"serviceUri" ) ).toString() );
590 const QString parentIdentifier = mArcgisLayerConfiguration.value( QStringLiteral(
"serviceItemId" ) ).toString();
591 if ( !parentIdentifier.isEmpty() )
596 metadata.
setTitle( mArcgisLayerConfiguration.value( QStringLiteral(
"name" ) ).toString() );
597 const QString copyright = mArcgisLayerConfiguration.value( QStringLiteral(
"copyrightText" ) ).toString();
598 if ( !copyright.isEmpty() )
625 if ( sourceUrl.isLocalFile() )
630 dsUri.
setParam( QStringLiteral(
"url" ), QUrl::fromLocalFile( relSrcUrl ).toString() );
634 else if (
sourceType == QLatin1String(
"mbtiles" ) )
657 if ( sourceUrl.isLocalFile() )
661 dsUri.
setParam( QStringLiteral(
"url" ), QUrl::fromLocalFile( absSrcUrl ).toString() );
665 else if (
sourceType == QLatin1String(
"mbtiles" ) )
680 QString info = QStringLiteral(
"<html><head></head>\n<body>\n" );
684 info += QStringLiteral(
"<h1>" ) + tr(
"Information from provider" ) + QStringLiteral(
"</h1>\n<hr>\n" ) %
685 QStringLiteral(
"<table class=\"list-view\">\n" );
687 info += QStringLiteral(
"<tr><td class=\"highlight\">" ) % tr(
"Source type" ) % QStringLiteral(
"</td><td>" ) %
sourceType() % QStringLiteral(
"</td></tr>\n" );
689 info += QStringLiteral(
"<tr><td class=\"highlight\">" ) % tr(
"Zoom levels" ) % QStringLiteral(
"</td><td>" ) % QStringLiteral(
"%1 - %2" ).arg(
sourceMinZoom() ).arg(
sourceMaxZoom() ) % QStringLiteral(
"</td></tr>\n" );
691 info += QLatin1String(
"</table>\n<br>" );
697 info += QStringLiteral(
"<h1>" ) % tr(
"Identification" ) % QStringLiteral(
"</h1>\n<hr>\n" ) %
699 QStringLiteral(
"<br>\n" ) %
702 QStringLiteral(
"<h1>" ) % tr(
"Extent" ) % QStringLiteral(
"</h1>\n<hr>\n" ) %
704 QStringLiteral(
"<br>\n" ) %
707 QStringLiteral(
"<h1>" ) % tr(
"Access" ) % QStringLiteral(
"</h1>\n<hr>\n" ) %
709 QStringLiteral(
"<br>\n" ) %
713 QStringLiteral(
"<h1>" ) % tr(
"Contacts" ) % QStringLiteral(
"</h1>\n<hr>\n" ) %
715 QStringLiteral(
"<br><br>\n" ) %
718 QStringLiteral(
"<h1>" ) % tr(
"References" ) % QStringLiteral(
"</h1>\n<hr>\n" ) %
720 QStringLiteral(
"<br>\n" ) %
723 QStringLiteral(
"<h1>" ) % tr(
"History" ) % QStringLiteral(
"</h1>\n<hr>\n" ) %
725 QStringLiteral(
"<br>\n" ) %
727 QStringLiteral(
"\n</body>\n</html>\n" );
741 headers [QStringLiteral(
"referer" ) ] = dsUri.
param( QStringLiteral(
"referer" ) );
744 if ( rawTiles.isEmpty() )
746 return rawTiles.first().data;
751 mRenderer.reset( r );
757 return mRenderer.get();
768 return mLabeling.get();
777 QgsVectorTileDataProvider::QgsVectorTileDataProvider(
778 const ProviderOptions &options,
779 QgsDataProvider::ReadFlags flags )
788 QString QgsVectorTileDataProvider::name()
const
790 return QStringLiteral(
"vectortile" );
793 QString QgsVectorTileDataProvider::description()
const
803 bool QgsVectorTileDataProvider::isValid()
const
static QgsCoordinateReferenceSystem convertSpatialReference(const QVariantMap &spatialReferenceMap)
Converts a spatial reference JSON definition to a QgsCoordinateReferenceSystem value.
A thread safe class for performing blocking (sync) network requests, with full support for QGIS proxy...
ErrorCode get(QNetworkRequest &request, bool forceRefresh=false, QgsFeedback *feedback=nullptr)
Performs a "get" operation on the specified request.
@ NetworkError
A network error occurred.
@ ServerExceptionError
An exception was raised by the server.
@ NoError
No error was encountered.
@ TimeoutError
Timeout was reached before a reply was received.
QgsNetworkReplyContent reply() const
Returns the content of the network reply, after a get() or post() request has been made.
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Custom exception class for Coordinate Reference System related exceptions.
Abstract base class for spatial data provider implementations.
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.
int removeParam(const QString &key)
Removes a generic parameter by key.
void setEncodedUri(const QByteArray &uri)
Sets the complete encoded 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.
static QVariant parseJson(const std::string &jsonString)
Converts JSON jsonString to a QVariant, in case of parsing error an invalid QVariant is returned and ...
Context for a MapBox GL style conversion operation.
void setPixelSizeConversionFactor(double sizeConversionFactor)
Sets the pixel size conversion factor, used to scale the original pixel sizes when converting styles.
void setSprites(const QImage &image, const QVariantMap &definitions)
Sets the sprite image and definitions JSON to use during conversion.
void setTargetUnit(QgsUnitTypes::RenderUnit targetUnit)
Sets the target unit type.
QVariantMap spriteDefinitions() const
Returns the sprite definitions to use during conversion.
Handles conversion of MapBox GL styles to QGIS vector tile renderers and labeling settings.
QgsVectorTileRenderer * renderer() const
Returns a new instance of a vector tile renderer representing the converted style,...
QgsVectorTileLabeling * labeling() const
Returns a new instance of a vector tile labeling representing the converted style,...
Result convert(const QVariantMap &style, QgsMapBoxGlStyleConversionContext *context=nullptr)
Converts a JSON style map, and returns the resultant status of the conversion.
@ Success
Conversion was successful.
QString errorMessage() const
Returns a descriptive error message if an error was encountered during the style conversion,...
QStringList warnings() const
Returns a list of user-friendly warnings generated during the conversion, e.g.
static QString typeToString(QgsMapLayerType type)
Converts a map layer type to a string value.
Base class for utility classes that encapsulate information necessary for rendering of map layers.
Base class for all map layer types.
void readStyleManager(const QDomNode &layerNode)
Read style manager's configuration (if any). To be called by subclasses.
void writeStyleManager(QDomNode &layerNode, QDomDocument &doc) const
Write style manager's configuration (if exists). To be called by subclasses.
QString source() const
Returns the source for the layer.
QString providerType() const
Returns the provider type (provider key) for this layer.
void setBlendMode(QPainter::CompositionMode blendMode)
Set the blending mode used for rendering a layer.
QgsMapLayer::LayerFlags flags() const
Returns the flags for this layer.
QgsCoordinateReferenceSystem crs
virtual QString loadDefaultStyle(bool &resultFlag)
Retrieve the default style for this layer if one exists (either as a .qml file on disk or as a record...
QString mLayerName
Name of the layer - used for display.
void triggerRepaint(bool deferredUpdate=false)
Will advise the map canvas (and any other interested party) that this layer requires to be repainted.
QString crsHtmlMetadata() const
Returns a HTML fragment containing the layer's CRS metadata, for use in the htmlMetadata() method.
QgsLayerMetadata metadata
QPainter::CompositionMode blendMode() const
Returns the current blending mode for a layer.
virtual void setOpacity(double opacity)
Sets the opacity for the layer, where opacity is a value between 0 (totally transparent) and 1....
virtual void setMetadata(const QgsLayerMetadata &metadata)
Sets the layer's metadata store.
QString mProviderKey
Data provider key (name of the data provider)
QgsCoordinateTransformContext transformContext() const
Returns the layer data provider coordinate transform context or a default transform context if the la...
virtual QgsError error() const
Gets current status error.
virtual void setExtent(const QgsRectangle &rect)
Sets the extent.
QString mDataSource
Data source description string, varies by layer type.
virtual QString loadDefaultMetadata(bool &resultFlag)
Retrieve the default metadata for this layer if one exists (either as a .qmd file on disk or as a rec...
void setValid(bool valid)
Sets whether layer is valid or not.
void readCommonStyle(const QDomElement &layerElement, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories)
Read style data common to all layer types.
@ Rendering
Rendering: scale visibility, simplify method, opacity.
QString generalHtmlMetadata() const
Returns an HTML fragment containing general metadata information, for use in the htmlMetadata() metho...
void writeCommonStyle(QDomElement &layerElement, QDomDocument &document, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const
Write style data common to all layer types.
void invalidateWgs84Extent()
Invalidates the WGS84 extent.
void setCrs(const QgsCoordinateReferenceSystem &srs, bool emitSignal=true)
Sets layer's spatial reference system.
Utility class for reading and writing MBTiles files (which are SQLite3 databases).
Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between...
QByteArray content() const
Returns the reply content.
static QgsPainting::BlendMode getBlendModeEnum(QPainter::CompositionMode blendMode)
Returns a BlendMode corresponding to a QPainter::CompositionMode.
static QPainter::CompositionMode getCompositionMode(QgsPainting::BlendMode blendMode)
Returns a QPainter::CompositionMode corresponding to a BlendMode.
BlendMode
Blending modes enum defining the available composition modes that can be used when rendering a layer.
QString writePath(const QString &filename) const
Prepare a filename to save it to the project file.
QString readPath(const QString &filename) const
Turn filename read from the project file to an absolute path.
The class is used as a container of context for various read/write operations on other objects.
const QgsPathResolver & pathResolver() const
Returns path resolver for conversion between relative and absolute paths.
A rectangle specified with double values.
Contains information about the context of a rendering operation.
virtual QDomElement writeXml(QDomDocument &document, const QgsReadWriteContext &context) const
Writes the set to an XML element.
QgsCoordinateReferenceSystem crs() const
Returns the coordinate reference system associated with the tiles.
int minimumZoom() const
Returns the minimum zoom level for tiles present in the set.
int maximumZoom() const
Returns the maximum zoom level for tiles present in the set.
QgsTileMatrix tileMatrix(int zoom) const
Returns the tile matrix corresponding to the specified zoom.
virtual bool readXml(const QDomElement &element, QgsReadWriteContext &context)
Reads the set from an XML element.
void dropMatricesOutsideZoomRange(int minimumZoom, int maximumZoom)
Deletes any existing matrices which fall outside the zoom range specified by minimumZoom to maximumZo...
Defines a matrix of tiles for a single zoom level: it is defined by its size (width *.
Range of tiles in a tile matrix to be rendered.
Stores coordinates of a tile in a tile matrix set.
int zoomLevel() const
Returns tile's zoom level (Z)
int column() const
Returns tile's column index (X)
int row() const
Returns tile's row index (Y)
@ RenderMillimeters
Millimeters.
Basic labeling configuration for vector tile layers.
The default vector tile renderer implementation.
static QList< QgsVectorTileBasicRendererStyle > simpleStyleWithRandomColors()
Returns a list of styles to render all layers, using random colors.
Base class for labeling configuration classes for vector tile layers.
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads labeling properties from given XML element.
This class provides map rendering functionality for vector tile layers.
Implements a map layer that is dedicated to rendering of vector tiles.
QgsVectorTileLayer(const QString &path=QString(), const QString &baseName=QString(), const QgsVectorTileLayer::LayerOptions &options=QgsVectorTileLayer::LayerOptions())
Constructs a new vector tile layer.
QByteArray getRawTile(QgsTileXYZ tileID)
Fetches raw tile data for the give tile coordinates.
bool readXml(const QDomNode &layerNode, QgsReadWriteContext &context) override
Called by readLayerXML(), used by children to read state specific to them from project files.
bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) const override
Write the style for the layer into the document provided.
void setRenderer(QgsVectorTileRenderer *r)
Sets renderer for the map layer.
QString decodedSource(const QString &source, const QString &provider, const QgsReadWriteContext &context) const FINAL
Called by readLayerXML(), used by derived classes to decode provider's specific data source from proj...
QString sourceType() const
Returns type of the data source.
bool writeXml(QDomNode &layerNode, QDomDocument &doc, const QgsReadWriteContext &context) const override
Called by writeLayerXML(), used by children to write state specific to them to project files.
void setLabeling(QgsVectorTileLabeling *labeling)
Sets labeling for the map layer.
QgsVectorTileLabeling * labeling() const
Returns currently assigned labeling.
~QgsVectorTileLayer() override
bool readSymbology(const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context, StyleCategories categories=AllStyleCategories) override
Read the symbology for the current layer from the DOM node supplied.
int sourceMinZoom() const
Returns minimum zoom level at which source has any valid tiles (negative = unconstrained)
QgsMapLayerRenderer * createMapRenderer(QgsRenderContext &rendererContext) override
Returns new instance of QgsMapLayerRenderer that will be used for rendering of given context.
QString loadDefaultStyle(bool &resultFlag) override
Retrieve the default style for this layer if one exists (either as a .qml file on disk or as a record...
QString htmlMetadata() const override
Obtain a formatted HTML string containing assorted metadata for this layer.
QString encodedSource(const QString &source, const QgsReadWriteContext &context) const FINAL
Called by writeLayerXML(), used by derived classes to encode provider's specific data source to proje...
int sourceMaxZoom() const
Returns maximum zoom level at which source has any valid tiles (negative = unconstrained)
QgsVectorTileRenderer * renderer() const
Returns currently assigned renderer.
QgsDataProvider * dataProvider() override
Returns the layer's data provider, it may be nullptr.
QString loadDefaultMetadata(bool &resultFlag) override
Retrieve the default metadata for this layer if one exists (either as a .qmd file on disk or as a rec...
QString sourcePath() const
Returns URL/path of the data source (syntax different to each data source type)
void setTransformContext(const QgsCoordinateTransformContext &transformContext) override
Sets the coordinate transform context to transformContext.
QgsVectorTileLayer * clone() const override
Returns a new instance equivalent to this one except for the id which is still unique.
static QList< QgsVectorTileRawData > blockingFetchTileRawData(const QString &sourceType, const QString &sourcePath, const QgsTileMatrix &tileMatrix, const QPointF &viewCenter, const QgsTileRange &range, const QString &authid, const QgsHttpHeaders &headers, QgsFeedback *feedback=nullptr)
Returns raw tile data for the specified range of tiles. Blocks the caller until all tiles are fetched...
bool fromEsriJson(const QVariantMap &json)
Initializes the tile structure settings from an ESRI REST VectorTileService json map.
static QgsVectorTileMatrixSet fromWebMercator(int minimumZoom=0, int maximumZoom=14)
Returns a vector tile structure corresponding to the standard web mercator/GoogleCRS84Quad setup.
Abstract base class for all vector tile renderer implementations.
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads renderer's properties from given XML element.
static bool checkXYZUrlTemplate(const QString &url)
Checks whether the URL template string is correct (contains {x}, {y} / {-y}, {z} placeholders)
QgsMapLayerType
Types of layers that can be added to a map.
@ VectorTileLayer
Vector tile layer. Added in QGIS 3.14.
#define QgsDebugMsgLevel(str, level)
#define QgsSetRequestInitiatorClass(request, _class)
const QgsCoordinateReferenceSystem & crs
Setting options for creating vector data providers.
Setting options for loading vector tile layers.