From 9e601d871b51e64f28bca66a8d131bc972978872 Mon Sep 17 00:00:00 2001 From: vsv Date: Mon, 17 Sep 2018 13:17:19 +0300 Subject: [PATCH] Issue #2644: On selection of a feature filter it by a shape returned by a selection attribute --- src/ModuleBase/ModuleBase_WidgetValidated.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index 76dfc2909..f55678ade 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -120,6 +121,21 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& if (aFeature.get()) { // Use feature as a reference to all its results myPresentedObject = aFeature; + AttributePtr anAttr = attribute(); + std::string aType = anAttr->attributeType(); + // Check that results of Feature is acceptable by filters for selection attribute + if (aType == ModelAPI_AttributeSelection::typeId()) { + AttributeSelectionPtr aSelectAttr = + std::dynamic_pointer_cast(anAttr); + aSelectAttr->setValue(myPresentedObject, GeomShapePtr(), true); + GeomShapePtr aShape = aSelectAttr->value(); + if (aShape.get()) { + const TopoDS_Shape aTDShape = aShape->impl(); + Handle(AIS_InteractiveObject) anIO = myWorkshop->selection()->getIO(thePrs); + anOwner = new StdSelect_BRepOwner(aTDShape, anIO); + } + aSelectAttr->setValue(ObjectPtr(), GeomShapePtr(), true); + } } else aValid = false; // only results with a shape can be filtered } -- 2.39.2