1 // File: Model_Object.hxx
2 // Created: 19 May 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef Model_Object_HeaderFile
6 #define Model_Object_HeaderFile
9 #include <ModelAPI_Object.h>
10 #include <ModelAPI_Document.h>
12 #include <TDataStd_Name.hxx>
14 /**\class ModelAPI_Object
16 * \brief Represents the result of some feature in the object browser
17 * under the specific folder. Just a reference to specific feature-operation
18 * with possibility to rename it.
20 class Model_Object : public ModelAPI_Object
22 FeaturePtr myRef; ///< the referenced feature
23 Handle_TDataStd_Name myName; ///< the name of this object that may be changed
25 /// Reference to the feature-operation that produces this object
26 MODEL_EXPORT virtual FeaturePtr featureRef();
28 /// Returns the name of this object (by default equal to the name of feature)
29 MODEL_EXPORT virtual std::string getName();
31 /// Defines the name of the object
32 MODEL_EXPORT virtual void setName(std::string theName);
34 /// Returns the kind of a feature (like "Point")
35 MODEL_EXPORT virtual const std::string& getKind() {return myRef->getKind();}
37 /// Returns to which group in the document must be added feature
38 MODEL_EXPORT virtual const std::string& getGroup() {return FEATURES_GROUP;}
40 /// Returns document this feature belongs to
41 MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> document()
42 {return myRef->document();}
44 /// Returns true if feature refers to the same model data instance
45 MODEL_EXPORT virtual bool isSame(const FeaturePtr& theFeature)
47 boost::shared_ptr<Model_Object> anObj = boost::dynamic_pointer_cast<Model_Object>(theFeature);
48 return anObj && myRef == anObj->myRef;
51 /// It is just a reference: don't init attributes
52 MODEL_EXPORT virtual void initAttributes() {}
54 /// It is just a reference: don't execute
55 MODEL_EXPORT virtual void execute() {}
59 /// Constructor fully defines this object
60 Model_Object(FeaturePtr theRef, Handle_TDataStd_Name theName);
62 friend class Model_Document;