QGIS API Documentation 3.41.0-Master (25ec5511245)
Loading...
Searching...
No Matches
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 "qgis_sip.h"
31
33#define SIP_NO_FILE
34
36
37class CORE_EXPORT QgsEptPointCloudIndex: public QgsPointCloudIndex
38{
39 Q_OBJECT
40 public:
41
42 explicit QgsEptPointCloudIndex();
43 ~QgsEptPointCloudIndex();
44
45 std::unique_ptr<QgsPointCloudIndex> clone() const override;
46
47 void load( const QString &fileName ) override;
48
49 std::unique_ptr<QgsPointCloudBlock> nodeData( const IndexedPointCloudNode &n, const QgsPointCloudRequest &request ) override;
51 bool hasNode( const IndexedPointCloudNode &n ) const override;
52
53 QgsCoordinateReferenceSystem crs() const override;
54 qint64 pointCount() const override;
55 virtual qint64 nodePointCount( const IndexedPointCloudNode &n ) const override;
56 bool hasStatisticsMetadata() const override;
57 QVariant metadataStatistic( const QString &attribute, Qgis::Statistic statistic ) const override;
58 QVariantList metadataClasses( const QString &attribute ) const override;
59 QVariant metadataClassStatistic( const QString &attribute, const QVariant &value, Qgis::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 loadSingleNodeHierarchy( const IndexedPointCloudNode &nodeId ) const;
76 QVector<IndexedPointCloudNode> nodePathToRoot( const IndexedPointCloudNode &nodeId ) const;
77 bool loadNodeHierarchy( const IndexedPointCloudNode &nodeId ) const;
78
79 bool mIsValid = false;
81 QString mDataType;
82 QString mWkt;
83
84 QString mUrlDirectoryPart;
85
87 mutable QSet<IndexedPointCloudNode> mHierarchyNodes;
88
89 qint64 mPointCount = 0;
90
91 struct AttributeStatistics
92 {
93 int count = -1;
94 QVariant minimum;
95 QVariant maximum;
96 double mean = std::numeric_limits< double >::quiet_NaN();
97 double stDev = std::numeric_limits< double >::quiet_NaN();
98 double variance = std::numeric_limits< double >::quiet_NaN();
99 };
100
101 QMap< QString, AttributeStatistics > mMetadataStats;
102
103 QMap< QString, QMap< int, int > > mAttributeClasses;
104 QVariantMap mOriginalMetadata;
105};
106
108#endif // QGSEPTPOINTCLOUDINDEX_H
Represents a indexed point cloud node in octree.
Statistic
Available generic statistics.
Definition qgis.h:5438
This class represents a coordinate reference system (CRS).
Base class for handling loading QgsPointCloudBlock asynchronously.
Represents a indexed point clouds data in octree.
virtual qint64 nodePointCount(const IndexedPointCloudNode &n) const
Returns the number of points of a given node n.
virtual QgsPointCloudBlockRequest * asyncNodeData(const IndexedPointCloudNode &n, const QgsPointCloudRequest &request)=0
Returns a handle responsible for loading a node data block.
AccessType
The access type of the data, local is for local files and remote for remote files (over HTTP)
@ Local
Local means the source is a local file on the machine.
virtual qint64 pointCount() const =0
Returns the number of points in the point cloud.
virtual QVariantList metadataClasses(const QString &attribute) const
Returns the classes of attribute.
void copyCommonProperties(QgsPointCloudIndex *destination) const
Copies common properties to the destination index.
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 std::unique_ptr< QgsPointCloudIndex > clone() const =0
Returns a clone of the current point cloud index object.
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 bool hasNode(const IndexedPointCloudNode &n) const
Returns whether the octree contain given node.
virtual void load(const QString &fileName)=0
Loads the index from the file.
virtual bool hasStatisticsMetadata() const =0
Returns whether the dataset contains metadata of statistics.
virtual QVariant metadataStatistic(const QString &attribute, Qgis::Statistic statistic) const
Returns the statistic statistic of attribute.
virtual std::unique_ptr< QgsPointCloudBlock > nodeData(const IndexedPointCloudNode &n, const QgsPointCloudRequest &request)=0
Returns node data block.
virtual QVariant metadataClassStatistic(const QString &attribute, const QVariant &value, Qgis::Statistic statistic) const
Returns the statistic statistic of the class value of the attribute attribute.
virtual QVariantMap originalMetadata() const =0
Returns the original metadata map.
Point cloud data request.