16 #ifndef QGSDEMTERRAINTILELOADER_P_H
17 #define QGSDEMTERRAINTILELOADER_P_H
32 #include <QtConcurrent/QtConcurrentRun>
33 #include <QFutureWatcher>
34 #include <QElapsedTimer>
53 class QgsDemTerrainTileLoader :
public QgsTerrainTileLoader
58 QgsDemTerrainTileLoader( QgsTerrainEntity *terrain, QgsChunkNode *node,
QgsTerrainGenerator *terrainGenerator );
60 Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent )
override;
63 void onHeightMapReady(
int jobId,
const QByteArray &heightMap );
68 QByteArray mHeightMap;
81 class QgsDemHeightMapGenerator :
public QObject
91 ~QgsDemHeightMapGenerator()
override;
94 int render(
const QgsChunkNodeId &nodeId );
97 void waitForFinished();
100 int resolution()
const {
return mResolution; }
103 float heightAt(
double x,
double y );
107 void heightMapReady(
int jobId,
const QByteArray &heightMap );
110 void onFutureFinished();
125 std::unique_ptr<QgsTerrainDownloader> mDownloader;
130 QgsChunkNodeId tileId;
132 QFuture<QByteArray> future;
136 QHash<QFutureWatcher<QByteArray>*, JobData> mJobs;
138 void lazyLoadDtmCoarseData(
int res,
const QgsRectangle &rect );
139 mutable QMutex mLazyLoadDtmCoarseDataMutex;
141 QByteArray mDtmCoarseData;
148 #endif // QGSDEMTERRAINTILELOADER_P_H