QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
Public Member Functions | List of all members
QgsTileMatrixSet Class Reference

Defines a set of tile matrices for multiple zoom levels. More...

#include <qgstiles.h>

Inheritance diagram for QgsTileMatrixSet:
Inheritance graph
[legend]

Public Member Functions

virtual ~QgsTileMatrixSet ()=default
 
void addGoogleCrs84QuadTiles (int minimumZoom=0, int maximumZoom=14)
 Adds tile matrices corresponding to the standard web mercator/GoogleCRS84Quad setup. More...
 
void addMatrix (const QgsTileMatrix &matrix)
 Adds a matrix to the set. More...
 
double calculateTileScaleForMap (double actualMapScale, const QgsCoordinateReferenceSystem &mapCrs, const QgsRectangle &mapExtent, const QSize mapSize, const double mapDpi) const
 Calculates the correct scale to use for the tiles when rendered using the specified map properties. More...
 
QgsCoordinateReferenceSystem crs () const
 Returns the coordinate reference system associated with the tiles. More...
 
void dropMatricesOutsideZoomRange (int minimumZoom, int maximumZoom)
 Deletes any existing matrices which fall outside the zoom range specified by minimumZoom to maximumZoom, inclusive. More...
 
bool isEmpty () const
 Returns true if the matrix set is empty. More...
 
int maximumZoom () const
 Returns the maximum zoom level for tiles present in the set. More...
 
int minimumZoom () const
 Returns the minimum zoom level for tiles present in the set. More...
 
virtual bool readXml (const QDomElement &element, QgsReadWriteContext &context)
 Reads the set from an XML element. More...
 
QgsTileMatrix rootMatrix () const
 Returns the root tile matrix (usually corresponding to zoom level 0). More...
 
double scaleForRenderContext (const QgsRenderContext &context) const
 Calculates the correct scale to use for the tiles when rendered using the specified render context. More...
 
Qgis::ScaleToTileZoomLevelMethod scaleToTileZoomMethod () const
 Returns the scale to tile zoom method. More...
 
double scaleToZoom (double scale) const
 Calculates a fractional zoom level given a map scale denominator. More...
 
int scaleToZoomLevel (double scale) const
 Finds the best fitting (integer) zoom level given a map scale denominator. More...
 
void setRootMatrix (const QgsTileMatrix &matrix)
 Sets the root tile matrix (usually corresponding to zoom level 0). More...
 
void setScaleToTileZoomMethod (Qgis::ScaleToTileZoomLevelMethod method)
 Sets the scale to tile zoom method. More...
 
QgsTileMatrix tileMatrix (int zoom) const
 Returns the tile matrix corresponding to the specified zoom. More...
 
virtual QDomElement writeXml (QDomDocument &document, const QgsReadWriteContext &context) const
 Writes the set to an XML element. More...
 

Detailed Description

Defines a set of tile matrices for multiple zoom levels.

Since
QGIS 3.22.6

Definition at line 223 of file qgstiles.h.

Constructor & Destructor Documentation

◆ ~QgsTileMatrixSet()

virtual QgsTileMatrixSet::~QgsTileMatrixSet ( )
virtualdefault

Member Function Documentation

◆ addGoogleCrs84QuadTiles()

void QgsTileMatrixSet::addGoogleCrs84QuadTiles ( int  minimumZoom = 0,
int  maximumZoom = 14 
)

Adds tile matrices corresponding to the standard web mercator/GoogleCRS84Quad setup.

Definition at line 137 of file qgstiles.cpp.

◆ addMatrix()

void QgsTileMatrixSet::addMatrix ( const QgsTileMatrix matrix)

Adds a matrix to the set.

Any existing matrix with the same QgsTileMatrix::zoomLevel() will be replaced.

Definition at line 165 of file qgstiles.cpp.

◆ calculateTileScaleForMap()

double QgsTileMatrixSet::calculateTileScaleForMap ( double  actualMapScale,
const QgsCoordinateReferenceSystem mapCrs,
const QgsRectangle mapExtent,
const QSize  mapSize,
const double  mapDpi 
) const

Calculates the correct scale to use for the tiles when rendered using the specified map properties.

Since
QGIS 3.26

Definition at line 282 of file qgstiles.cpp.

◆ crs()

QgsCoordinateReferenceSystem QgsTileMatrixSet::crs ( ) const

Returns the coordinate reference system associated with the tiles.

In the case of a tile set containing mixed CRS at different zoom levels this method will return the crs of the minimum zoom tile matrix.

Definition at line 207 of file qgstiles.cpp.

◆ dropMatricesOutsideZoomRange()

void QgsTileMatrixSet::dropMatricesOutsideZoomRange ( int  minimumZoom,
int  maximumZoom 
)

Deletes any existing matrices which fall outside the zoom range specified by minimumZoom to maximumZoom, inclusive.

Definition at line 192 of file qgstiles.cpp.

◆ isEmpty()

bool QgsTileMatrixSet::isEmpty ( ) const

Returns true if the matrix set is empty.

Definition at line 132 of file qgstiles.cpp.

◆ maximumZoom()

int QgsTileMatrixSet::maximumZoom ( ) const

Returns the maximum zoom level for tiles present in the set.

See also
minimumZoom()

Definition at line 181 of file qgstiles.cpp.

◆ minimumZoom()

int QgsTileMatrixSet::minimumZoom ( ) const

Returns the minimum zoom level for tiles present in the set.

See also
maximumZoom()

Definition at line 170 of file qgstiles.cpp.

◆ readXml()

bool QgsTileMatrixSet::readXml ( const QDomElement &  element,
QgsReadWriteContext context 
)
virtual

Reads the set from an XML element.

See also
writeXml()

Definition at line 315 of file qgstiles.cpp.

◆ rootMatrix()

QgsTileMatrix QgsTileMatrixSet::rootMatrix ( ) const

Returns the root tile matrix (usually corresponding to zoom level 0).

Since
QGIS 3.28

Definition at line 155 of file qgstiles.cpp.

◆ scaleForRenderContext()

double QgsTileMatrixSet::scaleForRenderContext ( const QgsRenderContext context) const

Calculates the correct scale to use for the tiles when rendered using the specified render context.

Since
QGIS 3.26

Definition at line 273 of file qgstiles.cpp.

◆ scaleToTileZoomMethod()

Qgis::ScaleToTileZoomLevelMethod QgsTileMatrixSet::scaleToTileZoomMethod ( ) const
inline

Returns the scale to tile zoom method.

See also
setScaleToTileZoomMethod()

Definition at line 344 of file qgstiles.h.

◆ scaleToZoom()

double QgsTileMatrixSet::scaleToZoom ( double  scale) const

Calculates a fractional zoom level given a map scale denominator.

The zoom level will be linearly interpolated between zoom levels present in the set.

Definition at line 215 of file qgstiles.cpp.

◆ scaleToZoomLevel()

int QgsTileMatrixSet::scaleToZoomLevel ( double  scale) const

Finds the best fitting (integer) zoom level given a map scale denominator.

Values are constrained to the zoom levels between minimumZoom() and maximumZoom().

Definition at line 257 of file qgstiles.cpp.

◆ setRootMatrix()

void QgsTileMatrixSet::setRootMatrix ( const QgsTileMatrix matrix)

Sets the root tile matrix (usually corresponding to zoom level 0).

Since
QGIS 3.28

Definition at line 160 of file qgstiles.cpp.

◆ setScaleToTileZoomMethod()

void QgsTileMatrixSet::setScaleToTileZoomMethod ( Qgis::ScaleToTileZoomLevelMethod  method)
inline

Sets the scale to tile zoom method.

See also
scaleToTileZoomMethod()

Definition at line 351 of file qgstiles.h.

◆ tileMatrix()

QgsTileMatrix QgsTileMatrixSet::tileMatrix ( int  zoom) const

Returns the tile matrix corresponding to the specified zoom.

Definition at line 150 of file qgstiles.cpp.

◆ writeXml()

QDomElement QgsTileMatrixSet::writeXml ( QDomDocument &  document,
const QgsReadWriteContext context 
) const
virtual

Writes the set to an XML element.

Definition at line 364 of file qgstiles.cpp.


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