Documentation


EngineGroupNode.cpp

Go to the documentation of this file.
00001 //
00002 // C++ Implementation: EngineGroupNode
00003 //
00004 // Description:
00005 //
00006 //
00007 // Author: François Faure <>, (C) 2004
00008 //
00009 // Copyright: See COPYING file that comes with this distribution
00010 //
00011 //
00012 #include "EngineGroupNode.h"
00013 #include <iostream>
00014 using std::cerr;
00015 using std::endl;
00016 
00017 namespace X3DTK
00018 {
00019 
00020 namespace X3D
00021 {
00022 
00023 EngineGroupNode::EngineGroupNode()
00024         : EngineNode()
00025 {
00026     defineTypeName("EngineGroup");
00027 }
00028 
00029 EngineGroupNode::EngineGroupNode( const EngineGroupNode& e )
00030         : EngineNode(e)
00031 {
00032 }
00033 
00034 
00035 EngineGroupNode::~EngineGroupNode()
00036 {}
00037 
00038 bool EngineGroupNode::addChild( const SFAbstractNode& n)
00039 {
00040     if( EngineNode* e = dynamic_cast<EngineNode*>(n) ){
00041         m_engines.push_back(e);
00042         return true;
00043     }
00044     else {
00045         cerr<<"EngineGroupNode::addChild, can not add a non-engine node"<<endl;
00046         return false;
00047     }
00048 }
00049 
00050 bool EngineGroupNode::setChild( const SFAbstractNode& n)
00051 {
00052     return addChild(n);
00053 }
00054 
00055 bool EngineGroupNode::removeChild( const SFAbstractNode& n)
00056 {
00057     if( EngineNode* e = dynamic_cast<EngineNode*>(n) ){
00058         m_engines.remove(e);
00059         return true;
00060     }
00061     else{
00062         cerr<<"EngineGroupNode::removeChild, can not remove a non-engine node"<<endl;
00063         return false;
00064     }
00065 }
00066 
00067 MFAbstractNode EngineGroupNode::getChildList() const
00068 {
00069     MFAbstractNode nodes;
00070     for( MFEngine::const_iterator e=m_engines.begin(); e!=m_engines.end(); ++e )
00071         nodes.push_back(*e);
00072     return nodes;
00073 }
00074 
00075 void EngineGroupNode::init()
00076 {
00077     for( MFEngine::iterator i=m_engines.begin(); i!=m_engines.end(); ++i )
00078     {
00079         (*i)->init();
00080     }
00081 }
00082 
00083 void EngineGroupNode::draw()
00084 {
00085     for( MFEngine::iterator i=m_engines.begin(); i!=m_engines.end(); ++i )
00086     {
00087         (*i)->draw();
00088     }
00089 }
00090 
00091 void EngineGroupNode::reset()
00092 {
00093     for( MFEngine::iterator i=m_engines.begin(); i!=m_engines.end(); ++i )
00094     {
00095         (*i)->reset();
00096     }
00097 }
00098 
00099 void EngineGroupNode::animate(float dt )
00100 {
00101     for( MFEngine::iterator i=m_engines.begin(); i!=m_engines.end(); ++i )
00102     {
00103         (*i)->animate(dt);
00104     }
00105 }
00106 void EngineGroupNode::updateBoundingBox()
00107 {
00108     for( MFEngine::iterator i=m_engines.begin(); i!=m_engines.end(); ++i )
00109     {
00110         (*i)->updateBoundingBox();
00111     }
00112 }
00113 
00114 SFNode EngineGroupNode::clone() const { return new EngineGroupNode(*this); }
00115 
00116 };
00117 
00118 };

Generated on Thu Dec 23 13:52:24 2004 by doxygen 1.3.6