From: vsv Date: Thu, 4 Dec 2014 07:53:18 +0000 (+0300) Subject: Issue #260: Avoid changes of display mode on Show Only command X-Git-Tag: V_0.6.0^2~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4f1ef0e7497a84f7de1fa06e642730bf6a104a95;p=modules%2Fshaper.git Issue #260: Avoid changes of display mode on Show Only command --- diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 6cd90a2fd..a65875761 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -609,3 +609,17 @@ void XGUI_Displayer::removeFilters() return; GetFilter()->Clear(); } + +void XGUI_Displayer::showOnly(const QObjectPtrList& theList) +{ + QObjectPtrList aDispList = myResult2AISObjectMap.keys(); + foreach(ObjectPtr aObj, aDispList) { + if (!theList.contains(aObj)) + erase(aObj, false); + } + foreach(ObjectPtr aObj, theList) { + if (!isVisible(aObj)) + display(aObj, false); + } + updateViewer(); +} diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index b18eb0f8d..d4167f5ba 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -144,6 +144,10 @@ class XGUI_EXPORT XGUI_Displayer DisplayMode displayMode(ObjectPtr theObject) const; + /// Displays only objects listed in the list + void showOnly(const QObjectPtrList& theList); + + /// Returns number of displayed objects int objectsCount() const { return myResult2AISObjectMap.size(); } protected: diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 820acdb56..d127172fc 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1239,13 +1239,10 @@ void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible) { foreach (ObjectPtr aObj, theList) { - ResultPtr aRes = std::dynamic_pointer_cast(aObj); - if (aRes) { - if (isVisible) { - myDisplayer->display(aRes, false); - } else { - myDisplayer->erase(aRes, false); - } + if (isVisible) { + myDisplayer->display(aObj, false); + } else { + myDisplayer->erase(aObj, false); } } myDisplayer->updateViewer(); @@ -1254,8 +1251,7 @@ void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible) //************************************************************** void XGUI_Workshop::showOnlyObjects(const QObjectPtrList& theList) { - myDisplayer->eraseAll(false); - showObjects(theList, true); + myDisplayer->showOnly(theList); }