From: vsv Date: Thu, 20 Sep 2018 14:48:07 +0000 (+0300) Subject: Issue #2632: Process Features in selection checking its shape from result X-Git-Tag: V9_2_0a1~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d570a46bdbeb5b2279f04a4746de7da413f0b0a6;p=modules%2Fshaper.git Issue #2632: Process Features in selection checking its shape from result --- diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index b59050037..7ecc5a955 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -123,6 +123,7 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& 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 = @@ -136,8 +137,18 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& } aSelectAttr->setValue(ObjectPtr(), GeomShapePtr(), true); } - else - aValid = false; // only results with a shape can be filtered + else { + ResultPtr aResult = aFeature->firstResult(); + if (aResult.get()) { + 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); + } + } + aValid = !anOwner.IsNull(); // only results with a shape can be filtered + } } else aValid = false; // only results with a shape can be filtered }