0024023: Revamp the OCCT Handle -- downcast (automatic)
[occt.git] / src / StdSelect / StdSelect_ViewerSelector3d.cxx
index a8881d8..a645173 100644 (file)
@@ -65,8 +65,6 @@
 
 #include <OSD_Timer.hxx>
 
-IMPLEMENT_STANDARD_HANDLE (StdSelect_ViewerSelector3d, SelectMgr_ViewerSelector)
-IMPLEMENT_STANDARD_RTTIEXT(StdSelect_ViewerSelector3d, SelectMgr_ViewerSelector)
 
 static Standard_Integer StdSel_NumberOfFreeEdges (const Handle(Poly_Triangulation)& Trg)
 {
@@ -519,16 +517,15 @@ void StdSelect_ViewerSelector3d::ComputeSensitivePrs (const Handle(SelectMgr_Sel
     //==========================================================
     else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveTriangulation))
     {
-      const Handle(Poly_Triangulation)& PT =
-        (*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->Triangulation();
+      Handle(Poly_Triangulation) PT (Handle(Select3D_SensitiveTriangulation)::DownCast (Ent)->Triangulation());
 
       const Poly_Array1OfTriangle& triangles = PT->Triangles();
       const TColgp_Array1OfPnt& Nodes = PT->Nodes();
       Standard_Integer n[3];
 
       TopLoc_Location iloc, bidloc;
-      if ((*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->HasInitLocation())
-        bidloc = (*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->GetInitLocation();
+      if (Handle(Select3D_SensitiveTriangulation)::DownCast (Ent)->HasInitLocation())
+        bidloc = Handle(Select3D_SensitiveTriangulation)::DownCast (Ent)->GetInitLocation();
 
       if (bidloc.IsIdentity())
         iloc = theLoc;
@@ -668,3 +665,15 @@ void StdSelect_ViewerSelector3d::ResetSelectionActivationStatus()
 {
   resetSelectionActivationStatus();
 }
+
+//=======================================================================
+//function : AllowOverlapDetection
+//purpose  : Sets the detection type: if theIsToAllow is false,
+//           only fully included sensitives will be detected, otherwise
+//           the algorithm will mark both included and overlapped entities
+//           as matched
+//=======================================================================
+void StdSelect_ViewerSelector3d::AllowOverlapDetection (const Standard_Boolean theIsToAllow)
+{
+  mySelectingVolumeMgr.AllowOverlapDetection (theIsToAllow);
+}