/
qgsvirtualpointcloudentity_p.h
108 lines (89 loc) · 4.04 KB
/
qgsvirtualpointcloudentity_p.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/***************************************************************************
qgsvirtualpointcloudentity_p.h
--------------------------------------
Date : April 2023
Copyright : (C) 2023 by Stefanos Natsis
Email : uclaros at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSVIRTUALPOINTCLOUDENTITY_P_H
#define QGSVIRTUALPOINTCLOUDENTITY_P_H
#define SIP_NO_FILE
///@cond PRIVATE
//
// W A R N I N G
// -------------
//
// This file is not part of the QGIS API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
#include <Qt3DCore/QEntity>
#include "qgscoordinatetransform.h"
#include "qgspointcloudsubindex.h"
#include "qgschunkedentity_p.h"
class QgsAABB;
class QgsChunkBoundsEntity;
class QgsPointCloudLayer;
class QgsVirtualPointCloudProvider;
class QgsPointCloud3DSymbol;
class Qgs3DMapSettings;
/**
* \ingroup 3d
* \brief Implementation of entity that handles virtual point cloud sub indexes
*
* This entity is parent to a QgsChunkBoundsEntity that renders all sub indexes' bounding boxes, as well as all individual
* QgsPointCloudLayerChunkedEntities.
*
*
* \since QGIS 3.32
*/
class QgsVirtualPointCloudEntity : public Qt3DCore::QEntity
{
Q_OBJECT
public:
//! Constructs
QgsVirtualPointCloudEntity( QgsPointCloudLayer *layer, const Qgs3DMapSettings &map, const QgsCoordinateTransform &coordinateTransform, QgsPointCloud3DSymbol *symbol, float maxScreenError, bool showBoundingBoxes,
double zValueScale, double zValueOffset, int pointBudget );
//! This is called when the camera moves. It's responsible for loading new indexes and decides if subindex will be rendered as bbox or chunked entity.
void handleSceneUpdate( const QgsChunkedEntity::SceneState &state );
//! Updates the Bbox child entity to display the sub indexes set with setRenderSubIndexAsBbox()
void updateBboxEntity();
//! Returns a list with pointers to all child QgsPointCloudLayerChunkedEntity
QList<QgsChunkedEntity *> chunkedEntities() const;
//! Returns a pointer to the associated layer's provider
QgsVirtualPointCloudProvider *provider() const;
//! Returns the bounding box for sub index \a i
QgsAABB boundingBox( int i ) const;
signals:
//! Emitted when a new point cloud chunked entity has been created for a sub index
void newEntityCreated( QgsChunkedEntity *entity );
public slots:
//! Creates a child QgsPointCloudLayerChunkedEntity for the \a i th sub index
void createChunkedEntityForSubIndex( int i );
//! If \a asBbox is TRUE only the bounding box will be rendered for the sub index \a i. If it is FALSE, the sub index will be rendered as a chunked entity.
void setRenderSubIndexAsBbox( const int i, const bool asBbox );
private:
QgsPointCloudLayer *mLayer = nullptr;
QList<QgsChunkedEntity *> mChunkedEntities;
QMap<int, QgsChunkedEntity *> mChunkedEntitiesMap;
QgsChunkBoundsEntity *mBboxesEntity = nullptr;
QList<QgsAABB> mBboxes;
const Qgs3DMapSettings &mMap;
QgsCoordinateTransform mCoordinateTransform;
QgsPointCloudIndex *mPointCloudIndex;
std::unique_ptr< QgsPointCloud3DSymbol > mSymbol;
double mZValueScale = 1.0;
double mZValueOffset = 0;
int mPointBudget = 1000000;
float mMaximumScreenSpaceError = -1.;
bool mShowBoundingBoxes = false;
};
/// @endcond
#endif // QGSVIRTUALPOINTCLOUDENTITY_P_H