Salome HOME
Make same planes cannot be used twice in partition tool
[modules/shaper.git] / src / XGUI / XGUI_Displayer.cpp
index 768c0d419a87515950c933273d7c7d2f03cc5456..978d6154936421e9f0332bbd4520b7a4e65fb3b4 100644 (file)
@@ -252,7 +252,7 @@ bool XGUI_Displayer::erase(ObjectPtr theObject, const bool theUpdateViewer)
     Handle(AIS_InteractiveObject) anAIS = anObject->impl<Handle(AIS_InteractiveObject)>();
     if (!anAIS.IsNull()) {
       emit beforeObjectErase(theObject, anObject);
-      aContext->Remove(anAIS);
+      aContext->Remove(anAIS, false/*update viewer*/);
       aErased = true;
     }
   }
@@ -322,7 +322,16 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer)
         arg(!isEqualShapes || isCustomized).arg(isEqualShapes).arg(isCustomized).toStdString().c_str());
     #endif
     if (!isEqualShapes || isCustomized) {
+      /// if shapes are equal and presentation are customized, selection should be restored
+      bool aNeedToRestoreSelection = isEqualShapes && isCustomized;
+      if (aNeedToRestoreSelection)
+        myWorkshop->module()->storeSelection();
+
       aContext->Redisplay(aAISIO, false);
+
+      if (aNeedToRestoreSelection)
+        myWorkshop->module()->restoreSelection();
+
       aRedisplayed = true;
       #ifdef DEBUG_FEATURE_REDISPLAY
         qDebug("  Redisplay happens");
@@ -599,7 +608,7 @@ bool XGUI_Displayer::eraseAll(const bool theUpdateViewer)
       Handle(AIS_InteractiveObject) anIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
       if (!anIO.IsNull()) {
         emit beforeObjectErase(aObj, aAISObj);
-        aContext->Remove(anIO, false);
+        aContext->Remove(anIO, false/*update viewer*/);
         aErased = true;
       }
     }