From: vsv Date: Wed, 6 Apr 2016 14:27:35 +0000 (+0300) Subject: Issue #1306: Find Feature by history from result and shape X-Git-Tag: V_2.3.0~287 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=de068c508b401849ac2a3f363ffa43396126c219;p=modules%2Fshaper.git Issue #1306: Find Feature by history from result and shape --- diff --git a/src/XGUI/XGUI_SelectionMgr.cpp b/src/XGUI/XGUI_SelectionMgr.cpp index 11e2e76fc..fd7729f03 100644 --- a/src/XGUI/XGUI_SelectionMgr.cpp +++ b/src/XGUI/XGUI_SelectionMgr.cpp @@ -120,25 +120,26 @@ void XGUI_SelectionMgr::onObjectBrowserSelection() //************************************************************** void XGUI_SelectionMgr::onViewerSelection() { + SessionPtr aMgr = ModelAPI_Session::get(); + DocumentPtr anActiveDocument = aMgr->activeDocument(); QObjectPtrList aFeatures; + ResultPtr aResult; + FeaturePtr aFeature; Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext(); if (!aContext.IsNull()) { QList aPresentations = selection()->getSelected(ModuleBase_ISelection::Viewer); foreach(ModuleBase_ViewerPrs aPrs, aPresentations) { - if (aPrs.object().get()) + if (aPrs.object().get()) { aFeatures.append(aPrs.object()); - } - } - // Add features by selected results - QObjectPtrList aTmpList = aFeatures; - ResultPtr aResult; - FeaturePtr aFeature; - foreach(ObjectPtr aObj, aTmpList) { - aResult = std::dynamic_pointer_cast(aObj); - if (aResult.get()) { - aFeature = ModelAPI_Feature::feature(aResult); - if (aFeature.get() && (!aFeatures.contains(aFeature))) - aFeatures.append(aFeature); + if (aPrs.shape().get()) { + aResult = std::dynamic_pointer_cast(aPrs.object()); + if (aResult.get()) { + aFeature = anActiveDocument->producedByFeature(aResult, aPrs.shape()); + if (aFeature.get() && (!aFeatures.contains(aFeature))) + aFeatures.append(aFeature); + } + } + } } } bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);