7fd59977 |
1 | // File: GeomToStep_MakeConic.cxx |
2 | // Created: Mon Jun 21 11:20:10 1993 |
3 | // Author: Martine LANGLOIS |
4 | // <mla@mastox> |
5 | |
6 | #include <GeomToStep_MakeConic.ixx> |
7 | #include <StdFail_NotDone.hxx> |
8 | #include <StepGeom_Conic.hxx> |
9 | #include <GeomToStep_MakeConic.hxx> |
10 | #include <Geom_Circle.hxx> |
11 | #include <Geom_Ellipse.hxx> |
12 | #include <Geom_Hyperbola.hxx> |
13 | #include <Geom_Parabola.hxx> |
14 | #include <Geom2d_Circle.hxx> |
15 | #include <Geom2d_Ellipse.hxx> |
16 | #include <Geom2d_Hyperbola.hxx> |
17 | #include <Geom2d_Parabola.hxx> |
18 | #include <GeomToStep_MakeCircle.hxx> |
19 | #include <GeomToStep_MakeEllipse.hxx> |
20 | #include <GeomToStep_MakeHyperbola.hxx> |
21 | #include <GeomToStep_MakeParabola.hxx> |
22 | |
23 | //============================================================================= |
24 | // Creation d' une Conic de prostep a partir d' une Conic de Geom |
25 | //============================================================================= |
26 | |
27 | GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom_Conic)& C) |
28 | { |
29 | done = Standard_True; |
30 | if (C->IsKind(STANDARD_TYPE(Geom_Circle))) { |
31 | Handle(Geom_Circle) Cer = Handle(Geom_Circle)::DownCast(C); |
32 | GeomToStep_MakeCircle MkCircle(Cer); |
33 | theConic = MkCircle.Value(); |
34 | } |
35 | else if (C->IsKind(STANDARD_TYPE(Geom_Ellipse))) { |
36 | Handle(Geom_Ellipse) Ell = Handle(Geom_Ellipse)::DownCast(C); |
37 | GeomToStep_MakeEllipse MkEllipse(Ell); |
38 | theConic = MkEllipse.Value(); |
39 | } |
40 | else if (C->IsKind(STANDARD_TYPE(Geom_Hyperbola))) { |
41 | Handle(Geom_Hyperbola) Hyp = Handle(Geom_Hyperbola)::DownCast(C); |
42 | GeomToStep_MakeHyperbola MkHyperbola(Hyp); |
43 | theConic = MkHyperbola.Value(); |
44 | } |
45 | else if (C->IsKind(STANDARD_TYPE(Geom_Parabola))) { |
46 | Handle(Geom_Parabola) Par = Handle(Geom_Parabola)::DownCast(C); |
47 | GeomToStep_MakeParabola MkParabola(Par); |
48 | theConic = MkParabola.Value(); |
49 | } |
50 | else { |
51 | #ifdef DEBUG |
52 | cout << "3D Curve Type : " << C->DynamicType() << endl; |
53 | #endif |
54 | done = Standard_False; |
55 | } |
56 | } |
57 | |
58 | //============================================================================= |
59 | // Creation d' une Conic2d de prostep a partir d' une Conic de Geom2d |
60 | //============================================================================= |
61 | |
62 | GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom2d_Conic)& C) |
63 | { |
64 | done = Standard_True; |
65 | if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) { |
66 | Handle(Geom2d_Circle) Cer = Handle(Geom2d_Circle)::DownCast(C); |
67 | GeomToStep_MakeCircle MkCircle(Cer); |
68 | theConic = MkCircle.Value(); |
69 | } |
70 | else if (C->IsKind(STANDARD_TYPE(Geom2d_Ellipse))) { |
71 | Handle(Geom2d_Ellipse) Ell = Handle(Geom2d_Ellipse)::DownCast(C); |
72 | GeomToStep_MakeEllipse MkEllipse(Ell); |
73 | theConic = MkEllipse.Value(); |
74 | } |
75 | else if (C->IsKind(STANDARD_TYPE(Geom2d_Hyperbola))) { |
76 | Handle(Geom2d_Hyperbola) Hyp = Handle(Geom2d_Hyperbola)::DownCast(C); |
77 | GeomToStep_MakeHyperbola MkHyperbola(Hyp); |
78 | theConic = MkHyperbola.Value(); |
79 | } |
80 | else if (C->IsKind(STANDARD_TYPE(Geom2d_Parabola))) { |
81 | Handle(Geom2d_Parabola) Par = Handle(Geom2d_Parabola)::DownCast(C); |
82 | GeomToStep_MakeParabola MkParabola(Par); |
83 | theConic = MkParabola.Value(); |
84 | } |
85 | else { |
86 | // Attention : Other 2d conics shall be implemented ... |
87 | // To be performed later ! |
88 | #ifdef DEBUG |
89 | cout << "2D conic not yet implemented" << endl; |
90 | #endif |
91 | done = Standard_False; |
92 | } |
93 | } |
94 | |
95 | //============================================================================= |
96 | // renvoi des valeurs |
97 | //============================================================================= |
98 | |
99 | const Handle(StepGeom_Conic) & |
100 | GeomToStep_MakeConic::Value() const |
101 | { |
102 | StdFail_NotDone_Raise_if(!done == Standard_True,""); |
103 | return theConic; |
104 | } |