C3D Toolkit
Kernel - 117982, Vision - 2.9.2.2
|
An attribute container. More...
#include <attribute_container.h>
Public Member Functions | |
MbAttributeContainer () | |
Constructor without parameters. | |
MbAttributeContainer (MbAttribute &) | |
Constructor by attribute. | |
virtual | ~MbAttributeContainer () |
Destructor. | |
virtual MbeImplicationType | ImplicationType () const |
Get attribute container type. | |
void | AttributesRead (reader &) |
Read attributes from stream. | |
void | AttributesWrite (writer &) const |
Writing attributes to stream. | |
void | GetProperties (MbProperties &) |
Get properties of attributes. | |
void | SetProperties (const MbProperties &) |
Set properties of attributes. | |
Functions of object's simple attributes. | |
void | SetDensity (double) |
Set density of an object. | |
double | GetDensity () const |
Get density of an object. | |
void | SetVisual (float a, float d, float sp, float sh, float t, float e, uint rgb=0) |
Set visual properties of the object. | |
void | SetVisual (const MbRGBA &ambient, const MbRGBA &diffuse, const MbRGBA &specular, const MbRGBA &emission, uint8 shininess, uint8 opacity, uint8 chrom) |
Set visual properties of the object. | |
bool | GetVisual (float &a, float &d, float &sp, float &sh, float &t, float &e, uint rgb=0) const |
Get visual properties of the object. More... | |
bool | IsColored () const |
void | SetColor (uint32) |
Change color of the object. | |
void | SetColor (int R, int G, int B) |
Change color of the object (0-255). | |
uint32 | GetColor () const |
Get color of an object. | |
void | SetWidth (int) |
Set thickness of lines for object's representation. | |
int | GetWidth () const |
Get thickness of lines for object's representation. | |
void | SetStyle (int) |
Set style of lines for object's representation. | |
int | GetStyle () const |
Get style of lines for object's representation. | |
void | SetSelected (bool s=true) |
To allocate or not to allocate an object. | |
bool | IsSelected () const |
Is the object selected. | |
bool | ReverseSelected () |
Invert object selection. | |
void | SetChanged (bool c=true) |
Set: the object is changed or isn't changed. | |
bool | IsChanged () const |
Is the object changed? | |
void | SetVisible (bool) |
Set visibility. | |
bool | IsVisible () const |
Is the object visible? | |
bool | IsInvisible () const |
Is the object invisible? | |
Protected Member Functions | |
MbAttributeContainer (const MbAttributeContainer &, MbRegDuplicate *) | |
Copy-constructor with the registrator. | |
Common functions of attributes | |
void | AttributesAssign (const MbAttributeContainer &) |
Duplicate attributes of a given object, release existing attributes. | |
size_t | AttributesCount () const |
Get the number of objects. | |
bool | RemoveAttributes (bool onDeleteOwner=false) |
Delete all attributes from container. | |
MbAttribute * | AddAttribute (MbAttribute *attr, bool checkSame=true) |
Add attribute in container. More... | |
MbAttribute * | AddAttribute (const MbAttribute &attr, bool checkSame=true) |
Add attribute in container (adds a copy of the attribute if it can be added). More... | |
void | GetAttributes (c3d::AttrVector &attrs, MbeAttributeType aFamily, MbeAttributeType subType) const |
Get attributes of a given type or family. More... | |
void | GetAttributes (c3d::AttrVector &attrs, MbeAttributeType aType) const |
Get attributes of a given type. More... | |
template<class AttrVector > | |
void | GetAttributes (AttrVector &attrs) const |
Get attributes. More... | |
void | GetCommonAttributes (c3d::AttrVector &, const c3d::string_t &samplePrompt, MbeAttributeType subType=at_Undefined, bool firstFound=false) const |
Get attributes using sample of description string. | |
void | GetStringAttributes (c3d::AttrVector &, const c3d::string_t &sampleContent) const |
Get string attributes using sample of contents of the string. | |
bool | RemoveAttribute (const MbAttribute *, bool checkAccuracySame=false, double accuracy=LENGTH_EPSILON) |
Get an attribute of a given type, the first one is returned if there are many. More... | |
bool | RemoveAttributes (MbeAttributeType type, MbeAttributeType subType) |
Delete attributes of a given type. | |
const MbAttribute * | GetSimpleAttribute (MbeAttributeType) const |
Get a simple attribute of a given subtype. | |
MbAttribute * | SetSimpleAttribute (MbeAttributeType) |
Get a simple attribute of a given subtype. | |
MbAttribute * | SetSimpleAttribute (MbAttribute *simpAttr) |
Set a simple attribute of a given subtype. | |
MbAttribute * | SetSimpleAttribute (const MbAttribute &simpAttr) |
Set a simple attribute of a given subtype (always copies the attribute). | |
void | RemoveSimpleAttribute (MbeAttributeType) |
Delete simple attributes (one or more) of a given subtype. | |
MbAttribute * | DetachSimpleAttribute (MbeAttributeType) |
Detach a simple attribute of a given subtype. | |
void | GetUserAttributes (std::vector< MbUserAttribute * > &attrs, const MbUserAttribType &type) const |
Get a user attribute of a given subtype. | |
void | RemoveUserAttributes (const MbUserAttribType &type) |
Delete user attributes (one or more) of a given subtype. | |
void | DetachUserAttributes (std::vector< MbUserAttribute * > &attrs, const MbUserAttribType &type) |
Detach a user attribute of a given subtype. | |
void | AttributesChange () |
Perform actions when changing the attributes. | |
void | AttributesConvert (MbAttributeContainer &other) const |
Perform actions when converting the attributes. | |
void | AttributesTransform (const MbMatrix3D &, MbRegTransform *=nullptr) |
Perform actions when transforming the attributes. | |
void | AttributesMove (const MbVector3D &, MbRegTransform *=nullptr) |
Perform actions when moving the attributes. | |
void | AttributesRotate (const MbAxis3D &, double angle, MbRegTransform *=nullptr) |
Perform actions when rotating the attributes. | |
void | AttributesCopy (MbAttributeContainer &other, MbRegDuplicate *=nullptr) const |
Perform actions when copying the attributes. | |
void | AttributesMerge (MbAttributeContainer &other) |
Perform actions when merging the attributes. | |
void | AttributesReplace (MbAttributeContainer &other) |
Perform actions when replacing the attributes. | |
void | AttributesSplit (const std::vector< MbAttributeContainer * > &others) |
Perform actions when splitting the attributes. | |
void | AttributesDelete () |
Perform actions when deleting the attributes. | |
static MbUserAttribute * | ReduceUserAttrib (const MbExternalAttribute &) |
Convert user attribute to "system" one. | |
static MbExternalAttribute * | AdvanceUserAttrib (const MbUserAttribute &) |
Convert "system" attribute to user one. | |
An attribute container.
An attribute container.
The inheritors of this class are: objects of geometric kernel model of type MbItem and topological objects of type MbTopologyItem.
Inheritors of this class contain attributes.
Operations with attributes of geometric kernel objects are performed by methods of this class.
Attribute can affect attribute state using its owner, i.e. geometric kernel provides an opportunity for transmission to attributes the information about changes of their owners by calling the predefined functions of the attribute.
In addition to transfer of information about changes occurring with owner provided a possibility to determine the behavior of attribute with these changes by selecting of one of the predefined types of behavior for each changing of the owner.
Types of actions that affect the states of attributes.
Copying, for example, when creating a copy of solid. Action on attribute is performed after copying of owning object.
Splitting. For example, splitting of a face into two parts in cutting. Action on attribute is performed after splitting of owning object.
Merging. For example, merging of faces in boolean operations. Action on attribute is performed after merging of owning object.
Attributes of all objects involved in merging are processed.
Changing which is not associated with splitting or merging. Action on attribute is performed after changing of owning object.
Transformation. For example, rotation or parallel translation. Action on attribute is performed after transformation of owning object.
Replacement. For example, replacement of one face of a solid to another. Action on attribute is performed after replacement of objects. Attributes of all objects involved in replacement are processed.
Deletion of an object. Action on attribute is performed after deletion of an object.
MbAttribute* MbAttributeContainer::AddAttribute | ( | MbAttribute * | attr, |
bool | checkSame = true |
||
) |
Add attribute in container.
Add attribute in container (adds the original attribute if it's possible). In the case of a simple attribute, if it already exists, its data is replaced by the data of the input attribute. To avoid leaks, it is recommended to own the attribute by reference count (explicitly or via SPtr).
[in] | attr | - Attribute. |
[in] | checkSame | - Search flag for an attribute containing the same content. Attribute will not be added if the same attribute is found. |
MbAttribute* MbAttributeContainer::AddAttribute | ( | const MbAttribute & | attr, |
bool | checkSame = true |
||
) |
Add attribute in container (adds a copy of the attribute if it can be added).
Add attribute in container (adds a copy of the attribute if it can be added). In the case of a simple attribute, if it already exists, its data is replaced by the data of the input attribute.
[in] | attr | - Attribute. |
[in] | checkSame | - Search flag for an attribute containing the same content. Attribute will not be added if the same attribute is found. |
void MbAttributeContainer::GetAttributes | ( | c3d::AttrVector & | attrs, |
MbeAttributeType | aFamily, | ||
MbeAttributeType | subType | ||
) | const |
Get attributes of a given type or family.
Get attributes of a given type or family of attributes. If the attribute type is set to at_Undefined,
then all attributes of the given family are returned, otherwise the attributes of the given type are returned.
[out] | attrs | - An array of returned attributes. |
[in] | aFamily | - A family of returned attributes. |
[in] | subType | - A type of returned attributes. |
void MbAttributeContainer::GetAttributes | ( | c3d::AttrVector & | attrs, |
MbeAttributeType | aType | ||
) | const |
Get attributes of a given type.
Get attributes of a given type.
[out] | attrs | - An array of returned attributes. |
[in] | aType | - A type of returned attributes. |
|
inline |
Get attributes.
Get attributes.
[out] | attrs | - An array of returned attributes. |
bool MbAttributeContainer::RemoveAttribute | ( | const MbAttribute * | , |
bool | checkAccuracySame = false , |
||
double | accuracy = LENGTH_EPSILON |
||
) |
Get an attribute of a given type, the first one is returned if there are many.
Delete an attribute from container.
bool MbAttributeContainer::GetVisual | ( | float & | a, |
float & | d, | ||
float & | sp, | ||
float & | sh, | ||
float & | t, | ||
float & | e, | ||
uint | rgb = 0 |
||
) | const |
Get visual properties of the object.
Get visual properties of the object.
[out] | a | - Coefficient of backlighting |
[out] | d | - Coefficient of diffuse reflection |
[out] | s | - Coefficient of specular reflection |
[out] | h | - Shininess (index according to the law of specular reflection) |
[out] | t | - Coefficient of total reflection (opacity coefficient) |
[out] | e | - Emissivity coefficient |
|
inline |
Whether the object is colored.
Whether the object is colored.