Skip to content

Commit c0f5089

Browse files
wonder-sknyalldawson
authored andcommittedOct 26, 2020
Use additive strategy for point clouds
1 parent 66ce1a6 commit c0f5089

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
 

‎src/3d/chunks/qgschunkedentity_p.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,14 @@ void QgsChunkedEntity::update( QgsChunkNode *node, const SceneState &state )
271271
{
272272
// error is not acceptable and children are ready to be used - recursive descent
273273

274+
if ( mAdditiveStrategy )
275+
{
276+
// With additive strategy enabled, also all parent nodes are added to active nodes.
277+
// This is desired when child nodes add more detailed data rather than just replace
278+
// coarser data in parents. We use this e.g. with point cloud data.
279+
mActiveNodes << node;
280+
}
281+
274282
QgsChunkNode *const *children = node->children();
275283
for ( int i = 0; i < node->childCount(); ++i )
276284
update( children[i], state );

‎src/3d/chunks/qgschunkedentity_p.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ class QgsChunkedEntity : public Qt3DCore::QEntity
100100
//! Returns whether object picking is currently enabled
101101
bool hasPickingEnabled() const { return mPickingEnabled; }
102102

103+
//! Sets whether additive strategy is enabled - see usingAditiveStrategy()
104+
void setUsingAdditiveStrategy( bool additive ) { mAdditiveStrategy = additive; }
105+
106+
/**
107+
* Returns whether additive strategy is enabled.
108+
* With additive strategy enabled, also all parent nodes are added to active nodes.
109+
* This is desired when child nodes add more detailed data rather than just replace coarser data in parents.
110+
*/
111+
bool usingAditiveStrategy() const { return mAdditiveStrategy; }
112+
103113
protected:
104114
//! Cancels the background job that is currently in progress
105115
void cancelActiveJob( QgsChunkQueueJob *job );
@@ -174,6 +184,12 @@ class QgsChunkedEntity : public Qt3DCore::QEntity
174184
//! If picking is enabled, QObjectPicker objects will be assigned to chunks and pickedObject() signals fired on mouse click
175185
bool mPickingEnabled = false;
176186

187+
/**
188+
* With additive strategy enabled, also all parent nodes are added to active nodes.
189+
* This is desired when child nodes add more detailed data rather than just replace coarser data in parents.
190+
*/
191+
bool mAdditiveStrategy = false;
192+
177193
bool mIsValid = true;
178194
};
179195

‎src/3d/qgspointcloudlayerchunkloader_p.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ QgsPointCloudLayerChunkedEntity::QgsPointCloudLayerChunkedEntity( QgsPointCloudI
333333
: QgsChunkedEntity( 5, // max. allowed screen error (in pixels) -- // TODO
334334
new QgsPointCloudLayerChunkLoaderFactory( map, pc ), true )
335335
{
336+
setUsingAdditiveStrategy( true );
336337
setShowBoundingBoxes( true );
337338
}
338339

0 commit comments

Comments
 (0)
Please sign in to comment.