1 // Created on: 2006-05-25
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2006-2012 OPEN CASCADE SAS
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.
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.
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.
22 #ifndef VrmlData_Cylinder_HeaderFile
23 #define VrmlData_Cylinder_HeaderFile
25 #include <VrmlData_Geometry.hxx>
28 * Implementation of the Cylinder node
30 class VrmlData_Cylinder : public VrmlData_Geometry
33 // ---------- PUBLIC METHODS ----------
38 inline VrmlData_Cylinder ()
41 myHasBottom (Standard_True),
42 myHasSide (Standard_True),
43 myHasTop (Standard_True)
48 inline VrmlData_Cylinder (const VrmlData_Scene& theScene,
50 const Standard_Real theRadius = 1.,
51 const Standard_Real theHeight = 2.)
52 : VrmlData_Geometry (theScene, theName),
55 myHasBottom (Standard_True),
56 myHasSide (Standard_True),
57 myHasTop (Standard_True)
63 inline Standard_Real Radius () const { return myRadius; }
68 inline Standard_Real Height () const { return myHeight; }
71 * Query if the bottom circle is included
73 inline Standard_Boolean HasBottom () const { return myHasBottom; }
76 * Query if the side surface is included
78 inline Standard_Boolean HasSide () const { return myHasSide; }
81 * Query if the top surface is included
83 inline Standard_Boolean HasTop () const { return myHasTop; }
88 inline void SetRadius (const Standard_Real theRadius)
89 { myRadius = theRadius; SetModified(); }
94 inline void SetHeight (const Standard_Real theHeight)
95 { myHeight = theHeight; SetModified(); }
98 * Set which faces are included
100 inline void SetFaces (const Standard_Boolean hasBottom,
101 const Standard_Boolean hasSide,
102 const Standard_Boolean hasTop)
103 { myHasBottom = hasBottom; myHasSide = hasSide;
104 myHasTop = hasTop; SetModified(); }
107 * Query the primitive topology. This method returns a Null shape if there
108 * is an internal error during the primitive creation (zero radius, etc.)
110 Standard_EXPORT virtual const Handle(TopoDS_TShape)& TShape ();
113 * Create a copy of this node.
114 * If the parameter is null, a new copied node is created. Otherwise new node
115 * is not created, but rather the given one is modified.
117 Standard_EXPORT virtual Handle(VrmlData_Node)
118 Clone (const Handle(VrmlData_Node)& theOther)const;
121 * Fill the Node internal data from the given input stream.
123 Standard_EXPORT virtual VrmlData_ErrorStatus
124 Read (VrmlData_InBuffer& theBuffer);
127 * Write the Node to output stream.
129 Standard_EXPORT virtual VrmlData_ErrorStatus
130 Write (const char * thePrefix) const;
133 // ---------- PROTECTED METHODS ----------
138 // ---------- PRIVATE FIELDS ----------
139 Standard_Real myRadius;
140 Standard_Real myHeight;
141 Standard_Boolean myHasBottom : 1;
142 Standard_Boolean myHasSide : 1;
143 Standard_Boolean myHasTop : 1;
146 // Declaration of CASCADE RTTI
147 DEFINE_STANDARD_RTTI (VrmlData_Cylinder)
150 // Definition of HANDLE object using Standard_DefineHandle.hxx
151 DEFINE_STANDARD_HANDLE (VrmlData_Cylinder, VrmlData_Geometry)