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_Cone_HeaderFile |
17 | #define VrmlData_Cone_HeaderFile |
18 | |
19 | #include <VrmlData_Geometry.hxx> |
20 | |
21 | /** |
22 | * Implementation of the Cone node. |
23 | * The cone is located with its middle of the height segment in (0., 0., 0.) |
24 | * The height is oriented along OY. |
25 | */ |
26 | class VrmlData_Cone : public VrmlData_Geometry |
27 | { |
28 | public: |
29 | // ---------- PUBLIC METHODS ---------- |
30 | |
31 | /** |
32 | * Empty constructor |
33 | */ |
34 | inline VrmlData_Cone () |
35 | : myBottomRadius (1.), |
36 | myHeight (2.), |
37 | myHasSide (Standard_True), |
38 | myHasBottom (Standard_True) |
39 | {} |
40 | |
41 | /** |
42 | * Constructor |
43 | */ |
44 | inline VrmlData_Cone (const VrmlData_Scene& theScene, |
45 | const char * theName, |
46 | const Standard_Real theBottomRadius = 1., |
47 | const Standard_Real theHeight = 2.) |
48 | : VrmlData_Geometry (theScene, theName), |
49 | myBottomRadius (theBottomRadius), |
50 | myHeight (theHeight), |
51 | myHasSide (Standard_True), |
52 | myHasBottom (Standard_True) |
53 | {} |
54 | |
55 | /** |
56 | * Query the Bottom Radius |
57 | */ |
58 | inline Standard_Real BottomRadius () const { return myBottomRadius; } |
59 | |
60 | /** |
61 | * Query the Height |
62 | */ |
63 | inline Standard_Real Height () const { return myHeight; } |
64 | |
65 | /** |
66 | * Query if the bottom circle is included |
67 | */ |
68 | inline Standard_Boolean HasBottom () const { return myHasBottom; } |
69 | |
70 | /** |
71 | * Query if the side surface is included |
72 | */ |
73 | inline Standard_Boolean HasSide () const { return myHasSide; } |
74 | |
75 | /** |
76 | * Set the Bottom Radius |
77 | */ |
78 | inline void SetBottomRadius (const Standard_Real theRadius) |
79 | { myBottomRadius = theRadius; SetModified(); } |
80 | |
81 | /** |
82 | * Set the Height |
83 | */ |
84 | inline void SetHeight (const Standard_Real theHeight) |
85 | { myHeight = theHeight; SetModified(); } |
86 | |
87 | /** |
88 | * Set which faces are included |
89 | */ |
90 | inline void SetFaces (const Standard_Boolean hasBottom, |
91 | const Standard_Boolean hasSide) |
92 | { myHasBottom = hasBottom; myHasSide = hasSide; SetModified(); } |
93 | |
94 | /** |
95 | * Query the primitive topology. This method returns a Null shape if there |
96 | * is an internal error during the primitive creation (zero radius, etc.) |
97 | */ |
79104795 |
98 | Standard_EXPORT virtual const Handle(TopoDS_TShape)& TShape () Standard_OVERRIDE; |
7fd59977 |
99 | |
100 | /** |
101 | * Create a copy of this node. |
102 | * If the parameter is null, a new copied node is created. Otherwise new node |
103 | * is not created, but rather the given one is modified. |
104 | */ |
105 | Standard_EXPORT virtual Handle(VrmlData_Node) |
79104795 |
106 | Clone (const Handle(VrmlData_Node)& theOther) const Standard_OVERRIDE; |
7fd59977 |
107 | |
108 | /** |
109 | * Fill the Node internal data from the given input stream. |
110 | */ |
111 | Standard_EXPORT virtual VrmlData_ErrorStatus |
79104795 |
112 | Read (VrmlData_InBuffer& theBuffer) Standard_OVERRIDE; |
7fd59977 |
113 | |
114 | /** |
115 | * Write the Node to output stream. |
116 | */ |
117 | Standard_EXPORT virtual VrmlData_ErrorStatus |
79104795 |
118 | Write (const char * thePrefix) const Standard_OVERRIDE; |
7fd59977 |
119 | |
120 | |
121 | protected: |
122 | // ---------- PROTECTED METHODS ---------- |
123 | |
124 | |
125 | |
126 | private: |
127 | // ---------- PRIVATE FIELDS ---------- |
128 | |
129 | Standard_Real myBottomRadius; |
130 | Standard_Real myHeight; |
131 | Standard_Boolean myHasSide : 1; |
132 | Standard_Boolean myHasBottom : 1; |
133 | |
134 | |
135 | public: |
136 | // Declaration of CASCADE RTTI |
92efcf78 |
137 | DEFINE_STANDARD_RTTI_INLINE(VrmlData_Cone,VrmlData_Geometry) |
7fd59977 |
138 | }; |
139 | |
140 | // Definition of HANDLE object using Standard_DefineHandle.hxx |
141 | DEFINE_STANDARD_HANDLE (VrmlData_Cone, VrmlData_Geometry) |
142 | |
143 | |
144 | #endif |