]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update SHAPERSTUDY objects in the viewers after SHAPER objects modification occ/19960
authorjfa <jfa@opencascade.com>
Thu, 21 Jan 2021 08:57:05 +0000 (11:57 +0300)
committerjfa <jfa@opencascade.com>
Thu, 21 Jan 2021 08:57:05 +0000 (11:57 +0300)
src/SHAPERGUI/SHAPERGUI.cpp

index 5e981a042ac59ab7c000be6903c37eae7a2da446..99fd7b3b8a5064c197563501cce5babb3a5661c1 100644 (file)
@@ -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<LightApp_Study*>(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<LightApp_DataObject*>( *aCompsIt );
-      if ( aComp && aComp->componentDataType() == aShaperStudyComp ) {
-        isFound = true;
-        DataObjectList anObjs;
-        aComp->children(anObjs, true);
-
-        QList<SUIT_ViewManager*> aViewMgrs;
-        getApp()->viewManagers( "OCCViewer", aViewMgrs );
-        getApp()->viewManagers( "VTKViewer", aViewMgrs );
-        QListIterator<SUIT_ViewManager*> itViewMgrs( aViewMgrs );
-        while ( itViewMgrs.hasNext()) {
-          SUIT_ViewModel* aVM = itViewMgrs.next()->getViewModel();
-          if ( aVM ) {
-            SALOME_View* aView = dynamic_cast<SALOME_View*>(aVM);
-            if ( aView ) {
-              DataObjectList::const_iterator itObjs = anObjs.begin();
-              for ( ; itObjs != anObjs.end(); itObjs++ ) {
-                LightApp_DataObject* anObj = dynamic_cast<LightApp_DataObject*>( *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);
+  }
 }