Provides an interface to appearance which is a collection of visual styles. More...
#include <cadex/ModelData_Appearance.hxx>
Public Types | |
typedef cadex::internal::ModelData_AppearanceImpl | ImplType |
Public Types inherited from cadex::ModelData_BaseObject | |
typedef int | IdType |
Defines a type identifier. | |
Public Member Functions | |
ModelData_Appearance () | |
Constructor. | |
ModelData_Appearance (initialized) | |
Constructor. | |
ModelData_Appearance (ImplType *theImpl) | |
Constructor (reserved for internal use). | |
ModelData_Appearance (const ModelData_Color &theGenericColor) | |
Constructor. | |
ModelData_Appearance (const ModelData_ColorObject &theGenericColor) | |
Constructor. | |
ModelData_Appearance (const ModelData_Material &theMaterial) | |
Constructor. | |
ModelData_Appearance (const ModelData_MaterialObject &theMaterial) | |
Constructor. | |
void | Set (const ModelData_Color &theGenericColor) |
Sets the color of appearance. | |
void | Set (const ModelData_ColorObject &theGenericColor) |
Sets the color of appearance. | |
ModelData_ColorObject | GenericColor () const |
Returns the color of appearance. | |
void | Set (const ModelData_Material &theMaterial) |
Sets the material of appearance. | |
void | Set (const ModelData_MaterialObject &theMaterial) |
Sets the material of appearance. | |
ModelData_MaterialObject | Material () const |
Returns the material of appearance. | |
bool | ToColor (ModelData_Color &theColor) const |
Returns true if there is any style item which allows to retrieve a color. | |
bool | ToMaterial (ModelData_Material &theMaterial) const |
Returns true if there is any style item which allows to convert this appearance to a material. | |
bool | HasLineProperties () const |
Returns true if the line properties are defined. | |
void | Set (const ModelData_LineProperties &theValue) |
Sets the line properties of appearance. | |
const ModelData_LineProperties & | LineProperties () const |
Retuns the line properties of appearance. | |
void | SetTextureSet (const ModelData_TextureSet &theTextureSet) |
Sets the texture set of appearance. | |
void | Add (const ModelData_Texture &theTexture) |
Adds a texture to the texture set of appearance. | |
ModelData_TextureSet | TextureSet () const |
Retuns the texture set of appearance. | |
void | CopyAndOverrideWith (const ModelData_Appearance &theOther) |
Copies internal contents and overrides with attributes in another appearance. | |
void | CopyAndCombineWith (const ModelData_Appearance &theOther) |
Copies internal contents and combines with set attributes from another appearance. | |
Public Member Functions inherited from cadex::ModelData_BaseObject | |
ModelData_BaseObject () | |
Constructor. | |
IdType | TypeId () const |
Returns an object type id. | |
template<typename T > | |
bool | IsOfType () const |
Returns true if the object has a type T. | |
void | SetName (const Base_UTF16String &theName) |
Sets an object name. | |
Base_UTF16String | Name () const |
void | SetUuid (const Base_Uuid &theUuid) |
Base_Uuid | Uuid () const |
void | Nullify () |
Resets reference to implementation object. | |
bool | IsNull () const |
Returns true if the object is nullified. | |
operator bool () const | |
Casts the object to the bool type. | |
internal::ModelData_BaseObjectImpl * | Impl () const |
Return a handle to backend (reserved for internal use). | |
Static Public Member Functions | |
static IdType | GetTypeId () |
Additional Inherited Members | |
Protected Member Functions inherited from cadex::ModelData_BaseObject | |
ModelData_BaseObject (const internal::ModelData_BaseObjectImpl *theImpl) | |
Constructor (reserved for internal use). | |
ModelData_BaseObject (const internal::ModelData_BaseObjectImpl *theImpl, const Base_UTF16String &theName) | |
Constructor (reserved for internal use). | |
template<typename T > | |
T * | GetOrCreateImpl () |
Reserved for internal use. | |
Provides an interface to appearance which is a collection of visual styles.
The possible types of visual styles that an appearance can contain:
cadex::ModelData_Appearance::ModelData_Appearance | ( | ) |
Constructor.
Creates a null object (see IsNull()).
cadex::ModelData_Appearance::ModelData_Appearance | ( | initialized | ) |
Constructor.
Creates a non-null object (see IsNull()) but without any style items.
cadex::ModelData_Appearance::ModelData_Appearance | ( | const ModelData_Color & | theGenericColor | ) |
Constructor.
Creates an appearance with the supplied color as the sole style item.
cadex::ModelData_Appearance::ModelData_Appearance | ( | const ModelData_ColorObject & | theGenericColor | ) |
Constructor.
Creates an appearance with the supplied color as the sole style item.
cadex::ModelData_Appearance::ModelData_Appearance | ( | const ModelData_Material & | theMaterial | ) |
Constructor.
Creates an appearance with the supplied material as the sole style item.
cadex::ModelData_Appearance::ModelData_Appearance | ( | const ModelData_MaterialObject & | theMaterial | ) |
Constructor.
Creates an appearance with the supplied material as the sole style item.
void cadex::ModelData_Appearance::CopyAndCombineWith | ( | const ModelData_Appearance & | theOther | ) |
Copies internal contents and combines with set attributes from another appearance.
Makes a deep copy so that any other object referring to this will not be modified. Copies attributes (material, generic color, line properties) set in the theOther to override respective attributes in this object. If the respective attribute is not set in theOther then retains a current value.
void cadex::ModelData_Appearance::CopyAndOverrideWith | ( | const ModelData_Appearance & | theOther | ) |
Copies internal contents and overrides with attributes in another appearance.
Makes a deep copy so that any other object referring to this will not be modified and assigns all attributes from theOther.
|
static |
Implementation details: Does not provide extra data objects. Uses references with id's of respective styles (e.g. ModelData_ColorObject, ModelData_MaterialObject) to find objects.
If sets the style which already existed in the appearance attribute then the previously used style can become orphan.
const ModelData_LineProperties & cadex::ModelData_Appearance::LineProperties | ( | ) | const |
Retuns the line properties of appearance.
Using the retrieved value when HasLineProperties() returns false is undefined behavior.
void cadex::ModelData_Appearance::Set | ( | const ModelData_Color & | theGenericColor | ) |
Sets the color of appearance.
If this object has color and theGenericColor is null the color is unset.
void cadex::ModelData_Appearance::Set | ( | const ModelData_ColorObject & | theGenericColor | ) |
Sets the color of appearance.
If this object has color and theGenericColor is null the color is unset.
void cadex::ModelData_Appearance::Set | ( | const ModelData_Material & | theMaterial | ) |
Sets the material of appearance.
If this object has material and theGenericMaterial is null the material is unset.
void cadex::ModelData_Appearance::Set | ( | const ModelData_MaterialObject & | theMaterial | ) |
Sets the material of appearance.
If this object has material and theGenericMaterial is null the material is unset.
bool cadex::ModelData_Appearance::ToColor | ( | ModelData_Color & | theColor | ) | const |
Returns true if there is any style item which allows to retrieve a color.
If the attribute has GenericColor() then theColor will be assigned its value. Otherwise, if the attribute has Material() then theColor will be assigned its diffuse color value. In both cases the function returns true.
Otherwise returns false.
bool cadex::ModelData_Appearance::ToMaterial | ( | ModelData_Material & | theMaterial | ) | const |
Returns true if there is any style item which allows to convert this appearance to a material.
If there is a Material() then theMaterial will be assigned its value. If there is a GenericColor() then theMaterial will have diffuse color of that value and other material's colors will have default values. In both cases the function returns true.
Otherwise returns false.