1 // Created on: 1995-01-03
2 // Created by: Frederic MAUPAS
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16 
17 //:o0 abv 16.02.99: POLYLINE allowed as 3d curve of edge
18 //gka,abv 05.04.99: S4136: improving tolerance management, eliminate BRepAPI::Precision()
19 
20 #include <BRep_Builder.hxx>
21 #include <BRep_Tool.hxx>
22 #include <BRepLib.hxx>
23 #include <BRepLib_MakeEdge.hxx>
24 #include <GCPnts_AbscissaPoint.hxx>
25 #include <Geom2d_Curve.hxx>
26 #include <Geom_CartesianPoint.hxx>
27 #include <Geom_Curve.hxx>
28 #include <Geom_Line.hxx>
29 #include <Geom_Surface.hxx>
30 #include <GeomAbs_Shape.hxx>
31 #include <GeomAdaptor_Curve.hxx>
32 #include <gp_Dir.hxx>
33 #include <gp_Lin.hxx>
34 #include <gp_Vec.hxx>
35 #include <Precision.hxx>
36 #include <ShapeAnalysis_Curve.hxx>
37 #include <ShapeConstruct_Curve.hxx>
38 #include <StdFail_NotDone.hxx>
39 #include <StepData_GlobalFactors.hxx>
40 #include <StepGeom_CartesianPoint.hxx>
41 #include <StepGeom_Curve.hxx>
42 #include <StepGeom_Pcurve.hxx>
43 #include <StepGeom_Polyline.hxx>
44 #include <StepGeom_SurfaceCurve.hxx>
45 #include <StepRepr_DefinitionalRepresentation.hxx>
46 #include <StepShape_Edge.hxx>
47 #include <StepShape_EdgeCurve.hxx>
48 #include <StepShape_OrientedEdge.hxx>
49 #include <StepShape_Vertex.hxx>
50 #include <StepShape_VertexPoint.hxx>
51 #include <StepToGeom.hxx>
52 #include <StepToTopoDS.hxx>
53 #include <StepToTopoDS_GeometricTool.hxx>
54 #include <StepToTopoDS_NMTool.hxx>
55 #include <StepToTopoDS_Tool.hxx>
56 #include <StepToTopoDS_TranslateEdge.hxx>
57 #include <StepToTopoDS_TranslateVertex.hxx>
58 #include <TCollection_HAsciiString.hxx>
59 #include <TopoDS.hxx>
60 #include <TopoDS_Edge.hxx>
61 #include <TopoDS_Shape.hxx>
62 #include <TopoDS_Vertex.hxx>
63 #include <Transfer_TransientProcess.hxx>
64 #include <GeomConvert_Units.hxx>
65 #include <Standard_Failure.hxx>
66 
67 //#include <StepGeom_Polyline.hxx>
68 //#include <TransferBRep.hxx>
69 //:d8
70 // Used in I-DEAS-like STP processing (ssv; 15.11.2010)
71 //#define DEBUG
72 // ============================================================================
73 // Method  : DecodeMakeEdgeError
74 // Purpose :
75 // ============================================================================
DecodeMakeEdgeError(const BRepLib_MakeEdge & ME,const Handle (Standard_Transient)& orig,const Handle (Geom_Curve)& myCurve,const TopoDS_Vertex & V1,const TopoDS_Vertex & V2,const Standard_Real & U1,const Standard_Real & U2,StepToTopoDS_Tool & aTool,const Handle (StepShape_TopologicalRepresentationItem)&)76 static void DecodeMakeEdgeError(const BRepLib_MakeEdge&   ME,
77 				const Handle(Standard_Transient)& orig,
78 				const Handle(Geom_Curve)& myCurve,
79 				const TopoDS_Vertex&      V1,
80 				const TopoDS_Vertex&      V2,
81 				const Standard_Real&      U1,
82 				const Standard_Real&      U2,
83 				StepToTopoDS_Tool&   aTool,
84 				const Handle(StepShape_TopologicalRepresentationItem)& /*tobind*/)
85 {
86   (void)U1, (void)U2; // avoid compiler warning
87 
88   Handle(Transfer_TransientProcess) TP = aTool.TransientProcess();
89 
90 #ifdef OCCT_DEBUG
91   std::cout << "------------------------------------" << std::endl;
92   std::cout << "MakeEdge Error  : " << ME.Error()<<" - ";
93 #endif
94   switch(ME.Error())
95     {
96     case (BRepLib_EdgeDone): return;
97     case (BRepLib_PointProjectionFailed):
98       TP->AddFail(orig," Point Projection failed");
99       break;
100     case (BRepLib_ParameterOutOfRange):
101       TP->AddFail(orig," Parameter Out Of Range");
102       break;
103     case (BRepLib_DifferentPointsOnClosedCurve):
104       TP->AddFail(orig," Different Points on Closed Curve");
105       break;
106     case (BRepLib_PointWithInfiniteParameter):
107       TP->AddFail(orig," Point with infinite Parameter");
108       break;
109     case (BRepLib_DifferentsPointAndParameter):
110       if (!ShapeConstruct_Curve().AdjustCurve
111 	  (myCurve,BRep_Tool::Pnt(V1),BRep_Tool::Pnt(V2),Standard_True,Standard_True))
112 	TP->AddFail(orig," Different Points and Parameters");
113        else TP->AddWarning(orig,"Different Points and Parameters, adjusted");
114       break;
115     case (BRepLib_LineThroughIdenticPoints):
116       TP->AddFail(orig," Line through identic Points");
117       break;
118     }
119 #ifdef OCCT_DEBUG
120   std::cout << "Original Type   : " << orig->DynamicType() << std::endl;
121   std::cout << "3D Curve Type   : " << myCurve->DynamicType() << std::endl;
122   std::cout << "First Parameter : " << U1 << std::endl;
123   gp_Pnt p1 = BRep_Tool::Pnt(V1);
124 //  std::cout << "First Point     : ";
125   std::cout << "First Vertex    : "<<p1.X()<<"  "<<p1.Y()<<"  "<<p1.Z()<<"  ";
126   std::cout << "Distance Point - Vertex : ";
127   Standard_Real d1 = p1.Distance(myCurve->Value(U1));
128   std::cout << d1 << std::endl;
129   std::cout << "Last  Parameter : " << U2 << std::endl;
130   gp_Pnt p2 = BRep_Tool::Pnt(V2);
131 //  std::cout << "Last  Point     : ";
132   std::cout << "Last  Vertex    : "<<p2.X()<<"  "<<p2.Y()<<"  "<<p2.Z()<<"  ";
133   std::cout << "Distance Point - Vertex : ";
134   Standard_Real d2 = BRep_Tool::Pnt(V2).Distance(myCurve->Value(U2));
135   std::cout << d2 << std::endl;
136 #endif
137 }
138 
139 // ============================================================================
140 // Method  : StepToTopoDS_TranslateEdge::StepToTopoDS_TranslateEdge
141 // Purpose : Empty Constructor
142 // ============================================================================
143 
MakeCurve(const Handle (StepGeom_Curve)& C1,const Handle (Transfer_TransientProcess)TP)144 static Handle(Geom_Curve) MakeCurve
145   (const Handle(StepGeom_Curve)& C1, const Handle(Transfer_TransientProcess) TP)
146 {
147   Handle(Geom_Curve) C2 = Handle(Geom_Curve)::DownCast (TP->FindTransient(C1));
148   if (!C2.IsNull()) return C2;
149   C2 = StepToGeom::MakeCurve (C1);
150   if (! C2.IsNull())
151     TP->BindTransient (C1,C2);
152   return C2;
153 }
154 
MakeEdge(const Handle (Geom_Curve)& C3D,const TopoDS_Vertex & V1,const TopoDS_Vertex & V2,const Standard_Real U1,const Standard_Real U2)155 static TopoDS_Edge  MakeEdge
156   (const Handle(Geom_Curve)& C3D,
157    const TopoDS_Vertex& V1, const TopoDS_Vertex& V2,
158    const Standard_Real U1, const Standard_Real U2)
159 {
160   BRep_Builder B;
161   TopoDS_Edge E;
162   B.MakeEdge (E,C3D,Precision::Confusion());
163   B.Add (E,V1);  B.Add (E,V2);
164   B.UpdateVertex(V1, U1, E, 0.);
165   B.UpdateVertex(V2, U2, E, 0.);
166   return E;
167 }
168 
169 // ============================================================================
170 // Method  : StepToTopoDS_TranslateEdge::StepToTopoDS_TranslateEdge()
171 // Purpose :
172 // ============================================================================
173 
StepToTopoDS_TranslateEdge()174 StepToTopoDS_TranslateEdge::StepToTopoDS_TranslateEdge()
175 : myError(StepToTopoDS_TranslateEdgeOther)
176 {
177   done = Standard_False;
178 }
179 
180 // ============================================================================
181 // Method  : StepToTopoDS_TranslateEdge::StepToTopoDS_TranslateEdge()
182 // Purpose : Constructor with an Edge and a Tool
183 // ============================================================================
184 
StepToTopoDS_TranslateEdge(const Handle (StepShape_Edge)& E,StepToTopoDS_Tool & T,StepToTopoDS_NMTool & NMTool)185 StepToTopoDS_TranslateEdge::StepToTopoDS_TranslateEdge(const Handle(StepShape_Edge)& E,
186                                                        StepToTopoDS_Tool& T,
187                                                        StepToTopoDS_NMTool& NMTool)
188 {
189   Init(E, T, NMTool);
190 }
191 
192 // ============================================================================
193 // Method  : Init
194 // Purpose : Init with an Edge and a Tool.
195 //           This method builds an Edge With 2 Vertices and 2 Parameters.
196 //           The Edge is always build like FORWARD (BRepLib_MakeEdge)
197 // ============================================================================
198 
Init(const Handle (StepShape_Edge)& aEdge,StepToTopoDS_Tool & aTool,StepToTopoDS_NMTool & NMTool)199 void StepToTopoDS_TranslateEdge::Init(const Handle(StepShape_Edge)& aEdge,
200                                       StepToTopoDS_Tool& aTool,
201                                       StepToTopoDS_NMTool& NMTool)
202 {
203   Handle(Transfer_TransientProcess) TP = aTool.TransientProcess();
204 
205   Handle(StepShape_OrientedEdge) OE =
206     Handle(StepShape_OrientedEdge)::DownCast(aEdge);
207   Handle(StepShape_Edge) wEdge = aEdge;
208   if ( ! OE.IsNull() ) wEdge = OE->EdgeElement();
209   Handle(StepShape_EdgeCurve) EC = Handle(StepShape_EdgeCurve)::DownCast(wEdge);
210 
211   if (aTool.IsBound(EC)) {
212     myResult = aTool.Find(EC);
213     if (BRep_Tool::Degenerated(TopoDS::Edge(myResult))) {
214       TP->AddWarning(EC,"Degenerated Edge in several faces : transferred for each face");
215     }
216     else {
217       myError  = StepToTopoDS_TranslateEdgeDone;
218       done     = Standard_True;
219 //:S4136      B.SameRange(TopoDS::Edge(myResult), Standard_False);    //:a5 abv 11 Feb 98
220 //:S4136      B.SameParameter(TopoDS::Edge(myResult), Standard_False);//:a5
221       return;
222     }
223   }
224 
225   // [BEGIN] Proceed with non-manifold cases (ssv; 12.11.2010)
226   if ( NMTool.IsActive() && NMTool.IsBound(EC) ) {
227     TopoDS_Shape existingShape = NMTool.Find(EC);
228     // Reverse shape's orientation if needed
229     if ( !OE->Orientation() )
230       existingShape.Reverse();
231     myResult = existingShape;
232     myError = StepToTopoDS_TranslateEdgeDone;
233     done = Standard_True;
234     return;
235   }
236   // [END] Proceed with non-manifold cases (ssv; 12.11.2010)
237 
238   // [BEGIN] Proceed with I-DEAS-like STP (ssv; 15.11.2010)
239   const Handle(TCollection_HAsciiString) anECName = EC->Name();
240   if ( NMTool.IsIDEASCase() && !anECName.IsNull() && !anECName->IsEmpty() &&
241        NMTool.IsBound(anECName->String()) ) {
242     TopoDS_Shape existingShape = NMTool.Find(anECName->String());
243     // Reverse shape's orientation if needed
244     if ( !OE->Orientation() )
245       existingShape.Reverse();
246     // Register Edge for final processing (I-DEAS case)
247     NMTool.RegisterNMEdge(existingShape);
248     myResult = existingShape;
249     myError = StepToTopoDS_TranslateEdgeDone;
250     done = Standard_True;
251     return;
252   }
253   // [END] Proceed with I-DEAS-like STP (ssv; 15.11.2010)
254 
255   BRep_Builder B;
256 
257   Handle(StepGeom_Curve) C = EC->EdgeGeometry();
258   if( C.IsNull())
259   {
260     TP->AddFail(EC," Geom Curve in EdgeCurve is equal to 0");
261     myError = StepToTopoDS_TranslateEdgeOther;
262     done = Standard_False;
263     return;
264   }
265   TopoDS_Edge E;
266   Handle(StepShape_Vertex) Vstart, Vend;
267 
268   // -----------------------------------------------------------
269   // Extract the start and end Vertices corresponding to FORWARD
270   // (following the geometrical sense)
271   // -----------------------------------------------------------
272 
273   Standard_Boolean EdgeCurveSameSense = EC->SameSense();
274 
275   if (EdgeCurveSameSense) {
276     Vstart = EC->EdgeStart();
277     Vend   = EC->EdgeEnd();
278   }
279   else {
280     Vend   = EC->EdgeStart();
281     Vstart = EC->EdgeEnd();
282   }
283 
284   TopoDS_Vertex V1, V2;
285 
286   StepToTopoDS_TranslateVertex myTranVertex1(Vstart, aTool, NMTool);
287   StepToTopoDS_TranslateVertex myTranVertex2(Vend, aTool, NMTool);
288 
289   if (myTranVertex1.IsDone()) {
290     V1 = TopoDS::Vertex(myTranVertex1.Value());
291     V1.Orientation(TopAbs_FORWARD);
292   }
293   if (Vend == Vstart) {
294     V2 = V1;
295     V2.Orientation(TopAbs_REVERSED);
296   }
297   else if (myTranVertex2.IsDone()) {
298     V2 = TopoDS::Vertex(myTranVertex2.Value());
299     V2.Orientation(TopAbs_REVERSED);
300   }
301   done = Standard_True;
302 
303   // ----------------------------------------------------------
304   // --- The EdgeCurve Geometry is of StepGeom_Curve Type
305   // --- It can be : * a Pcurve : no 3D curve is constructed
306   // ---             * a Surface Curve, Intersection Curve
307   // ---               or a Seam Curve
308   // ---             * a 3D Curve
309   // ----------------------------------------------------------
310 
311   if ( C->IsKind(STANDARD_TYPE(StepGeom_Pcurve))) {
312     B.MakeEdge(E);
313 //:S4136    B.UpdateEdge (E,preci);
314     B.Add(E, V1);
315     B.Add(E, V2);
316   }
317   else if (C->IsKind(STANDARD_TYPE(StepGeom_SurfaceCurve)) ) {
318     // For SeamCurve and IntersectionCurve types
319     // --- The Edge Geometry is a Surface Curve ---
320     // ---     (3d + 2 Pcurve Or Surface)       ---
321     Handle(StepGeom_SurfaceCurve) Sc =
322       Handle(StepGeom_SurfaceCurve)::DownCast(C);
323     Handle(StepGeom_Curve) C1 = Sc->Curve3d();
324       MakeFromCurve3D (C1,EC,Vend,Precision(), E,V1,V2 , aTool);
325   }
326   else {
327     // --- The Edge Geometry is a Single 3d Curve ---
328     MakeFromCurve3D (C,EC,Vend,Precision(), E,V1,V2 , aTool);
329   }
330   // Force set flags SameRange and SameParameter to Standard_False
331   if (done) {
332 //:S4136    B.SameRange(E, Standard_False);
333 //:S4136    B.SameParameter(E, Standard_False);
334     aTool.Bind(EC,E);
335 
336     // Bind Edge in NM tool (ssv; 15.11.2010)
337     if ( NMTool.IsActive() ) {
338       NMTool.Bind(EC, E);
339       if ( NMTool.IsIDEASCase() && !anECName.IsNull() && !anECName->IsEmpty() )
340         NMTool.Bind(anECName->String(), E);
341     }
342 
343     myResult = E;
344     myError = StepToTopoDS_TranslateEdgeDone;
345   }
346 }
347 
348 
349 // ============================================================================
350 // Method  : MakeFromCurve3D
351 // Purpose : case of a Curve 3D (alone or in SurfaceCurve)
352 // ============================================================================
353 
354 // auxiliary function
355 //:e6 abv 16 Apr 98: ProSTEP TR8, r0601_sy.stp, #14907
GetCartesianPoints(const Handle (StepShape_EdgeCurve)& EC,gp_Pnt & P1,gp_Pnt & P2)356 static void GetCartesianPoints ( const Handle(StepShape_EdgeCurve)& EC,
357 				 gp_Pnt &P1, gp_Pnt &P2)
358 {
359   for ( Standard_Integer i=1; i<=2; i++ ) {
360     const Handle(StepShape_Vertex) V = ((i == 1) == EC->SameSense() ? EC->EdgeStart() : EC->EdgeEnd() );
361     const Handle(StepShape_VertexPoint) VP = Handle(StepShape_VertexPoint)::DownCast(V);
362     if ( VP.IsNull() ) continue;
363     const Handle(StepGeom_CartesianPoint) P = Handle(StepGeom_CartesianPoint)::DownCast(VP->VertexGeometry());
364     Handle(Geom_CartesianPoint) CP = StepToGeom::MakeCartesianPoint (P);
365     ( i==1 ? P1 : P2 ) = CP->Pnt();
366   }
367 }
368 
369 // ============================================================================
370 // Method  : StepToTopoDS_TranslateEdge::MakeFromCurve3D()
371 // Purpose :
372 // ============================================================================
373 
MakeFromCurve3D(const Handle (StepGeom_Curve)& C3D,const Handle (StepShape_EdgeCurve)& EC,const Handle (StepShape_Vertex)& Vend,const Standard_Real preci,TopoDS_Edge & E,TopoDS_Vertex & V1,TopoDS_Vertex & V2,StepToTopoDS_Tool & aTool)374 void  StepToTopoDS_TranslateEdge::MakeFromCurve3D
375   (const Handle(StepGeom_Curve)& C3D, const Handle(StepShape_EdgeCurve)& EC,
376    const Handle(StepShape_Vertex)&  Vend,
377    const Standard_Real preci, TopoDS_Edge& E,
378    TopoDS_Vertex& V1, TopoDS_Vertex& V2,
379    StepToTopoDS_Tool&   aTool)
380 {
381   Handle(Transfer_TransientProcess) TP = aTool.TransientProcess();
382   Handle(Geom_Curve) C1 = MakeCurve(C3D,TP);
383   if (C1.IsNull()) {
384     TP->AddFail(C3D," Make Geom_Curve (3D) failed");
385     myError = StepToTopoDS_TranslateEdgeOther;
386     done = Standard_False;
387     return;
388   }
389     // -- Statistics -- -> No Warning message
390   aTool.AddContinuity (C1);
391   BRep_Builder B;
392   Standard_Real temp1,temp2, U1,U2;
393   gp_Pnt pproj;
394   gp_Pnt pv1 = BRep_Tool::Pnt(V1);
395   gp_Pnt pv2 = BRep_Tool::Pnt(V2);
396 
397   //:e6 abv
398   gp_Pnt pnt1 = pv1, pnt2 = pv2;
399   if ( V1.IsSame ( V2 ) ) GetCartesianPoints ( EC, pnt1, pnt2 );
400   ShapeAnalysis_Curve sac;
401   temp1 = sac.Project (C1,pnt1,preci,pproj,U1,Standard_False);
402   temp2 = sac.Project (C1,pnt2,preci,pproj,U2,Standard_False);
403 
404   if (!StepToTopoDS_GeometricTool::UpdateParam3d(C1, U1, U2, preci))
405     TP->AddWarning(C3D,"Update of 3D-Parameters has failed");
406 
407   //:d5: instead of AdjustCurve above which is incorrect if U1 and U2 are not ends
408   GeomAdaptor_Curve aCA(C1);
409   gp_Pnt pU1 = aCA.Value ( U1 ), pU2 = aCA.Value ( U2 );
410   temp1 = pU1.Distance ( pv1 );
411   temp2 = pU2.Distance ( pv2 );
412   if ( temp1 > preci || temp2 > preci ) {
413     TP->AddWarning (C3D,"Poor result from projection vertex / curve 3d");
414   }
415   B.UpdateVertex ( V1, 1.000001*temp1 ); //:h6 abv 14 Jul 98: PRO8845 #2746: *=1.0001
416   B.UpdateVertex ( V2, 1.000001*temp2 ); //:h6
417 
418   BRepLib_MakeEdge ME(C1, V1, V2, U1, U2);
419   if (ME.IsDone()) {
420     E = ME.Edge();
421     B.Range ( E, U1, U2 ); // abv 14 Mar 00: trj3_pm1-ug.stp #91739, edge 2
422   }
423   else {
424     if (ME.Error() == BRepLib_DifferentPointsOnClosedCurve) {
425       // The Edge could be closed and trimmed by 2 Different vertices
426       if (C1->IsClosed()) {
427 	// Attention : topology updating
428 	aTool.Bind (Vend,V1);
429 	TopoDS_Shape aLocalShape = V1.Reversed();
430 	V2 = TopoDS::Vertex(aLocalShape);
431 	ME.Init(C1, V1, V2, U1, U2);
432 	if (ME.IsDone()) {
433 	  TP->AddWarning(EC, "Wrong topology corrected : Closed Edge with TWO different Vertices");
434 	  E = ME.Edge();
435 	}
436 	else {
437 	  DecodeMakeEdgeError(ME, C3D, C1, V1, V2, U1, U2, aTool, EC);
438 	  E = MakeEdge (C1,V1,V2,U1,U2);
439 	  myError = StepToTopoDS_TranslateEdgeDone;
440 	  done = Standard_True;
441 	  //		return;
442         }
443       }
444       else {
445 	// Then, this is should be coded as degenerated
446 	// To be performed later !!!
447 	myError = StepToTopoDS_TranslateEdgeDone;
448 	//  Bon, on la fait cette petite edge, mais faudra repasser
449 	//  pour l enlever ET FUSIONNER LES VERTEX, pour tout le shell !
450 	//  courbe trop petite pour etre mise -> fait planter
451 	done = Standard_True;
452 	if (!V1.IsSame(V2)) {
453 	  TP->AddFail(EC, "This edge has null arc length");
454 	  gp_Pnt P1 = BRep_Tool::Pnt(V1);
455 	  gp_Pnt P2 = BRep_Tool::Pnt(V2);
456 	  gp_Vec avec (P1,P2);  gp_Dir adir (avec);  gp_Lin alin (P1,adir);
457 	  C1 = new Geom_Line (alin);
458 	  U1 = 0.;  U2 = P1.Distance(P2);
459 	  E = MakeEdge (C1,V1,V2,U1,U2);//,preci
460 	}
461 	else {
462 	  TP->AddFail(EC,"NULL EDGE, SKIPPED");
463 	  myResult.Nullify();
464 	  return;
465 	}
466       }
467     }
468     else {
469       DecodeMakeEdgeError(ME, C3D, C1, V1, V2, U1, U2, aTool, EC);
470       E = MakeEdge (C1,V1,V2,U1,U2);
471       myError = StepToTopoDS_TranslateEdgeDone;
472       done = Standard_True;
473     }
474   }
475 }
476 
477 
478 // ============================================================================
479 // Method  : MakePCurve
480 // Purpose : Computes an individual pcurve (i.e. curve 2d)
481 // ============================================================================
Handle(Geom2d_Curve)482 Handle(Geom2d_Curve)  StepToTopoDS_TranslateEdge::MakePCurve
483   (const Handle(StepGeom_Pcurve)& PCU, const Handle(Geom_Surface)& ConvSurf) const
484 {
485   Handle(Geom2d_Curve) C2d;
486   const Handle(StepRepr_DefinitionalRepresentation) DRI = PCU->ReferenceToCurve();
487   if( DRI.IsNull()) return C2d;
488   const Handle(StepGeom_Curve) StepCurve = Handle(StepGeom_Curve)::DownCast(DRI->ItemsValue(1));
489   try
490   {
491     C2d = StepToGeom::MakeCurve2d (StepCurve);
492     if (! C2d.IsNull()) {
493     // -- if the surface is a RectangularTrimmedSurface,
494     // -- send the BasisSurface.
495      C2d = GeomConvert_Units::DegreeToRadian(C2d, ConvSurf,
496        StepData_GlobalFactors::Intance().LengthFactor(), StepData_GlobalFactors::Intance().FactorDegreeRadian());
497     }
498 
499   }
500   catch(Standard_Failure const&)
501   {
502     return C2d;
503   }
504   return C2d;
505 }
506 
507 
508 // ============================================================================
509 // Method  : Value
510 // Purpose : Returns the mapped edge
511 // ============================================================================
512 
Value() const513 const TopoDS_Shape& StepToTopoDS_TranslateEdge::Value() const
514 {
515   StdFail_NotDone_Raise_if (!done, "StepToTopoDS_TranslateEdge::Value() - no result");
516   return myResult;
517 }
518 
519 // ============================================================================
520 // Method  : Error
521 // Purpose : Returns the error code
522 // ============================================================================
523 
Error() const524 StepToTopoDS_TranslateEdgeError StepToTopoDS_TranslateEdge::Error() const
525 {
526   return myError;
527 }
528