0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / GeomToStep / GeomToStep_MakeElementarySurface.cxx
1 // Created on: 1993-06-22
2 // Created by: Martine LANGLOIS
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <Geom_ConicalSurface.hxx>
19 #include <Geom_CylindricalSurface.hxx>
20 #include <Geom_ElementarySurface.hxx>
21 #include <Geom_Plane.hxx>
22 #include <Geom_SphericalSurface.hxx>
23 #include <Geom_ToroidalSurface.hxx>
24 #include <GeomToStep_MakeConicalSurface.hxx>
25 #include <GeomToStep_MakeCylindricalSurface.hxx>
26 #include <GeomToStep_MakeElementarySurface.hxx>
27 #include <GeomToStep_MakePlane.hxx>
28 #include <GeomToStep_MakeSphericalSurface.hxx>
29 #include <GeomToStep_MakeToroidalSurface.hxx>
30 #include <StdFail_NotDone.hxx>
31 #include <StepGeom_ConicalSurface.hxx>
32 #include <StepGeom_CylindricalSurface.hxx>
33 #include <StepGeom_ElementarySurface.hxx>
34 #include <StepGeom_Plane.hxx>
35 #include <StepGeom_SphericalSurface.hxx>
36 #include <StepGeom_ToroidalSurface.hxx>
37
38 //=============================================================================
39 // Creation d' une ElementarySurface de prostep a partir d' une 
40 // ElementarySurface de Geom
41 //=============================================================================
42 GeomToStep_MakeElementarySurface::GeomToStep_MakeElementarySurface
43   ( const Handle(Geom_ElementarySurface)& S)
44 {
45   done = Standard_True;
46   if (S->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
47     Handle(Geom_CylindricalSurface) Sur = 
48       Handle(Geom_CylindricalSurface)::DownCast(S);
49     GeomToStep_MakeCylindricalSurface MkCylindrical(Sur);
50     theElementarySurface = MkCylindrical.Value();
51   }
52   else if (S->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) {
53     Handle(Geom_ConicalSurface) Sur = 
54       Handle(Geom_ConicalSurface)::DownCast(S);
55     GeomToStep_MakeConicalSurface MkConical(Sur);
56     theElementarySurface = MkConical.Value();
57   }
58   else if (S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
59     Handle(Geom_SphericalSurface) Sur = 
60       Handle(Geom_SphericalSurface)::DownCast(S);
61     GeomToStep_MakeSphericalSurface MkSpherical(Sur);
62     theElementarySurface = MkSpherical.Value();
63   }
64   else if (S->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
65     Handle(Geom_ToroidalSurface) Sur = 
66       Handle(Geom_ToroidalSurface)::DownCast(S);
67     GeomToStep_MakeToroidalSurface MkToroidal(Sur);
68     theElementarySurface = MkToroidal.Value();
69   }
70   else if (S->IsKind(STANDARD_TYPE(Geom_Plane))) {
71     Handle(Geom_Plane) Sur =    Handle(Geom_Plane)::DownCast(S); 
72     GeomToStep_MakePlane MkPlane(Sur);
73     theElementarySurface = MkPlane.Value();
74   }
75   else
76     done = Standard_False;
77 }        
78
79
80 //=============================================================================
81 // renvoi des valeurs
82 //=============================================================================
83
84 const Handle(StepGeom_ElementarySurface) &
85       GeomToStep_MakeElementarySurface::Value() const
86 {
87   StdFail_NotDone_Raise_if (!done, "GeomToStep_MakeElementarySurface::Value() - no result");
88   return theElementarySurface;
89 }