QGIS API Documentation 3.41.0-Master (25ec5511245)
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#include "moc_qgspointcloudstatscalculationtask.cpp"
20
21#include "qgspointcloudindex.h"
23
24#include <QtConcurrent/QtConcurrent>
25
27
28QgsPointCloudStatsCalculationTask::QgsPointCloudStatsCalculationTask( QgsPointCloudIndex *index, const QVector<QgsPointCloudAttribute> &attributes, qint64 pointLimit )
29 : QgsTask( tr( "Generating attributes statistics" ) )
30 , mCalculator( index )
31 , mAttributes( attributes )
32 , mPointLimit( pointLimit )
33{
34 mFeedback = new QgsFeedback( this );
35}
36
37bool QgsPointCloudStatsCalculationTask::run()
38{
39 connect( mFeedback, &QgsFeedback::progressChanged, this, &QgsPointCloudStatsCalculationTask::setProgress );
40 return mCalculator.calculateStats( mFeedback, mAttributes, mPointLimit );
41}
42
43void QgsPointCloudStatsCalculationTask::cancel()
44{
45 mFeedback->cancel();
47}
48
49QgsPointCloudStatistics QgsPointCloudStatsCalculationTask::calculationResults() const
50{
51 return mCalculator.statistics();
52}
53
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.
Represents a indexed point clouds data in octree.
Class 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.