]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
"Initialization" plugin: plugin and it's features stubs created
authorsbh <sergey.belash@opencascade.com>
Tue, 24 Feb 2015 14:52:54 +0000 (17:52 +0300)
committersbh <sergey.belash@opencascade.com>
Tue, 24 Feb 2015 14:52:54 +0000 (17:52 +0300)
18 files changed:
CMakeLists.txt
src/Config/plugins.xml
src/ConstructionPlugin/ConstructionPlugin_Axis.cpp
src/ConstructionPlugin/ConstructionPlugin_Axis.h
src/ConstructionPlugin/ConstructionPlugin_Plane.cpp
src/ConstructionPlugin/ConstructionPlugin_Plane.h
src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.h
src/InitializationPlugin/CMakeLists.txt [new file with mode: 0644]
src/InitializationPlugin/InitializationPlugin.h [new file with mode: 0644]
src/InitializationPlugin/InitializationPlugin_OriginPlanesFeature.cpp [new file with mode: 0644]
src/InitializationPlugin/InitializationPlugin_OriginPlanesFeature.h [new file with mode: 0644]
src/InitializationPlugin/InitializationPlugin_Plugin.cpp [new file with mode: 0644]
src/InitializationPlugin/InitializationPlugin_Plugin.h [new file with mode: 0644]
src/InitializationPlugin/plugin-Initialization.xml [new file with mode: 0644]
src/ModelAPI/ModelAPI_Events.cpp
src/ModelAPI/ModelAPI_Events.h

index ea51439dfafdc64027a31c58cb1a4e4e09503e9f..895c8e8ed9e47cf473dae443216b49ee69493319 100644 (file)
@@ -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)
index e8d43ed022a5ef39b45c1d4462b06fd55edf69db..3923ac8e9a0ad2341157e6a5c134ee57122ec377 100644 (file)
@@ -7,6 +7,7 @@
   <plugin library="FeaturesPlugin" configuration="plugin-Features.xml"/>
   <plugin library="ExchangePlugin" configuration="plugin-Exchange.xml"/>
   <plugin script="ConnectorPlugin" configuration="plugin-Connector.xml" dependency="Geometry"/>
+  <plugin library="InitializationPlugin" configuration="plugin-Initialization.xml"/>
   <plugin library="SketchSolver"/>
   <plugin library="GeomValidators"/>
   <plugin library="DFBrowser" internal="true"/>
index f0e45a5bf0bb9bc8cedc988e6cc0a6612ec6ca6b..570a3a3b8edb2b58a4a19ff02b5c39e0f59dacd7 100644 (file)
 
 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<GeomAPI_Pnt> aStart = GeomAlgoAPI_PointBuilder::point(aShape1);
       std::shared_ptr<GeomAPI_Pnt> anEnd = GeomAlgoAPI_PointBuilder::point(aShape2);
-      if (aStart->distance(anEnd) > MINIMAL_LENGTH) {
+      if (aStart->distance(anEnd) > ConstructionPlugin_Axis::MINIMAL_LENGTH()) {
         std::shared_ptr<GeomAPI_Edge> 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
+}
index 87ab72be5b709825ffc7b42bc0246dd3a8d90832..2b968ba593553a229efbc52ef920111993e57583 100644 (file)
 #include <GeomAPI_ICustomPrs.h>
 
 
-/// 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
index 5475402437a3a707cf5e5dbb3ef90dc55be4f413..39fa27ed966998a30a1eef0955e2aff5ee762a1e 100644 (file)
@@ -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
+}
index 9697654e54d6aee54f04241b7dc941206f0dafbb..fd73f263e2fdbf2a1f770d15de9f4226aa75aea2 100644 (file)
 #include <ModelAPI_Feature.h>
 #include <GeomAPI_ICustomPrs.h>
 
-/// 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
index 4ce70ae037c789ce3e0e7aa0cf788c3589355543..f06bd7635440f443c99e3bb42532f58711b33bb4 100644 (file)
@@ -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
index 9539004b7645ed5ff075cfa952fb4f46fc82753c..4c13dba4958abb832558f62db3d307c557470e4e 100644 (file)
@@ -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<GeomAPI_Pnt> 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<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
   aConstr->setShape(GeomAlgoAPI_PointBuilder::point(aPnt));
index cbab9d1ce5253dd0a3ede6a12430b6df6fac6022..b0504698d93c7f9017edc73ad1ab98b925c45a9f 100644 (file)
 #include "ConstructionPlugin.h"
 #include <ModelAPI_Feature.h>
 
-/// 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 (file)
index 0000000..407d3cc
--- /dev/null
@@ -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 (file)
index 0000000..f2b03e8
--- /dev/null
@@ -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 (file)
index 0000000..8d06ee7
--- /dev/null
@@ -0,0 +1,54 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+/*
+ * InitializationPlugin_OriginPlanesFeature.cpp
+ *
+ *  Created on: Aug 28, 2014
+ *      Author: sbh
+ */
+
+#include <InitializationPlugin_OriginPlanesFeature.h>
+
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Document.h>
+#include <ModelAPI_AttributeDouble.h>
+
+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<ModelAPI_Session> aSession = ModelAPI_Session::get();
+  std::shared_ptr<ModelAPI_Document> aDoc = aSession->activeDocument();
+  aSession->startOperation();
+  createPoint(aDoc);
+
+  //std::shared_ptr<ModelAPI_Feature> aPlane = aDoc->addFeature(ConstructionPlugin_Plane::ID());
+
+  aSession->finishOperation();
+}
+
+void InitializationPlugin_OriginPlanesFeature
+::createPoint(const std::shared_ptr<ModelAPI_Document>& aDoc)
+{
+  std::shared_ptr<ModelAPI_Feature> 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 (file)
index 0000000..7b98500
--- /dev/null
@@ -0,0 +1,42 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef INITIALIZATIONPLUGIN_ORIGINPLANESFEATURE_H_
+#define INITIALIZATIONPLUGIN_ORIGINPLANESFEATURE_H_
+
+#include <InitializationPlugin.h>
+#include <ModelAPI_Feature.h>
+
+#include <map>
+
+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<ModelAPI_Document>& aDoc);
+};
+
+#endif /* IMPORT_IMPORTFEATURE_H_ */
diff --git a/src/InitializationPlugin/InitializationPlugin_Plugin.cpp b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp
new file mode 100644 (file)
index 0000000..157625b
--- /dev/null
@@ -0,0 +1,28 @@
+
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#include <InitializationPlugin_Plugin.h>
+#include <InitializationPlugin_OriginPlanesFeature.h>
+
+#include <ModelAPI_Session.h>
+
+#include <memory>
+
+// 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 (file)
index 0000000..dfa0727
--- /dev/null
@@ -0,0 +1,25 @@
+
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef INITIALIZATIONPLUGIN_PLUGIN_H_
+#define INITIALIZATIONPLUGIN_PLUGIN_H_
+
+#include <InitializationPlugin.h>
+#include <ModelAPI_Plugin.h>
+#include <ModelAPI_Feature.h>
+
+/**\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 (file)
index 0000000..ccd8442
--- /dev/null
@@ -0,0 +1,11 @@
+<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+<plugin>
+  <workbench id="Features">
+    <group id="Basic">
+      <!-- <feature id="OriginAndPlanes" title="Add default planes" tooltip="Do not touch" icon=":pictures/wnd_close.png"> -->
+      <feature id="OriginAndPlanes" internal="true">
+      </feature>
+    </group>
+  </workbench>
+</plugin>
index 447019a2af949ecef3a45409556b9af53d4bf6c9..5127ad2b623fa1e9b044fdec42201226982f9a29 100644 (file)
@@ -84,3 +84,24 @@ std::list<std::string> 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;
+}
index fb332baff0c5ce0a2b8a9d66e0a2b65f5d7d729c..f7293bb6dd5c8a270d94a3c890dc346ba1ec8939 100644 (file)
@@ -11,6 +11,7 @@
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Feature.h>
 #include <Events_MessageGroup.h>
+#include <Events_Loop.h>
 
 #include <memory>
 #include <string>
@@ -139,4 +140,26 @@ public:
   std::map<std::string, bool> 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