18#ifndef QGSCOPCPOINTCLOUDINDEX_H
19#define QGSCOPCPOINTCLOUDINDEX_H
24#include "lazperf/vlr.hpp"
45 explicit QgsCopcPointCloudIndex();
46 ~QgsCopcPointCloudIndex()
override;
48 void load(
const QString &urlString,
const QString &authcfg = QString() )
override;
50 bool hasNode(
const QgsPointCloudNodeId &n )
const override;
51 QgsPointCloudNode
getNode(
const QgsPointCloudNodeId &
id )
const override;
53 std::unique_ptr< QgsPointCloudBlock>
nodeData(
const QgsPointCloudNodeId &n,
const QgsPointCloudRequest &request )
override;
54 QgsPointCloudBlockRequest *
asyncNodeData(
const QgsPointCloudNodeId &n,
const QgsPointCloudRequest &request )
override;
57 const QByteArray rawNodeData( QgsPointCloudNodeId n )
const;
59 QgsCoordinateReferenceSystem
crs()
const override;
88 bool loadSchema( QgsLazInfo &lazInfo );
89 bool loadHierarchy()
const;
92 bool fetchNodeHierarchy(
const QgsPointCloudNodeId &n )
const;
97 virtual void fetchHierarchyPage( uint64_t offset, uint64_t byteSize )
const;
99 void populateHierarchy(
const char *hierarchyPageData, uint64_t byteSize )
const;
102 QByteArray readRange( uint64_t offset, uint64_t length )
const;
104 QByteArray fetchCopcStatisticsEvlrData()
const;
108 bool mIsValid =
false;
110 mutable std::ifstream mCopcFile;
111 mutable lazperf::copc_info_vlr mCopcInfoVlr;
112 mutable QHash<QgsPointCloudNodeId, QPair<uint64_t, int32_t>> mHierarchyNodePos;
114 mutable QMutex mFileMutex;
116 QVariantMap mOriginalMetadata;
117 mutable std::optional<QgsPointCloudStatistics> mStatistics;
119 std::unique_ptr<QgsLazInfo> mLazInfo =
nullptr;
121 friend class QgsPointCloudLayerEditUtils;
122 friend class QgsPointCloudEditingIndex;
PointCloudAccessType
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.
Represents an indexed point clouds data in octree.
virtual QVariantMap originalMetadata() const =0
Returns the original metadata map.
virtual qint64 pointCount() const =0
Returns the number of points in the point cloud.
virtual QgsCoordinateReferenceSystem crs() const =0
Returns the coordinate reference system of the point cloud index.
virtual bool writeStatistics(QgsPointCloudStatistics &stats)
Writes the statistics object stats into the backing file, if possible.
virtual bool hasNode(const QgsPointCloudNodeId &n) const
Returns whether the octree contain given node.
virtual QVariantMap extraMetadata() const
Returns extra metadata that's not accessible through the other methods in an implementation-specific ...
virtual QgsPointCloudBlockRequest * asyncNodeData(const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request)=0
Returns a handle responsible for loading a node data block.
virtual Qgis::PointCloudAccessType 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 QgsPointCloudStatistics metadataStatistics() const
Returns the object containing the statistics metadata extracted from the dataset.
virtual void load(const QString &uri, const QString &authcfg=QString())=0
Loads the index from the uri, using an optional authcfg for network requests.
virtual std::unique_ptr< QgsPointCloudBlock > nodeData(const QgsPointCloudNodeId &n, const QgsPointCloudRequest &request)=0
Returns node data block.
virtual bool isValid() const =0
Returns whether index is loaded and valid.
virtual QgsPointCloudNode getNode(const QgsPointCloudNodeId &id) const
Returns object for a given node.
Represents a coordinate reference system (CRS).