Provides MTK data model. More...
#include <cadex/ModelData/Model.hxx>
Public Types | |
enum class | FileFormatType { MTK , MTKWEB } |
![]() | |
typedef std::shared_ptr< internal::BaseObjectImpl > | ImplType |
Public Member Functions | |
Model () | |
Constructor. | |
Model (const UTF16String &theName) | |
Constructor. | |
void | SetName (const UTF16String &theName) |
Sets a model name. | |
UTF16String | Name () const |
Returns a model name. | |
bool | IsEmpty () const |
Returns true if the model is empty. | |
void | Clear () |
Clears the model contents. | |
void | AddRoot (const ModelElement &theElement) |
Adds a root element to the model. | |
const std::vector< ModelElement > & | Roots () const |
Returns root elements of the model. | |
size_t | NumberOfRoots () const |
Returns the number of root elements in the model. | |
void | SetDrawing (const Drawing::Drawing &theDrawing) |
Drawing::Drawing | Drawing () const |
void | Merge (const Model &theModel) |
Adds roots from another model to current. | |
void | AssignUuids () |
Assigns uuid's (persistent id's) to scene graph elements and part representations (if not assigned yet). | |
void | Accept (ModelElementVisitor &theVisitor) const |
Accepts a visitor. | |
bool | Open (const UTF16String &theFileName, bool theToAppend=false, const ProgressStatus &theProgressStatus=ProgressStatus()) |
bool | Save (const UTF16String &theFileName, const ProgressStatus &theProgressStatus=ProgressStatus()) const |
bool | Save (const UTF16String &theFileName, const FileFormatType &theFormat, const ProgressStatus &theProgressStatus=ProgressStatus()) const |
![]() | |
size_t | Id () const |
Return unique identifier of public object. | |
internal::BaseObjectImpl * | Impl () const |
bool | IsNull () const |
operator bool () const | |
template<typename T > | |
bool | IsOfType () const |
template<typename T > | |
T * | Impl () const |
Reserved for internal use. | |
Protected Member Functions | |
Model (const ImplType &theImpl) | |
![]() | |
BaseObject (const ImplType &theImpl) | |
Provides MTK data model.
The model encapsulates a scene graph (hierarchy of assemblies and parts) and is thus an entry point to entire 3D model data.
A model contains a shared pointer to its internal implementation, so simple copying an object will just copy a shared pointer:
cadex::ModelData::Model::Model | ( | ) |
Constructor.
Creates an empty model. IsEmpty() returns true.
cadex::ModelData::Model::Model | ( | const UTF16String & | theName | ) |
Constructor.
Creates an empty model with name. IsEmpty() returns true.
void cadex::ModelData::Model::AddRoot | ( | const ModelElement & | theElement | ) |
Adds a root element to the model.
This function adds theElement as a root element in the model. If the passed element is an instance of ModelData::Instance, it will be automatically nested in ModelData::Assembly.
void cadex::ModelData::Model::Clear | ( | ) |
Clears the model contents.
Detaches the model contents. Only cleans up contents of this object. Other copies of this object will remain unaffected. For instance, in the following code
the aM2 object will continue to have entire previous contents. Respectively, all previous pointers (e.g. to objects of BaseObject subclasses) remain valid.
bool cadex::ModelData::Model::IsEmpty | ( | ) | const |
Returns true if the model is empty.
Returns true if the model has no roots, i.e. NumberOfRoots() returns 0.
UTF16String cadex::ModelData::Model::Name | ( | ) | const |
Returns a model name.
Returns empty string if the model has no name (by default).
size_t cadex::ModelData::Model::NumberOfRoots | ( | ) | const |
const std::vector< ModelElement > & cadex::ModelData::Model::Roots | ( | ) | const |
Returns root elements of the model.
This function returns the root elements of the model as a std::vector.
void cadex::ModelData::Model::SetName | ( | const UTF16String & | theName | ) |
Sets a model name.
Accepts a string as a unicode string.