QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
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:
66
67#ifndef SIP_RUN
69 QgsPointCloudStatistics( int sampledPointsCount, const QMap<QString, QgsPointCloudAttributeStatistics> &stats );
70#endif
71
73 int sampledPointsCount() const { return mSampledPointsCount; }
74
76 void clear();
77
79 void clear( const QVector<QgsPointCloudAttribute> &attributes );
80
82 QgsPointCloudAttributeStatistics statisticsOf( const QString &attribute ) const;
83
85 QList<int> classesOf( const QString &attribute ) const;
86
87#ifndef SIP_RUN
88
93 QMap<int, int> availableClasses( const QString &attribute ) const;
94#endif
95
100 double minimum( const QString &attribute ) const;
101
106 double maximum( const QString &attribute ) const;
107
112 double mean( const QString &attribute ) const;
113
118 double stDev( const QString &attribute ) const;
119
121 void combineWith( const QgsPointCloudStatistics &stats );
122
124 QByteArray toStatisticsJson() const;
125
127 static QgsPointCloudStatistics fromStatisticsJson( QByteArray stats );
128
129#ifndef SIP_RUN
131 QMap<QString, QgsPointCloudAttributeStatistics> statisticsMap() const { return mStatisticsMap; };
132#endif
133 private:
134 int mSampledPointsCount = 0;
135 QMap<QString, QgsPointCloudAttributeStatistics> mStatisticsMap;
136
138 static QJsonObject attributeStatisticsToJson( const QgsPointCloudAttributeStatistics &stats );
139
141 static QgsPointCloudAttributeStatistics fromAttributeStatisticsJson( QJsonObject &stats );
142};
143
144#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.