From: mpv Date: Tue, 22 Apr 2014 13:39:05 +0000 (+0400) Subject: Separation of Construction plugin from PartSet plugin. Each plugin package contains... X-Git-Tag: V_0.2~139 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7b1cee901954dabb2e9165caf72baff2393db266;p=modules%2Fshaper.git Separation of Construction plugin from PartSet plugin. Each plugin package contains its config. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ed7aa098c..b5dd0ebd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/Config/CMakeLists.txt b/src/Config/CMakeLists.txt index 660990d30..92aee7ca6 100644 --- a/src/Config/CMakeLists.txt +++ b/src/Config/CMakeLists.txt @@ -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 index 3cc8a1182..000000000 --- a/src/Config/plugin-PartSet.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/Config/plugins.xml b/src/Config/plugins.xml index 4af6b07db..fa22efe2a 100644 --- a/src/Config/plugins.xml +++ b/src/Config/plugins.xml @@ -1,3 +1,4 @@ + diff --git a/src/ConstructionPlugin/CMakeLists.txt b/src/ConstructionPlugin/CMakeLists.txt new file mode 100644 index 000000000..fff34c724 --- /dev/null +++ b/src/ConstructionPlugin/CMakeLists.txt @@ -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 index 000000000..99bbf1fda --- /dev/null +++ b/src/ConstructionPlugin/ConstructionPlugin.h @@ -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 index 000000000..c433491f9 --- /dev/null +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cxx @@ -0,0 +1,24 @@ +#include "ConstructionPlugin_Plugin.h" +#include "ConstructionPlugin_Point.h" +#include +#include + +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 ConstructionPlugin_Plugin::createFeature(string theFeatureID) +{ + if (theFeatureID == "Point") { + return shared_ptr(new ConstructionPlugin_Point); + } + // feature of such kind is not found + return shared_ptr(); +} diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.h b/src/ConstructionPlugin/ConstructionPlugin_Plugin.h new file mode 100644 index 000000000..91875f362 --- /dev/null +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.h @@ -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 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 index 000000000..ea613603b --- /dev/null +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.cxx @@ -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 +void ConstructionPlugin_Point::execute() +{ + // TODO: create a real shape for the point using OCC layer + cout<<"X="<real(POINT_ATTR_X)->value()<<" Y="<real(POINT_ATTR_Y)->value() + <<" Z="<real(POINT_ATTR_Z)->value()< + +/// 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 index 000000000..a5e402f06 --- /dev/null +++ b/src/ConstructionPlugin/plugin-Construction.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/PartSetPlugin/CMakeLists.txt b/src/PartSetPlugin/CMakeLists.txt index c27034c10..1e52d1570 100644 --- a/src/PartSetPlugin/CMakeLists.txt +++ b/src/PartSetPlugin/CMakeLists.txt @@ -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) diff --git a/src/PartSetPlugin/PartSetPlugin_Plugin.cxx b/src/PartSetPlugin/PartSetPlugin_Plugin.cxx index 333239037..83e9bc421 100644 --- a/src/PartSetPlugin/PartSetPlugin_Plugin.cxx +++ b/src/PartSetPlugin/PartSetPlugin_Plugin.cxx @@ -19,8 +19,6 @@ shared_ptr PartSetPlugin_Plugin::createFeature(string theFeatu { if (theFeatureID == "Part") { return shared_ptr(new PartSetPlugin_Part); - } else if (theFeatureID == "Point") { - return shared_ptr(new PartSetPlugin_Point); } // feature of such kind is not found return shared_ptr(); diff --git a/src/PartSetPlugin/PartSetPlugin_Point.cxx b/src/PartSetPlugin/PartSetPlugin_Point.cxx deleted file mode 100644 index e9b0d2fe2..000000000 --- a/src/PartSetPlugin/PartSetPlugin_Point.cxx +++ /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 -void PartSetPlugin_Point::execute() -{ - // TODO: create a real shape for the point using OCC layer - cout<<"X="<real(POINT_ATTR_X)->value()<<" Y="<real(POINT_ATTR_Y)->value() - <<" Z="<real(POINT_ATTR_Z)->value()< - -/// 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 index 000000000..4b3391da8 --- /dev/null +++ b/src/PartSetPlugin/plugin-PartSet.xml @@ -0,0 +1,9 @@ + + + + + + + + +