]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2223: EraseAll function has to erase only SALOME interactive objects.
authorvsv <vsv@opencascade.com>
Thu, 20 Jul 2017 12:01:31 +0000 (15:01 +0300)
committervsv <vsv@opencascade.com>
Thu, 20 Jul 2017 12:01:47 +0000 (15:01 +0300)
src/SHAPERGUI/CMakeLists.txt
src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp

index f56ba704f451962928fc1951928fb5cfd1e59b59..63887c6b73423f1f27a8ad463da74d1a3f084f36 100644 (file)
@@ -72,6 +72,7 @@ SET(PROJECT_LIBRARIES
     ${OCCViewer}
     ${qtx}
     ${CAS_SHAPE}
+    ${SalomeObject}
 )
 
 ADD_DEFINITIONS( -DSHAPERGUI_EXPORTS ${CAS_DEFINITIONS} )
index dc11d995f7482e637d411d1dd29e428735f45030..37148b5a3b9025ec68fcd0aa1d7d04a55c093ddf 100644 (file)
@@ -27,6 +27,7 @@
 #include <SUIT_ViewManager.h>
 
 #include <QtxActionToolMgr.h>
+#include <SALOME_AISShape.hxx>
 
 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
 
@@ -374,8 +375,18 @@ void SHAPERGUI_SalomeViewer::fitAll()
 //**********************************************
 void SHAPERGUI_SalomeViewer::eraseAll()
 {
-  SOCC_Viewer* aViewer = dynamic_cast<SOCC_Viewer*>(myView->viewer());
-  aViewer->EraseAll(0);
+  Handle(AIS_InteractiveContext) aContext = AISContext();
+  AIS_ListOfInteractive aList;
+  aContext->DisplayedObjects(aList);
+  AIS_ListIteratorOfListOfInteractive aLIt;
+  Handle(AIS_InteractiveObject) anAISIO;
+  for (aLIt.Initialize(aList); aLIt.More(); aLIt.Next()) {
+    anAISIO = aLIt.Value();
+    Handle(Standard_Type) aType = anAISIO->DynamicType();
+    if (anAISIO->IsKind(STANDARD_TYPE(SALOME_AISShape))) {
+      aContext->Erase(anAISIO, false);
+    }
+  }
 }
 
 //**********************************************