QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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// clang-format off
33% ModuleHeaderCode
35% End
36// clang-format on
37#endif
38
48{
49 double minimum = std::numeric_limits<double>::max();
50 double maximum = std::numeric_limits<double>::lowest();
51 double mean = 0;
52 double stDev = 0;
53 int count = 0;
54#ifndef SIP_RUN
55 QMap<int, int> classCount;
58#endif
59
64 int singleClassCount( int cls ) const;
65};
66
75class CORE_EXPORT QgsPointCloudStatistics
76{
77 public:
79
80#ifndef SIP_RUN
82 QgsPointCloudStatistics( int sampledPointsCount, const QMap<QString, QgsPointCloudAttributeStatistics> &stats );
83#endif
84
86 int sampledPointsCount() const { return mSampledPointsCount; }
87
89 void clear();
90
92 void clear( const QVector<QgsPointCloudAttribute> &attributes );
93
95 QgsPointCloudAttributeStatistics statisticsOf( const QString &attribute ) const;
96
98 QList<int> classesOf( const QString &attribute ) const;
99
100#ifndef SIP_RUN
101
106 QMap<int, int> availableClasses( const QString &attribute ) const;
107#endif
108
113 double minimum( const QString &attribute ) const;
114
119 double maximum( const QString &attribute ) const;
120
125 double mean( const QString &attribute ) const;
126
131 double stDev( const QString &attribute ) const;
132
134 void combineWith( const QgsPointCloudStatistics &stats );
135
137 QByteArray toStatisticsJson() const;
138
140 static QgsPointCloudStatistics fromStatisticsJson( const QByteArray &stats );
141
142#ifndef SIP_RUN
144 QMap<QString, QgsPointCloudAttributeStatistics> statisticsMap() const { return mStatisticsMap; };
145#endif
146 private:
147 int mSampledPointsCount = 0;
148 QMap<QString, QgsPointCloudAttributeStatistics> mStatisticsMap;
149
151 static QJsonObject attributeStatisticsToJson( const QgsPointCloudAttributeStatistics &stats );
152
154 static QgsPointCloudAttributeStatistics fromAttributeStatisticsJson( QJsonObject &stats );
155};
156
157#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.