0027867: Visualization - AIS_InteractiveContext::HasSelectedShape() returns true...
authorSergey Solomin <sergey.solomin@cadexchanger.com>
Tue, 13 Sep 2016 08:07:03 +0000 (11:07 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 15 Sep 2016 09:16:18 +0000 (12:16 +0300)
src/AIS/AIS_InteractiveContext_1.cxx

index 56d77b7..7eeeff4 100644 (file)
@@ -1200,9 +1200,13 @@ Standard_Boolean AIS_InteractiveContext::HasSelectedShape() const
   {
     return myLocalContexts(myCurLocalIndex)->HasSelectedShape();
   }
+  if (!mySelection->More())
+    return Standard_False;
+
+  const Handle(StdSelect_BRepOwner) anOwner =
+    Handle(StdSelect_BRepOwner)::DownCast (mySelection->Value());
 
-  Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (SelectedInteractive());
-  return !aShape.IsNull();
+  return !anOwner.IsNull() && anOwner->HasShape();
 }
 
 //=======================================================================