973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
42cf5bc1 |
14 | |
15 | #include <Vrml_Cylinder.hxx> |
7fd59977 |
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 | { |
586db386 |
58 | anOStream << "Cylinder {\n"; |
7fd59977 |
59 | |
60 | switch ( myParts ) |
61 | { |
586db386 |
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; |
7fd59977 |
66 | } |
67 | |
68 | if ( Abs(myRadius - 1) > 0.0001 ) |
69 | { |
586db386 |
70 | anOStream << " radius\t"; |
71 | anOStream << myRadius << "\n"; |
7fd59977 |
72 | } |
73 | |
74 | if ( Abs(myHeight - 2) > 0.0001 ) |
75 | { |
586db386 |
76 | anOStream << " height\t"; |
77 | anOStream << myHeight << "\n"; |
7fd59977 |
78 | } |
79 | |
586db386 |
80 | anOStream << "}\n"; |
7fd59977 |
81 | return anOStream; |
82 | |
83 | } |