summaryrefslogtreecommitdiff
path: root/src/GeomToStep/GeomToStep_MakeConic.cxx
blob: 97a84cf340a38b89f96003a7a4a63b945e9d588e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// File:	GeomToStep_MakeConic.cxx
// Created:	Mon Jun 21 11:20:10 1993
// Author:	Martine LANGLOIS
//		<mla@mastox>

#include <GeomToStep_MakeConic.ixx>
#include <StdFail_NotDone.hxx>
#include <StepGeom_Conic.hxx>
#include <GeomToStep_MakeConic.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Hyperbola.hxx>
#include <Geom_Parabola.hxx>
#include <Geom2d_Circle.hxx>
#include <Geom2d_Ellipse.hxx>
#include <Geom2d_Hyperbola.hxx>
#include <Geom2d_Parabola.hxx>
#include <GeomToStep_MakeCircle.hxx>
#include <GeomToStep_MakeEllipse.hxx>
#include <GeomToStep_MakeHyperbola.hxx>
#include <GeomToStep_MakeParabola.hxx>

//=============================================================================
// Creation d' une Conic de prostep a partir d' une Conic de Geom
//=============================================================================

GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom_Conic)& C)
{
  done = Standard_True;
  if (C->IsKind(STANDARD_TYPE(Geom_Circle))) {
    Handle(Geom_Circle) Cer = Handle(Geom_Circle)::DownCast(C);
    GeomToStep_MakeCircle MkCircle(Cer);
    theConic = MkCircle.Value();
  }
  else if (C->IsKind(STANDARD_TYPE(Geom_Ellipse))) {
    Handle(Geom_Ellipse) Ell = Handle(Geom_Ellipse)::DownCast(C);
    GeomToStep_MakeEllipse MkEllipse(Ell);
    theConic = MkEllipse.Value();
  }
  else if (C->IsKind(STANDARD_TYPE(Geom_Hyperbola))) {
    Handle(Geom_Hyperbola) Hyp = Handle(Geom_Hyperbola)::DownCast(C);
    GeomToStep_MakeHyperbola MkHyperbola(Hyp);
    theConic = MkHyperbola.Value();
  }
  else if (C->IsKind(STANDARD_TYPE(Geom_Parabola))) {
    Handle(Geom_Parabola) Par = Handle(Geom_Parabola)::DownCast(C);
    GeomToStep_MakeParabola MkParabola(Par);
    theConic = MkParabola.Value();
  }
  else {
#ifdef DEBUG
    cout << "3D Curve Type   : " << C->DynamicType() << endl;
#endif
    done = Standard_False;
  }
}	 

//=============================================================================
// Creation d' une Conic2d de prostep a partir d' une Conic de Geom2d
//=============================================================================

GeomToStep_MakeConic::GeomToStep_MakeConic ( const Handle(Geom2d_Conic)& C)
{
  done = Standard_True;
  if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) {
    Handle(Geom2d_Circle) Cer = Handle(Geom2d_Circle)::DownCast(C);
    GeomToStep_MakeCircle MkCircle(Cer);
    theConic = MkCircle.Value();
  }
  else if (C->IsKind(STANDARD_TYPE(Geom2d_Ellipse))) {
    Handle(Geom2d_Ellipse) Ell = Handle(Geom2d_Ellipse)::DownCast(C);
    GeomToStep_MakeEllipse MkEllipse(Ell);
    theConic = MkEllipse.Value();
  }
  else if (C->IsKind(STANDARD_TYPE(Geom2d_Hyperbola))) {
    Handle(Geom2d_Hyperbola) Hyp = Handle(Geom2d_Hyperbola)::DownCast(C);
    GeomToStep_MakeHyperbola MkHyperbola(Hyp);
    theConic = MkHyperbola.Value();
  }
  else if (C->IsKind(STANDARD_TYPE(Geom2d_Parabola))) {
    Handle(Geom2d_Parabola) Par = Handle(Geom2d_Parabola)::DownCast(C);
    GeomToStep_MakeParabola MkParabola(Par);
    theConic = MkParabola.Value();
  }
  else {
    // Attention : Other 2d conics shall be implemented ...
    //             To be performed later !
#ifdef DEBUG
    cout << "2D conic not yet implemented" << endl;
#endif
    done = Standard_False;
  }
}	 

//=============================================================================
// renvoi des valeurs
//=============================================================================

const Handle(StepGeom_Conic) &
      GeomToStep_MakeConic::Value() const
{
  StdFail_NotDone_Raise_if(!done == Standard_True,"");
  return theConic;
}