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

X3DGroupingNode.cpp

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

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