QGIS API Documentation 4.3.0-Master (0cef2469b72)
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"
36#include "qgspointcloudindex.h"
38
39#include <QFutureWatcher>
40#include <QVector3D>
41#include <Qt3DCore/QBuffer>
42#include <Qt3DCore/QGeometry>
43
44#define SIP_NO_FILE
45
54class QgsPointCloudLayerChunkLoader : public QgsChunkLoader
55{
56 Q_OBJECT
57
58 public:
63 QgsPointCloudLayerChunkLoader(
64 const Qgs3DRenderContext &context, const QgsCoordinateTransform &coordinateTransform, QgsPointCloudIndex pc, QgsPointCloud3DSymbol *symbol, double zValueScale, double zValueOffset
65 );
66
67 QFuture<QgsChunkLoaderResult> loadChunk( QgsChunkNode *node ) override;
68 QgsChunkNode *createRootNode() const override;
69 QFuture<QVector<QgsChunkNode *>> createChildren( QgsChunkNode *node ) override;
70 int primitivesCount( QgsChunkNode *node ) const override;
71
72 private:
74 QFuture<void> fetchHierarchyForNode( const QgsPointCloudNodeId &nodeId );
76 QVector<QgsChunkNode *> createChildrenInner( QgsChunkNode *node );
77
78 Qgs3DRenderContext mRenderContext;
79 QgsCoordinateTransform mCoordinateTransform;
80 QgsPointCloudIndex mPointCloudIndex;
81 std::unique_ptr<QgsPointCloud3DSymbol> mSymbol;
82 double mZValueScale = 1.0;
83 double mZValueOffset = 0;
84 QgsRectangle mExtent;
85
86 friend class QgsPointCloudLayerChunkedEntity;
87};
88
89
100class QgsPointCloudLayerChunkedEntity : public QgsChunkedEntity
101{
102 Q_OBJECT
103 public:
104 explicit QgsPointCloudLayerChunkedEntity(
105 Qgs3DMapSettings *map,
106 QgsPointCloudLayer *pcl,
107 const int indexPosition,
108 const QgsCoordinateTransform &coordinateTransform,
109 QgsPointCloud3DSymbol *symbol,
110 float maxScreenError,
111 bool showBoundingBoxes,
112 double zValueScale,
113 double zValueOffset,
114 int pointBudget
115 );
116
117 QList<QgsRayCastHit> rayIntersection( const QgsRay3D &ray, const QgsRayCastContext &context ) const override;
118
119 ~QgsPointCloudLayerChunkedEntity() override;
120
121 private slots:
122 void updateIndex();
123
124 private:
132 static QgsPointCloudIndex resolveIndex( const QgsPointCloudLayer *pcl, int indexPosition );
133
134 QgsPointCloudLayer *mLayer = nullptr;
135 int mIndexPosition;
136};
137
139
140#endif // QGSPOINTCLOUDLAYERCHUNKLOADER_P_H