Skip to content
Permalink
Browse files

Use additive strategy for point clouds

  • Loading branch information
wonder-sk authored and nyalldawson committed Oct 26, 2020
1 parent 66ce1a6 commit c0f50891eb3d0cec75c92a690efaa1204f10ecb8
@@ -271,6 +271,14 @@ void QgsChunkedEntity::update( QgsChunkNode *node, const SceneState &state )
{
// error is not acceptable and children are ready to be used - recursive descent

if ( mAdditiveStrategy )
{
// With additive strategy enabled, also all parent nodes are added to active nodes.
// This is desired when child nodes add more detailed data rather than just replace
// coarser data in parents. We use this e.g. with point cloud data.
mActiveNodes << node;
}

QgsChunkNode *const *children = node->children();
for ( int i = 0; i < node->childCount(); ++i )
update( children[i], state );
@@ -100,6 +100,16 @@ class QgsChunkedEntity : public Qt3DCore::QEntity
//! Returns whether object picking is currently enabled
bool hasPickingEnabled() const { return mPickingEnabled; }

//! Sets whether additive strategy is enabled - see usingAditiveStrategy()
void setUsingAdditiveStrategy( bool additive ) { mAdditiveStrategy = additive; }

/**
* Returns whether additive strategy is enabled.
* With additive strategy enabled, also all parent nodes are added to active nodes.
* This is desired when child nodes add more detailed data rather than just replace coarser data in parents.
*/
bool usingAditiveStrategy() const { return mAdditiveStrategy; }

protected:
//! Cancels the background job that is currently in progress
void cancelActiveJob( QgsChunkQueueJob *job );
@@ -174,6 +184,12 @@ class QgsChunkedEntity : public Qt3DCore::QEntity
//! If picking is enabled, QObjectPicker objects will be assigned to chunks and pickedObject() signals fired on mouse click
bool mPickingEnabled = false;

/**
* With additive strategy enabled, also all parent nodes are added to active nodes.
* This is desired when child nodes add more detailed data rather than just replace coarser data in parents.
*/
bool mAdditiveStrategy = false;

bool mIsValid = true;
};

@@ -333,6 +333,7 @@ QgsPointCloudLayerChunkedEntity::QgsPointCloudLayerChunkedEntity( QgsPointCloudI
: QgsChunkedEntity( 5, // max. allowed screen error (in pixels) -- // TODO
new QgsPointCloudLayerChunkLoaderFactory( map, pc ), true )
{
setUsingAdditiveStrategy( true );
setShowBoundingBoxes( true );
}

0 comments on commit c0f5089

Please sign in to comment.
You can’t perform that action at this time.