QGIS API Documentation 3.41.0-Master (af5edcb665c)
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
56 int singleClassCount( int cls ) const;
57};
58
67class CORE_EXPORT QgsPointCloudStatistics
68{
69 public:
71
72#ifndef SIP_RUN
74 QgsPointCloudStatistics( int sampledPointsCount, const QMap<QString, QgsPointCloudAttributeStatistics> &stats );
75#endif
76
78 int sampledPointsCount() const { return mSampledPointsCount; }
79
81 void clear();
82
84 void clear( const QVector<QgsPointCloudAttribute> &attributes );
85
87 QgsPointCloudAttributeStatistics statisticsOf( const QString &attribute ) const;
88
90 QList<int> classesOf( const QString &attribute ) const;
91
92#ifndef SIP_RUN
93
98 QMap<int, int> availableClasses( const QString &attribute ) const;
99#endif
100
105 double minimum( const QString &attribute ) const;
106
111 double maximum( const QString &attribute ) const;
112
117 double mean( const QString &attribute ) const;
118
123 double stDev( const QString &attribute ) const;
124
126 void combineWith( const QgsPointCloudStatistics &stats );
127
129 QByteArray toStatisticsJson() const;
130
132 static QgsPointCloudStatistics fromStatisticsJson( const QByteArray &stats );
133
134#ifndef SIP_RUN
136 QMap<QString, QgsPointCloudAttributeStatistics> statisticsMap() const { return mStatisticsMap; };
137#endif
138 private:
139 int mSampledPointsCount = 0;
140 QMap<QString, QgsPointCloudAttributeStatistics> mStatisticsMap;
141
143 static QJsonObject attributeStatisticsToJson( const QgsPointCloudAttributeStatistics &stats );
144
146 static QgsPointCloudAttributeStatistics fromAttributeStatisticsJson( QJsonObject &stats );
147};
148
149#endif // QGSPOINTCLOUDSTATISTICS_H
Attribute for point cloud data pair of name and size in bytes.
Represents a indexed point cloud node's position in octree.
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.