1 // Created on: 2006-05-25
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2006-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef VrmlData_Cylinder_HeaderFile
17 #define VrmlData_Cylinder_HeaderFile
19 #include <VrmlData_Geometry.hxx>
22 * Implementation of the Cylinder node
24 class VrmlData_Cylinder : public VrmlData_Geometry
27 // ---------- PUBLIC METHODS ----------
32 inline VrmlData_Cylinder ()
35 myHasBottom (Standard_True),
36 myHasSide (Standard_True),
37 myHasTop (Standard_True)
42 inline VrmlData_Cylinder (const VrmlData_Scene& theScene,
44 const Standard_Real theRadius = 1.,
45 const Standard_Real theHeight = 2.)
46 : VrmlData_Geometry (theScene, theName),
49 myHasBottom (Standard_True),
50 myHasSide (Standard_True),
51 myHasTop (Standard_True)
57 inline Standard_Real Radius () const { return myRadius; }
62 inline Standard_Real Height () const { return myHeight; }
65 * Query if the bottom circle is included
67 inline Standard_Boolean HasBottom () const { return myHasBottom; }
70 * Query if the side surface is included
72 inline Standard_Boolean HasSide () const { return myHasSide; }
75 * Query if the top surface is included
77 inline Standard_Boolean HasTop () const { return myHasTop; }
82 inline void SetRadius (const Standard_Real theRadius)
83 { myRadius = theRadius; SetModified(); }
88 inline void SetHeight (const Standard_Real theHeight)
89 { myHeight = theHeight; SetModified(); }
92 * Set which faces are included
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(); }
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.)
104 Standard_EXPORT virtual const Handle(TopoDS_TShape)& TShape ();
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.
111 Standard_EXPORT virtual Handle(VrmlData_Node)
112 Clone (const Handle(VrmlData_Node)& theOther)const;
115 * Fill the Node internal data from the given input stream.
117 Standard_EXPORT virtual VrmlData_ErrorStatus
118 Read (VrmlData_InBuffer& theBuffer);
121 * Write the Node to output stream.
123 Standard_EXPORT virtual VrmlData_ErrorStatus
124 Write (const char * thePrefix) const;
127 // ---------- PROTECTED METHODS ----------
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;
140 // Declaration of CASCADE RTTI
141 DEFINE_STANDARD_RTTI (VrmlData_Cylinder)
144 // Definition of HANDLE object using Standard_DefineHandle.hxx
145 DEFINE_STANDARD_HANDLE (VrmlData_Cylinder, VrmlData_Geometry)