Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:32

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_Box_HeaderFile
0017 #define VrmlData_Box_HeaderFile
0018 
0019 #include <VrmlData_Geometry.hxx>
0020 #include <gp_XYZ.hxx>
0021 
0022 /**
0023  *  Inplementation of the Box node.
0024  *  This node is defined by Size vector, assumong that the box center is located
0025  *  in (0., 0., 0.) and that each corner is 0.5*|Size| distance from the center.
0026  */
0027 class VrmlData_Box : public VrmlData_Geometry
0028 {
0029  public:
0030   // ---------- PUBLIC METHODS ----------
0031 
0032   /**
0033    * Empty constructor
0034    */
0035   inline VrmlData_Box           ()
0036     : mySize (2., 2., 2.)
0037   {}
0038 
0039   /**
0040    * Constructor
0041    */
0042   inline VrmlData_Box           (const VrmlData_Scene&  theScene,
0043                                  const char             * theName,
0044                                  const Standard_Real    sizeX = 2.,
0045                                  const Standard_Real    sizeY = 2.,
0046                                  const Standard_Real    sizeZ = 2.)
0047     : VrmlData_Geometry (theScene, theName),
0048       mySize            (sizeX, sizeY, sizeZ)
0049   {}
0050 
0051   /**
0052    * Query the Box size
0053    */
0054   inline const gp_XYZ&  Size    () const                { return mySize; }
0055 
0056   /**
0057    * Set the Box Size
0058    */
0059   inline void           SetSize (const gp_XYZ& theSize)
0060   { mySize = theSize; SetModified(); }
0061 
0062   /**
0063    * Query the primitive topology. This method returns a Null shape if there
0064    * is an internal error during the primitive creation (zero radius, etc.)
0065    */
0066   Standard_EXPORT virtual const Handle(TopoDS_TShape)&
0067                         TShape  () Standard_OVERRIDE;
0068 
0069   /**
0070    * Create a copy of this node.
0071    * If the parameter is null, a new copied node is created. Otherwise new node
0072    * is not created, but rather the given one is modified.
0073    */
0074   Standard_EXPORT virtual Handle(VrmlData_Node)
0075                         Clone   (const Handle(VrmlData_Node)& theOther)const Standard_OVERRIDE;
0076 
0077   /**
0078    * Fill the Node internal data from the given input stream.
0079    */
0080   Standard_EXPORT virtual VrmlData_ErrorStatus
0081                         Read    (VrmlData_InBuffer& theBuffer) Standard_OVERRIDE;
0082 
0083   /**
0084    * Write the Node to output stream.
0085    */
0086   Standard_EXPORT virtual VrmlData_ErrorStatus
0087                         Write   (const char * thePrefix) const Standard_OVERRIDE;
0088 
0089  private:
0090   // ---------- PRIVATE FIELDS ----------
0091 
0092   gp_XYZ        mySize;
0093 
0094  public:
0095 // Declaration of CASCADE RTTI
0096 DEFINE_STANDARD_RTTI_INLINE(VrmlData_Box,VrmlData_Geometry)
0097 };
0098 
0099 // Definition of HANDLE object using Standard_DefineHandle.hxx
0100 DEFINE_STANDARD_HANDLE (VrmlData_Box, VrmlData_Geometry)
0101 
0102 
0103 #endif