From: sbh Date: Tue, 24 Feb 2015 14:52:54 +0000 (+0300) Subject: "Initialization" plugin: plugin and it's features stubs created X-Git-Tag: V_1.1.0~158^2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=94303d51165398c71527f80bc3f8e17e75ee5523;p=modules%2Fshaper.git "Initialization" plugin: plugin and it's features stubs created --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ea51439df..895c8e8ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,7 @@ ADD_SUBDIRECTORY (src/XGUI) ADD_SUBDIRECTORY (src/GeomApp) ADD_SUBDIRECTORY (src/ExchangePlugin) ADD_SUBDIRECTORY (src/GeomValidators) +ADD_SUBDIRECTORY (src/InitializationPlugin) IF(${HAVE_SALOME}) ADD_SUBDIRECTORY (src/NewGeom) diff --git a/src/Config/plugins.xml b/src/Config/plugins.xml index e8d43ed02..3923ac8e9 100644 --- a/src/Config/plugins.xml +++ b/src/Config/plugins.xml @@ -7,6 +7,7 @@ + diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp index f0e45a5bf..570a3a3b8 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp @@ -15,29 +15,29 @@ using namespace std; -static const double MINIMAL_LENGTH = 1.e-5; - ConstructionPlugin_Axis::ConstructionPlugin_Axis() { } void ConstructionPlugin_Axis::initAttributes() { - data()->addAttribute(POINT_ATTR_FIRST, ModelAPI_AttributeSelection::type()); - data()->addAttribute(POINT_ATTR_SECOND, ModelAPI_AttributeSelection::type()); + data()->addAttribute(ConstructionPlugin_Axis::POINT_FIRST(), + ModelAPI_AttributeSelection::type()); + data()->addAttribute(ConstructionPlugin_Axis::POINT_SECOND(), + ModelAPI_AttributeSelection::type()); } void ConstructionPlugin_Axis::execute() { - AttributeSelectionPtr aRef1 = data()->selection(POINT_ATTR_FIRST); - AttributeSelectionPtr aRef2 = data()->selection(POINT_ATTR_SECOND); + AttributeSelectionPtr aRef1 = data()->selection(ConstructionPlugin_Axis::POINT_FIRST()); + AttributeSelectionPtr aRef2 = data()->selection(ConstructionPlugin_Axis::POINT_SECOND()); if ((aRef1.get() != NULL) && (aRef2.get() != NULL)) { GeomShapePtr aShape1 = aRef1->value(); GeomShapePtr aShape2 = aRef2->value(); if (aShape1->isVertex() && aShape2->isVertex() && (!aShape1->isEqual(aShape2))) { std::shared_ptr aStart = GeomAlgoAPI_PointBuilder::point(aShape1); std::shared_ptr anEnd = GeomAlgoAPI_PointBuilder::point(aShape2); - if (aStart->distance(anEnd) > MINIMAL_LENGTH) { + if (aStart->distance(anEnd) > ConstructionPlugin_Axis::MINIMAL_LENGTH()) { std::shared_ptr anEdge = GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd); ResultConstructionPtr aConstr = document()->createConstruction(data()); @@ -53,4 +53,4 @@ void ConstructionPlugin_Axis::customisePresentation(AISObjectPtr thePrs) thePrs->setColor(0, 0, 0); thePrs->setLineStyle(3); thePrs->redisplay(); -} \ No newline at end of file +} diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.h b/src/ConstructionPlugin/ConstructionPlugin_Axis.h index 87ab72be5..2b968ba59 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.h @@ -12,15 +12,6 @@ #include -/// Point kind -const std::string CONSTRUCTION_AXIS_KIND("Axis"); - -/// attribute name for first point -const std::string POINT_ATTR_FIRST = "firstPoint"; - -/// attribute name for second point -const std::string POINT_ATTR_SECOND = "secondPoint"; - /**\class ConstructionPlugin_Axis * \ingroup Plugins * \brief Feature for creation of the new axis in PartSet. @@ -31,10 +22,31 @@ class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomP /// Returns the kind of a feature CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() { - static std::string MY_KIND = CONSTRUCTION_AXIS_KIND; + static std::string MY_KIND = ConstructionPlugin_Axis::ID(); return MY_KIND; } + /// Axis kind + inline static const std::string& ID() + { + static const std::string CONSTRUCTION_AXIS_KIND("Axis"); + return CONSTRUCTION_AXIS_KIND; + } + /// attribute name for first point + inline static const std::string& POINT_FIRST() + { + static const std::string POINT_ATTR_FIRST("firstPoint"); + return POINT_ATTR_FIRST; + } + /// attribute name for second point + inline static const std::string& POINT_SECOND() + { + static const std::string POINT_ATTR_SECOND("secondPoint"); + return POINT_ATTR_SECOND; + } + + inline static const double MINIMAL_LENGTH() { return 1.e-5; } + /// Creates a new part document if needed CONSTRUCTIONPLUGIN_EXPORT virtual void execute(); @@ -52,4 +64,4 @@ class ConstructionPlugin_Axis : public ModelAPI_Feature, public GeomAPI_ICustomP }; -#endif \ No newline at end of file +#endif diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp index 547540243..39fa27ed9 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.cpp @@ -22,14 +22,14 @@ ConstructionPlugin_Plane::ConstructionPlugin_Plane() void ConstructionPlugin_Plane::initAttributes() { - data()->addAttribute(FACE_ATTR, ModelAPI_AttributeSelection::type()); - data()->addAttribute(DISTANCE_ATTR, ModelAPI_AttributeDouble::type()); + data()->addAttribute(ConstructionPlugin_Plane::FACE(), ModelAPI_AttributeSelection::type()); + data()->addAttribute(ConstructionPlugin_Plane::DISTANCE(), ModelAPI_AttributeDouble::type()); } void ConstructionPlugin_Plane::execute() { - AttributeSelectionPtr aFaceAttr = data()->selection(FACE_ATTR); - AttributeDoublePtr aDistAttr = data()->real(DISTANCE_ATTR); + AttributeSelectionPtr aFaceAttr = data()->selection(ConstructionPlugin_Plane::FACE()); + AttributeDoublePtr aDistAttr = data()->real(ConstructionPlugin_Plane::DISTANCE()); if ((aFaceAttr.get() != NULL) && (aDistAttr.get() != NULL) && aFaceAttr->isInitialized() && aDistAttr->isInitialized()) { @@ -75,4 +75,4 @@ void ConstructionPlugin_Plane::customisePresentation(AISObjectPtr thePrs) { thePrs->setColor(50, 255, 50); thePrs->setTransparensy(0.6); -} \ No newline at end of file +} diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.h b/src/ConstructionPlugin/ConstructionPlugin_Plane.h index 9697654e5..fd73f263e 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.h @@ -11,14 +11,7 @@ #include #include -/// Point kind -const std::string CONSTRUCTION_PLANE_KIND("Plane"); -/// attribute name for base face -const std::string FACE_ATTR = "planeFace"; - -/// attribute name for distance -const std::string DISTANCE_ATTR = "distance"; /**\class ConstructionPlugin_Plane * \ingroup Plugins @@ -30,17 +23,61 @@ class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustom /// Returns the kind of a feature CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() { - static std::string MY_KIND = CONSTRUCTION_PLANE_KIND; + static std::string MY_KIND = ConstructionPlugin_Plane::ID(); return MY_KIND; } + /// Plane kind + inline static const std::string& ID() + { + static const std::string CONSTRUCTION_PLANE_KIND("Plane"); + return CONSTRUCTION_PLANE_KIND; + } + /// attribute name for base face + inline static const std::string& FACE() + { + static const std::string FACE_ATTR("planeFace"); + return FACE_ATTR; + } + /// attribute name for distance + inline static const std::string& DISTANCE() + { + static const std::string DISTANCE_ATTR("distance"); + return DISTANCE_ATTR; + } + + /// the a parameter for the general equation of a plane (ax+by+cz+d=0) + inline static const std::string& A() + { + static const std::string PARAM_A_ATTR("A"); + return PARAM_A_ATTR; + } + /// the b parameter for the general equation of a plane (ax+by+cz+d=0) + inline static const std::string& B() + { + static const std::string PARAM_B_ATTR("B"); + return PARAM_B_ATTR; + } + /// the c parameter for the general equation of a plane (ax+by+cz+d=0) + inline static const std::string& C() + { + static const std::string PARAM_C_ATTR("C"); + return PARAM_C_ATTR; + } + /// the d parameter for the general equation of a plane (ax+by+cz+d=0) + inline static const std::string& D() + { + static const std::string PARAM_D_ATTR("D"); + return PARAM_D_ATTR; + } + /// Creates a new part document if needed CONSTRUCTIONPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes(); - /// Construction result is allways recomuted on the fly + /// Construction result is always recomputed on the fly CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;} /// Use plugin manager for features creation @@ -50,4 +87,4 @@ class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustom virtual void customisePresentation(AISObjectPtr thePrs); }; -#endif \ No newline at end of file +#endif diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp index 4ce70ae03..f06bd7635 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp @@ -21,13 +21,13 @@ ConstructionPlugin_Plugin::ConstructionPlugin_Plugin() FeaturePtr ConstructionPlugin_Plugin::createFeature(string theFeatureID) { - if (theFeatureID == CONSTRUCTION_POINT_KIND) { + if (theFeatureID == ConstructionPlugin_Point::ID()) { return FeaturePtr(new ConstructionPlugin_Point); } - else if (theFeatureID == CONSTRUCTION_AXIS_KIND) { + else if (theFeatureID == ConstructionPlugin_Axis::ID()) { return FeaturePtr(new ConstructionPlugin_Axis); } - else if (theFeatureID == CONSTRUCTION_PLANE_KIND) { + else if (theFeatureID == ConstructionPlugin_Plane::ID()) { return FeaturePtr(new ConstructionPlugin_Plane); } // feature of such kind is not found diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp index 9539004b7..4c13dba49 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp @@ -19,18 +19,25 @@ ConstructionPlugin_Point::ConstructionPlugin_Point() { } +const std::string& ConstructionPlugin_Point::getKind() +{ + static std::string MY_KIND = ConstructionPlugin_Point::ID(); + return MY_KIND; +} + void ConstructionPlugin_Point::initAttributes() { - data()->addAttribute(POINT_ATTR_X, ModelAPI_AttributeDouble::type()); - data()->addAttribute(POINT_ATTR_Y, ModelAPI_AttributeDouble::type()); - data()->addAttribute(POINT_ATTR_Z, ModelAPI_AttributeDouble::type()); + data()->addAttribute(ConstructionPlugin_Point::X(), ModelAPI_AttributeDouble::type()); + data()->addAttribute(ConstructionPlugin_Point::Y(), ModelAPI_AttributeDouble::type()); + data()->addAttribute(ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble::type()); } void ConstructionPlugin_Point::execute() { std::shared_ptr aPnt( - new GeomAPI_Pnt(data()->real(POINT_ATTR_X)->value(), data()->real(POINT_ATTR_Y)->value(), - data()->real(POINT_ATTR_Z)->value())); + new GeomAPI_Pnt(data()->real(ConstructionPlugin_Point::X())->value(), + data()->real(ConstructionPlugin_Point::Y())->value(), + data()->real(ConstructionPlugin_Point::Z())->value())); std::shared_ptr aConstr = document()->createConstruction(data()); aConstr->setShape(GeomAlgoAPI_PointBuilder::point(aPnt)); diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.h b/src/ConstructionPlugin/ConstructionPlugin_Point.h index cbab9d1ce..b0504698d 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.h @@ -10,16 +10,6 @@ #include "ConstructionPlugin.h" #include -/// Point kind -const std::string CONSTRUCTION_POINT_KIND("Point"); - -/// attribute name for X coordinate -const std::string POINT_ATTR_X = "x"; -/// attribute name for Y coordinate -const std::string POINT_ATTR_Y = "y"; -/// attribute name for Z coordinate -const std::string POINT_ATTR_Z = "z"; - /**\class ConstructionPlugin_Point * \ingroup Plugins * \brief Feature for creation of the new part in PartSet. @@ -28,10 +18,31 @@ class ConstructionPlugin_Point : public ModelAPI_Feature { public: /// Returns the kind of a feature - CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() + CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind(); + + inline static const std::string& ID() + { + static const std::string CONSTRUCTION_POINT_KIND("Point"); + return CONSTRUCTION_POINT_KIND; + } + + /// attribute name for X coordinate + inline static const std::string& X() + { + static const std::string POINT_ATTR_X("x"); + return POINT_ATTR_X; + } + /// attribute name for Y coordinate + inline static const std::string& Y() + { + static const std::string POINT_ATTR_Y("y"); + return POINT_ATTR_Y; + } + /// attribute name for Z coordinate + inline static const std::string& Z() { - static std::string MY_KIND = CONSTRUCTION_POINT_KIND; - return MY_KIND; + static const std::string POINT_ATTR_Z("z"); + return POINT_ATTR_Z; } /// Creates a new part document if needed diff --git a/src/InitializationPlugin/CMakeLists.txt b/src/InitializationPlugin/CMakeLists.txt new file mode 100644 index 000000000..407d3cc47 --- /dev/null +++ b/src/InitializationPlugin/CMakeLists.txt @@ -0,0 +1,36 @@ + +INCLUDE(Common) + +INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/Events + ${PROJECT_SOURCE_DIR}/src/Config + ${PROJECT_SOURCE_DIR}/src/ModelAPI +) + +SET(PROJECT_HEADERS + InitializationPlugin.h + InitializationPlugin_Plugin.h + InitializationPlugin_OriginPlanesFeature.h +) + +SET(PROJECT_SOURCES + InitializationPlugin_Plugin.cpp + InitializationPlugin_OriginPlanesFeature.cpp +) + +SET(XML_RESOURCES + plugin-Initialization.xml +) + +SET(PROJECT_LIBRARIES + Events + Config + ModelAPI +) + +ADD_DEFINITIONS(-DINITIALIZATIONPLUGIN_EXPORTS) +ADD_LIBRARY(InitializationPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES}) + +TARGET_LINK_LIBRARIES(InitializationPlugin ${PROJECT_LIBRARIES}) + +INSTALL(TARGETS InitializationPlugin DESTINATION plugins) +INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins) diff --git a/src/InitializationPlugin/InitializationPlugin.h b/src/InitializationPlugin/InitializationPlugin.h new file mode 100644 index 000000000..f2b03e873 --- /dev/null +++ b/src/InitializationPlugin/InitializationPlugin.h @@ -0,0 +1,22 @@ + +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +#ifndef INITIALIZATIONPLUGIN_H +#define INITIALIZATIONPLUGIN_H + +#if defined INITIALIZATIONPLUGIN_EXPORTS +#if defined WIN32 +#define INITIALIZATIONPLUGIN_EXPORT __declspec( dllexport ) +#else +#define INITIALIZATIONPLUGIN_EXPORT +#endif +#else +#if defined WIN32 +#define INITIALIZATIONPLUGIN_EXPORT __declspec( dllimport ) +#else +#define INITIALIZATIONPLUGIN_EXPORT +#endif +#endif + +#endif + diff --git a/src/InitializationPlugin/InitializationPlugin_OriginPlanesFeature.cpp b/src/InitializationPlugin/InitializationPlugin_OriginPlanesFeature.cpp new file mode 100644 index 000000000..8d06ee722 --- /dev/null +++ b/src/InitializationPlugin/InitializationPlugin_OriginPlanesFeature.cpp @@ -0,0 +1,54 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +/* + * InitializationPlugin_OriginPlanesFeature.cpp + * + * Created on: Aug 28, 2014 + * Author: sbh + */ + +#include + +#include +#include +#include + +InitializationPlugin_OriginPlanesFeature::InitializationPlugin_OriginPlanesFeature() +: ModelAPI_Feature() +{ +} + +InitializationPlugin_OriginPlanesFeature::~InitializationPlugin_OriginPlanesFeature() +{ +} + +/* + * Request for initialization of data model of the feature: adding all attributes + */ +void InitializationPlugin_OriginPlanesFeature::initAttributes() +{ +} + +/* + * Computes or recomputes the results + */ +void InitializationPlugin_OriginPlanesFeature::execute() +{ + std::shared_ptr aSession = ModelAPI_Session::get(); + std::shared_ptr aDoc = aSession->activeDocument(); + aSession->startOperation(); + createPoint(aDoc); + + //std::shared_ptr aPlane = aDoc->addFeature(ConstructionPlugin_Plane::ID()); + + aSession->finishOperation(); +} + +void InitializationPlugin_OriginPlanesFeature +::createPoint(const std::shared_ptr& aDoc) +{ + std::shared_ptr aPoint = aDoc->addFeature("Point"); + aPoint->real("x")->setValue(0.); + aPoint->real("y")->setValue(0.); + aPoint->real("z")->setValue(0.); +} diff --git a/src/InitializationPlugin/InitializationPlugin_OriginPlanesFeature.h b/src/InitializationPlugin/InitializationPlugin_OriginPlanesFeature.h new file mode 100644 index 000000000..7b9850091 --- /dev/null +++ b/src/InitializationPlugin/InitializationPlugin_OriginPlanesFeature.h @@ -0,0 +1,42 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +#ifndef INITIALIZATIONPLUGIN_ORIGINPLANESFEATURE_H_ +#define INITIALIZATIONPLUGIN_ORIGINPLANESFEATURE_H_ + +#include +#include + +#include + +class InitializationPlugin_OriginPlanesFeature : public ModelAPI_Feature +{ + public: + explicit InitializationPlugin_OriginPlanesFeature(); + virtual ~InitializationPlugin_OriginPlanesFeature(); + /// Extrusion kind + inline static const std::string& ID() + { + static const std::string MY_ORIGIN_PLANES_ID("OriginAndPlanes"); + return MY_ORIGIN_PLANES_ID; + } + + INITIALIZATIONPLUGIN_EXPORT virtual const std::string& getKind() + { + static std::string MY_KIND = InitializationPlugin_OriginPlanesFeature::ID(); + return MY_KIND; + } + + INITIALIZATIONPLUGIN_EXPORT virtual void initAttributes(); + + INITIALIZATIONPLUGIN_EXPORT virtual void execute(); + + INITIALIZATIONPLUGIN_EXPORT virtual bool isInHistory() + { + return false; + } + + protected: + void createPoint(const std::shared_ptr& aDoc); +}; + +#endif /* IMPORT_IMPORTFEATURE_H_ */ diff --git a/src/InitializationPlugin/InitializationPlugin_Plugin.cpp b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp new file mode 100644 index 000000000..157625b62 --- /dev/null +++ b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp @@ -0,0 +1,28 @@ + +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +#include +#include + +#include + +#include + +// the only created instance of this plugin +static InitializationPlugin_Plugin* MY_INITIALIZATIONPLUGIN_INSTANCE = new InitializationPlugin_Plugin(); + +InitializationPlugin_Plugin::InitializationPlugin_Plugin() +{ + // register this plugin + SessionPtr aSession = ModelAPI_Session::get(); + aSession->registerPlugin(this); +} + +FeaturePtr InitializationPlugin_Plugin::createFeature(std::string theFeatureID) +{ + if(InitializationPlugin_OriginPlanesFeature::ID() == theFeatureID) { + return FeaturePtr(new InitializationPlugin_OriginPlanesFeature); + } + return FeaturePtr(); +} + diff --git a/src/InitializationPlugin/InitializationPlugin_Plugin.h b/src/InitializationPlugin/InitializationPlugin_Plugin.h new file mode 100644 index 000000000..dfa0727b8 --- /dev/null +++ b/src/InitializationPlugin/InitializationPlugin_Plugin.h @@ -0,0 +1,25 @@ + +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +#ifndef INITIALIZATIONPLUGIN_PLUGIN_H_ +#define INITIALIZATIONPLUGIN_PLUGIN_H_ + +#include +#include +#include + +/**\class InitializationPlugin_Plugin + * TODO: Add documentation + */ +class INITIALIZATIONPLUGIN_EXPORT InitializationPlugin_Plugin : public ModelAPI_Plugin +{ + public: + /// Creates the feature object of this plugin by the feature string ID + virtual FeaturePtr createFeature(std::string theFeatureID); + + public: + InitializationPlugin_Plugin(); +}; + +#endif + diff --git a/src/InitializationPlugin/plugin-Initialization.xml b/src/InitializationPlugin/plugin-Initialization.xml new file mode 100644 index 000000000..ccd8442b6 --- /dev/null +++ b/src/InitializationPlugin/plugin-Initialization.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/ModelAPI/ModelAPI_Events.cpp b/src/ModelAPI/ModelAPI_Events.cpp index 447019a2a..5127ad2b6 100644 --- a/src/ModelAPI/ModelAPI_Events.cpp +++ b/src/ModelAPI/ModelAPI_Events.cpp @@ -84,3 +84,24 @@ std::list ModelAPI_FeatureStateMessage::features() const return result; } + +ModelAPI_DocumentCreatedMessage::ModelAPI_DocumentCreatedMessage(const Events_ID theID, const void* theSender) +: Events_Message(theID, theSender) +{ + +} + +ModelAPI_DocumentCreatedMessage::~ModelAPI_DocumentCreatedMessage() +{ + +} + +DocumentPtr ModelAPI_DocumentCreatedMessage::document() const +{ + return myDocument; +} + +void ModelAPI_DocumentCreatedMessage::setDocument(DocumentPtr theDocument) +{ + myDocument = theDocument; +} diff --git a/src/ModelAPI/ModelAPI_Events.h b/src/ModelAPI/ModelAPI_Events.h index fb332baff..f7293bb6d 100644 --- a/src/ModelAPI/ModelAPI_Events.h +++ b/src/ModelAPI/ModelAPI_Events.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -139,4 +140,26 @@ public: std::map myFeatureState; }; +/// Message that document (Part, PartSet) was created +class MODELAPI_EXPORT ModelAPI_DocumentCreatedMessage : public Events_Message +{ + DocumentPtr myDocument; + + public: + /// Creates an empty message + ModelAPI_DocumentCreatedMessage(const Events_ID theID, const void* theSender = 0); + /// The virtual destructor + virtual ~ModelAPI_DocumentCreatedMessage(); + + static Events_ID eventId() + { + static const char * MY_DOCUMENT_CREATED_EVENT_ID("DocumentCreated"); + return Events_Loop::eventByName(MY_DOCUMENT_CREATED_EVENT_ID); + } + + + DocumentPtr document() const; + void setDocument(DocumentPtr theDocument); +}; + #endif