QGIS API Documentation 3.43.0-Master (37eec98dbf6)
qgscopcupdate.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscopcupdate.h
3 ---------------------
4 begin : January 2025
5 copyright : (C) 2025 by Martin Dobias
6 email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSCOPCUPDATE_H
17#define QGSCOPCUPDATE_H
18
19#include "qgis_core.h"
20#include "qgspointcloudindex.h"
21
22#include <lazperf/header.hpp>
23#include <lazperf/vlr.hpp>
24
25#define SIP_NO_FILE
26
27
39class CORE_EXPORT QgsCopcUpdate
40{
41 public:
42
45 {
47 int32_t pointCount;
49 QByteArray chunkData;
50 };
51
53 bool read( const QString &inputFilename );
54
56 bool write( const QString &outputFilename, const QHash<QgsPointCloudNodeId, UpdatedChunk> &updatedChunks );
57
59 QString errorMessage() const { return mErrorMessage; }
60
68 static bool writeUpdatedFile( const QString &inputFilename,
69 const QString &outputFilename,
70 const QHash<QgsPointCloudNodeId, UpdatedChunk> &updatedChunks,
71 QString *errorMessage = nullptr );
72
73 private:
74 bool readHeader();
75 void readChunkTable();
76 void readHierarchy();
77
78 private:
79 QString mInputFilename;
80 std::ifstream mFile;
81 lazperf::header14 mHeader;
82 lazperf::copc_info_vlr mCopcVlr;
83 std::vector<lazperf::chunk> mChunks;
84 uint32_t mChunkCount = 0;
85 uint64_t mHierarchyOffset = 0;
86 std::vector<char> mHierarchyBlob;
87 std::vector<lazperf::evlr_header> mEvlrHeaders;
88 std::vector<std::vector<char>> mEvlrData;
89 QHash<uint64_t, QgsPointCloudNodeId> mOffsetToVoxel;
90
91 QString mErrorMessage;
92};
93
94#endif // QGSCOPCUPDATE_H
Handles update operations to a COPC file.
QString errorMessage() const
Returns error message.
Keeps information how points of a single chunk has been modified.
QByteArray chunkData
Data of the chunk (compressed already with LAZ compressor)
int32_t pointCount
Number of points in the updated chunk.