0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / GeomToStep / GeomToStep_MakeConic.cxx
CommitLineData
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
42cf5bc1 17
7fd59977 18#include <Geom2d_Circle.hxx>
42cf5bc1 19#include <Geom2d_Conic.hxx>
7fd59977 20#include <Geom2d_Ellipse.hxx>
21#include <Geom2d_Hyperbola.hxx>
22#include <Geom2d_Parabola.hxx>
42cf5bc1 23#include <Geom_Circle.hxx>
24#include <Geom_Conic.hxx>
25#include <Geom_Ellipse.hxx>
26#include <Geom_Hyperbola.hxx>
27#include <Geom_Parabola.hxx>
7fd59977 28#include <GeomToStep_MakeCircle.hxx>
42cf5bc1 29#include <GeomToStep_MakeConic.hxx>
7fd59977 30#include <GeomToStep_MakeEllipse.hxx>
31#include <GeomToStep_MakeHyperbola.hxx>
32#include <GeomToStep_MakeParabola.hxx>
42cf5bc1 33#include <StdFail_NotDone.hxx>
34#include <StepGeom_Circle.hxx>
35#include <StepGeom_Conic.hxx>
36#include <StepGeom_Ellipse.hxx>
37#include <StepGeom_Hyperbola.hxx>
38#include <StepGeom_Parabola.hxx>
7fd59977 39
40//=============================================================================
41// Creation d' une Conic de prostep a partir d' une Conic de Geom
42//=============================================================================
7fd59977 43GeomToStep_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 {
0797d9d3 67#ifdef OCCT_DEBUG
04232180 68 std::cout << "3D Curve Type : " << C->DynamicType() << std::endl;
7fd59977 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
78GeomToStep_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 !
0797d9d3 104#ifdef OCCT_DEBUG
04232180 105 std::cout << "2D conic not yet implemented" << std::endl;
7fd59977 106#endif
107 done = Standard_False;
108 }
109}
110
111//=============================================================================
112// renvoi des valeurs
113//=============================================================================
114
115const Handle(StepGeom_Conic) &
116 GeomToStep_MakeConic::Value() const
117{
2d2b3d53 118 StdFail_NotDone_Raise_if (!done, "GeomToStep_MakeConic::Value() - no result");
7fd59977 119 return theConic;
120}