QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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  std::unique_ptr<QgsPointCloudIndex> clone() const override;
48 
49  void load( const QString &fileName ) override;
50 
51  QgsPointCloudBlock *nodeData( const IndexedPointCloudNode &n, const QgsPointCloudRequest &request ) override;
53 
54  QgsCoordinateReferenceSystem crs() const override;
55  qint64 pointCount() const override;
56  bool hasStatisticsMetadata() const override;
57  QVariant metadataStatistic( const QString &attribute, QgsStatisticalSummary::Statistic statistic ) const override;
58  QVariantList metadataClasses( const QString &attribute ) const override;
59  QVariant metadataClassStatistic( const QString &attribute, const QVariant &value, QgsStatisticalSummary::Statistic statistic ) const override;
60  QVariantMap originalMetadata() const override { return mOriginalMetadata; }
61 
62  bool isValid() const override;
64 
69  void copyCommonProperties( QgsEptPointCloudIndex *destination ) const;
70 
71  protected:
72  bool loadSchema( const QByteArray &dataJson );
73  void loadManifest( const QByteArray &manifestJson );
74  bool loadSchema( QFile &f );
75  bool loadHierarchy();
76 
77  bool mIsValid = false;
78  QString mDataType;
79  QString mDirectory;
80  QString mWkt;
81 
82  qint64 mPointCount = 0;
83 
84  struct AttributeStatistics
85  {
86  int count = -1;
87  QVariant minimum;
88  QVariant maximum;
89  double mean = std::numeric_limits< double >::quiet_NaN();
90  double stDev = std::numeric_limits< double >::quiet_NaN();
91  double variance = std::numeric_limits< double >::quiet_NaN();
92  };
93 
94  QMap< QString, AttributeStatistics > mMetadataStats;
95 
96  QMap< QString, QMap< int, int > > mAttributeClasses;
97  QVariantMap mOriginalMetadata;
98 };
99 
101 #endif // QGSEPTPOINTCLOUDINDEX_H
QgsPointCloudIndex::nodeData
virtual QgsPointCloudBlock * nodeData(const IndexedPointCloudNode &n, const QgsPointCloudRequest &request)=0
Returns node data block.
QgsPointCloudIndex::crs
virtual QgsCoordinateReferenceSystem crs() const =0
Returns the coordinate reference system of the point cloud index.
QgsPointCloudIndex::copyCommonProperties
void copyCommonProperties(QgsPointCloudIndex *destination) const
Copies common properties to the destination index.
Definition: qgspointcloudindex.cpp:352
qgspointcloudattribute.h
QgsPointCloudIndex::clone
virtual std::unique_ptr< QgsPointCloudIndex > clone() const =0
Returns a clone of the current point cloud index object.
QgsPointCloudBlock
Base class for storing raw data from point cloud nodes.
Definition: qgspointcloudblock.h:38
qgsstatisticalsummary.h
QgsPointCloudIndex::isValid
virtual bool isValid() const =0
Returns whether index is loaded and valid.
QgsPointCloudIndex::accessType
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...
QgsPointCloudRequest
Point cloud data request.
Definition: qgspointcloudrequest.h:39
QgsPointCloudIndex::originalMetadata
virtual QVariantMap originalMetadata() const =0
Returns the original metadata map.
IndexedPointCloudNode
Represents a indexed point cloud node in octree.
Definition: qgspointcloudindex.h:57
QgsPointCloudIndex::load
virtual void load(const QString &fileName)=0
Loads the index from the file.
QgsPointCloudIndex::hasStatisticsMetadata
virtual bool hasStatisticsMetadata() const =0
Returns whether the dataset contains metadata of statistics.
qgis_sip.h
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:211
qgspointcloudindex.h
QgsPointCloudIndex::metadataClasses
virtual QVariantList metadataClasses(const QString &attribute) const
Returns the classes of attribute.
Definition: qgspointcloudindex.cpp:309
QgsPointCloudIndex::asyncNodeData
virtual QgsPointCloudBlockRequest * asyncNodeData(const IndexedPointCloudNode &n, const QgsPointCloudRequest &request)=0
Returns a handle responsible for loading a node data block.
QgsStatisticalSummary::Statistic
Statistic
Enumeration of flags that specify statistics to be calculated.
Definition: qgsstatisticalsummary.h:48
QgsPointCloudBlockRequest
Base class for handling loading QgsPointCloudBlock asynchronously.
Definition: qgspointcloudblockrequest.h:36
QgsPointCloudIndex::Local
@ Local
Local means the source is a local file on the machine.
Definition: qgspointcloudindex.h:170
QgsPointCloudIndex::AccessType
AccessType
The access type of the data, local is for local files and remote for remote files (over HTTP)
Definition: qgspointcloudindex.h:168
QgsPointCloudIndex::metadataStatistic
virtual QVariant metadataStatistic(const QString &attribute, QgsStatisticalSummary::Statistic statistic) const
Returns the statistic statistic of attribute.
Definition: qgspointcloudindex.cpp:289
QgsPointCloudIndex
Represents a indexed point clouds data in octree.
Definition: qgspointcloudindex.h:163
QgsPointCloudIndex::metadataClassStatistic
virtual QVariant metadataClassStatistic(const QString &attribute, const QVariant &value, QgsStatisticalSummary::Statistic statistic) const
Returns the statistic statistic of the class value of the attribute attribute.
Definition: qgspointcloudindex.cpp:315
QgsPointCloudIndex::pointCount
virtual qint64 pointCount() const =0
Returns the number of points in the point cloud.