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