1 // Created on: 1994-05-30
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Adaptor2d_Curve2d.hxx>
19 #include <Geom2d_BezierCurve.hxx>
20 #include <Geom2d_BSplineCurve.hxx>
21 #include <Geom2d_Circle.hxx>
22 #include <Geom2d_Curve.hxx>
23 #include <Geom2d_Ellipse.hxx>
24 #include <Geom2d_Hyperbola.hxx>
25 #include <Geom2d_Line.hxx>
26 #include <Geom2d_Parabola.hxx>
27 #include <Geom2d_TrimmedCurve.hxx>
28 #include <Geom2dAdaptor.hxx>
29 #include <gp_Circ2d.hxx>
30 #include <gp_Elips2d.hxx>
31 #include <gp_Hypr2d.hxx>
32 #include <gp_Lin2d.hxx>
33 #include <gp_Parab2d.hxx>
35 //=======================================================================
36 //function : MakeCurve
38 //=======================================================================
39 Handle(Geom2d_Curve) Geom2dAdaptor::MakeCurve
40 (const Adaptor2d_Curve2d& HC)
42 Handle(Geom2d_Curve) C2D;
43 switch (HC.GetType()) {
47 Handle(Geom2d_Line) GL = new Geom2d_Line(HC.Line());
54 Handle(Geom2d_Circle) GL = new Geom2d_Circle(HC.Circle());
61 Handle(Geom2d_Ellipse) GL = new Geom2d_Ellipse(HC.Ellipse());
66 case GeomAbs_Parabola:
68 Handle(Geom2d_Parabola) GL = new Geom2d_Parabola(HC.Parabola());
73 case GeomAbs_Hyperbola:
75 Handle(Geom2d_Hyperbola) GL = new Geom2d_Hyperbola(HC.Hyperbola());
80 case GeomAbs_BezierCurve:
86 case GeomAbs_BSplineCurve:
93 throw Standard_DomainError("Geom2dAdaptor::MakeCurve, OtherCurve");
97 // trim the curve if necassary.
99 ((HC.FirstParameter() != C2D->FirstParameter()) ||
100 (HC.LastParameter() != C2D->LastParameter()))) {
102 C2D = new Geom2d_TrimmedCurve
103 (C2D,HC.FirstParameter(),HC.LastParameter());