ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccWaveform Class Reference

Waveform. More...

#include <ecvWaveform.h>

Inheritance diagram for ccWaveform:
Collaboration diagram for ccWaveform:

Public Member Functions

 ccWaveform (uint8_t descriptorID=0)
 Default constructor. More...
 
 ~ccWaveform () override=default
 Destructor. More...
 
uint8_t descriptorID () const
 Returns the associated descriptor (ID) More...
 
void setDescriptorID (uint8_t id)
 Sets the associated descriptor (ID) More...
 
void setDataDescription (uint64_t dataOffset, uint32_t byteCount)
 Describes the waveform data. More...
 
uint32_t getRawSample (uint32_t i, const WaveformDescriptor &descriptor, const uint8_t *dataStorage) const
 Returns the (raw) value of a given sample. More...
 
double getSample (uint32_t i, const WaveformDescriptor &descriptor, const uint8_t *dataStorage) const
 Returns the (real) value of a given sample (in volts) More...
 
double getRange (double &minVal, double &maxVal, const WaveformDescriptor &descriptor, const uint8_t *dataStorage) const
 Returns the range of (real) samples. More...
 
bool decodeSamples (std::vector< double > &values, const WaveformDescriptor &descriptor, const uint8_t *dataStorage) const
 Decodes the samples and store them in a vector. More...
 
bool toASCII (const QString &filename, const WaveformDescriptor &descriptor, const uint8_t *dataStorage) const
 Exports (real) samples to an ASCII file. More...
 
CCVector3 getSamplePos (float i, const CCVector3 &P0, const WaveformDescriptor &descriptor) const
 Returns the sample position in 3D. More...
 
uint32_t byteCount () const
 Returns the number of allocated bytes. More...
 
uint64_t dataOffset () const
 Returns the byte offset to waveform data. More...
 
void setDataOffset (uint64_t offset)
 Sets the byte offset to waveform data. More...
 
const uint8_t * data (const uint8_t *dataStorage) const
 Gives access to the internal data. More...
 
void setBeamDir (const CCVector3f &dir)
 Sets the beam direction. More...
 
const CCVector3fbeamDir () const
 Returns the beam direction. More...
 
void setEchoTime_ps (float time_ps)
 Set the echo time (in picoseconds) More...
 
float echoTime_ps () const
 Returns the echo time (in picoseconds) More...
 
void applyRigidTransformation (const ccGLMatrix &trans)
 Applies a rigid transformation (on the beam direction) More...
 
uint8_t returnIndex () const
 Returns the return index. More...
 
void setReturnIndex (uint8_t index)
 Sets the return index. More...
 
bool isSerializable () const override
 Returns whether object is serializable of not. More...
 
bool toFile (QFile &out, short dataVersion) const override
 Saves data to binary stream. More...
 
short minimumFileVersion () const override
 Returns the minimum file version required to save this instance. More...
 
bool fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
 Loads data from binary stream. More...
 
- Public Member Functions inherited from ccSerializableObject
virtual ~ccSerializableObject ()=default
 Destructor. More...
 

Static Public Member Functions

static bool ToASCII (const QString &filename, std::vector< double > &values, uint32_t samplingRate_ps)
 Helper: exports a series of values as an ASCII file. More...
 
- Static Public Member Functions inherited from ccSerializableObject
static bool WriteError ()
 Sends a custom error message (write error) and returns 'false'. More...
 
static bool ReadError ()
 Sends a custom error message (read error) and returns 'false'. More...
 
static bool MemoryError ()
 Sends a custom error message (not enough memory) and returns 'false'. More...
 
static bool CorruptError ()
 Sends a custom error message (corrupted file) and returns 'false'. More...
 

Protected Attributes

uint32_t m_byteCount
 Waveform packet size in bytes. More...
 
uint64_t m_dataOffset
 Byte offset to waveform data. More...
 
CCVector3f m_beamDir
 Laser beam direction. More...
 
float m_echoTime_ps
 Return Point location (in picoseconds) More...
 
uint8_t m_descriptorID
 Wave Packet descriptor index. More...
 
uint8_t m_returnIndex
 Return index. More...
 

Additional Inherited Members

- Public Types inherited from ccSerializableObject
enum  DeserializationFlags { DF_POINT_COORDS_64_BITS , DF_SCALAR_VAL_32_BITS = 2 }
 Deserialization flags (bit-field) More...
 
typedef QMultiMap< unsigned, unsigned > LoadedIDMap
 Map of loaded unique IDs (old ID --> new ID) More...
 

Detailed Description

Waveform.

Warning
Waveforms do not own their data!

Definition at line 55 of file ecvWaveform.h.

Constructor & Destructor Documentation

◆ ccWaveform()

ccWaveform::ccWaveform ( uint8_t  descriptorID = 0)

Default constructor.

◆ ~ccWaveform()

ccWaveform::~ccWaveform ( )
overridedefault

Destructor.

Member Function Documentation

◆ applyRigidTransformation()

void ccWaveform::applyRigidTransformation ( const ccGLMatrix trans)

Applies a rigid transformation (on the beam direction)

Referenced by define_ccWaveform().

◆ beamDir()

const CCVector3f& ccWaveform::beamDir ( ) const
inline

Returns the beam direction.

Definition at line 129 of file ecvWaveform.h.

Referenced by define_ccWaveform(), LasWaveformSaver::handlePoint(), and LASFWFFilter::saveToFile().

◆ byteCount()

uint32_t ccWaveform::byteCount ( ) const
inline

Returns the number of allocated bytes.

Definition at line 112 of file ecvWaveform.h.

Referenced by define_ccWaveform(), LasWaveformSaver::handlePoint(), and LASFWFFilter::saveToFile().

◆ data()

const uint8_t* ccWaveform::data ( const uint8_t *  dataStorage) const
inline

Gives access to the internal data.

Definition at line 121 of file ecvWaveform.h.

◆ dataOffset()

uint64_t ccWaveform::dataOffset ( ) const
inline

Returns the byte offset to waveform data.

Definition at line 115 of file ecvWaveform.h.

Referenced by define_ccWaveform(), LasWaveformSaver::handlePoint(), and LASFWFFilter::saveToFile().

◆ decodeSamples()

bool ccWaveform::decodeSamples ( std::vector< double > &  values,
const WaveformDescriptor descriptor,
const uint8_t *  dataStorage 
) const

Decodes the samples and store them in a vector.

◆ descriptorID()

uint8_t ccWaveform::descriptorID ( ) const
inline

Returns the associated descriptor (ID)

Warning
A value of zero indicates that there is no associated waveform data.

Definition at line 67 of file ecvWaveform.h.

Referenced by define_ccWaveform(), and LasWaveformSaver::handlePoint().

◆ echoTime_ps()

float ccWaveform::echoTime_ps ( ) const
inline

Returns the echo time (in picoseconds)

Definition at line 135 of file ecvWaveform.h.

Referenced by define_ccWaveform(), LasWaveformSaver::handlePoint(), and LASFWFFilter::saveToFile().

◆ fromFile()

bool ccWaveform::fromFile ( QFile &  in,
short  dataVersion,
int  flags,
LoadedIDMap oldToNewIDMap 
)
overridevirtual

Loads data from binary stream.

Parameters
ininput file (already opened)
dataVersionfile version (for version-specific deserialization)
flagsdeserialization flags (see ccSerializableObject::DeserializationFlags)
oldToNewIDMapmap to link old IDs with new IDs
Returns
success
Note: When implementing, use dataVersion checks to handle different
versions:
  • if (dataVersion >= X) { read new field } else { use default value } This ensures forward compatibility with older file formats.

Reimplemented from ccSerializableObject.

◆ getRange()

double ccWaveform::getRange ( double &  minVal,
double &  maxVal,
const WaveformDescriptor descriptor,
const uint8_t *  dataStorage 
) const

Returns the range of (real) samples.

◆ getRawSample()

uint32_t ccWaveform::getRawSample ( uint32_t  i,
const WaveformDescriptor descriptor,
const uint8_t *  dataStorage 
) const

Returns the (raw) value of a given sample.

Referenced by define_ccWaveform().

◆ getSample()

double ccWaveform::getSample ( uint32_t  i,
const WaveformDescriptor descriptor,
const uint8_t *  dataStorage 
) const

Returns the (real) value of a given sample (in volts)

◆ getSamplePos()

CCVector3 ccWaveform::getSamplePos ( float  i,
const CCVector3 P0,
const WaveformDescriptor descriptor 
) const

Returns the sample position in 3D.

Referenced by define_ccWaveform().

◆ isSerializable()

bool ccWaveform::isSerializable ( ) const
inlineoverridevirtual

Returns whether object is serializable of not.

Reimplemented from ccSerializableObject.

Definition at line 146 of file ecvWaveform.h.

◆ minimumFileVersion()

short ccWaveform::minimumFileVersion ( ) const
overridevirtual

Returns the minimum file version required to save this instance.

To be overridden by subclasses to indicate their minimum required version. This enables the system to determine:

  • Forward compatibility: newer software can read older files (dataVersion check in fromFile)
  • Backward compatibility: determine minimum version needed to save current data
    Returns
    minimum file version required for this object

Implements ccSerializableObject.

◆ returnIndex()

uint8_t ccWaveform::returnIndex ( ) const
inline

Returns the return index.

Definition at line 141 of file ecvWaveform.h.

Referenced by define_ccWaveform(), and LASFWFFilter::saveToFile().

◆ setBeamDir()

void ccWaveform::setBeamDir ( const CCVector3f dir)
inline

Sets the beam direction.

Definition at line 126 of file ecvWaveform.h.

Referenced by define_ccWaveform(), LASFWFFilter::loadFile(), and LasWaveformLoader::loadWaveform().

◆ setDataDescription()

void ccWaveform::setDataDescription ( uint64_t  dataOffset,
uint32_t  byteCount 
)

Describes the waveform data.

Referenced by define_ccWaveform(), LASFWFFilter::loadFile(), and LasWaveformLoader::loadWaveform().

◆ setDataOffset()

void ccWaveform::setDataOffset ( uint64_t  offset)
inline

Sets the byte offset to waveform data.

Definition at line 118 of file ecvWaveform.h.

References offset.

Referenced by define_ccWaveform().

◆ setDescriptorID()

void ccWaveform::setDescriptorID ( uint8_t  id)
inline

Sets the associated descriptor (ID)

Definition at line 70 of file ecvWaveform.h.

Referenced by define_ccWaveform(), LASFWFFilter::loadFile(), and LasWaveformLoader::loadWaveform().

◆ setEchoTime_ps()

void ccWaveform::setEchoTime_ps ( float  time_ps)
inline

Set the echo time (in picoseconds)

Definition at line 132 of file ecvWaveform.h.

Referenced by define_ccWaveform(), LASFWFFilter::loadFile(), and LasWaveformLoader::loadWaveform().

◆ setReturnIndex()

void ccWaveform::setReturnIndex ( uint8_t  index)
inline

Sets the return index.

Definition at line 143 of file ecvWaveform.h.

Referenced by define_ccWaveform(), LASFWFFilter::loadFile(), and LasWaveformLoader::loadWaveform().

◆ toASCII()

bool ccWaveform::toASCII ( const QString &  filename,
const WaveformDescriptor descriptor,
const uint8_t *  dataStorage 
) const

Exports (real) samples to an ASCII file.

Referenced by define_ccWaveform().

◆ ToASCII()

static bool ccWaveform::ToASCII ( const QString &  filename,
std::vector< double > &  values,
uint32_t  samplingRate_ps 
)
static

Helper: exports a series of values as an ASCII file.

Referenced by define_ccWaveform().

◆ toFile()

bool ccWaveform::toFile ( QFile &  out,
short  dataVersion 
) const
overridevirtual

Saves data to binary stream.

Parameters
outoutput file (already opened)
dataVersiontarget file version (for forward/backward compatibility)
Returns
success

Reimplemented from ccSerializableObject.

Member Data Documentation

◆ m_beamDir

CCVector3f ccWaveform::m_beamDir
protected

Laser beam direction.

Parametric line equation for extrapolating points along the associated waveform: X = X0 + X(t) Y = Y0 + Y(t) Z = Z0 + Z(t)

Definition at line 167 of file ecvWaveform.h.

◆ m_byteCount

uint32_t ccWaveform::m_byteCount
protected

Waveform packet size in bytes.

Warning
Not necessarily equal to the number of samples!

Definition at line 158 of file ecvWaveform.h.

◆ m_dataOffset

uint64_t ccWaveform::m_dataOffset
protected

Byte offset to waveform data.

Definition at line 161 of file ecvWaveform.h.

◆ m_descriptorID

uint8_t ccWaveform::m_descriptorID
protected

Wave Packet descriptor index.

Warning
A value of zero indicates that there is no associated waveform data.

Definition at line 180 of file ecvWaveform.h.

◆ m_echoTime_ps

float ccWaveform::m_echoTime_ps
protected

Return Point location (in picoseconds)

The offset in picoseconds from the first digitized value to the location within the waveform packet that the associated return pulse was detected.

Definition at line 174 of file ecvWaveform.h.

◆ m_returnIndex

uint8_t ccWaveform::m_returnIndex
protected

Return index.

Definition at line 183 of file ecvWaveform.h.


The documentation for this class was generated from the following file: