From: vsv Date: Mon, 17 Sep 2018 10:17:19 +0000 (+0300) Subject: Issue #2644: On selection of a feature filter it by a shape returned by a selection... X-Git-Tag: V9_2_0a1~30 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9e601d871b51e64f28bca66a8d131bc972978872;p=modules%2Fshaper.git Issue #2644: On selection of a feature filter it by a shape returned by a selection attribute --- 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 }