Skip to content
Permalink
Browse files

fix bug with nodes count is small

  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Apr 8, 2021
1 parent 006e320 commit d3e32dc4358dccea41b7b385cb4cb78c4a71c874
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/core/pointcloud/qgspointcloudlayerrenderer.cpp
@@ -238,12 +238,13 @@ int QgsPointCloudLayerRenderer::renderNodesAsync( const QVector<IndexedPointClou
QElapsedTimer downloadTimer;
downloadTimer.start();

int groupSize = 4;
const int groupSize = 4;
for ( int groupIndex = 0; groupIndex < nodes.size(); groupIndex += groupSize )
{
// Async loading of nodes
QVector<QgsPointCloudBlockRequest *> blockRequests( std::min( nodes.size() - groupIndex, groupSize ), nullptr );
QVector<bool> finishedLoadingBlock( std::min( nodes.size() - groupIndex, groupSize ), false );
const int currentGroupSize = std::min( std::max( nodes.size() - groupIndex, 0 ), groupSize );
QVector<QgsPointCloudBlockRequest *> blockRequests( currentGroupSize, nullptr );
QVector<bool> finishedLoadingBlock( currentGroupSize, false );
QEventLoop loop;

// Note: All capture by reference warnings here shouldn't be an issue since we have an event loop, so locals won't be deallocated

0 comments on commit d3e32dc

Please sign in to comment.