From: nds Date: Thu, 11 May 2017 10:49:34 +0000 (+0300) Subject: Issue #2159 Hide all incomplete behavior X-Git-Tag: V_2.7.1~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=116001f1015b8567ac4426e3a13c8cb8a0b32052;p=modules%2Fshaper.git Issue #2159 Hide all incomplete behavior --- diff --git a/src/ModuleBase/ModuleBase_IViewer.h b/src/ModuleBase/ModuleBase_IViewer.h index 5e9892324..ee46b6be5 100644 --- a/src/ModuleBase/ModuleBase_IViewer.h +++ b/src/ModuleBase/ModuleBase_IViewer.h @@ -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 diff --git a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp index c341e0f1a..70b088848 100644 --- a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp +++ b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp @@ -5,7 +5,7 @@ #include #include - +#include #include #include @@ -351,6 +351,13 @@ void SHAPERGUI_SalomeViewer::fitAll() } } +//********************************************** +void SHAPERGUI_SalomeViewer::eraseAll() +{ + SOCC_Viewer* aViewer = dynamic_cast(myView->viewer()); + aViewer->EraseAll(0); +} + //********************************************** void SHAPERGUI_SalomeViewer::setViewProjection(double theX, double theY, double theZ, double theTwist) diff --git a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h index 7e02278a1..07b6f6b46 100644 --- a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h +++ b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.h @@ -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 diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index c76241a29..89e8d9c8e 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -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(); diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index e31fe57ea..f97b3ce53 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -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 diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index 24b945ddf..8d032e7d5 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -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(); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 77c4bd57f..f332c4aad 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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);