SUAPI-CppWrapper
C++WrapperforSketchUpCAPI
|
Public Member Functions | |
Entity () | |
Constructor representing a null objject. | |
Entity (SUEntityRef entity, bool attached=true) | |
Creates a new Entity object. More... | |
Entity (const Entity &other, SUEntityRef entity_ref=SU_INVALID) | |
Copy constructor with an optional parameter for the entity reference. More... | |
~Entity () | |
Destructor. More... | |
Entity & | operator= (const Entity &other) |
Copy assignment operator. | |
operator SUEntityRef () const | |
operator SUEntityRef * () | |
SUEntityRef | ref () const |
bool | attached () const |
Returns true if the entity is attached to another object. | |
void | attached (bool attach) |
Method lets the object know that it has been attached to a model. This is important as it will let the object know that it does not need to "release" the object. More... | |
std::vector< AttributeDictionary > | attribute_dictionaries () const |
Returns the AttributeDictionaries collection attached to the entity. More... | |
AttributeDictionary | attribute_dictionary (const std::string &name) const |
Returns an attribute dictionary object with a given name that is attached to an Entity. More... | |
bool | add_dictionary (AttributeDictionary &dict) |
Adds the AttributeDictionary to the Entity. More... | |
bool | copy_attributes_from (const Entity &entity) |
Copies attributes from another Entity object to this one. More... | |
bool | is_valid () const |
Checks if the entity is valid. More... | |
bool | operator! () const |
Returns true if this entity is not valid. Alias of !is_valid(). | |
int32_t | entityID () const |
Retrieve a unique ID assigned to an entity. More... | |
TypedValue | get_attribute (const std::string &dict_name, const std::string &key, const TypedValue &default_value=TypedValue()) const |
Retrieves the value of an attribute in the entity's attribute dictionary. More... | |
TypedValue | get_attribute (const AttributeDictionary &dict, const std::string &key, const TypedValue &default_value=TypedValue()) const |
Retrieves the value of an attribute in the entity's attribute dictionary. More... | |
bool | set_attribute (const std::string &dict_name, const std::string &key, const TypedValue &value) |
Sets the value of an attribute in the given AttributeDictionary object. More... | |
bool | set_attribute (AttributeDictionary &dict, const std::string &key, const TypedValue &value) |
Sets the value of an attribute in the given AttributeDictionary object. More... | |
enum SURefType | entity_type () const |
Returns the type of the entity. See enum SURefType. | |
Model | model () const |
Entities | parent () const |
int64_t | persistent_id () const |
Protected Attributes | |
SUEntityRef | m_entity |
The C SUEntityRef that this class wraps. | |
bool | m_attached |
Indicates whether the Entity has been attached to a model. | |
Friends | |
bool | operator== (const Entity &lhs, const Entity &rhs) |
Equality operator for two entity objects. More... | |
bool | operator!= (const Entity &lhs, const Entity &rhs) |
Non-equality operator for two entity objects. | |
Definition at line 54 of file Entity.hpp.
CW::Entity::Entity | ( | SUEntityRef | entity, |
bool | attached = true |
||
) |
entity | - SUEntityRef from SU C API |
attached | - (optional) flag indicating whether the entity is attached to a model. Defaults to true. |
Definition at line 54 of file Entity.cpp.
CW::Entity::Entity | ( | const Entity & | other, |
SUEntityRef | entity_ref = SU_INVALID |
||
) |
SUEntityRef objects cannot be created from this class, so the Ref object must be passed to this constructor from a derived class object.
other | - Entity object from which properties will be copied. |
entity_ref | - (optional) SUEntityRef object to assign to the copied object. |
Definition at line 60 of file Entity.cpp.
CW::Entity::~Entity | ( | ) |
The C++ wrapper deals with releasing objects, so user does not have to keep track of memory allocations.
Definition at line 66 of file Entity.cpp.
bool CW::Entity::add_dictionary | ( | AttributeDictionary & | dict | ) |
dict | - AttributeDictionary to add |
Definition at line 146 of file Entity.cpp.
void CW::Entity::attached | ( | bool | attach | ) |
attach | - (optional) true to let the object know that it has been attached to a model. False to let the object know that it has not been attached. |
Definition at line 105 of file Entity.cpp.
std::vector< AttributeDictionary > CW::Entity::attribute_dictionaries | ( | ) | const |
Definition at line 110 of file Entity.cpp.
AttributeDictionary CW::Entity::attribute_dictionary | ( | const std::string & | name | ) | const |
name | - string representing the name of the AttributeDictionary |
Definition at line 131 of file Entity.cpp.
bool CW::Entity::copy_attributes_from | ( | const Entity & | entity | ) |
entity | - object to get the attributes from. |
bool | true to delete existing attributes, false to retain and overwrite the values. // TODO: as the C API does not currentlty allow you to delete attributes, this flag can have no effect. |
Definition at line 156 of file Entity.cpp.
int32_t CW::Entity::entityID | ( | ) | const |
Definition at line 185 of file Entity.cpp.
TypedValue CW::Entity::get_attribute | ( | const std::string & | dict_name, |
const std::string & | key, | ||
const TypedValue & | default_value = TypedValue() |
||
) | const |
dict_name | - string name of the attribute dictionary. |
key | - the attribute key. |
default_value | - (optional) default TypedValue to return if no attribute is found. Defaults to an empty TypedValue |
Definition at line 195 of file Entity.cpp.
TypedValue CW::Entity::get_attribute | ( | const AttributeDictionary & | dict, |
const std::string & | key, | ||
const TypedValue & | default_value = TypedValue() |
||
) | const |
dict | - AttributeDictionary object to search. |
key | - the attribute key. |
default_value | - (optional) default TypedValue to return if no attribute is found. Defaults to an empty TypedValue |
Definition at line 204 of file Entity.cpp.
bool CW::Entity::is_valid | ( | ) | const |
The delete_attribute method is used to delete an attribute from an entity.
AttributeDictionary& | object in which to find the key. |
std::string | with the name of the key of the attribute. Note that this function does not check if the entity has been deleted. |
Definition at line 175 of file Entity.cpp.
Model CW::Entity::model | ( | ) | const |
Returns the model object that holds this entity.
Definition at line 241 of file Entity.cpp.
Entities CW::Entity::parent | ( | ) | const |
Returns the parent Entities object.
Definition at line 251 of file Entity.cpp.
int64_t CW::Entity::persistent_id | ( | ) | const |
Returns the persistent ID of the entity. If the entity is not an entity that can have a persistent ID, the method will fail.
Definition at line 262 of file Entity.cpp.
bool CW::Entity::set_attribute | ( | const std::string & | dict_name, |
const std::string & | key, | ||
const TypedValue & | value | ||
) |
TODO: C API does not currently allow traversing upwards parent()
dict_name | - string name of AttributeDictionary object that the attribute is in. |
key | - std::string attribute key. |
value | - TypedValue to set. |
Definition at line 217 of file Entity.cpp.
bool CW::Entity::set_attribute | ( | AttributeDictionary & | dict, |
const std::string & | key, | ||
const TypedValue & | value | ||
) |
dict | - AttributeDictionary object that the attribute is in. |
key | - std::string attribute key. |
value | - TypedValue to set. |
Definition at line 226 of file Entity.cpp.
Returns whether these objects are the same.
Definition at line 280 of file Entity.cpp.