QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
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"
22
23#include <QtConcurrent/QtConcurrent>
24
25#include "moc_qgspointcloudstatscalculationtask.cpp"
26
28
29QgsPointCloudStatsCalculationTask::QgsPointCloudStatsCalculationTask( QgsPointCloudIndex index, const QVector<QgsPointCloudAttribute> &attributes, qint64 pointLimit )
30 : QgsTask( tr( "Generating attributes statistics" ) )
31 , mCalculator( std::move( index ) )
32 , mAttributes( attributes )
33 , mPointLimit( pointLimit )
34{
35 mFeedback = new QgsFeedback( this );
36}
37
38bool QgsPointCloudStatsCalculationTask::run()
39{
40 connect( mFeedback, &QgsFeedback::progressChanged, this, &QgsPointCloudStatsCalculationTask::setProgress );
41 return mCalculator.calculateStats( mFeedback, mAttributes, mPointLimit );
42}
43
44void QgsPointCloudStatsCalculationTask::cancel()
45{
46 mFeedback->cancel();
48}
49
50QgsPointCloudStatistics QgsPointCloudStatsCalculationTask::calculationResults() const
51{
52 return mCalculator.statistics();
53}
54
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
void progressChanged(double progress)
Emitted when the feedback object reports a progress change.
Smart pointer for QgsAbstractPointCloudIndex.
Used to store statistics of a point cloud dataset.
Abstract base class for long running background tasks.
virtual void cancel()
Notifies the task that it should terminate.