QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
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
26
27QgsPointCloudStatsCalculationTask::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
36bool QgsPointCloudStatsCalculationTask::run()
37{
38 connect( mFeedback, &QgsFeedback::progressChanged, this, &QgsPointCloudStatsCalculationTask::setProgress );
39 return mCalculator.calculateStats( mFeedback, mAttributes, mPointLimit );
40}
41
42void QgsPointCloudStatsCalculationTask::cancel()
43{
44 mFeedback->cancel();
46}
47
48QgsPointCloudStatistics QgsPointCloudStatsCalculationTask::calculationResults() const
49{
50 return mCalculator.statistics();
51}
52
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:45
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.