44 : mColumn( tc ), mRow( tr ), mZoomLevel( tz )
49 int column()
const {
return mColumn; }
51 int row()
const {
return mRow; }
56 QString
toString()
const {
return QStringLiteral(
"X=%1 Y=%2 Z=%3" ).arg( mColumn ).arg( mRow ).arg( mZoomLevel ); }
58 bool operator==(
const QgsTileXYZ &other )
const {
return mColumn == other.mColumn && mRow == other.mRow && mZoomLevel == other.mZoomLevel; }
62 SIP_PYOBJECT __repr__();
64 const QString
str = QStringLiteral(
"<QgsTileXYZ: %1, %2, %3>" ).arg( sipCpp->column() ).arg( sipCpp->row() ).arg( sipCpp->zoomLevel() );
65 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
82 return id.column() +
id.row() +
id.zoomLevel();
84 const uint h1 =
qHash(
static_cast< quint64
>(
id.column( ) ) );
85 const uint h2 =
qHash(
static_cast< quint64
>(
id.row() ) );
86 const uint h3 =
qHash(
static_cast< quint64
>(
id.zoomLevel() ) );
87 return h1 ^ ( h2 << 1 ) ^ ( h3 );
103 : mStartColumn( c1 ), mEndColumn( c2 ), mStartRow( r1 ), mEndRow( r2 ) {}
106 bool isValid()
const {
return mStartColumn >= 0 && mEndColumn >= 0 && mStartRow >= 0 && mEndRow >= 0; }
118 int mStartColumn = -1;
148 const QgsPointXY &z0TopLeftPoint,
double z0Dimension,
149 int z0MatrixWidth = 1,
int z0MatrixHeight = 1 );
198 double scale()
const {
return mScaleDenom; }
206 void setScale(
double scale ) { mScaleDenom = scale; }
218 QPointF mapToTileCoordinates(
const QgsPointXY &mapPoint )
const;
229 int mMatrixWidth = 0;
231 int mMatrixHeight = 0;
235 double mScaleDenom = 0;
237 double mTileXSpan = 0;
239 double mTileYSpan = 0;
263 bool isEmpty()
const;
268 void addGoogleCrs84QuadTiles(
int minimumZoom = 0,
int maximumZoom = 14 );
301 int minimumZoom()
const;
308 int maximumZoom()
const;
314 void dropMatricesOutsideZoomRange(
int minimumZoom,
int maximumZoom );
342 double scaleToZoom(
double scale )
const;
351 int scaleToZoomLevel(
double scale,
bool clamp =
true )
const;
365 double calculateTileScaleForMap(
double actualMapScale,
382 virtual QDomElement writeXml( QDomDocument &document,
const QgsReadWriteContext &context )
const;
403 QVector<QgsTileXYZ> tilesInRange(
QgsTileRange range,
int zoomLevel )
const;
ScaleToTileZoomLevelMethod
Available methods for converting map scales to tile zoom levels.
@ MapBox
Uses a scale doubling approach to account for hi-DPI tiles, and rounds to the nearest tile level for ...
TileAvailability
Possible availability states for a tile within a tile matrix.
This class represents a coordinate reference system (CRS).
A class to represent a 2D point.
The class is used as a container of context for various read/write operations on other objects.
A rectangle specified with double values.
Contains information about the context of a rendering operation.
Defines a set of tile matrices for multiple zoom levels.
std::function< Qgis::TileAvailability(QgsTileXYZ id) > mTileAvailabilityFunction
QMap< int, QgsTileMatrix > mTileMatrices
virtual ~QgsTileMatrixSet()=default
QgsTileMatrix mRootMatrix
Qgis::ScaleToTileZoomLevelMethod scaleToTileZoomMethod() const
Returns the scale to tile zoom method.
void setScaleToTileZoomMethod(Qgis::ScaleToTileZoomLevelMethod method)
Sets the scale to tile zoom method.
std::function< Qgis::TileAvailability(QgsTileXYZ id, QgsTileXYZ &replacement) > mTileReplacementFunction
Defines a matrix of tiles for a single zoom level: it is defined by its size (width *.
void setCrs(const QgsCoordinateReferenceSystem &crs)
Sets the crs of the tile matrix.
void setScale(double scale)
Sets the scale denominator of the tile matrix.
QgsRectangle extent() const
Returns extent of the tile matrix.
int matrixWidth() const
Returns number of columns of the tile matrix.
QgsCoordinateReferenceSystem crs() const
Returns the crs of the tile matrix.
bool isRootTileMatrix() const
Returns the root status of the tile matrix (zoom level == 0)
double scale() const
Returns scale denominator of the tile matrix.
void setZoomLevel(int level)
Sets the zoom level of the tile matrix.
int matrixHeight() const
Returns number of rows of the tile matrix.
int zoomLevel() const
Returns the zoom level of the tile matrix.
Range of tiles in a tile matrix to be rendered.
int endColumn() const
Returns index of the last column in the range.
QgsTileRange(int c1=-1, int c2=-1, int r1=-1, int r2=-1)
Constructs a range of tiles from given span of columns and rows.
int endRow() const
Returns index of the last row in the range.
int startRow() const
Returns index of the first row in the range.
int startColumn() const
Returns index of the first column in the range.
bool isValid() const
Returns whether the range is valid (when all row/column numbers are not negative)
Stores coordinates of a tile in a tile matrix set.
QString toString() const
Returns tile coordinates in a formatted string.
int zoomLevel() const
Returns tile's zoom level (Z)
QgsTileXYZ(int tc=-1, int tr=-1, int tz=-1)
Constructs a tile identifier from given column, row and zoom level indices.
bool operator==(const QgsTileXYZ &other) const
int column() const
Returns tile's column index (X)
bool operator!=(const QgsTileXYZ &other) const
int row() const
Returns tile's row index (Y)
CORE_EXPORT uint qHash(QgsTileXYZ id)
Returns a hash for a tile id.
const QgsCoordinateReferenceSystem & crs