From c8a734951c3d64b45f20394e619a920602522f3c Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 20 Jul 2017 15:01:31 +0300 Subject: [PATCH] Issue #2223: EraseAll function has to erase only SALOME interactive objects. --- src/SHAPERGUI/CMakeLists.txt | 1 + src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/SHAPERGUI/CMakeLists.txt b/src/SHAPERGUI/CMakeLists.txt index f56ba704f..63887c6b7 100644 --- a/src/SHAPERGUI/CMakeLists.txt +++ b/src/SHAPERGUI/CMakeLists.txt @@ -72,6 +72,7 @@ SET(PROJECT_LIBRARIES ${OCCViewer} ${qtx} ${CAS_SHAPE} + ${SalomeObject} ) ADD_DEFINITIONS( -DSHAPERGUI_EXPORTS ${CAS_DEFINITIONS} ) diff --git a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp index dc11d995f..37148b5a3 100644 --- a/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp +++ b/src/SHAPERGUI/SHAPERGUI_SalomeViewer.cpp @@ -27,6 +27,7 @@ #include #include +#include #include @@ -374,8 +375,18 @@ void SHAPERGUI_SalomeViewer::fitAll() //********************************************** void SHAPERGUI_SalomeViewer::eraseAll() { - SOCC_Viewer* aViewer = dynamic_cast(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); + } + } } //********************************************** -- 2.39.2