Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Box.cpp

Go to the documentation of this file.
00001 #include "Box.h"
00002 
00003 using namespace X3DTK;
00004 
00005 Box::Box()
00006 :X3DGeometry3DNode(), size_(SFVec3f(2.0f, 2.0f, 2.0f))
00007 {
00008   defineTagName("Box", "Geometry3D");
00009 }
00010 
00011 Box::Box(const SFVec3f &size)
00012 :X3DGeometry3DNode(), size_(size)
00013 {
00014   defineTagName("Box", "Geometry3D");
00015 }
00016 
00017 Box::Box(const Box &B)
00018 :X3DGeometry3DNode(B), size_(B.size_)
00019 {
00020   defineTagName("Box", "Geometry3D");
00021 }
00022 
00023 SFNode Box::clone() const
00024 {
00025   return new Box(*this);
00026 }
00027 
00028 Box::~Box()
00029 {
00030 }
00031 
00032 void Box::setSize(const SFVec3f &size)
00033 {
00034   size_ = size;
00035 }
00036 
00037 void Box::loadAttributes(const X3DFileElement *element)
00038 {
00039   int index;
00040   index = element->getIndexAttribute("size");
00041   if (index != -1)
00042     size_ = SFVec3f(element->getAttribute(index));
00043 }
00044 
00045 SFString Box::writeAttributes() const
00046 {
00047   SFString attr;
00048   if (size_ != SFVec3f(2.0f, 2.0f, 2.0f))
00049       attr += " size=\"" + toSFString(size_) + "\"";
00050       
00051   return attr;    
00052 }

Generated on Wed May 14 10:03:07 2003 for X3DToolKit by doxygen1.3