/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgstiles.h                                                  *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/





class QgsTileXYZ
{
%Docstring(signature="appended")
Stores coordinates of a tile in a tile matrix set.

Tile matrix is identified by the :py:func:`~zoomLevel`, and the position
within tile matrix is given by :py:func:`~column` and :py:func:`~row`.

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgstiles.h"
%End
  public:
    QgsTileXYZ( int tc = -1, int tr = -1, int tz = -1 );
%Docstring
Constructs a tile identifier from given column, row and zoom level
indices
%End

    int column() const;
%Docstring
Returns tile's column index (X)
%End
    int row() const;
%Docstring
Returns tile's row index (Y)
%End
    int zoomLevel() const;
%Docstring
Returns tile's zoom level (Z)
%End

    QString toString() const;
%Docstring
Returns tile coordinates in a formatted string
%End

    bool operator==( const QgsTileXYZ &other ) const;
    bool operator!=( const QgsTileXYZ &other ) const;

    SIP_PYOBJECT __repr__();
%MethodCode
    const QString str = QStringLiteral( "<QgsTileXYZ: %1, %2, %3>" ).arg( sipCpp->column() ).arg( sipCpp->row() ).arg( sipCpp->zoomLevel() );
    sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End

};



class QgsTileRange
{
%Docstring(signature="appended")
Range of tiles in a tile matrix to be rendered. The selection is
rectangular, given by start/end row and column numbers.

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgstiles.h"
%End
  public:
    QgsTileRange( int c1 = -1, int c2 = -1, int r1 = -1, int r2 = -1 );
%Docstring
Constructs a range of tiles from given span of columns and rows
%End
    bool isValid() const;
%Docstring
Returns whether the range is valid (when all row/column numbers are not
negative)
%End

    int startColumn() const;
%Docstring
Returns index of the first column in the range
%End
    int endColumn() const;
%Docstring
Returns index of the last column in the range
%End
    int startRow() const;
%Docstring
Returns index of the first row in the range
%End
    int endRow() const;
%Docstring
Returns index of the last row in the range
%End

    int count() const;
%Docstring
Returns the total number of tiles in the range.

.. versionadded:: 3.44
%End

};


class QgsTileMatrix
{
%Docstring(signature="appended")
Defines a matrix of tiles for a single zoom level: it is defined by its
size (width * height) and map extent that it covers.

Please note that we follow the XYZ convention of X/Y axes, i.e. top-left
tile has [0,0] coordinate (which is different from TMS convention where
bottom-left tile has [0,0] coordinate).

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgstiles.h"
%End
  public:

    static QgsTileMatrix fromWebMercator( int zoomLevel );
%Docstring
Returns a tile matrix for the usual web mercator
%End

    static QgsTileMatrix fromCustomDef( int zoomLevel, const QgsCoordinateReferenceSystem &crs,
                                        const QgsPointXY &z0TopLeftPoint, double z0Dimension,
                                        int z0MatrixWidth = 1, int z0MatrixHeight = 1 );
%Docstring
Returns a tile matrix for a specific CRS, top left point, zoom level 0
dimension in CRS units.

The ``z0Dimension`` argument must specify the dimension (width or
height, in map units) of the root tiles in zoom level 0.
%End

    static QgsTileMatrix fromTileMatrix( int zoomLevel, const QgsTileMatrix &tileMatrix );
%Docstring
Returns a tile matrix based on another one
%End

    QgsCoordinateReferenceSystem crs() const;
%Docstring
Returns the crs of the tile matrix.

.. seealso:: :py:func:`setCrs`
%End

    void setCrs( const QgsCoordinateReferenceSystem &crs );
%Docstring
Sets the ``crs`` of the tile matrix.

.. seealso:: :py:func:`crs`

.. versionadded:: 3.22.6
%End

    int zoomLevel() const;
%Docstring
Returns the zoom level of the tile matrix.

.. seealso:: :py:func:`setZoomLevel`
%End

    void setZoomLevel( int level );
%Docstring
Sets the zoom ``level`` of the tile matrix.

.. seealso:: :py:func:`zoomLevel`

.. versionadded:: 3.22.6
%End

    int matrixWidth() const;
%Docstring
Returns number of columns of the tile matrix
%End

    int matrixHeight() const;
%Docstring
Returns number of rows of the tile matrix
%End

    QgsRectangle extent() const;
%Docstring
Returns extent of the tile matrix
%End

    double scale() const;
%Docstring
Returns scale denominator of the tile matrix.

.. seealso:: :py:func:`setScale`
%End

    void setScale( double scale );
%Docstring
Sets the scale denominator of the tile matrix.

.. seealso:: :py:func:`scale`

.. versionadded:: 3.22.6
%End

    QgsRectangle tileExtent( QgsTileXYZ id ) const;
%Docstring
Returns extent of the given tile in this matrix
%End

    QgsPointXY tileCenter( QgsTileXYZ id ) const;
%Docstring
Returns center of the given tile in this matrix
%End

    QgsTileRange tileRangeFromExtent( const QgsRectangle &mExtent ) const;
%Docstring
Returns tile range that fully covers the given extent
%End

    QPointF mapToTileCoordinates( const QgsPointXY &mapPoint ) const;
%Docstring
Returns row/column coordinates (floating point number) from the given
point in map coordinates
%End

    bool isRootTileMatrix() const;
%Docstring
Returns the root status of the tile matrix (zoom level == 0)
%End

};


class QgsTileMatrixSet
{
%Docstring(signature="appended")
Defines a set of tile matrices for multiple zoom levels.

.. versionadded:: 3.22.6
%End

%TypeHeaderCode
#include "qgstiles.h"
%End
  public:

    QgsTileMatrixSet();

    virtual ~QgsTileMatrixSet();

    bool isEmpty() const;
%Docstring
Returns ``True`` if the matrix set is empty.
%End

    void addGoogleCrs84QuadTiles( int minimumZoom = 0, int maximumZoom = 14 );
%Docstring
Adds tile matrices corresponding to the standard web
mercator/GoogleCRS84Quad setup.
%End

    QgsTileMatrix tileMatrix( int zoom ) const;
%Docstring
Returns the tile matrix corresponding to the specified ``zoom``.
%End

    QgsTileMatrix rootMatrix() const;
%Docstring
Returns the root tile matrix (usually corresponding to zoom level 0).

.. versionadded:: 3.28
%End

    void setRootMatrix( const QgsTileMatrix &matrix );
%Docstring
Sets the root tile ``matrix`` (usually corresponding to zoom level 0).

.. versionadded:: 3.28
%End

    void addMatrix( const QgsTileMatrix &matrix );
%Docstring
Adds a ``matrix`` to the set.

Any existing matrix with the same :py:func:`QgsTileMatrix.zoomLevel()`
will be replaced.
%End

    int minimumZoom() const;
%Docstring
Returns the minimum zoom level for tiles present in the set.

.. seealso:: :py:func:`maximumZoom`
%End

    int maximumZoom() const;
%Docstring
Returns the maximum zoom level for tiles present in the set.

.. seealso:: :py:func:`minimumZoom`
%End

    void dropMatricesOutsideZoomRange( int minimumZoom, int maximumZoom );
%Docstring
Deletes any existing matrices which fall outside the zoom range
specified by ``minimumZoom`` to ``maximumZoom``, inclusive.
%End

    Qgis::TileAvailability tileAvailability( QgsTileXYZ id ) const;
%Docstring
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 :py:class:`Qgis`.TileAvailability.Available by
default, unless specific tile availability is known for the given
``id``.

.. versionadded:: 3.32
%End

    QgsCoordinateReferenceSystem crs() const;
%Docstring
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.
%End

    double scaleToZoom( double scale ) const;
%Docstring
Calculates a fractional zoom level given a map ``scale`` denominator.

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

    int scaleToZoomLevel( double scale, bool clamp = true ) const;
%Docstring
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
:py:func:`~QgsTileMatrixSet.minimumZoom` and
:py:func:`~QgsTileMatrixSet.maximumZoom`.
%End

    double scaleForRenderContext( const QgsRenderContext &context ) const;
%Docstring
Calculates the correct scale to use for the tiles when rendered using
the specified render ``context``.

.. versionadded:: 3.26
%End

    double calculateTileScaleForMap( double actualMapScale,
                                     const QgsCoordinateReferenceSystem &mapCrs,
                                     const QgsRectangle &mapExtent,
                                     const QSize mapSize,
                                     const double mapDpi
                                   ) const;
%Docstring
Calculates the correct scale to use for the tiles when rendered using
the specified map properties.

.. versionadded:: 3.26
%End

    virtual bool readXml( const QDomElement &element, QgsReadWriteContext &context );
%Docstring
Reads the set from an XML ``element``.

.. seealso:: :py:func:`writeXml`
%End

    virtual QDomElement writeXml( QDomDocument &document, const QgsReadWriteContext &context ) const;
%Docstring
Writes the set to an XML element.
%End

    Qgis::ScaleToTileZoomLevelMethod scaleToTileZoomMethod() const;
%Docstring
Returns the scale to tile zoom method.

.. seealso:: :py:func:`setScaleToTileZoomMethod`
%End

    void setScaleToTileZoomMethod( Qgis::ScaleToTileZoomLevelMethod method );
%Docstring
Sets the scale to tile zoom method.

.. seealso:: :py:func:`scaleToTileZoomMethod`
%End

    QVector<QgsTileXYZ> tilesInRange( QgsTileRange range, int zoomLevel ) const;
%Docstring
Returns a list of tiles in the given tile range.

.. versionadded:: 3.32
%End

  protected:

};

/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgstiles.h                                                  *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/
