From: jfa Date: Thu, 21 Jan 2021 08:57:05 +0000 (+0300) Subject: Update SHAPERSTUDY objects in the viewers after SHAPER objects modification X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=988c4e476b2c0d6f7add6654da53c1c00196a65f;p=modules%2Fshaper.git Update SHAPERSTUDY objects in the viewers after SHAPER objects modification --- diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index 5e981a042..99fd7b3b8 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -493,47 +493,6 @@ 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); } @@ -1321,6 +1280,12 @@ void SHAPERGUI::resetToolbars() void SHAPERGUI::publishToStudy() { - if (isActiveModule() && ModelAPI_Session::get()->hasModuleDocument()) + if (isActiveModule() && ModelAPI_Session::get()->hasModuleDocument()) { myWorkshop->module()->launchOperation("PublishToStudy", false); + + // update SHAPERSTUDY objects in OCC and VTK viewers + QStringList aVMList; + aVMList << "OCCViewer" << "VTKViewer"; + getApp()->updatePresentations("SHAPERSTUDY", aVMList); + } }