1 // Created on: 1993-06-21
2 // Created by: Martine LANGLOIS
3 // Copyright (c) 1993-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.
17 #include <GeomToStep_MakeConic.ixx>
18 #include <StdFail_NotDone.hxx>
19 #include <StepGeom_Circle.hxx>
20 #include <StepGeom_Ellipse.hxx>
21 #include <StepGeom_Hyperbola.hxx>
22 #include <StepGeom_Parabola.hxx>
23 #include <GeomToStep_MakeConic.hxx>
24 #include <Geom_Circle.hxx>
25 #include <Geom_Ellipse.hxx>
26 #include <Geom_Hyperbola.hxx>
27 #include <Geom_Parabola.hxx>
28 #include <Geom2d_Circle.hxx>
29 #include <Geom2d_Ellipse.hxx>
30 #include <Geom2d_Hyperbola.hxx>
31 #include <Geom2d_Parabola.hxx>
32 #include <GeomToStep_MakeCircle.hxx>
33 #include <GeomToStep_MakeEllipse.hxx>
34 #include <GeomToStep_MakeHyperbola.hxx>
35 #include <GeomToStep_MakeParabola.hxx>
37 //=============================================================================
38 // Creation d' une Conic de prostep a partir d' une Conic de Geom
39 //=============================================================================
41 GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom_Conic)& C)
44 if (C->IsKind(STANDARD_TYPE(Geom_Circle))) {
45 Handle(Geom_Circle) Cer = Handle(Geom_Circle)::DownCast(C);
46 GeomToStep_MakeCircle MkCircle(Cer);
47 theConic = MkCircle.Value();
49 else if (C->IsKind(STANDARD_TYPE(Geom_Ellipse))) {
50 Handle(Geom_Ellipse) Ell = Handle(Geom_Ellipse)::DownCast(C);
51 GeomToStep_MakeEllipse MkEllipse(Ell);
52 theConic = MkEllipse.Value();
54 else if (C->IsKind(STANDARD_TYPE(Geom_Hyperbola))) {
55 Handle(Geom_Hyperbola) Hyp = Handle(Geom_Hyperbola)::DownCast(C);
56 GeomToStep_MakeHyperbola MkHyperbola(Hyp);
57 theConic = MkHyperbola.Value();
59 else if (C->IsKind(STANDARD_TYPE(Geom_Parabola))) {
60 Handle(Geom_Parabola) Par = Handle(Geom_Parabola)::DownCast(C);
61 GeomToStep_MakeParabola MkParabola(Par);
62 theConic = MkParabola.Value();
66 cout << "3D Curve Type : " << C->DynamicType() << endl;
68 done = Standard_False;
72 //=============================================================================
73 // Creation d' une Conic2d de prostep a partir d' une Conic de Geom2d
74 //=============================================================================
76 GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom2d_Conic)& C)
79 if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) {
80 Handle(Geom2d_Circle) Cer = Handle(Geom2d_Circle)::DownCast(C);
81 GeomToStep_MakeCircle MkCircle(Cer);
82 theConic = MkCircle.Value();
84 else if (C->IsKind(STANDARD_TYPE(Geom2d_Ellipse))) {
85 Handle(Geom2d_Ellipse) Ell = Handle(Geom2d_Ellipse)::DownCast(C);
86 GeomToStep_MakeEllipse MkEllipse(Ell);
87 theConic = MkEllipse.Value();
89 else if (C->IsKind(STANDARD_TYPE(Geom2d_Hyperbola))) {
90 Handle(Geom2d_Hyperbola) Hyp = Handle(Geom2d_Hyperbola)::DownCast(C);
91 GeomToStep_MakeHyperbola MkHyperbola(Hyp);
92 theConic = MkHyperbola.Value();
94 else if (C->IsKind(STANDARD_TYPE(Geom2d_Parabola))) {
95 Handle(Geom2d_Parabola) Par = Handle(Geom2d_Parabola)::DownCast(C);
96 GeomToStep_MakeParabola MkParabola(Par);
97 theConic = MkParabola.Value();
100 // Attention : Other 2d conics shall be implemented ...
101 // To be performed later !
103 cout << "2D conic not yet implemented" << endl;
105 done = Standard_False;
109 //=============================================================================
110 // renvoi des valeurs
111 //=============================================================================
113 const Handle(StepGeom_Conic) &
114 GeomToStep_MakeConic::Value() const
116 StdFail_NotDone_Raise_if(!done, "");