]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Synchronize displayed objects if Viewer was opened after displaying
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 15 Sep 2015 15:30:25 +0000 (18:30 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 15 Sep 2015 15:30:39 +0000 (18:30 +0300)
src/NewGeom/NewGeom_Module.cpp
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index 0d2cdaa764c5cb64e38298ecdf914764fce5b128..75f33a64f9a32f8bb840b259b24d1f4e52427f3b 100644 (file)
@@ -275,6 +275,7 @@ void NewGeom_Module::onViewManagerAdded(SUIT_ViewManager* theMgr)
   if (!mySelector) {
     mySelector = createSelector(theMgr);
     myWorkshop->module()->activateSelectionFilters();
+    myWorkshop->synchronizeViewer();
   }
 }
 
index 936057419477d53d93380268c68138d9c2b00b1c..5d0e12c5dac6f0f5886beea0559814cfeee1810d 100644 (file)
@@ -1682,3 +1682,29 @@ QList<ActionInfo> XGUI_Workshop::processHistoryList(const std::list<std::string>
   }
   return aResult;
 }
+
+void XGUI_Workshop::synchronizeViewer()
+{
+  SessionPtr aMgr = ModelAPI_Session::get();
+  DocumentPtr aDoc = aMgr->activeDocument();
+
+  synchronizeGroupInViewer(aDoc, ModelAPI_ResultConstruction::group(), false);
+  synchronizeGroupInViewer(aDoc, ModelAPI_ResultBody::group(), false);
+  synchronizeGroupInViewer(aDoc, ModelAPI_ResultPart::group(), false);
+  synchronizeGroupInViewer(aDoc, ModelAPI_ResultGroup::group(), false);
+}
+
+void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc, 
+                                             const std::string& theGroup, 
+                                             bool theUpdateViewer)
+{
+  ObjectPtr aObj;
+  int aSize = theDoc->size(theGroup);
+  for (int i = 0; i < aSize; i++) {
+    aObj = theDoc->object(theGroup, i);
+    if (aObj->isDisplayed())
+      myDisplayer->display(aObj, false);
+  }
+  if (theUpdateViewer)
+    myDisplayer->updateViewer();
+}
index 91980355aee278045474ec19a734bde33d8bbe5c..03195947a0cf8aa01c56c27791dc49f7954e3b16 100644 (file)
@@ -245,6 +245,15 @@ Q_OBJECT
   /// \param theFeature a feature
   bool isFeatureOfNested(const FeaturePtr& theFeature);
 
+  /// Has to be called in order to display objects with visibility status = true
+  void synchronizeViewer();
+
+  /// Has to be called in order to display objects from a cpecifed group with visibility status = true
+  /// \param theDoc the document for objects synchronisation
+  /// \param theGroup the group name
+  /// \param theUpdateViewer update viewer flag
+  void synchronizeGroupInViewer(const DocumentPtr& theDoc, const std::string& theGroup, bool theUpdateViewer);
+
 signals:
   /// Emitted when selection happens in Salome viewer
   void salomeViewerSelection();