0027525: Coding - eliminate warnings on Windows for OCCT with static type of libraries
[occt.git] / src / BRepPrimAPI / BRepPrimAPI_MakeCylinder.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_Cylinder.hxx>
20 #include <BRepPrimAPI_MakeCylinder.hxx>
21 #include <gp.hxx>
22 #include <gp_Ax2.hxx>
23 #include <gp_Dir.hxx>
24 #include <Standard_DomainError.hxx>
25
26 static gp_Ax2 CylinderComputeAxes() { 
27   static Standard_Integer firsttime=1;
28   static Standard_Integer modif=0;
29   static Standard_Real cosa=cos(0.1);
30   static Standard_Real sina=sin(0.1);
31   static Standard_Real ux=1.0;
32   static Standard_Real uy=0.0;
33   
34   if(firsttime) { 
35     modif = getenv("PRIM_CYLINDER") != NULL;
36     firsttime = 0;
37   }
38   if(modif) { 
39     Standard_Real nux = cosa*ux+sina*uy;
40     Standard_Real nuy =-sina*ux+cosa*uy;
41     ux=nux; uy=nuy;
42     return(gp_Ax2(gp::Origin(),gp::DZ(),gp_Dir(ux,uy,0.0)));
43   }
44   else { 
45     return(gp::XOY());
46   }
47
48 }
49
50
51
52 //=======================================================================
53 //function : BRepPrimAPI_MakeCylinder
54 //purpose  : 
55 //=======================================================================
56
57 BRepPrimAPI_MakeCylinder::BRepPrimAPI_MakeCylinder(const Standard_Real R,
58                                            const Standard_Real H) :
59        myCylinder(CylinderComputeAxes(), R , H)
60 {
61 }
62
63
64 //=======================================================================
65 //function : BRepPrimAPI_MakeCylinder
66 //purpose  : 
67 //=======================================================================
68
69 BRepPrimAPI_MakeCylinder::BRepPrimAPI_MakeCylinder(const Standard_Real R, 
70                                            const Standard_Real H, 
71                                            const Standard_Real Angle) :
72        myCylinder( R , H)
73 {
74   myCylinder.Angle(Angle);
75 }
76
77
78 //=======================================================================
79 //function : BRepPrimAPI_MakeCylinder
80 //purpose  : 
81 //=======================================================================
82
83 BRepPrimAPI_MakeCylinder::BRepPrimAPI_MakeCylinder(const gp_Ax2& Axes, 
84                                            const Standard_Real R, 
85                                            const Standard_Real H) :
86        myCylinder( Axes, R , H)
87 {
88 }
89
90
91 //=======================================================================
92 //function : BRepPrimAPI_MakeCylinder
93 //purpose  : 
94 //=======================================================================
95
96 BRepPrimAPI_MakeCylinder::BRepPrimAPI_MakeCylinder(const gp_Ax2& Axes,
97                                            const Standard_Real R, 
98                                            const Standard_Real H,
99                                            const Standard_Real Angle) :
100        myCylinder( Axes, R , H)
101 {
102   myCylinder.Angle(Angle);
103 }
104
105
106 //=======================================================================
107 //function : OneAxis
108 //purpose  : 
109 //=======================================================================
110
111 Standard_Address  BRepPrimAPI_MakeCylinder::OneAxis()
112 {
113   return &myCylinder;
114 }
115
116
117 //=======================================================================
118 //function : Cylinder
119 //purpose  : 
120 //=======================================================================
121
122 BRepPrim_Cylinder&  BRepPrimAPI_MakeCylinder::Cylinder()
123 {
124   return myCylinder;
125 }
126
127
128