From: vsv Date: Wed, 20 Mar 2019 12:22:54 +0000 (+0300) Subject: Issue #2889:Multi-selection of features in Object Browser X-Git-Tag: V9_3_0b2~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fc89212acbb2a0b4bdaaad10708b94b9797d1a1f;p=modules%2Fshaper.git Issue #2889:Multi-selection of features in Object Browser --- diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index 9c00ba201..937464e3c 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -116,7 +116,8 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& myPresentedObject = aResult; } else { - FeaturePtr aFeature = ModelAPI_Feature::feature(thePrs->object()); + //FeaturePtr aFeature = ModelAPI_Feature::feature(thePrs->object()); + FeaturePtr aFeature = std::dynamic_pointer_cast(thePrs->object()); if (aFeature.get()) { // Use feature as a reference to all its results myPresentedObject = aFeature; @@ -148,8 +149,11 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& GeomShapePtr aShapePtr = ModelAPI_Tools::shape(aResult); if (aShapePtr.get()) { const TopoDS_Shape aTDShape = aShapePtr->impl(); - Handle(AIS_InteractiveObject) anIO = myWorkshop->selection()->getIO(thePrs); - anOwner = new StdSelect_BRepOwner(aTDShape, anIO); + AISObjectPtr aIOPtr = myWorkshop->findPresentation(aResult); + if (aIOPtr.get()) { + Handle(AIS_InteractiveObject) anIO = aIOPtr->impl(); + anOwner = new StdSelect_BRepOwner(aTDShape, anIO); + } } } aValid = !anOwner.IsNull(); // only results with a shape can be filtered @@ -439,12 +443,9 @@ QList ModuleBase_WidgetValidated::getFilteredSelected() void ModuleBase_WidgetValidated::filterPresentations(QList& theValues) { QList aValidatedValues; - - QList::const_iterator anIt = theValues.begin(), aLast = theValues.end(); - bool isDone = false; - for (; anIt != aLast; anIt++) { - if (isValidInFilters(*anIt)) - aValidatedValues.append(*anIt); + foreach(ModuleBase_ViewerPrsPtr aPrs, theValues) { + if (isValidInFilters(aPrs)) + aValidatedValues.append(aPrs); } if (aValidatedValues.size() != theValues.size()) { theValues.clear();