QGIS API Documentation 3.41.0-Master (cea29feecf2)
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 "qgis_3d.h"
20
21#include <memory>
22#include <QByteArray>
23#include <QImage>
24
26
27class QgsRectangle;
29class QgsRasterLayer;
31
32#define SIP_NO_FILE
33
48class _3D_EXPORT QgsTerrainDownloader
49{
50 public:
55 QgsTerrainDownloader( const QgsCoordinateTransformContext &transformContext );
56
58
61 {
62 QString uri;
63 int zMin = 0;
64 int zMax = 0;
65 };
66
68 static DataSource defaultDataSource();
69
71 void setDataSource( const DataSource &ds );
72
74 DataSource dataSource() const { return mDataSource; }
75
80 QByteArray getHeightMap( const QgsRectangle &extentOrig, int res, const QgsCoordinateReferenceSystem &destCrs, const QgsCoordinateTransformContext &context = QgsCoordinateTransformContext(), QString tmpFilenameImg = QString(), QString tmpFilenameTif = QString() );
81
82 private:
87 double findBestTileResolution( double requestedMupp ) const;
88
92 static void adjustExtentAndResolution( double mupp, const QgsRectangle &extentOrig, QgsRectangle &extent, int &res );
93
98 static void tileImageToHeightMap( const QImage &img, QByteArray &heightMap );
99
100 private:
101 DataSource mDataSource;
102 std::unique_ptr<QgsRasterLayer> mOnlineDtm;
103 double mXSpan = 0;
104};
105
106#endif // QGSTERRAINDOWNLOADER_H
This class 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.
DataSource dataSource() const
Returns currently configured data source.
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)