+
+void XGUI_Workshop::setStatusBarMessage(const QString& theMessage)
+{
+#ifdef HAVE_SALOME
+ salomeConnector()->putInfo(theMessage, -1);
+#else
+ myMainWindow->putInfo(theMessage, -1);
+#endif
+}
+
+void XGUI_Workshop::synchronizeViewer()
+{
+ SessionPtr aMgr = ModelAPI_Session::get();
+ QList<DocumentPtr> 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<ModelAPI_Result>(aObj);
+ if (aRes.get() && (!aRes->shape().get() || aRes->shape()->isNull()))
+ continue;
+ myDisplayer->display(aObj, false);
+ }
+ }
+ if (theUpdateViewer)
+ myDisplayer->updateViewer();
+}
+
+void XGUI_Workshop::highlightResults(const QObjectPtrList& theObjects)
+{
+ FeaturePtr aFeature;
+ QObjectPtrList aSelList = theObjects;
+ bool aHasHidden = false;
+ foreach(ObjectPtr aObj, theObjects) {
+ aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ if (aFeature.get()) {
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(aFeature, aResults);
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aIt;
+ for(aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) {
+ aHasHidden |= (*aIt)->isConcealed();
+ aSelList.append(*aIt);
+ }
+ }
+ }
+ if (aSelList.count() > theObjects.count()) {
+ // if something was found
+ bool aBlocked = objectBrowser()->blockSignals(true);
+ objectBrowser()->setObjectsSelected(aSelList);
+ objectBrowser()->blockSignals(aBlocked);
+ }
+ if (aHasHidden)
+ QMessageBox::information(desktop(), tr("Find results"),
+ tr("Results not found"), QMessageBox::Ok);
+}
+
+void XGUI_Workshop::highlightFeature(const QObjectPtrList& theObjects)
+{
+ ResultPtr aResult;
+ QObjectPtrList aSelList = theObjects;
+ FeaturePtr aFeature;
+ foreach(ObjectPtr aObj, theObjects) {
+ aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
+ if (aResult.get()) {
+ aFeature = ModelAPI_Feature::feature(aResult);
+ if (aFeature.get()) {
+ aSelList.append(aFeature);
+ }
+ }
+ }
+ if (aSelList.count() > theObjects.count()) {
+ // if something was found
+ bool aBlocked = objectBrowser()->blockSignals(true);
+ objectBrowser()->setObjectsSelected(aSelList);
+ objectBrowser()->blockSignals(aBlocked);
+ }
+}