0032437: Coding Rules - eliminate MinGW warning -Wmaybe-uninitialized
[occt.git] / src / TopOpeBRepDS / TopOpeBRepDS_BuildTool.cxx
index 2ffb5d1..81b8dc0 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <TopOpeBRepDS_BuildTool.ixx>
+#include <TopOpeBRepDS_BuildTool.hxx>
 
-#include <TopoDS.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopAbs.hxx>
 #include <BRep_Tool.hxx>
-#include <TopOpeBRepTool_GeomTool.hxx>
-#include <TopOpeBRepTool_ShapeTool.hxx>
-#include <TopOpeBRepTool_OutCurveType.hxx>
-#include <TopOpeBRepDS_SurfaceCurveInterference.hxx>
-#include <Precision.hxx>
-#include <Geom_Surface.hxx>
-#include <GeomAdaptor_Curve.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_TrimmedCurve.hxx>
-#include <GeomAPI_ProjectPointOnCurve.hxx>
-#include <GeomAPI_ProjectPointOnSurf.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <ElCLib.hxx>
-#include <gp.hxx>
-#include <gp_Vec2d.hxx>
-#include <TopExp.hxx>
-#include <TopLoc_Location.hxx>
-#include <TopOpeBRepTool_ShapeTool.hxx>
-#include <Geom_SphericalSurface.hxx>
-#include <Standard_ProgramError.hxx>
-#include <Standard_NotImplemented.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Pnt2d.hxx>
-#include <TopOpeBRepDS_Dumper.hxx>
 #include <BRepAdaptor_Surface.hxx>
-#include <Geom2d_Conic.hxx>
+#include <ElCLib.hxx>
+#include <Extrema_ExtPC.hxx>
+#include <Extrema_POnCurv.hxx>
+#include <Geom2d_BezierCurve.hxx>
+#include <Geom2d_BSplineCurve.hxx>
 #include <Geom2d_Circle.hxx>
-#include <Geom2d_Line.hxx>
+#include <Geom2d_Conic.hxx>
+#include <Geom2d_Curve.hxx>
 #include <Geom2d_Ellipse.hxx>
-#include <Geom2d_Parabola.hxx>
 #include <Geom2d_Hyperbola.hxx>
-#include <Geom2d_BezierCurve.hxx>
-#include <Geom2d_BSplineCurve.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
+#include <Geom2d_Line.hxx>
 #include <Geom2d_OffsetCurve.hxx>
-#include <Geom_Conic.hxx>
+#include <Geom2d_Parabola.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+#include <Geom_BezierCurve.hxx>
+#include <Geom_BSplineCurve.hxx>
 #include <Geom_Circle.hxx>
-#include <Geom_Line.hxx>
+#include <Geom_Conic.hxx>
+#include <Geom_Curve.hxx>
 #include <Geom_Ellipse.hxx>
-#include <Geom_Parabola.hxx>
 #include <Geom_Hyperbola.hxx>
-#include <Geom_BezierCurve.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <Geom_TrimmedCurve.hxx>
+#include <Geom_Line.hxx>
 #include <Geom_OffsetCurve.hxx>
-// includes especially needed by the static Project function
-#include <BRep_Tool.hxx>
+#include <Geom_Parabola.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_SphericalSurface.hxx>
+#include <Geom_Surface.hxx>
+#include <Geom_TrimmedCurve.hxx>
 #include <GeomAdaptor_Curve.hxx>
-#include <Extrema_ExtPC.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
+#include <GeomAPI_ProjectPointOnSurf.hxx>
+#include <gp.hxx>
 #include <gp_Pnt.hxx>
-#include <Extrema_POnCurv.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom_BSplineCurve.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Vec2d.hxx>
+#include <Precision.hxx>
+#include <Standard_NotImplemented.hxx>
+#include <Standard_ProgramError.hxx>
 #include <TCollection_AsciiString.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
-
-#ifdef DEB
-extern Standard_Boolean TopOpeBRepDS_GettraceDSNC();
-extern Standard_Boolean TopOpeBRepDS_GettraceBUTO();
-extern Standard_Boolean TopOpeBRepDS_GettraceTRPE();
-extern Standard_Boolean TopOpeBRepDS_GettraceSANTRAN();
-static void DUMPCURVES(const Handle(Geom_Curve)& C3D,const TopOpeBRepDS_Curve& C)
-{
-  if ( !C3D.IsNull() ) {
-    Standard_Real dp1 = C3D->FirstParameter();
-    Standard_Real dp2 = C3D->LastParameter();
-    cout<<"TopOpeBRepDS_BuildTool : C3D = "<<dp1<<","<<dp2<<endl;
-  }
-  if ( !C.Curve1().IsNull() ) {
-    Standard_Real dp1 = C.Curve1()->FirstParameter();
-    Standard_Real dp2 = C.Curve1()->LastParameter();
-    cout<<"TopOpeBRepDS_BuildTool : PC1 = "<<dp1<<","<<dp2<<endl;
-  }
-  if ( !C.Curve2().IsNull() ) {
-    Standard_Real dp1 = C.Curve2()->FirstParameter();
-    Standard_Real dp2 = C.Curve2()->LastParameter();
-    cout<<"TopOpeBRepDS_BuildTool : PC2 = "<<dp1<<","<<dp2<<endl;
-  }
-}
-#endif
+#include <TopAbs.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopLoc_Location.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopOpeBRepDS_Curve.hxx>
+#include <TopOpeBRepDS_DataStructure.hxx>
+#include <TopOpeBRepDS_Dumper.hxx>
+#include <TopOpeBRepDS_HDataStructure.hxx>
+#include <TopOpeBRepDS_Point.hxx>
+#include <TopOpeBRepDS_Surface.hxx>
+#include <TopOpeBRepDS_SurfaceCurveInterference.hxx>
+#include <TopOpeBRepTool_GeomTool.hxx>
+#include <TopOpeBRepTool_OutCurveType.hxx>
+#include <TopOpeBRepTool_ShapeTool.hxx>
 
+// includes especially needed by the static Project function
 #ifdef DRAW
 #include <TopOpeBRepDS_DRAW.hxx>
-#endif
-
-//-----------------------------------------------------------------------
-//function : PrintSurface
-//purpose  : print the name of a surface on a stream
-// a mettre dans TopOpeBRepDS_Dumper.cxx NYI
-//-----------------------------------------------------------------------
-
-#ifdef DEB
-static Standard_OStream& PrintSurface(const TopoDS_Face& F, Standard_OStream& s)
-{
-  BRepAdaptor_Surface STA_Surface(F);
-  GeomAbs_SurfaceType t =  STA_Surface.GetType();
-  switch(t) {
-  case GeomAbs_Plane               : s<<"PLANE";               break;
-  case GeomAbs_Cylinder            : s<<"CYLINDER";            break;
-  case GeomAbs_Cone                : s<<"CONE";                break;
-  case GeomAbs_Sphere              : s<<"SPHERE";              break;
-  case GeomAbs_Torus               : s<<"TORUS";               break;
-  case GeomAbs_BezierSurface       : s<<"BEZIERSURFACE";       break;
-  case GeomAbs_BSplineSurface      : s<<"BSPLINESURFACE";      break;
-  case GeomAbs_SurfaceOfRevolution : s<<"SURFACEOFREVOLUTION"; break;
-  case GeomAbs_SurfaceOfExtrusion  : s<<"SURFACEOFEXTRUSION";  break;
-  case GeomAbs_OtherSurface : default :  s<<"OTHERSURFACE";        break;
-  }
-  return s;                                                    
-}
+#include <Geom2d_Curve.hxx>
 #endif
 
 Standard_EXPORT Handle(Geom2d_Curve) BASISCURVE2D(const Handle(Geom2d_Curve)& C);
 
-//-----------------------------------------------------------------------
-//function : GetOrigin
-//purpose  : a mettre dans TopOpeBRepDS_Dumper.cxx NYI
-//-----------------------------------------------------------------------
-
-#ifdef DEB
-static Standard_Boolean GetOrigin(const Handle(Geom2d_Curve)& PCIN, gp_Pnt2d& o)
-{
-  if (PCIN.IsNull()) return Standard_False;
-  Handle(Geom2d_Curve) PC = ::BASISCURVE2D(PCIN);
-  if (PC.IsNull()) return Standard_False;
-
-  Handle(Standard_Type) T = PC->DynamicType();
-  if      ((T==STANDARD_TYPE(Geom2d_Circle)) ||
-          (T==STANDARD_TYPE(Geom2d_Ellipse))  ||
-          (T==STANDARD_TYPE(Geom2d_Parabola)) ||
-          (T==STANDARD_TYPE(Geom2d_Hyperbola))) {
-    o = Handle(Geom2d_Conic)::DownCast(PC)->Location();
-    return Standard_True;
-  }
-  else if (T==STANDARD_TYPE(Geom2d_Line)) {
-    o = Handle(Geom2d_Line)::DownCast(PC)->Location();
-    return Standard_True;
-  }
-  else  {
-    return Standard_False;
-  }
-//  return Standard_False;
-}
-#endif
-
-//-----------------------------------------------------------------------
-//function : GetOrigin
-//purpose  : a mettre dans TopOpeBRepDS_Dumper.cxx NYI
-//-----------------------------------------------------------------------
-
-#ifdef DEB
-static Standard_Boolean GetOrigin(const Handle(Geom_Curve)& CIN, gp_Pnt& o)
-{
-  if (CIN.IsNull()) return Standard_False;
-  Handle(Geom_Curve) C = TopOpeBRepTool_ShapeTool::BASISCURVE(CIN);
-  if (C.IsNull()) return Standard_False;
-
-  Handle(Standard_Type) T = C->DynamicType();
-  if      ((T==STANDARD_TYPE(Geom_Circle)) ||
-          (T==STANDARD_TYPE(Geom_Ellipse))  ||
-          (T==STANDARD_TYPE(Geom_Parabola)) ||
-          (T==STANDARD_TYPE(Geom_Hyperbola))) {
-    o = Handle(Geom_Conic)::DownCast(C)->Location();
-    return Standard_True;
-  }
-  else if (T==STANDARD_TYPE(Geom_Line)) {
-    o = Handle(Geom_Line)::DownCast(C)->Position().Location();
-    return Standard_True;
-  }
-  else  {
-    return Standard_False;
-  }
-}
-#endif
-
 Standard_Boolean FUN_UisoLineOnSphe
 (const TopoDS_Shape& F,
  const Handle(Geom2d_Curve)& PC)
@@ -309,13 +197,6 @@ void  TopOpeBRepDS_BuildTool::MakeVertex(TopoDS_Shape& V,
   myBuilder.MakeVertex(TopoDS::Vertex(V),P.Point(),P.Tolerance());
 }
 
-#ifdef DEB
-//-----------------------------------------------------------------------
-static Standard_OStream& DUMPPNT(const gp_Pnt& P, Standard_OStream& OS)
-//-----------------------------------------------------------------------
-{ OS<<P.X()<<" "<<P.Y()<<" "<<P.Z(); return OS; }
-#endif
-
 //=======================================================================
 //function : MakeEdge
 //purpose  : 
@@ -356,22 +237,8 @@ void  TopOpeBRepDS_BuildTool::MakeEdge(TopoDS_Shape& E,
       if (!BSC.IsNull()) {
        if (BSC->Degree() == 1) {
          myBuilder.Range(TopoDS::Edge(E),1,BSC->NbPoles());
-#ifdef DEB
-         if (TopOpeBRepDS_GettraceBUTO()) {
-           cout<<endl<<"TopOpeBRepDS_BuildTool : ";
-           cout<<"new range of "<< 1 <<" "<<BSC->NbPoles()<<endl;
-         }
-#endif
        }
       }
-      
-#ifdef DEB
-      if (TopOpeBRepDS_GettraceBUTO()) {
-       cout<<"TopOpeBRepDS_BuildTool : ";
-       cout<<"vertices on parameter "<<first<<endl;
-       cout<<" point is "; DUMPPNT(P,cout); cout<<endl;
-      }
-#endif
     }
   }
 
@@ -380,12 +247,6 @@ void  TopOpeBRepDS_BuildTool::MakeEdge(TopoDS_Shape& E,
     Standard_Boolean rangedef = C.Range(first,last);
     if (rangedef) {
       Range(E,first,last);
-#ifdef DEB
-      if (TopOpeBRepDS_GettraceBUTO()) {
-       cout<<"TopOpeBRepDS_BuildTool : ";
-       cout<<"set edge range : "<<first<<" "<<last<<endl;
-      }
-#endif
     }
   }
 }
@@ -595,15 +456,13 @@ void TopOpeBRepDS_BuildTool::UpdateEdgeCurveTol
 //  newtol=tol3d;
 //  if (r1>newtol) newtol=r1;
 //  if (r2>newtol) newtol=r2;
-//#ifdef DEB
-//  if (TopOpeBRepDS_GettraceDSNC()) cout<<"newtol = "<<newtol<<endl;
-//#endif
 
 //  newtol *= 1.5;
 
-  TopoDS_Vertex Vmin,Vmax; Standard_Real parmin,parmax;
-  GetOrientedEdgeVertices(E,Vmin,Vmax,parmin,parmax);
-  
+  TopoDS_Vertex Vmin, Vmax;
+  Standard_Real parmin = 0.0, parmax = 0.0;
+  GetOrientedEdgeVertices (E, Vmin, Vmax, parmin, parmax);
+
   Standard_Real tolmin=BRep_Tool::Tolerance(Vmin);
   if(newtol>tolmin) tolmin=newtol;
   Standard_Real tolmax=BRep_Tool::Tolerance(Vmax);
@@ -675,11 +534,6 @@ void  TopOpeBRepDS_BuildTool::ApproxCurves
   inewC = HDS->MakeCurve(C,newC1);
   TopOpeBRepDS_Curve& newC = HDS->ChangeCurve(inewC);
 
-#ifdef DEB
-//  Standard_Boolean tDSNC = TopOpeBRepDS_GettraceDSNC();
-  Standard_Boolean tBUTO = TopOpeBRepDS_GettraceBUTO();
-#endif
-  
   // C1 curves have been approximated by BSplines of degree 1 :
   // compute new geometry on curves.
 
@@ -693,31 +547,22 @@ void  TopOpeBRepDS_BuildTool::ApproxCurves
   // Vmin,Vmax = bounding vertices of edge <E>
   // and their parameters parmin,parmax .
 
-  TopoDS_Vertex Vmin,Vmax;Standard_Real parmin,parmax;
-  GetOrientedEdgeVertices(E,Vmin,Vmax,parmin,parmax);
+  TopoDS_Vertex Vmin, Vmax;
+  Standard_Real parmin = 0.0, parmax = 0.0;
+  GetOrientedEdgeVertices (E, Vmin, Vmax, parmin, parmax);
 
-#ifdef DEB
-  if (tBUTO) cout<<"Recompute1 min,max = "<<parmin<<","<<parmax<<endl;
-  if (tBUTO) DUMPCURVES(C3D,C);
-#endif
-  
   Handle(Geom_Curve)   C3Dnew;
   Handle(Geom2d_Curve) PC1new;
   Handle(Geom2d_Curve) PC2new;
-  Standard_Real tolreached3d,tolreached2d;
-  
+  Standard_Real tolreached3d = 0.0, tolreached2d = 0.0;
   Standard_Boolean approxMade = myCurveTool.MakeCurves(parmin,parmax,
                         C3D,PC1,PC2,F1,F2,
                         C3Dnew,PC1new,PC2new,
                         tolreached3d,tolreached2d);
 
-  Standard_Real newtol,newparmin,newparmax;
+  Standard_Real newtol = 0.0, newparmin = 0.0, newparmax = 0.0;
   // MSV Nov 12, 2001: if approx failed than leave old curves of degree 1
   if (!approxMade) {
-#ifdef TOPOPEBREPDS_DEB
-    cout<<"TopOpeBRepDS_BuildTool::ApproxCurves : approx failed, leave curves of degree 1"
-      <<endl;
-#endif
     newtol = BRep_Tool::Tolerance(E);
     newparmin = parmin;
     newparmax = parmax;
@@ -773,13 +618,6 @@ Standard_Boolean FUN_reversePC
   Standard_Boolean sam = P3D.IsEqual(P3DC3D,tol);
   PCreversed = !sam;
 
-#ifdef DEB
-#ifdef DRAW
-  Standard_Boolean tBUTO = TopOpeBRepDS_GettraceBUTO();
-  if (tBUTO) {FUN_draw(P3DC3D); FUN_draw(P3D);}
-#endif
-#endif
-
   if ( PCreversed ) {
     Handle(Geom2d_Curve) PC = ::BASISCURVE2D(PCnew);
     if (!PC.IsNull()) {
@@ -811,9 +649,6 @@ Standard_Boolean FUN_makeUisoLineOnSphe
   if (!FUN_getUV(surf,C3D,par3dsup,usup,vsup)) return Standard_False;
   Standard_Real tol = Precision::Parametric(tol3d);
   if (Abs(uinf-usup) > tol) return Standard_False;
-#ifdef DEB
-//  Standard_Real deltav = vsup-vinf;
-#endif
 
   Standard_Boolean isvgrowing = (vsup - vinf > -tol);
   gp_Dir2d vdir;
@@ -826,16 +661,6 @@ Standard_Boolean FUN_makeUisoLineOnSphe
   if (!PC.IsNull()) {  
     Handle(Geom2d_Line) L = Handle(Geom2d_Line)::DownCast(PC); 
     L->SetLin2d(gp_Lin2d(origin,vdir));
-#ifdef DEB
-#ifdef DRAW
-  Standard_Boolean trc = TopOpeBRepDS_GettraceBUTO();
-    if (trc) {
-      FUN_draw(gp_Pnt2d(uinf,vinf));
-      FUN_draw(gp_Pnt2d(usup,vsup));
-      FUN_draw(L,p3dl-p3df);
-    }
-#endif
-#endif
   } // (!PC.IsNull())
   
   return Standard_True;
@@ -849,42 +674,26 @@ void TopOpeBRepDS_BuildTool::ComputePCurves
  const Standard_Boolean comppc2,
  const Standard_Boolean compc3d) const
 {
-#ifdef DEB
-//  Standard_Boolean tDSNC = TopOpeBRepDS_GettraceDSNC();
-  Standard_Boolean tBUTO = TopOpeBRepDS_GettraceBUTO();
-  Standard_Boolean tTRPE = TopOpeBRepDS_GettraceTRPE();
-#endif
-  
   const TopoDS_Face& F1 = TopoDS::Face(newC.Shape1());
   const TopoDS_Face& F2 = TopoDS::Face(newC.Shape2());
   
   const Handle(Geom_Curve)& C3D = C.Curve();
-#ifdef DEB
-//  const Handle(Geom2d_Curve)& PC1 = C.Curve1();
-//  const Handle(Geom2d_Curve)& PC2 = C.Curve2();
-#endif
 
   // get bounding vertices Vmin,Vmax supported by the new edge <E>
   // and their corresponding parameters parmin,parmax .
-
-  TopoDS_Vertex Vmin,Vmax;Standard_Real parmin,parmax;
-  GetOrientedEdgeVertices(E,Vmin,Vmax,parmin,parmax);
-
-#ifdef DEB
-  if (tBUTO) cout<<"Recompute2 min,max = "<<parmin<<","<<parmax<<endl;
-  if (tBUTO) DUMPCURVES(C3D,C);
-#endif
-
-  Handle(Geom2d_Curve) PC1new;
-  Handle(Geom2d_Curve) PC2new;
-  
-  if(C3D.IsNull()) {
-    Standard_Real tolreached2d1 = Precision::Confusion(), tolreached2d2 = Precision::Confusion(), r1, r2, tol=Precision::Confusion();
+  TopoDS_Vertex Vmin, Vmax;
+  Standard_Real parmin = 0.0, parmax = 0.0;
+  GetOrientedEdgeVertices (E, Vmin, Vmax, parmin, parmax);
+
+  Handle(Geom2d_Curve) PC1new, PC2new;
+  if(C3D.IsNull())
+  {
+    Standard_Real tolreached2d1 = Precision::Confusion(), tolreached2d2 = Precision::Confusion(), tol=Precision::Confusion();
     if (comppc1) PC1new = myCurveTool.MakePCurveOnFace(F1,C3D,tolreached2d1);
     if (comppc2) PC2new = myCurveTool.MakePCurveOnFace(F2,C3D,tolreached2d2);
     
-    r1 = TopOpeBRepTool_ShapeTool::Resolution3d(F1,tolreached2d1);
-    r2 = TopOpeBRepTool_ShapeTool::Resolution3d(F2,tolreached2d2);
+    Standard_Real r1 = TopOpeBRepTool_ShapeTool::Resolution3d(F1,tolreached2d1);
+    Standard_Real r2 = TopOpeBRepTool_ShapeTool::Resolution3d(F2,tolreached2d2);
     tol = Max(tol,r1);
     tol = Max(tol,r2);
     newC.Tolerance(tol);
@@ -907,10 +716,6 @@ void TopOpeBRepDS_BuildTool::ComputePCurves
     ElCLib::AdjustPeriodic(f,f+period,Precision::PConfusion(),parmin,parmax);
     if (compc3d) C3Dnew = new Geom_TrimmedCurve(C3D,parmin,parmax);
     
-#ifdef DEB
-    if (tBUTO||tTRPE) cout<<"Recompute2 : parmin,parmax "<<f<<","<<l<<endl;
-    if (tBUTO||tTRPE) cout<<"                   --> parmin,parmax "<<parmin<<","<<parmax<<endl;
-#endif
   }
   
   Standard_Real tolreached3d = C.Tolerance();
@@ -945,10 +750,6 @@ void TopOpeBRepDS_BuildTool::ComputePCurves
   }
   if (!PC1new.IsNull()) newC.Curve1(PC1new);
   if (!PC2new.IsNull()) newC.Curve2(PC2new);
-  
-#ifdef DEB
-  if (tBUTO) DUMPCURVES(C3Dnew,newC);
-#endif
 }
 
 //=======================================================================
@@ -999,19 +800,14 @@ void  TopOpeBRepDS_BuildTool::RecomputeCurves
   const Standard_Boolean approx = Approximation();
   
   const Handle(Geom_Curve)& C3D = C.Curve();
-  if (comppc1 && C.Shape1().IsNull()) Standard_ProgramError::Raise
-    ("TopOpeBRepDS_BuildTool::RecomputeCurve 2");
-  if (comppc2 && C.Shape2().IsNull()) Standard_ProgramError::Raise
-    ("TopOpeBRepDS_BuildTool::RecomputeCurve 3");
+  if (comppc1 && C.Shape1().IsNull()) throw Standard_ProgramError("TopOpeBRepDS_BuildTool::RecomputeCurve 2");
+  if (comppc2 && C.Shape2().IsNull()) throw Standard_ProgramError("TopOpeBRepDS_BuildTool::RecomputeCurve 3");
   TopoDS_Vertex Vmin,Vmax; TopExp::Vertices(E,Vmin,Vmax);
-  if ( Vmin.IsNull() ) Standard_ProgramError::Raise
-    ("TopOpeBRepDS_BuildTool::RecomputeCurve 4");
-  if ( Vmax.IsNull() ) Standard_ProgramError::Raise
-    ("TopOpeBRepDS_BuildTool::RecomputeCurve 5");
+  if ( Vmin.IsNull() ) throw Standard_ProgramError("TopOpeBRepDS_BuildTool::RecomputeCurve 4");
+  if ( Vmax.IsNull() ) throw Standard_ProgramError("TopOpeBRepDS_BuildTool::RecomputeCurve 5");
   
   if (iswalk && approx) {
-    if (compc3d && C3D.IsNull()) Standard_ProgramError::Raise
-      ("TopOpeBRepDS_BuildTool::RecomputeCurve 1");
+    if (compc3d && C3D.IsNull()) throw Standard_ProgramError("TopOpeBRepDS_BuildTool::RecomputeCurve 1");
     ApproxCurves(C, E, inewC, HDS);
     TopOpeBRepDS_Curve& newC = HDS->ChangeCurve(inewC);
     PutPCurves(newC, E, comppc1, comppc2);
@@ -1028,8 +824,7 @@ void  TopOpeBRepDS_BuildTool::RecomputeCurves
       inewC = HDS->MakeCurve(C,newC1);
       TopOpeBRepDS_Curve& newC = HDS->ChangeCurve(inewC);
       if(iswalk && !approx) {
-       if (compc3d && C3D.IsNull()) Standard_ProgramError::Raise
-         ("TopOpeBRepDS_BuildTool::RecomputeCurve 1");
+       if (compc3d && C3D.IsNull()) throw Standard_ProgramError("TopOpeBRepDS_BuildTool::RecomputeCurve 1");
        newC.Curve1(C.Curve1());
        newC.Curve2(C.Curve2());
       }
@@ -1162,11 +957,6 @@ void  TopOpeBRepDS_BuildTool::Parameter(const TopoDS_Shape& E,
       if ( oV == TopAbs_REVERSED ) {
        if ( p < f ) {
          Standard_Real pp = ElCLib::InPeriod(p,f,f+per);
-#ifdef DEB
-         if (TopOpeBRepDS_GettraceBUTO() ) {
-           cout<<"BuildTool Parameter : "<<p<<" --> "<<pp<<endl;
-         }
-#endif
          p = pp;
        }
       }
@@ -1210,21 +1000,6 @@ void  TopOpeBRepDS_BuildTool::UpdateEdge(const TopoDS_Shape& Ein,
     if ( l2n <= f2n ) {
       ElCLib::AdjustPeriodic(f1,l1,Precision::PConfusion(),f2n,l2n);
       Range(Eou,f2n,l2n);
-#ifdef DEB
-      if (TopOpeBRepDS_GettraceBUTO() || TopOpeBRepDS_GettraceTRPE()) {
-       cout<<endl;
-       cout<<"UpdateEdge f1,l1   "<<f1<<" "<<l1<<endl;
-       cout<<"UpdateEdge f2,l2   "<<f2<<" "<<l2<<" "<<endl;
-       cout<<"UpdateEdge f2n,l2n "<<f2n<<" "<<l2n<<endl;
-       TopExp_Explorer ex;
-       for (ex.Init(Eou,TopAbs_VERTEX); ex.More(); ex.Next()) {
-         TopoDS_Vertex v = TopoDS::Vertex(ex.Current());
-         Standard_Real par = BRep_Tool::Parameter(v,TopoDS::Edge(Eou));
-         TopAbs_Orientation o = v.Orientation();
-         cout<<"BuildTool vertex ";TopAbs::Print(o,cout); cout<<" "<<par<<endl;
-       }
-      }
-#endif
     }
   }
 }
@@ -1339,16 +1114,6 @@ void TopOpeBRepDS_BuildTool::TranslateOnPeriodic
   du = u2 - u1, dv = v2 - v1;    
 
   if ( du != 0. || dv != 0.) {
-#ifdef DEB
-    if (TopOpeBRepDS_GettraceBUTO() || TopOpeBRepDS_GettraceTRPE()) {
-      cout<<endl;
-      cout<<"TranslateOnPeriodic :  Curve range "<<C3Df<<" "<<C3Dl<<endl;
-      Standard_Real PCf,PCl;
-      BRep_Tool::Range(TopoDS::Edge(E),TopoDS::Face(F),PCf,PCl);
-      cout<<"TranslateOnPeriodic : PCurve range "<<PCf<<" "<<PCl<<endl;
-      cout<<"TranslateOnPeriodic :  translation "<<du<<" "<<dv<<endl;
-    }
-#endif
     // translate curve PC of du,dv
     Handle(Geom2d_Curve) PCT = Handle(Geom2d_Curve)::DownCast(PC->Copy());
     PCT->Translate(gp_Vec2d(du,dv));
@@ -1387,34 +1152,6 @@ Standard_EXPORT void TopOpeBRepDS_SetThePCurve(const BRep_Builder& B,
   }
 }
 
-#ifdef DEB
-//------------------------------------------------------------------------
-static void DUMPPCURVE(const TopoDS_Edge& EE, 
-                      const TopoDS_Face& FF,
-                      const Handle(Geom2d_Curve)& PC)
-//------------------------------------------------------------------------
-{
-  TopLoc_Location L; Standard_Real Cf,Cl;
-  Handle(Geom_Curve) C = BRep_Tool::Curve(EE,L,Cf,Cl);
-  if (C->IsPeriodic()) {
-    cout<<endl;
-      cout<<"DUMPPCURVE  : ";cout<<" face "; ::PrintSurface(FF,cout); cout<<endl;
-      cout<<"PCurve type : ";TopOpeBRepDS_Dumper::PrintType(PC,cout); cout<<endl;
-    gp_Pnt oC; 
-    if (::GetOrigin(C,oC)) 
-      cout<<"(E)Curve origin : "<<oC.X()<<" "<<oC.Y()<<" "<<oC.Z()<<endl;
-      cout<<"(E)Curve range  : Cf,Cl = "<<Cf<<" "<<Cl<<endl;
-    
-    Standard_Real PCf,PCl;
-    PCf = PC->FirstParameter(); PCl = PC->LastParameter();
-    gp_Pnt2d oPC; 
-    if (::GetOrigin(PC,oPC))
-      cout<<"(PC)PCurve origin : "<<oPC.X()<<" "<<oPC.Y()<<endl;
-      cout<<"(PC)PCurve range  : PCf,PCl = "<<PCf<<" "<<PCl<<endl;
-  }
-}
-#endif
-
 //=======================================================================
 //function : PCurve
 //purpose  : 
@@ -1429,24 +1166,8 @@ void  TopOpeBRepDS_BuildTool::PCurve(TopoDS_Shape& F,
     TopoDS_Edge EE = TopoDS::Edge(E);
     Handle(Geom2d_Curve) PCT = PC;
 
-#ifdef DEB
-#ifdef DRAW
-    Standard_Boolean trc = Standard_False;
-    if (trc) FUN_draw(FF);
-    if (trc) FUN_draw(EE);
-    if (trc) FUN_draw(PC,0.);
-#endif
-    if (TopOpeBRepDS_GettraceTRPE()) DUMPPCURVE(EE,FF,PCT);
-#endif
-    
     // pour iab, ajout de Translate
     Standard_Boolean tran = myTranslate;
-#ifdef DEB
-    if ( TopOpeBRepDS_GettraceSANTRAN()) {
-      tran = Standard_False; 
-      cout<<"SANS translation de pcurve"<<endl; 
-    }
-#endif
 
     // xpu : 13-06-97 : 
     // recompute twice the pcurve boundaries if OverWrite
@@ -1475,10 +1196,6 @@ void  TopOpeBRepDS_BuildTool::PCurve(TopoDS_Shape& F,
       Standard_Real newpar = BRep_Tool::Parameter(vi,EE);
       myBuilder.UpdateVertex(vi,newpar,EE,FF,tolvi);
     } // INTERNAL vertex
-    
-#ifdef DEB
-    if (TopOpeBRepDS_GettraceTRPE()) DUMPPCURVE(EE,FF,PCT);
-#endif
   }
 }
 
@@ -1503,10 +1220,6 @@ void  TopOpeBRepDS_BuildTool::PCurve(TopoDS_Shape& F,
     
     TopLoc_Location L; Standard_Real Cf,Cl;
     Handle(Geom_Curve) C = BRep_Tool::Curve(EE,L,Cf,Cl);
-
-#ifdef DEB
-    if (TopOpeBRepDS_GettraceTRPE()) DUMPPCURVE(EE,FF,PCT);
-#endif
       
     if (!C.IsNull()){
       Standard_Boolean deca = (Abs(Cf - CDSmin) > Precision::PConfusion());
@@ -1532,10 +1245,6 @@ void  TopOpeBRepDS_BuildTool::PCurve(TopoDS_Shape& F,
     }
     
     TopOpeBRepDS_SetThePCurve(myBuilder,EE,FF,E.Orientation(),PCT);
-    
-#ifdef DEB
-    if (TopOpeBRepDS_GettraceTRPE()) DUMPPCURVE(EE,FF,PCT);
-#endif
   }
 }
 
@@ -1626,17 +1335,12 @@ void  TopOpeBRepDS_BuildTool::RecomputeCurve
   Standard_Boolean comppc2 = GT.CompPC2();
   
   const Handle(Geom_Curve)& C3D = C1.Curve();
-  if (compc3d && C3D.IsNull()) Standard_ProgramError::Raise
-    ("TopOpeBRepDS_BuildTool::RecomputeCurve 1");
-  if (comppc1 && C2.Shape1().IsNull()) Standard_ProgramError::Raise
-    ("TopOpeBRepDS_BuildTool::RecomputeCurve 2");
-  if (comppc2 && C2.Shape2().IsNull()) Standard_ProgramError::Raise
-    ("TopOpeBRepDS_BuildTool::RecomputeCurve 3");
+  if (compc3d && C3D.IsNull()) throw Standard_ProgramError("TopOpeBRepDS_BuildTool::RecomputeCurve 1");
+  if (comppc1 && C2.Shape1().IsNull()) throw Standard_ProgramError("TopOpeBRepDS_BuildTool::RecomputeCurve 2");
+  if (comppc2 && C2.Shape2().IsNull()) throw Standard_ProgramError("TopOpeBRepDS_BuildTool::RecomputeCurve 3");
   TopoDS_Vertex Vmin,Vmax; TopExp::Vertices(TopoDS::Edge(E),Vmin,Vmax);
-  if ( Vmin.IsNull() ) Standard_ProgramError::Raise
-    ("TopOpeBRepDS_BuildTool::RecomputeCurve 4");
-  if ( Vmax.IsNull() ) Standard_ProgramError::Raise
-    ("TopOpeBRepDS_BuildTool::RecomputeCurve 5");
+  if ( Vmin.IsNull() ) throw Standard_ProgramError("TopOpeBRepDS_BuildTool::RecomputeCurve 4");
+  if ( Vmax.IsNull() ) throw Standard_ProgramError("TopOpeBRepDS_BuildTool::RecomputeCurve 5");
 
   Standard_Boolean kbspl1 = Standard_False;
   Handle(Geom_BSplineCurve) BS = Handle(Geom_BSplineCurve)::DownCast(C3D);
@@ -1655,11 +1359,6 @@ void  TopOpeBRepDS_BuildTool::RecomputeBSpline1Curve
  TopoDS_Shape& EE,
  TopOpeBRepDS_Curve& C2) const
 {
-#ifdef DEB
-  Standard_Boolean tDSNC = TopOpeBRepDS_GettraceDSNC();
-  Standard_Boolean tBUTO = TopOpeBRepDS_GettraceBUTO();
-#endif
-  
   // C1 curves have been approximated by BSplines of degree 1 :
   // compute new geometry on curves.
 
@@ -1681,14 +1380,10 @@ void  TopOpeBRepDS_BuildTool::RecomputeBSpline1Curve
   // Vmin,Vmax = bounding vertices of edge <E>
   // and their parameters parmin,parmax .
 
-  TopoDS_Vertex Vmin,Vmax; Standard_Real parmin,parmax;
-  ::GetOrientedEdgeVertices(E,Vmin,Vmax,parmin,parmax);
+  TopoDS_Vertex Vmin, Vmax;
+  Standard_Real parmin = 0.0, parmax = 0.0;
+  ::GetOrientedEdgeVertices (E, Vmin, Vmax, parmin, parmax);
 
-#ifdef DEB
-  if (tBUTO) cout<<"Recompute1 min,max = "<<parmin<<","<<parmax<<endl;
-  if (tBUTO) DUMPCURVES(C3D,C1);
-#endif
-  
   Handle(Geom_Curve)   C3Dnew;
   Handle(Geom2d_Curve) PC1new;
   Handle(Geom2d_Curve) PC2new;
@@ -1710,7 +1405,7 @@ void  TopOpeBRepDS_BuildTool::RecomputeBSpline1Curve
   }
 
   else if ( typec3d == TopOpeBRepTool_APPROX ) {
-    if (!comppc1 || !comppc2) Standard_NotImplemented::Raise("DSBuildToolAPPROX");
+    if (!comppc1 || !comppc2) throw Standard_NotImplemented("DSBuildToolAPPROX");
     myCurveTool.MakeCurves(parmin,parmax,
                           C3D,PC1,PC2,F1,F2,
                           C3Dnew,PC1new,PC2new,
@@ -1718,7 +1413,7 @@ void  TopOpeBRepDS_BuildTool::RecomputeBSpline1Curve
   }
 
   else if ( typec3d == TopOpeBRepTool_INTERPOL ) {
-    Standard_NotImplemented::Raise("DSBuildToolINTERPOL");
+    throw Standard_NotImplemented("DSBuildToolINTERPOL");
   }
 
   Standard_Real newtol,newparmin,newparmax;
@@ -1745,12 +1440,6 @@ void  TopOpeBRepDS_BuildTool::RecomputeCurveOnCone
    TopoDS_Shape&             EE,
    TopOpeBRepDS_Curve&       C2 ) const
 {
-#ifdef DEB
-  Standard_Boolean tDSNC = TopOpeBRepDS_GettraceDSNC();
-  Standard_Boolean tBUTO = TopOpeBRepDS_GettraceBUTO();
-  Standard_Boolean tTRPE = TopOpeBRepDS_GettraceTRPE();
-#endif
-  
   // C1 Pcurves have not been computed because C1 Curve is not projectable
   // on one at least of the intersecting faces giving C1 Curve.
   // (see TopOpeBRepTool_CurveTool::IsProjectable())
@@ -1772,14 +1461,9 @@ void  TopOpeBRepDS_BuildTool::RecomputeCurveOnCone
 
   // get bounding vertices Vmin,Vmax supported by the new edge <E>
   // and their corresponding parameters parmin,parmax .
-
-  TopoDS_Vertex Vmin,Vmax; Standard_Real parmin,parmax;
-  ::GetOrientedEdgeVertices(E,Vmin,Vmax,parmin,parmax);
-
-#ifdef DEB
-  if (tBUTO) {cout<<"Recompute2 min,max = "<<parmin<<","<<parmax<<endl;
-             DUMPCURVES(C3D,C1);}
-#endif
+  TopoDS_Vertex Vmin, Vmax;
+  Standard_Real parmin = 0.0, parmax = 0.0;
+  ::GetOrientedEdgeVertices (E, Vmin, Vmax, parmin, parmax);
 
   if ( C3D->IsPeriodic() ) {
     // ellipse on cone : periodize parmin,parmax
@@ -1789,10 +1473,6 @@ void  TopOpeBRepDS_BuildTool::RecomputeCurveOnCone
     else {                                      f = parmax; l = parmin; }
     parmin = f; parmax = l;
     ElCLib::AdjustPeriodic(f,f+period,Precision::PConfusion(),parmin,parmax);
-#ifdef DEB
-    if (tBUTO||tTRPE) cout<<"Recompute2 : parmin,parmax "<<f<<","<<l<<endl;
-    if (tBUTO||tTRPE) cout<<"                   --> parmin,parmax "<<parmin<<","<<parmax<<endl;
-#endif
   }
   
   Handle(Geom_TrimmedCurve) C3Dnew;
@@ -1828,9 +1508,6 @@ void  TopOpeBRepDS_BuildTool::RecomputeCurveOnCone
 //    Standard_Real isrev1 = 
 //      ::FUN_reversePC(PC1new,F1,P3DC3D,par2d,tol);
 //    
-//#ifdef DEB
-//    if (tBUTO && isrev1) cout<<"on retourne PC1"<<endl;
-//#endif
 //
 //  }
 //
@@ -1840,9 +1517,6 @@ void  TopOpeBRepDS_BuildTool::RecomputeCurveOnCone
 //    Standard_Real isrev2 = 
 //     ::FUN_reversePC(PC2new,F2,P3DC3D,par2d,tol);
 //
-//#ifdef DEB
-//    if (tBUTO && isrev2) cout<<"on retourne PC2"<<endl;
-//#endif
 //  }
 
   // xpu : 17-06-97
@@ -1863,10 +1537,4 @@ void  TopOpeBRepDS_BuildTool::RecomputeCurveOnCone
   if (!C3Dnew.IsNull()) C2.Curve(C3Dnew,newtol);
   if (!PC1new.IsNull()) C2.Curve1(PC1new);
   if (!PC2new.IsNull()) C2.Curve2(PC2new);
-  
-#ifdef DEB
-  if (tBUTO) DUMPCURVES(C3Dnew,C2);
-#endif
 }*/ // - merge 04-07-97
-
-