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

LineProperties.cpp

Go to the documentation of this file.
00001 #include "LineProperties.h"
00002 
00003 using namespace X3DTK;
00004 
00005 LineProperties::LineProperties()
00006 : X3DAppearanceChildNode(), lineStyle_(0), width_(0.0f)
00007 {
00008   defineTagName("LineProperties", "Shape");
00009 }
00010 
00011 LineProperties::LineProperties(SFInt32 lineStyle, SFFloat width)
00012 : X3DAppearanceChildNode(), lineStyle_(lineStyle), width_(width)
00013 {
00014   defineTagName("LineProperties", "Shape");
00015 }
00016 
00017 LineProperties::LineProperties(const LineProperties &L)
00018 : X3DAppearanceChildNode(L), lineStyle_(L.lineStyle_), width_(L.width_)
00019 {
00020   defineTagName("LineProperties", "Shape");
00021 }
00022 
00023 SFNode LineProperties::clone() const
00024 {
00025   return new LineProperties(*this);
00026 }
00027 
00028 LineProperties::~LineProperties()
00029 {
00030 }
00031 
00032 void LineProperties::setLineStyle(SFInt32 lineStyle)
00033 {
00034   lineStyle_ = lineStyle;
00035 }
00036 
00037 void LineProperties::setWidth(SFFloat width)
00038 {
00039   width_ = width;
00040 }
00041 
00042 void LineProperties::loadAttributes(const X3DFileElement *element)
00043 {
00044   int index;
00045   index = element->getIndexAttribute("lineStyle");
00046   if (index != -1)
00047    lineStyle_ = element->getAttribute(index).toInt();
00048    
00049   index = element->getIndexAttribute("width");
00050   if (index != -1)
00051    width_ = element->getAttribute(index).toFloat(); 
00052 }
00053 
00054 SFString LineProperties::writeAttributes() const
00055 {
00056   SFString attr;
00057   if (lineStyle_ != 0)
00058     attr += " lineStyle = \"" + toSFString(lineStyle_) + "\"";  
00059   if (width_ != 0.0f)
00060     attr += " width = \"" + toSFString(width_) + "\"";
00061       
00062   return attr;
00063 }

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