]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2159 Hide all incomplete behavior
authornds <nds@opencascade.com>
Thu, 11 May 2017 10:49:34 +0000 (13:49 +0300)
committernds <nds@opencascade.com>
Thu, 11 May 2017 10:49:34 +0000 (13:49 +0300)
src/ModuleBase/ModuleBase_IViewer.h
src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp
src/SHAPERGUI/SHAPERGUI_SalomeViewer.h
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_ViewerProxy.cpp
src/XGUI/XGUI_ViewerProxy.h
src/XGUI/XGUI_Workshop.cpp

index 5e989232480beedb819f6636c9b57c5eae2cdc8f..ee46b6be5397d25899f3cbe4c75d17350037ca80 100644 (file)
@@ -63,6 +63,9 @@ Q_OBJECT
   //! Perfroms the fit all for the active view
   virtual void fitAll() = 0;
 
+  //! Erases all presentations from the viewer
+  virtual void eraseAll() = 0;
+
   //! Sets the view projection
   /// \param theX the X projection value
   /// \param theY the Y projection value
index c341e0f1a2aaac39335d03c021d2e3a34721845e..70b088848df7583eee28cddb76cadf7d5b885263 100644 (file)
@@ -5,7 +5,7 @@
 
 #include <OCCViewer_ViewPort3d.h>
 #include <OCCViewer_ViewFrame.h>
-
+#include <SOCC_ViewModel.h>
 #include <SUIT_ViewManager.h>
 
 #include <QtxActionToolMgr.h>
@@ -351,6 +351,13 @@ void SHAPERGUI_SalomeViewer::fitAll()
   }
 }
 
+//**********************************************
+void SHAPERGUI_SalomeViewer::eraseAll()
+{
+  SOCC_Viewer* aViewer = dynamic_cast<SOCC_Viewer*>(myView->viewer());
+  aViewer->EraseAll(0);
+}
+
 //**********************************************
 void SHAPERGUI_SalomeViewer::setViewProjection(double theX, double theY,
                                                double theZ, double theTwist)
index 7e02278a1c6de72cd6d81ad688ba9bea99bfa532..07b6f6b469e24242edf810d0bb963d13c7de30d8 100644 (file)
@@ -107,6 +107,9 @@ Q_OBJECT
   //! Perfroms the fit all for the active view
   virtual void fitAll();
 
+  //! Erases all presentations from the viewer
+  virtual void eraseAll();
+
   //! Sets the view projection
   /// \param theX the X projection value
   /// \param theY the Y projection value
index c76241a294eca31d2c6d64a82f9f9d9ac9e757ff..89e8d9c8ed2213602f114865fb8c377c707e9ee6 100644 (file)
@@ -387,8 +387,13 @@ void XGUI_ContextMenuMgr::updateViewerMenu()
     } else
       action("SHOW_CMD")->setEnabled(true);
   }
+  //issue #2159 Hide all incomplete behavior
+#ifdef HAVE_SALOME
+    action("HIDEALL_CMD")->setEnabled(true);
+#else
   if (myWorkshop->displayer()->objectsCount() > 0)
     action("HIDEALL_CMD")->setEnabled(true);
+#endif
 
   // Update selection menu
   QIntList aModes = aDisplayer->activeSelectionModes();
index e31fe57ea3240d9d9359fc6032f63f71f683eab6..f97b3ce5360a63dd7408c5bc6fc6f15dbbf77995 100644 (file)
@@ -109,6 +109,14 @@ void XGUI_ViewerProxy::fitAll()
 #endif
 }
 
+void XGUI_ViewerProxy::eraseAll()
+{
+#ifdef HAVE_SALOME
+  myWorkshop->salomeConnector()->viewer()->eraseAll();
+#else
+#endif
+}
+
 void XGUI_ViewerProxy::connectToViewer()
 {
 #ifdef HAVE_SALOME
index 24b945ddf7e8c416bef4b98553c1ea51b21040d0..8d032e7d510421748aa568182b342825343d187e 100644 (file)
@@ -71,6 +71,9 @@ Q_OBJECT
   //! Sets the view fitted all
   virtual void fitAll();
 
+  //! Erases all presentations from the viewer
+  virtual void eraseAll();
+
   /// Connects to a viewer according to current environment
   void connectToViewer();
 
index 77c4bd57f5fe53262f51e94266f7222cfc308378..f332c4aad16f9df7ae45c715d8eaa112bdcb6854 100755 (executable)
@@ -1358,12 +1358,17 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
   else if (theId == "WIREFRAME_CMD")
     setDisplayMode(aObjects, XGUI_Displayer::Wireframe);
   else if (theId == "HIDEALL_CMD") {
+#ifdef HAVE_SALOME
+    //issue #2159 Hide all incomplete behavior
+    viewer()->eraseAll();
+#else
     QObjectPtrList aList = myDisplayer->displayedObjects();
     foreach (ObjectPtr aObj, aList) {
       if (module()->canEraseObject(aObj))
         aObj->setDisplayed(false);
     }
     Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+#endif
     updateCommandStatus();
   } else if (theId == "SELECT_VERTEX_CMD") {
     setViewerSelectionMode(TopAbs_VERTEX);