- Handle(AIS_InteractiveObject) anAISObj =
- Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
- if (!anAISObj.IsNull()) {
- Handle(AIS_InteractiveObject) anObj =
- Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
- Handle(AIS_Shape) aAISShape = Handle(AIS_Shape)::DownCast(anObj);
- if (!aAISShape.IsNull()) {
- TopoDS_Shape anAISShape = aAISShape->Shape();
- if (!anAISShape.IsNull() && anAISShape.Infinite()) {
- aValid = Standard_False;
+
+ ModuleBase_ViewerPrs aPrs;
+ myWorkshop->selection()->fillPresentation(aPrs, theOwner);
+ ResultPtr aResult = myWorkshop->selection()->getResult(aPrs);
+ // to filter infinite construction results
+ if (aResult.get() && aResult->groupName() == ModelAPI_ResultConstruction::group()) {
+ ResultConstructionPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
+ if (aConstruction.get() && aConstruction->isInfinite()) {
+ Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
+ if (!aBRepOwner.IsNull() && aBRepOwner->HasShape()) {
+ const TopoDS_Shape& aShape = aBRepOwner->Shape();
+ TopAbs_ShapeEnum anOwnerShapeType = aShape.ShapeType();
+
+ TopAbs_ShapeEnum aResultShapeType = TopAbs_SHAPE;
+ GeomShapePtr aResultShape = aResult->shape();
+ if (aResultShape.get()) {
+ TopoDS_Shape aResultTopoShape = aResultShape->impl<TopoDS_Shape>();
+ aResultShapeType = aResultTopoShape.ShapeType();
+ }