QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgspointcloudlayerchunkloader_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspointcloudlayerchunkloader_p.h
3  --------------------------------------
4  Date : October 2020
5  Copyright : (C) 2020 by Peter Petrik
6  Email : zilolv 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 QGSPOINTCLOUDLAYERCHUNKLOADER_P_H
17 #define QGSPOINTCLOUDLAYERCHUNKLOADER_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 #include "qgschunkloader_p.h"
31 #include "qgsfeature3dhandler_p.h"
32 #include "qgschunkedentity_p.h"
33 #include "qgspointcloud3dsymbol.h"
36 
37 #include <memory>
38 
39 #include <QFutureWatcher>
40 #include <Qt3DRender/QGeometry>
41 #include <Qt3DRender/QBuffer>
42 #include <Qt3DRender/QMaterial>
43 #include <QVector3D>
44 
45 #define SIP_NO_FILE
46 
54 class QgsPointCloudLayerChunkLoaderFactory : public QgsChunkLoaderFactory
55 {
56  public:
57 
62  QgsPointCloudLayerChunkLoaderFactory( const Qgs3DMapSettings &map, const QgsCoordinateTransform &coordinateTransform, QgsPointCloudIndex *pc, QgsPointCloud3DSymbol *symbol,
63  double zValueScale, double zValueOffset, int pointBudget );
64 
66  virtual QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
67  virtual QgsChunkNode *createRootNode() const override;
68  virtual QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
69  virtual int primitivesCount( QgsChunkNode *node ) const override;
70  const Qgs3DMapSettings &mMap;
71  QgsCoordinateTransform mCoordinateTransform;
72  QgsPointCloudIndex *mPointCloudIndex;
73  std::unique_ptr< QgsPointCloud3DSymbol > mSymbol;
74  double mZValueScale = 1.0;
75  double mZValueOffset = 0;
76  int mPointBudget = 1000000;
77 };
78 
79 
88 class QgsPointCloudLayerChunkLoader : public QgsChunkLoader
89 {
90  public:
91 
96  QgsPointCloudLayerChunkLoader( const QgsPointCloudLayerChunkLoaderFactory *factory, QgsChunkNode *node, std::unique_ptr< QgsPointCloud3DSymbol > symbol,
97  const QgsCoordinateTransform &coordinateTransform, double zValueScale, double zValueOffset );
98  ~QgsPointCloudLayerChunkLoader() override;
99 
100  virtual void cancel() override;
101  virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
102 
103  private:
104  const QgsPointCloudLayerChunkLoaderFactory *mFactory;
105  std::unique_ptr<QgsPointCloud3DSymbolHandler> mHandler;
107  QFutureWatcher<void> *mFutureWatcher = nullptr;
108 };
109 
110 
121 class QgsPointCloudLayerChunkedEntity : public QgsChunkedEntity
122 {
123  Q_OBJECT
124  public:
125  explicit QgsPointCloudLayerChunkedEntity( QgsPointCloudIndex *pc, const Qgs3DMapSettings &map, const QgsCoordinateTransform &coordinateTransform, QgsPointCloud3DSymbol *symbol, float maxScreenError, bool showBoundingBoxes,
126  double zValueScale, double zValueOffset, int pointBudget );
127 
128  ~QgsPointCloudLayerChunkedEntity();
129 };
130 
132 
133 #endif // QGSPOINTCLOUDLAYERCHUNKLOADER_P_H
Class for doing transforms between two map coordinate systems.
Encapsulates the render context for a 3D point cloud rendering operation.
Represents a indexed point clouds data in octree.