QGIS API Documentation 4.3.0-Master (8c22baaae17)
Loading...
Searching...
No Matches
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 <memory>
31
32#include "qgschunkedentity.h"
33#include "qgschunkloader.h"
36#include "qgspointcloudindex.h"
38
39#include <QFutureWatcher>
40#include <QVector3D>
41#include <Qt3DCore/QBuffer>
42#include <Qt3DCore/QGeometry>
43
44#define SIP_NO_FILE
45
54class QgsPointCloudLayerChunkLoader : public QgsChunkLoader
55{
56 Q_OBJECT
57
58 public:
63 QgsPointCloudLayerChunkLoader(
64 const Qgs3DRenderContext &context, const QgsCoordinateTransform &coordinateTransform, QgsPointCloudIndex pc, QgsPointCloud3DSymbol *symbol, double zValueScale, double zValueOffset, int pointBudget
65 );
66
67 QFuture<QgsChunkLoaderResult> loadChunk( QgsChunkNode *node ) override;
68 QgsChunkNode *createRootNode() const override;
69 QFuture<QVector<QgsChunkNode *>> createChildren( QgsChunkNode *node ) override;
70 int primitivesCount( QgsChunkNode *node ) const override;
71
72 private:
74 QFuture<void> fetchHierarchyForNode( const QgsPointCloudNodeId &nodeId );
76 QVector<QgsChunkNode *> createChildrenInner( QgsChunkNode *node );
77
78 Qgs3DRenderContext mRenderContext;
79 QgsCoordinateTransform mCoordinateTransform;
80 QgsPointCloudIndex mPointCloudIndex;
81 std::unique_ptr<QgsPointCloud3DSymbol> mSymbol;
82 double mZValueScale = 1.0;
83 double mZValueOffset = 0;
84 int mPointBudget = 1000000;
85 bool mTriangulate = false;
86 QgsRectangle mExtent;
87
88 friend class QgsPointCloudLayerChunkedEntity;
89};
90
91
102class QgsPointCloudLayerChunkedEntity : public QgsChunkedEntity
103{
104 Q_OBJECT
105 public:
106 explicit QgsPointCloudLayerChunkedEntity(
107 Qgs3DMapSettings *map,
108 QgsPointCloudLayer *pcl,
109 const int indexPosition,
110 const QgsCoordinateTransform &coordinateTransform,
111 QgsPointCloud3DSymbol *symbol,
112 float maxScreenError,
113 bool showBoundingBoxes,
114 double zValueScale,
115 double zValueOffset,
116 int pointBudget
117 );
118
119 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
120
121 ~QgsPointCloudLayerChunkedEntity() override;
122
123 private slots:
124 void updateIndex();
125
126 private:
134 static QgsPointCloudIndex resolveIndex( const QgsPointCloudLayer *pcl, int indexPosition );
135
136 QgsPointCloudLayer *mLayer = nullptr;
137 int mIndexPosition;
138};
139
141
142#endif // QGSPOINTCLOUDLAYERCHUNKLOADER_P_H