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