0027772: Foundation Classes - define Standard_Boolean using C++ type "bool" instead...
[occt.git] / src / StepToTopoDS / StepToTopoDS_TranslateEdge.cxx
index d128b3e..fe3814e 100644 (file)
 //:o0 abv 16.02.99: POLYLINE allowed as 3d curve of edge
 //gka,abv 05.04.99: S4136: improving tolerance management, eliminate BRepAPI::Precision()
 
-#include <StepToTopoDS_TranslateEdge.ixx>
-
-#include <StepToTopoDS.hxx>
-#include <StepToTopoDS_TranslateVertex.hxx>
-#include <StepToTopoDS_GeometricTool.hxx>
-#include <StepToGeom_MakeCurve.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
 #include <BRep_Builder.hxx>
 #include <BRep_Tool.hxx>
 #include <BRepLib.hxx>
 #include <BRepLib_MakeEdge.hxx>
+#include <GCPnts_AbscissaPoint.hxx>
+#include <Geom2d_Curve.hxx>
+#include <Geom_CartesianPoint.hxx>
 #include <Geom_Curve.hxx>
-#include <GeomAbs_Shape.hxx>
-
 #include <Geom_Line.hxx>
-#include <gp_Vec.hxx>
+#include <Geom_Surface.hxx>
+#include <GeomAbs_Shape.hxx>
+#include <GeomAdaptor_Curve.hxx>
 #include <gp_Dir.hxx>
 #include <gp_Lin.hxx>
-
+#include <gp_Vec.hxx>
+#include <Precision.hxx>
 #include <ShapeAnalysis_Curve.hxx>
 #include <ShapeConstruct_Curve.hxx>
-
-#include <StepShape_EdgeCurve.hxx>
-#include <StepShape_OrientedEdge.hxx>
+#include <StdFail_NotDone.hxx>
+#include <StepGeom_CartesianPoint.hxx>
 #include <StepGeom_Curve.hxx>
-//#include <StepGeom_Polyline.hxx>
 #include <StepGeom_Pcurve.hxx>
+#include <StepGeom_Polyline.hxx>
 #include <StepGeom_SurfaceCurve.hxx>
-#include <Transfer_TransientProcess.hxx>
-//#include <TransferBRep.hxx>
-
-#include <GeomAdaptor_Curve.hxx>
-#include <GCPnts_AbscissaPoint.hxx>
-#include <Precision.hxx>
-
-#include <StepToGeom_MakeCurve2d.hxx>
 #include <StepRepr_DefinitionalRepresentation.hxx>
+#include <StepShape_Edge.hxx>
+#include <StepShape_EdgeCurve.hxx>
+#include <StepShape_OrientedEdge.hxx>
+#include <StepShape_Vertex.hxx>
+#include <StepShape_VertexPoint.hxx>
+#include <StepToGeom.hxx>
+#include <StepToTopoDS.hxx>
+#include <StepToTopoDS_GeometricTool.hxx>
+#include <StepToTopoDS_NMTool.hxx>
+#include <StepToTopoDS_Tool.hxx>
+#include <StepToTopoDS_TranslateEdge.hxx>
+#include <StepToTopoDS_TranslateVertex.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <Transfer_TransientProcess.hxx>
 #include <UnitsMethods.hxx>
+#include <Standard_Failure.hxx>
 
+//#include <StepGeom_Polyline.hxx>
+//#include <TransferBRep.hxx>
 //:d8
-#include <StepShape_VertexPoint.hxx>
-#include <StepGeom_CartesianPoint.hxx>
-#include <StepToGeom_MakeCartesianPoint.hxx>
-#include <Geom_CartesianPoint.hxx>
-
 // Used in I-DEAS-like STP processing (ssv; 15.11.2010)
-#include <TCollection_HAsciiString.hxx>
-#include <StepGeom_Polyline.hxx>
-
 //#define DEBUG
-
-
 // ============================================================================
 // Method  : DecodeMakeEdgeError
 // Purpose : 
 // ============================================================================
-
 static void DecodeMakeEdgeError(const BRepLib_MakeEdge&   ME,
                                const Handle(Standard_Transient)& orig,
                                const Handle(Geom_Curve)& myCurve,
@@ -153,7 +149,8 @@ static Handle(Geom_Curve) MakeCurve
 {
   Handle(Geom_Curve) C2 = Handle(Geom_Curve)::DownCast (TP->FindTransient(C1));
   if (!C2.IsNull()) return C2;
-  if (StepToGeom_MakeCurve::Convert(C1,C2))
+  C2 = StepToGeom::MakeCurve (C1);
+  if (! C2.IsNull())
     TP->BindTransient (C1,C2);
   return C2;
 }
@@ -378,13 +375,12 @@ static void GetCartesianPoints ( const Handle(StepShape_EdgeCurve)& EC,
                                 gp_Pnt &P1, gp_Pnt &P2)
 {
   for ( Standard_Integer i=1; i<=2; i++ ) {
-    const Handle(StepShape_Vertex) V = ( (Standard_Boolean)(i==1) == EC->SameSense() ? EC->EdgeStart() : EC->EdgeEnd() );
+    const Handle(StepShape_Vertex) V = ((i == 1) == EC->SameSense() ? EC->EdgeStart() : EC->EdgeEnd() );
     const Handle(StepShape_VertexPoint) VP = Handle(StepShape_VertexPoint)::DownCast(V);
     if ( VP.IsNull() ) continue;
     const Handle(StepGeom_CartesianPoint) P = Handle(StepGeom_CartesianPoint)::DownCast(VP->VertexGeometry());
-    Handle(Geom_CartesianPoint) CP;
-    StepToGeom_MakeCartesianPoint::Convert(P,CP);
-       ( i==1 ? P1 : P2 ) = CP->Pnt();
+    Handle(Geom_CartesianPoint) CP = StepToGeom::MakeCartesianPoint (P);
+    ( i==1 ? P1 : P2 ) = CP->Pnt();
   }
 }
 
@@ -506,10 +502,19 @@ Handle(Geom2d_Curve)  StepToTopoDS_TranslateEdge::MakePCurve
   const Handle(StepRepr_DefinitionalRepresentation) DRI = PCU->ReferenceToCurve();
   if( DRI.IsNull()) return C2d;
   const Handle(StepGeom_Curve) StepCurve = Handle(StepGeom_Curve)::DownCast(DRI->ItemsValue(1));
-  if (StepToGeom_MakeCurve2d::Convert(StepCurve,C2d)) {
+  try
+  {
+    C2d = StepToGeom::MakeCurve2d (StepCurve);
+    if (! C2d.IsNull()) {
     // -- if the surface is a RectangularTrimmedSurface, 
     // -- send the BasisSurface.
-    C2d = UnitsMethods::DegreeToRadian(C2d, ConvSurf);
+     C2d = UnitsMethods::DegreeToRadian(C2d, ConvSurf);
+    }
+    
+  }
+  catch(Standard_Failure)
+  {
+    return C2d;
   }
   return C2d;
 }