QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgslazinfo.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslazinfo.h
3 --------------------
4 begin : April 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 QGSLAZINFO_H
19#define QGSLAZINFO_H
20
21#include <fstream>
22
25
26#include "lazperf/header.hpp"
27
28#define SIP_NO_FILE
29
38class CORE_EXPORT QgsLazInfo
39{
40 public:
41 struct LazVlr
42 {
43 QString userId;
45 QByteArray data;
46 };
47
55
57 QgsLazInfo();
58
60 bool isValid() const { return mIsValid; }
61
63 QString error() const { return mError; }
64
66 void parseRawHeader( char *data, uint64_t length );
67
69 void parseRawVlrEntries( char *data, uint64_t length );
70
72 uint64_t pointCount() const
73 {
74 return mHeader.version.major == 1 && mHeader.version.minor == 4 ? mHeader.point_count_14 : mHeader.point_count;
75 }
77 QgsVector3D scale() const { return mScale; }
79 QgsVector3D offset() const { return mOffset; }
81 QPair<uint16_t, uint16_t> creationYearDay() const { return mCreationYearDay; }
83 QPair<uint8_t, uint8_t> version() const { return mVersion; }
85 int pointFormat() const { return mPointFormat; }
87 QString projectId() const { return mProjectId; }
89 QString systemId() const { return mSystemId; }
91 QString softwareId() const { return mSoftwareId; }
93 QgsVector3D minCoords() const { return mMinCoords; }
95 QgsVector3D maxCoords() const { return mMaxCoords; }
97 uint32_t firstPointRecordOffset() const { return mHeader.point_offset; }
99 uint32_t firstVariableLengthRecord() const;
101 int pointRecordLength() const { return mHeader.point_record_length; }
103 int extrabytesCount() const { return mHeader.ebCount(); }
104
106 uint64_t firstEvlrOffset() const { return mHeader.evlr_offset; }
108 uint32_t evlrCount() const { return mHeader.evlr_count; }
109
111 QgsCoordinateReferenceSystem crs() const { return mCrs; }
112
114 QVariantMap toMetadata() const;
115
117 QByteArray vlrData( QString userId, int recordId );
118
120 QgsPointCloudAttributeCollection attributes() const { return mAttributes; }
121
123 QVector<ExtraBytesAttributeDetails> extrabytes() const { return mExtrabyteAttributes; }
124
125#ifndef SIP_RUN
127 lazperf::header14 header() const { return mHeader; }
128#endif
129
131 static QVector<ExtraBytesAttributeDetails> parseExtrabytes( char *rawData, int length, int pointRecordLength );
132
134 static QgsLazInfo fromFile( std::ifstream &file );
136 static QgsLazInfo fromUrl( QUrl &url );
137
138 private:
139 void parseHeader( lazperf::header14 &header );
140 void parseCrs();
141 void parseLazAttributes();
142 void parseExtrabyteAttributes();
143 private:
144 bool mIsValid = false;
145 QString mError;
146
147 lazperf::header14 mHeader;
148
149 QgsVector3D mScale, mOffset;
150 QPair<uint16_t, uint16_t> mCreationYearDay;
151 QPair<uint8_t, uint8_t> mVersion;
152 int mPointFormat = -1;
153 QString mProjectId;
154 QString mSystemId;
155 QString mSoftwareId;
156
158
159 QgsVector3D mMinCoords, mMaxCoords;
160
161 int mVlrCount = 0;
162
163 QVector<LazVlr> mVlrVector;
164
166 QVector<ExtraBytesAttributeDetails> mExtrabyteAttributes;
167};
168
169#endif // QGSLAZINFO_H
This class represents a coordinate reference system (CRS).
Class for extracting information contained in LAZ file such as the public header block and variable l...
Definition qgslazinfo.h:39
QString systemId() const
Returns the system identifier contained in the LAZ file public header block.
Definition qgslazinfo.h:89
QgsVector3D maxCoords() const
Returns the maximum coordinate across X, Y and Z axis.
Definition qgslazinfo.h:95
QgsPointCloudAttributeCollection attributes() const
Returns the list of attributes contained in the LAZ file.
Definition qgslazinfo.h:120
int extrabytesCount() const
Returns the number of extrabytes contained in the LAZ dataset.
Definition qgslazinfo.h:103
bool isValid() const
Returns whether the LAZ header data passed to this class is from a valid LAZ file.
Definition qgslazinfo.h:60
QString projectId() const
Returns the project identifier contained in the LAZ file public header block (Optional field)
Definition qgslazinfo.h:87
uint64_t firstEvlrOffset() const
Returns the absolute offset to the first extended point record in the LAZ file.
Definition qgslazinfo.h:106
QString error() const
Returns an error string detailing what went wrong with reading the LAZ info.
Definition qgslazinfo.h:63
uint32_t firstPointRecordOffset() const
Returns the absolute offset to the first point record in the LAZ file.
Definition qgslazinfo.h:97
uint32_t evlrCount() const
Returns the absolute offset to the first variable length record in the LAZ file.
Definition qgslazinfo.h:108
QPair< uint8_t, uint8_t > version() const
Returns the LAZ specification version of the LAZ file.
Definition qgslazinfo.h:83
lazperf::header14 header() const
Returns the LAZPERF header object.
Definition qgslazinfo.h:127
QgsVector3D scale() const
Returns the scale of the points coordinates.
Definition qgslazinfo.h:77
uint64_t pointCount() const
Returns the number of points contained in the LAZ file.
Definition qgslazinfo.h:72
int pointFormat() const
Returns the point format of the point records contained in the LAZ file.
Definition qgslazinfo.h:85
QPair< uint16_t, uint16_t > creationYearDay() const
Returns the pair ( creation_year, creation_day ) extracted from the LAZ file public header block.
Definition qgslazinfo.h:81
QgsCoordinateReferenceSystem crs() const
Returns the coordinate system stored in the LAZ file.
Definition qgslazinfo.h:111
QVector< ExtraBytesAttributeDetails > extrabytes() const
Returns the list of extrabytes contained in the LAZ file.
Definition qgslazinfo.h:123
QString softwareId() const
Returns the identifier of the software used to generate the LAZ file public header block.
Definition qgslazinfo.h:91
QgsVector3D minCoords() const
Returns the minimum coordinate across X, Y and Z axis.
Definition qgslazinfo.h:93
QgsVector3D offset() const
Returns the offset of the points coordinates.
Definition qgslazinfo.h:79
int pointRecordLength() const
Returns the length of each point record in bytes.
Definition qgslazinfo.h:101
Collection of point cloud attributes.
DataType
Systems of unit measurement.
Class for storage of 3D vectors similar to QVector3D, with the difference that it uses double precisi...
Definition qgsvector3d.h:31
QgsPointCloudAttribute::DataType type
Definition qgslazinfo.h:51
QByteArray data
Definition qgslazinfo.h:45