QGIS API Documentation 3.99.0-Master (a5475b57e34)
Loading...
Searching...
No Matches
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 "lazperf/header.hpp"
20#include "lazperf/vlr.hpp"
21#include "qgis_core.h"
22#include "qgspointcloudindex.h"
23
24#define SIP_NO_FILE
25
37class CORE_EXPORT QgsCopcUpdate
38{
39 public:
40
43 {
45 int32_t pointCount;
47 QByteArray chunkData;
48 };
49
51 bool read( const QString &inputFilename );
52
54 bool write( const QString &outputFilename, const QHash<QgsPointCloudNodeId, UpdatedChunk> &updatedChunks );
55
57 QString errorMessage() const { return mErrorMessage; }
58
66 static bool writeUpdatedFile( const QString &inputFilename,
67 const QString &outputFilename,
68 const QHash<QgsPointCloudNodeId, UpdatedChunk> &updatedChunks,
69 QString *errorMessage = nullptr );
70
71 private:
72 bool readHeader();
73 void readChunkTable();
74 void readHierarchy();
75
76 private:
77 QString mInputFilename;
78 std::ifstream mFile;
79 lazperf::header14 mHeader;
80 lazperf::copc_info_vlr mCopcVlr;
81 std::vector<lazperf::chunk> mChunks;
82 uint32_t mChunkCount = 0;
83 uint64_t mHierarchyOffset = 0;
84 std::vector<char> mHierarchyBlob;
85 std::vector<lazperf::evlr_header> mEvlrHeaders;
86 std::vector<std::vector<char>> mEvlrData;
87 QHash<uint64_t, QgsPointCloudNodeId> mOffsetToVoxel;
88
89 QString mErrorMessage;
90};
91
92#endif // QGSCOPCUPDATE_H
Handles update operations to a COPC file.
QString errorMessage() const
Returns error message.
bool read(const QString &inputFilename)
Reads input COPC file and initializes all the members.
bool write(const QString &outputFilename, const QHash< QgsPointCloudNodeId, UpdatedChunk > &updatedChunks)
Writes a COPC file with updated chunks.
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.