QGIS API Documentation  3.23.0-Master (22c16f2067)
qgsterraintexturegenerator_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsterraintexturegenerator_p.h
3  --------------------------------------
4  Date : July 2017
5  Copyright : (C) 2017 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 QGSTERRAINTEXTUREGENERATOR_P_H
17 #define QGSTERRAINTEXTUREGENERATOR_P_H
18 
20 
21 //
22 // W A R N I N G
23 // -------------
24 //
25 // This file is not part of the QGIS API. It exists purely as an
26 // implementation detail. This header file may change from version to
27 // version without notice, or even be removed.
28 //
29 
30 #define SIP_NO_FILE
31 
33 class QgsMapSettings;
34 class QgsProject;
35 class QgsRasterLayer;
36 
37 #include <QObject>
38 #include <QSize>
39 
40 #include "qgschunknode_p.h"
41 #include "qgsrectangle.h"
42 
43 class Qgs3DMapSettings;
44 
56 class QgsTerrainTextureGenerator : public QObject
57 {
58  Q_OBJECT
59  public:
61  QgsTerrainTextureGenerator( const Qgs3DMapSettings &map );
62 
67  int render( const QgsRectangle &extent, QgsChunkNodeId nodeId, const QString &debugText = QString() );
68 
70  void cancelJob( int jobId );
71 
73  void waitForFinished();
74 
76  QSize textureSize() const { return mTextureSize; }
78  void setTextureSize( QSize textureSize ) { mTextureSize = textureSize; }
79 
80  signals:
82  void tileReady( int jobId, const QImage &image );
83 
84  private slots:
85  void onRenderingFinished();
86 
87  private:
88  QgsMapSettings baseMapSettings();
89 
90  const Qgs3DMapSettings &mMap;
91 
92  struct JobData
93  {
94  int jobId;
95  QgsChunkNodeId tileId;
96  QgsMapRendererSequentialJob *job = nullptr;
97  QgsRectangle extent;
98  QString debugText;
99  };
100 
101  QHash<QgsMapRendererSequentialJob *, JobData> mJobs;
102  int mLastJobId;
103  QSize mTextureSize;
104 };
105 
107 
108 #endif // QGSTERRAINTEXTUREGENERATOR_P_H
Job implementation that renders everything sequentially in one thread.
The QgsMapSettings class contains configuration for rendering of the map.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:101
Represents a raster layer.
A rectangle specified with double values.
Definition: qgsrectangle.h:42