Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / XGUI / XGUI_Displayer.cpp
index 20a6f721e9f38e7285b3440405e7e18a2edf67e5..2613adae6bbc9ab20b77f31e8b3f5e49b7bb6e75 100644 (file)
@@ -141,6 +141,26 @@ void XGUI_Displayer::RedisplayInLocalContext(boost::shared_ptr<ModelAPI_Feature>
     aContext->UpdateCurrentViewer();
 }
 
+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);
+  }
+  myFeature2AISObjectMap.clear();
+  if (isUpdateViewer)
+    ic->UpdateCurrentViewer();
+}
+
 void XGUI_Displayer::CloseLocalContexts(const bool isUpdateViewer)
 {
   closeAllContexts(true);
@@ -156,6 +176,13 @@ void XGUI_Displayer::closeAllContexts(const bool isUpdateViewer)
   }
 }
 
+void XGUI_Displayer::UpdateViewer()
+{
+  Handle(AIS_InteractiveContext) ic = AISContext();
+  if (!ic.IsNull())
+    ic->UpdateCurrentViewer();
+}
+
 Handle(AIS_InteractiveContext) XGUI_Displayer::AISContext() const 
 { 
   return myWorkshop->viewer()->AISContext();