]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #260: Avoid changes of display mode on Show Only command
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 4 Dec 2014 07:53:18 +0000 (10:53 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 4 Dec 2014 07:53:18 +0000 (10:53 +0300)
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_Workshop.cpp

index 6cd90a2fdb235af03ce64c9a50584460358c1bbc..a658757613ed409d28f0d06ea77caa0f62167434 100644 (file)
@@ -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();
+}
index b18eb0f8dc33baafa655ef85c202fbb606389d7d..d4167f5bacc0d1b0625f06be5b39ed978564c76c 100644 (file)
@@ -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:
index 820acdb563f6eacdc396aaef7c831418537dee66..d127172fc9dfbe37ae0061a413fa235395c15261 100644 (file)
@@ -1239,13 +1239,10 @@ void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible)
 {
   foreach (ObjectPtr aObj, theList)
   {
-    ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(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);
 }