Skip to content

Commit 62cd6b3

Browse files
committedJan 12, 2020
Add information about pending jobs also from non-terrain entities
1 parent 5b9b2e4 commit 62cd6b3

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed
 

‎src/3d/qgs3dmapscene.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ int Qgs3DMapScene::terrainPendingJobsCount() const
177177
return mTerrain ? mTerrain->pendingJobsCount() : 0;
178178
}
179179

180+
int Qgs3DMapScene::totalPendingJobsCount() const
181+
{
182+
int count = 0;
183+
for ( QgsChunkedEntity *entity : qgis::as_const( mChunkEntities ) )
184+
count += entity->pendingJobsCount();
185+
return count;
186+
}
187+
180188
void Qgs3DMapScene::registerPickHandler( Qgs3DMapScenePickHandler *pickHandler )
181189
{
182190
if ( mPickHandlers.isEmpty() )
@@ -420,6 +428,7 @@ void Qgs3DMapScene::createTerrainDeferred()
420428

421429
mTerrainUpdateScheduled = false;
422430

431+
connect( mTerrain, &QgsChunkedEntity::pendingJobsCountChanged, this, &Qgs3DMapScene::totalPendingJobsCountChanged );
423432
connect( mTerrain, &QgsTerrainEntity::pendingJobsCountChanged, this, &Qgs3DMapScene::terrainPendingJobsCountChanged );
424433

425434
emit terrainEntityChanged();
@@ -567,6 +576,8 @@ void Qgs3DMapScene::addLayerEntity( QgsMapLayer *layer )
567576
{
568577
finalizeNewEntity( entity );
569578
} );
579+
580+
connect( chunkedNewEntity, &QgsChunkedEntity::pendingJobsCountChanged, this, &Qgs3DMapScene::totalPendingJobsCountChanged );
570581
}
571582
}
572583
}

‎src/3d/qgs3dmapscene.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ class _3D_EXPORT Qgs3DMapScene : public Qt3DCore::QEntity
7373
//! Returns number of pending jobs of the terrain entity
7474
int terrainPendingJobsCount() const;
7575

76+
//! Returns number of pending jobs for all chunked entities
77+
int totalPendingJobsCount() const;
78+
7679
//! Enumeration of possible states of the 3D scene
7780
enum SceneState
7881
{
@@ -99,6 +102,8 @@ class _3D_EXPORT Qgs3DMapScene : public Qt3DCore::QEntity
99102
void terrainEntityChanged();
100103
//! Emitted when the number of terrain's pending jobs changes
101104
void terrainPendingJobsCountChanged();
105+
//! Emitted when the total number of pending jobs changes
106+
void totalPendingJobsCountChanged();
102107
//! Emitted when the scene's state has changed
103108
void sceneStateChanged();
104109

‎src/app/3d/qgs3dmapcanvasdockwidget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Qgs3DMapCanvasDockWidget::Qgs3DMapCanvasDockWidget( QWidget *parent )
141141

142142
setWidget( contentsWidget );
143143

144-
onTerrainPendingJobsCountChanged();
144+
onTotalPendingJobsCountChanged();
145145
}
146146

147147
void Qgs3DMapCanvasDockWidget::saveAsImage()
@@ -206,7 +206,7 @@ void Qgs3DMapCanvasDockWidget::setMapSettings( Qgs3DMapSettings *map )
206206
{
207207
mCanvas->setMap( map );
208208

209-
connect( mCanvas->scene(), &Qgs3DMapScene::terrainPendingJobsCountChanged, this, &Qgs3DMapCanvasDockWidget::onTerrainPendingJobsCountChanged );
209+
connect( mCanvas->scene(), &Qgs3DMapScene::totalPendingJobsCountChanged, this, &Qgs3DMapCanvasDockWidget::onTotalPendingJobsCountChanged );
210210

211211
mAnimationWidget->setCameraController( mCanvas->scene()->cameraController() );
212212
mAnimationWidget->setMap( map );
@@ -278,9 +278,9 @@ void Qgs3DMapCanvasDockWidget::onMainCanvasColorChanged()
278278
mCanvas->map()->setBackgroundColor( mMainCanvas->canvasColor() );
279279
}
280280

281-
void Qgs3DMapCanvasDockWidget::onTerrainPendingJobsCountChanged()
281+
void Qgs3DMapCanvasDockWidget::onTotalPendingJobsCountChanged()
282282
{
283-
int count = mCanvas->scene() ? mCanvas->scene()->terrainPendingJobsCount() : 0;
283+
int count = mCanvas->scene() ? mCanvas->scene()->totalPendingJobsCount() : 0;
284284
mProgressPendingJobs->setVisible( count );
285285
mLabelPendingJobs->setVisible( count );
286286
if ( count )

‎src/app/3d/qgs3dmapcanvasdockwidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Qgs3DMapCanvasDockWidget : public QgsDockWidget
5757

5858
void onMainCanvasLayersChanged();
5959
void onMainCanvasColorChanged();
60-
void onTerrainPendingJobsCountChanged();
60+
void onTotalPendingJobsCountChanged();
6161

6262
private:
6363
Qgs3DMapCanvas *mCanvas = nullptr;

0 commit comments

Comments
 (0)
Please sign in to comment.