00001 #include "GLStaticGroup.h" 00002 #include "StaticGroup.h" 00003 00004 #include <iostream> 00005 00006 using namespace X3DTK; 00007 using namespace std; 00008 00009 GLStaticGroup::GLStaticGroup() 00010 : X3DGLChildNode() 00011 { 00012 defineTagName("GLStaticGroup", "GLGrouping"); 00013 } 00014 00015 GLStaticGroup::GLStaticGroup(const GLStaticGroup &G) 00016 : X3DGLChildNode(G), _children(G._children) 00017 { 00018 defineTagName("GLStaticGroup", "GLGrouping"); 00019 } 00020 00021 SFNode GLStaticGroup::clone() const 00022 { 00023 return new GLStaticGroup(*this); 00024 } 00025 00026 GLStaticGroup::~GLStaticGroup() 00027 { 00028 } 00029 00030 bool GLStaticGroup::addChild(const SFNode &N) 00031 { 00032 if (dynamic_cast<X3DGLChildNode *>(N) != 0) 00033 { 00034 _children.push_back(N); 00035 return true; 00036 } 00037 00038 cerr << "GLStaticGroup::addChild : a node of type " << N->getTypeName() << " cannot be a child!" << endl; 00039 return false; 00040 } 00041 00042 bool GLStaticGroup::setChild(const SFNode &N) 00043 { 00044 if (dynamic_cast<X3DGLChildNode *>(N) != 0) 00045 { 00046 _children.push_back(N); 00047 return true; 00048 } 00049 00050 cerr << "GLStaticGroup::setChild : a node of type " << N->getTypeName() << " cannot be a child!" << endl; 00051 return false; 00052 } 00053 00054 bool GLStaticGroup::removeChild(const SFNode &N) 00055 { 00056 MFNode::iterator res = find(_children.begin(), _children.end(), N); 00057 if (res != _children.end()) 00058 { 00059 _children.erase(res); 00060 return true; 00061 } 00062 return false; 00063 } 00064 00065 void GLStaticGroup::removeScenesToChildren(const MFScene &sceneList) 00066 { 00067 for (MFNode::iterator it = _children.begin(); it != _children.end(); ++it) 00068 removeScenes(*it, sceneList); 00069 } 00070 00071 void GLStaticGroup::addScenesToChildren(const MFScene &sceneList) 00072 { 00073 for (MFNode::iterator it = _children.begin(); it != _children.end(); ++it) 00074 addScenes(*it, sceneList); 00075 }