]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/GEOMImpl/GEOMImpl_FillingDriver.cxx
Salome HOME
Backward compatibility OCCT < 6.8.0
[modules/geom.git] / src / GEOMImpl / GEOMImpl_FillingDriver.cxx
index 77d2295402d02a4dba492833a25b08077627a424..9dc5092bd48d13cffe13496687e7ba2ce6d7ef4c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -135,91 +135,16 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
   for (; It.More(); It.Next()) {
     Scurrent = It.Value();
     if (Scurrent.ShapeType() != TopAbs_EDGE) {
-      Handle(Geom_BSplineCurve) newC;
-      if (Scurrent.ShapeType() == TopAbs_WIRE) {
-        TColgp_SequenceOfPnt PntSeq;
-        // collect points
-        for (Ex.Init(Scurrent, TopAbs_EDGE); Ex.More(); Ex.Next()) {
-          TopoDS_Edge E = TopoDS::Edge(Ex.Current());
-          if (BRep_Tool::Degenerated(E)) continue;
-          C = BRep_Tool::Curve(E, First, Last);
-          if( E.Orientation() == TopAbs_REVERSED ) {
-            C->Reverse();
-          }
-          Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(C);
-          while( !tc.IsNull() ) {
-            C = tc->BasisCurve();
-            tc = Handle(Geom_TrimmedCurve)::DownCast(C);
-          }
-          int nbp = 10;
-          if( C->IsKind(STANDARD_TYPE(Geom_Line)) ) {
-            nbp = 4;
-          }
-          else if( C->IsKind(STANDARD_TYPE(Geom_Circle)) || 
-                   C->IsKind(STANDARD_TYPE(Geom_Ellipse)) ) {
-            nbp = (int)25*fabs(Last-First)/(2.*M_PI);
-          }
-          else if( C->IsKind(STANDARD_TYPE(Geom_BezierCurve)) ) {
-            Handle(Geom_BezierCurve) C3d = Handle(Geom_BezierCurve)::DownCast(C);
-            nbp = C3d->NbPoles();
-          }
-          else if( C->IsKind(STANDARD_TYPE(Geom_BSplineCurve)) ) {
-            Handle(Geom_BSplineCurve) C3d = Handle(Geom_BSplineCurve)::DownCast(C);
-            nbp = C3d->NbPoles();
-          }
-          else {
-          }
-          if( nbp<4 ) nbp = 4;
-          double dp = (Last-First)/(nbp-1);
-          for(int i=1; i<nbp; i++) {
-            gp_Pnt P;
-            C->D0(First+dp*(i-1),P);
-            PntSeq.Append(P);
-          }
-        }
-        // add last point
-        gp_Pnt P;
-        C->D0(Last,P);
-        PntSeq.Append(P);
-        // create BSpline 
-        if(PntSeq.Length()>1) {
-          TColgp_Array1OfPnt Pnts(1,PntSeq.Length());
-          // check orientation of wire
-          if( Scurrent.Orientation() == TopAbs_REVERSED ) {
-            for(int i=1; i<=PntSeq.Length(); i++) {
-              Pnts.SetValue(PntSeq.Length()-i+1,PntSeq.Value(i));
-            }
-          }
-          else {
-            for(int i=1; i<=PntSeq.Length(); i++) {
-              Pnts.SetValue(i,PntSeq.Value(i));
-            }
-          }
-          GeomAPI_PointsToBSpline PTB (Pnts);
-          newC = Handle(Geom_BSplineCurve)::DownCast(PTB.Curve());
-          // set periodic flag if curve is closed
-          //if( newC->IsClosed() ) {
-          //  newC->SetPeriodic();
-          //}
-          // create edge
-          double fp = newC->FirstParameter();
-          double lp = newC->FirstParameter();
-          gp_Pnt PF,PL;
-          newC->D0(fp,PF);
-          newC->D0(lp,PL);
-          TopoDS_Vertex VF,VL;
-          B.MakeVertex(VF,PF,1.e-7);
-          B.MakeVertex(VL,PL,1.e-7);
-          TopoDS_Edge newE;
-          B.MakeEdge(newE,newC,1.e-7);
-          B.Add(newE,VF);
-          B.Add(newE,VL.Reversed());
-          Scurrent = newE;
-        }
+      TopoDS_Edge NewEdge;
+      if (Scurrent.ShapeType() == TopAbs_WIRE)
+      {
+        const TopoDS_Wire& CurWire = TopoDS::Wire(Scurrent);
+        NewEdge = BRepAlgo::ConcatenateWireC0(CurWire);
       }
-      if (newC.IsNull()) {
+      if (NewEdge.IsNull()) {
         Standard_ConstructionError::Raise("The argument compound must contain only edges");
       }
+      Scurrent = NewEdge;
     }
     B.Add(aComp,Scurrent);
   }
@@ -280,7 +205,7 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
     }
 
     /* a 'tolerance' is used to compare 2 knots : see GeomFill_Generator.cdl */
-    Section.Perform(Precision::Confusion());
+    Section.Perform(Precision::PConfusion());
     Handle(GeomFill_Line) Line = new GeomFill_Line(i);
 
     GeomFill_AppSurf App (mindeg, maxdeg, tol3d, tol2d, nbiter); /* user parameters */
@@ -294,11 +219,7 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
        App.SurfUMults(), App.SurfVMults(), App.UDegree(), App.VDegree());
 
     if (GBS.IsNull()) return 0;
-#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
     aShape = BRepBuilderAPI_MakeFace(GBS, Precision::Confusion());
-#else
-    aShape = BRepBuilderAPI_MakeFace(GBS);
-#endif
   }
   else {
     // implemented by skl 20.03.2008 for bug 16568
@@ -362,11 +283,7 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const
     }
     GeomAPI_PointsToBSplineSurface PTB (Points, mindeg, maxdeg, GeomAbs_C2, tol3d);
     Handle(Geom_BSplineSurface) BS = PTB.Surface();
-#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
     BRepBuilderAPI_MakeFace BB (BS, Precision::Confusion());
-#else
-    BRepBuilderAPI_MakeFace BB (BS);
-#endif
     TopoDS_Face NewF = BB.Face();
     Handle(ShapeFix_Face) sff = new ShapeFix_Face (NewF);
     sff->Perform();