QGIS API Documentation  3.21.0-Master (909859188c)
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;
51 
52  QgsCoordinateReferenceSystem crs() const override;
53  qint64 pointCount() const override;
54  QVariant metadataStatistic( const QString &attribute, QgsStatisticalSummary::Statistic statistic ) const override;
55  QVariantList metadataClasses( const QString &attribute ) const override;
56  QVariant metadataClassStatistic( const QString &attribute, const QVariant &value, QgsStatisticalSummary::Statistic statistic ) const override;
57  QVariantMap originalMetadata() const override { return mOriginalMetadata; }
58 
59  bool isValid() const override;
61 
62  protected:
63  bool loadSchema( const QByteArray &dataJson );
64  void loadManifest( const QByteArray &manifestJson );
65  bool loadSchema( QFile &f );
66  bool loadHierarchy();
67 
68  bool mIsValid = false;
69  QString mDataType;
70  QString mDirectory;
71  QString mWkt;
72 
73  qint64 mPointCount = 0;
74 
75  struct AttributeStatistics
76  {
77  int count = -1;
78  QVariant minimum;
79  QVariant maximum;
80  double mean = std::numeric_limits< double >::quiet_NaN();
81  double stDev = std::numeric_limits< double >::quiet_NaN();
82  double variance = std::numeric_limits< double >::quiet_NaN();
83  };
84 
85  QMap< QString, AttributeStatistics > mMetadataStats;
86 
87  QMap< QString, QMap< int, int > > mAttributeClasses;
88  QVariantMap mOriginalMetadata;
89 };
90 
92 #endif // QGSEPTPOINTCLOUDINDEX_H
Represents a indexed point cloud node in octree.
This class represents a coordinate reference system (CRS).
Base class for handling loading QgsPointCloudBlock asynchronously.
Base class for storing raw data from point cloud nodes.
Represents a indexed point clouds data in octree.
AccessType
The access type of the data, local is for local files and remote for remote files (over HTTP)
virtual qint64 pointCount() const =0
Returns the number of points in the point cloud.
virtual QgsPointCloudBlock * nodeData(const IndexedPointCloudNode &n, const QgsPointCloudRequest &request)=0
Returns node data block.
virtual AccessType accessType() const =0
Returns the access type of the data If the access type is Remote, data will be fetched from an HTTP s...
virtual bool isValid() const =0
Returns whether index is loaded and valid.
virtual QgsCoordinateReferenceSystem crs() const =0
Returns the coordinate reference system of the point cloud index.
virtual void load(const QString &fileName)=0
Loads the index from the file.
virtual QVariant metadataClassStatistic(const QString &attribute, const QVariant &value, QgsStatisticalSummary::Statistic statistic) const =0
Returns the statistic statistic of the class value of the attribute attribute.
virtual QVariant metadataStatistic(const QString &attribute, QgsStatisticalSummary::Statistic statistic) const =0
Returns the statistic statistic of attribute.
virtual QgsPointCloudBlockRequest * asyncNodeData(const IndexedPointCloudNode &n, const QgsPointCloudRequest &request)=0
Returns a handle responsible for loading a node data block.
virtual QVariantMap originalMetadata() const =0
Returns the original metadata map.
virtual QVariantList metadataClasses(const QString &attribute) const =0
Returns the classes of attribute.
Point cloud data request.
Statistic
Enumeration of flags that specify statistics to be calculated.