]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Parameters plugin created
authorsbh <sergey.belash@opencascade.com>
Mon, 23 Mar 2015 15:10:46 +0000 (18:10 +0300)
committersbh <sergey.belash@opencascade.com>
Mon, 23 Mar 2015 15:10:46 +0000 (18:10 +0300)
12 files changed:
CMakeLists.txt
src/Config/plugins.xml
src/ModuleBase/ModuleBase_WidgetLineEdit.h
src/ParametersPlugin/CMakeLists.txt [new file with mode: 0644]
src/ParametersPlugin/ParametersPlugin.h [new file with mode: 0644]
src/ParametersPlugin/ParametersPlugin_Parameter.cpp [new file with mode: 0644]
src/ParametersPlugin/ParametersPlugin_Parameter.h [new file with mode: 0644]
src/ParametersPlugin/ParametersPlugin_Plugin.cpp [new file with mode: 0644]
src/ParametersPlugin/ParametersPlugin_Plugin.h [new file with mode: 0644]
src/ParametersPlugin/plugin-Parameters.xml [new file with mode: 0644]
src/XGUI/XGUI_pictures.qrc
src/XGUI/pictures/expression.png [new file with mode: 0644]

index 789636f2afb261daeeb20d5ab08302d473979efc..f1042dade8d9700e911dd188a865d35ee3b9dbc9 100644 (file)
@@ -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)
index 212647ecebe1226f313e2423781aa2d9d96fc084..623b8097394293d4479c6302bf8282185a5b657b 100644 (file)
@@ -9,6 +9,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="ParametersPlugin" configuration="plugin-Parameters.xml"/>
   <plugin library="SketchSolver"/>
   <plugin library="GeomValidators"/>
   <plugin library="DFBrowser" internal="true"/>
index 965049db6cc8d0ed5cb69559b4e2e079ca06705e..067185cdd2ee565a70355eb7698a403237150ba9 100644 (file)
@@ -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 (file)
index 0000000..287e84b
--- /dev/null
@@ -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 (file)
index 0000000..7d223f4
--- /dev/null
@@ -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 (file)
index 0000000..498b83d
--- /dev/null
@@ -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 <ModelAPI_AttributeString.h>
+
+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 (file)
index 0000000..e7574fd
--- /dev/null
@@ -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 <ModelAPI_Feature.h>
+
+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 (file)
index 0000000..9affdd7
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#include <ParametersPlugin_Plugin.h>
+#include <ParametersPlugin_Parameter.h>
+
+#include <ModelAPI_Session.h>
+
+#include <memory>
+
+// 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 (file)
index 0000000..d82198f
--- /dev/null
@@ -0,0 +1,24 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef PARAMETERSPLUGIN_PLUGIN_H_
+#define PARAMETERSPLUGIN_PLUGIN_H_
+
+#include <ParametersPlugin.h>
+#include <ModelAPI_Plugin.h>
+#include <ModelAPI_Feature.h>
+
+/**\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 (file)
index 0000000..63ba2ab
--- /dev/null
@@ -0,0 +1,12 @@
+<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+<plugin>
+  <workbench id="Part">
+    <group id="Parameters">
+      <feature id="Parameter" title="New Variable" tooltip="Creates a variable" icon=":pictures/expression.png">
+        <stringvalue id="variable" label="Name"/>
+        <stringvalue id="expression" icon="Value"/>
+      </feature>
+    </group>
+  </workbench>
+</plugin>
index 3176442f64049a911497746232d405bbe7f120aa..022b1c356d5683aa876bb84a5907b51c09a2452c 100644 (file)
@@ -44,5 +44,6 @@
      <file>pictures/module.png</file>
      <file>pictures/shading.png</file>
      <file>pictures/wireframe.png</file>
+     <file>pictures/expression.png</file>
  </qresource>
  </RCC>
diff --git a/src/XGUI/pictures/expression.png b/src/XGUI/pictures/expression.png
new file mode 100644 (file)
index 0000000..39dd556
Binary files /dev/null and b/src/XGUI/pictures/expression.png differ