QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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  Q_OBJECT
57 
58  public:
59 
64  QgsPointCloudLayerChunkLoaderFactory( const Qgs3DMapSettings &map, const QgsCoordinateTransform &coordinateTransform, QgsPointCloudIndex *pc, QgsPointCloud3DSymbol *symbol,
65  double zValueScale, double zValueOffset, int pointBudget );
66 
68  virtual QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
69  virtual QgsChunkNode *createRootNode() const override;
70  virtual QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
71  virtual int primitivesCount( QgsChunkNode *node ) const override;
72  const Qgs3DMapSettings &mMap;
73  QgsCoordinateTransform mCoordinateTransform;
74  QgsPointCloudIndex *mPointCloudIndex;
75  std::unique_ptr< QgsPointCloud3DSymbol > mSymbol;
76  double mZValueScale = 1.0;
77  double mZValueOffset = 0;
78  int mPointBudget = 1000000;
79  bool mTriangulate = false;
80 };
81 
82 
91 class QgsPointCloudLayerChunkLoader : public QgsChunkLoader
92 {
93  Q_OBJECT
94 
95  public:
96 
101  QgsPointCloudLayerChunkLoader( const QgsPointCloudLayerChunkLoaderFactory *factory, QgsChunkNode *node, std::unique_ptr< QgsPointCloud3DSymbol > symbol,
102  const QgsCoordinateTransform &coordinateTransform, double zValueScale, double zValueOffset );
103  ~QgsPointCloudLayerChunkLoader() override;
104 
105  virtual void cancel() override;
106  virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
107 
108  private:
109  const QgsPointCloudLayerChunkLoaderFactory *mFactory;
110  std::unique_ptr<QgsPointCloud3DSymbolHandler> mHandler;
112  QFutureWatcher<void> *mFutureWatcher = nullptr;
113 };
114 
115 
126 class QgsPointCloudLayerChunkedEntity : public QgsChunkedEntity
127 {
128  Q_OBJECT
129  public:
130  explicit QgsPointCloudLayerChunkedEntity( QgsPointCloudIndex *pc, const Qgs3DMapSettings &map, const QgsCoordinateTransform &coordinateTransform, QgsPointCloud3DSymbol *symbol, float maxScreenError, bool showBoundingBoxes,
131  double zValueScale, double zValueOffset, int pointBudget );
132 
133  ~QgsPointCloudLayerChunkedEntity();
134 };
135 
137 
138 #endif // QGSPOINTCLOUDLAYERCHUNKLOADER_P_H
qgsfeature3dhandler_p.h
QgsPointCloud3DSymbol
3D symbol that draws point cloud geometries as 3D objects.
Definition: qgspointcloud3dsymbol.h:38
qgschunkloader_p.h
qgspointcloud3dsymbol.h
qgschunkedentity_p.h
Qgs3DMapSettings
Definition of the world.
Definition: qgs3dmapsettings.h:57
QgsPointCloud3DRenderContext
Encapsulates the render context for a 3D point cloud rendering operation.
Definition: qgspointcloudlayer3drenderer.h:42
QgsPointCloudIndex
Represents a indexed point clouds data in octree.
Definition: qgspointcloudindex.h:163
QgsCoordinateTransform
Class for doing transforms between two map coordinate systems.
Definition: qgscoordinatetransform.h:57
qgspointcloud3dsymbol_p.h
qgspointcloudlayer3drenderer.h