Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:22:23

0001 // Created on: 2006-05-25
0002 // Created by: Alexander GRIGORIEV
0003 // Copyright (c) 2006-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef VrmlData_Cone_HeaderFile
0017 #define VrmlData_Cone_HeaderFile
0018 
0019 #include <VrmlData_Geometry.hxx>
0020 
0021 /**
0022  *  Implementation of the Cone node.
0023  *  The cone is located with its middle of the height segment in (0., 0., 0.)
0024  *  The height is oriented along OY.
0025  */
0026 class VrmlData_Cone : public VrmlData_Geometry
0027 {
0028 public:
0029   // ---------- PUBLIC METHODS ----------
0030 
0031   /**
0032    * Empty constructor
0033    */
0034   inline VrmlData_Cone()
0035       : myBottomRadius(1.),
0036         myHeight(2.),
0037         myHasSide(true),
0038         myHasBottom(true)
0039   {
0040   }
0041 
0042   /**
0043    * Constructor
0044    */
0045   inline VrmlData_Cone(const VrmlData_Scene& theScene,
0046                        const char*           theName,
0047                        const double          theBottomRadius = 1.,
0048                        const double          theHeight       = 2.)
0049       : VrmlData_Geometry(theScene, theName),
0050         myBottomRadius(theBottomRadius),
0051         myHeight(theHeight),
0052         myHasSide(true),
0053         myHasBottom(true)
0054   {
0055   }
0056 
0057   /**
0058    * Query the Bottom Radius
0059    */
0060   inline double BottomRadius() const { return myBottomRadius; }
0061 
0062   /**
0063    * Query the Height
0064    */
0065   inline double Height() const { return myHeight; }
0066 
0067   /**
0068    * Query if the bottom circle is included
0069    */
0070   inline bool HasBottom() const { return myHasBottom; }
0071 
0072   /**
0073    * Query if the side surface is included
0074    */
0075   inline bool HasSide() const { return myHasSide; }
0076 
0077   /**
0078    * Set the Bottom Radius
0079    */
0080   inline void SetBottomRadius(const double theRadius)
0081   {
0082     myBottomRadius = theRadius;
0083     SetModified();
0084   }
0085 
0086   /**
0087    * Set the Height
0088    */
0089   inline void SetHeight(const double theHeight)
0090   {
0091     myHeight = theHeight;
0092     SetModified();
0093   }
0094 
0095   /**
0096    * Set which faces are included
0097    */
0098   inline void SetFaces(const bool hasBottom, const bool hasSide)
0099   {
0100     myHasBottom = hasBottom;
0101     myHasSide   = hasSide;
0102     SetModified();
0103   }
0104 
0105   /**
0106    * Query the primitive topology. This method returns a Null shape if there
0107    * is an internal error during the primitive creation (zero radius, etc.)
0108    */
0109   Standard_EXPORT const occ::handle<TopoDS_TShape>& TShape() override;
0110 
0111   /**
0112    * Create a copy of this node.
0113    * If the parameter is null, a new copied node is created. Otherwise new node
0114    * is not created, but rather the given one is modified.
0115    */
0116   Standard_EXPORT occ::handle<VrmlData_Node> Clone(
0117     const occ::handle<VrmlData_Node>& theOther) const override;
0118 
0119   /**
0120    * Fill the Node internal data from the given input stream.
0121    */
0122   Standard_EXPORT VrmlData_ErrorStatus Read(VrmlData_InBuffer& theBuffer) override;
0123 
0124   /**
0125    * Write the Node to output stream.
0126    */
0127   Standard_EXPORT VrmlData_ErrorStatus Write(const char* thePrefix) const override;
0128 
0129 private:
0130   // ---------- PRIVATE FIELDS ----------
0131 
0132   double myBottomRadius;
0133   double myHeight;
0134   bool   myHasSide : 1;
0135   bool   myHasBottom : 1;
0136 
0137 public:
0138   // Declaration of CASCADE RTTI
0139   DEFINE_STANDARD_RTTI_INLINE(VrmlData_Cone, VrmlData_Geometry)
0140 };
0141 
0142 // Definition of HANDLE object using Standard_DefineHandle.hxx
0143 #endif