0028966: Coding Rules - remove Adaptor2d_HCurve2d, Adaptor3d_HCurve and Adaptor3d_HSu...
[occt.git] / src / GeomAPI / GeomAPI.cxx
1 // Created on: 1994-08-05
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1994-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
18 #include <Adaptor3d_CurveOnSurface.hxx>
19 #include <Geom2d_Curve.hxx>
20 #include <Geom2d_TrimmedCurve.hxx>
21 #include <Geom2dAdaptor.hxx>
22 #include <Geom2dAdaptor_Curve.hxx>
23 #include <Geom_BezierCurve.hxx>
24 #include <Geom_BSplineCurve.hxx>
25 #include <Geom_Circle.hxx>
26 #include <Geom_Curve.hxx>
27 #include <Geom_Ellipse.hxx>
28 #include <Geom_Hyperbola.hxx>
29 #include <Geom_Line.hxx>
30 #include <Geom_Parabola.hxx>
31 #include <Geom_Plane.hxx>
32 #include <Geom_TrimmedCurve.hxx>
33 #include <GeomAdaptor.hxx>
34 #include <GeomAdaptor_Curve.hxx>
35 #include <GeomAdaptor_Surface.hxx>
36 #include <GeomAdaptor_Surface.hxx>
37 #include <GeomAPI.hxx>
38 #include <gp_Pln.hxx>
39 #include <ProjLib_ProjectedCurve.hxx>
40 #include <TColgp_Array1OfPnt.hxx>
41 #include <TColStd_Array1OfInteger.hxx>
42 #include <TColStd_Array1OfReal.hxx>
43
44 //=======================================================================
45 //function : To2d
46 //purpose  : 
47 //=======================================================================
48 Handle(Geom2d_Curve) GeomAPI::To2d(const Handle(Geom_Curve)& C,
49                                    const gp_Pln& P)
50 {
51   Handle(Geom2d_Curve) result;
52   Handle(GeomAdaptor_Curve) HC = new GeomAdaptor_Curve(C);
53   Handle(Geom_Plane) Plane = new Geom_Plane(P);
54   Handle(GeomAdaptor_Surface) HS = new GeomAdaptor_Surface(Plane);
55
56   ProjLib_ProjectedCurve Proj(HS,HC);
57
58   if (Proj.GetType() != GeomAbs_OffsetCurve && 
59       Proj.GetType() != GeomAbs_OtherCurve) {
60     result = Geom2dAdaptor::MakeCurve(Proj);
61   }
62   
63   return result;
64 }
65
66
67
68 //=======================================================================
69 //function : To3d
70 //purpose  : 
71 //=======================================================================
72
73 Handle(Geom_Curve) GeomAPI::To3d(const Handle(Geom2d_Curve)& C,
74                                  const gp_Pln& P)
75 {
76   Handle(Geom2dAdaptor_Curve) AHC  = new Geom2dAdaptor_Curve(C);
77
78   Handle(Geom_Plane) ThePlane = new Geom_Plane(P);
79   Handle(GeomAdaptor_Surface) AHS = new GeomAdaptor_Surface(ThePlane);
80
81   Adaptor3d_CurveOnSurface COS(AHC,AHS);
82   return GeomAdaptor::MakeCurve(COS);
83 }