18 #ifndef QGSEPTDECODER_H
19 #define QGSEPTDECODER_H
22 #include "qgis_core.h"
27 #include "laz-perf/io.hpp"
28 #include "laz-perf/common/common.hpp"
35 namespace QgsEptDecoder
37 struct ExtraBytesAttributeDetails
53 template<
typename FileType>
54 QVector<QgsEptDecoder::ExtraBytesAttributeDetails> readExtraByteAttributes( FileType &file )
57 return QVector<QgsEptDecoder::ExtraBytesAttributeDetails>();
59 auto pastFilePos = file.tellg();
63 laszip::io::reader::basic_file<FileType> f( file );
64 int point_record_length = f.get_header().point_record_length;
70 unsigned short reserved;
72 unsigned short record_id;
73 unsigned short record_length;
77 struct ExtraByteDescriptor
79 unsigned char reserved[2];
80 unsigned char data_type;
81 unsigned char options;
83 unsigned char unused[4];
84 unsigned char no_data[8];
85 unsigned char deprecated1[16];
87 unsigned char deprecated2[16];
89 unsigned char deprecated3[16];
90 unsigned char scale[8];
91 unsigned char deprecated4[16];
93 unsigned char deprecated5[16];
97 QVector<ExtraByteDescriptor> extraBytes;
98 QVector<ExtraBytesAttributeDetails> extrabytesAttr;
100 VlrHeader extraBytesVlrHeader;
101 int extraBytesDescriptorsOffset = -1;
103 file.seekg( f.get_header().header_size );
104 for (
unsigned int i = 0; i < f.get_header().vlr_count && file.good() && !file.eof(); ++i )
107 file.read( (
char * )&vlrHeader,
sizeof( VlrHeader ) );
108 file.seekg( vlrHeader.record_length, std::ios::cur );
109 if ( std::equal( vlrHeader.user_id, vlrHeader.user_id + 9,
"LASF_Spec" ) && vlrHeader.record_id == 4 )
111 extraBytesVlrHeader = vlrHeader;
112 extraBytesDescriptorsOffset = f.get_header().header_size +
sizeof( VlrHeader );
117 if ( extraBytesDescriptorsOffset != -1 )
119 file.seekg( extraBytesDescriptorsOffset );
120 int n_descriptors = extraBytesVlrHeader.record_length /
sizeof( ExtraByteDescriptor );
121 for (
int i = 0; i < n_descriptors; ++i )
123 ExtraByteDescriptor ebd;
124 file.read( (
char * )&ebd,
sizeof( ExtraByteDescriptor ) );
125 extraBytes.push_back( ebd );
129 for (
int i = (
int )extraBytes.size() - 1; i >= 0; --i )
131 ExtraByteDescriptor eb = extraBytes[i];
132 ExtraBytesAttributeDetails ebAtrr;
133 ebAtrr.attribute = QString::fromStdString( eb.name );
134 switch ( eb.data_type )
138 ebAtrr.size = eb.options;
182 ebAtrr.size = eb.options;
185 int accOffset = ( extrabytesAttr.empty() ? point_record_length : extrabytesAttr.back().offset ) - ebAtrr.size;
186 ebAtrr.offset = accOffset;
187 extrabytesAttr.push_back( ebAtrr );
190 file.seekg( pastFilePos );
192 return extrabytesAttr;
Collection of point cloud attributes.
DataType
Systems of unit measurement.
@ UShort
Unsigned short int 2 bytes.
@ Short
Short int 2 bytes.
@ UChar
Unsigned char 1 byte.
@ UInt32
Unsigned int32 4 bytes.
@ UInt64
Unsigned int64 8 bytes.
Base class for storing raw data from point cloud nodes.