QGIS API Documentation 3.99.0-Master (a8f284845db)
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
53class QgsPointCloudLayerChunkLoaderFactory : public QgsChunkLoaderFactory
54{
55 Q_OBJECT
56
57 public:
62 QgsPointCloudLayerChunkLoaderFactory( const Qgs3DRenderContext &context, const QgsCoordinateTransform &coordinateTransform, QgsPointCloudIndex pc, QgsPointCloud3DSymbol *symbol, double zValueScale, double zValueOffset, int pointBudget );
63
65 QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
66 QgsChunkNode *createRootNode() const override;
67 QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
68 int primitivesCount( QgsChunkNode *node ) const override;
69 Qgs3DRenderContext mRenderContext;
70 QgsCoordinateTransform mCoordinateTransform;
71 QgsPointCloudIndex mPointCloudIndex;
72 std::unique_ptr<QgsPointCloud3DSymbol> mSymbol;
73 double mZValueScale = 1.0;
74 double mZValueOffset = 0;
75 int mPointBudget = 1000000;
76 bool mTriangulate = false;
77 QgsRectangle mExtent;
78};
79
80
89class QgsPointCloudLayerChunkLoader : public QgsChunkLoader
90{
91 Q_OBJECT
92
93 public:
98 QgsPointCloudLayerChunkLoader( const QgsPointCloudLayerChunkLoaderFactory *factory, QgsChunkNode *node, std::unique_ptr<QgsPointCloud3DSymbol> symbol, const QgsCoordinateTransform &coordinateTransform, double zValueScale, double zValueOffset );
99 ~QgsPointCloudLayerChunkLoader() override;
100
101 void start() override;
102 void cancel() override;
103 Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
104
105 private:
106 const QgsPointCloudLayerChunkLoaderFactory *mFactory;
107 std::unique_ptr<QgsPointCloud3DSymbolHandler> mHandler;
108 QgsPointCloud3DRenderContext mContext;
109 QFutureWatcher<void> *mFutureWatcher = nullptr;
110};
111
112
123class QgsPointCloudLayerChunkedEntity : public QgsChunkedEntity
124{
125 Q_OBJECT
126 public:
127 explicit QgsPointCloudLayerChunkedEntity( Qgs3DMapSettings *map, QgsPointCloudLayer *pcl, const int indexPosition, const QgsCoordinateTransform &coordinateTransform, QgsPointCloud3DSymbol *symbol, float maxScreenError, bool showBoundingBoxes, double zValueScale, double zValueOffset, int pointBudget );
128
129 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
130
131 ~QgsPointCloudLayerChunkedEntity() override;
132
133 private slots:
134 void updateIndex();
135
136 private:
137 static QgsPointCloudIndex resolveIndex( const QgsPointCloudLayer *pcl, int indexPosition );
138
139 QgsPointCloudLayer *mLayer = nullptr;
140 std::unique_ptr<QgsChunkUpdaterFactory> mChunkUpdaterFactory;
141 int mIndexPosition;
142};
143
145
146#endif // QGSPOINTCLOUDLAYERCHUNKLOADER_P_H