From 38a0f530db0cd0f3f1d73eb9a6d953849a275c68 Mon Sep 17 00:00:00 2001 From: jfa Date: Tue, 12 Jan 2021 13:11:34 +0300 Subject: [PATCH] Provide presentations update after SHAPER objects modification --- src/SHAPERGUI/SHAPERGUI.cpp | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index f92d89f69..5e981a042 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -43,6 +43,8 @@ #include #include +#include +#include #include #include #include @@ -491,6 +493,47 @@ bool SHAPERGUI::deactivateModule(SUIT_Study* theStudy) publishToStudy(); + // update SHAPERSTUDY objects in OCC and VTK viewers + QString aShaperStudyComp = "SHAPERSTUDY"; + LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(aShaperStudyComp, false); + if ( aDisplayer ) { + LightApp_Study* aStudy = dynamic_cast(theStudy); + DataObjectList aComps; + bool isFound = false; + aStudy->root()->children( aComps ); + DataObjectList::const_iterator aCompsIt = aComps.begin(); + for ( ; aCompsIt != aComps.end() && !isFound; aCompsIt++ ) { + LightApp_DataObject* aComp = dynamic_cast( *aCompsIt ); + if ( aComp && aComp->componentDataType() == aShaperStudyComp ) { + isFound = true; + DataObjectList anObjs; + aComp->children(anObjs, true); + + QList aViewMgrs; + getApp()->viewManagers( "OCCViewer", aViewMgrs ); + getApp()->viewManagers( "VTKViewer", aViewMgrs ); + QListIterator itViewMgrs( aViewMgrs ); + while ( itViewMgrs.hasNext()) { + SUIT_ViewModel* aVM = itViewMgrs.next()->getViewModel(); + if ( aVM ) { + SALOME_View* aView = dynamic_cast(aVM); + if ( aView ) { + DataObjectList::const_iterator itObjs = anObjs.begin(); + for ( ; itObjs != anObjs.end(); itObjs++ ) { + LightApp_DataObject* anObj = dynamic_cast( *itObjs ); + QString anEntry = anObj->entry(); + if ( aDisplayer->IsDisplayed( anEntry, aView ) ) { + aDisplayer->Erase( anEntry, false, false, aView ); + aDisplayer->Display( anEntry, false, aView ); + } + } + } + } + } + } + } + } + return LightApp_Module::deactivateModule(theStudy); } -- 2.39.2