QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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 "qgschunkloader_p.h"
32#include "qgschunkedentity_p.h"
36
37#include <memory>
38
39#include <QFutureWatcher>
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 <Qt3DRender/QMaterial>
48#include <QVector3D>
49
50#define SIP_NO_FILE
51
59class QgsPointCloudLayerChunkLoaderFactory : public QgsChunkLoaderFactory
60{
61 Q_OBJECT
62
63 public:
64
69 QgsPointCloudLayerChunkLoaderFactory( const Qgs3DMapSettings &map, const QgsCoordinateTransform &coordinateTransform, QgsPointCloudIndex *pc, QgsPointCloud3DSymbol *symbol,
70 double zValueScale, double zValueOffset, int pointBudget );
71
73 virtual QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
74 virtual QgsChunkNode *createRootNode() const override;
75 virtual QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
76 virtual int primitivesCount( QgsChunkNode *node ) const override;
77 const Qgs3DMapSettings &mMap;
78 QgsCoordinateTransform mCoordinateTransform;
79 QgsPointCloudIndex *mPointCloudIndex;
80 std::unique_ptr< QgsPointCloud3DSymbol > mSymbol;
81 double mZValueScale = 1.0;
82 double mZValueOffset = 0;
83 int mPointBudget = 1000000;
84 bool mTriangulate = false;
85 QgsRectangle mExtent;
86};
87
88
97class QgsPointCloudLayerChunkLoader : public QgsChunkLoader
98{
99 Q_OBJECT
100
101 public:
102
107 QgsPointCloudLayerChunkLoader( const QgsPointCloudLayerChunkLoaderFactory *factory, QgsChunkNode *node, std::unique_ptr< QgsPointCloud3DSymbol > symbol,
108 const QgsCoordinateTransform &coordinateTransform, double zValueScale, double zValueOffset );
109 ~QgsPointCloudLayerChunkLoader() override;
110
111 virtual void cancel() override;
112 virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
113
114 private:
115 const QgsPointCloudLayerChunkLoaderFactory *mFactory;
116 std::unique_ptr<QgsPointCloud3DSymbolHandler> mHandler;
118 QFutureWatcher<void> *mFutureWatcher = nullptr;
119};
120
121
132class QgsPointCloudLayerChunkedEntity : public QgsChunkedEntity
133{
134 Q_OBJECT
135 public:
136 explicit QgsPointCloudLayerChunkedEntity( QgsPointCloudIndex *pc, const Qgs3DMapSettings &map, const QgsCoordinateTransform &coordinateTransform, QgsPointCloud3DSymbol *symbol, float maxScreenError, bool showBoundingBoxes,
137 double zValueScale, double zValueOffset, int pointBudget );
138
139 QVector<QgsRayCastingUtils::RayHit> rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QgsRayCastingUtils::RayCastContext &context ) const override;
140
141 ~QgsPointCloudLayerChunkedEntity();
142};
143
145
146#endif // QGSPOINTCLOUDLAYERCHUNKLOADER_P_H
Class for doing transforms between two map coordinate systems.
Encapsulates the render context for a 3D point cloud rendering operation.
Represents a indexed point clouds data in octree.
A rectangle specified with double values.
Definition: qgsrectangle.h:42