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

FillProperties.cpp

Go to the documentation of this file.
00001 #include "FillProperties.h"
00002 
00003 using namespace X3DTK;
00004 
00005 FillProperties::FillProperties()
00006 : X3DAppearanceChildNode(), fillStyle_(SFString("")), hatchStyle_(1), hatchColor_(SFColor(1.0f, 1.0f, 1.0f))
00007 {
00008   defineTagName("FillProperties", "Shape");
00009 }
00010 
00011 FillProperties::FillProperties(SFString fillStyle, SFInt32 hatchStyle, SFColor hatchColor)
00012 : X3DAppearanceChildNode(), fillStyle_(fillStyle), hatchStyle_(hatchStyle), hatchColor_(hatchColor)
00013 {
00014   defineTagName("FillProperties", "Shape");
00015 }
00016 
00017 FillProperties::FillProperties(const FillProperties &F)
00018 : X3DAppearanceChildNode(F), fillStyle_(F.fillStyle_), hatchStyle_(F.hatchStyle_), hatchColor_(F.hatchColor_)
00019 {
00020   defineTagName("FillProperties", "Shape");
00021 }
00022 
00023 SFNode FillProperties::clone() const
00024 {
00025   return new FillProperties(*this);
00026 }
00027 
00028 FillProperties::~FillProperties()
00029 {
00030 }
00031 
00032 void FillProperties::setFillStyle(SFString fillStyle)
00033 {
00034   fillStyle_ = fillStyle;
00035 }
00036 
00037 void FillProperties::setHatchStyle(SFInt32 hatchStyle)
00038 {
00039   hatchStyle_ = hatchStyle;
00040 }
00041 
00042 void FillProperties::setHatchColor(SFColor hatchColor)
00043 {
00044   hatchColor_ = hatchColor;
00045 }
00046 
00047 void FillProperties::loadAttributes(const X3DFileElement *element)
00048 {
00049   int index;
00050   index = element->getIndexAttribute("fillStyle");
00051   if (index != -1)
00052     fillStyle_ = element->getAttribute(index);
00053   
00054   index = element->getIndexAttribute("hatchStyle");
00055   if (index != -1)
00056     hatchStyle_ = element->getAttribute(index).toInt();  
00057   
00058   index = element->getIndexAttribute("hatchColor");
00059   if (index != -1)
00060     hatchColor_ = SFColor(element->getAttribute(index));    
00061 }
00062 
00063 SFString FillProperties::writeAttributes() const
00064 {
00065   SFString attr;
00066   if (fillStyle_ != "NONE")
00067     attr += " fillStyle = \"" + fillStyle_ + "\"";
00068   if (hatchStyle_ != 1)
00069     attr += " hatchStyle = \"" + toSFString(hatchStyle_) + "\"";  
00070   if (hatchColor_ != SFColor(1.0f, 1.0f, 1.0f))
00071     attr += " hatchColor = \"" + toSFString(hatchColor_) + "\"";
00072       
00073   return attr;
00074 }

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