From: vsv Date: Tue, 15 Sep 2015 15:30:25 +0000 (+0300) Subject: Synchronize displayed objects if Viewer was opened after displaying X-Git-Tag: V_1.4.0~64 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=04dcca50b319e65e5141be7f6c329a2e1cf94718;p=modules%2Fshaper.git Synchronize displayed objects if Viewer was opened after displaying --- diff --git a/src/NewGeom/NewGeom_Module.cpp b/src/NewGeom/NewGeom_Module.cpp index 0d2cdaa76..75f33a64f 100644 --- a/src/NewGeom/NewGeom_Module.cpp +++ b/src/NewGeom/NewGeom_Module.cpp @@ -275,6 +275,7 @@ void NewGeom_Module::onViewManagerAdded(SUIT_ViewManager* theMgr) if (!mySelector) { mySelector = createSelector(theMgr); myWorkshop->module()->activateSelectionFilters(); + myWorkshop->synchronizeViewer(); } } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 936057419..5d0e12c5d 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1682,3 +1682,29 @@ QList XGUI_Workshop::processHistoryList(const std::list } 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(); +} diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 91980355a..03195947a 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -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();