QGIS API Documentation 3.99.0-Master (a5475b57e34)
Loading...
Searching...
No Matches
qgsterraindownloader.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsterraindownloader.h
3 --------------------------------------
4 Date : March 2019
5 Copyright : (C) 2019 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#ifndef QGSTERRAINDOWNLOADER_H
17#define QGSTERRAINDOWNLOADER_H
18
19#include <memory>
20
21#include "qgis_3d.h"
23
24#include <QByteArray>
25#include <QImage>
26
27#define SIP_NO_FILE
28
29class QgsRectangle;
31class QgsRasterLayer;
33
34
49class _3D_EXPORT QgsTerrainDownloader
50{
51 public:
56 QgsTerrainDownloader( const QgsCoordinateTransformContext &transformContext );
57
59
62 {
63 QString uri;
64 int zMin = 0;
65 int zMax = 0;
66 };
67
70
72 void setDataSource( const DataSource &ds );
73
75 DataSource dataSource() const { return mDataSource; }
76
81 QByteArray getHeightMap( const QgsRectangle &extentOrig, int res, const QgsCoordinateReferenceSystem &destCrs, const QgsCoordinateTransformContext &context = QgsCoordinateTransformContext(), QString tmpFilenameImg = QString(), QString tmpFilenameTif = QString() );
82
83 private:
88 double findBestTileResolution( double requestedMupp ) const;
89
93 static void adjustExtentAndResolution( double mupp, const QgsRectangle &extentOrig, QgsRectangle &extent, int &res );
94
99 static void tileImageToHeightMap( const QImage &img, QByteArray &heightMap );
100
101 private:
102 DataSource mDataSource;
103 std::unique_ptr<QgsRasterLayer> mOnlineDtm;
104 double mXSpan = 0;
105};
106
107#endif // QGSTERRAINDOWNLOADER_H
Represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Represents a raster layer.
A rectangle specified with double values.
QgsTerrainDownloader(const QgsCoordinateTransformContext &transformContext)
Constructs a QgsTerrainDownloader object.
DataSource dataSource() const
Returns currently configured data source.
static DataSource defaultDataSource()
Returns the data source used by default.
void setDataSource(const DataSource &ds)
Configures data source to be used for download of terrain tiles.
Definition of data source for terrain tiles (assuming "terrarium" data encoding with usual XYZ tiling...
QString uri
HTTP(S) template for XYZ tiles requests (e.g. http://example.com/{z}/{x}/{y}.png).
int zMin
Minimum zoom level (Z) with valid data.
int zMax
Maximum zoom level (Z) with valid data.