Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:19:06

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  *  Implementation of the Box node.
0024  *  This node is defined by Size vector, assuming 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   /**
0041    * Constructor
0042    */
0043   inline VrmlData_Box(const VrmlData_Scene& theScene,
0044                       const char*           theName,
0045                       const double          sizeX = 2.,
0046                       const double          sizeY = 2.,
0047                       const double          sizeZ = 2.)
0048       : VrmlData_Geometry(theScene, theName),
0049         mySize(sizeX, sizeY, sizeZ)
0050   {
0051   }
0052 
0053   /**
0054    * Query the Box size
0055    */
0056   inline const gp_XYZ& Size() const { return mySize; }
0057 
0058   /**
0059    * Set the Box Size
0060    */
0061   inline void SetSize(const gp_XYZ& theSize)
0062   {
0063     mySize = theSize;
0064     SetModified();
0065   }
0066 
0067   /**
0068    * Query the primitive topology. This method returns a Null shape if there
0069    * is an internal error during the primitive creation (zero radius, etc.)
0070    */
0071   Standard_EXPORT const occ::handle<TopoDS_TShape>& TShape() override;
0072 
0073   /**
0074    * Create a copy of this node.
0075    * If the parameter is null, a new copied node is created. Otherwise new node
0076    * is not created, but rather the given one is modified.
0077    */
0078   Standard_EXPORT occ::handle<VrmlData_Node> Clone(
0079     const occ::handle<VrmlData_Node>& theOther) const override;
0080 
0081   /**
0082    * Fill the Node internal data from the given input stream.
0083    */
0084   Standard_EXPORT VrmlData_ErrorStatus Read(VrmlData_InBuffer& theBuffer) override;
0085 
0086   /**
0087    * Write the Node to output stream.
0088    */
0089   Standard_EXPORT VrmlData_ErrorStatus Write(const char* thePrefix) const override;
0090 
0091 private:
0092   // ---------- PRIVATE FIELDS ----------
0093 
0094   gp_XYZ mySize;
0095 
0096 public:
0097   // Declaration of CASCADE RTTI
0098   DEFINE_STANDARD_RTTI_INLINE(VrmlData_Box, VrmlData_Geometry)
0099 };
0100 
0101 // Definition of HANDLE object using Standard_DefineHandle.hxx
0102 #endif