]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Provide presentations update after SHAPER objects modification
authorjfa <jfa@opencascade.com>
Tue, 12 Jan 2021 10:11:34 +0000 (13:11 +0300)
committerjfa <jfa@opencascade.com>
Tue, 12 Jan 2021 10:11:34 +0000 (13:11 +0300)
src/SHAPERGUI/SHAPERGUI.cpp

index f92d89f69d7bcc8891d76cf276a29844632f8d7d..5e981a042ac59ab7c000be6903c37eae7a2da446 100644 (file)
@@ -43,6 +43,8 @@
 #include <ModelAPI_Tools.h>
 
 #include <LightApp_Application.h>
+#include <LightApp_DataObject.h>
+#include <LightApp_Displayer.h>
 #include <LightApp_SelectionMgr.h>
 #include <LightApp_OCCSelector.h>
 #include <LightApp_Study.h>
@@ -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<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);
 }