Rhino C++ API  9.0
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
ON_DecalObjectAttributesWrapper Class Referencefinal

#include <opennurbs_decals.h>

Public Types

enum  AddDecalResults { AddDecalResults::Success, AddDecalResults::Failure, AddDecalResults::Duplicate, AddDecalResults::ReadOnly }
 Results for AddDecal(). More...
 

Public Member Functions

 ON_DecalObjectAttributesWrapper (const ON_3dmObjectAttributes &a)
 Construct for read-only access to the decal information on the attributes. More...
 
 ON_DecalObjectAttributesWrapper (ON_3dmObjectAttributes &a)
 Construct for read/write access to the decal information on the attributes. More...
 
AddDecalResults AddDecal (const ON_Decal &decal)
 
int CountDecalsOnAttributesUserData (void) const
 Returns the number of decals stored on the attributes user data. More...
 
bool CullIdenticalDecals (void)
 
void GetDecalCRCs (ON_SimpleArray< ON_DECAL_CRC > &crcs) const
 Gets the decal CRCs of all the decals stored on the attributes. More...
 
bool MoveDecalAfter (ON_DECAL_CRC decal_crc, ON_DECAL_CRC decal_crc_after)
 
const ON_DecalNewDecalForRead (ON_DECAL_CRC decal_crc) const
 
ON_DecalNewDecalForWrite (ON_DECAL_CRC decal_crc)
 
bool RemoveAllDecals (void)
 
bool RemoveDecal (ON_DECAL_CRC decal_crc)
 
bool RemoveValue (ON_DECAL_CRC decal_crc, const wchar_t *param_name)
 
bool UpdateDecal (ON_DECAL_CRC decal_crc, const ON_Decal &decal)
 

Static Public Member Functions

static const ON_XMLNodeFastDecalsNode (const ON_3dmObjectAttributes &attr)
 

Friends

class ON_DecalCollection
 

Detailed Description

ON_DecalObjectAttributesWrapper

Decal properties for an object are stored as XML in user data on the object's attributes. This class is a wrapper around these attributes which provides decal functionality. The attributes passed to the constructor of the wrapper can be either const or non-const. If the attributes are const, the wrapper is set as read-only and any methods that attempt to modify the attributes or one of its decals will fail.

Member Enumeration Documentation

◆ AddDecalResults

Results for AddDecal().

Enumerator
Success 

The new decal was added successfully.

Failure 

The new decal could not be added.

Duplicate 

The new decal was not added because it had the same CRC as an existing decal.

ReadOnly 

The new decal was not added because the attributes being wrapped are read-only.

Constructor & Destructor Documentation

◆ ON_DecalObjectAttributesWrapper() [1/2]

ON_DecalObjectAttributesWrapper::ON_DecalObjectAttributesWrapper ( ON_3dmObjectAttributes a)

Construct for read/write access to the decal information on the attributes.

◆ ON_DecalObjectAttributesWrapper() [2/2]

ON_DecalObjectAttributesWrapper::ON_DecalObjectAttributesWrapper ( const ON_3dmObjectAttributes a)

Construct for read-only access to the decal information on the attributes.

Member Function Documentation

◆ AddDecal()

AddDecalResults ON_DecalObjectAttributesWrapper::AddDecal ( const ON_Decal decal)

Adds a copy of a decal to the attributes, if possible. Returns Success if successful or an error code if the attributes does not contain such a decal, the wrapper was constructed with a const attributes object, or the added decal has the same CRC as an existing decal.

◆ CountDecalsOnAttributesUserData()

int ON_DecalObjectAttributesWrapper::CountDecalsOnAttributesUserData ( void  ) const

Returns the number of decals stored on the attributes user data.

◆ CullIdenticalDecals()

bool ON_DecalObjectAttributesWrapper::CullIdenticalDecals ( void  )

Removes any decals that have duplicate CRCs. Returns a pointer to the decal if successful, null if the attributes does not contain such a decal or the wrapper was constructed with a const attributes object.

◆ FastDecalsNode()

static const ON_XMLNode* ON_DecalObjectAttributesWrapper::FastDecalsNode ( const ON_3dmObjectAttributes attr)
static

◆ GetDecalCRCs()

void ON_DecalObjectAttributesWrapper::GetDecalCRCs ( ON_SimpleArray< ON_DECAL_CRC > &  crcs) const

Gets the decal CRCs of all the decals stored on the attributes.

◆ MoveDecalAfter()

bool ON_DecalObjectAttributesWrapper::MoveDecalAfter ( ON_DECAL_CRC  decal_crc,
ON_DECAL_CRC  decal_crc_after 
)

Move the decal given by 'decal_crc' after the decal given by 'decal_crc_after'. If 'decal_crc_after' is nil, move the decal to the top. By 'move', we mean move the decal's XML node position within the parent XML node. Returns true if successful, false if the wrapper was constructed with a const attributes object.

◆ NewDecalForRead()

const ON_Decal* ON_DecalObjectAttributesWrapper::NewDecalForRead ( ON_DECAL_CRC  decal_crc) const

Creates a new const decal for the decal CRC given by 'decal_crc'. Returns a pointer to the decal if successful, null if the attributes does not contain such a decal.

◆ NewDecalForWrite()

ON_Decal* ON_DecalObjectAttributesWrapper::NewDecalForWrite ( ON_DECAL_CRC  decal_crc)

Creates a new non-const decal for the decal CRC given by 'decal_crc'. Returns a pointer to the decal if successful, null if the attributes does not contain such a decal or the wrapper was constructed with a const attributes object.

◆ RemoveAllDecals()

bool ON_DecalObjectAttributesWrapper::RemoveAllDecals ( void  )

Removes all decals from the attributes, if possible. Returns true if successful, false if the wrapper was constructed with a const attributes object. *‍/

◆ RemoveDecal()

bool ON_DecalObjectAttributesWrapper::RemoveDecal ( ON_DECAL_CRC  decal_crc)

Removes the decal given by 'decal_crc' from the attributes, if possible. Returns true if successful, false if the attributes does not contain such a decal or the wrapper was constructed with a const attributes object.

◆ RemoveValue()

bool ON_DecalObjectAttributesWrapper::RemoveValue ( ON_DECAL_CRC  decal_crc,
const wchar_t *  param_name 
)

Removes the value given by 'param_name' from the XML of the decal given by 'decal_crc'. Returns true if successful, false if the parameter does not exist or the wrapper was constructed with a const attributes object. *‍/

◆ UpdateDecal()

bool ON_DecalObjectAttributesWrapper::UpdateDecal ( ON_DECAL_CRC  decal_crc,
const ON_Decal decal 
)

Updates a decal on the attributes. The decal given by 'decal_crc' is found and updated (if possible) to be the same as 'decal'. Returns true if successful, false if the attributes does not contain such a decal or the wrapper was constructed with a const attributes object.

Friends And Related Function Documentation

◆ ON_DecalCollection

friend class ON_DecalCollection
friend