0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepLib / BRepLib_MakeShell.cxx
index 646cbc3..c866cb7 100644 (file)
@@ -5,8 +5,8 @@
 //
 // This file is part of Open CASCADE Technology software library.
 //
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
 // by the Free Software Foundation, with special exception defined in the file
 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
 // distribution for complete text of the license and disclaimer of any warranty.
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <BRepLib_MakeShell.ixx>
 
+#include <BRep_Builder.hxx>
 #include <BRepLib.hxx>
-#include <Precision.hxx>
-#include <TColStd_Array1OfReal.hxx>
-
-#include <Geom_RectangularTrimmedSurface.hxx>
-#include <Geom_BSplineSurface.hxx>
+#include <BRepLib_MakeFace.hxx>
+#include <BRepLib_MakeShell.hxx>
 #include <Geom2d_Line.hxx>
+#include <Geom_BSplineSurface.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+#include <Geom_Surface.hxx>
 #include <GeomAdaptor_Surface.hxx>
-#include <TColGeom2d_Array1OfCurve.hxx>
 #include <gp_Pnt.hxx>
-
+#include <Precision.hxx>
+#include <StdFail_NotDone.hxx>
+#include <TColGeom2d_Array1OfCurve.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TopExp_Explorer.hxx>
 #include <TopoDS.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Wire.hxx>
 #include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shell.hxx>
 #include <TopoDS_Vertex.hxx>
+#include <TopoDS_Wire.hxx>
 #include <TopTools_Array1OfShape.hxx>
-#include <BRep_Builder.hxx>
-
 
 //=======================================================================
 //function : BRepLib_MakeShell
 //purpose  : 
 //=======================================================================
-
 BRepLib_MakeShell::BRepLib_MakeShell() :
        myError(BRepLib_EmptyShell)
 {
@@ -353,6 +354,21 @@ void BRepLib_MakeShell::Init(const Handle(Geom_Surface)& S,
   // codage des courbes 3d et regularites.
   BRepLib::BuildCurves3d(myShape,tol);
   BRepLib::EncodeRegularity(myShape);
+  myShape.Closed (BRep_Tool::IsClosed (myShape));
+
+  // Additional checking for degenerated edges
+  Standard_Boolean isDegenerated;
+  Standard_Real aFirst, aLast;
+  Standard_Real aTol = Precision::Confusion();
+  Standard_Real anActTol;
+  TopExp_Explorer anExp(myShape, TopAbs_EDGE);
+  for ( ; anExp.More(); anExp.Next())
+  {
+    const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current());
+    Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
+    isDegenerated = BRepLib_MakeFace::IsDegenerated(aCurve, aTol, anActTol);
+    B.Degenerated(anEdge, isDegenerated);
+  }
   
   myError = BRepLib_ShellDone;
   Done();