1 // File: Model_Object.hxx
2 // Created: 21 Mar 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef Model_Object_HeaderFile
6 #define Model_Object_HeaderFile
9 #include <ModelAPI_Object.h>
10 #include <TDF_Label.hxx>
14 class ModelAPI_Attribute;
16 /**\class Model_Object
18 * \brief General object of the application that allows
19 * to get/set attributes from the document and compute result of an operation.
22 class MODEL_EXPORT Model_Object: public ModelAPI_Object
24 TDF_Label myLab; ///< label of the feature in the document
25 /// All attributes of the object identified by the attribute ID
26 std::map<std::string, std::shared_ptr<ModelAPI_Attribute> > myAttrs;
28 std::shared_ptr<ModelAPI_Document> myDoc; ///< document this feature belongs to
32 TDF_Label label() {return myLab;}
34 friend class Model_Document;
35 friend class Model_Iterator;
38 /// Returns the name of the feature visible by the user in the object browser
39 virtual std::string getName();
40 /// Defines the name of the feature visible by the user in the object browser
41 virtual void setName(std::string theName);
42 /// Returns the attribute that references to another document
43 virtual std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID);
44 /// Returns the attribute that contains real value with double precision
45 virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID);
47 /// Initializes object by the attributes: must be called just after the object is created
48 /// for each attribute of the object
49 /// \param theID identifier of the attribute that can be referenced by this ID later
50 /// \param theAttrType type of the created attribute (received from the type method)
51 virtual void addAttribute(std::string theID, std::string theAttrType);
53 /// Returns the document of this data
54 virtual std::shared_ptr<ModelAPI_Document> document() {return myDoc;}
56 /// Puts feature to the document data sub-structure
57 void setLabel(TDF_Label& theLab);
59 /// Sets the document of this data
60 virtual void setDocument(const std::shared_ptr<ModelAPI_Document>& theDoc) {myDoc = theDoc;}