0030153: Visualization, TKOpenGl - AIS_ColoredShape::SynchronizeAspects() doesn't...
[occt.git] / src / ChFi3d / ChFi3d_Builder.cxx
index aba1d73..9514f7c 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <ChFi3d_Builder.ixx>
 
+#include <Adaptor2d_HCurve2d.hxx>
+#include <Adaptor3d_HSurface.hxx>
+#include <Adaptor3d_TopolTool.hxx>
+#include <AppBlend_Approx.hxx>
+#include <Blend_CurvPointFuncInv.hxx>
+#include <Blend_FuncInv.hxx>
+#include <Blend_Function.hxx>
+#include <Blend_RstRstFunction.hxx>
+#include <Blend_SurfCurvFuncInv.hxx>
+#include <Blend_SurfPointFuncInv.hxx>
+#include <Blend_SurfRstFunction.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepAdaptor_HCurve2d.hxx>
+#include <BRepAdaptor_HSurface.hxx>
+#include <BRepBlend_Line.hxx>
+#include <BRepLib.hxx>
+#include <BRepTopAdaptor_TopolTool.hxx>
+#include <ChFi3d.hxx>
+#include <ChFi3d_Builder.hxx>
+#include <ChFi3d_Builder_0.hxx>
+#include <ChFiDS_CommonPoint.hxx>
+#include <ChFiDS_HData.hxx>
+#include <ChFiDS_HElSpine.hxx>
+#include <ChFiDS_ListIteratorOfListOfStripe.hxx>
+#include <ChFiDS_SequenceOfSurfData.hxx>
+#include <ChFiDS_Spine.hxx>
+#include <ChFiDS_Stripe.hxx>
+#include <ChFiDS_SurfData.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Geom_Surface.hxx>
+#include <gp_Pnt2d.hxx>
+#include <Precision.hxx>
+#include <ShapeFix.hxx>
+#include <Standard_ConstructionError.hxx>
+#include <Standard_ErrorHandler.hxx>
 #include <Standard_Failure.hxx>
 #include <Standard_NoSuchObject.hxx>
 #include <Standard_NotImplemented.hxx>
-#include <Standard_ErrorHandler.hxx>
+#include <Standard_OutOfRange.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
 #include <TColStd_MapIteratorOfMapOfInteger.hxx>
 #include <TColStd_MapOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Vertex.hxx>
-
 #include <TopAbs.hxx>
-#include <TopAbs_ShapeEnum.hxx>
 #include <TopAbs_Orientation.hxx>
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
+#include <TopAbs_ShapeEnum.hxx>
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopOpeBRepBuild_HBuilder.hxx>
+#include <TopOpeBRepDS_BuildTool.hxx>
+#include <TopOpeBRepDS_Curve.hxx>
 #include <TopOpeBRepDS_CurveExplorer.hxx>
 #include <TopOpeBRepDS_CurvePointInterference.hxx>
 #include <TopOpeBRepDS_DataStructure.hxx>
-#include <TopOpeBRepDS_BuildTool.hxx>
-#include <TopOpeBRepDS_Curve.hxx>
+#include <TopOpeBRepDS_HDataStructure.hxx>
+#include <TopOpeBRepDS_ListOfInterference.hxx>
 #include <TopOpeBRepDS_PointIterator.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
 
-#include <BRep_Tool.hxx>
-#include <ChFiDS_Stripe.hxx>
-#include <ChFiDS_ListIteratorOfListOfStripe.hxx>
-#include <ChFiDS_SequenceOfSurfData.hxx>
-#include <ChFiDS_HData.hxx>
-
-#include <ChFi3d.hxx>
-
-#include <ChFi3d_Builder_0.hxx>
-#include <TopOpeBRepDS_ListOfInterference.hxx>
-#include <BRepLib.hxx>
-#include <ShapeFix.hxx>
-#include <Precision.hxx>
-
-#ifdef DRAW
-#include <TestTopOpeTools.hxx>
-#include <TestTopOpe.hxx>
-#endif
-#ifdef DEB
+#ifdef OCCT_DEBUG
 #include <OSD_Chronometer.hxx>
 
 
@@ -149,7 +163,12 @@ static void CompleteDS(TopOpeBRepDS_DataStructure& DStr,
   }
 }
 
-void ChFi3d_Builder::Delete()
+//=======================================================================
+//function : ~ChFi3d_Builder
+//purpose  : 
+//=======================================================================
+
+ChFi3d_Builder::~ChFi3d_Builder()
 {}
 
 //=======================================================================
@@ -163,7 +182,8 @@ void ChFi3d_Builder::ExtentAnalyse ()
   for (Standard_Integer iv = 1; iv <= myVDataMap.Extent(); iv++) {
     nbs = myVDataMap(iv).Extent();
     const TopoDS_Vertex& Vtx = myVDataMap.FindKey(iv);
-    nbedges = ChFi3d_NumberOfEdges(Vtx, myVEMap); 
+    //nbedges = ChFi3d_NumberOfEdges(Vtx, myVEMap); 
+    nbedges = ChFi3d_NumberOfSharpEdges(Vtx, myVEMap, myEFMap); 
     switch (nbs) {
     case 1 :
       ExtentOneCorner(Vtx, myVDataMap.FindFromIndex(iv).First());
@@ -190,7 +210,7 @@ void ChFi3d_Builder::ExtentAnalyse ()
 void  ChFi3d_Builder::Compute()
 {
   
-#ifdef DEB   //perf 
+#ifdef OCCT_DEBUG   //perf 
   t_total=0;t_extent=0; t_perfsetofsurf=0;t_perffilletonvertex=0;
   t_filds=0;t_reconstruction=0;t_setregul=0;
   t_perfsetofkpart=0; t_perfsetofkgen=0;t_makextremities=0;
@@ -206,18 +226,13 @@ void  ChFi3d_Builder::Compute()
 #endif 
   
   if (myListStripe.IsEmpty())
-    Standard_Failure::Raise("There are no suitable edges for chamfer or fillet");
+    throw Standard_Failure("There are no suitable edges for chamfer or fillet");
   
   Reset();
   myDS = new TopOpeBRepDS_HDataStructure();
   TopOpeBRepDS_DataStructure& DStr = myDS->ChangeDS();
   done = Standard_True;
   hasresult=Standard_False;
-#ifdef DRAW
-  TestTopOpe::CurrentDS(myDS);
-  TopoDS_Shape bids;
-  TestTopOpe::Shapes(myShape,bids);
-#endif
   
   // filling of myVDatatMap
   ChFiDS_ListIteratorOfListOfStripe itel;
@@ -236,7 +251,7 @@ void  ChFi3d_Builder::Compute()
   ExtentAnalyse();
   
   
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
   ChFi3d_ResultChron(cl_extent,t_extent);
   ChFi3d_InitChron(cl_perfsetofsurf);
 #endif
@@ -248,11 +263,11 @@ void  ChFi3d_Builder::Compute()
       OCC_CATCH_SIGNALS
       PerformSetOfSurf(itel.Value());
     }
-    catch(Standard_Failure) {
-      Handle(Standard_Failure) exc = Standard_Failure::Caught();
-#ifdef CHFI3D_DEB
-      cout <<"EXCEPTION Stripe compute " << exc << endl;
+    catch(Standard_Failure const& anException) {
+#ifdef OCCT_DEBUG
+      cout <<"EXCEPTION Stripe compute " << anException << endl;
 #endif
+      (void)anException;
       badstripes.Append(itel.Value());
       done = Standard_True;
       if (itel.Value()->Spine()->ErrorStatus()==ChFiDS_Ok) 
@@ -263,7 +278,7 @@ void  ChFi3d_Builder::Compute()
   }
   done = (badstripes.IsEmpty());
   
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
   ChFi3d_ResultChron(cl_perfsetofsurf,t_perfsetofsurf);
   ChFi3d_InitChron(cl_perffilletonvertex);
 #endif 
@@ -278,12 +293,11 @@ void  ChFi3d_Builder::Compute()
         OCC_CATCH_SIGNALS
         PerformFilletOnVertex(j);
       }
-      catch(Standard_Failure)
-      {
-        Handle(Standard_Failure) exc = Standard_Failure::Caught();
-#ifdef CHFI3D_DEB
-        cout <<"EXCEPTION Corner compute " << exc << endl;
+      catch(Standard_Failure const& anException) {
+#ifdef OCCT_DEBUG
+        cout <<"EXCEPTION Corner compute " << anException << endl;
 #endif
+        (void)anException;
         badvertices.Append(myVDataMap.FindKey(j));
         hasresult=Standard_False;
         done = Standard_True;
@@ -295,7 +309,7 @@ void  ChFi3d_Builder::Compute()
   }
   
 
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
   ChFi3d_ResultChron(cl_perffilletonvertex,t_perffilletonvertex);
   ChFi3d_InitChron(cl_filds);
 #endif
@@ -334,11 +348,11 @@ void  ChFi3d_Builder::Compute()
          OCC_CATCH_SIGNALS
          ChFi3d_StripeEdgeInter (st, aCheckStripe, DStr, tol2d);
        }
-       catch(Standard_Failure) {
-         Handle(Standard_Failure) exc = Standard_Failure::Caught();
-#ifdef CHFI3D_DEB
-         cout <<"EXCEPTION Fillets compute " << exc << endl;
+       catch(Standard_Failure const& anException) {
+#ifdef OCCT_DEBUG
+         cout <<"EXCEPTION Fillets compute " << anException << endl;
 #endif
+         (void)anException;
          badstripes.Append(itel.Value());
          hasresult=Standard_False;
          done = Standard_False;
@@ -351,7 +365,7 @@ void  ChFi3d_Builder::Compute()
       if (!done) break;
     }
     
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
     ChFi3d_ResultChron(cl_filds,t_filds);
     ChFi3d_InitChron(cl_reconstruction);
 #endif
@@ -466,7 +480,7 @@ void  ChFi3d_Builder::Compute()
        }
       }
       }
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
       ChFi3d_ResultChron(cl_reconstruction ,t_reconstruction);
       ChFi3d_InitChron(cl_setregul);
 #endif
@@ -475,19 +489,19 @@ void  ChFi3d_Builder::Compute()
       SetRegul();
       
       
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
  ChFi3d_ResultChron(cl_setregul ,t_setregul);
 #endif
     }
   }
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
   ChFi3d_ResultChron(cl_total,t_total);
 #endif
       
   
   // display of time for perfs 
   
-#ifdef DEB  
+#ifdef OCCT_DEBUG
   if(ChFi3d_GettraceCHRON()){
     cout<<endl; 
     cout<<"COMPUTE: temps total "<<t_total<<"s  dont :"<<endl;
@@ -692,7 +706,7 @@ void ChFi3d_Builder::PerformFilletOnVertex
     if (BRep_Tool::Degenerated(cur)) nba--;
   }
   nba=nba/2;*/
-  Standard_Integer nba = ChFi3d_NumberOfEdges(Vtx, myVEMap);
+  Standard_Integer nba = ChFi3d_NumberOfSharpEdges(Vtx, myVEMap, myEFMap);
 
   if (nondegenere) { // Normal processing
     switch (i) {
@@ -700,22 +714,22 @@ void ChFi3d_Builder::PerformFilletOnVertex
       {
        if(sp->Status(isfirst) == ChFiDS_FreeBoundary) return; 
        if(nba>3) {
-#ifdef DEB //perf    
+#ifdef OCCT_DEBUG //perf    
          ChFi3d_InitChron(cl_performatend);
 #endif
          PerformIntersectionAtEnd(Index);
-#ifdef DEB    
+#ifdef OCCT_DEBUG
          ChFi3d_ResultChron(cl_performatend,t_performatend);
 #endif 
        }
        else { 
-#ifdef DEB //perf    
+#ifdef OCCT_DEBUG //perf    
          ChFi3d_InitChron(cl_perform1corner);
 #endif
           if (MoreSurfdata(Index))
              PerformMoreSurfdata(Index);
          else PerformOneCorner(Index);
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
          ChFi3d_ResultChron(cl_perform1corner,t_perform1corner);
 #endif  
        }
@@ -724,20 +738,20 @@ void ChFi3d_Builder::PerformFilletOnVertex
     case 2 : 
       {
        if(nba>3){
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
          ChFi3d_InitChron(cl_performmore3corner);
 #endif
          PerformMoreThreeCorner(Index, i);
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
          ChFi3d_ResultChron(cl_performmore3corner,t_performmore3corner);
 #endif
        }
        else { 
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
          ChFi3d_InitChron(cl_perform2corner);
 #endif
          PerformTwoCorner(Index);
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
          ChFi3d_ResultChron(cl_perform2corner,t_perform2corner);
 #endif
        }
@@ -746,31 +760,31 @@ void ChFi3d_Builder::PerformFilletOnVertex
     case 3 : 
       {
        if(nba>3){
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
          ChFi3d_InitChron(cl_performmore3corner);
 #endif
          PerformMoreThreeCorner(Index, i);
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
          ChFi3d_ResultChron(cl_performmore3corner,t_performmore3corner);
 #endif
        }
        else {
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
          ChFi3d_InitChron(cl_perform3corner);
 #endif
          PerformThreeCorner(Index);
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
          ChFi3d_ResultChron(cl_perform3corner,t_perform3corner);
 #endif
        }
       }
       break;
       default : {
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
        ChFi3d_InitChron(cl_performmore3corner);
 #endif
        PerformMoreThreeCorner(Index, i);
-#ifdef DEB //perf 
+#ifdef OCCT_DEBUG //perf 
        ChFi3d_ResultChron(cl_performmore3corner,t_performmore3corner);
 #endif
       }