Skip to content

Commit

Permalink
trigger loading of sub indexes using queued connection
Browse files Browse the repository at this point in the history
  • Loading branch information
uclaros authored and nyalldawson committed Oct 19, 2023
1 parent ca5041b commit 993c95d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/3d/qgsvirtualpointcloudentity_p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ QgsVirtualPointCloudEntity::QgsVirtualPointCloudEntity( QgsPointCloudLayer *laye
}

updateBboxEntity();
connect( this, &QgsVirtualPointCloudEntity::subIndexNeedsLoading, provider(), &QgsVirtualPointCloudProvider::loadSubIndex, Qt::QueuedConnection );
connect( provider(), &QgsVirtualPointCloudProvider::subIndexLoaded, this, &QgsVirtualPointCloudEntity::createChunkedEntityForSubIndex );

}

QList<QgsChunkedEntity *> QgsVirtualPointCloudEntity::chunkedEntities() const
Expand Down Expand Up @@ -120,7 +122,7 @@ void QgsVirtualPointCloudEntity::handleSceneUpdate( const SceneState &state )
// then once the camera changes we display as bbox depending on screen space error
const bool displayAsBbox = state.cameraPos.isNull() || sse < THRESHOLD;
if ( !displayAsBbox && !subIndexes.at( i ).index() )
provider()->loadSubIndex( i );
emit subIndexNeedsLoading( i );

setRenderSubIndexAsBbox( i, displayAsBbox );
if ( !displayAsBbox && mChunkedEntitiesMap.contains( i ) )
Expand Down
3 changes: 3 additions & 0 deletions src/3d/qgsvirtualpointcloudentity_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ class QgsVirtualPointCloudEntity : public Qgs3DMapSceneEntity
//! 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( int i, bool asBbox );

signals:
void subIndexNeedsLoading( int i );

private:
//! Updates the Bbox child entity to display the sub indexes set with setRenderSubIndexAsBbox()
void updateBboxEntity();
Expand Down

0 comments on commit 993c95d

Please sign in to comment.