]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2876: Fix synchronization of objects display on module activation
authorvsv <vsv@opencascade.com>
Tue, 5 Mar 2019 08:23:43 +0000 (11:23 +0300)
committervsv <vsv@opencascade.com>
Tue, 5 Mar 2019 08:24:09 +0000 (11:24 +0300)
src/SHAPERGUI/SHAPERGUI.cpp
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index 4b74af5ae33a5ee557e5b178c6c3b6968d73bf93..c0becb578d2438241d77de0d8e7ca0a3c210f6e1 100644 (file)
@@ -204,6 +204,7 @@ void SHAPERGUI::initialize(CAM_Application* theApp)
         aViewPort->installEventFilter(aViewer);
         Handle(V3d_View) aView = aViewPort->getView();
         aViewer->SetScale(aView, aView->Camera()->Scale());
+        onViewManagerAdded(aMgr);
       }
     }
   }
index 2660cb93b4a6cd9f5937269e31258f04cf045ff9..f1d5d4f36d807306b3be36e33e9210da6e10f1e1 100644 (file)
@@ -2700,12 +2700,28 @@ void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc,
       ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
       if (aRes.get() && (!aRes->shape().get() || aRes->shape()->isNull()))
         continue;
-      myDisplayer->display(aObj, false);
+      ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aObj);
+      if (aResBody.get())
+        synchronizeResultTree(aResBody, false);
+      else
+        myDisplayer->display(aObj, false);
     }
   }
   if (theUpdateViewer)
     myDisplayer->updateViewer();
 }
+
+void XGUI_Workshop::synchronizeResultTree(const ResultBodyPtr& theRes, bool theUpdateViewer)
+{
+  if (theRes->numberOfSubs() > 0)
+    for (int i = 0; i < theRes->numberOfSubs(); i++) {
+      ResultBodyPtr aRes = theRes->subResult(i);
+      if (aRes.get())
+        synchronizeResultTree(aRes, theUpdateViewer);
+    }
+  else
+    myDisplayer->display(theRes, theUpdateViewer);
+}
 #endif
 
 //******************************************************
index ea1ecf0944d24fa867bdc128a86c42875cd3abf2..01c75a373b0fd2697bb04a8b573d50d8dba62e77 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Feature.h>
+#include <ModelAPI_ResultBody.h>
 
 #include <ModuleBase_ActionInfo.h>
 #include <ModuleBase_ActionType.h>
@@ -287,6 +288,8 @@ Q_OBJECT
                                 const std::string& theGroup,
                                 bool theUpdateViewer);
 
+  void synchronizeResultTree(const ResultBodyPtr& theRes, bool theUpdateViewer);
+
 #endif
   /// Update the property panel content by the XML description of the operation and set the panel
   /// into the operation