#define Model_Data_HeaderFile
#include "Model.h"
-#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
#include <TDF_Label.hxx>
#include <map>
* to get/set attributes from the document and compute result of an operation.
*/
-class Model_Data: public ModelAPI_Object
+class Model_Data: public ModelAPI_Data
{
TDF_Label myLab; ///< label of the feature in the document
/// All attributes of the object identified by the attribute ID
SET(PROJECT_HEADERS
ModelAPI.h
- ModelAPI_Interface.h
ModelAPI_PluginManager.h
ModelAPI_Plugin.h
ModelAPI_Feature.h
ModelAPI_Iterator.h
- ModelAPI_Object.h
+ ModelAPI_Data.h
ModelAPI_Document.h
ModelAPI_Attribute.h
ModelAPI_AttributeDouble.h
#include "ModelAPI_Document.h"
#include "ModelAPI_PluginManager.h"
#include "ModelAPI_Feature.h"
- #include "ModelAPI_Object.h"
+ #include "ModelAPI_Data.h"
#include "ModelAPI_Attribute.h"
#include "ModelAPI_AttributeDocRef.h"
#include "ModelAPI_AttributeDouble.h"
%shared_ptr(ModelAPI_Document)
%shared_ptr(ModelAPI_PluginManager)
%shared_ptr(ModelAPI_Feature)
-%shared_ptr(ModelAPI_Object)
+%shared_ptr(ModelAPI_Data)
%shared_ptr(ModelAPI_Attribute)
%shared_ptr(ModelAPI_AttributeDocRef)
%shared_ptr(ModelAPI_AttributeDouble)
%include "ModelAPI_Document.h"
%include "ModelAPI_PluginManager.h"
%include "ModelAPI_Feature.h"
-%include "ModelAPI_Object.h"
+%include "ModelAPI_Data.h"
%include "ModelAPI_Attribute.h"
%include "ModelAPI_AttributeDocRef.h"
%include "ModelAPI_AttributeDouble.h"
/// Returns the type of this class of attributes, not static method
virtual std::string attributeType() = 0;
+ /// To virtually destroy the fields of successors
+ virtual ~ModelAPI_Attribute() {}
+
protected:
/// Objects are created for features automatically
- ModelAPI_Attribute()
- {}
+ ModelAPI_Attribute(){}
+
};
#endif
/// Returns the type of this class of attributes, not static method
virtual std::string attributeType() {return type();}
+ /// To virtually destroy the fields of successors
+ virtual ~ModelAPI_AttributeDocRef() {}
+
protected:
/// Objects are created for features automatically
ModelAPI_AttributeDocRef()
/// Returns the type of this class of attributes, not static method
virtual std::string attributeType() {return type();}
+ /// To virtually destroy the fields of successors
+ virtual ~ModelAPI_AttributeDouble() {}
+
protected:
/// Objects are created for features automatically
ModelAPI_AttributeDouble()
--- /dev/null
+// File: ModelAPI_Data.hxx
+// Created: 21 Mar 2014
+// Author: Mikhail PONIKAROV
+
+#ifndef ModelAPI_Data_HeaderFile
+#define ModelAPI_Data_HeaderFile
+
+#include "ModelAPI.h"
+#include <string>
+#include <memory>
+
+class ModelAPI_AttributeDocRef;
+class ModelAPI_AttributeDouble;
+class ModelAPI_Document;
+
+/**\class ModelAPI_Data
+ * \ingroup DataModel
+ * \brief General object of the application that allows
+ * to get/set attributes from the document and compute result of an operation.
+ */
+
+class MODELAPI_EXPORT ModelAPI_Data
+{
+public:
+
+ /// Returns the name of the feature visible by the user in the object browser
+ virtual std::string getName() = 0;
+
+ /// Defines the name of the feature visible by the user in the object browser
+ virtual void setName(std::string theName) = 0;
+
+ /// Returns the attribute that references to another document
+ virtual std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID) = 0;
+ /// Returns the attribute that contains real value with double precision
+ virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID) = 0;
+
+ /// Initializes object by the attributes: must be called just after the object is created
+ /// for each attribute of the object
+ /// \param theID identifier of the attribute that can be referenced by this ID later
+ /// \param theAttrType type of the created attribute (received from the type method)
+ virtual void addAttribute(std::string theID, std::string theAttrType) = 0;
+
+ /// Returns the document of this data
+ virtual std::shared_ptr<ModelAPI_Document> document() = 0;
+
+ /// To virtually destroy the fields of successors
+ virtual ~ModelAPI_Data() {}
+
+protected:
+ /// Objects are created for features automatically
+ ModelAPI_Data()
+ {}
+};
+
+#endif
///! Returns the vector of groups already added to the document
MODELAPI_EXPORT virtual const std::vector<std::string>& getGroups() const = 0;
+ /// To virtually destroy the fields of successors
+ virtual ~ModelAPI_Document() {}
+
protected:
/// Only for SWIG wrapping it is here
MODELAPI_EXPORT ModelAPI_Document()
#include <string>
#include <memory>
-class ModelAPI_Object;
+class ModelAPI_Data;
class ModelAPI_Document;
/**\class ModelAPI_Feature
*/
class ModelAPI_Feature
{
- std::shared_ptr<ModelAPI_Object> myData; ///< manager of the data model of a feature
+ std::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
public:
/// Returns the kind of a feature (like "Point")
MODELAPI_EXPORT virtual void execute() = 0;
/// Returns the data manager of this feature
- MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Object> data() {return myData;}
+ MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Data> data() {return myData;}
/// Must return document where the new feature must be added to
/// By default it is current document
MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> documentToAdd()
{return ModelAPI_PluginManager::get()->currentDocument();}
+ /// To virtually destroy the fields of successors
+ virtual ~ModelAPI_Feature() {}
+
protected:
/// Use plugin manager for features creation: this method is
/// defined here only for SWIG-wrapping
{}
/// Sets the data manager of an object (document does)
- MODELAPI_EXPORT void setData(std::shared_ptr<ModelAPI_Object> theData) {myData = theData;}
+ MODELAPI_EXPORT void setData(std::shared_ptr<ModelAPI_Data> theData) {myData = theData;}
friend class Model_Document;
};
+++ /dev/null
-// File: ModelAPI_Interface.hxx
-// Created: 20 Mar 2014
-// Author: Mikhail PONIKAROV
-
-#ifndef ModelAPI_Interface_HeaderFile
-#define ModelAPI_Interface_HeaderFile
-
-#include <ModelAPI.h>
-
-/**\class ModelAPI_Interface
- * \ingroup DataModel
- * \brief General base class for all interfaces in this package
- */
-
-class MODELAPI_EXPORT ModelAPI_Interface
-{
- void* myImpl; ///< pointer to the internal implementation object
-
-public:
- /// None - constructor
- virtual ModelAPI_Interface()
- {
- myImpl = 0;
- }
-
- /// Constructor by the implementation pointer (used for internal needs)
- virtual ModelAPI_Interface(void* theImpl)
- {
- myImpl = theImpl;
- }
-
- /// Copy-constructor
- virtual ModelAPI_Interface(ModelAPI_Interface& theOrig)
- {
- myImpl = theOrig.theImpl;
- Duplicate();
- }
-
- virtual ModelAPI_Interface& operator=(ModelAPI_Interface& const theOrig)
- { myImpl = theOrig.theImpl; Duplicate(); return *this;}
-
- /// Duplicates the objet pointed by myImpl (loosing the old one)
- virtual void Duplicate() = 0;
-
-};
-
-#endif
/// \returns true if given feature equals to the current one
virtual bool is(std::shared_ptr<ModelAPI_Feature> theFeature) = 0;
+ /// To virtually destroy the fields of successors
+ virtual ~ModelAPI_Iterator() {}
+
protected:
/// Use plugin manager for features creation: this method is
/// defined here only for SWIG-wrapping
+++ /dev/null
-// File: ModelAPI_Object.hxx
-// Created: 21 Mar 2014
-// Author: Mikhail PONIKAROV
-
-#ifndef ModelAPI_Object_HeaderFile
-#define ModelAPI_Object_HeaderFile
-
-#include "ModelAPI.h"
-#include <string>
-#include <memory>
-
-class ModelAPI_AttributeDocRef;
-class ModelAPI_AttributeDouble;
-class ModelAPI_Document;
-
-/**\class ModelAPI_Object
- * \ingroup DataModel
- * \brief General object of the application that allows
- * to get/set attributes from the document and compute result of an operation.
- */
-
-class MODELAPI_EXPORT ModelAPI_Object
-{
-public:
-
- /// Returns the name of the feature visible by the user in the object browser
- virtual std::string getName() = 0;
-
- /// Defines the name of the feature visible by the user in the object browser
- virtual void setName(std::string theName) = 0;
-
- /// Returns the attribute that references to another document
- virtual std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID) = 0;
- /// Returns the attribute that contains real value with double precision
- virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID) = 0;
-
- /// Initializes object by the attributes: must be called just after the object is created
- /// for each attribute of the object
- /// \param theID identifier of the attribute that can be referenced by this ID later
- /// \param theAttrType type of the created attribute (received from the type method)
- virtual void addAttribute(std::string theID, std::string theAttrType) = 0;
-
- /// Returns the document of this data
- virtual std::shared_ptr<ModelAPI_Document> document() = 0;
-
-protected:
- /// Objects are created for features automatically
- ModelAPI_Object()
- {}
-};
-
-#endif
/// Creates the feature object of this plugin by the feature string ID
virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+ /// To virtually destroy the fields of successors
+ virtual ~ModelAPI_Plugin() {}
+
protected:
/// Is needed for python wrapping by swig
ModelAPI_Plugin() {};
#include <ModelAPI_Document.h>
// to avoid unresolved ModelAPI_Feature()
#include <ModelAPI_Feature.h>
-// to avoid unresolved ModelAPI_Object()
-#include <ModelAPI_Object.h>
+// to avoid unresolved ModelAPI_Data()
+#include <ModelAPI_Data.h>
// to avoid unresolved ModelAPI_Plugin()
#include <ModelAPI_Plugin.h>
// to avoid unresolved ModelAPI_Iterator()
/// Is needed for python wrapping by swig, call Get to get an instance
ModelAPI_PluginManager();
+ /// To virtually destroy the fields of successors
+ virtual ~ModelAPI_PluginManager() {}
+
protected:
/// Creates the feature object using plugins functionality
virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_Document.h>
#include <ModelAPI_Feature.h>
-#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
#include <ModelAPI_PluginManager.h>
#include <ModelAPI_Document.h>
return;
}
QString anId = sender()->objectName();
- std::shared_ptr<ModelAPI_Object> aData = myFeature->data();
+ std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
std::shared_ptr<ModelAPI_AttributeDouble> aReal = aData->real(anId.toStdString());
aReal->setValue(theValue);
}
#include "PartSetPlugin_Part.h"
#include "ModelAPI_PluginManager.h"
#include "ModelAPI_Document.h"
-#include "ModelAPI_Object.h"
+#include "ModelAPI_Data.h"
#include "ModelAPI_Iterator.h"
#include "ModelAPI_AttributeDocRef.h"
#include "PartSetPlugin_Point.h"
#include "ModelAPI_PluginManager.h"
#include "ModelAPI_Document.h"
-#include "ModelAPI_Object.h"
+#include "ModelAPI_Data.h"
#include "ModelAPI_AttributeDouble.h"
using namespace std;
#include <ModelAPI_Iterator.h>
#include <ModelAPI_Document.h>
#include <ModelAPI_Feature.h>
-#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
#include <Model_Events.h>
#include <Event_Loop.h>
myDocument = aMgr->currentDocument();
// Register in event loop
+ Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_CREATED));
Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_UPDATED));
// Create a top part of data tree model
#include <ModelAPI_Iterator.h>
#include <ModelAPI_Document.h>
#include <ModelAPI_Feature.h>
-#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
#include <ModelAPI_AttributeDocRef.h>
#include <QIcon>
#include <ModelAPI_Feature.h>
#include <ModelAPI_PluginManager.h>
#include <ModelAPI_AttributeDocRef.h>
-#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
#include <ModelAPI_PluginManager.h>
#include <ModelAPI_Feature.h>
-#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
#include <ModelAPI_AttributeDocRef.h>
#include <Event_Loop.h>