0024023: Revamp the OCCT Handle -- downcast (manual)
authorabv <abv@opencascade.com>
Thu, 2 Jul 2015 13:44:46 +0000 (16:44 +0300)
committerabv <abv@opencascade.com>
Sat, 11 Jul 2015 09:08:06 +0000 (12:08 +0300)
Manual corrections of C-style casts of Handle types

12 files changed:
src/AIS/AIS_SymmetricRelation.cxx
src/AIS/AIS_TypeFilter.cxx
src/BRepFill/BRepFill_Sweep.cxx
src/BndLib/BndLib_Add3dCurve.cxx
src/GeomAdaptor/GeomAdaptor_Surface.cxx
src/GeomInt/GeomInt_LineConstructor.cxx
src/IntPatch/IntPatch_ImpPrmIntersection.cxx
src/IntPatch/IntPatch_Intersection.cxx
src/IntPatch/IntPatch_LineConstructor.cxx
src/TPrsStd/TPrsStd_ConstraintTools.cxx
src/TopOpeBRepTool/TopOpeBRepTool_CurveTool.cxx
src/V3d/V3d_Viewer_2.cxx

index b3eff3d..4155f2d 100644 (file)
@@ -237,9 +237,6 @@ void AIS_SymmetricRelation::ComputeSelection(const Handle(SelectMgr_Selection)&
     
     //=======================Pour les arcs======================    
   if(cu1.GetType() == GeomAbs_Circle) { 
-    BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L);
-//    Handle(Geom_Circle) geom_circ1 = (Handle(Geom_Circle)&) BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L);
-//JR/Hp
     Handle(Geom_Curve) aGeomCurve = BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L);
     Handle(Geom_Circle) geom_circ1 = Handle(Geom_Circle)::DownCast (aGeomCurve) ;
 //    Handle(Geom_Circle) geom_circ1 = (const Handle(Geom_Circle)&) BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L);
index 1e4b16e..185bd91 100644 (file)
@@ -25,10 +25,7 @@ Standard_Boolean AIS_TypeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& anObj
   if(Handle(AIS_InteractiveObject)::DownCast(anObj->Selectable()).IsNull()) 
     return Standard_False;
   
-//#ifndef OCCT_DEBUG
-  Handle(SelectMgr_SelectableObject) aSelectableObject = anObj->Selectable() ;
-  return Handle(AIS_InteractiveObject)::DownCast (aSelectableObject)->Type()== myKind;
-//#else
-//  return ((Handle(AIS_InteractiveObject)&)anObj->Selectable())->Type()== myKind;
-//#endif
+  Handle(AIS_InteractiveObject) anObject = 
+    Handle(AIS_InteractiveObject)::DownCast (anObj->Selectable());
+  return ! anObject.IsNull() && anObject->Type()== myKind;
 }
index 8f1674f..5e14d93 100644 (file)
@@ -260,7 +260,7 @@ static Handle(Geom2d_Curve) Couture(const TopoDS_Edge& E,
   while (itcr.More()) {
     Handle(BRep_CurveRepresentation)& cr = itcr.Value();
     if (cr->IsCurveOnSurface(S,l)) {
-      Handle(BRep_GCurve)& GC = Handle(BRep_GCurve)::DownCast (cr);
+      Handle(BRep_GCurve) GC (Handle(BRep_GCurve)::DownCast (cr));
       if (GC->IsCurveOnClosedSurface() && Eisreversed) 
        return  GC->PCurve2();
       else
index c5fb584..a8e92cd 100644 (file)
@@ -137,7 +137,7 @@ void BndLib_Add3dCurve::Add( const Adaptor3d_Curve& C,
         Abs(Bs->LastParameter()  - U2) > Precision::Parametric(Tol)) {
 
        Handle(Geom_Geometry) G = Bs->Copy();
-       Handle(Geom_BSplineCurve)& Bsaux = Handle(Geom_BSplineCurve)::DownCast (G);
+       Handle(Geom_BSplineCurve) Bsaux (Handle(Geom_BSplineCurve)::DownCast (G));
        Standard_Real u1 = U1, u2 = U2;
        //// modified by jgv, 24.10.01 for BUC61031 ////
        if (Bsaux->IsPeriodic())
index d558995..51c42c2 100644 (file)
@@ -913,7 +913,7 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const
     }
        case GeomAbs_Torus:
     {
-      Handle(Geom_ToroidalSurface)& S = Handle(Geom_ToroidalSurface)::DownCast (mySurface);
+      Handle(Geom_ToroidalSurface) S (Handle(Geom_ToroidalSurface)::DownCast (mySurface));
       const Standard_Real R = S->MajorRadius() + S->MinorRadius();
       if(R>Precision::Confusion())
         Res = R3d/(2.*R);
@@ -921,7 +921,7 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const
     }
        case GeomAbs_Sphere:
     {
-      Handle(Geom_SphericalSurface)& S = Handle(Geom_SphericalSurface)::DownCast (mySurface);
+      Handle(Geom_SphericalSurface) S (Handle(Geom_SphericalSurface)::DownCast (mySurface));
       const Standard_Real R = S->Radius();
       if(R>Precision::Confusion())
         Res = R3d/(2.*R);
@@ -929,7 +929,7 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const
     }
        case GeomAbs_Cylinder:
     {
-      Handle(Geom_CylindricalSurface)& S = Handle(Geom_CylindricalSurface)::DownCast (mySurface);
+      Handle(Geom_CylindricalSurface) S (Handle(Geom_CylindricalSurface)::DownCast (mySurface));
       const Standard_Real R = S->Radius();
       if(R>Precision::Confusion())
         Res = R3d/(2.*R);
@@ -941,7 +941,7 @@ Standard_Real GeomAdaptor_Surface::UResolution(const Standard_Real R3d) const
         // Pas vraiment borne => resolution inconnue
         return Precision::Parametric(R3d);
       }
-      Handle(Geom_ConicalSurface)& S = Handle(Geom_ConicalSurface)::DownCast (mySurface);
+      Handle(Geom_ConicalSurface) S (Handle(Geom_ConicalSurface)::DownCast (mySurface));
       Handle(Geom_Curve) C = S->VIso(myVLast);
       const Standard_Real Rayon1 = Handle(Geom_Circle)::DownCast (C)->Radius();
       C = S->VIso(myVFirst);
@@ -999,7 +999,7 @@ Standard_Real GeomAdaptor_Surface::VResolution(const Standard_Real R3d) const
     }
        case GeomAbs_Torus:
     {
-      Handle(Geom_ToroidalSurface)& S = Handle(Geom_ToroidalSurface)::DownCast (mySurface);
+      Handle(Geom_ToroidalSurface) S (Handle(Geom_ToroidalSurface)::DownCast (mySurface));
       const Standard_Real R = S->MinorRadius();
       if(R>Precision::Confusion())
         Res = R3d/(2.*R);
@@ -1007,7 +1007,7 @@ Standard_Real GeomAdaptor_Surface::VResolution(const Standard_Real R3d) const
     }
        case GeomAbs_Sphere:
     {
-      Handle(Geom_SphericalSurface)& S = Handle(Geom_SphericalSurface)::DownCast (mySurface);
+      Handle(Geom_SphericalSurface) S (Handle(Geom_SphericalSurface)::DownCast (mySurface));
       const Standard_Real R = S->Radius();
       if(R>Precision::Confusion())
         Res = R3d/(2.*R);
index f35b14c..46f3ce5 100644 (file)
@@ -145,7 +145,7 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
   const IntPatch_IType typl = L->ArcType();
   if(typl == IntPatch_Analytic)  {
     Standard_Real u1,v1,u2,v2;
-    Handle(IntPatch_ALine)& ALine =  Handle(IntPatch_ALine)::DownCast (L);
+    Handle(IntPatch_ALine) ALine (Handle(IntPatch_ALine)::DownCast (L));
     seqp.Clear();
     nbvtx = GeomInt_LineTool::NbVertex(L);
     for(i=1;i<nbvtx;i++)   {
@@ -171,7 +171,7 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
   } // if(typl == IntPatch_Analytic)  {
   else if(typl == IntPatch_Walking)  {
     Standard_Real u1,v1,u2,v2;
-    Handle(IntPatch_WLine)& WLine =  Handle(IntPatch_WLine)::DownCast (L);
+    Handle(IntPatch_WLine) WLine (Handle(IntPatch_WLine)::DownCast (L));
     seqp.Clear();
     nbvtx = GeomInt_LineTool::NbVertex(L);
     for(i=1;i<nbvtx;i++)    { 
@@ -287,7 +287,7 @@ void GeomInt_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
   else if (typl != IntPatch_Restriction)  {
     seqp.Clear();
     //
-    Handle(IntPatch_GLine)& GLine =  Handle(IntPatch_GLine)::DownCast (L);
+    Handle(IntPatch_GLine) GLine (Handle(IntPatch_GLine)::DownCast (L));
     //
     if(typl == IntPatch_Circle || typl == IntPatch_Ellipse) { 
       TreatCircle(L, Tol);
@@ -726,7 +726,7 @@ void GeomInt_LineConstructor::TreatCircle(const Handle(IntPatch_Line)& aLine,
   IntPatch_IType aType;
   //
   aType=aLine->ArcType();
-  Handle(IntPatch_GLine)& aGLine=Handle(IntPatch_GLine)::DownCast (aLine);
+  Handle(IntPatch_GLine) aGLine (Handle(IntPatch_GLine)::DownCast (aLine));
   //
   bRejected=RejectMicroCircle(aGLine, aType, aTol);
   if (bRejected) {
index 916f6b8..9eb52d6 100644 (file)
@@ -2244,7 +2244,7 @@ static void PutIntVertices(Handle(IntPatch_Line)&    Line,
   if(nbp < 3)
     return;
 
-  Handle(IntPatch_WLine)& WLine = Handle(IntPatch_WLine)::DownCast (Line);
+  Handle(IntPatch_WLine) WLine (Handle(IntPatch_WLine)::DownCast (Line));
   Standard_Integer ip = 0, iv = 0;
   gp_Pnt aPnt;
   IntPatch_Point thePnt;
index a9ceb76..09999d7 100644 (file)
@@ -1900,8 +1900,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer ,
     if(IType == IntPatch_Walking) nbw++;
     else     if(IType == IntPatch_Restriction) { 
       nbr++;
-      Handle(IntPatch_RLine)& rlin =
-        Handle(IntPatch_RLine)::DownCast (line);
+      Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (line));
       if(rlin->IsArcOnS1()) nbr1++;
       if(rlin->IsArcOnS2()) nbr2++;
     }
@@ -1937,8 +1936,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer ,
       nbllc++;
       const Handle(IntPatch_Line)& LineK = LineConstructor.Line(k);
       if (LineK->ArcType() == IntPatch_Analytic) { 
-        Handle(IntPatch_ALine)& alin =
-          Handle(IntPatch_ALine)::DownCast (LineK);
+        Handle(IntPatch_ALine) alin (Handle(IntPatch_ALine)::DownCast (LineK));
         nbvtx=alin->NbVertex();
         nbva+=nbvtx;        nba++;
         for(v=1;v<=nbvtx;v++) { 
@@ -1946,8 +1944,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer ,
         }
       }
       else if (LineK->ArcType() == IntPatch_Restriction) {
-        Handle(IntPatch_RLine)& rlin =
-          Handle(IntPatch_RLine)::DownCast (LineK);
+        Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (LineK));
         nbvtx=rlin->NbVertex();
         nbvr+=nbvtx;        nbr++;
         for(v=1;v<=nbvtx;v++) { 
@@ -1955,8 +1952,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer ,
         }
       }
       else if (LineK->ArcType() == IntPatch_Walking) {
-        Handle(IntPatch_WLine)& wlin =
-          Handle(IntPatch_WLine)::DownCast (LineK);
+        Handle(IntPatch_WLine) wlin (Handle(IntPatch_WLine)::DownCast (LineK));
         nbvtx=wlin->NbVertex();
         nbvw+=nbvtx;        nbw++;
         for(v=1;v<=nbvtx;v++) { 
@@ -1964,8 +1960,7 @@ void IntPatch_Intersection::Dump(const Standard_Integer ,
         }
       }
       else { 
-        Handle(IntPatch_GLine)& glin =
-          Handle(IntPatch_GLine)::DownCast (LineK);
+        Handle(IntPatch_GLine) glin (Handle(IntPatch_GLine)::DownCast (LineK));
         nbvtx=glin->NbVertex();
         nbvg+=nbvtx;        nbg++;
         for(v=1;v<=nbvtx;v++) { 
index fa0191b..bc85e6d 100644 (file)
@@ -199,7 +199,7 @@ static Standard_Real LocalFirstParameter (const Handle(IntPatch_Line)& L)
   switch (typl) {
   case IntPatch_Analytic:
     {
-      Handle(IntPatch_ALine)& alin = Handle(IntPatch_ALine)::DownCast (L);
+      Handle(IntPatch_ALine) alin (Handle(IntPatch_ALine)::DownCast (L));
       if (alin->HasFirstPoint()) {
        firstp = alin->FirstPoint().ParameterOnLine();
       }
@@ -215,7 +215,7 @@ static Standard_Real LocalFirstParameter (const Handle(IntPatch_Line)& L)
 
   case IntPatch_Restriction:
     {
-      Handle(IntPatch_RLine)& rlin = Handle(IntPatch_RLine)::DownCast (L);
+      Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (L));
       if (rlin->HasFirstPoint()) {
        firstp = rlin->FirstPoint().ParameterOnLine();
       }
@@ -227,7 +227,7 @@ static Standard_Real LocalFirstParameter (const Handle(IntPatch_Line)& L)
    case IntPatch_Walking:
     {
       
-      Handle(IntPatch_WLine)& wlin = Handle(IntPatch_WLine)::DownCast (L);
+      Handle(IntPatch_WLine) wlin (Handle(IntPatch_WLine)::DownCast (L));
       if (wlin->HasFirstPoint()) {
        firstp = wlin->FirstPoint().ParameterOnLine();
       }
@@ -239,7 +239,7 @@ static Standard_Real LocalFirstParameter (const Handle(IntPatch_Line)& L)
        
   default:
     {
-      Handle(IntPatch_GLine)& glin = Handle(IntPatch_GLine)::DownCast (L);
+      Handle(IntPatch_GLine) glin (Handle(IntPatch_GLine)::DownCast (L));
       if (glin->HasFirstPoint()) {
        firstp = glin->FirstPoint().ParameterOnLine();
       }
@@ -278,7 +278,7 @@ static Standard_Real LocalLastParameter (const Handle(IntPatch_Line)& L)
   switch (typl) {
   case IntPatch_Analytic:
     {
-      Handle(IntPatch_ALine)& alin = Handle(IntPatch_ALine)::DownCast (L);
+      Handle(IntPatch_ALine) alin (Handle(IntPatch_ALine)::DownCast (L));
 
       if (alin->HasLastPoint()) {
        lastp = alin->LastPoint().ParameterOnLine();
@@ -295,7 +295,7 @@ static Standard_Real LocalLastParameter (const Handle(IntPatch_Line)& L)
 
   case IntPatch_Restriction:
     {
-      Handle(IntPatch_RLine)& rlin = Handle(IntPatch_RLine)::DownCast (L);
+      Handle(IntPatch_RLine) rlin (Handle(IntPatch_RLine)::DownCast (L));
       
       if (rlin->HasLastPoint()) {
        lastp = rlin->LastPoint().ParameterOnLine();
@@ -307,7 +307,7 @@ static Standard_Real LocalLastParameter (const Handle(IntPatch_Line)& L)
     }
    case IntPatch_Walking:
     {
-      Handle(IntPatch_WLine)& wlin = Handle(IntPatch_WLine)::DownCast (L);
+      Handle(IntPatch_WLine) wlin (Handle(IntPatch_WLine)::DownCast (L));
 
       if (wlin->HasLastPoint()) {
        lastp = wlin->LastPoint().ParameterOnLine();
@@ -320,7 +320,7 @@ static Standard_Real LocalLastParameter (const Handle(IntPatch_Line)& L)
        
   default:
     {
-      Handle(IntPatch_GLine)& glin = Handle(IntPatch_GLine)::DownCast (L);
+      Handle(IntPatch_GLine) glin (Handle(IntPatch_GLine)::DownCast (L));
       
       if (glin->HasLastPoint()) {
        lastp = glin->LastPoint().ParameterOnLine();
@@ -562,7 +562,7 @@ static void AddLine(const Handle(IntPatch_Line)& L,
   IntPatch_IType typl = L->ArcType();
   switch (typl) {
     case IntPatch_Analytic: { 
-      Handle(IntPatch_ALine)& ALine = Handle(IntPatch_ALine)::DownCast (L);
+      Handle(IntPatch_ALine) ALine (Handle(IntPatch_ALine)::DownCast (L));
       Handle(IntPatch_ALine) alig;
       if(L->TransitionOnS1() == IntSurf_Undecided)
        alig = new IntPatch_ALine(ALine->Curve(),L->IsTangent());
@@ -582,7 +582,7 @@ static void AddLine(const Handle(IntPatch_Line)& L,
       break;
     }
     case IntPatch_Walking: {  //-- ****************************************
-      Handle(IntPatch_WLine)& WLine = Handle(IntPatch_WLine)::DownCast (L);
+      Handle(IntPatch_WLine) WLine (Handle(IntPatch_WLine)::DownCast (L));
       const Handle(IntSurf_LineOn2S)& Lori = WLine->Curve();
       Handle(IntSurf_LineOn2S) LineOn2S = new IntSurf_LineOn2S();
       Standard_Integer ParamMinOnLine = (Standard_Integer) WLine->Vertex(i).ParameterOnLine();   
@@ -623,7 +623,7 @@ static void AddLine(const Handle(IntPatch_Line)& L,
       break;
     }
     case IntPatch_Restriction: { 
-      Handle(IntPatch_RLine)& RLine = Handle(IntPatch_RLine)::DownCast (L);
+      Handle(IntPatch_RLine) RLine (Handle(IntPatch_RLine)::DownCast (L));
       IndexLastVertex=2;
       IndexFirstVertex=1;
       Handle(IntPatch_RLine) rlig;
@@ -661,7 +661,7 @@ static void AddLine(const Handle(IntPatch_Line)& L,
     case IntPatch_Hyperbola:
     case IntPatch_Circle:
     case IntPatch_Ellipse: { 
-      Handle(IntPatch_GLine)& GLine = Handle(IntPatch_GLine)::DownCast (L);
+      Handle(IntPatch_GLine) GLine (Handle(IntPatch_GLine)::DownCast (L));
       Handle(IntPatch_GLine) glig;
       switch (typl) {
       case IntPatch_Lin:
@@ -1025,34 +1025,34 @@ static void TestWLineToRLine(const IntPatch_SequenceOfLine& slinref,
        iv = indicesV1(i);
        Handle(Adaptor2d_HCurve2d) arc;
        if ((WLine->Vertex(iv).*pIsOnDomS)()) arc = (WLine->Vertex(iv).*pArcOnS)();
-       else arc = (const Handle(Adaptor2d_HCurve2d)&) arcsResolved(iv);
+       else arc = Handle(Adaptor2d_HCurve2d)::DownCast (arcsResolved(iv));
        if (!arc.IsNull()) mapArcsV1.Add(arc);
       }
       for (i=1; i <= indicesV2.Length(); i++) {
        iv = indicesV2(i);
        Handle(Adaptor2d_HCurve2d) arc;
        if ((WLine->Vertex(iv).*pIsOnDomS)()) arc = (WLine->Vertex(iv).*pArcOnS)();
-       else arc = (const Handle(Adaptor2d_HCurve2d)&) arcsResolved(iv);
+       else arc = Handle(Adaptor2d_HCurve2d)::DownCast (arcsResolved(iv));
        if (!arc.IsNull() && mapArcsV1.Contains(arc)) mapArcs.Add(arc);
       }
 
       // for each common arc
       for (Standard_Integer ia=1; ia <= mapArcs.Extent(); ia++) {
-       const Handle(Adaptor2d_HCurve2d)& arc = (const Handle(Adaptor2d_HCurve2d)&) mapArcs(ia);
+       const Handle(Adaptor2d_HCurve2d) arc (Handle(Adaptor2d_HCurve2d)::DownCast (mapArcs(ia)));
        // get end vertices of wline linked with this arc
        Standard_Integer iv1=0,iv2=0;
        for (i=1; i <= indicesV1.Length() && iv1==0; i++) {
          iv = indicesV1(i);
          Handle(Adaptor2d_HCurve2d) arc1;
          if ((WLine->Vertex(iv).*pIsOnDomS)()) arc1 = (WLine->Vertex(iv).*pArcOnS)();
-         else arc1 = (const Handle(Adaptor2d_HCurve2d)&) arcsResolved(iv);
+         else arc1 = Handle(Adaptor2d_HCurve2d)::DownCast (arcsResolved(iv));
          if (!arc1.IsNull() && arc1 == arc) iv1 = iv;
        }
        for (i=1; i <= indicesV2.Length() && iv2==0; i++) {
          iv = indicesV2(i);
          Handle(Adaptor2d_HCurve2d) arc1;
          if ((WLine->Vertex(iv).*pIsOnDomS)()) arc1 = (WLine->Vertex(iv).*pArcOnS)();
-         else arc1 = (const Handle(Adaptor2d_HCurve2d)&) arcsResolved(iv);
+         else arc1 = Handle(Adaptor2d_HCurve2d)::DownCast (arcsResolved(iv));
          if (!arc1.IsNull() && arc1 == arc) iv2 = iv;
        }
        if (!iv1 || !iv2) {
@@ -1194,8 +1194,7 @@ void IntPatch_LineConstructor::Perform(const IntPatch_SequenceOfLine& slinref,
   IntPatch_IType typl = L->ArcType();
   if(typl == IntPatch_Analytic) { 
     Standard_Real u1,v1,u2,v2;
-    Handle(IntPatch_ALine)& ALine 
-      =  Handle(IntPatch_ALine)::DownCast (L);
+    Handle(IntPatch_ALine) ALine (Handle(IntPatch_ALine)::DownCast (L));
     slin.Clear();
     nbvtx = ALine->NbVertex();
     //-- -------------------------------------------------------------------
@@ -1247,8 +1246,7 @@ void IntPatch_LineConstructor::Perform(const IntPatch_SequenceOfLine& slinref,
   }
   else if(typl == IntPatch_Walking) { 
     Standard_Real u1,v1,u2,v2;
-    Handle(IntPatch_WLine)& WLine 
-      =  Handle(IntPatch_WLine)::DownCast (L);
+    Handle(IntPatch_WLine) WLine (Handle(IntPatch_WLine)::DownCast (L));
     slin.Clear();
     nbvtx = WLine->NbVertex();
     //-- -------------------------------------------------------------------
@@ -1407,8 +1405,7 @@ void IntPatch_LineConstructor::Perform(const IntPatch_SequenceOfLine& slinref,
   }
   else if (typl != IntPatch_Restriction) { // JAG 01.07.96
     Standard_Real u1,v1,u2,v2;
-    Handle(IntPatch_GLine)& GLine 
-      =  Handle(IntPatch_GLine)::DownCast (L);
+    Handle(IntPatch_GLine) GLine (Handle(IntPatch_GLine)::DownCast (L));
     slin.Clear();
     nbvtx = GLine->NbVertex();
     //-- -------------------------------------------------------------------
@@ -1539,8 +1536,7 @@ void IntPatch_LineConstructor::Perform(const IntPatch_SequenceOfLine& slinref,
     return;
   }
   else {  //-- Restriction
-    Handle(IntPatch_RLine)& RLine 
-      =  Handle(IntPatch_RLine)::DownCast (L);
+    Handle(IntPatch_RLine) RLine (Handle(IntPatch_RLine)::DownCast (L));
     slin.Clear();
     Standard_Integer NbVtx    = RLine->NbVertex();
     Standard_Boolean RestOnS1 = RLine->IsArcOnS1();
index 283506f..b81fbde 100644 (file)
@@ -1845,20 +1845,12 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
       BRepAdaptor_Curve CURVE(OE);
       if (CURVE.GetType() == GeomAbs_Line)  {
        // Works only with line !!
-//#ifndef OCCT_DEBUG
         Handle(Geom_Geometry) aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ;
         gp_Lin OLin = Handle(Geom_Line)::DownCast (aGeomGeometry)->Lin();
-//#else
-//     gp_Lin OLin = ((Handle(Geom_Line)&) CURVE.Curve().Curve()->Transformed(CURVE.Trsf()))->Lin();
-//#endif
        TopoDS_Edge NE = TopoDS::Edge(S2);
        CURVE.Initialize (NE);
-//#ifndef OCCT_DEBUG
         aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ;
         gp_Lin NLin = Handle(Geom_Line)::DownCast (aGeomGeometry)->Lin();
-//#else
-//     gp_Lin NLin = ((Handle(Geom_Line)&) CURVE.Curve().Curve()->Transformed(CURVE.Trsf()))->Lin();
-//#endif
        gp_Dir TDir (NLin.Location().XYZ() - OLin.Location().XYZ());
        aplane = new Geom_Plane (NLin.Location(),NLin.Direction()^TDir);
 
@@ -1876,12 +1868,8 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
       }
       else
       if (CURVE.GetType() == GeomAbs_Circle)  {
-//#ifndef OCCT_DEBUG
         Handle(Geom_Geometry) aGeomGeometry = CURVE.Curve().Curve()->Transformed(CURVE.Trsf()) ;
         gp_Ax1 ax = Handle(Geom_Circle)::DownCast (aGeomGeometry)->Circ().Axis();
-//#else
-//     gp_Ax1 ax = ((Handle(Geom_Circle)&) CURVE.Curve().Curve()->Transformed(CURVE.Trsf()))->Circ().Axis();
-//#endif
        aplane = new Geom_Plane (ax.Location(),ax.Direction());
        is_planar = Standard_True;
       }
@@ -1902,12 +1890,8 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
 
       BRepBuilderAPI_MakeFace MkF (w1,Standard_True);
       if (MkF.IsDone())  {
-//#ifndef OCCT_DEBUG
         Handle(Geom_Surface) aGeomSurface = BRep_Tool::Surface(MkF.Face());
-        aplane = Handle(Geom_Plane)::DownCast (aGeomSurface) ;
-//#else
-//     aplane = ((Handle(Geom_Plane)&) BRep_Tool::Surface(MkF.Face()));
-//#endif
+        aplane = Handle(Geom_Plane)::DownCast (aGeomSurface);
        is_planar = Standard_True;
       }
     }
index a873c06..d95784f 100644 (file)
@@ -341,9 +341,9 @@ Standard_Boolean  TopOpeBRepTool_CurveTool::MakeCurves
   Standard_Integer iparmin = (Standard_Integer)parmin;
   Standard_Integer iparmax = (Standard_Integer)parmax;
 
-  Handle(Geom_BSplineCurve)&   HC3D = Handle(Geom_BSplineCurve)::DownCast (C3D);
-  Handle(Geom2d_BSplineCurve)& HPC1 = Handle(Geom2d_BSplineCurve)::DownCast (PC1);
-  Handle(Geom2d_BSplineCurve)& HPC2 = Handle(Geom2d_BSplineCurve)::DownCast (PC2);
+  Handle(Geom_BSplineCurve) HC3D (Handle(Geom_BSplineCurve)::DownCast (C3D));
+  Handle(Geom2d_BSplineCurve) HPC1 (Handle(Geom2d_BSplineCurve)::DownCast (PC1));
+  Handle(Geom2d_BSplineCurve) HPC2 (Handle(Geom2d_BSplineCurve)::DownCast (PC2));
 
 //--------------------- IFV - "improving" initial curves
 #ifdef CurveImprovement
@@ -452,21 +452,21 @@ Standard_Boolean  TopOpeBRepTool_CurveTool::MakeCurves
       if(CompPC1) Polpc1(NbPol) = PolPC1(nbpol);
       if(CompPC2) Polpc2(NbPol) = PolPC2(nbpol);
       
-      HC3D = new Geom_BSplineCurve(Polc3d, knots, mults, 1);
-      if(CompPC1) HPC1 = new Geom2d_BSplineCurve(Polpc1, knots, mults, 1);
-      if(CompPC2) HPC2 = new Geom2d_BSplineCurve(Polpc2, knots, mults, 1);
+      const_cast<Handle(Geom_Curve)&>(C3D) = new Geom_BSplineCurve(Polc3d, knots, mults, 1);
+      if(CompPC1) const_cast<Handle(Geom2d_Curve)&>(PC1) = new Geom2d_BSplineCurve(Polpc1, knots, mults, 1);
+      if(CompPC2) const_cast<Handle(Geom2d_Curve)&>(PC2) = new Geom2d_BSplineCurve(Polpc2, knots, mults, 1);
       iparmax = NbPol;
 
 #ifdef IFV
       sprintf(name,"C3Dmod_%d",NbCalls);
       nm = &name[0];
-      DrawTrSurf::Set(nm, HC3D);
+      DrawTrSurf::Set(nm, C3D);
       sprintf(name,"PC1mod_%d",NbCalls);
       nm = &name[0];
-      DrawTrSurf::Set(nm, HPC1);
+      DrawTrSurf::Set(nm, PC1);
       sprintf(name,"PC2mod_%d",NbCalls);
       nm = &name[0];
-      DrawTrSurf::Set(nm, HPC2);
+      DrawTrSurf::Set(nm, PC2);
 #endif
 
     }
index a26d10a..66240c4 100644 (file)
@@ -73,7 +73,7 @@ void V3d_Viewer::SetCurrentSelectedLight(const Handle(V3d_Light)& TheLight) {
 }
 
 void V3d_Viewer::ClearCurrentSelectedLight() {
-  MyCurrentSelectedLight = NULL;
+  MyCurrentSelectedLight.Nullify();
 }
 
 
@@ -104,7 +104,7 @@ void V3d_Viewer::SetDefaultLights()
 {
   while (MyDefinedLights.Extent() > 0)
   {
-    DelLight ((Handle(V3d_Light)&)MyDefinedLights.First());
+    DelLight (Handle(V3d_Light)::DownCast (MyDefinedLights.First()));
   }
 
   SetLightOn (new V3d_DirectionalLight (this, V3d_Zneg, Quantity_NOC_WHITE, Standard_True));