0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / BRepPrimAPI / BRepPrimAPI_MakeOneAxis.cxx
1 // Created on: 1993-07-23
2 // Created by: Remi LEQUETTE
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 <BRepBuilderAPI.hxx>
19 #include <BRepPrim_OneAxis.hxx>
20 #include <BRepPrimAPI_MakeOneAxis.hxx>
21 #include <StdFail_NotDone.hxx>
22 #include <TopoDS.hxx>
23 #include <TopoDS_Face.hxx>
24 #include <TopoDS_Shell.hxx>
25 #include <TopoDS_Solid.hxx>
26
27 //=======================================================================
28 //function : Face
29 //purpose  : 
30 //=======================================================================
31 const TopoDS_Face&  BRepPrimAPI_MakeOneAxis::Face()
32 {
33   Build();
34   return ((BRepPrim_OneAxis*) OneAxis())->LateralFace();
35 }
36
37
38 //=======================================================================
39 //function : Shell
40 //purpose  : 
41 //=======================================================================
42
43 const TopoDS_Shell&  BRepPrimAPI_MakeOneAxis::Shell()
44 {
45   Build();
46   return ((BRepPrim_OneAxis*) OneAxis())->Shell();
47 }
48
49 //=======================================================================
50 //function : Build
51 //purpose  : 
52 //=======================================================================
53
54 void BRepPrimAPI_MakeOneAxis::Build()
55 {
56   BRep_Builder B;
57   B.MakeSolid(TopoDS::Solid(myShape));
58   B.Add(myShape,((BRepPrim_OneAxis*) OneAxis())->Shell());
59   Done();
60 }
61
62 //=======================================================================
63 //function : Solid
64 //purpose  : 
65 //=======================================================================
66
67 const TopoDS_Solid&  BRepPrimAPI_MakeOneAxis::Solid()
68 {
69   Build();
70   return TopoDS::Solid(myShape);
71 }
72
73
74
75 //=======================================================================
76 //function : operator
77 //purpose  : 
78 //=======================================================================
79
80 BRepPrimAPI_MakeOneAxis::operator TopoDS_Face()
81 {
82   return Face();
83 }
84
85 //=======================================================================
86 //function : operator
87 //purpose  : 
88 //=======================================================================
89
90 BRepPrimAPI_MakeOneAxis::operator TopoDS_Shell()
91 {
92   return Shell();
93 }
94
95
96 //=======================================================================
97 //function : operator
98 //purpose  : 
99 //=======================================================================
100
101 BRepPrimAPI_MakeOneAxis::operator TopoDS_Solid()
102 {
103   return Solid();
104 }
105