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