ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccPointCloud::Grid Struct Reference

Grid structure. More...

#include <ecvPointCloud.h>

Inheritance diagram for ccPointCloud::Grid:
Collaboration diagram for ccPointCloud::Grid:

Public Types

using Shared = QSharedPointer< Grid >
 Shared type. More...
 
- 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...
 

Public Member Functions

 Grid ()
 Default constructor. More...
 
 Grid (const Grid &grid)=default
 Copy constructor. More...
 
bool init (unsigned rowCount, unsigned colCount, bool withRGB=false)
 Inits the grid. More...
 
void setIndex (unsigned row, unsigned col, int index)
 Sets an index at a given position inside the grid. More...
 
void setColor (unsigned row, unsigned col, const ecvColor::Rgb &rgb)
 Sets a color at a given position inside the grid. More...
 
void updateMinAndMaxValidIndexes ()
 Updates the min and max valid indexes. More...
 
QImage toImage () const
 Converts the grid to an RGB image (needs colors) 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...
 
bool fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
 Loads data from binary stream. More...
 
short minimumFileVersion () const override
 Returns the minimum file version required to save this instance. More...
 
- Public Member Functions inherited from ccSerializableObject
virtual ~ccSerializableObject ()=default
 Destructor. More...
 

Public Attributes

unsigned w
 Grid width. More...
 
unsigned h
 Grid height. More...
 
unsigned validCount
 Number of valid indexes. More...
 
unsigned minValidIndex
 Minimum valid index. More...
 
unsigned maxValidIndex
 Maximum valid index. More...
 
std::vector< int > indexes
 Grid indexes (size: w x h) More...
 
std::vector< ecvColor::Rgbcolors
 Grid colors (size: w x h, or 0 = no color) More...
 
ccGLMatrixd sensorPosition
 Sensor position (expressed relatively to the cloud points) More...
 

Additional Inherited Members

- 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...
 

Detailed Description

Grid structure.

Definition at line 383 of file ecvPointCloud.h.

Member Typedef Documentation

◆ Shared

using ccPointCloud::Grid::Shared = QSharedPointer<Grid>

Shared type.

Definition at line 385 of file ecvPointCloud.h.

Constructor & Destructor Documentation

◆ Grid() [1/2]

ccPointCloud::Grid::Grid ( )

Default constructor.

◆ Grid() [2/2]

ccPointCloud::Grid::Grid ( const Grid grid)
default

Copy constructor.

Warning
May throw a bad_alloc exception

Member Function Documentation

◆ fromFile()

bool ccPointCloud::Grid::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.

◆ init()

bool ccPointCloud::Grid::init ( unsigned  rowCount,
unsigned  colCount,
bool  withRGB = false 
)

Inits the grid.

◆ isSerializable()

bool ccPointCloud::Grid::isSerializable ( ) const
inlineoverridevirtual

Returns whether object is serializable of not.

Reimplemented from ccSerializableObject.

Definition at line 411 of file ecvPointCloud.h.

◆ minimumFileVersion()

short ccPointCloud::Grid::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.

◆ setColor()

void ccPointCloud::Grid::setColor ( unsigned  row,
unsigned  col,
const ecvColor::Rgb rgb 
)

Sets a color at a given position inside the grid.

◆ setIndex()

void ccPointCloud::Grid::setIndex ( unsigned  row,
unsigned  col,
int  index 
)

Sets an index at a given position inside the grid.

◆ toFile()

bool ccPointCloud::Grid::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.

◆ toImage()

QImage ccPointCloud::Grid::toImage ( ) const

Converts the grid to an RGB image (needs colors)

◆ updateMinAndMaxValidIndexes()

void ccPointCloud::Grid::updateMinAndMaxValidIndexes ( )

Updates the min and max valid indexes.

Member Data Documentation

◆ colors

std::vector<ecvColor::Rgb> ccPointCloud::Grid::colors

Grid colors (size: w x h, or 0 = no color)

Definition at line 434 of file ecvPointCloud.h.

◆ h

unsigned ccPointCloud::Grid::h

Grid height.

Definition at line 422 of file ecvPointCloud.h.

◆ indexes

std::vector<int> ccPointCloud::Grid::indexes

Grid indexes (size: w x h)

Definition at line 432 of file ecvPointCloud.h.

◆ maxValidIndex

unsigned ccPointCloud::Grid::maxValidIndex

Maximum valid index.

Definition at line 429 of file ecvPointCloud.h.

◆ minValidIndex

unsigned ccPointCloud::Grid::minValidIndex

Minimum valid index.

Definition at line 427 of file ecvPointCloud.h.

◆ sensorPosition

ccGLMatrixd ccPointCloud::Grid::sensorPosition

Sensor position (expressed relatively to the cloud points)

Definition at line 437 of file ecvPointCloud.h.

◆ validCount

unsigned ccPointCloud::Grid::validCount

Number of valid indexes.

Definition at line 425 of file ecvPointCloud.h.

◆ w

unsigned ccPointCloud::Grid::w

Grid width.

Definition at line 420 of file ecvPointCloud.h.


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