QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
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 <QVector>
24#include <QSet>
25#include <QVariant>
26#include <QtMath>
27
30
40{
41 double minimum = std::numeric_limits<double>::max();
42 double maximum = std::numeric_limits<double>::lowest();
43 double mean = 0;
44 double stDev = 0;
45 int count = 0;
46#ifndef SIP_RUN
47 QMap<int, int> classCount;
49 void cumulateStatistics( const QgsPointCloudAttributeStatistics &stats );
50#endif
51};
52
61class CORE_EXPORT QgsPointCloudStatistics
62{
63 public:
65
66#ifndef SIP_RUN
68 QgsPointCloudStatistics( int sampledPointsCount, const QMap<QString, QgsPointCloudAttributeStatistics> &stats );
69#endif
70
72 int sampledPointsCount() const { return mSampledPointsCount; }
73
75 void clear();
76
78 void clear( const QVector<QgsPointCloudAttribute> &attributes );
79
81 QgsPointCloudAttributeStatistics statisticsOf( const QString &attribute ) const;
82
84 QList<int> classesOf( const QString &attribute ) const;
85
86#ifndef SIP_RUN
87
92 QMap<int, int> availableClasses( const QString &attribute ) const;
93#endif
94
99 double minimum( const QString &attribute ) const;
100
105 double maximum( const QString &attribute ) const;
106
111 double mean( const QString &attribute ) const;
112
117 double stDev( const QString &attribute ) const;
118
120 void combineWith( const QgsPointCloudStatistics &stats );
121
123 QByteArray toStatisticsJson() const;
124
126 static QgsPointCloudStatistics fromStatisticsJson( QByteArray stats );
127
128#ifndef SIP_RUN
130 QMap<QString, QgsPointCloudAttributeStatistics> statisticsMap() const { return mStatisticsMap; };
131#endif
132 private:
133 int mSampledPointsCount = 0;
134 QMap<QString, QgsPointCloudAttributeStatistics> mStatisticsMap;
135
137 static QJsonObject attributeStatisticsToJson( const QgsPointCloudAttributeStatistics &stats );
138
140 static QgsPointCloudAttributeStatistics fromAttributeStatisticsJson( QJsonObject &stats );
141};
142
143#endif // QGSPOINTCLOUDSTATISTICS_H
Represents a indexed point cloud node in octree.
Attribute for point cloud data pair of name and size in bytes.
Class 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.
Class used to store statistics of one attribute of a point cloud dataset.