QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
Defines a set of tile matrices for multiple zoom levels. More...
#include <qgstiles.h>
Public Member Functions | |
QgsTileMatrixSet () | |
virtual | ~QgsTileMatrixSet ()=default |
void | addGoogleCrs84QuadTiles (int minimumZoom=0, int maximumZoom=14) |
Adds tile matrices corresponding to the standard web mercator/GoogleCRS84Quad setup. | |
void | addMatrix (const QgsTileMatrix &matrix) |
Adds a matrix to the set. | |
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. | |
QgsCoordinateReferenceSystem | crs () const |
Returns the coordinate reference system associated with the tiles. | |
void | dropMatricesOutsideZoomRange (int minimumZoom, int maximumZoom) |
Deletes any existing matrices which fall outside the zoom range specified by minimumZoom to maximumZoom, inclusive. | |
bool | isEmpty () const |
Returns true if the matrix set is empty. | |
int | maximumZoom () const |
Returns the maximum zoom level for tiles present in the set. | |
int | minimumZoom () const |
Returns the minimum zoom level for tiles present in the set. | |
virtual bool | readXml (const QDomElement &element, QgsReadWriteContext &context) |
Reads the set from an XML element. | |
QgsTileMatrix | rootMatrix () const |
Returns the root tile matrix (usually corresponding to zoom level 0). | |
double | scaleForRenderContext (const QgsRenderContext &context) const |
Calculates the correct scale to use for the tiles when rendered using the specified render context. | |
Qgis::ScaleToTileZoomLevelMethod | scaleToTileZoomMethod () const |
Returns the scale to tile zoom method. | |
double | scaleToZoom (double scale) const |
Calculates a fractional zoom level given a map scale denominator. | |
int | scaleToZoomLevel (double scale, bool clamp=true) const |
Finds the best fitting (integer) zoom level given a map scale denominator. | |
void | setRootMatrix (const QgsTileMatrix &matrix) |
Sets the root tile matrix (usually corresponding to zoom level 0). | |
void | setScaleToTileZoomMethod (Qgis::ScaleToTileZoomLevelMethod method) |
Sets the scale to tile zoom method. | |
Qgis::TileAvailability | tileAvailability (QgsTileXYZ id) const |
Returns the availability of the given tile in this matrix. | |
QgsTileMatrix | tileMatrix (int zoom) const |
Returns the tile matrix corresponding to the specified zoom. | |
QVector< QgsTileXYZ > | tilesInRange (QgsTileRange range, int zoomLevel) const |
Returns a list of tiles in the given tile range. | |
virtual QDomElement | writeXml (QDomDocument &document, const QgsReadWriteContext &context) const |
Writes the set to an XML element. | |
Protected Attributes | |
QgsTileMatrix | mRootMatrix |
Qgis::ScaleToTileZoomLevelMethod | mScaleToTileZoomMethod = Qgis::ScaleToTileZoomLevelMethod::MapBox |
std::function< Qgis::TileAvailability(QgsTileXYZ id) > | mTileAvailabilityFunction |
QMap< int, QgsTileMatrix > | mTileMatrices |
std::function< Qgis::TileAvailability(QgsTileXYZ id, QgsTileXYZ &replacement) > | mTileReplacementFunction |
Defines a set of tile matrices for multiple zoom levels.
Definition at line 249 of file qgstiles.h.
QgsTileMatrixSet::QgsTileMatrixSet | ( | ) |
Definition at line 132 of file qgstiles.cpp.
|
virtualdefault |
void QgsTileMatrixSet::addGoogleCrs84QuadTiles | ( | int | minimumZoom = 0 , |
int | maximumZoom = 14 |
||
) |
Adds tile matrices corresponding to the standard web mercator/GoogleCRS84Quad setup.
Definition at line 143 of file qgstiles.cpp.
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 171 of file qgstiles.cpp.
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.
Definition at line 308 of file qgstiles.cpp.
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 218 of file qgstiles.cpp.
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 198 of file qgstiles.cpp.
bool QgsTileMatrixSet::isEmpty | ( | ) | const |
Returns true
if the matrix set is empty.
Definition at line 138 of file qgstiles.cpp.
int QgsTileMatrixSet::maximumZoom | ( | ) | const |
Returns the maximum zoom level for tiles present in the set.
Definition at line 187 of file qgstiles.cpp.
int QgsTileMatrixSet::minimumZoom | ( | ) | const |
Returns the minimum zoom level for tiles present in the set.
Definition at line 176 of file qgstiles.cpp.
|
virtual |
QgsTileMatrix QgsTileMatrixSet::rootMatrix | ( | ) | const |
Returns the root tile matrix (usually corresponding to zoom level 0).
Definition at line 161 of file qgstiles.cpp.
double QgsTileMatrixSet::scaleForRenderContext | ( | const QgsRenderContext & | context | ) | const |
Calculates the correct scale to use for the tiles when rendered using the specified render context.
Definition at line 299 of file qgstiles.cpp.
|
inline |
Returns the scale to tile zoom method.
Definition at line 387 of file qgstiles.h.
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 226 of file qgstiles.cpp.
int QgsTileMatrixSet::scaleToZoomLevel | ( | double | scale, |
bool | clamp = true |
||
) | const |
Finds the best fitting (integer) zoom level given a map scale denominator.
An optional clamp parameter can be set to false
to disable clamping zoom level to the tile matrix set's minimum and maximum zoom level.
Values are constrained to the zoom levels between minimumZoom() and maximumZoom().
Definition at line 283 of file qgstiles.cpp.
void QgsTileMatrixSet::setRootMatrix | ( | const QgsTileMatrix & | matrix | ) |
Sets the root tile matrix (usually corresponding to zoom level 0).
Definition at line 166 of file qgstiles.cpp.
|
inline |
Sets the scale to tile zoom method.
Definition at line 394 of file qgstiles.h.
Qgis::TileAvailability QgsTileMatrixSet::tileAvailability | ( | QgsTileXYZ | id | ) | const |
Returns the availability of the given tile in this matrix.
This method can be used to determine whether a particular tile actually exists within the matrix, or is not available (e.g. due to holes within the matrix).
This method returns Qgis::TileAvailability::Available by default, unless specific tile availability is known for the given id.
Definition at line 213 of file qgstiles.cpp.
QgsTileMatrix QgsTileMatrixSet::tileMatrix | ( | int | zoom | ) | const |
Returns the tile matrix corresponding to the specified zoom.
Definition at line 156 of file qgstiles.cpp.
QVector< QgsTileXYZ > QgsTileMatrixSet::tilesInRange | ( | QgsTileRange | range, |
int | zoomLevel | ||
) | const |
Returns a list of tiles in the given tile range.
Definition at line 428 of file qgstiles.cpp.
|
virtual |
Writes the set to an XML element.
Definition at line 391 of file qgstiles.cpp.
|
protected |
Definition at line 408 of file qgstiles.h.
|
protected |
Definition at line 410 of file qgstiles.h.
|
protected |
Definition at line 404 of file qgstiles.h.
|
protected |
Definition at line 409 of file qgstiles.h.
|
protected |
Definition at line 405 of file qgstiles.h.