]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2632: Process Features in selection checking its shape from result
authorvsv <vsv@opencascade.com>
Thu, 20 Sep 2018 14:48:07 +0000 (17:48 +0300)
committervsv <vsv@opencascade.com>
Thu, 20 Sep 2018 14:48:07 +0000 (17:48 +0300)
src/ModuleBase/ModuleBase_WidgetValidated.cpp

index b59050037e12cd38b8344f16cf1b79bc70aea87d..7ecc5a9552ffc43f2dfaff2c3922a26c2a08b44e 100644 (file)
@@ -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<TopoDS_Shape>();
+              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
     }