QGIS API Documentation 3.99.0-Master (26c88405ac0)
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:
63
68 QgsPointCloudLayerChunkLoaderFactory( const Qgs3DRenderContext &context, const QgsCoordinateTransform &coordinateTransform, QgsPointCloudIndex pc, QgsPointCloud3DSymbol *symbol, double zValueScale, double zValueOffset, int pointBudget );
69
71 QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
72 QgsChunkNode *createRootNode() const override;
73 QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
74 int primitivesCount( QgsChunkNode *node ) const override;
75 Qgs3DRenderContext mRenderContext;
76 QgsCoordinateTransform mCoordinateTransform;
77 QgsPointCloudIndex mPointCloudIndex;
78 std::unique_ptr<QgsPointCloud3DSymbol> mSymbol;
79 double mZValueScale = 1.0;
80 double mZValueOffset = 0;
81 int mPointBudget = 1000000;
82 bool mTriangulate = false;
83 QgsRectangle mExtent;
84};
85
86
95class QgsPointCloudLayerChunkLoader : public QgsChunkLoader
96{
97 Q_OBJECT
98
99 public:
100
105 QgsPointCloudLayerChunkLoader( const QgsPointCloudLayerChunkLoaderFactory *factory, QgsChunkNode *node, std::unique_ptr<QgsPointCloud3DSymbol> symbol, const QgsCoordinateTransform &coordinateTransform, double zValueScale, double zValueOffset );
106 ~QgsPointCloudLayerChunkLoader() override;
107
108 void start() override;
109 void cancel() override;
110 Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
111
112 private:
113 const QgsPointCloudLayerChunkLoaderFactory *mFactory;
114 std::unique_ptr<QgsPointCloud3DSymbolHandler> mHandler;
115 QgsPointCloud3DRenderContext mContext;
116 QFutureWatcher<void> *mFutureWatcher = nullptr;
117};
118
119
130class QgsPointCloudLayerChunkedEntity : public QgsChunkedEntity
131{
132 Q_OBJECT
133 public:
134 explicit QgsPointCloudLayerChunkedEntity( Qgs3DMapSettings *map, QgsPointCloudLayer *pcl, QgsPointCloudIndex index, const QgsCoordinateTransform &coordinateTransform, QgsPointCloud3DSymbol *symbol, float maxScreenError, bool showBoundingBoxes, double zValueScale, double zValueOffset, int pointBudget );
135
136 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
137
138 ~QgsPointCloudLayerChunkedEntity() override;
139
140 private slots:
141 void updateIndex();
142
143 private:
144 QgsPointCloudLayer *mLayer = nullptr;
145 std::unique_ptr<QgsChunkUpdaterFactory> mChunkUpdaterFactory;
146};
147
149
150#endif // QGSPOINTCLOUDLAYERCHUNKLOADER_P_H