QGIS API Documentation 3.41.0-Master (3440c17df1d)
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 "qgschunkloader.h"
31#include "qgschunkedentity.h"
35
36#include <memory>
37
38#include <QFutureWatcher>
39#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
40#include <Qt3DRender/QGeometry>
41#include <Qt3DRender/QBuffer>
42#else
43#include <Qt3DCore/QGeometry>
44#include <Qt3DCore/QBuffer>
45#endif
46#include <QVector3D>
47
48#define SIP_NO_FILE
49
57class QgsPointCloudLayerChunkLoaderFactory : public QgsChunkLoaderFactory
58{
59 Q_OBJECT
60
61 public:
62
67 QgsPointCloudLayerChunkLoaderFactory( const Qgs3DRenderContext &context, const QgsCoordinateTransform &coordinateTransform, QgsPointCloudIndex *pc, QgsPointCloud3DSymbol *symbol,
68 double zValueScale, double zValueOffset, int pointBudget );
69
71 virtual QgsChunkLoader *createChunkLoader( QgsChunkNode *node ) const override;
72 virtual QgsChunkNode *createRootNode() const override;
73 virtual QVector<QgsChunkNode *> createChildren( QgsChunkNode *node ) const override;
74 virtual 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,
106 const QgsCoordinateTransform &coordinateTransform, double zValueScale, double zValueOffset );
107 ~QgsPointCloudLayerChunkLoader() override;
108
109 virtual void cancel() override;
110 virtual Qt3DCore::QEntity *createEntity( Qt3DCore::QEntity *parent ) override;
111
112 private:
113 const QgsPointCloudLayerChunkLoaderFactory *mFactory;
114 std::unique_ptr<QgsPointCloud3DSymbolHandler> mHandler;
116 QFutureWatcher<void> *mFutureWatcher = nullptr;
117};
118
119
130class QgsPointCloudLayerChunkedEntity : public QgsChunkedEntity
131{
132 Q_OBJECT
133 public:
134 explicit QgsPointCloudLayerChunkedEntity( Qgs3DMapSettings *map, QgsPointCloudIndex *pc, const QgsCoordinateTransform &coordinateTransform, QgsPointCloud3DSymbol *symbol, float maxScreenError, bool showBoundingBoxes,
135 double zValueScale, double zValueOffset, int pointBudget );
136
137 QVector<QgsRayCastingUtils::RayHit> rayIntersection( const QgsRayCastingUtils::Ray3D &ray, const QgsRayCastingUtils::RayCastContext &context ) const override;
138
139 ~QgsPointCloudLayerChunkedEntity();
140};
141
143
144#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.
Helper struct to store ray casting parameters.