00001 #include "StaticGroup.h" 00002 00003 #include <iostream> 00004 00005 using namespace X3DTK; 00006 using namespace std; 00007 00008 StaticGroup::StaticGroup() 00009 : X3DChildNode(), X3DBoundedObject() 00010 { 00011 defineTagName("StaticGroup", "Grouping"); 00012 } 00013 00014 StaticGroup::StaticGroup(const SFVec3f &bboxCenter, const SFVec3f &bboxSize) 00015 : X3DChildNode(), X3DBoundedObject(bboxCenter, bboxSize) 00016 { 00017 defineTagName("StaticGroup", "Grouping"); 00018 } 00019 00020 StaticGroup::StaticGroup(const StaticGroup &G) 00021 : X3DChildNode(G), X3DBoundedObject(G), children_(G.children_) 00022 { 00023 defineTagName("StaticGroup", "Grouping"); 00024 } 00025 00026 SFNode StaticGroup::clone() const 00027 { 00028 return new StaticGroup(*this); 00029 } 00030 00031 StaticGroup::~StaticGroup() 00032 { 00033 } 00034 00035 bool StaticGroup::addChild(const SFNode &N) 00036 { 00037 if (dynamic_cast<X3DChildNode *>(N) != 0) 00038 { 00039 children_.push_back(N); 00040 addLink(this, N); 00041 return true; 00042 } 00043 00044 cerr << "StaticGroup::addChild : a node of type " << N->getTypeName() << " cannot be a child!" << endl; 00045 return false; 00046 } 00047 00048 bool StaticGroup::setChild(const SFNode &N) 00049 { 00050 if (dynamic_cast<X3DChildNode *>(N) != 0) 00051 { 00052 children_.push_back(N); 00053 addLink(this, N); 00054 return true; 00055 } 00056 00057 cerr << "StaticGroup::setChild : a node of type " << N->getTypeName() << " cannot be a child!" << endl; 00058 return false; 00059 } 00060 00061 bool StaticGroup::removeChild(const SFNode &N) 00062 { 00063 MFNode::iterator res = find(children_.begin(), children_.end(), N); 00064 if (res != children_.end()) 00065 { 00066 children_.erase(res); 00067 removeLink(this, N); 00068 return true; 00069 } 00070 00071 return false; 00072 } 00073 00074 void StaticGroup::loadAttributes(const X3DFileElement *element) 00075 { 00076 X3DBoundedObject::loadAttributes(element); 00077 } 00078 00079 SFString StaticGroup::writeAttributes() const 00080 { 00081 return X3DBoundedObject::writeAttributes(); 00082 } 00083 00084 void StaticGroup::removeScenesToChildren(const MFScene &sceneList) 00085 { 00086 for (MFNode::iterator it = children_.begin(); it != children_.end(); ++it) 00087 removeScenes(*it, sceneList); 00088 } 00089 00090 void StaticGroup::addScenesToChildren(const MFScene &sceneList) 00091 { 00092 for (MFNode::iterator it = children_.begin(); it != children_.end(); ++it) 00093 addScenes(*it, sceneList); 00094 } 00095