QGIS API Documentation 3.41.0-Master (d5b93354e9c)
Loading...
Searching...
No Matches
qgscopcpointcloudindex.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscopcpointcloudindex.h
3 --------------------
4 begin : March 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 QGSCOPCPOINTCLOUDINDEX_H
19#define QGSCOPCPOINTCLOUDINDEX_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 <fstream>
30#include <optional>
31
32#include "qgspointcloudindex.h"
34
35#include "qgslazinfo.h"
36#include "lazperf/vlr.hpp"
37
39#define SIP_NO_FILE
40
42
43class CORE_EXPORT QgsCopcPointCloudIndex: public QgsPointCloudIndex
44{
45 public:
46
47 explicit QgsCopcPointCloudIndex();
48 ~QgsCopcPointCloudIndex();
49
50 std::unique_ptr<QgsPointCloudIndex> clone() const override;
51
52 void load( const QString &fileName ) override;
53
54 bool hasNode( const QgsPointCloudNodeId &n ) const override;
55 QgsPointCloudNode getNode( const QgsPointCloudNodeId &id ) const override;
56
57 std::unique_ptr< QgsPointCloudBlock> nodeData( const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request ) override;
59
60 QgsCoordinateReferenceSystem crs() const override;
61 qint64 pointCount() const override;
62 QVariantMap originalMetadata() const override { return mOriginalMetadata; }
63
64 bool isValid() const override;
65 QgsPointCloudIndex::AccessType accessType() const override { return mAccessType; };
66
72 bool writeStatistics( QgsPointCloudStatistics &stats );
73
80
85 void copyCommonProperties( QgsCopcPointCloudIndex *destination ) const;
86
92 bool gpsTimeFlag() const;
93
94 protected:
95 bool loadSchema( QgsLazInfo &lazInfo );
96 bool loadHierarchy();
97
99 bool fetchNodeHierarchy( const QgsPointCloudNodeId &n ) const;
100
104 virtual void fetchHierarchyPage( uint64_t offset, uint64_t byteSize ) const;
105
106 void populateHierarchy( const char *hierarchyPageData, uint64_t byteSize ) const;
107
108 QByteArray fetchCopcStatisticsEvlrData() const;
109
110 bool mIsValid = false;
112 mutable std::ifstream mCopcFile;
113 mutable lazperf::copc_info_vlr mCopcInfoVlr;
114 mutable QHash<QgsPointCloudNodeId, QPair<uint64_t, int32_t>> mHierarchyNodePos;
115
116 QVariantMap mOriginalMetadata;
117 mutable std::optional<QgsPointCloudStatistics> mStatistics;
118
119 std::unique_ptr<QgsLazInfo> mLazInfo = nullptr;
120};
121
123#endif // QGSCOPCPOINTCLOUDINDEX_H
This class represents a coordinate reference system (CRS).
Class for extracting information contained in LAZ file such as the public header block and variable l...
Definition qgslazinfo.h:39
Base class for handling loading QgsPointCloudBlock asynchronously.
Represents a indexed point clouds data in octree.
virtual bool hasNode(const QgsPointCloudNodeId &n) const
Returns whether the octree contain given node.
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.
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 QgsPointCloudStatistics metadataStatistics() const
Returns the object containing the statistics metadata extracted from the dataset.
virtual QgsPointCloudBlockRequest * asyncNodeData(const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request)=0
Returns a handle responsible for loading a node data block.
virtual void load(const QString &fileName)=0
Loads the index from the file.
virtual QgsPointCloudNode getNode(const QgsPointCloudNodeId &id) const
Returns object for a given node.
virtual QVariantMap originalMetadata() const =0
Returns the original metadata map.
virtual std::unique_ptr< QgsPointCloudBlock > nodeData(const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request)=0
Returns node data block.
Represents a indexed point cloud node's position in octree.
Keeps metadata for indexed point cloud node.
Point cloud data request.
Class used to store statistics of a point cloud dataset.