]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Separation of Construction plugin from PartSet plugin. Each plugin package contains...
authormpv <mikhail.ponikarov@opencascade.com>
Tue, 22 Apr 2014 13:39:05 +0000 (17:39 +0400)
committermpv <mikhail.ponikarov@opencascade.com>
Tue, 22 Apr 2014 13:39:05 +0000 (17:39 +0400)
16 files changed:
CMakeLists.txt
src/Config/CMakeLists.txt
src/Config/plugin-PartSet.xml [deleted file]
src/Config/plugins.xml
src/ConstructionPlugin/CMakeLists.txt [new file with mode: 0644]
src/ConstructionPlugin/ConstructionPlugin.h [new file with mode: 0644]
src/ConstructionPlugin/ConstructionPlugin_Plugin.cxx [new file with mode: 0644]
src/ConstructionPlugin/ConstructionPlugin_Plugin.h [new file with mode: 0644]
src/ConstructionPlugin/ConstructionPlugin_Point.cxx [new file with mode: 0644]
src/ConstructionPlugin/ConstructionPlugin_Point.h [new file with mode: 0644]
src/ConstructionPlugin/plugin-Construction.xml [new file with mode: 0644]
src/PartSetPlugin/CMakeLists.txt
src/PartSetPlugin/PartSetPlugin_Plugin.cxx
src/PartSetPlugin/PartSetPlugin_Point.cxx [deleted file]
src/PartSetPlugin/PartSetPlugin_Point.h [deleted file]
src/PartSetPlugin/plugin-PartSet.xml [new file with mode: 0644]

index ed7aa098c1c3f40289243b3189ca7be39e688626..b5dd0ebd4b68198848779931de5c83e9da974fac 100644 (file)
@@ -25,6 +25,7 @@ ADD_SUBDIRECTORY (src/ModelAPI)
 ADD_SUBDIRECTORY (src/ModuleBase)
 ADD_SUBDIRECTORY (src/PartSet)
 ADD_SUBDIRECTORY (src/PartSetPlugin)
+ADD_SUBDIRECTORY (src/ConstructionPlugin)
 ADD_SUBDIRECTORY (src/PyConsole)
 ADD_SUBDIRECTORY (src/PyEvent)
 ADD_SUBDIRECTORY (src/PyInterp)
index 660990d30090fc1048badca036b8c31b609717bc..92aee7ca611efc77eface8cad5f13fa00012be14 100644 (file)
@@ -26,7 +26,6 @@ SET(PROJECT_SOURCES
 )
 
 SET(XML_RESOURCES
-  plugin-PartSet.xml
   plugins.xml
 )
 
diff --git a/src/Config/plugin-PartSet.xml b/src/Config/plugin-PartSet.xml
deleted file mode 100644 (file)
index 3cc8a11..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<plugin>
-  <workbench id="Part">
-    <group id="Operations">
-      <feature id="Part" text="New part" tooltip="Creates a new part" icon=":pictures/part_ico.png"/>
-      <feature id="duplicate" text="Duplicate" tooltip="Duplicate selected object" icon=":icons/duplicate.png"/>
-      <feature id="remove" text="Remove"  tooltip="Remove selected object" icon=":icons/remove.png"/>
-    </group>
-  </workbench>
-  <workbench id="Construction">
-    <group id="Basic">
-      <feature id="Point" text="Point" tooltip="Create a new point" icon=":icons/point.png">
-        <doublevalue id="x" label="X:" max="50" step="1.0" default="0" icon=":pictures/x_point.png" tooltip="Set X"/>
-        <doublevalue id="y" label="Y:" min="x" default="1" icon=":pictures/y_point.png" tooltip="Set Y"/>
-        <doublevalue id="z" label="Z:" min="-20" step="0.1" default="2" icon=":pictures/z_point.png" tooltip="Set Z"/>
-      </feature>
-      <feature id="Axis" text="Axis" tooltip="Create a new axis" icon=":icons/axis.png" keysequence=""/>
-      <feature id="Plane" text="Plane" tooltip="Create a new plane" icon=":icons/plane.png" keysequence=""/>
-    </group>
-  </workbench>  
-</plugin>
index 4af6b07dbdc40228a3d18c9da4fb7ad2ed0ff45d..fa22efe2a011009d04e8466df05b766168c9b8f3 100644 (file)
@@ -1,3 +1,4 @@
 <plugins module="PartSet">
   <plugin library="PartSetPlugin" configuration="plugin-PartSet.xml"/>
+  <plugin library="ConstructionPlugin" configuration="plugin-Construction.xml"/>
 </plugins>
diff --git a/src/ConstructionPlugin/CMakeLists.txt b/src/ConstructionPlugin/CMakeLists.txt
new file mode 100644 (file)
index 0000000..fff34c7
--- /dev/null
@@ -0,0 +1,27 @@
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+    ConstructionPlugin.h
+    ConstructionPlugin_Plugin.h
+    ConstructionPlugin_Point.h
+)
+
+SET(PROJECT_SOURCES
+    ConstructionPlugin_Plugin.cxx
+    ConstructionPlugin_Point.cxx
+)
+
+ADD_DEFINITIONS(-DCONSTRUCTIONPLUGIN_EXPORTS ${BOOST_DEFINITIONS})
+ADD_LIBRARY(ConstructionPlugin SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(ConstructionPlugin ${PROJECT_LIBRARIES} ModelAPI)
+
+INCLUDE_DIRECTORIES(
+  ../ModelAPI
+)
+
+SET(XML_RESOURCES
+  plugin-Construction.xml
+)
+
+INSTALL(TARGETS ConstructionPlugin DESTINATION plugins)
+INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins)
diff --git a/src/ConstructionPlugin/ConstructionPlugin.h b/src/ConstructionPlugin/ConstructionPlugin.h
new file mode 100644 (file)
index 0000000..99bbf1f
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef CONSTRUCTIONPLUGIN_H
+#define CONSTRUCTIONPLUGIN_H
+
+#if defined CONSTRUCTIONPLUGIN_EXPORTS
+#if defined WIN32
+#define CONSTRUCTIONPLUGIN_EXPORT              __declspec( dllexport )
+#else
+#define CONSTRUCTIONPLUGIN_EXPORT
+#endif
+#else
+#if defined WIN32
+#define CONSTRUCTIONPLUGIN_EXPORT              __declspec( dllimport )
+#else
+#define CONSTRUCTIONPLUGIN_EXPORT
+#endif
+#endif
+
+#endif
diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cxx b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cxx
new file mode 100644 (file)
index 0000000..c433491
--- /dev/null
@@ -0,0 +1,24 @@
+#include "ConstructionPlugin_Plugin.h"
+#include "ConstructionPlugin_Point.h"
+#include <ModelAPI_PluginManager.h>
+#include <ModelAPI_Document.h>
+
+using namespace std;
+
+// the only created instance of this plugin
+static ConstructionPlugin_Plugin* MY_INSTANCE = new ConstructionPlugin_Plugin();
+
+ConstructionPlugin_Plugin::ConstructionPlugin_Plugin() 
+{
+  // register this plugin
+  ModelAPI_PluginManager::get()->registerPlugin(this);
+}
+
+shared_ptr<ModelAPI_Feature> ConstructionPlugin_Plugin::createFeature(string theFeatureID)
+{
+  if (theFeatureID == "Point") {
+    return shared_ptr<ModelAPI_Feature>(new ConstructionPlugin_Point);
+  }
+  // feature of such kind is not found
+  return shared_ptr<ModelAPI_Feature>();
+}
diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.h b/src/ConstructionPlugin/ConstructionPlugin_Plugin.h
new file mode 100644 (file)
index 0000000..91875f3
--- /dev/null
@@ -0,0 +1,23 @@
+// File:        ConstructionPlugin_Plugin.hxx
+// Created:     31 Mar 2014
+// Author:      Mikhail PONIKAROV
+
+#ifndef ConstructionPlugin_Plugin_HeaderFile
+#define ConstructionPlugin_Plugin_HeaderFile
+
+
+#include "ConstructionPlugin.h"
+#include "ModelAPI_Plugin.h"
+
+class CONSTRUCTIONPLUGIN_EXPORT ConstructionPlugin_Plugin: public ModelAPI_Plugin
+{
+public:
+  /// Creates the feature object of this plugin by the feature string ID
+  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+
+public:
+  /// Is needed for python wrapping by swig
+  ConstructionPlugin_Plugin();
+};
+
+#endif
diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.cxx b/src/ConstructionPlugin/ConstructionPlugin_Point.cxx
new file mode 100644 (file)
index 0000000..ea61360
--- /dev/null
@@ -0,0 +1,31 @@
+// File:        ConstructionPlugin_Point.cxx
+// Created:     27 Mar 2014
+// Author:      Mikhail PONIKAROV
+
+#include "ConstructionPlugin_Point.h"
+#include "ModelAPI_PluginManager.h"
+#include "ModelAPI_Document.h"
+#include "ModelAPI_Data.h"
+#include "ModelAPI_AttributeDouble.h"
+
+using namespace std;
+
+ConstructionPlugin_Point::ConstructionPlugin_Point()
+{
+}
+
+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());
+}
+
+// this is for debug only
+#include <iostream>
+void ConstructionPlugin_Point::execute() 
+{
+  // TODO: create a real shape for the point using OCC layer
+  cout<<"X="<<data()->real(POINT_ATTR_X)->value()<<" Y="<<data()->real(POINT_ATTR_Y)->value()
+      <<" Z="<<data()->real(POINT_ATTR_Z)->value()<<endl;
+}
diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.h b/src/ConstructionPlugin/ConstructionPlugin_Point.h
new file mode 100644 (file)
index 0000000..2b71b50
--- /dev/null
@@ -0,0 +1,43 @@
+// File:        ConstructionPlugin_Point.h
+// Created:     3 Apr 2014
+// Author:      Mikhail PONIKAROV
+
+#ifndef ConstructionPlugin_Point_HeaderFile
+#define ConstructionPlugin_Point_HeaderFile
+
+#include "ConstructionPlugin.h"
+#include <ModelAPI_Feature.h>
+
+/// 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 DataModel
+ * \brief Feature for creation of the new part in PartSet.
+ */
+class ConstructionPlugin_Point: public ModelAPI_Feature
+{
+public:
+  /// Returns the kind of a feature
+  CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() 
+  {static std::string MY_KIND = "Point"; return MY_KIND;}
+
+  /// Returns to which group in the document must be added feature
+  CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getGroup() 
+  {static std::string MY_GROUP = "Construction"; return MY_GROUP;}
+
+  /// 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();
+
+  /// Use plugin manager for features creation
+  ConstructionPlugin_Point();
+};
+
+#endif
diff --git a/src/ConstructionPlugin/plugin-Construction.xml b/src/ConstructionPlugin/plugin-Construction.xml
new file mode 100644 (file)
index 0000000..a5e402f
--- /dev/null
@@ -0,0 +1,13 @@
+<plugin>
+  <workbench id="Construction">
+    <group id="Basic">
+      <feature id="Point" text="Point" tooltip="Create a new point" icon=":icons/point.png">
+        <doublevalue id="x" label="X:" max="50" step="1.0" default="0" icon=":pictures/x_point.png" tooltip="Set X"/>
+        <doublevalue id="y" label="Y:" min="x" default="1" icon=":pictures/y_point.png" tooltip="Set Y"/>
+        <doublevalue id="z" label="Z:" min="-20" step="0.1" default="2" icon=":pictures/z_point.png" tooltip="Set Z"/>
+      </feature>
+      <feature id="Axis" text="Axis" tooltip="Create a new axis" icon=":icons/axis.png" keysequence=""/>
+      <feature id="Plane" text="Plane" tooltip="Create a new plane" icon=":icons/plane.png" keysequence=""/>
+    </group>
+  </workbench>  
+</plugin>
index c27034c10ddd19dc4800fef8917a2da49f786138..1e52d1570473a6c4ba8132fc2f25ef8c5d6a42bd 100644 (file)
@@ -4,13 +4,11 @@ SET(PROJECT_HEADERS
     PartSetPlugin.h
     PartSetPlugin_Plugin.h
     PartSetPlugin_Part.h
-    PartSetPlugin_Point.h
 )
 
 SET(PROJECT_SOURCES
     PartSetPlugin_Plugin.cxx
     PartSetPlugin_Part.cxx
-    PartSetPlugin_Point.cxx
 )
 
 ADD_DEFINITIONS(-DPARTSETPLUGIN_EXPORTS ${BOOST_DEFINITIONS})
@@ -21,4 +19,9 @@ INCLUDE_DIRECTORIES(
   ../ModelAPI
 )
 
+SET(XML_RESOURCES
+  plugin-PartSet.xml
+)
+
 INSTALL(TARGETS PartSetPlugin DESTINATION plugins)
+INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins)
index 33323903724e41a2c8a97b33029a2c1d239c8069..83e9bc421b138ab498c27d627d8bcc4f897aecb5 100644 (file)
@@ -19,8 +19,6 @@ shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatu
 {
   if (theFeatureID == "Part") {
     return shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Part);
-  } else if (theFeatureID == "Point") {
-    return shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Point);
   }
   // feature of such kind is not found
   return shared_ptr<ModelAPI_Feature>();
diff --git a/src/PartSetPlugin/PartSetPlugin_Point.cxx b/src/PartSetPlugin/PartSetPlugin_Point.cxx
deleted file mode 100644 (file)
index e9b0d2f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// File:        PartSetPlugin_Point.cxx
-// Created:     27 Mar 2014
-// Author:      Mikhail PONIKAROV
-
-#include "PartSetPlugin_Point.h"
-#include "ModelAPI_PluginManager.h"
-#include "ModelAPI_Document.h"
-#include "ModelAPI_Data.h"
-#include "ModelAPI_AttributeDouble.h"
-
-using namespace std;
-
-PartSetPlugin_Point::PartSetPlugin_Point()
-{
-}
-
-void PartSetPlugin_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());
-}
-
-// this is for debug only
-#include <iostream>
-void PartSetPlugin_Point::execute() 
-{
-  // TODO: create a real shape for the point using OCC layer
-  cout<<"X="<<data()->real(POINT_ATTR_X)->value()<<" Y="<<data()->real(POINT_ATTR_Y)->value()
-      <<" Z="<<data()->real(POINT_ATTR_Z)->value()<<endl;
-}
diff --git a/src/PartSetPlugin/PartSetPlugin_Point.h b/src/PartSetPlugin/PartSetPlugin_Point.h
deleted file mode 100644 (file)
index 4a8766a..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-// File:        PartSetPlugin_Point.h
-// Created:     3 Apr 2014
-// Author:      Mikhail PONIKAROV
-
-#ifndef PartSetPlugin_Point_HeaderFile
-#define PartSetPlugin_Point_HeaderFile
-
-#include "PartSetPlugin.h"
-#include <ModelAPI_Feature.h>
-
-/// 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 PartSetPlugin_Point
- * \ingroup DataModel
- * \brief Feature for creation of the new part in PartSet.
- */
-class PartSetPlugin_Point: public ModelAPI_Feature
-{
-public:
-  /// Returns the kind of a feature
-  PARTSETPLUGIN_EXPORT virtual const std::string& getKind() 
-  {static std::string MY_KIND = "Point"; return MY_KIND;}
-
-  /// Returns to which group in the document must be added feature
-  PARTSETPLUGIN_EXPORT virtual const std::string& getGroup() 
-  {static std::string MY_GROUP = "Construction"; return MY_GROUP;}
-
-  /// Creates a new part document if needed
-  PARTSETPLUGIN_EXPORT virtual void execute();
-
-  /// Request for initialization of data model of the feature: adding all attributes
-  PARTSETPLUGIN_EXPORT virtual void initAttributes();
-
-  /// Use plugin manager for features creation
-  PartSetPlugin_Point();
-};
-
-#endif
diff --git a/src/PartSetPlugin/plugin-PartSet.xml b/src/PartSetPlugin/plugin-PartSet.xml
new file mode 100644 (file)
index 0000000..4b3391d
--- /dev/null
@@ -0,0 +1,9 @@
+<plugin>
+  <workbench id="Part">
+    <group id="Operations">
+      <feature id="Part" text="New part" tooltip="Creates a new part" icon=":pictures/part_ico.png"/>
+      <feature id="duplicate" text="Duplicate" tooltip="Duplicate selected object" icon=":icons/duplicate.png"/>
+      <feature id="remove" text="Remove"  tooltip="Remove selected object" icon=":icons/remove.png"/>
+    </group>
+  </workbench>
+</plugin>