]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
IWorkshop interface for Module is created
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 3 Jun 2014 08:17:50 +0000 (12:17 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 3 Jun 2014 08:17:50 +0000 (12:17 +0400)
32 files changed:
CMakeLists.txt
src/Config/CMakeLists.txt
src/Config/Config.h [deleted file]
src/Config/Config_Common.h
src/Config/Config_FeatureMessage.h
src/Config/Config_FeatureReader.h
src/Config/Config_ModuleReader.h
src/Config/Config_PointerMessage.h
src/Config/Config_WidgetAPI.cpp
src/Config/Config_WidgetAPI.h
src/Config/Config_WidgetReader.h
src/Config/Config_XMLReader.h
src/Config/Config_def.h [new file with mode: 0644]
src/GeomAPI/CMakeLists.txt
src/GeomAlgoAPI/CMakeLists.txt
src/GeomData/CMakeLists.txt
src/Model/CMakeLists.txt
src/ModuleBase/CMakeLists.txt
src/ModuleBase/ModuleBase_IWorkshop.h [new file with mode: 0644]
src/ModuleBase/ModuleBase_SelectorWidget.cpp [new file with mode: 0644]
src/ModuleBase/ModuleBase_SelectorWidget.h [new file with mode: 0644]
src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/ModuleBase/ModuleBase_WidgetFactory.h
src/NewGeom/CMakeLists.txt
src/PartSet/CMakeLists.txt
src/XGUI/CMakeLists.txt
src/XGUI/XGUI_ModuleConnector.cpp [new file with mode: 0644]
src/XGUI/XGUI_ModuleConnector.h [new file with mode: 0644]
src/XGUI/XGUI_ObjectsBrowser.cpp
src/XGUI/XGUI_ObjectsBrowser.h
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index bef4cdee832db553cbc8fc76202f5bfcf6f52b3b..4f70d821c7df0d7b6820462f9f0bcc72fad7611a 100644 (file)
@@ -10,6 +10,7 @@ INCLUDE(FindBoost)
 INCLUDE(FindPython)
 INCLUDE(FindSalome)
 INCLUDE(FindSolveSpace)
+INCLUDE(FindCAS)
 
 IF(UNIX)
     IF(CMAKE_COMPILER_IS_GNUCC)
index 2e954c8a844614d3ec2cf3c5b288c6a9a874876e..ebb5efb695ee3c638bf152f765af59f9ee65c266 100644 (file)
@@ -4,7 +4,7 @@ INCLUDE(XMLProcessing)
 INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Events) 
 
 SET(PROJECT_HEADERS
-  Config.h
+  Config_def.h
   Config_FeatureMessage.h
   Config_XMLReader.h
   Config_ModuleReader.h
diff --git a/src/Config/Config.h b/src/Config/Config.h
deleted file mode 100644 (file)
index 587ac53..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef CONFIG_H
-#define CONFIG_H
-
-#if defined CONFIG_EXPORTS
-#if defined WIN32
-#define CONFIG_EXPORT              __declspec( dllexport )
-#else
-#define CONFIG_EXPORT
-#endif
-#else
-#if defined WIN32
-#define CONFIG_EXPORT              __declspec( dllimport )
-#else
-#define CONFIG_EXPORT
-#endif
-#endif
-
-#endif //CONFIG_H
index 40051dc2ac209f5d0389d4fe5f712cc5eb8017de..2a579b91e126403d14d7f74cc698988be479a285 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef Config_Common_H_
 #define Config_Common_H_
 
-#include "Config.h"
+#include "Config_def.h"
 
 #include <string>
 #include <stdarg.h>
index 9328e0690775df4e1fb7bdc44ba625477bb3a846..2613c992636fef61ddaeade5dafdb19730a76638 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef CONFIG_MESSAGE_H\r
 #define CONFIG_MESSAGE_H\r
 \r
-#include <Config.h>\r
+#include <Config_def.h>\r
 #include <Events_Message.h>\r
 \r
 #include <string>\r
index 1add8438d464da227b792435783df3907af2ce2c..468cb9911165f8c09faa902d6d0b55c23f317b53 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef CONFIG_FEATUREREADER_H_
 #define CONFIG_FEATUREREADER_H_
 
-#include <Config.h>
+#include <Config_def.h>
 #include <Config_XMLReader.h>
 
 #include <string>
index a4afba3c242dd20be7eeb39a99f3b7325253f79f..3bd5d39f3f75c8289f5566e5fc44ec8bfc1e553f 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef CONFIG_MODULEREADER_H_
 #define CONFIG_MODULEREADER_H_
 
-#include <Config.h>
+#include <Config_def.h>
 #include <Config_XMLReader.h>
 
 #include <map>
index f108d3edeaa50bc7ad81f1071026fd6f5825484f..0e3c726caa094e05e0392032a357952e35b2fafb 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef PARTSET_MESSAGE_H_
 #define PARTSET_MESSAGE_H_
 
-#include <Config.h>
+#include <Config_def.h>
 #include <Events_Message.h>
 
 /*
index 9a77d778ac0825da41131e6ffc65a2ef0ea3c88c..2fdad673519fcd7f1be6fc49cdbadad3062ffb67 100644 (file)
@@ -61,7 +61,7 @@ bool Config_WidgetAPI::toParentWidget()
   return myCurrentNode != NULL;
 }
 
-std::string Config_WidgetAPI::widgetType()
+std::string Config_WidgetAPI::widgetType() const
 {
   std::string result = "";
   if(myCurrentNode) {
@@ -70,19 +70,19 @@ std::string Config_WidgetAPI::widgetType()
   return result;
 }
 
-bool Config_WidgetAPI::isContainerWidget()
+bool Config_WidgetAPI::isContainerWidget() const
 {
   return isNode(myCurrentNode, WDG_GROUP, WDG_CHECK_GROUP,
                                NULL);
 }
 
-bool Config_WidgetAPI::isPagedWidget()
+bool Config_WidgetAPI::isPagedWidget() const
 {
   return isNode(myCurrentNode, WDG_TOOLBOX, WDG_SWITCH,
                                NULL);
 }
 
-std::string Config_WidgetAPI::getProperty(const char* thePropName)
+std::string Config_WidgetAPI::getProperty(const char* thePropName) const
 {
   std::string result = "";
   char* aPropChars = (char*) xmlGetProp(myCurrentNode, BAD_CAST thePropName);
@@ -92,22 +92,22 @@ std::string Config_WidgetAPI::getProperty(const char* thePropName)
   return result;
 }
 
-std::string Config_WidgetAPI::widgetId()
+std::string Config_WidgetAPI::widgetId() const
 {
   return getProperty("id");
 }
 
-std::string Config_WidgetAPI::widgetTooltip()
+std::string Config_WidgetAPI::widgetTooltip() const
 {
   return getProperty("tooltip");
 }
 
-std::string Config_WidgetAPI::widgetIcon()
+std::string Config_WidgetAPI::widgetIcon() const
 {
   return getProperty("icon");
 }
 
-std::string Config_WidgetAPI::widgetLabel()
+std::string Config_WidgetAPI::widgetLabel() const
 {
   return getProperty("label");
 }
index 4030ff257a204b12e70af6d7c14cdbd6f4677f10..190ccfc7fafd450dcd7ea1ea931414cf43b35455 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef CONFIG_WIDGETAPI_H_
 #define CONFIG_WIDGETAPI_H_
 
-#include <Config.h>
+#include <Config_def.h>
 
 #include <cstdarg>
 #include <string>
@@ -36,16 +36,16 @@ public:
   bool toChildWidget();
   bool toParentWidget();
 
-  std::string widgetType();
-  bool isContainerWidget();
-  bool isPagedWidget();
+  std::string widgetType() const;
+  bool isContainerWidget() const;
+  bool isPagedWidget() const;
 
-  std::string widgetId();
-  std::string widgetIcon();
-  std::string widgetLabel();
-  std::string widgetTooltip();
+  std::string widgetId() const;
+  std::string widgetIcon() const;
+  std::string widgetLabel() const;
+  std::string widgetTooltip() const;
 
-  std::string getProperty(const char* thePropName);
+  std::string getProperty(const char* thePropName) const;
 
 private:
   xmlDocPtr myDoc;
index cfc1519a56b62fcc46eafeaeb39e489d3fba599d..96f35ac19a062a46a70075bab2150b115c9a2b1f 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef CONFIG_WIDGETREADER_H_
 #define CONFIG_WIDGETREADER_H_
 
-#include <Config.h>
+#include <Config_def.h>
 #include <Config_XMLReader.h>
 
 #include <map>
index bcd8ddfdf4bfe5d27bdd6305060a40298cb714eb..8915147e9eb5c8b88a550d642e38ec2d6728bd65 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef CONFIG_XMLREADER_H_
 #define CONFIG_XMLREADER_H_
 
-#include <Config.h>
+#include <Config_def.h>
 
 #include <cstdarg>
 #include <string>
diff --git a/src/Config/Config_def.h b/src/Config/Config_def.h
new file mode 100644 (file)
index 0000000..587ac53
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#if defined CONFIG_EXPORTS
+#if defined WIN32
+#define CONFIG_EXPORT              __declspec( dllexport )
+#else
+#define CONFIG_EXPORT
+#endif
+#else
+#if defined WIN32
+#define CONFIG_EXPORT              __declspec( dllimport )
+#else
+#define CONFIG_EXPORT
+#endif
+#endif
+
+#endif //CONFIG_H
index ad741d302d83c67fe65adae20fc93ff949e96e45..2a2f3ed40e5ffe4ac1b7ef99880054a9a1a4e1a2 100644 (file)
@@ -1,5 +1,4 @@
 FIND_PACKAGE(SWIG REQUIRED)
-INCLUDE(FindCAS)
 
 INCLUDE(${SWIG_USE_FILE})
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
index 509c7fd9e0bc5ab7b01c1f3dc608e14e237709ab..0ce88abde56cafb05b0f2e84ffe02c92de594c52 100644 (file)
@@ -1,5 +1,4 @@
 FIND_PACKAGE(SWIG REQUIRED)
-INCLUDE(FindCAS)
 
 INCLUDE(${SWIG_USE_FILE})
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
index b69c280d060d7ae678882a7c9307b80589227e8b..a1e450c6ecdf9034de10fcc4910fb24cfebf88ae 100644 (file)
@@ -1,5 +1,4 @@
 INCLUDE(Common)
-INCLUDE(FindCAS)
 
 SET(PROJECT_HEADERS
     GeomData.h
index 9da38b914c666e7dcd6563552f3372e5647f91d3..3743fabf332e0f3b27045a8ed0006c519d799412 100644 (file)
@@ -1,5 +1,4 @@
 INCLUDE(Common)
-INCLUDE(FindCAS)
 
 SET(PROJECT_HEADERS
     Model.h
index 82f7214d88e005c820d1fda431e71c81f9b8eb81..6b1f3d6772d125e96c31800c3dbb7633f92d92a4 100644 (file)
@@ -11,6 +11,8 @@ SET(PROJECT_HEADERS
        ModuleBase_WidgetPoint2D.h
        ModuleBase_WidgetSwitch.h
        ModuleBase_MetaWidget.h
+    ModuleBase_SelectorWidget.h
+    ModuleBase_IWorkshop.h
 )
 
 SET(PROJECT_SOURCES
@@ -21,12 +23,15 @@ SET(PROJECT_SOURCES
        ModuleBase_WidgetPoint2D.cpp
        ModuleBase_WidgetSwitch.cpp
        ModuleBase_MetaWidget.cpp
+    ModuleBase_SelectorWidget.cpp
 )
 
 SET(PROJECT_LIBRARIES
     Config
     ModelAPI
     ${QT_LIBRARIES}
+       ${CAS_VIEWER}
+       ${CAS_KERNEL}
 )
 
 SET(PROJECT_AUTOMOC 
@@ -40,14 +45,15 @@ SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESO
 #SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES})
 
 INCLUDE_DIRECTORIES(
-    ${PROJECT_SOURCE_DIR}/src/Config
+    ${CAS_INCLUDE_DIRS}
+    ${CMAKE_SOURCE_DIR}/src/Config
     ${CMAKE_SOURCE_DIR}/src/Events
     ${CMAKE_SOURCE_DIR}/src/Model
     ${CMAKE_SOURCE_DIR}/src/ModelAPI
     ${CMAKE_SOURCE_DIR}/src/GeomDataAPI
 )
 
-ADD_DEFINITIONS(-DMODULEBASE_EXPORTS)
+ADD_DEFINITIONS(-DMODULEBASE_EXPORTS ${CAS_DEFINITIONS})
 ADD_LIBRARY(ModuleBase SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
 TARGET_LINK_LIBRARIES(ModuleBase ${PROJECT_LIBRARIES})
 
diff --git a/src/ModuleBase/ModuleBase_IWorkshop.h b/src/ModuleBase/ModuleBase_IWorkshop.h
new file mode 100644 (file)
index 0000000..d9dcf54
--- /dev/null
@@ -0,0 +1,37 @@
+// File:        ModuleBase_IWorkshop.h
+// Created:     2 June 2014
+// Author:      Vitaly Smetannikov
+
+#ifndef ModuleBase_IWorkshop_H
+#define ModuleBase_IWorkshop_H
+
+#include "ModuleBase.h"
+
+#include <ModelAPI_Feature.h>
+
+#include <AIS_InteractiveContext.hxx>
+
+#include <QObject>
+
+/**
+* Class which provides access to Workshop object serveces
+*/
+class MODULEBASE_EXPORT ModuleBase_IWorkshop: public QObject
+{
+Q_OBJECT
+public:
+  ModuleBase_IWorkshop(QObject* theParent):QObject(theParent) {}
+
+  virtual ~ModuleBase_IWorkshop() {};
+
+  //! Returns AIS_InteractiveContext from current OCCViewer
+  virtual Handle(AIS_InteractiveContext) AISContext() const = 0;
+
+  //! Returns list of currently selected data objects
+  virtual QList<FeaturePtr> selectedFeatures() const = 0; 
+
+signals:
+  void selectionChanged();
+};
+
+#endif
\ No newline at end of file
diff --git a/src/ModuleBase/ModuleBase_SelectorWidget.cpp b/src/ModuleBase/ModuleBase_SelectorWidget.cpp
new file mode 100644 (file)
index 0000000..931c3be
--- /dev/null
@@ -0,0 +1,106 @@
+// File:        ModuleBase_SelectorWidget.h
+// Created:     2 June 2014
+// Author:      Vitaly Smetannikov
+
+
+#include "ModuleBase_SelectorWidget.h"
+#include "ModuleBase_IWorkshop.h"
+
+#include <ModelAPI_Data.h>
+#include <ModelAPI_AttributeReference.h>
+#include <Config_WidgetAPI.h>
+
+#include <QWidget>
+#include <QLayout>
+#include <QLabel>
+#include <QLineEdit>
+#include <QToolButton>
+
+
+ModuleBase_SelectorWidget::ModuleBase_SelectorWidget(QWidget* theParent, 
+                                                     ModuleBase_IWorkshop* theWorkshop, 
+                                                     const Config_WidgetAPI* theData)
+: ModuleBase_ModelWidget(theParent), myWorkshop(theWorkshop)
+{
+  myFeatureAttributeID = theData->widgetId();
+
+  myContainer = new QWidget(theParent);
+  QHBoxLayout* aLayout = new QHBoxLayout(myContainer);
+
+  aLayout->setContentsMargins(0, 0, 0, 0);
+  QString aLabelText = QString::fromStdString(theData->widgetLabel());
+  QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
+  myLabel = new QLabel(aLabelText, myContainer);
+  myLabel->setPixmap(QPixmap(aLabelIcon));
+
+  aLayout->addWidget(myLabel);
+
+  QString aToolTip = QString::fromStdString(theData->widgetTooltip());
+  myTextLine = new QLineEdit(myContainer);
+  myTextLine->setReadOnly(true);
+  myTextLine->setToolTip(aToolTip);
+
+  aLayout->addWidget(myTextLine);
+
+  myActivateBtn = new QToolButton(myContainer);
+  myActivateBtn->setIcon(QIcon(":icons/hand_point.png"));
+  myActivateBtn->setCheckable(true);
+  myActivateBtn->setToolTip(tr("Activate/Deactivate selection"));
+
+  aLayout->addWidget(myActivateBtn);
+
+  connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
+}
+
+//********************************************************************
+ModuleBase_SelectorWidget::~ModuleBase_SelectorWidget()
+{
+}
+
+//********************************************************************
+bool ModuleBase_SelectorWidget::storeValue(FeaturePtr theFeature)
+{
+  DataPtr aData = theFeature->data();
+  boost::shared_ptr<ModelAPI_AttributeReference> aRef = 
+    boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(aData->attribute(myFeatureAttributeID));
+
+  return true;
+}
+
+//********************************************************************
+bool ModuleBase_SelectorWidget::restoreValue(FeaturePtr theFeature)
+{
+  DataPtr aData = theFeature->data();
+  boost::shared_ptr<ModelAPI_AttributeReference> aRef = 
+    boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(aData->attribute(myFeatureAttributeID));
+  
+  return true;
+}
+
+//********************************************************************
+bool ModuleBase_SelectorWidget::canFocusTo(const std::string& theAttributeName)
+{
+  return false;
+}
+
+//********************************************************************
+void ModuleBase_SelectorWidget::focusTo()
+{
+}
+
+//********************************************************************
+QList<QWidget*> ModuleBase_SelectorWidget::getControls() const
+{
+  QList<QWidget*> aControls;
+  aControls.append(myLabel);
+  aControls.append(myTextLine);
+  aControls.append(myActivateBtn);
+  return aControls;
+}
+
+//********************************************************************
+void ModuleBase_SelectorWidget::onSelectionChanged()
+{
+  QList<FeaturePtr> aFeatures = myWorkshop->selectedFeatures();
+  int aCount = aFeatures.size();
+}
\ No newline at end of file
diff --git a/src/ModuleBase/ModuleBase_SelectorWidget.h b/src/ModuleBase/ModuleBase_SelectorWidget.h
new file mode 100644 (file)
index 0000000..cf3468a
--- /dev/null
@@ -0,0 +1,66 @@
+// File:        ModuleBase_SelectorWidget.h
+// Created:     2 June 2014
+// Author:      Vitaly Smetannikov
+
+#ifndef ModuleBase_SelectorWidget_H
+#define ModuleBase_SelectorWidget_H
+
+#include "ModuleBase.h"
+#include "ModuleBase_ModelWidget.h"
+
+#include <ModelAPI_Feature.h>
+
+
+class Config_WidgetAPI;
+class QWidget;
+class QLabel;
+class QLineEdit;
+class QToolButton;
+class ModuleBase_IWorkshop;
+
+class MODULEBASE_EXPORT ModuleBase_SelectorWidget: public ModuleBase_ModelWidget
+{
+  Q_OBJECT
+public:
+  ModuleBase_SelectorWidget(QWidget* theParent, 
+                            ModuleBase_IWorkshop* theWorkshop, 
+                            const Config_WidgetAPI* theData);
+
+  virtual ~ModuleBase_SelectorWidget();
+
+  /// Saves the internal parameters to the given feature
+  /// \param theFeature a model feature to be changed
+  virtual bool storeValue(FeaturePtr theFeature);
+
+  virtual bool restoreValue(FeaturePtr theFeature);
+
+  /// Returns whether the widget can accept focus, or if it corresponds to the given attribute
+  /// \param theAttribute name
+  virtual bool canFocusTo(const std::string& theAttributeName);
+
+  /// Set focus to the current widget if it corresponds to the given attribute
+  virtual void focusTo();
+
+  /// Returns the internal parent wiget control, that can be shown anywhere
+  /// \returns the widget
+  QWidget* getControl() const { return myContainer; }
+
+  /// Returns list of widget controls
+  /// \return a control list
+  virtual QList<QWidget*> getControls() const;
+
+private slots:
+  void onSelectionChanged();
+
+private:
+  std::string myFeatureAttributeID;
+
+  QWidget*     myContainer;
+  QLabel*      myLabel;
+  QLineEdit*   myTextLine;
+  QToolButton* myActivateBtn;
+
+  ModuleBase_IWorkshop* myWorkshop;
+};
+
+#endif
\ No newline at end of file
index 1ef8c83d8bedc66cea3b12e801dd69b0ee4d303c..ecfe258e6646956c15f132d5ddb9f6a5a6b0fdcc 100644 (file)
@@ -12,6 +12,7 @@
 #include <ModuleBase_OperationDescription.h>
 #include <ModuleBase_WidgetPoint2D.h>
 #include <ModuleBase_WidgetSwitch.h>
+#include <ModuleBase_SelectorWidget.h>
 
 #include <Config_Keywords.h>
 #include <Config_WidgetAPI.h>
@@ -25,8 +26,6 @@
 #include <QPixmap>
 #include <QGroupBox>
 #include <QToolBox>
-#include <QLineEdit>
-#include <QToolButton>
 #include <QCheckBox>
 
 #ifdef _DEBUG
@@ -36,8 +35,8 @@
 #include <cfloat>
 #include <climits>
 
-ModuleBase_WidgetFactory::ModuleBase_WidgetFactory(ModuleBase_Operation* theOperation)
- : myOperation(theOperation)
+ModuleBase_WidgetFactory::ModuleBase_WidgetFactory(ModuleBase_Operation* theOperation, ModuleBase_IWorkshop* theWorkshop)
+ : myOperation(theOperation), myWorkshop(theWorkshop)
 {
   QString aXml = myOperation->getDescription()->xmlRepresentation();
   myWidgetApi = new Config_WidgetAPI(aXml.toStdString());
@@ -229,29 +228,12 @@ QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) const
 
 QWidget* ModuleBase_WidgetFactory::selectorControl(QWidget* theParent)
 {
-  QWidget* aRes = new QWidget();
-  QHBoxLayout* aLayout = new QHBoxLayout(aRes);
+  ModuleBase_SelectorWidget* aSelector = new ModuleBase_SelectorWidget(theParent, myWorkshop, myWidgetApi);
+  
+  QObject::connect(aSelector, SIGNAL(valuesChanged()),  myOperation, SLOT(storeCustomValue()));
 
-  aLayout->setContentsMargins(0, 0, 0, 0);
-  QString aLabelText = qs(myWidgetApi->widgetLabel());
-  QString aLabelIcon = qs(myWidgetApi->widgetIcon());
-  QLabel* aLabel = new QLabel(aLabelText, aRes);
-  aLabel->setPixmap(QPixmap(aLabelIcon));
-
-  aLayout->addWidget(aLabel);
-
-  QLineEdit* aTextLine = new QLineEdit(aRes);
-  aTextLine->setReadOnly(true);
-
-  aLayout->addWidget(aTextLine);
-
-  QToolButton* aActivateBtn = new QToolButton(aRes);
-  aActivateBtn->setIcon(QIcon(":icons/hand_point.png"));
-  aActivateBtn->setCheckable(true);
-
-  aLayout->addWidget(aActivateBtn);
-
-  return aRes;
+  myModelWidgets.append(aSelector);
+  return aSelector->getControl();
 }
 
 
index f0303cdae36e66a47d336cb935514118650a8054..5dd799d62c706a0f71748dd60d573bc2a9b23a07 100644 (file)
@@ -8,8 +8,8 @@
 #ifndef ModuleBase_WidgetFactory_H_
 #define ModuleBase_WidgetFactory_H_
 
-#include <ModuleBase.h>
-#include <ModuleBase_ModelWidget.h>
+#include "ModuleBase.h"
+#include "ModuleBase_ModelWidget.h"
 
 #include <QString>
 #include <QList>
@@ -18,11 +18,12 @@ class QObject;
 class QWidget;
 class Config_WidgetAPI;
 class ModuleBase_Operation;
+class ModuleBase_IWorkshop;
 
 class MODULEBASE_EXPORT ModuleBase_WidgetFactory
 {
 public:
-  ModuleBase_WidgetFactory(ModuleBase_Operation*);
+  ModuleBase_WidgetFactory(ModuleBase_Operation* theOperation, ModuleBase_IWorkshop* theWorkshop);
   virtual ~ModuleBase_WidgetFactory();
 
   void createWidget(QWidget* theParent);
@@ -48,6 +49,7 @@ protected:
 private:
   Config_WidgetAPI* myWidgetApi;
   ModuleBase_Operation*   myOperation;
+  ModuleBase_IWorkshop*   myWorkshop;
 
   QList<ModuleBase_ModelWidget*> myModelWidgets;
 };
index 4eee4a29489646d15093f9cb1d10080fd7d9b488..27b7c58f481c9ea961947fc3c0af63b6386d2290 100644 (file)
@@ -1,6 +1,4 @@
 
-INCLUDE(FindCAS)
-
 SET(CMAKE_AUTOMOC ON)
 
 SET(PROJECT_HEADERS
index 9ccf4e46b3b6ab0eb2153da3030e748e95045b95..4dc7d82ae4da753cd83c35dfa7552e50cbe9eb19 100644 (file)
@@ -1,5 +1,4 @@
 INCLUDE(Common)
-INCLUDE(FindCAS)
 
 SET(CMAKE_AUTOMOC ON)
 
index ea9af50b6bfd6138eea9e3575a077cf30d68ead6..c23054513853535c1e67e5273de6241612a07da0 100644 (file)
@@ -1,4 +1,3 @@
-INCLUDE(FindCAS)
 
 SET(CMAKE_AUTOMOC ON)
 
@@ -33,6 +32,7 @@ SET(PROJECT_HEADERS
     XGUI_ViewerPrs.h
     XGUI_PropertyPanel.h
     XGUI_ContextMenuMgr.h
+    XGUI_ModuleConnector.h
 )
 
 SET(PROJECT_AUTOMOC 
@@ -64,6 +64,7 @@ SET(PROJECT_SOURCES
     XGUI_ViewerPrs.cpp
     XGUI_PropertyPanel.cpp
     XGUI_ContextMenuMgr.cpp
+    XGUI_ModuleConnector.cpp
 )
 
 SET(PROJECT_RESOURCES 
diff --git a/src/XGUI/XGUI_ModuleConnector.cpp b/src/XGUI/XGUI_ModuleConnector.cpp
new file mode 100644 (file)
index 0000000..542eca0
--- /dev/null
@@ -0,0 +1,33 @@
+// File:        XGUI_ModuleConnector.cpp
+// Created:     3 June 2014
+// Author:      Vitaly Smetannikov
+
+
+#include "XGUI_ModuleConnector.h"
+#include "XGUI_Workshop.h"
+#include "XGUI_ViewerProxy.h"
+#include "XGUI_SelectionMgr.h"
+
+
+
+XGUI_ModuleConnector::XGUI_ModuleConnector(XGUI_Workshop* theWorkshop) 
+: ModuleBase_IWorkshop(theWorkshop), myWorkshop(theWorkshop)
+{
+  XGUI_SelectionMgr* aSelector = myWorkshop->selector();
+  connect(aSelector, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
+}
+
+XGUI_ModuleConnector::~XGUI_ModuleConnector()
+{
+}
+
+Handle(AIS_InteractiveContext) XGUI_ModuleConnector::AISContext() const
+{
+  return myWorkshop->viewer()->AISContext();
+}
+
+
+QFeatureList XGUI_ModuleConnector::selectedFeatures() const
+{
+  return myWorkshop->selector()->selectedFeatures();
+}
\ No newline at end of file
diff --git a/src/XGUI/XGUI_ModuleConnector.h b/src/XGUI/XGUI_ModuleConnector.h
new file mode 100644 (file)
index 0000000..04d7b3e
--- /dev/null
@@ -0,0 +1,38 @@
+// File:        XGUI_ModuleConnector.h
+// Created:     3 June 2014
+// Author:      Vitaly Smetannikov
+
+#ifndef XGUI_ModuleConnector_H
+#define XGUI_ModuleConnector_H
+
+
+#include "XGUI.h"
+#include "XGUI_Constants.h"
+
+#include <ModuleBase_IWorkshop.h>
+
+class Handle_AIS_InteractiveContext;
+class XGUI_Workshop;
+
+/**
+* Implementation of IWorkshop interface which provides access to Workshop sevices at module level
+*/
+class XGUI_EXPORT XGUI_ModuleConnector: public ModuleBase_IWorkshop
+{
+  Q_OBJECT
+public:
+  XGUI_ModuleConnector(XGUI_Workshop* theWorkshop);
+
+  virtual ~XGUI_ModuleConnector();
+
+  //! Returns AIS_InteractiveContext from current OCCViewer
+  virtual Handle(AIS_InteractiveContext) AISContext() const;
+
+  //! Returns list of currently selected data objects
+  QFeatureList selectedFeatures() const; 
+
+private:
+  XGUI_Workshop* myWorkshop;
+};
+
+#endif
\ No newline at end of file
index 125e1aaf4bc17cd6d52adda9f90296f88e671bb0..818e72210722732ae689684011070b0aa99dd668 100644 (file)
@@ -146,7 +146,7 @@ XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
   aLabelWgt->setFrameShape(myTreeView->frameShape());
   aLabelWgt->setFrameShadow(myTreeView->frameShadow());
 
-  connect(myTreeView, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
+  connect(myTreeView, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
   connect(myTreeView, SIGNAL(activePartChanged(FeaturePtr)), this, SLOT(onActivePartChanged(FeaturePtr)));
   connect(myTreeView, SIGNAL(activePartChanged(FeaturePtr)), this, SIGNAL(activePartChanged(FeaturePtr)));
 
@@ -315,4 +315,11 @@ void XGUI_ObjectsBrowser::onEditItem()
       myActiveDocLbl->setProperty("OldText", myActiveDocLbl->text());
     }
   }
+}
+
+//***************************************************
+void XGUI_ObjectsBrowser::onSelectionChanged()
+{
+  myFeaturesList = myTreeView->selectedFeatures();
+  emit selectionChanged();
 }
\ No newline at end of file
index b8e275ae688e3d6f7478bc832ef244377a4eea38..8e4842df549e707f5bc29bc81f0bef552d023925 100644 (file)
@@ -96,6 +96,8 @@ private slots:
   //! Called on Edit command request
   void onEditItem();
 
+  void onSelectionChanged();
+
 private:
   void closeDocNameEditing(bool toSave);
 
index 980b8c8e0f28243771c285ceab2c4f9e74a423d9..dfe77c6f82b30f1fe13b7c77b18b15ceece383dd 100644 (file)
@@ -20,6 +20,7 @@
 #include "XGUI_ViewerProxy.h"
 #include "XGUI_PropertyPanel.h"
 #include "XGUI_ContextMenuMgr.h"
+#include "XGUI_ModuleConnector.h"
 
 #include <Model_Events.h>
 #include <ModelAPI_PluginManager.h>
@@ -91,6 +92,8 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
           this, SLOT(onContextMenuCommand(const QString&, bool)));
 
   myViewerProxy = new XGUI_ViewerProxy(this);
+  
+  myModuleConnector = new XGUI_ModuleConnector(this);
 
   connect(myOperationMgr, SIGNAL(operationStarted()), SLOT(onOperationStarted()));
   connect(myOperationMgr, SIGNAL(operationResumed()), SLOT(onOperationStarted()));
@@ -289,7 +292,7 @@ void XGUI_Workshop::onOperationStarted()
 
     showPropertyPanel();
 
-    ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aOperation);
+    ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aOperation, myModuleConnector);
     QWidget* aContent = myPropertyPanel->contentWidget();
     qDeleteAll(aContent->children());
     aFactory.createWidget(aContent);
index d7ace358b60068eb67234ed7c51be05957cf4d79..dad0857074b93a92e6e91d51226012ecf5e5e4ea 100644 (file)
@@ -25,6 +25,7 @@ class XGUI_SalomeViewer;
 class XGUI_ViewerProxy;
 class XGUI_PropertyPanel;
 class XGUI_ContextMenuMgr;
+class XGUI_ModuleConnector;
 
 class ModuleBase_Operation;
 
@@ -174,6 +175,7 @@ private:
   XGUI_ErrorDialog* myErrorDlg;
   XGUI_ViewerProxy* myViewerProxy;
   XGUI_ContextMenuMgr* myContextMenuMgr;
+  XGUI_ModuleConnector* myModuleConnector;
 
   QString myCurrentDir;
   static QMap<QString, QString> myIcons;