QGIS API Documentation 4.1.0-Master (60fea48833c)
Loading...
Searching...
No Matches
qgstiles.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgstiles.cpp
3 --------------------------------------
4 Date : March 2020
5 Copyright : (C) 2020 by Martin Dobias
6 Email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#include "qgstiles.h"
17
19#include "qgslogger.h"
20#include "qgsrendercontext.h"
21#include "qgsunittypes.h"
22
23#include <QString>
24
25using namespace Qt::StringLiterals;
26
28{
29 constexpr double z0xMin = -20037508.3427892;
30 constexpr double z0yMax = 20037508.3427892;
31
32 return fromCustomDef( zoomLevel, QgsCoordinateReferenceSystem( u"EPSG:3857"_s ), QgsPointXY( z0xMin, z0yMax ), 2 * z0yMax );
33}
34
35QgsTileMatrix QgsTileMatrix::fromCustomDef( int zoomLevel, const QgsCoordinateReferenceSystem &crs, const QgsPointXY &z0TopLeftPoint, double z0Dimension, int z0MatrixWidth, int z0MatrixHeight )
36{
37 // Square extent calculation
38 double z0xMin = z0TopLeftPoint.x();
39 double z0yMax = z0TopLeftPoint.y();
40 double z0xMax = z0xMin + z0MatrixWidth * z0Dimension;
41 double z0yMin = z0yMax - z0MatrixHeight * z0Dimension;
42
43 // Constant for scale denominator calculation
44 constexpr double TILE_SIZE = 256.0;
45 constexpr double PIXELS_TO_M = 2.8 / 10000.0; // WMS/WMTS define "standardized rendering pixel size" as 0.28mm
46 const double unitToMeters = QgsUnitTypes::fromUnitToUnitFactor( crs.mapUnits(), Qgis::DistanceUnit::Meters );
47 // Scale denominator calculation
48 const double scaleDenom0 = ( z0Dimension / TILE_SIZE ) * ( unitToMeters / PIXELS_TO_M );
49
50 int numTiles = static_cast<int>( pow( 2, zoomLevel ) ); // assuming we won't ever go over 30 zoom levels
51
53 tm.mCrs = crs;
54 tm.mZoomLevel = zoomLevel;
55 tm.mMatrixWidth = z0MatrixWidth * numTiles;
56 tm.mMatrixHeight = z0MatrixHeight * numTiles;
57 tm.mTileXSpan = ( z0xMax - z0xMin ) / tm.mMatrixWidth;
58 tm.mTileYSpan = ( z0yMax - z0yMin ) / tm.mMatrixHeight;
59 tm.mExtent = QgsRectangle( z0xMin, z0yMin, z0xMax, z0yMax );
60 tm.mScaleDenom = scaleDenom0 / pow( 2, zoomLevel );
61 return tm;
62}
63
65{
67 int numTiles = static_cast<int>( pow( 2, zoomLevel ) ); // assuming we won't ever go over 30 zoom levels
68 int aZoomLevel = tileMatrix.zoomLevel();
69 int aNumTiles = static_cast<int>( pow( 2, aZoomLevel ) );
70 int aMatrixWidth = tileMatrix.matrixWidth();
71 int aMatrixHeight = tileMatrix.matrixHeight();
72 QgsRectangle aExtent = tileMatrix.extent();
73 tm.mCrs = tileMatrix.crs();
74 tm.mZoomLevel = zoomLevel;
75 tm.mMatrixWidth = aMatrixWidth * numTiles / aNumTiles;
76 tm.mMatrixHeight = aMatrixHeight * numTiles / aNumTiles;
77 tm.mTileXSpan = aExtent.width() / tm.mMatrixWidth;
78 tm.mTileYSpan = aExtent.height() / tm.mMatrixHeight;
79 tm.mExtent = aExtent;
80 tm.mScaleDenom = tileMatrix.scale() * pow( 2, aZoomLevel ) / pow( 2, zoomLevel );
81 return tm;
82}
83
85{
86 double xMin = mExtent.xMinimum() + mTileXSpan * id.column();
87 double xMax = xMin + mTileXSpan;
88 double yMax = mExtent.yMaximum() - mTileYSpan * id.row();
89 double yMin = yMax - mTileYSpan;
90 return QgsRectangle( xMin, yMin, xMax, yMax );
91}
92
94{
95 double x = mExtent.xMinimum() + mTileXSpan * id.column() + mTileXSpan / 2;
96 double y = mExtent.yMaximum() - mTileYSpan * id.row() - mTileYSpan / 2;
97 return QgsPointXY( x, y );
98}
99
101{
102 double x0 = std::clamp( r.xMinimum(), mExtent.xMinimum(), mExtent.xMaximum() );
103 double y0 = std::clamp( r.yMinimum(), mExtent.yMinimum(), mExtent.yMaximum() );
104 double x1 = std::clamp( r.xMaximum(), mExtent.xMinimum(), mExtent.xMaximum() );
105 double y1 = std::clamp( r.yMaximum(), mExtent.yMinimum(), mExtent.yMaximum() );
106 if ( x0 >= x1 || y0 >= y1 )
107 return QgsTileRange(); // nothing to display
108
109 double tileX1 = ( x0 - mExtent.xMinimum() ) / mTileXSpan;
110 double tileX2 = ( x1 - mExtent.xMinimum() ) / mTileXSpan;
111 double tileY1 = ( mExtent.yMaximum() - y1 ) / mTileYSpan;
112 double tileY2 = ( mExtent.yMaximum() - y0 ) / mTileYSpan;
113
114 QgsDebugMsgLevel( u"Tile range of edges [%1,%2] - [%3,%4]"_s.arg( tileX1 ).arg( tileY1 ).arg( tileX2 ).arg( tileY2 ), 2 );
115
116 // figure out tile range from zoom
117 int startColumn = std::clamp( static_cast<int>( floor( tileX1 ) ), 0, mMatrixWidth - 1 );
118 int endColumn = std::clamp( static_cast<int>( floor( tileX2 ) ), 0, mMatrixWidth - 1 );
119 int startRow = std::clamp( static_cast<int>( floor( tileY1 ) ), 0, mMatrixHeight - 1 );
120 int endRow = std::clamp( static_cast<int>( floor( tileY2 ) ), 0, mMatrixHeight - 1 );
121 return QgsTileRange( startColumn, endColumn, startRow, endRow );
122}
123
124QPointF QgsTileMatrix::mapToTileCoordinates( const QgsPointXY &mapPoint ) const
125{
126 double dx = mapPoint.x() - mExtent.xMinimum();
127 double dy = mExtent.yMaximum() - mapPoint.y();
128 return QPointF( dx / mTileXSpan, dy / mTileYSpan );
129}
130
131//
132// QgsTileMatrixSet
133//
134
143
145{
146 return mTileMatrices.isEmpty();
147}
148
150{
151 if ( maximumZoom < minimumZoom )
152 std::swap( minimumZoom, maximumZoom );
153
154 for ( int zoom = minimumZoom; zoom <= maximumZoom; ++zoom )
155 {
157 }
158
160}
161
163{
164 return mTileMatrices.value( zoom );
165}
166
171
173{
174 mRootMatrix = matrix;
175}
176
178{
179 mTileMatrices.insert( matrix.zoomLevel(), matrix );
180}
181
183{
184 int res = -1;
185 for ( auto it = mTileMatrices.constBegin(); it != mTileMatrices.constEnd(); ++it )
186 {
187 if ( res == -1 || it->zoomLevel() < res )
188 res = it->zoomLevel();
189 }
190 return res;
191}
192
194{
195 int res = -1;
196 for ( auto it = mTileMatrices.constBegin(); it != mTileMatrices.constEnd(); ++it )
197 {
198 if ( res == -1 || it->zoomLevel() > res )
199 res = it->zoomLevel();
200 }
201 return res;
202}
203
205{
206 for ( auto it = mTileMatrices.begin(); it != mTileMatrices.end(); )
207 {
208 if ( it->zoomLevel() < minimumZoom || it->zoomLevel() > maximumZoom )
209 {
210 it = mTileMatrices.erase( it );
211 }
212 else
213 {
214 ++it;
215 }
216 }
217}
218
223
225{
226 if ( mTileMatrices.empty() )
228
229 return mTileMatrices.value( minimumZoom() ).crs();
230}
231
232double QgsTileMatrixSet::scaleToZoom( double scale ) const
233{
234 int zoomUnder = -1;
235 int zoomOver = -1;
236 double scaleUnder = 0;
237 double scaleOver = 0;
238
239 switch ( mScaleToTileZoomMethod )
240 {
242 {
243 // TODO: it seems that map scale is double (is that because of high-dpi screen?)
244 // (this TODO was taken straight from QgsVectorTileUtils::scaleToZoom!)
245 scale *= 2;
246 break;
247 }
249 break;
250 }
251
252 for ( auto it = mTileMatrices.constBegin(); it != mTileMatrices.constEnd(); ++it )
253 {
254 if ( it->scale() > scale && ( zoomUnder == -1 || zoomUnder < it->zoomLevel() ) )
255 {
256 zoomUnder = it->zoomLevel();
257 scaleUnder = it->scale();
258 }
259 if ( it->scale() < scale && ( zoomOver == -1 || zoomOver > it->zoomLevel() ) )
260 {
261 zoomOver = it->zoomLevel();
262 scaleOver = it->scale();
263 }
264 }
265
266 if ( zoomUnder < 0 )
267 return zoomOver;
268 if ( zoomOver < 0 )
269 {
270 // allow overzooming, so the styling is applied correctly
271 scaleOver = tileMatrix( maximumZoom() ).scale() / 2;
272 zoomOver = maximumZoom() + 1;
273 while ( true )
274 {
275 if ( scaleOver < scale && scale < scaleUnder )
276 {
277 return ( scaleUnder - scale ) / ( scaleUnder - scaleOver ) * ( zoomOver - zoomUnder ) + zoomUnder;
278 }
279 scaleUnder = scaleOver;
280 zoomUnder = zoomOver;
281 scaleOver = scaleOver / 2;
282 zoomOver += 1;
283 }
284 }
285 else
286 return ( scaleUnder - scale ) / ( scaleUnder - scaleOver ) * ( zoomOver - zoomUnder ) + zoomUnder;
287}
288
289int QgsTileMatrixSet::scaleToZoomLevel( double scale, bool clamp ) const
290{
291 int tileZoom = 0;
292 switch ( mScaleToTileZoomMethod )
293 {
295 tileZoom = static_cast<int>( round( scaleToZoom( scale ) ) );
296 break;
298 tileZoom = static_cast<int>( floor( scaleToZoom( scale ) ) );
299 break;
300 }
301
302 return clamp ? std::clamp( tileZoom, minimumZoom(), maximumZoom() ) : tileZoom;
303}
304
306{
307 return calculateTileScaleForMap( context.rendererScale(), context.coordinateTransform().destinationCrs(), context.mapExtent(), context.outputSize(), context.painter()->device()->logicalDpiX() );
308}
309
310double QgsTileMatrixSet::calculateTileScaleForMap( double actualMapScale, const QgsCoordinateReferenceSystem &mapCrs, const QgsRectangle &mapExtent, const QSize mapSize, const double mapDpi ) const
311{
312 switch ( mScaleToTileZoomMethod )
313 // cppcheck-suppress missingReturn
314 {
316 return actualMapScale;
317
319 if ( mapCrs.isGeographic() )
320 {
321 // ESRI calculates the scale for geographic CRS ***ALWAYS*** at the equator, regardless of map extent!
322 // see https://support.esri.com/en/technical-article/000007211, https://gis.stackexchange.com/questions/33270/how-does-arcmap-calculate-scalebar-inside-a-wgs84-layout
323 constexpr double METERS_PER_DEGREE = M_PI / 180.0 * 6378137;
324 constexpr double INCHES_PER_METER = 39.370078;
325 const double mapWidthInches = mapExtent.width() * METERS_PER_DEGREE * INCHES_PER_METER;
326
327 double scale = mapWidthInches * mapDpi / static_cast< double >( mapSize.width() );
328
329 // Note: I **think** there's also some magic which ESRI applies when rendering tiles ON SCREEN,
330 // which may be something like adjusting the scale based on the ratio between the map DPI and 96 DPI,
331 // e.g. scale *= mapDpi / 96.0;
332 // BUT the same adjustment isn't applied when exporting maps. This needs further investigation!
333
334 return scale;
335 }
336 else
337 {
338 return actualMapScale;
339 }
340 }
342}
343
344bool QgsTileMatrixSet::readXml( const QDomElement &element, QgsReadWriteContext & )
345{
346 mTileMatrices.clear();
347
348 mScaleToTileZoomMethod = qgsEnumKeyToValue( element.attribute( u"scaleToZoomMethod"_s ), Qgis::ScaleToTileZoomLevelMethod::MapBox );
349
350 auto readMatrixFromElement = []( const QDomElement &matrixElement ) -> QgsTileMatrix {
351 QgsTileMatrix matrix;
352 matrix.mZoomLevel = matrixElement.attribute( u"zoomLevel"_s ).toInt();
353 matrix.mMatrixWidth = matrixElement.attribute( u"matrixWidth"_s ).toInt();
354 matrix.mMatrixHeight = matrixElement.attribute( u"matrixHeight"_s ).toInt();
355 matrix.mExtent = QgsRectangle(
356 matrixElement.attribute( u"xMin"_s ).toDouble(), matrixElement.attribute( u"yMin"_s ).toDouble(), matrixElement.attribute( u"xMax"_s ).toDouble(), matrixElement.attribute( u"yMax"_s ).toDouble()
357 );
358
359 matrix.mScaleDenom = matrixElement.attribute( u"scale"_s ).toDouble();
360 matrix.mTileXSpan = matrixElement.attribute( u"tileXSpan"_s ).toDouble();
361 matrix.mTileYSpan = matrixElement.attribute( u"tileYSpan"_s ).toDouble();
362 matrix.mCrs.readXml( matrixElement );
363 return matrix;
364 };
365
366 const QDomNodeList children = element.childNodes();
367 for ( int i = 0; i < children.size(); i++ )
368 {
369 const QDomElement matrixElement = children.at( i ).toElement();
370 if ( matrixElement.tagName() == "rootMatrix"_L1 )
371 continue;
372
373 QgsTileMatrix matrix = readMatrixFromElement( matrixElement );
374 if ( matrix.zoomLevel() == 0 ) // old project compatibility
375 mRootMatrix = matrix;
376
377 addMatrix( matrix );
378 }
379
380 const QDomElement rootElement = element.firstChildElement( u"rootMatrix"_s );
381 if ( !rootElement.isNull() )
382 {
383 mRootMatrix = readMatrixFromElement( rootElement );
384 }
385
386 return true;
387}
388
389QDomElement QgsTileMatrixSet::writeXml( QDomDocument &document, const QgsReadWriteContext & ) const
390{
391 QDomElement setElement = document.createElement( u"matrixSet"_s );
392 setElement.setAttribute( u"scaleToZoomMethod"_s, qgsEnumValueToKey( mScaleToTileZoomMethod ) );
393
394 auto writeMatrixToElement = [&document]( const QgsTileMatrix &matrix, QDomElement &matrixElement ) {
395 matrixElement.setAttribute( u"zoomLevel"_s, matrix.zoomLevel() );
396 matrixElement.setAttribute( u"matrixWidth"_s, matrix.matrixWidth() );
397 matrixElement.setAttribute( u"matrixHeight"_s, matrix.matrixHeight() );
398
399 matrixElement.setAttribute( u"xMin"_s, qgsDoubleToString( matrix.mExtent.xMinimum() ) );
400 matrixElement.setAttribute( u"xMax"_s, qgsDoubleToString( matrix.mExtent.xMaximum() ) );
401 matrixElement.setAttribute( u"yMin"_s, qgsDoubleToString( matrix.mExtent.yMinimum() ) );
402 matrixElement.setAttribute( u"yMax"_s, qgsDoubleToString( matrix.mExtent.yMaximum() ) );
403
404 matrixElement.setAttribute( u"scale"_s, qgsDoubleToString( matrix.scale() ) );
405 matrixElement.setAttribute( u"tileXSpan"_s, qgsDoubleToString( matrix.mTileXSpan ) );
406 matrixElement.setAttribute( u"tileYSpan"_s, qgsDoubleToString( matrix.mTileYSpan ) );
407
408 matrix.crs().writeXml( matrixElement, document );
409 };
410
411 for ( auto it = mTileMatrices.constBegin(); it != mTileMatrices.constEnd(); ++it )
412 {
413 QDomElement matrixElement = document.createElement( u"matrix"_s );
414 writeMatrixToElement( *it, matrixElement );
415 setElement.appendChild( matrixElement );
416 }
417
418 QDomElement rootElement = document.createElement( u"rootMatrix"_s );
419 writeMatrixToElement( mRootMatrix, rootElement );
420 setElement.appendChild( rootElement );
421
422 return setElement;
423}
424
425QVector<QgsTileXYZ> QgsTileMatrixSet::tilesInRange( QgsTileRange range, int zoomLevel ) const
426{
427 QVector<QgsTileXYZ> tiles;
428 tiles.reserve( ( range.endColumn() - range.startColumn() + 1 ) * ( range.endRow() - range.startRow() + 1 ) );
429
430 for ( int tileRow = range.startRow(); tileRow <= range.endRow(); ++tileRow )
431 {
432 for ( int tileColumn = range.startColumn(); tileColumn <= range.endColumn(); ++tileColumn )
433 {
434 QgsTileXYZ tile( tileColumn, tileRow, zoomLevel );
435 QgsTileXYZ replacement;
436 switch ( mTileReplacementFunction( tile, replacement ) )
437 {
439 break;
440
444 if ( !tiles.contains( replacement ) )
445 tiles.append( replacement );
446 break;
447 }
448 }
449 }
450 return tiles;
451}
@ Meters
Meters.
Definition qgis.h:5171
@ Esri
No scale doubling, always rounds down when matching to available tile levels.
Definition qgis.h:3536
@ MapBox
Uses a scale doubling approach to account for hi-DPI tiles, and rounds to the nearest tile level for ...
Definition qgis.h:3535
TileAvailability
Possible availability states for a tile within a tile matrix.
Definition qgis.h:5963
@ UseLowerZoomLevelTile
Tile is not available at the requested zoom level, it should be replaced by a tile from a lower zoom ...
Definition qgis.h:5967
@ NotAvailable
Tile is not available within the matrix, e.g. there is no content for the tile.
Definition qgis.h:5965
@ AvailableNoChildren
Tile is available within the matrix, and is known to have no children (ie no higher zoom level tiles ...
Definition qgis.h:5966
@ Available
Tile is available within the matrix.
Definition qgis.h:5964
Represents a coordinate reference system (CRS).
bool readXml(const QDomNode &node)
Restores state from the given DOM node.
bool writeXml(QDomNode &node, QDomDocument &doc) const
Stores state to the given Dom node in the given document.
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system, which the transform will transform coordinates t...
Represents a 2D point.
Definition qgspointxy.h:62
double y
Definition qgspointxy.h:66
double x
Definition qgspointxy.h:65
A container for the context for various read/write operations on objects.
A rectangle specified with double values.
double xMinimum
double yMinimum
double xMaximum
double yMaximum
Contains information about the context of a rendering operation.
QPainter * painter()
Returns the destination QPainter for the render operation.
double rendererScale() const
Returns the renderer map scale.
QSize outputSize() const
Returns the size of the resulting rendered image, in pixels.
QgsRectangle mapExtent() const
Returns the original extent of the map being rendered.
QgsCoordinateTransform coordinateTransform() const
Returns the current coordinate transform for the context.
virtual QDomElement writeXml(QDomDocument &document, const QgsReadWriteContext &context) const
Writes the set to an XML element.
Definition qgstiles.cpp:389
Qgis::ScaleToTileZoomLevelMethod mScaleToTileZoomMethod
Definition qgstiles.h:437
void addGoogleCrs84QuadTiles(int minimumZoom=0, int maximumZoom=14)
Adds tile matrices corresponding to the standard web mercator/GoogleCRS84Quad setup.
Definition qgstiles.cpp:149
QgsCoordinateReferenceSystem crs() const
Returns the coordinate reference system associated with the tiles.
Definition qgstiles.cpp:224
std::function< Qgis::TileAvailability(QgsTileXYZ id) > mTileAvailabilityFunction
Definition qgstiles.h:431
double scaleForRenderContext(const QgsRenderContext &context) const
Calculates the correct scale to use for the tiles when rendered using the specified render context.
Definition qgstiles.cpp:305
int minimumZoom() const
Returns the minimum zoom level for tiles present in the set.
Definition qgstiles.cpp:182
double scaleToZoom(double scale) const
Calculates a fractional zoom level given a map scale denominator.
Definition qgstiles.cpp:232
QMap< int, QgsTileMatrix > mTileMatrices
Definition qgstiles.h:436
QVector< QgsTileXYZ > tilesInRange(QgsTileRange range, int zoomLevel) const
Returns a list of tiles in the given tile range.
Definition qgstiles.cpp:425
int maximumZoom() const
Returns the maximum zoom level for tiles present in the set.
Definition qgstiles.cpp:193
QgsTileMatrix tileMatrix(int zoom) const
Returns the tile matrix corresponding to the specified zoom.
Definition qgstiles.cpp:162
Qgis::TileAvailability tileAvailability(QgsTileXYZ id) const
Returns the availability of the given tile in this matrix.
Definition qgstiles.cpp:219
QgsTileMatrix rootMatrix() const
Returns the root tile matrix (usually corresponding to zoom level 0).
Definition qgstiles.cpp:167
virtual bool readXml(const QDomElement &element, QgsReadWriteContext &context)
Reads the set from an XML element.
Definition qgstiles.cpp:344
void addMatrix(const QgsTileMatrix &matrix)
Adds a matrix to the set.
Definition qgstiles.cpp:177
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.
Definition qgstiles.cpp:310
void dropMatricesOutsideZoomRange(int minimumZoom, int maximumZoom)
Deletes any existing matrices which fall outside the zoom range specified by minimumZoom to maximumZo...
Definition qgstiles.cpp:204
bool isEmpty() const
Returns true if the matrix set is empty.
Definition qgstiles.cpp:144
QgsTileMatrix mRootMatrix
Definition qgstiles.h:435
void setRootMatrix(const QgsTileMatrix &matrix)
Sets the root tile matrix (usually corresponding to zoom level 0).
Definition qgstiles.cpp:172
std::function< Qgis::TileAvailability(QgsTileXYZ id, QgsTileXYZ &replacement) > mTileReplacementFunction
Definition qgstiles.h:432
int scaleToZoomLevel(double scale, bool clamp=true) const
Finds the best fitting (integer) zoom level given a map scale denominator.
Definition qgstiles.cpp:289
Defines a matrix of tiles for a single zoom level: it is defined by its size (width *.
Definition qgstiles.h:171
QgsRectangle tileExtent(QgsTileXYZ id) const
Returns extent of the given tile in this matrix.
Definition qgstiles.cpp:84
QPointF mapToTileCoordinates(const QgsPointXY &mapPoint) const
Returns row/column coordinates (floating point number) from the given point in map coordinates.
Definition qgstiles.cpp:124
QgsTileRange tileRangeFromExtent(const QgsRectangle &mExtent) const
Returns tile range that fully covers the given extent.
Definition qgstiles.cpp:100
static QgsTileMatrix fromWebMercator(int zoomLevel)
Returns a tile matrix for the usual web mercator.
Definition qgstiles.cpp:27
QgsRectangle extent() const
Returns extent of the tile matrix.
Definition qgstiles.h:223
int matrixWidth() const
Returns number of columns of the tile matrix.
Definition qgstiles.h:217
QgsCoordinateReferenceSystem crs() const
Returns the crs of the tile matrix.
Definition qgstiles.h:191
double scale() const
Returns scale denominator of the tile matrix.
Definition qgstiles.h:230
QgsPointXY tileCenter(QgsTileXYZ id) const
Returns center of the given tile in this matrix.
Definition qgstiles.cpp:93
int matrixHeight() const
Returns number of rows of the tile matrix.
Definition qgstiles.h:220
static QgsTileMatrix fromTileMatrix(int zoomLevel, const QgsTileMatrix &tileMatrix)
Returns a tile matrix based on another one.
Definition qgstiles.cpp:64
int zoomLevel() const
Returns the zoom level of the tile matrix.
Definition qgstiles.h:206
static QgsTileMatrix fromCustomDef(int zoomLevel, const QgsCoordinateReferenceSystem &crs, const QgsPointXY &z0TopLeftPoint, double z0Dimension, int z0MatrixWidth=1, int z0MatrixHeight=1)
Returns a tile matrix for a specific CRS, top left point, zoom level 0 dimension in CRS units.
Definition qgstiles.cpp:35
A range of tiles in a tile matrix.
Definition qgstiles.h:123
int endColumn() const
Returns index of the last column in the range.
Definition qgstiles.h:139
int endRow() const
Returns index of the last row in the range.
Definition qgstiles.h:143
int startRow() const
Returns index of the first row in the range.
Definition qgstiles.h:141
int startColumn() const
Returns index of the first column in the range.
Definition qgstiles.h:137
Stores coordinates of a tile in a tile matrix set.
Definition qgstiles.h:43
static Q_INVOKABLE double fromUnitToUnitFactor(Qgis::DistanceUnit fromUnit, Qgis::DistanceUnit toUnit)
Returns the conversion factor between the specified distance units.
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
Definition qgis.h:7176
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
Definition qgis.h:6893
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
Definition qgis.h:7157
#define BUILTIN_UNREACHABLE
Definition qgis.h:7540
#define QgsDebugMsgLevel(str, level)
Definition qgslogger.h:63