From: nds Date: Sun, 10 Dec 2017 11:53:03 +0000 (+0300) Subject: Correct compilation on Linux X-Git-Tag: V_2.10.0RC~65 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e5384c6aeaf39cd6994d158c4609c331863b8775;p=modules%2Fshaper.git Correct compilation on Linux --- diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index e433ff4bb..2e7c4e770 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -2532,6 +2532,46 @@ void XGUI_Workshop::setStatusBarMessage(const QString& theMessage) #endif } +#ifdef HAVE_SALOME +//****************************************************** +void XGUI_Workshop::synchronizeViewer() +{ + SessionPtr aMgr = ModelAPI_Session::get(); + QList aDocs; + aDocs.append(aMgr->activeDocument()); + aDocs.append(aMgr->moduleDocument()); + + foreach(DocumentPtr aDoc, aDocs) { + 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()) { + // Hide the presentation with an empty shape. But isDisplayed state of the object should not + // be changed to the object becomes visible when the shape becomes not empty + ResultPtr aRes = std::dynamic_pointer_cast(aObj); + if (aRes.get() && (!aRes->shape().get() || aRes->shape()->isNull())) + continue; + myDisplayer->display(aObj, false); + } + } + if (theUpdateViewer) + myDisplayer->updateViewer(); +} +#endif + //****************************************************** void XGUI_Workshop::highlightResults(const QObjectPtrList& theObjects) { diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 5f1ddd499..8267dff5a 100755 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -264,6 +264,20 @@ Q_OBJECT /// \param theMessage a message void setStatusBarMessage(const QString& theMessage); +#ifdef HAVE_SALOME + /// 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 specifed 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); + +#endif /// Update the property panel content by the XML description of the operation and set the panel /// into the operation /// \param theOperation an operation