From 94cfce6d9f83f04d6ce273849c93c01381670de4 Mon Sep 17 00:00:00 2001 From: sbh Date: Mon, 23 Mar 2015 18:10:46 +0300 Subject: [PATCH] Parameters plugin created --- CMakeLists.txt | 1 + src/Config/plugins.xml | 1 + src/ModuleBase/ModuleBase_WidgetLineEdit.h | 2 +- src/ParametersPlugin/CMakeLists.txt | 35 ++++++++++++ src/ParametersPlugin/ParametersPlugin.h | 21 +++++++ .../ParametersPlugin_Parameter.cpp | 22 +++++++ .../ParametersPlugin_Parameter.h | 54 ++++++++++++++++++ .../ParametersPlugin_Plugin.cpp | 28 +++++++++ .../ParametersPlugin_Plugin.h | 24 ++++++++ src/ParametersPlugin/plugin-Parameters.xml | 12 ++++ src/XGUI/XGUI_pictures.qrc | 1 + src/XGUI/pictures/expression.png | Bin 0 -> 375 bytes 12 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 src/ParametersPlugin/CMakeLists.txt create mode 100644 src/ParametersPlugin/ParametersPlugin.h create mode 100644 src/ParametersPlugin/ParametersPlugin_Parameter.cpp create mode 100644 src/ParametersPlugin/ParametersPlugin_Parameter.h create mode 100644 src/ParametersPlugin/ParametersPlugin_Plugin.cpp create mode 100644 src/ParametersPlugin/ParametersPlugin_Plugin.h create mode 100644 src/ParametersPlugin/plugin-Parameters.xml create mode 100644 src/XGUI/pictures/expression.png diff --git a/CMakeLists.txt b/CMakeLists.txt index 789636f2a..f1042dade 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ ADD_SUBDIRECTORY (src/GeomApp) ADD_SUBDIRECTORY (src/ExchangePlugin) ADD_SUBDIRECTORY (src/GeomValidators) ADD_SUBDIRECTORY (src/InitializationPlugin) +ADD_SUBDIRECTORY (src/ParametersPlugin) IF(${HAVE_SALOME}) ADD_SUBDIRECTORY (src/NewGeom) diff --git a/src/Config/plugins.xml b/src/Config/plugins.xml index 212647ece..623b80973 100644 --- a/src/Config/plugins.xml +++ b/src/Config/plugins.xml @@ -9,6 +9,7 @@ + diff --git a/src/ModuleBase/ModuleBase_WidgetLineEdit.h b/src/ModuleBase/ModuleBase_WidgetLineEdit.h index 965049db6..067185cdd 100644 --- a/src/ModuleBase/ModuleBase_WidgetLineEdit.h +++ b/src/ModuleBase/ModuleBase_WidgetLineEdit.h @@ -31,7 +31,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetLineEdit : public ModuleBase_ModelWidge public: /// Constructor /// \param theParent the parent object - /// \param theData the widget configuation. The attribute of the model widget is obtained from + /// \param theData the widget configuration. /// \param theParentId is Id of a parent of the current attribute ModuleBase_WidgetLineEdit(QWidget* theParent, const Config_WidgetAPI* theData, diff --git a/src/ParametersPlugin/CMakeLists.txt b/src/ParametersPlugin/CMakeLists.txt new file mode 100644 index 000000000..287e84b23 --- /dev/null +++ b/src/ParametersPlugin/CMakeLists.txt @@ -0,0 +1,35 @@ +INCLUDE(Common) + +INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/Events + ${PROJECT_SOURCE_DIR}/src/Config + ${PROJECT_SOURCE_DIR}/src/ModelAPI +) + +SET(PROJECT_HEADERS + ParametersPlugin.h + ParametersPlugin_Plugin.h + ParametersPlugin_Parameter.h +) + +SET(PROJECT_SOURCES + ParametersPlugin_Plugin.cpp + ParametersPlugin_Parameter.cpp +) + +SET(XML_RESOURCES + plugin-Parameters.xml +) + +SET(PROJECT_LIBRARIES + Events + Config + ModelAPI +) + +ADD_DEFINITIONS(-DPARAMETERSPLUGIN_EXPORTS) +ADD_LIBRARY(ParametersPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES}) + +TARGET_LINK_LIBRARIES(ParametersPlugin ${PROJECT_LIBRARIES}) + +INSTALL(TARGETS ParametersPlugin DESTINATION plugins) +INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins) diff --git a/src/ParametersPlugin/ParametersPlugin.h b/src/ParametersPlugin/ParametersPlugin.h new file mode 100644 index 000000000..7d223f4bb --- /dev/null +++ b/src/ParametersPlugin/ParametersPlugin.h @@ -0,0 +1,21 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +#ifndef PARAMETERSPLUGIN_H +#define PARAMETERSPLUGIN_H + +#if defined PARAMETERSPLUGIN_EXPORTS +#if defined WIN32 +#define PARAMETERSPLUGIN_EXPORT __declspec( dllexport ) +#else +#define PARAMETERSPLUGIN_EXPORT +#endif +#else +#if defined WIN32 +#define PARAMETERSPLUGIN_EXPORT __declspec( dllimport ) +#else +#define PARAMETERSPLUGIN_EXPORT +#endif +#endif + +#endif + diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp new file mode 100644 index 000000000..498b83d9a --- /dev/null +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp @@ -0,0 +1,22 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: ParametersPlugin_Parameter.cpp +// Created: 23 MArch 2015 +// Author: sbh + +#include "ParametersPlugin_Parameter.h" +#include + +ParametersPlugin_Parameter::ParametersPlugin_Parameter() +{ +} + +void ParametersPlugin_Parameter::initAttributes() +{ + data()->addAttribute(ParametersPlugin_Parameter::VARIABLE_ID(), ModelAPI_AttributeString::type()); + data()->addAttribute(ParametersPlugin_Parameter::EXPRESSION_ID(), ModelAPI_AttributeString::type()); +} + +void ParametersPlugin_Parameter::execute() +{ +} diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.h b/src/ParametersPlugin/ParametersPlugin_Parameter.h new file mode 100644 index 000000000..e7574fd2a --- /dev/null +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.h @@ -0,0 +1,54 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: ParametersPlugin_Parameter.h +// Created: 23 MArch 2015 +// Author: sbh + +#ifndef PARAMETERSPLUGIN_PARAMETER_H_ +#define PARAMETERSPLUGIN_PARAMETER_H_ + +#include "ParametersPlugin.h" +#include + +class ParametersPlugin_Parameter : public ModelAPI_Feature +{ + public: + /// Extrusion kind + inline static const std::string& ID() + { + static const std::string MY_EXTRUSION_ID("Parameter"); + return MY_EXTRUSION_ID; + } + /// attribute name of references sketch entities list, it should contain a sketch result or + /// a pair a sketch result to sketch face + inline static const std::string& VARIABLE_ID() + { + static const std::string MY_VARIABLE_ID("variable"); + return MY_VARIABLE_ID; + } + + /// attribute name of extrusion size + inline static const std::string& EXPRESSION_ID() + { + static const std::string MY_EXPRESSION_ID("expression"); + return MY_EXPRESSION_ID; + } + + /// Returns the kind of a feature + PARAMETERSPLUGIN_EXPORT virtual const std::string& getKind() + { + static std::string MY_KIND = ParametersPlugin_Parameter::ID(); + return MY_KIND; + } + + /// Creates a new part document if needed + PARAMETERSPLUGIN_EXPORT virtual void execute(); + + /// Request for initialization of data model of the feature: adding all attributes + PARAMETERSPLUGIN_EXPORT virtual void initAttributes(); + + /// Use plugin manager for features creation + ParametersPlugin_Parameter(); +}; + +#endif diff --git a/src/ParametersPlugin/ParametersPlugin_Plugin.cpp b/src/ParametersPlugin/ParametersPlugin_Plugin.cpp new file mode 100644 index 000000000..9affdd7a1 --- /dev/null +++ b/src/ParametersPlugin/ParametersPlugin_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 ParametersPlugin_Plugin* MY_PARAMETERSPLUGIN_INSTANCE = new ParametersPlugin_Plugin(); + +ParametersPlugin_Plugin::ParametersPlugin_Plugin() +{ + // register this plugin + SessionPtr aSession = ModelAPI_Session::get(); + aSession->registerPlugin(this); +} + +FeaturePtr ParametersPlugin_Plugin::createFeature(std::string theFeatureID) +{ + // TODO: register some features + if (theFeatureID == ParametersPlugin_Parameter::ID()) { + return FeaturePtr(new ParametersPlugin_Parameter); + } + return FeaturePtr(); +} + diff --git a/src/ParametersPlugin/ParametersPlugin_Plugin.h b/src/ParametersPlugin/ParametersPlugin_Plugin.h new file mode 100644 index 000000000..d82198f60 --- /dev/null +++ b/src/ParametersPlugin/ParametersPlugin_Plugin.h @@ -0,0 +1,24 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +#ifndef PARAMETERSPLUGIN_PLUGIN_H_ +#define PARAMETERSPLUGIN_PLUGIN_H_ + +#include +#include +#include + +/**\class ParametersPlugin_Plugin + * TODO: Add documentation + */ +class PARAMETERSPLUGIN_EXPORT ParametersPlugin_Plugin : public ModelAPI_Plugin +{ + public: + /// Creates the feature object of this plugin by the feature string ID + virtual FeaturePtr createFeature(std::string theFeatureID); + + public: + ParametersPlugin_Plugin(); +}; + +#endif + diff --git a/src/ParametersPlugin/plugin-Parameters.xml b/src/ParametersPlugin/plugin-Parameters.xml new file mode 100644 index 000000000..63ba2ab68 --- /dev/null +++ b/src/ParametersPlugin/plugin-Parameters.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/XGUI/XGUI_pictures.qrc b/src/XGUI/XGUI_pictures.qrc index 3176442f6..022b1c356 100644 --- a/src/XGUI/XGUI_pictures.qrc +++ b/src/XGUI/XGUI_pictures.qrc @@ -44,5 +44,6 @@ pictures/module.png pictures/shading.png pictures/wireframe.png + pictures/expression.png diff --git a/src/XGUI/pictures/expression.png b/src/XGUI/pictures/expression.png new file mode 100644 index 0000000000000000000000000000000000000000..39dd556e638aaf646e1082eb13cf1ffbecba190b GIT binary patch literal 375 zcmV--0f_#IP) z;c3G#5QQs||5Z1zH!yesd4qa_WP{QP+D=e1LDLDGPGBuy+7U8BHgMm;6Nt7hI;c#E z;Nv9l`CZ_P5;M>9)f&sP7RR)0>re;a3uOe*+ma!~gTZoBdU*-DEEzU&Gfk5z5dhid zRrR*NOwtGoed_1!LQ{qE4sI1g-+__6-_~ZSiS;0blRhx`1bQ|Mz=0Y(fgOAA^Q_|w zA;^hm2lfo982ZA!6Zov)HF{TUibe*3VR4YaPthd+z3oZI`~&;4rT6D;q3L3ME58e|i7wJ^`!R VW