+ 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;
+ // for infinite object, the selection is possible only for shapes of owners, which are coincide
+ // to the shape of corresponded AIS object. In other words, for axis, only edge can be selected
+ // (vertices are not selectable), for planes, only faces can be selected (not edges or vertices)
+ TopoDS_Shape anOwnerShape;
+ Handle(StdSelect_BRepOwner) aBRO = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
+ if( !aBRO.IsNull() ) {
+ anOwnerShape = aBRO->Shape();
+ if (!anOwnerShape.IsNull()) {
+ aValid = anAISShape.ShapeType() == anOwnerShape.ShapeType();
+ }
+ }
+ }
+ }