qCC_db version 2.13.alpha (Qt) - 31 May 2022
CloudCompare 3D entities
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ccObject Class Referenceabstract

Generic "CloudCompare Object" template. More...

#include <ccObject.h>

Inheritance diagram for ccObject:
Inheritance graph
[legend]
Collaboration diagram for ccObject:
Collaboration graph
[legend]

Public Member Functions

 ccObject (const QString &name=QString(), unsigned uniqueID=ccUniqueIDGenerator::InvalidUniqueID)
 Default constructor. More...
 
 ccObject (const ccObject &object)
 Copy constructor.
 
virtual CC_CLASS_ENUM getClassID () const =0
 Returns class ID. More...
 
virtual QString getName () const
 Returns object name. More...
 
virtual void setName (const QString &name)
 Sets object name.
 
virtual unsigned getUniqueID () const
 Returns object unique ID.
 
virtual void setUniqueID (unsigned ID)
 Changes unique ID. More...
 
virtual bool isEnabled () const
 Returns whether the object is enabled or not. More...
 
virtual void setEnabled (bool state)
 Sets the "enabled" property. More...
 
virtual void toggleActivation ()
 Toggles the "enabled" property.
 
virtual bool isLocked () const
 Returns whether the object is locked or not. More...
 
virtual void setLocked (bool state)
 Sets the "enabled" property. More...
 
bool isLeaf () const
 
bool isCustom () const
 
bool isHierarchy () const
 
bool isKindOf (CC_CLASS_ENUM type) const
 
bool isA (CC_CLASS_ENUM type) const
 
QVariant getMetaData (const QString &key) const
 Returns a given associated meta data. More...
 
bool removeMetaData (const QString &key)
 Removes a given associated meta-data. More...
 
void setMetaData (const QString &key, const QVariant &data)
 Sets a meta-data element. More...
 
void setMetaData (const QVariantMap &dataset, bool overwrite=false)
 Sets several meta-data elements at a time. More...
 
bool hasMetaData (const QString &key) const
 Returns whether a meta-data element with the given key exists or not. More...
 
const QVariantMap & metaData () const
 Returns meta-data map (const only)
 
- Public Member Functions inherited from ccSerializableObject
virtual ~ccSerializableObject ()=default
 Destructor.
 
virtual bool isSerializable () const
 Returns whether object is serializable of not. More...
 
virtual bool toFile (QFile &out) const
 Saves data to binary stream. More...
 
virtual bool fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap)
 Loads data from binary stream. More...
 

Static Public Member Functions

static unsigned GetCurrentDBVersion ()
 Returns current database version.
 
static void SetUniqueIDGenerator (ccUniqueIDGenerator::Shared generator)
 Sets the unique ID generator.
 
static ccUniqueIDGenerator::Shared GetUniqueIDGenerator ()
 Returns the unique ID generator.
 
static unsigned GetNextUniqueID ()
 Returns a new unassigned unique ID. More...
 
static unsigned GetLastUniqueID ()
 Returns last assigned unique ID. More...
 
static CC_CLASS_ENUM ReadClassIDFromFile (QFile &in, short dataVersion)
 Helper: reads out class ID from a binary stream. 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 Member Functions

virtual bool getFlagState (CC_OBJECT_FLAG flag) const
 Returns flag state.
 
virtual void setFlagState (CC_OBJECT_FLAG flag, bool state)
 Sets flag state. More...
 
bool toFile (QFile &out) const override
 Saves data to binary stream. More...
 
bool fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
 Reimplemented from ccSerializableObject::fromFile. More...
 

Protected Attributes

QString m_name
 Object name.
 
unsigned m_flags
 Object flags.
 
QVariantMap m_metaData
 Associated meta-data.
 

Additional Inherited Members

- Public Types inherited from ccSerializableObject
enum  DeserializationFlags { DF_POINT_COORDS_64_BITS = 1 , 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)
 

Detailed Description

Generic "CloudCompare Object" template.

Constructor & Destructor Documentation

◆ ccObject()

ccObject::ccObject ( const QString &  name = QString(),
unsigned  uniqueID = ccUniqueIDGenerator::InvalidUniqueID 
)

Default constructor.

Parameters
nameobject name (optional)
uniqueIDunique ID (handle with care! Will be auto generated if equal to ccUniqueIDGenerator::InvalidUniqueID)

Member Function Documentation

◆ fromFile()

bool ccObject::fromFile ( QFile &  in,
short  dataVersion,
int  flags,
LoadedIDMap oldToNewIDMap 
)
overrideprotectedvirtual

Reimplemented from ccSerializableObject::fromFile.

Be sure to call ccObject::ReadClassIDFromFile (once) before calling this method, as the classID is voluntarily skipped (in order to let the user instantiate the object first)

Reimplemented from ccSerializableObject.

◆ getClassID()

virtual CC_CLASS_ENUM ccObject::getClassID ( ) const
pure virtual

◆ GetLastUniqueID()

unsigned ccObject::GetLastUniqueID ( )
static

Returns last assigned unique ID.

Unique IDs are handled with persistent settings in order to assure consistency between main app and plugins!

◆ getMetaData()

QVariant ccObject::getMetaData ( const QString &  key) const

Returns a given associated meta data.

Parameters
keymeta data unique identifier (case sensitive)
Returns
meta data (if any) or an invalid QVariant

◆ getName()

virtual QString ccObject::getName ( ) const
inlinevirtual

Returns object name.

Reimplemented in cc2DLabel.

◆ GetNextUniqueID()

unsigned ccObject::GetNextUniqueID ( )
static

Returns a new unassigned unique ID.

Unique IDs are handled with persistent settings in order to assure consistency between main app and plugins!

◆ hasMetaData()

bool ccObject::hasMetaData ( const QString &  key) const

Returns whether a meta-data element with the given key exists or not.

Parameters
keymeta-data unique identifier (case sensitive)
Returns
whether the element exists or not

◆ isEnabled()

virtual bool ccObject::isEnabled ( ) const
inlinevirtual

Returns whether the object is enabled or not.

Shortcut to access flag CC_ENABLED

◆ isLocked()

virtual bool ccObject::isLocked ( ) const
inlinevirtual

Returns whether the object is locked or not.

Shortcut to access flag CC_LOCKED

◆ ReadClassIDFromFile()

CC_CLASS_ENUM ccObject::ReadClassIDFromFile ( QFile &  in,
short  dataVersion 
)
static

Helper: reads out class ID from a binary stream.

Must be called before 'fromFile'!

◆ removeMetaData()

bool ccObject::removeMetaData ( const QString &  key)

Removes a given associated meta-data.

Parameters
keymeta-data unique identifier (case sensitive)
Returns
success

◆ setEnabled()

virtual void ccObject::setEnabled ( bool  state)
inlinevirtual

Sets the "enabled" property.

Shortcut to modify flag CC_ENABLED

◆ setFlagState()

void ccObject::setFlagState ( CC_OBJECT_FLAG  flag,
bool  state 
)
protectedvirtual

Sets flag state.

Parameters
flagobject flag to set
stateflag state

◆ setLocked()

virtual void ccObject::setLocked ( bool  state)
inlinevirtual

Sets the "enabled" property.

Shortcut to modify flag CC_LOCKED

◆ setMetaData() [1/2]

void ccObject::setMetaData ( const QString &  key,
const QVariant &  data 
)

Sets a meta-data element.

Parameters
keymeta-data unique identifier (case sensitive)
datadata

◆ setMetaData() [2/2]

void ccObject::setMetaData ( const QVariantMap &  dataset,
bool  overwrite = false 
)

Sets several meta-data elements at a time.

Parameters
datasetmeta-data set
overwritewhether existing meta-data elements should be replaced by the input ones (with the same key) or not

◆ setUniqueID()

void ccObject::setUniqueID ( unsigned  ID)
virtual

Changes unique ID.

Warning
HANDLE WITH CARE! Updates persistent settings (last unique ID) if necessary.

◆ toFile()

bool ccObject::toFile ( QFile &  out) const
overrideprotectedvirtual

Saves data to binary stream.

Parameters
outoutput file (already opened)
Returns
success

Reimplemented from ccSerializableObject.


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