QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgspointcloudstatistics.h
Go to the documentation of this file.
1/***************************************************************************
2 qgspointcloudstatistics.h
3 --------------------
4 begin : May 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
18#ifndef QGSPOINTCLOUDSTATISTICS_H
19#define QGSPOINTCLOUDSTATISTICS_H
20
21#include "qgis_core.h"
22
23#include <QSet>
24#include <QVariant>
25#include <QVector>
26#include <QtMath>
27
30
31#ifdef SIP_RUN
32% ModuleHeaderCode
34% End
35#endif
36
46{
47 double minimum = std::numeric_limits<double>::max();
48 double maximum = std::numeric_limits<double>::lowest();
49 double mean = 0;
50 double stDev = 0;
51 int count = 0;
52#ifndef SIP_RUN
53 QMap<int, int> classCount;
56#endif
57
62 int singleClassCount( int cls ) const;
63};
64
73class CORE_EXPORT QgsPointCloudStatistics
74{
75 public:
77
78#ifndef SIP_RUN
80 QgsPointCloudStatistics( int sampledPointsCount, const QMap<QString, QgsPointCloudAttributeStatistics> &stats );
81#endif
82
84 int sampledPointsCount() const { return mSampledPointsCount; }
85
87 void clear();
88
90 void clear( const QVector<QgsPointCloudAttribute> &attributes );
91
93 QgsPointCloudAttributeStatistics statisticsOf( const QString &attribute ) const;
94
96 QList<int> classesOf( const QString &attribute ) const;
97
98#ifndef SIP_RUN
99
104 QMap<int, int> availableClasses( const QString &attribute ) const;
105#endif
106
111 double minimum( const QString &attribute ) const;
112
117 double maximum( const QString &attribute ) const;
118
123 double mean( const QString &attribute ) const;
124
129 double stDev( const QString &attribute ) const;
130
132 void combineWith( const QgsPointCloudStatistics &stats );
133
135 QByteArray toStatisticsJson() const;
136
138 static QgsPointCloudStatistics fromStatisticsJson( const QByteArray &stats );
139
140#ifndef SIP_RUN
142 QMap<QString, QgsPointCloudAttributeStatistics> statisticsMap() const { return mStatisticsMap; };
143#endif
144 private:
145 int mSampledPointsCount = 0;
146 QMap<QString, QgsPointCloudAttributeStatistics> mStatisticsMap;
147
149 static QJsonObject attributeStatisticsToJson( const QgsPointCloudAttributeStatistics &stats );
150
152 static QgsPointCloudAttributeStatistics fromAttributeStatisticsJson( QJsonObject &stats );
153};
154
155#endif // QGSPOINTCLOUDSTATISTICS_H
Attribute for point cloud data pair of name and size in bytes.
Represents an indexed point cloud node's position in octree.
Used to store statistics of a point cloud dataset.
int sampledPointsCount() const
Returns the number of points used to calculate the statistics.
QMap< QString, QgsPointCloudAttributeStatistics > statisticsMap() const
Returns a map object containing all the statistics.
Stores statistics of one attribute of a point cloud dataset.
void cumulateStatistics(const QgsPointCloudAttributeStatistics &stats)
Updates the current point cloud statistics to hold the cumulation of the current statistics and stats...
int singleClassCount(int cls) const
Returns the count of points in given class or -1 on error.