0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / Geom2dAdaptor / Geom2dAdaptor.cxx
CommitLineData
b311480e 1// Created on: 1994-05-30
2// Created by: Remi LEQUETTE
3// Copyright (c) 1994-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
7fd59977 17
42cf5bc1 18#include <Adaptor2d_Curve2d.hxx>
19#include <Geom2d_BezierCurve.hxx>
20#include <Geom2d_BSplineCurve.hxx>
7fd59977 21#include <Geom2d_Circle.hxx>
42cf5bc1 22#include <Geom2d_Curve.hxx>
7fd59977 23#include <Geom2d_Ellipse.hxx>
7fd59977 24#include <Geom2d_Hyperbola.hxx>
42cf5bc1 25#include <Geom2d_Line.hxx>
26#include <Geom2d_Parabola.hxx>
7fd59977 27#include <Geom2d_TrimmedCurve.hxx>
42cf5bc1 28#include <Geom2dAdaptor.hxx>
7fd59977 29#include <gp_Circ2d.hxx>
30#include <gp_Elips2d.hxx>
7fd59977 31#include <gp_Hypr2d.hxx>
42cf5bc1 32#include <gp_Lin2d.hxx>
33#include <gp_Parab2d.hxx>
7fd59977 34
35//=======================================================================
36//function : MakeCurve
37//purpose :
38//=======================================================================
7fd59977 39Handle(Geom2d_Curve) Geom2dAdaptor::MakeCurve
40 (const Adaptor2d_Curve2d& HC)
41{
42 Handle(Geom2d_Curve) C2D;
43 switch (HC.GetType()) {
44
45 case GeomAbs_Line:
46 {
47 Handle(Geom2d_Line) GL = new Geom2d_Line(HC.Line());
48 C2D = GL;
49 }
50 break;
51
52 case GeomAbs_Circle:
53 {
54 Handle(Geom2d_Circle) GL = new Geom2d_Circle(HC.Circle());
55 C2D = GL;
56 }
57 break;
58
59 case GeomAbs_Ellipse:
60 {
61 Handle(Geom2d_Ellipse) GL = new Geom2d_Ellipse(HC.Ellipse());
62 C2D = GL;
63 }
64 break;
65
66 case GeomAbs_Parabola:
67 {
68 Handle(Geom2d_Parabola) GL = new Geom2d_Parabola(HC.Parabola());
69 C2D = GL;
70 }
71 break;
72
73 case GeomAbs_Hyperbola:
74 {
75 Handle(Geom2d_Hyperbola) GL = new Geom2d_Hyperbola(HC.Hyperbola());
76 C2D = GL;
77 }
78 break;
79
80 case GeomAbs_BezierCurve:
81 {
82 C2D = HC.Bezier();
83 }
84 break;
85
86 case GeomAbs_BSplineCurve:
87 {
88 C2D = HC.BSpline();
89 }
90 break;
91
1aec3320 92 default:
7fd59977 93 Standard_DomainError::Raise("Geom2dAdaptor::MakeCurve, OtherCurve");
94
95 }
96
97 // trim the curve if necassary.
98 if (! C2D.IsNull() &&
0ebaa4db 99 ((HC.FirstParameter() != C2D->FirstParameter()) ||
100 (HC.LastParameter() != C2D->LastParameter()))) {
7fd59977 101
102 C2D = new Geom2d_TrimmedCurve
103 (C2D,HC.FirstParameter(),HC.LastParameter());
104 }
105
106 return C2D;
107}