Salome HOME
Merge branch 'master' of newgeom:newgeom
authornds <natalia.donis@opencascade.com>
Mon, 2 Jun 2014 08:20:01 +0000 (12:20 +0400)
committernds <natalia.donis@opencascade.com>
Mon, 2 Jun 2014 08:20:01 +0000 (12:20 +0400)
25 files changed:
src/Config/Config_Keywords.h
src/ConstructionPlugin/CMakeLists.txt
src/ConstructionPlugin/ConstructionPlugin_Extrusion.cpp [new file with mode: 0644]
src/ConstructionPlugin/ConstructionPlugin_Extrusion.h [new file with mode: 0644]
src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp
src/ConstructionPlugin/extrusion_widget.xml [new file with mode: 0644]
src/ConstructionPlugin/plugin-Construction.xml
src/Model/CMakeLists.txt
src/Model/Model_AttributeBoolean.cpp [new file with mode: 0644]
src/Model/Model_AttributeBoolean.h [new file with mode: 0644]
src/ModelAPI/CMakeLists.txt
src/ModelAPI/ModelAPI_AttributeBoolean.h [new file with mode: 0644]
src/ModelAPI/ModelAPI_PluginManager.cpp
src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/ModuleBase/ModuleBase_WidgetFactory.h
src/PartSet/PartSet_icons.qrc
src/PartSet/icons/dimension_v.png [new file with mode: 0644]
src/PartSet/icons/hand_point.png [new file with mode: 0644]
src/SketchSolver/SketchSolver_ConstraintGroup.cpp
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h
src/XGUI/XGUI_pictures.qrc
src/XGUI/pictures/eye_pencil.png [new file with mode: 0644]
src/XGUI/pictures/eye_pencil_closed.png [new file with mode: 0644]

index 2056a658bff44d66ffcb4630482371009760d120..125faa57a0879e241a273c5f94d7c27a79adee24 100644 (file)
@@ -18,6 +18,7 @@ const static char* NODE_SOURCE = "source";
 
 //Widgets
 const static char* WDG_DOUBLEVALUE = "doublevalue";
+const static char* WDG_BOOLVALUE = "boolvalue";
 //Widget containers
 const static char* WDG_INFO = "label";
 const static char* WDG_GROUP = "groupbox";
@@ -26,6 +27,7 @@ const static char* WDG_TOOLBOX = "toolbox";
 const static char* WDG_TOOLBOX_BOX = "box";
 const static char* WDG_SWITCH = "switch";
 const static char* WDG_SWITCH_CASE = "case";
+const static char* WDG_SELECTOR = "selector";
 
 //Specific widget containers
 const static char* WDG_POINT_SELECTOR = "point_selector";
index 7fe6d649c3b671b6cb6dacc3581a394fb47920c1..ab34919147ff1251a53a238fd62bec0a005e75ec 100644 (file)
@@ -4,11 +4,13 @@ SET(PROJECT_HEADERS
     ConstructionPlugin.h
     ConstructionPlugin_Plugin.h
     ConstructionPlugin_Point.h
+    ConstructionPlugin_Extrusion.h
 )
 
 SET(PROJECT_SOURCES
     ConstructionPlugin_Plugin.cpp
     ConstructionPlugin_Point.cpp
+    ConstructionPlugin_Extrusion.cpp
 )
 
 ADD_DEFINITIONS(-DCONSTRUCTIONPLUGIN_EXPORTS ${BOOST_DEFINITIONS})
@@ -22,6 +24,7 @@ INCLUDE_DIRECTORIES(
 SET(XML_RESOURCES
   plugin-Construction.xml
   point_widget.xml
+  extrusion_widget.xml
 )
 
 INSTALL(TARGETS ConstructionPlugin DESTINATION plugins)
diff --git a/src/ConstructionPlugin/ConstructionPlugin_Extrusion.cpp b/src/ConstructionPlugin/ConstructionPlugin_Extrusion.cpp
new file mode 100644 (file)
index 0000000..8b5dc2d
--- /dev/null
@@ -0,0 +1,33 @@
+// File:        ConstructionPlugin_Extrusion.cpp
+// Created:     30 May 2014
+// Author:      Vitaly SMETANNIKOV
+
+#include "ConstructionPlugin_Extrusion.h"
+#include <ModelAPI_PluginManager.h>
+#include <ModelAPI_Document.h>
+#include <ModelAPI_Data.h>
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_AttributeBoolean.h>
+
+using namespace std;
+
+ConstructionPlugin_Extrusion::ConstructionPlugin_Extrusion()
+{
+}
+
+void ConstructionPlugin_Extrusion::initAttributes()
+{
+  data()->addAttribute(EXTRUSION_FACE, ModelAPI_AttributeReference::type());
+  data()->addAttribute(EXTRUSION_SIZE, ModelAPI_AttributeDouble::type());
+  data()->addAttribute(EXTRUSION_REVERCE, ModelAPI_AttributeBoolean::type());
+}
+
+// this is for debug only
+#include <iostream>
+void ConstructionPlugin_Extrusion::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_Extrusion.h b/src/ConstructionPlugin/ConstructionPlugin_Extrusion.h
new file mode 100644 (file)
index 0000000..6d557a3
--- /dev/null
@@ -0,0 +1,42 @@
+// File:        ConstructionPlugin_Extrusion.h
+// Created:     30 May 2014
+// Author:      Vitaly SMETANNIKOV
+
+#ifndef ConstructionPlugin_Extrusion_HeaderFile
+#define ConstructionPlugin_Extrusion_HeaderFile
+
+#include "ConstructionPlugin.h"
+#include <ModelAPI_Feature.h>
+
+/// attribute name of referenced face
+const std::string EXTRUSION_FACE = "extrusion_select_face";
+
+/// attribute name of extrusion size
+const std::string EXTRUSION_SIZE = "extrusion_size";
+
+/// attribute name of reverce direction
+const std::string EXTRUSION_REVERCE = "extrusion_reverse";
+
+
+class ConstructionPlugin_Extrusion: public ModelAPI_Feature
+{
+public:
+  /// Returns the kind of a feature
+  CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() 
+  { static std::string MY_KIND = "Extrusion"; 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_Extrusion();
+};
+
+#endif
index 5c1f39f2f8de2dfc5bc87f1df52371d2fbb9dff3..a825c5608e0a96cc95a2a453623bc65088706c6e 100644 (file)
@@ -1,5 +1,7 @@
 #include "ConstructionPlugin_Plugin.h"
 #include "ConstructionPlugin_Point.h"
+#include "ConstructionPlugin_Extrusion.h"
+
 #include <ModelAPI_PluginManager.h>
 #include <ModelAPI_Document.h>
 
@@ -18,6 +20,8 @@ boost::shared_ptr<ModelAPI_Feature> ConstructionPlugin_Plugin::createFeature(str
 {
   if (theFeatureID == "Point") {
     return boost::shared_ptr<ModelAPI_Feature>(new ConstructionPlugin_Point);
+  } else if (theFeatureID == "Extrusion") {
+    return boost::shared_ptr<ModelAPI_Feature>(new ConstructionPlugin_Extrusion);
   }
   // feature of such kind is not found
   return boost::shared_ptr<ModelAPI_Feature>();
diff --git a/src/ConstructionPlugin/extrusion_widget.xml b/src/ConstructionPlugin/extrusion_widget.xml
new file mode 100644 (file)
index 0000000..52cf862
--- /dev/null
@@ -0,0 +1,9 @@
+<source>
+  <selector id="extrusion_select_face" 
+    label="Select a face" 
+    icon=":icons/sketch.png" 
+    tooltip="Select a face for extrusion"
+  />
+  <doublevalue id="extrusion_size" label="Size" min="0" step="1.0" default="10" icon=":icons/dimension_v.png" tooltip="Set size of extrusion"/>
+  <boolvalue id="extrusion_reverse" label="Reverse" default="false" tooltip="Reverse default direction"/>
+</source>
index 8e86996877b49bbee33942038b5b299bee4152fb..4736d36cfa54344fbd11db2b318b8c8306917f41 100644 (file)
@@ -6,6 +6,9 @@
       </feature>
       <feature id="Axis" title="Axis" tooltip="Create a new axis" icon=":icons/axis.png" keysequence="" internal="true"/>
       <feature id="Plane" title="Plane" tooltip="Create a new plane" icon=":icons/plane.png" keysequence="" internal="true"/>
+      <feature id="Extrusion" title="Extrusion" tooltip="Create a shape by extrusion of a contour" icon=":icons/extrusion.png">
+          <source path="extrusion_widget.xml"/>
+      </feature>
     </group>
-  </workbench>  
+</workbench>  
 </plugin>
index 5db73c34774b755d8dbb34729b1ae8a32b41fe31..9da38b914c666e7dcd6563552f3372e5647f91d3 100644 (file)
@@ -13,6 +13,7 @@ SET(PROJECT_HEADERS
     Model_AttributeReference.h
     Model_AttributeRefAttr.h
     Model_AttributeRefList.h
+    Model_AttributeBoolean.h
     Model_Events.h
 )
 
@@ -27,6 +28,7 @@ SET(PROJECT_SOURCES
     Model_AttributeReference.cpp
     Model_AttributeRefAttr.cpp
     Model_AttributeRefList.cpp
+    Model_AttributeBoolean.cpp
     Model_Events.cpp
 )
 SET(PROJECT_LIBRARIES
diff --git a/src/Model/Model_AttributeBoolean.cpp b/src/Model/Model_AttributeBoolean.cpp
new file mode 100644 (file)
index 0000000..d3c0d6b
--- /dev/null
@@ -0,0 +1,33 @@
+// File:        Model_AttributeBoolean.cpp
+// Created:     2 june 2014
+// Author:      Vitaly Smetannikov
+
+#include "Model_AttributeBoolean.h"
+#include "Model_Events.h"
+#include <Events_Loop.h>
+
+using namespace std;
+
+void Model_AttributeBoolean::setValue(bool theValue)
+{
+  if (myBool->Get() != theValue) {
+    myBool->Set(theValue? 1 : 0);
+    static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_UPDATED);
+    Model_FeatureUpdatedMessage aMsg(owner(), anEvent);
+    Events_Loop::loop()->send(aMsg);
+  }
+}
+
+bool Model_AttributeBoolean::value()
+{
+  return (myBool->Get() == 1)? true : false;
+}
+
+Model_AttributeBoolean::Model_AttributeBoolean(TDF_Label& theLabel)
+{
+  // check the attribute could be already presented in this doc (after load document)
+  if (!theLabel.FindAttribute(TDataStd_Integer::GetID(), myBool)) {
+    // create attribute: not initialized by value yet, just zero
+    myBool = TDataStd_Integer::Set(theLabel, 0);
+  }
+}
diff --git a/src/Model/Model_AttributeBoolean.h b/src/Model/Model_AttributeBoolean.h
new file mode 100644 (file)
index 0000000..331fa13
--- /dev/null
@@ -0,0 +1,35 @@
+// File:        Model_AttributeBoolean.h
+// Created:     2 june 2014
+// Author:      Vitaly Smetannikov
+
+#ifndef Model_AttributeBoolean_HeaderFile
+#define Model_AttributeBoolean_HeaderFile
+
+#include "Model.h"
+#include "ModelAPI_AttributeBoolean.h"
+#include <TDataStd_Integer.hxx>
+#include <TDF_Label.hxx>
+
+/**\class Model_AttributeDouble
+ * \ingroup DataModel
+ * \brief Attribute that contains real value with double precision.
+ */
+
+class Model_AttributeBoolean : public ModelAPI_AttributeBoolean
+{
+  Handle_TDataStd_Integer myBool; ///< double is Real attribute
+public:
+  /// Defines the double value
+  MODEL_EXPORT virtual void setValue(bool theValue);
+
+  /// Returns the double value
+  MODEL_EXPORT virtual bool value();
+
+protected:
+  /// Initializes attibutes
+  Model_AttributeBoolean(TDF_Label& theLabel);
+
+  friend class Model_Data;
+};
+
+#endif
index 49757f69fe70022388c2ecab6a6b10fc6b4919ec..981d5567d82e4bda6a5dd79f327fd2762fa21217 100644 (file)
@@ -16,6 +16,7 @@ SET(PROJECT_HEADERS
     ModelAPI_AttributeReference.h
     ModelAPI_AttributeRefAttr.h
     ModelAPI_AttributeRefList.h
+    ModelAPI_AttributeBoolean.h
 )
 
 SET(PROJECT_SOURCES
diff --git a/src/ModelAPI/ModelAPI_AttributeBoolean.h b/src/ModelAPI/ModelAPI_AttributeBoolean.h
new file mode 100644 (file)
index 0000000..038b93f
--- /dev/null
@@ -0,0 +1,38 @@
+// File:        ModelAPI_AttributeBoolean.h
+// Created:     2 june 2014
+// Author:      Vitaly Smetannikov
+
+#ifndef ModelAPI_AttributeBoolean_HeaderFile
+#define ModelAPI_AttributeBoolean_HeaderFile
+
+#include "ModelAPI_Attribute.h"
+
+/**\class ModelAPI_AttributeBoolean
+ * \ingroup DataModel
+ * \brief Attribute that contains boolean value.
+ */
+
+class ModelAPI_AttributeBoolean : public ModelAPI_Attribute
+{
+public:
+  /// Defines the double value
+  MODELAPI_EXPORT virtual void setValue(bool theValue) = 0;
+
+  /// Returns the double value
+  MODELAPI_EXPORT virtual bool value() = 0;
+
+  /// Returns the type of this class of attributes
+  MODELAPI_EXPORT static std::string type() {return "Boolean";}
+
+  /// Returns the type of this class of attributes, not static method
+  MODELAPI_EXPORT virtual std::string attributeType() {return type();}
+
+  /// To virtually destroy the fields of successors
+  MODELAPI_EXPORT virtual ~ModelAPI_AttributeBoolean() {}
+
+protected:
+  /// Objects are created for features automatically
+  MODELAPI_EXPORT ModelAPI_AttributeBoolean() {}
+};
+
+#endif
index eb79b9d03d3a7e0c32e119be73a8b43204bc353c..4cf100d5c12719b0fd6f02d6267e08065190f2b8 100644 (file)
@@ -15,6 +15,7 @@
 #include <ModelAPI_Attribute.h>
 #include <ModelAPI_AttributeDocRef.h>
 #include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeBoolean.h>
 #include <ModelAPI_AttributeReference.h>
 #include <ModelAPI_AttributeRefAttr.h>
 #include <ModelAPI_AttributeRefList.h>
index e5212c7e85f70d8d4f61cf562f204976ca77dfd3..1ef8c83d8bedc66cea3b12e801dd69b0ee4d303c 100644 (file)
@@ -25,6 +25,9 @@
 #include <QPixmap>
 #include <QGroupBox>
 #include <QToolBox>
+#include <QLineEdit>
+#include <QToolButton>
+#include <QCheckBox>
 
 #ifdef _DEBUG
 #include <QDebug>
@@ -104,13 +107,20 @@ QWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::string& theType
   QWidget* result = NULL;
   if (theType == WDG_DOUBLEVALUE) {
     result = doubleSpinBoxControl();
+
   } else if (theType == WDG_INFO) {
     result = labelControl(theParent);
-  }
-  else if (theType == WDG_POINT_SELECTOR) {
+
+  } else if (theType == WDG_SELECTOR) {
+    result = selectorControl(theParent);
+
+  } else if (theType == WDG_BOOLVALUE) {
+    result = booleanControl(theParent);
+
+  } else if (theType == WDG_POINT_SELECTOR) {
     result = pointSelectorControl(theParent);
-  }
-  else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) {
+
+  else if (myWidgetApi->isContainerWidget() || myWidgetApi->isPagedWidget()) {
     result = createContainer(theType, theParent);
   }
 #ifdef _DEBUG
@@ -215,3 +225,44 @@ QString ModuleBase_WidgetFactory::qs(const std::string& theStdString) const
 {
   return QString::fromStdString(theStdString);
 }
+
+
+QWidget* ModuleBase_WidgetFactory::selectorControl(QWidget* theParent)
+{
+  QWidget* aRes = new QWidget();
+  QHBoxLayout* aLayout = new QHBoxLayout(aRes);
+
+  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;
+}
+
+
+QWidget* ModuleBase_WidgetFactory::booleanControl(QWidget* theParent)
+{
+  QString aText = qs(myWidgetApi->widgetLabel());
+  QString aToolTip = qs(myWidgetApi->widgetTooltip());
+  QString aDefault = qs(myWidgetApi->getProperty("default"));
+
+  QCheckBox* aRes = new QCheckBox(aText, theParent);
+  aRes->setToolTip(aToolTip);
+  aRes->setChecked(aDefault == "true");
+  return aRes;
+}
\ No newline at end of file
index bf765824f95dcdbc4a106bd1e4e0ad761f4738f6..f0303cdae36e66a47d336cb935514118650a8054 100644 (file)
@@ -39,6 +39,8 @@ protected:
   QWidget* doubleSpinBoxControl();
   QWidget* pointSelectorControl(QWidget* theParent);
   QWidget* createContainer(const std::string& theType, QWidget* theParent = NULL);
+  QWidget* selectorControl(QWidget* theParent);
+  QWidget* booleanControl(QWidget* theParent);
 
   bool connectWidget(QObject*, const QString&);
   QString qs(const std::string& theStdString) const;
index f3300ede58262776b78a58a529f2ca12b0387d47..89a8e5735c3afc339c6ed105555f5f616c70262d 100644 (file)
@@ -13,5 +13,7 @@
      <file>icons/import.png</file>
      <file>icons/line.png</file>
      <file>icons/sketch.png</file>
+     <file>icons/hand_point.png</file>
+     <file>icons/dimension_v.png</file>
  </qresource>
  </RCC>
diff --git a/src/PartSet/icons/dimension_v.png b/src/PartSet/icons/dimension_v.png
new file mode 100644 (file)
index 0000000..6213de3
Binary files /dev/null and b/src/PartSet/icons/dimension_v.png differ
diff --git a/src/PartSet/icons/hand_point.png b/src/PartSet/icons/hand_point.png
new file mode 100644 (file)
index 0000000..31c4813
Binary files /dev/null and b/src/PartSet/icons/hand_point.png differ
index ce1d5f87ef18ebbf337c59edb3ba412f9a65c67d..7c0bd37845879ea5df3015d550a1645a013eefdb 100644 (file)
@@ -656,10 +656,11 @@ void SketchSolver_ConstraintGroup::splitGroup(std::vector<SketchSolver_Constrain
     }
     else if (anIndexes.size() == 1)
     { // Add entities indexes into the found group
+      aGrEntIter = aGroupsEntities.begin() + anIndexes.front();
       for (int i = 0; i < 4; i++)
         if (aConstrEnt[i] != 0)
           aGrEntIter->insert(aConstrEnt[i]);
-      aGroupsConstr[aGrEntIter - aGroupsEntities.begin()].insert(aConstrIter->h);
+      aGroupsConstr[anIndexes.front()].insert(aConstrIter->h);
       if (aGrEntIter->size() > aGroupsEntities[aMaxNbEntities].size())
         aMaxNbEntities = aGrEntIter - aGroupsEntities.begin();
     }
index 38e74834ba85a9a57f655e02172a0a6e0240d6bb..0abbb09ffe7bb8cbdd84e86c214622fb76dd8094 100644 (file)
@@ -3,6 +3,7 @@
 #include "XGUI_Workshop.h"
 #include "XGUI_ObjectsBrowser.h"
 #include "XGUI_SelectionMgr.h"
+#include "XGUI_Displayer.h"
 
 #include <ModelAPI_Data.h>
 #include <ModelAPI_AttributeDocRef.h>
@@ -15,7 +16,6 @@
 XGUI_ContextMenuMgr::XGUI_ContextMenuMgr(XGUI_Workshop* theParent) :
 QObject(theParent), myWorkshop(theParent)
 {
-
 }
 
 XGUI_ContextMenuMgr::~XGUI_ContextMenuMgr()
@@ -35,6 +35,12 @@ void XGUI_ContextMenuMgr::createActions()
 
   aAction = new QAction(QIcon(":pictures/delete.png"), tr("Delete"), this);
   addAction("DELETE_CMD", aAction);
+
+  aAction = new QAction(QIcon(":pictures/eye_pencil.png"), tr("Show"), this);
+  addAction("SHOW_CMD", aAction);
+
+  aAction = new QAction(QIcon(":pictures/eye_pencil_closed.png"), tr("Hide"), this);
+  addAction("HIDE_CMD", aAction);
 }
 
 void XGUI_ContextMenuMgr::addAction(const QString& theId, QAction* theAction)
@@ -82,7 +88,7 @@ void XGUI_ContextMenuMgr::onContextMenuRequest(QContextMenuEvent* theEvent)
 
 QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
 {
-  QList<QAction*> aActions;
+  QMenu* aMenu = new QMenu();
   XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
   QFeatureList aFeatures = aSelMgr->selectedFeatures();
   if (aFeatures.size() == 1) {
@@ -94,27 +100,33 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
         ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
         DocumentPtr aFeaDoc = aObject->featureRef()->data()->docRef("PartDocument")->value();
         if (aMgr->currentDocument() == aFeaDoc)
-          aActions.append(action("DEACTIVATE_PART_CMD"));
+          aMenu->addAction(action("DEACTIVATE_PART_CMD"));
         else 
-          aActions.append(action("ACTIVATE_PART_CMD"));
+          aMenu->addAction(action("ACTIVATE_PART_CMD"));
       } else {
-        aActions.append(action("EDIT_CMD"));
+        aMenu->addAction(action("EDIT_CMD"));
+
+        XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+        if (aDisplayer->IsVisible(aFeature))
+          aMenu->addAction(action("HIDE_CMD"));
+        else
+          aMenu->addAction(action("SHOW_CMD"));
       }
-      aActions.append(action("DELETE_CMD"));
+      aMenu->addAction(action("DELETE_CMD"));
+      aMenu->addSeparator();
 
     // Process Root object (document)
     } else { // If feature is 0 the it means that selected root object (document)
       if (aMgr->currentDocument() != aMgr->rootDocument()) {
-        aActions.append(action("ACTIVATE_PART_CMD"));
+        aMenu->addAction(action("ACTIVATE_PART_CMD"));
       }
     }
   }
-  aActions.append(myWorkshop->objectBrowser()->actions());
-  if (aActions.size() > 0) {
-    QMenu* aMenu = new QMenu();
-    aMenu->addActions(aActions);
+  aMenu->addActions(myWorkshop->objectBrowser()->actions());
+  if (aMenu->actions().size() > 0) {
     return aMenu;
   }
+  delete aMenu;
   return 0;
 }
 
index f42b21c69a41f8fdcf26aea258a334b97feaafe2..980b8c8e0f28243771c285ceab2c4f9e74a423d9 100644 (file)
@@ -773,6 +773,10 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
     activatePart(FeaturePtr());
   else if (theId == "DELETE_CMD")
     deleteFeatures(aFeatures);
+  else if (theId == "SHOW_CMD")
+    showFeatures(aFeatures, true);
+  else if (theId == "HIDE_CMD")
+    showFeatures(aFeatures, false);
 }
 
 //**************************************************************
@@ -825,3 +829,10 @@ void XGUI_Workshop::deleteFeatures(QFeatureList theList)
     aMgr->rootDocument()->finishOperation();
   }
 }
+
+//**************************************************************
+void XGUI_Workshop::showFeatures(QFeatureList theList, bool isVisible)
+{
+//  foreach (FeaturePtr aFeature, theList) {
+//  }
+}
index 42d893f1d116e3de7486a1d05be0d93545902d40..d7ace358b60068eb67234ed7c51be05957cf4d79 100644 (file)
@@ -102,8 +102,12 @@ public:
   //! If PartPtr is Null pointer then PartSet will be activated
   void activatePart(FeaturePtr theFeature);
 
+  //! Delete features
   void deleteFeatures(QFeatureList theList);
 
+  //! Show the given features in 3d Viewer
+  void showFeatures(QFeatureList theList, bool isVisible);
+
 signals:
   void salomeViewerSelection();
   void errorOccurred(const QString&);
index 8ae03bf231bcb5beb4553a2de7d2d42247f50015..39c671f73b45eaff2982c50349bb3693f3c1fb2f 100644 (file)
@@ -56,5 +56,6 @@
      <file>pictures/activate.png</file>
      <file>pictures/delete.png</file>
      <file>pictures/rename_edit.png</file>
+     <file>pictures/eye_pencil.png</file>
  </qresource>
  </RCC>
diff --git a/src/XGUI/pictures/eye_pencil.png b/src/XGUI/pictures/eye_pencil.png
new file mode 100644 (file)
index 0000000..53562db
Binary files /dev/null and b/src/XGUI/pictures/eye_pencil.png differ
diff --git a/src/XGUI/pictures/eye_pencil_closed.png b/src/XGUI/pictures/eye_pencil_closed.png
new file mode 100644 (file)
index 0000000..72931ef
Binary files /dev/null and b/src/XGUI/pictures/eye_pencil_closed.png differ