0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / Vrml / Vrml_Cylinder.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <Vrml_Cylinder.hxx>
16
17 Vrml_Cylinder::Vrml_Cylinder(const Vrml_CylinderParts aParts,
18                              const Standard_Real aRadius,
19                              const Standard_Real aHeight)
20 {
21     myParts = aParts;   
22     myRadius = aRadius;
23     myHeight = aHeight;
24 }
25
26  void Vrml_Cylinder::SetParts(const Vrml_CylinderParts aParts) 
27 {
28     myParts = aParts;   
29 }
30
31  Vrml_CylinderParts Vrml_Cylinder::Parts() const
32 {
33   return myParts;
34 }
35
36  void Vrml_Cylinder::SetRadius(const Standard_Real aRadius) 
37 {
38     myRadius = aRadius;
39 }
40
41  Standard_Real Vrml_Cylinder::Radius() const
42 {
43   return myRadius;
44 }
45
46  void Vrml_Cylinder::SetHeight(const Standard_Real aHeight) 
47 {
48     myHeight = aHeight;
49 }
50
51  Standard_Real Vrml_Cylinder::Height() const
52 {
53   return myHeight;
54 }
55
56  Standard_OStream& Vrml_Cylinder::Print(Standard_OStream& anOStream) const
57 {
58   anOStream  << "Cylinder {\n";
59
60   switch ( myParts )
61     {
62      case Vrml_CylinderALL: break; // anOStream  << "\tparts\tALL ";
63      case Vrml_CylinderSIDES:  anOStream  << "    parts\tSIDES\n"; break;
64      case Vrml_CylinderTOP:    anOStream  << "    parts\tTOP\n"; break; 
65      case Vrml_CylinderBOTTOM: anOStream  << "    parts\tBOTTOM\n"; break; 
66     }
67
68  if ( Abs(myRadius - 1) > 0.0001 )
69    {
70     anOStream  << "    radius\t";
71     anOStream << myRadius << "\n";
72    }
73
74  if ( Abs(myHeight - 2) > 0.0001 )
75    {
76     anOStream  << "    height\t";
77     anOStream << myHeight << "\n";
78    }
79
80  anOStream  << "}\n";
81  return anOStream;
82
83 }