ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
LasExtraScalarField.h
Go to the documentation of this file.
1
// ----------------------------------------------------------------------------
2
// - CloudViewer: www.cloudViewer.org -
3
// ----------------------------------------------------------------------------
4
// Copyright (c) 2018-2024 www.cloudViewer.org
5
// SPDX-License-Identifier: MIT
6
// ----------------------------------------------------------------------------
7
8
#pragma once
9
10
// ##########################################################################
11
// # #
12
// # CloudViewer PLUGIN: LAS-IO Plugin #
13
// # #
14
// # This program is free software; you can redistribute it and/or modify #
15
// # it under the terms of the GNU General Public License as published by #
16
// # the Free Software Foundation; version 2 of the License. #
17
// # #
18
// # This program is distributed in the hope that it will be useful, #
19
// # but WITHOUT ANY WARRANTY; without even the implied warranty of #
20
// # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
21
// # GNU General Public License for more details. #
22
// # #
23
// # COPYRIGHT: Thomas Montaigu #
24
// # #
25
// ##########################################################################
26
27
#include <cstdint>
28
#include <string>
29
#include <vector>
30
31
class
QDataStream;
32
33
class
ccPointCloud
;
34
class
ccScalarField
;
35
36
struct
laszip_header;
37
struct
laszip_vlr;
38
typedef
laszip_vlr
laszip_vlr_struct
;
39
41
class
LasExtraScalarField
42
{
43
public
:
50
static
constexpr
unsigned
MAX_DIM_SIZE
= 3;
51
static
constexpr
unsigned
MAX_NAME_SIZE
= 32;
52
static
constexpr
unsigned
MAX_DESCRIPTION_SIZE
= 32;
53
54
enum class
DimensionSize
55
{
56
One
= 1,
57
Two
= 2,
58
Three
= 3,
59
};
60
62
enum
DataType
63
{
64
Undocumented
= 0,
65
u8
= 1,
66
i8
,
67
u16
,
68
i16
,
69
u32
,
70
i32
,
71
u64
,
72
i64
,
73
f32
,
74
f64
,
75
Invalid
76
};
77
78
enum
Kind
79
{
80
Signed
,
81
Unsigned
,
82
Floating
83
};
84
85
public
:
86
LasExtraScalarField
() =
default
;
87
88
friend
QDataStream&
operator>>
(QDataStream& dataStream,
LasExtraScalarField
& extraScalarField);
89
friend
QDataStream&
operator<<
(QDataStream& dataStream,
const
LasExtraScalarField
& extraScalarField);
90
91
public
:
// Static Helper functions that works on collection of LasExtraScalarFields
92
static
std::vector<LasExtraScalarField>
ParseExtraScalarFields
(
const
laszip_header& laszipHeader);
93
static
std::vector<LasExtraScalarField>
ParseExtraScalarFields
(
const
laszip_vlr_struct
& extraBytesVlr);
94
static
void
InitExtraBytesVlr
(
laszip_vlr_struct
& vlr,
95
const
std::vector<LasExtraScalarField>& extraFields);
96
static
void
UpdateByteOffsets
(std::vector<LasExtraScalarField>& extraFields);
97
static
unsigned
TotalExtraBytesSize
(
const
std::vector<LasExtraScalarField>& extraScalarFields);
98
static
void
MatchExtraBytesToScalarFields
(std::vector<LasExtraScalarField>& extraScalarFields,
99
const
ccPointCloud
& pointCloud);
100
101
public
:
// methods
102
// LAS Spec integer value for the type
103
uint8_t
typeCode
()
const
;
104
105
// Properties we can derive from the type attribute
106
unsigned
elementSize
()
const
;
107
unsigned
numElements
()
const
;
108
unsigned
byteSize
()
const
;
109
Kind
kind
()
const
;
110
const
char
*
typeName
()
const
;
111
112
// Properties we can derive from the type options attribute
113
bool
noDataIsRelevant
()
const
;
114
bool
minIsRelevant
()
const
;
115
bool
maxIsRelevant
()
const
;
116
bool
scaleIsRelevant
()
const
;
117
bool
offsetIsRelevant
()
const
;
118
119
void
setOffsetIsRelevant
(
bool
isRelevant);
120
void
setScaleIsRelevant
(
bool
isRelevant);
121
122
void
resetScalarFieldsPointers
();
123
124
static
std::tuple<DataType, DimensionSize>
DataTypeFromValue
(uint8_t value);
125
126
public
:
// Data members
127
DataType
type
{
Undocumented
};
128
DimensionSize
dimensions
{
DimensionSize::One
};
129
// These fields are from the vlr itself
130
uint8_t
options
{0};
131
char
name
[
MAX_NAME_SIZE
] =
""
;
132
char
description
[
MAX_DESCRIPTION_SIZE
] =
""
;
133
uint8_t
noData
[
MAX_DIM_SIZE
][8] = {0};
134
uint8_t
mins
[
MAX_DIM_SIZE
][8] = {0};
135
uint8_t
maxs
[
MAX_DIM_SIZE
][8] = {0};
136
double
scales
[
MAX_DIM_SIZE
] = {0.0};
137
double
offsets
[
MAX_DIM_SIZE
] = {0.0};
138
139
// These are added by us
140
unsigned
byteOffset
{0};
141
ccScalarField
*
scalarFields
[
MAX_DIM_SIZE
] = {
nullptr
};
142
// TODO explain better
143
// This strings store the name of the field in CC,
144
// Extra fields name may clash with existing scalar fields name
145
// (eg: the user calls one of his extra field "Intensity")
146
// we have to alter the real name
147
char
ccName
[
MAX_NAME_SIZE
+ 8] = {0};
148
};
LasExtraScalarField::typeName
const char * typeName() const
Definition:
LasExtraScalarField.cpp:330
LasExtraScalarField::maxs
uint8_t maxs[MAX_DIM_SIZE][8]
Definition:
LasExtraScalarField.h:135
LasExtraScalarField::Invalid
@ Invalid
Definition:
LasExtraScalarField.h:75
LasExtraScalarField::u16
@ u16
Definition:
LasExtraScalarField.h:67
LasExtraScalarField::noDataIsRelevant
bool noDataIsRelevant() const
Definition:
LasExtraScalarField.cpp:230
LasExtraScalarField::Floating
@ Floating
Definition:
LasExtraScalarField.h:82
LasExtraScalarField::scaleIsRelevant
bool scaleIsRelevant() const
Definition:
LasExtraScalarField.cpp:245
LasExtraScalarField::MatchExtraBytesToScalarFields
static void MatchExtraBytesToScalarFields(std::vector< LasExtraScalarField > &extraScalarFields, const ccPointCloud &pointCloud)
Definition:
LasExtraScalarField.cpp:389
LasExtraScalarField::MAX_DIM_SIZE
static constexpr unsigned MAX_DIM_SIZE
Definition:
LasExtraScalarField.h:50
LasExtraScalarField::Unsigned
@ Unsigned
Definition:
LasExtraScalarField.h:81
LasExtraScalarField::kind
Kind kind() const
Definition:
LasExtraScalarField.cpp:279
LasExtraScalarField::ParseExtraScalarFields
static std::vector< LasExtraScalarField > ParseExtraScalarFields(const laszip_header &laszipHeader)
Definition:
LasExtraScalarField.cpp:178
LasExtraScalarField::i32
@ i32
Definition:
LasExtraScalarField.h:70
LasExtraScalarField::MAX_DESCRIPTION_SIZE
static constexpr unsigned MAX_DESCRIPTION_SIZE
Definition:
LasExtraScalarField.h:52
LasExtraScalarField::byteOffset
unsigned byteOffset
Definition:
LasExtraScalarField.h:140
ccPointCloud
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Definition:
ecvPointCloud.h:146
LasExtraScalarField::numElements
unsigned numElements() const
Definition:
LasExtraScalarField.cpp:172
LasExtraScalarField::typeCode
uint8_t typeCode() const
Definition:
LasExtraScalarField.cpp:322
LasExtraScalarField::scales
double scales[MAX_DIM_SIZE]
Definition:
LasExtraScalarField.h:136
LasExtraScalarField::DimensionSize::One
@ One
LasExtraScalarField::byteSize
unsigned byteSize() const
Definition:
LasExtraScalarField.cpp:167
LasExtraScalarField::description
char description[MAX_DESCRIPTION_SIZE]
Definition:
LasExtraScalarField.h:132
LasExtraScalarField::TotalExtraBytesSize
static unsigned TotalExtraBytesSize(const std::vector< LasExtraScalarField > &extraScalarFields)
Definition:
LasExtraScalarField.cpp:362
LasExtraScalarField::DimensionSize::Two
@ Two
LasExtraScalarField
This serves the same purpose as LasScalarField but for extra bytes.
Definition:
LasExtraScalarField.h:41
LasExtraScalarField::InitExtraBytesVlr
static void InitExtraBytesVlr(laszip_vlr_struct &vlr, const std::vector< LasExtraScalarField > &extraFields)
Definition:
LasExtraScalarField.cpp:302
LasExtraScalarField::ccName
char ccName[MAX_NAME_SIZE+8]
Definition:
LasExtraScalarField.h:147
LasExtraScalarField::i16
@ i16
Definition:
LasExtraScalarField.h:68
LasExtraScalarField::setScaleIsRelevant
void setScaleIsRelevant(bool isRelevant)
Definition:
LasExtraScalarField.cpp:255
LasExtraScalarField::scalarFields
ccScalarField * scalarFields[MAX_DIM_SIZE]
Definition:
LasExtraScalarField.h:141
LasExtraScalarField::u8
@ u8
Definition:
LasExtraScalarField.h:65
laszip_vlr_struct
laszip_vlr laszip_vlr_struct
Definition:
LasExtraScalarField.h:37
LasExtraScalarField::DimensionSize
DimensionSize
Definition:
LasExtraScalarField.h:54
LasExtraScalarField::i8
@ i8
Definition:
LasExtraScalarField.h:66
LasExtraScalarField::DimensionSize::Three
@ Three
LasExtraScalarField::offsets
double offsets[MAX_DIM_SIZE]
Definition:
LasExtraScalarField.h:137
LasExtraScalarField::Kind
Kind
Definition:
LasExtraScalarField.h:78
LasExtraScalarField::i64
@ i64
Definition:
LasExtraScalarField.h:72
LasExtraScalarField::Undocumented
@ Undocumented
Definition:
LasExtraScalarField.h:64
LasExtraScalarField::name
char name[MAX_NAME_SIZE]
Definition:
LasExtraScalarField.h:131
LasExtraScalarField::minIsRelevant
bool minIsRelevant() const
Definition:
LasExtraScalarField.cpp:235
LasExtraScalarField::UpdateByteOffsets
static void UpdateByteOffsets(std::vector< LasExtraScalarField > &extraFields)
Definition:
LasExtraScalarField.cpp:379
laszip_vlr_struct
laszip_vlr laszip_vlr_struct
Definition:
LasDetails.h:46
LasExtraScalarField::u32
@ u32
Definition:
LasExtraScalarField.h:69
LasExtraScalarField::operator<<
friend QDataStream & operator<<(QDataStream &dataStream, const LasExtraScalarField &extraScalarField)
Definition:
LasExtraScalarField.cpp:47
LasExtraScalarField::type
DataType type
Definition:
LasExtraScalarField.h:127
LasExtraScalarField::setOffsetIsRelevant
void setOffsetIsRelevant(bool isRelevant)
Definition:
LasExtraScalarField.cpp:267
LasExtraScalarField::noData
uint8_t noData[MAX_DIM_SIZE][8]
Definition:
LasExtraScalarField.h:133
LasExtraScalarField::MAX_NAME_SIZE
static constexpr unsigned MAX_NAME_SIZE
Definition:
LasExtraScalarField.h:51
LasExtraScalarField::mins
uint8_t mins[MAX_DIM_SIZE][8]
Definition:
LasExtraScalarField.h:134
LasExtraScalarField::LasExtraScalarField
LasExtraScalarField()=default
LasExtraScalarField::Signed
@ Signed
Definition:
LasExtraScalarField.h:80
LasExtraScalarField::dimensions
DimensionSize dimensions
Definition:
LasExtraScalarField.h:128
LasExtraScalarField::DataTypeFromValue
static std::tuple< DataType, DimensionSize > DataTypeFromValue(uint8_t value)
Definition:
LasExtraScalarField.cpp:67
LasExtraScalarField::f64
@ f64
Definition:
LasExtraScalarField.h:74
LasExtraScalarField::DataType
DataType
Data types available LAS Extra Field.
Definition:
LasExtraScalarField.h:62
LasExtraScalarField::resetScalarFieldsPointers
void resetScalarFieldsPointers()
Definition:
LasExtraScalarField.cpp:371
LasExtraScalarField::elementSize
unsigned elementSize() const
Definition:
LasExtraScalarField.cpp:134
LasExtraScalarField::u64
@ u64
Definition:
LasExtraScalarField.h:71
LasExtraScalarField::operator>>
friend QDataStream & operator>>(QDataStream &dataStream, LasExtraScalarField &extraScalarField)
Definition:
LasExtraScalarField.cpp:24
LasExtraScalarField::options
uint8_t options
Definition:
LasExtraScalarField.h:130
LasExtraScalarField::maxIsRelevant
bool maxIsRelevant() const
Definition:
LasExtraScalarField.cpp:240
ccScalarField
A scalar field associated to display-related parameters.
Definition:
ecvScalarField.h:19
LasExtraScalarField::offsetIsRelevant
bool offsetIsRelevant() const
Definition:
LasExtraScalarField.cpp:250
LasExtraScalarField::f32
@ f32
Definition:
LasExtraScalarField.h:73
plugins
core
IO
qLASIO
include
LasExtraScalarField.h
Generated on Wed Nov 18 2026 14:48:10 for ACloudViewer by
1.8.17