QGIS API Documentation 3.37.0-Master (684a802617f)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
QgsVectorTileBasicRenderer Class Reference

The default vector tile renderer implementation. More...

#include <qgsvectortilebasicrenderer.h>

Inheritance diagram for QgsVectorTileBasicRenderer:
Inheritance graph
[legend]

Public Member Functions

 QgsVectorTileBasicRenderer ()
 Constructs renderer with no styles.
 
QgsVectorTileBasicRendererclone () const override
 Returns a clone of the renderer.
 
void readXml (const QDomElement &elem, const QgsReadWriteContext &context) override
 Reads renderer's properties from given XML element.
 
void renderBackground (QgsRenderContext &context) override
 Renders the background if defined.
 
void renderSelectedFeatures (const QList< QgsFeature > &selection, QgsRenderContext &context) override
 Renders the specified features in a selected state.
 
void renderTile (const QgsVectorTileRendererData &tile, QgsRenderContext &context) override
 Renders given vector tile. Must be called between startRender/stopRender.
 
QSet< QString > requiredLayers (QgsRenderContext &context, int tileZoom) const override
 Returns a list of the layers required for rendering.
 
void setStyle (int index, const QgsVectorTileBasicRendererStyle &style)
 Updates style definition at the paricular index of the list (the index must be in interval [0,N-1] otherwise this function does nothing)
 
void setStyles (const QList< QgsVectorTileBasicRendererStyle > &styles)
 Sets list of styles of the renderer.
 
void startRender (QgsRenderContext &context, int tileZoom, const QgsTileRange &tileRange) override
 Initializes rendering. It should be paired with a stopRender() call.
 
void stopRender (QgsRenderContext &context) override
 Finishes rendering and cleans up any resources.
 
QgsVectorTileBasicRendererStyle style (int index) const
 Returns style definition at the particular index.
 
QList< QgsVectorTileBasicRendererStylestyles () const
 Returns list of styles of the renderer.
 
QString type () const override
 Returns unique type name of the renderer implementation.
 
QMap< QString, QSet< QString > > usedAttributes (const QgsRenderContext &) override
 Returns field names of sub-layers that will be used for rendering. Must be called between startRender/stopRender.
 
bool willRenderFeature (const QgsFeature &feature, int tileZoom, const QString &layerName, QgsRenderContext &context) override
 Returns true if the specified feature will be rendered in the given render context.
 
void writeXml (QDomElement &elem, const QgsReadWriteContext &context) const override
 Writes renderer's properties to given XML element.
 
- Public Member Functions inherited from QgsVectorTileRenderer
virtual ~QgsVectorTileRenderer ()=default
 
virtual void resolveReferences (const QgsProject &project)
 Resolves references to other objects - second phase of loading - after readXml()
 

Static Public Member Functions

static QList< QgsVectorTileBasicRendererStylesimpleStyle (const QColor &polygonFillColor, const QColor &polygonStrokeColor, double polygonStrokeWidth, const QColor &lineStrokeColor, double lineStrokeWidth, const QColor &pointFillColor, const QColor &pointStrokeColor, double pointSize)
 Returns a list of styles to render all layers with the given fill/stroke colors, stroke widths and marker sizes.
 
static QList< QgsVectorTileBasicRendererStylesimpleStyleWithRandomColors ()
 Returns a list of styles to render all layers, using random colors.
 

Detailed Description

The default vector tile renderer implementation.

It has an ordered list of "styles", each defines a rendering rule.

Since
QGIS 3.14

Definition at line 169 of file qgsvectortilebasicrenderer.h.

Constructor & Destructor Documentation

◆ QgsVectorTileBasicRenderer()

QgsVectorTileBasicRenderer::QgsVectorTileBasicRenderer ( )

Constructs renderer with no styles.

Definition at line 103 of file qgsvectortilebasicrenderer.cpp.

Member Function Documentation

◆ clone()

QgsVectorTileBasicRenderer * QgsVectorTileBasicRenderer::clone ( ) const
overridevirtual

Returns a clone of the renderer.

Implements QgsVectorTileRenderer.

Definition at line 112 of file qgsvectortilebasicrenderer.cpp.

◆ readXml()

void QgsVectorTileBasicRenderer::readXml ( const QDomElement &  elem,
const QgsReadWriteContext context 
)
overridevirtual

Reads renderer's properties from given XML element.

Implements QgsVectorTileRenderer.

Definition at line 411 of file qgsvectortilebasicrenderer.cpp.

◆ renderBackground()

void QgsVectorTileBasicRenderer::renderBackground ( QgsRenderContext context)
overridevirtual

Renders the background if defined.

Implements QgsVectorTileRenderer.

Definition at line 165 of file qgsvectortilebasicrenderer.cpp.

◆ renderSelectedFeatures()

void QgsVectorTileBasicRenderer::renderSelectedFeatures ( const QList< QgsFeature > &  selection,
QgsRenderContext context 
)
overridevirtual

Renders the specified features in a selected state.

This will be called after rendering the tiles, so that the selected features are always visible on the top of the layer.

Since
QGIS 3.28

Implements QgsVectorTileRenderer.

Definition at line 285 of file qgsvectortilebasicrenderer.cpp.

◆ renderTile()

void QgsVectorTileBasicRenderer::renderTile ( const QgsVectorTileRendererData tile,
QgsRenderContext context 
)
overridevirtual

Renders given vector tile. Must be called between startRender/stopRender.

Implements QgsVectorTileRenderer.

Definition at line 193 of file qgsvectortilebasicrenderer.cpp.

◆ requiredLayers()

QSet< QString > QgsVectorTileBasicRenderer::requiredLayers ( QgsRenderContext context,
int  tileZoom 
) const
overridevirtual

Returns a list of the layers required for rendering.

Only layers which are visible at the specified tileZoom should be included in this list.

An empty string present in the list indicates that all layer in the tiles are required.

Since
QGIS 3.16

Reimplemented from QgsVectorTileRenderer.

Definition at line 147 of file qgsvectortilebasicrenderer.cpp.

◆ setStyle()

void QgsVectorTileBasicRenderer::setStyle ( int  index,
const QgsVectorTileBasicRendererStyle style 
)
inline

Updates style definition at the paricular index of the list (the index must be in interval [0,N-1] otherwise this function does nothing)

Definition at line 193 of file qgsvectortilebasicrenderer.h.

◆ setStyles()

void QgsVectorTileBasicRenderer::setStyles ( const QList< QgsVectorTileBasicRendererStyle > &  styles)

Sets list of styles of the renderer.

Definition at line 426 of file qgsvectortilebasicrenderer.cpp.

◆ simpleStyle()

QList< QgsVectorTileBasicRendererStyle > QgsVectorTileBasicRenderer::simpleStyle ( const QColor &  polygonFillColor,
const QColor &  polygonStrokeColor,
double  polygonStrokeWidth,
const QColor &  lineStrokeColor,
double  lineStrokeWidth,
const QColor &  pointFillColor,
const QColor &  pointStrokeColor,
double  pointSize 
)
static

Returns a list of styles to render all layers with the given fill/stroke colors, stroke widths and marker sizes.

Definition at line 456 of file qgsvectortilebasicrenderer.cpp.

◆ simpleStyleWithRandomColors()

QList< QgsVectorTileBasicRendererStyle > QgsVectorTileBasicRenderer::simpleStyleWithRandomColors ( )
static

Returns a list of styles to render all layers, using random colors.

Definition at line 436 of file qgsvectortilebasicrenderer.cpp.

◆ startRender()

void QgsVectorTileBasicRenderer::startRender ( QgsRenderContext context,
int  tileZoom,
const QgsTileRange tileRange 
)
overridevirtual

Initializes rendering. It should be paired with a stopRender() call.

Implements QgsVectorTileRenderer.

Definition at line 120 of file qgsvectortilebasicrenderer.cpp.

◆ stopRender()

void QgsVectorTileBasicRenderer::stopRender ( QgsRenderContext context)
overridevirtual

Finishes rendering and cleans up any resources.

Implements QgsVectorTileRenderer.

Definition at line 160 of file qgsvectortilebasicrenderer.cpp.

◆ style()

QgsVectorTileBasicRendererStyle QgsVectorTileBasicRenderer::style ( int  index) const
inline

Returns style definition at the particular index.

Definition at line 195 of file qgsvectortilebasicrenderer.h.

◆ styles()

QList< QgsVectorTileBasicRendererStyle > QgsVectorTileBasicRenderer::styles ( ) const

Returns list of styles of the renderer.

Definition at line 431 of file qgsvectortilebasicrenderer.cpp.

◆ type()

QString QgsVectorTileBasicRenderer::type ( ) const
overridevirtual

Returns unique type name of the renderer implementation.

Implements QgsVectorTileRenderer.

Definition at line 107 of file qgsvectortilebasicrenderer.cpp.

◆ usedAttributes()

QMap< QString, QSet< QString > > QgsVectorTileBasicRenderer::usedAttributes ( const QgsRenderContext )
overridevirtual

Returns field names of sub-layers that will be used for rendering. Must be called between startRender/stopRender.

Reimplemented from QgsVectorTileRenderer.

Definition at line 142 of file qgsvectortilebasicrenderer.cpp.

◆ willRenderFeature()

bool QgsVectorTileBasicRenderer::willRenderFeature ( const QgsFeature feature,
int  tileZoom,
const QString &  layerName,
QgsRenderContext context 
)
overridevirtual

Returns true if the specified feature will be rendered in the given render context.

Since
QGIS 3.28

Implements QgsVectorTileRenderer.

Definition at line 353 of file qgsvectortilebasicrenderer.cpp.

◆ writeXml()

void QgsVectorTileBasicRenderer::writeXml ( QDomElement &  elem,
const QgsReadWriteContext context 
) const
overridevirtual

Writes renderer's properties to given XML element.

Implements QgsVectorTileRenderer.

Definition at line 398 of file qgsvectortilebasicrenderer.cpp.


The documentation for this class was generated from the following files: