From: vsv Date: Fri, 5 Sep 2014 14:41:40 +0000 (+0400) Subject: Issue # 112: Show only command defined X-Git-Tag: V_0.4.4~78^2~3^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=20c269662fbdfeb45eaed671c7ab4de5da4d423e;p=modules%2Fshaper.git Issue # 112: Show only command defined --- diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 914cce321..c24669c70 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -46,6 +46,9 @@ void XGUI_ContextMenuMgr::createActions() aAction = new QAction(QIcon(":pictures/eye_pencil.png"), tr("Show"), this); addAction("SHOW_CMD", aAction); + aAction = new QAction(QIcon(":pictures/eye_pencil.png"), tr("Show only"), this); + addAction("SHOW_ONLY_CMD", aAction); + aAction = new QAction(QIcon(":pictures/eye_pencil_closed.png"), tr("Hide"), this); addAction("HIDE_CMD", aAction); } @@ -121,8 +124,10 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const } else { if (aDisplayer->isVisible(aObject)) aMenu->addAction(action("HIDE_CMD")); - else + else { aMenu->addAction(action("SHOW_CMD")); + } + aMenu->addAction(action("SHOW_ONLY_CMD")); } } else { // If feature is 0 the it means that selected root object (document) if (aMgr->currentDocument() != aMgr->rootDocument()) @@ -145,6 +150,7 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const if (hasResult) { aMenu->addAction(action("SHOW_CMD")); aMenu->addAction(action("HIDE_CMD")); + aMenu->addAction(action("SHOW_ONLY_CMD")); } if (hasFeature) aMenu->addAction(action("DELETE_CMD")); diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 26def2f04..840ade671 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -279,25 +279,22 @@ void XGUI_Displayer::setSelected(const QList& theResults, const bool updateViewer(); } -/*void XGUI_Displayer::EraseAll(const bool isUpdateViewer) +void XGUI_Displayer::eraseAll(const bool isUpdateViewer) { - Handle(AIS_InteractiveContext) ic = AISContext(); - - AIS_ListOfInteractive aList; - ic->DisplayedObjects(aList); - AIS_ListIteratorOfListOfInteractive anIter(aList); - for (; anIter.More(); anIter.Next()) { - if ((anIter.Value()->DynamicType() == STANDARD_TYPE(AIS_Trihedron))) - continue; - - // erase an object - Handle(AIS_InteractiveObject) anIO = anIter.Value(); - ic->Erase(anIO, false); + Handle(AIS_InteractiveContext) ic = AISContext(); + + ResultToAISMap::iterator aIt; + for (aIt = myResult2AISObjectMap.begin(); aIt != myResult2AISObjectMap.end(); aIt++) { + // erase an object + boost::shared_ptr aAISObj = (*aIt).second; + Handle(AIS_InteractiveObject) anIO = aAISObj->impl(); + if (!anIO.IsNull()) + ic->Remove(anIO, false); + } + myResult2AISObjectMap.clear(); + if (isUpdateViewer) + updateViewer(); } - myResult2AISObjectMap.clear(); - if (isUpdateViewer) - updateViewer(); - }*/ void XGUI_Displayer::eraseDeletedResults(const bool isUpdateViewer) { diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index 5c54857d0..7d0970659 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -97,7 +97,7 @@ class XGUI_EXPORT XGUI_Displayer /// Erase all presentations /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly - //void EraseAll(const bool isUpdateViewer = true); + void eraseAll(const bool isUpdateViewer = true); /// Erase AIS interactive objects, which has an empty feature in the internal map /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index be21a2825..9d51cd865 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -960,6 +960,8 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) showObjects(aObjects, true); else if (theId == "HIDE_CMD") showObjects(aObjects, false); + else if (theId == "SHOW_ONLY_CMD") + showOnlyObjects(aObjects); } //************************************************************** @@ -1050,6 +1052,14 @@ void XGUI_Workshop::showObjects(const QList& theList, bool isVisible) myDisplayer->updateViewer(); } +//************************************************************** +void XGUI_Workshop::showOnlyObjects(const QList& theList) +{ + myDisplayer->eraseAll(false); + showObjects(theList, true); +} + + //************************************************************** void XGUI_Workshop::updateCommandsOnViewSelection() { diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 458b8a4c4..95644a07f 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -154,6 +154,9 @@ Q_OBJECT //! Show the given features in 3d Viewer void showObjects(const QList& theList, bool isVisible); + //! Show the given features in 3d Viewer + void showOnlyObjects(const QList& theList); + ModuleBase_IModule* module() const { return myModule;