b311480e |
1 | // Created on: 2006-05-25 |
2 | // Created by: Alexander GRIGORIEV |
973c2be1 |
3 | // Copyright (c) 2006-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | #ifndef VrmlData_Cylinder_HeaderFile |
17 | #define VrmlData_Cylinder_HeaderFile |
18 | |
19 | #include <VrmlData_Geometry.hxx> |
20 | |
21 | /** |
22 | * Implementation of the Cylinder node |
23 | */ |
24 | class VrmlData_Cylinder : public VrmlData_Geometry |
25 | { |
26 | public: |
27 | // ---------- PUBLIC METHODS ---------- |
28 | |
29 | /** |
30 | * Empty constructor |
31 | */ |
32 | inline VrmlData_Cylinder () |
33 | : myRadius (1.), |
34 | myHeight (2.), |
35 | myHasBottom (Standard_True), |
36 | myHasSide (Standard_True), |
37 | myHasTop (Standard_True) |
38 | {} |
39 | /** |
40 | * Constructor |
41 | */ |
42 | inline VrmlData_Cylinder (const VrmlData_Scene& theScene, |
43 | const char * theName, |
44 | const Standard_Real theRadius = 1., |
45 | const Standard_Real theHeight = 2.) |
46 | : VrmlData_Geometry (theScene, theName), |
47 | myRadius (theRadius), |
48 | myHeight (theHeight), |
49 | myHasBottom (Standard_True), |
50 | myHasSide (Standard_True), |
51 | myHasTop (Standard_True) |
52 | {} |
53 | |
54 | /** |
55 | * Query the Radius |
56 | */ |
57 | inline Standard_Real Radius () const { return myRadius; } |
58 | |
59 | /** |
60 | * Query the Height |
61 | */ |
62 | inline Standard_Real Height () const { return myHeight; } |
63 | |
64 | /** |
65 | * Query if the bottom circle is included |
66 | */ |
67 | inline Standard_Boolean HasBottom () const { return myHasBottom; } |
68 | |
69 | /** |
70 | * Query if the side surface is included |
71 | */ |
72 | inline Standard_Boolean HasSide () const { return myHasSide; } |
73 | |
74 | /** |
75 | * Query if the top surface is included |
76 | */ |
77 | inline Standard_Boolean HasTop () const { return myHasTop; } |
78 | |
79 | /** |
80 | * Set the Radius |
81 | */ |
82 | inline void SetRadius (const Standard_Real theRadius) |
83 | { myRadius = theRadius; SetModified(); } |
84 | |
85 | /** |
86 | * Set the Height |
87 | */ |
88 | inline void SetHeight (const Standard_Real theHeight) |
89 | { myHeight = theHeight; SetModified(); } |
90 | |
91 | /** |
92 | * Set which faces are included |
93 | */ |
94 | inline void SetFaces (const Standard_Boolean hasBottom, |
95 | const Standard_Boolean hasSide, |
96 | const Standard_Boolean hasTop) |
97 | { myHasBottom = hasBottom; myHasSide = hasSide; |
98 | myHasTop = hasTop; SetModified(); } |
99 | |
100 | /** |
101 | * Query the primitive topology. This method returns a Null shape if there |
102 | * is an internal error during the primitive creation (zero radius, etc.) |
103 | */ |
104 | Standard_EXPORT virtual const Handle(TopoDS_TShape)& TShape (); |
105 | |
106 | /** |
107 | * Create a copy of this node. |
108 | * If the parameter is null, a new copied node is created. Otherwise new node |
109 | * is not created, but rather the given one is modified. |
110 | */ |
111 | Standard_EXPORT virtual Handle(VrmlData_Node) |
112 | Clone (const Handle(VrmlData_Node)& theOther)const; |
113 | |
114 | /** |
115 | * Fill the Node internal data from the given input stream. |
116 | */ |
117 | Standard_EXPORT virtual VrmlData_ErrorStatus |
118 | Read (VrmlData_InBuffer& theBuffer); |
119 | |
120 | /** |
121 | * Write the Node to output stream. |
122 | */ |
123 | Standard_EXPORT virtual VrmlData_ErrorStatus |
124 | Write (const char * thePrefix) const; |
125 | |
126 | protected: |
127 | // ---------- PROTECTED METHODS ---------- |
128 | |
129 | |
130 | |
131 | private: |
132 | // ---------- PRIVATE FIELDS ---------- |
133 | Standard_Real myRadius; |
134 | Standard_Real myHeight; |
135 | Standard_Boolean myHasBottom : 1; |
136 | Standard_Boolean myHasSide : 1; |
137 | Standard_Boolean myHasTop : 1; |
138 | |
139 | public: |
140 | // Declaration of CASCADE RTTI |
141 | DEFINE_STANDARD_RTTI (VrmlData_Cylinder) |
142 | }; |
143 | |
144 | // Definition of HANDLE object using Standard_DefineHandle.hxx |
145 | DEFINE_STANDARD_HANDLE (VrmlData_Cylinder, VrmlData_Geometry) |
146 | |
147 | |
148 | #endif |