QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
qgseptpointcloudindex.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspointcloudindex.h
3  --------------------
4  begin : October 2020
5  copyright : (C) 2020 by Peter Petrik
6  email : zilolv 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 QGSEPTPOINTCLOUDINDEX_H
19 #define QGSEPTPOINTCLOUDINDEX_H
20 
21 #include <QObject>
22 #include <QString>
23 #include <QHash>
24 #include <QStringList>
25 #include <QVector>
26 #include <QList>
27 #include <QFile>
28 
29 #include "qgspointcloudindex.h"
30 #include "qgspointcloudattribute.h"
31 #include "qgsstatisticalsummary.h"
32 #include "qgis_sip.h"
33 
35 #define SIP_NO_FILE
36 
38 
39 class CORE_EXPORT QgsEptPointCloudIndex: public QgsPointCloudIndex
40 {
41  Q_OBJECT
42  public:
43 
44  explicit QgsEptPointCloudIndex();
45  ~QgsEptPointCloudIndex();
46 
47  void load( const QString &fileName ) override;
48 
49  QgsPointCloudBlock *nodeData( const IndexedPointCloudNode &n, const QgsPointCloudRequest &request ) override;
50 
52  int pointCount() const;
53  QVariant metadataStatistic( const QString &attribute, QgsStatisticalSummary::Statistic statistic ) const;
54  QVariantList metadataClasses( const QString &attribute ) const;
55  QVariant metadataClassStatistic( const QString &attribute, const QVariant &value, QgsStatisticalSummary::Statistic statistic ) const;
56 
57  QVariantMap originalMetadata() const { return mOriginalMetadata; }
58  bool isValid() const override;
59 
60  private:
61  bool loadSchema( QFile &f );
62  bool loadHierarchy();
63 
64  bool mIsValid = false;
65  QString mDataType;
66  QString mDirectory;
67  QString mWkt;
68 
69  int mPointCount = 0;
70 
71  struct AttributeStatistics
72  {
73  int count = -1;
74  QVariant minimum;
75  QVariant maximum;
76  double mean = std::numeric_limits< double >::quiet_NaN();
77  double stDev = std::numeric_limits< double >::quiet_NaN();
78  double variance = std::numeric_limits< double >::quiet_NaN();
79  };
80 
81  QMap< QString, AttributeStatistics > mMetadataStats;
82 
83  QMap< QString, QMap< int, int > > mAttributeClasses;
84  QVariantMap mOriginalMetadata;
85 };
86 
88 #endif // QGSEPTPOINTCLOUDINDEX_H
Represents a indexed point cloud node in octree.
This class represents a coordinate reference system (CRS).
Base class for storing raw data from point cloud nodes.
Represents a indexed point clouds data in octree.
virtual QgsPointCloudBlock * nodeData(const IndexedPointCloudNode &n, const QgsPointCloudRequest &request)=0
Returns node data block.
virtual bool isValid() const =0
Returns whether index is loaded and valid.
virtual void load(const QString &fileName)=0
Loads the index from the file.
Point cloud data request.
Statistic
Enumeration of flags that specify statistics to be calculated.
const QgsCoordinateReferenceSystem & crs