b311480e |
1 | // Created on: 2006-05-25 |
2 | // Created by: Alexander GRIGORIEV |
3 | // Copyright (c) 2006-2012 OPEN CASCADE SAS |
4 | // |
5 | // The content of this file is subject to the Open CASCADE Technology Public |
6 | // License Version 6.5 (the "License"). You may not use the content of this file |
7 | // except in compliance with the License. Please obtain a copy of the License |
8 | // at http://www.opencascade.org and read it completely before using this file. |
9 | // |
10 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
11 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
12 | // |
13 | // The Original Code and all software distributed under the License is |
14 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
15 | // Initial Developer hereby disclaims all such warranties, including without |
16 | // limitation, any warranties of merchantability, fitness for a particular |
17 | // purpose or non-infringement. Please see the License for the specific terms |
18 | // and conditions governing the rights and limitations under the License. |
19 | |
7fd59977 |
20 | |
21 | |
22 | #ifndef VrmlData_Cone_HeaderFile |
23 | #define VrmlData_Cone_HeaderFile |
24 | |
25 | #include <VrmlData_Geometry.hxx> |
26 | |
27 | /** |
28 | * Implementation of the Cone node. |
29 | * The cone is located with its middle of the height segment in (0., 0., 0.) |
30 | * The height is oriented along OY. |
31 | */ |
32 | class VrmlData_Cone : public VrmlData_Geometry |
33 | { |
34 | public: |
35 | // ---------- PUBLIC METHODS ---------- |
36 | |
37 | /** |
38 | * Empty constructor |
39 | */ |
40 | inline VrmlData_Cone () |
41 | : myBottomRadius (1.), |
42 | myHeight (2.), |
43 | myHasSide (Standard_True), |
44 | myHasBottom (Standard_True) |
45 | {} |
46 | |
47 | /** |
48 | * Constructor |
49 | */ |
50 | inline VrmlData_Cone (const VrmlData_Scene& theScene, |
51 | const char * theName, |
52 | const Standard_Real theBottomRadius = 1., |
53 | const Standard_Real theHeight = 2.) |
54 | : VrmlData_Geometry (theScene, theName), |
55 | myBottomRadius (theBottomRadius), |
56 | myHeight (theHeight), |
57 | myHasSide (Standard_True), |
58 | myHasBottom (Standard_True) |
59 | {} |
60 | |
61 | /** |
62 | * Query the Bottom Radius |
63 | */ |
64 | inline Standard_Real BottomRadius () const { return myBottomRadius; } |
65 | |
66 | /** |
67 | * Query the Height |
68 | */ |
69 | inline Standard_Real Height () const { return myHeight; } |
70 | |
71 | /** |
72 | * Query if the bottom circle is included |
73 | */ |
74 | inline Standard_Boolean HasBottom () const { return myHasBottom; } |
75 | |
76 | /** |
77 | * Query if the side surface is included |
78 | */ |
79 | inline Standard_Boolean HasSide () const { return myHasSide; } |
80 | |
81 | /** |
82 | * Set the Bottom Radius |
83 | */ |
84 | inline void SetBottomRadius (const Standard_Real theRadius) |
85 | { myBottomRadius = theRadius; SetModified(); } |
86 | |
87 | /** |
88 | * Set the Height |
89 | */ |
90 | inline void SetHeight (const Standard_Real theHeight) |
91 | { myHeight = theHeight; SetModified(); } |
92 | |
93 | /** |
94 | * Set which faces are included |
95 | */ |
96 | inline void SetFaces (const Standard_Boolean hasBottom, |
97 | const Standard_Boolean hasSide) |
98 | { myHasBottom = hasBottom; myHasSide = hasSide; 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 | |
127 | protected: |
128 | // ---------- PROTECTED METHODS ---------- |
129 | |
130 | |
131 | |
132 | private: |
133 | // ---------- PRIVATE FIELDS ---------- |
134 | |
135 | Standard_Real myBottomRadius; |
136 | Standard_Real myHeight; |
137 | Standard_Boolean myHasSide : 1; |
138 | Standard_Boolean myHasBottom : 1; |
139 | |
140 | |
141 | public: |
142 | // Declaration of CASCADE RTTI |
143 | DEFINE_STANDARD_RTTI (VrmlData_Cone) |
144 | }; |
145 | |
146 | // Definition of HANDLE object using Standard_DefineHandle.hxx |
147 | DEFINE_STANDARD_HANDLE (VrmlData_Cone, VrmlData_Geometry) |
148 | |
149 | |
150 | #endif |