QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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"
37
38#include <QFutureWatcher>
39
40#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
41#include <Qt3DRender/QGeometry>
42#include <Qt3DRender/QBuffer>
43#else
44#include <Qt3DCore/QGeometry>
45#include <Qt3DCore/QBuffer>
46#endif
47#include <QVector3D>
48
49#define SIP_NO_FILE
50
58class QgsPointCloudLayerChunkLoaderFactory : public QgsChunkLoaderFactory
59{
60 Q_OBJECT
61
62 public:
67 QgsPointCloudLayerChunkLoaderFactory( const Qgs3DRenderContext &context, const QgsCoordinateTransform &coordinateTransform, QgsPointCloudIndex pc, QgsPointCloud3DSymbol *symbol, double zValueScale, double zValueOffset, int pointBudget );
68
70 QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
71 QgsChunkNode *createRootNode() const override;
72 QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
73 int primitivesCount( QgsChunkNode *node ) const override;
74 Qgs3DRenderContext mRenderContext;
75 QgsCoordinateTransform mCoordinateTransform;
76 QgsPointCloudIndex mPointCloudIndex;
77 std::unique_ptr<QgsPointCloud3DSymbol> mSymbol;
78 double mZValueScale = 1.0;
79 double mZValueOffset = 0;
80 int mPointBudget = 1000000;
81 bool mTriangulate = false;
82 QgsRectangle mExtent;
83};
84
85
94class QgsPointCloudLayerChunkLoader : public QgsChunkLoader
95{
96 Q_OBJECT
97
98 public:
103 QgsPointCloudLayerChunkLoader( const QgsPointCloudLayerChunkLoaderFactory *factory, QgsChunkNode *node, std::unique_ptr<QgsPointCloud3DSymbol> symbol, const QgsCoordinateTransform &coordinateTransform, double zValueScale, double zValueOffset );
104 ~QgsPointCloudLayerChunkLoader() override;
105
106 void start() override;
107 void cancel() override;
108 Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
109
110 private:
111 const QgsPointCloudLayerChunkLoaderFactory *mFactory;
112 std::unique_ptr<QgsPointCloud3DSymbolHandler> mHandler;
113 QgsPointCloud3DRenderContext mContext;
114 QFutureWatcher<void> *mFutureWatcher = nullptr;
115};
116
117
128class QgsPointCloudLayerChunkedEntity : public QgsChunkedEntity
129{
130 Q_OBJECT
131 public:
132 explicit QgsPointCloudLayerChunkedEntity( Qgs3DMapSettings *map, QgsPointCloudLayer *pcl, QgsPointCloudIndex index, const QgsCoordinateTransform &coordinateTransform, QgsPointCloud3DSymbol *symbol, float maxScreenError, bool showBoundingBoxes, double zValueScale, double zValueOffset, int pointBudget );
133
134 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
135
136 ~QgsPointCloudLayerChunkedEntity() override;
137
138 private slots:
139 void updateIndex();
140
141 private:
142 QgsPointCloudLayer *mLayer = nullptr;
143 std::unique_ptr<QgsChunkUpdaterFactory> mChunkUpdaterFactory;
144};
145
147
148#endif // QGSPOINTCLOUDLAYERCHUNKLOADER_P_H