MrSID Decode SDK for LiDAR Reference Manual
1.1.3.4427
Main Page
Classes
Files
File List
File Members
PointData.h
Go to the documentation of this file.
1
/* //////////////////////////////////////////////////////////////////////////
2
// //
3
// This code is Copyright (c) 2008-2010 LizardTech, Inc, 1008 Western //
4
// Avenue, Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
5
// prohibited. Access to and use of this code is permitted only under //
6
// license from LizardTech, Inc. Portions of the code are protected by //
7
// US and foreign patents and other filings. All Rights Reserved. //
8
// //
10
/* PUBLIC */
11
12
#ifndef __LIDAR_POINT_DATA_H__
13
#define __LIDAR_POINT_DATA_H__
14
15
#include "
lidar/Base.h
"
16
17
LT_BEGIN_LIDAR_NAMESPACE
18
class
ChannelData
;
19
class
PointData
;
20
26
enum
DataType
27
{
28
// don't change the values they are serialized
29
// all values must be less then 1 << 16
30
31
DATATYPE_INVALID
= 0x0000,
32
33
DATATYPE_UINT8
= 0x0100,
34
DATATYPE_SINT8
= 0x0101,
35
DATATYPE_UINT16
= 0x0200,
36
DATATYPE_SINT16
= 0x0201,
37
DATATYPE_UINT32
= 0x0400,
38
DATATYPE_SINT32
= 0x0401,
39
DATATYPE_UINT64
= 0x0800,
40
DATATYPE_SINT64
= 0x0801,
41
42
DATATYPE_FLOAT32
= 0x0403,
43
DATATYPE_FLOAT64
= 0x0803
44
};
45
49
struct
DataTypeUtils
50
{
58
static
inline
bool
isSigned
(
DataType
dt) {
return
(dt & 0x1) == 0x1; }
59
67
static
inline
bool
isFloat
(
DataType
dt) {
return
(dt & 0x2) == 0x2; }
68
77
static
inline
int
byteWidth
(
DataType
dt) {
return
(dt >> 8) & 0xFF; }
78
87
static
const
char
*
toString
(
DataType
dt);
88
static
DataType
toDataType
(
const
char
*str);
89
};
90
94
#define CHANNEL_NAME_X "X"
95
#define CHANNEL_NAME_Y "Y"
96
#define CHANNEL_NAME_Z "Z"
97
#define CHANNEL_NAME_Intensity "Intensity"
98
#define CHANNEL_NAME_ReturnNum "ReturnNum"
99
#define CHANNEL_NAME_NumReturns "NumReturns"
100
#define CHANNEL_NAME_ScanDir "ScanDir"
101
#define CHANNEL_NAME_EdgeFlightLine "EdgeFlightLine"
102
#define CHANNEL_NAME_ClassId "ClassId"
103
#define CHANNEL_NAME_ScanAngle "ScanAngle"
104
#define CHANNEL_NAME_UserData "UserData"
105
#define CHANNEL_NAME_SourceId "SourceId"
106
#define CHANNEL_NAME_GPSTime_Week "GPSTime"
107
#define CHANNEL_NAME_GPSTime_Adjusted "GPSTime_Adjusted"
108
#define CHANNEL_NAME_Red "Red"
109
#define CHANNEL_NAME_Green "Green"
110
#define CHANNEL_NAME_Blue "Blue"
111
112
// Used with the TXTPointReader to skip a field
113
#define CHANNEL_NAME_Skip "@Skip"
114
115
116
123
class
ChannelInfo
124
{
125
SIMPLE_OBJECT(
ChannelInfo
);
126
public
:
127
~ChannelInfo
(
void
);
128
ChannelInfo
(
void
);
129
130
void
init
(
const
char
*name,
DataType
datatype,
int
bits,
double
quantization = 0);
131
void
init
(
const
ChannelInfo
&info);
132
138
const
char
*
getName
(
void
)
const
;
139
145
DataType
getDataType
(
void
)
const
;
146
154
size_t
getBits
(
void
)
const
;
155
161
double
getQuantization
(
void
)
const
;
162
163
bool
operator==
(
const
ChannelInfo
&rhs)
const
;
164
bool
operator!=
(
const
ChannelInfo
&rhs)
const
{
return
!
operator==
(rhs); }
165
166
protected
:
167
char
*
m_name
;
168
DataType
m_datatype
;
169
int
m_bits
;
170
double
m_quantization
;
171
};
172
181
class
PointInfo
182
{
183
SIMPLE_OBJECT(
PointInfo
);
184
public
:
185
~PointInfo
(
void
);
186
PointInfo
(
void
);
187
188
void
init
(
size_t
numChannels);
189
void
init
(
const
PointInfo
&pointInfo);
190
void
init
(
const
PointData
&pointData);
191
197
size_t
getNumChannels
(
void
)
const
;
198
207
const
ChannelInfo
&
getChannel
(
size_t
idx)
const
;
208
217
ChannelInfo
&
getChannel
(
size_t
idx);
218
227
bool
hasChannel
(
const
char
*name)
const
;
228
237
const
ChannelInfo
*
getChannel
(
const
char
*name)
const
;
238
247
ChannelInfo
*
getChannel
(
const
char
*name);
248
257
size_t
getChannelIndex
(
const
char
*name)
const
;
258
265
bool
hasValidXYZ
(
void
)
const
;
266
267
268
bool
operator==
(
const
PointInfo
&rhs)
const
;
269
bool
operator!=
(
const
PointInfo
&rhs)
const
{
return
!
operator==
(rhs); }
270
271
protected
:
272
size_t
m_numChannels
;
273
ChannelInfo
*
m_channel
;
274
};
275
279
class
ChannelData
:
public
ChannelInfo
280
{
281
DISABLE_COPY(
ChannelData
);
282
public
:
283
~ChannelData
(
void
);
284
ChannelData
(
void
);
285
286
void
init
(
const
ChannelInfo
&info,
size_t
numSamples);
287
294
size_t
getNumSamples
(
void
)
const
;
295
304
const
void
*
getData
(
void
)
const
;
305
314
void
*
getData
(
void
);
315
329
static
void
copy
(
ChannelData
&dst,
size_t
dstOffset,
330
const
ChannelData
&src,
size_t
srcOffset,
331
size_t
length);
332
348
static
void
convert
(
ChannelData
&dst,
size_t
dstOffset,
349
const
ChannelData
&src,
size_t
srcOffset,
350
size_t
length);
351
371
static
void
convert
(
ChannelData
&dst,
size_t
dstOffset,
372
const
ChannelData
&src,
size_t
srcOffset,
373
double
offset,
double
scale,
374
size_t
length);
375
385
void
setDataType
(
DataType
datatype);
386
393
void
resize
(
size_t
newNumSamples);
394
396
void
setOffset
(
size_t
offset);
397
protected
:
398
size_t
m_numSamples
;
399
size_t
m_offset
;
400
void
*
m_data
;
401
};
402
411
class
PointData
412
{
413
SIMPLE_OBJECT(
PointData
);
414
public
:
415
~PointData
(
void
);
416
PointData
(
void
);
417
418
void
init
(
const
PointInfo
&pointInfo,
size_t
numSamples);
419
425
size_t
getNumChannels
(
void
)
const
;
426
433
size_t
getNumSamples
(
void
)
const
;
434
443
const
ChannelData
&
getChannel
(
size_t
idx)
const
;
444
453
ChannelData
&
getChannel
(
size_t
idx);
454
463
bool
hasChannel
(
const
char
*name)
const
;
464
473
const
ChannelData
*
getChannel
(
const
char
*name)
const
;
474
483
ChannelData
*
getChannel
(
const
char
*name);
484
490
const
double
*
getX
(
void
)
const
;
491
497
double
*
getX
(
void
);
498
504
const
double
*
getY
(
void
)
const
;
505
511
double
*
getY
(
void
);
512
518
const
double
*
getZ
(
void
)
const
;
519
525
double
*
getZ
(
void
);
526
540
static
void
copy
(
PointData
&dst,
size_t
dstOffset,
541
const
PointData
&src,
size_t
srcOffset,
542
size_t
length);
543
557
static
void
merge
(
PointData
&dst,
size_t
dstNumPoints,
558
const
PointData
&src,
size_t
srcNumPoints);
559
566
void
resize
(
size_t
newNumSamples);
567
569
void
setOffset
(
size_t
offset);
570
protected
:
571
size_t
m_numChannels
;
572
ChannelData
*
m_channel
;
573
size_t
m_numSamples
;
574
size_t
m_offset
;
575
576
// just pointers into m_channel[]
577
double
*
m_x
;
578
double
*
m_y
;
579
double
*
m_z
;
580
};
581
582
LT_END_LIDAR_NAMESPACE
583
#endif
/* __LIDAR_POINT_DATA_H__ */
LizardTech