QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgspointcloudstatscalculationtask.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgspointcloudstatscalculationtask.cpp
3  --------------------
4  begin : April 2022
5  copyright : (C) 2022 by Belgacem Nedjima
6  email : belgacem dot nedjima at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
19 
20 #include "qgspointcloudindex.h"
21 #include "qgspointcloudrenderer.h"
22 
23 #include <QtConcurrent/QtConcurrent>
24 
26 
27 QgsPointCloudStatsCalculationTask::QgsPointCloudStatsCalculationTask( QgsPointCloudIndex *index, const QVector<QgsPointCloudAttribute> &attributes, qint64 pointLimit )
28  : QgsTask( tr( "Generating attributes statistics" ) )
29  , mCalculator( index )
30  , mAttributes( attributes )
31  , mPointLimit( pointLimit )
32 {
33  mFeedback = new QgsFeedback( this );
34 }
35 
36 bool QgsPointCloudStatsCalculationTask::run()
37 {
38  connect( mFeedback, &QgsFeedback::progressChanged, this, &QgsPointCloudStatsCalculationTask::setProgress );
39  return mCalculator.calculateStats( mFeedback, mAttributes, mPointLimit );
40 }
41 
42 void QgsPointCloudStatsCalculationTask::cancel()
43 {
44  mFeedback->cancel();
46 }
47 
48 QgsPointCloudStatistics QgsPointCloudStatsCalculationTask::calculationResults() const
49 {
50  return mCalculator.statistics();
51 }
52 
QgsPointCloudStatistics
Class used to store statistics of a point cloud dataset.
Definition: qgspointcloudstatistics.h:61
QgsTask::cancel
virtual void cancel()
Notifies the task that it should terminate.
Definition: qgstaskmanager.cpp:91
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:44
QgsFeedback::progressChanged
void progressChanged(double progress)
Emitted when the feedback object reports a progress change.
qgspointcloudindex.h
QgsPointCloudIndex
Represents a indexed point clouds data in octree.
Definition: qgspointcloudindex.h:163
qgspointcloudstatscalculationtask.h
qgspointcloudrenderer.h
QgsTask
Abstract base class for long running background tasks. Tasks can be controlled directly,...
Definition: qgstaskmanager.h:54