0023024: Update headers of OCCT files
[occt.git] / src / GeomToStep / GeomToStep_MakeConic.cxx
1 // Created on: 1993-06-21
2 // Created by: Martine LANGLOIS
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22 #include <GeomToStep_MakeConic.ixx>
23 #include <StdFail_NotDone.hxx>
24 #include <StepGeom_Conic.hxx>
25 #include <GeomToStep_MakeConic.hxx>
26 #include <Geom_Circle.hxx>
27 #include <Geom_Ellipse.hxx>
28 #include <Geom_Hyperbola.hxx>
29 #include <Geom_Parabola.hxx>
30 #include <Geom2d_Circle.hxx>
31 #include <Geom2d_Ellipse.hxx>
32 #include <Geom2d_Hyperbola.hxx>
33 #include <Geom2d_Parabola.hxx>
34 #include <GeomToStep_MakeCircle.hxx>
35 #include <GeomToStep_MakeEllipse.hxx>
36 #include <GeomToStep_MakeHyperbola.hxx>
37 #include <GeomToStep_MakeParabola.hxx>
38
39 //=============================================================================
40 // Creation d' une Conic de prostep a partir d' une Conic de Geom
41 //=============================================================================
42
43 GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom_Conic)& C)
44 {
45   done = Standard_True;
46   if (C->IsKind(STANDARD_TYPE(Geom_Circle))) {
47     Handle(Geom_Circle) Cer = Handle(Geom_Circle)::DownCast(C);
48     GeomToStep_MakeCircle MkCircle(Cer);
49     theConic = MkCircle.Value();
50   }
51   else if (C->IsKind(STANDARD_TYPE(Geom_Ellipse))) {
52     Handle(Geom_Ellipse) Ell = Handle(Geom_Ellipse)::DownCast(C);
53     GeomToStep_MakeEllipse MkEllipse(Ell);
54     theConic = MkEllipse.Value();
55   }
56   else if (C->IsKind(STANDARD_TYPE(Geom_Hyperbola))) {
57     Handle(Geom_Hyperbola) Hyp = Handle(Geom_Hyperbola)::DownCast(C);
58     GeomToStep_MakeHyperbola MkHyperbola(Hyp);
59     theConic = MkHyperbola.Value();
60   }
61   else if (C->IsKind(STANDARD_TYPE(Geom_Parabola))) {
62     Handle(Geom_Parabola) Par = Handle(Geom_Parabola)::DownCast(C);
63     GeomToStep_MakeParabola MkParabola(Par);
64     theConic = MkParabola.Value();
65   }
66   else {
67 #ifdef DEBUG
68     cout << "3D Curve Type   : " << C->DynamicType() << endl;
69 #endif
70     done = Standard_False;
71   }
72 }        
73
74 //=============================================================================
75 // Creation d' une Conic2d de prostep a partir d' une Conic de Geom2d
76 //=============================================================================
77
78 GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom2d_Conic)& C)
79 {
80   done = Standard_True;
81   if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) {
82     Handle(Geom2d_Circle) Cer = Handle(Geom2d_Circle)::DownCast(C);
83     GeomToStep_MakeCircle MkCircle(Cer);
84     theConic = MkCircle.Value();
85   }
86   else if (C->IsKind(STANDARD_TYPE(Geom2d_Ellipse))) {
87     Handle(Geom2d_Ellipse) Ell = Handle(Geom2d_Ellipse)::DownCast(C);
88     GeomToStep_MakeEllipse MkEllipse(Ell);
89     theConic = MkEllipse.Value();
90   }
91   else if (C->IsKind(STANDARD_TYPE(Geom2d_Hyperbola))) {
92     Handle(Geom2d_Hyperbola) Hyp = Handle(Geom2d_Hyperbola)::DownCast(C);
93     GeomToStep_MakeHyperbola MkHyperbola(Hyp);
94     theConic = MkHyperbola.Value();
95   }
96   else if (C->IsKind(STANDARD_TYPE(Geom2d_Parabola))) {
97     Handle(Geom2d_Parabola) Par = Handle(Geom2d_Parabola)::DownCast(C);
98     GeomToStep_MakeParabola MkParabola(Par);
99     theConic = MkParabola.Value();
100   }
101   else {
102     // Attention : Other 2d conics shall be implemented ...
103     //             To be performed later !
104 #ifdef DEBUG
105     cout << "2D conic not yet implemented" << endl;
106 #endif
107     done = Standard_False;
108   }
109 }        
110
111 //=============================================================================
112 // renvoi des valeurs
113 //=============================================================================
114
115 const Handle(StepGeom_Conic) &
116       GeomToStep_MakeConic::Value() const
117 {
118   StdFail_NotDone_Raise_if(!done == Standard_True,"");
119   return theConic;
120 }