QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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 "qgspointcloudblock.h"
24
25#include <string>
26#include <QString>
27
29#define SIP_NO_FILE
30
31
32class QgsPointCloudExpression;
33class QgsLazInfo;
34class QgsRectangle;
35
36template <typename T>
37bool lazStoreToStream_( char *s, size_t position, QgsPointCloudAttribute::DataType type, T value );
38bool lazSerialize_( char *data, size_t outputPosition, QgsPointCloudAttribute::DataType outputType,
39 const char *input, QgsPointCloudAttribute::DataType inputType, int inputSize, size_t inputPosition );
40
41class QgsLazDecoder
42{
43 public:
44
45 enum class LazAttribute
46 {
47 X,
48 Y,
49 Z,
50 Classification,
51 Intensity,
52 ReturnNumber,
53 NumberOfReturns,
54 ScanDirectionFlag,
55 EdgeOfFlightLine,
56 ScanAngleRank,
57 UserData,
58 PointSourceId,
59 GpsTime,
60 Red,
61 Green,
62 Blue,
63 ScannerChannel,
64 Synthetic,
65 KeyPoint,
66 Withheld,
67 Overlap,
68 NIR,
69 ExtraBytes,
70 MissingOrUnknown
71 };
72
73 struct RequestedAttributeDetails
74 {
75 RequestedAttributeDetails( LazAttribute attribute, QgsPointCloudAttribute::DataType type, int size, int offset = -1 )
76 : attribute( attribute )
77 , type( type )
78 , size( size )
79 , offset( offset )
80 {}
81
82 LazAttribute attribute;
84 int size;
85 int offset; // Used in case the attribute is an extra byte attribute
86 };
87
88 static std::unique_ptr<QgsPointCloudBlock> decompressLaz( const QString &filename, const QgsPointCloudAttributeCollection &requestedAttributes, QgsPointCloudExpression &filterExpression, QgsRectangle &filterRect );
89 static std::unique_ptr<QgsPointCloudBlock> decompressLaz( const QByteArray &data, const QgsPointCloudAttributeCollection &requestedAttributes, QgsPointCloudExpression &filterExpression, QgsRectangle &filterRect );
90 static std::unique_ptr<QgsPointCloudBlock> decompressCopc( const QByteArray &data, QgsLazInfo &lazInfo, int32_t pointCount, const QgsPointCloudAttributeCollection &requestedAttributes, QgsPointCloudExpression &filterExpression, QgsRectangle &filterRect );
91
92#if defined(_MSC_VER)
93
99 static std::wstring toNativePath( const QString &filename );
100#else
102 static std::string toNativePath( const QString &filename );
103#endif
104
105};
106
108#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.
A rectangle specified with double values.
Definition: qgsrectangle.h:42