13 #include <laszip/laszip_api.h>
23 #include <QDataStream>
31 static const std::array<const char*, 3>
VersionsArray = {
"1.2",
"1.3",
"1.4"};
46 self.recordLength = 0;
52 stream.setByteOrder(QDataStream::ByteOrder::LittleEndian);
58 quint64 recordLength_;
59 stream >> recordLength_;
69 stream.setByteOrder(QDataStream::ByteOrder::LittleEndian);
114 switch (versionMinor)
129 if (strcmp(vlr.user_id,
"Laszip encoded") == 0 && vlr.record_id == 22204)
138 if (strcmp(vlr.user_id,
"LASF_Spec") == 0 && vlr.record_id == 4)
148 return std::accumulate(vlrs,
152 {
return vlr.record_length_after_header + header_size +
size; });
190 bool isExtendedRequired = hasOverlapFlag || hasNIR || hasScannerChannel || hasScanAngle;
192 if (!isExtendedRequired)
197 if (classificationIdx != -1)
202 isExtendedRequired =
true;
207 if (returnNumberIdx != -1)
212 isExtendedRequired =
true;
217 if (numReturnsIdx != -1)
222 isExtendedRequired =
true;
228 bool hasWaveform = cloud.
hasFWF();
230 if (isExtendedRequired)
246 if (hasRGB && hasNIR)
250 else if (hasRGB && !hasNIR)
255 return {pointFormat, 4};
261 int minorVersion = 2;
281 return {pointFormat, minorVersion};
288 dst.data =
new laszip_U8[src.record_length_after_header];
289 std::copy(src.data, src.data + src.record_length_after_header, dst.data);
static const std::array< const char *, 3 > VersionsArray
static const std::vector< unsigned > PointFormatForV1_3
static const std::vector< unsigned > PointFormatForV1_4
static const std::vector< unsigned > PointFormatForV1_2
constexpr size_t LAS_VLR_HEADER_SIZE
laszip_vlr laszip_vlr_struct
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
bool hasFWF() const
Returns whether the cloud has associated Full WaveForm data.
bool hasColors() const override
Returns whether colors are enabled or not.
int getScalarFieldIndexByName(const char *name) const
Returns the index of a scalar field represented by its name.
ScalarField * getScalarField(int index) const
Returns a pointer to a specific scalar field.
A simple scalar field (to be associated to a point cloud)
ScalarType getMax() const
Returns the maximum value.
const std::array< const char *, 3 > & AvailableVersions()
bool IsLaszipVlr(const laszip_vlr_struct &)
Returns whether the vlr is the vlr for/of LASzip compression.
uint16_t PointFormatSize(unsigned pointFormat)
LasVersion SelectBestVersion(const ccPointCloud &cloud)
bool IsExtraBytesVlr(const laszip_vlr_struct &)
Returns whether the vlr describes extra bytes.
QDataStream & operator<<(QDataStream &stream, const EvlrHeader &hdr)
uint16_t HeaderSize(unsigned versionMinor)
Returns the header size for the given minor version of the standard used.
void CloneVlrInto(const laszip_vlr_struct &src, laszip_vlr_struct &dst)
Clones the content of the src vlr into the dst vlr.
unsigned SizeOfVlrs(const laszip_vlr_struct *vlrs, unsigned numVlrs)
QDataStream & operator>>(QDataStream &stream, EvlrHeader &hdr)
const std::vector< unsigned > * PointFormatsAvailableForVersion(QString version)
constexpr const char * ScanAngle
constexpr const char * NumberOfReturns
constexpr const char * OverlapFlag
constexpr const char * Classification
constexpr const char * ScannerChannel
constexpr const char * ReturnNumber
constexpr const char * NearInfrared
constexpr const char * GpsTime
static LasScalarField::Range ValueRange(LasScalarField::Id id)
Returns the range of value the given field (ID) supports.