ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
LasWaveformSaver.cpp
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 #include "LasWaveformSaver.h"
9 
10 #include "LasDetails.h"
11 
12 #include <ecvPointCloud.h>
13 
15  : m_array(29, '\0')
16  , m_pointCloud(pointCloud)
17 {
18 }
19 
20 void LasWaveformSaver::handlePoint(size_t index, laszip_point& point)
21 {
22  assert(index < m_pointCloud.size());
23  const ccWaveform& w = m_pointCloud.waveforms().at(index);
24 
25  {
26  QDataStream stream(&m_array, QIODevice::WriteOnly);
27  stream.setByteOrder(QDataStream::ByteOrder::LittleEndian);
28  stream << w.descriptorID();
29  stream << static_cast<quint64>(w.dataOffset() + LasDetails::EvlrHeader::SIZE);
30  stream << w.byteCount();
31  stream << w.echoTime_ps();
32  stream << w.beamDir().x << w.beamDir().y << w.beamDir().z;
33  }
34 
35  memcpy(point.wave_packet, m_array.constData(), 29);
36 }
Type y
Definition: CVGeom.h:137
Type x
Definition: CVGeom.h:137
Type z
Definition: CVGeom.h:137
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
std::vector< ccWaveform > & waveforms()
Gives access to the associated FWF data.
Waveform.
Definition: ecvWaveform.h:55
uint32_t byteCount() const
Returns the number of allocated bytes.
Definition: ecvWaveform.h:112
float echoTime_ps() const
Returns the echo time (in picoseconds)
Definition: ecvWaveform.h:135
uint8_t descriptorID() const
Returns the associated descriptor (ID)
Definition: ecvWaveform.h:67
const CCVector3f & beamDir() const
Returns the beam direction.
Definition: ecvWaveform.h:129
uint64_t dataOffset() const
Returns the byte offset to waveform data.
Definition: ecvWaveform.h:115
unsigned size() const override
Definition: PointCloudTpl.h:38
static constexpr size_t SIZE
Definition: LasDetails.h:94
void handlePoint(size_t index, laszip_point &point)
LasWaveformSaver(const ccPointCloud &pointCloud) noexcept
Definition: lsd.c:149