QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
qgslazdecoder.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslazdecoder.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 QGSLAZDECODER_H
19#define QGSLAZDECODER_H
20
21
22#include "qgis_core.h"
23#include "qgis_sip.h"
24#include "qgspointcloudblock.h"
26
27#include "lazperf/lazperf.hpp"
28#include "lazperf/readers.hpp"
29
30#include <string>
31
33#define SIP_NO_FILE
34
35#include <QString>
36
37class QgsPointCloudExpression;
38class QgsLazInfo;
39
40template <typename T>
41bool _lazStoreToStream( char *s, size_t position, QgsPointCloudAttribute::DataType type, T value );
42bool _lazSerialize( char *data, size_t outputPosition, QgsPointCloudAttribute::DataType outputType,
43 const char *input, QgsPointCloudAttribute::DataType inputType, int inputSize, size_t inputPosition );
44
45class QgsLazDecoder
46{
47 public:
48
49 enum class LazAttribute
50 {
51 X,
52 Y,
53 Z,
54 Classification,
55 Intensity,
56 ReturnNumber,
57 NumberOfReturns,
58 ScanDirectionFlag,
59 EdgeOfFlightLine,
60 ScanAngleRank,
61 UserData,
62 PointSourceId,
63 GpsTime,
64 Red,
65 Green,
66 Blue,
67 ScannerChannel,
68 ClassificationFlags,
69 NIR,
70 ExtraBytes,
71 MissingOrUnknown
72 };
73
74 struct RequestedAttributeDetails
75 {
76 RequestedAttributeDetails( LazAttribute attribute, QgsPointCloudAttribute::DataType type, int size, int offset = -1 )
77 : attribute( attribute )
78 , type( type )
79 , size( size )
80 , offset( offset )
81 {}
82
83 LazAttribute attribute;
85 int size;
86 int offset; // Used in case the attribute is an extra byte attribute
87 };
88
89 static QgsPointCloudBlock *decompressLaz( const QString &filename, const QgsPointCloudAttributeCollection &requestedAttributes, QgsPointCloudExpression &filterExpression );
90 static QgsPointCloudBlock *decompressLaz( const QByteArray &data, const QgsPointCloudAttributeCollection &requestedAttributes, QgsPointCloudExpression &filterExpression );
91 static QgsPointCloudBlock *decompressCopc( const QString &filename, QgsLazInfo &lazInfo, uint64_t blockOffset, uint64_t blockSize, int32_t pointCount, const QgsPointCloudAttributeCollection &requestedAttributes, QgsPointCloudExpression &filterExpression );
92 static QgsPointCloudBlock *decompressCopc( const QByteArray &data, QgsLazInfo &lazInfo, int32_t pointCount, const QgsPointCloudAttributeCollection &requestedAttributes, QgsPointCloudExpression &filterExpression );
93
94#if defined(_MSC_VER)
95
101 static std::wstring toNativePath( const QString &filename );
102#else
104 static std::string toNativePath( const QString &filename );
105#endif
106
107};
108
110#endif // QGSLAZDECODER_H
Class for extracting information contained in LAZ file such as the public header block and variable l...
Definition: qgslazinfo.h:39
Collection of point cloud attributes.
DataType
Systems of unit measurement.
Base class for storing raw data from point cloud nodes.