25 cerr <<
"\aWarning: SceneNode::RecursiveCopy() is deprecated.\n";
27 std::list<VART::SceneNode*>::iterator iter;
29 thisCopy = this->Copy();
31 for( iter = childList.begin(); iter !=childList.end(); iter++ )
32 thisCopy->
AddChild( *(*iter)->RecursiveCopy() );
56 childList.push_back(&child);
61 assert(childPtr != NULL);
62 list<VART::SceneNode*>::iterator iter = childList.begin();
63 while (iter != childList.end())
65 if ((*iter) == childPtr)
67 childList.erase(iter);
78 bool result = DrawInstanceOGL();
79 list<VART::SceneNode*>::const_iterator iter = childList.begin();
80 for (; iter != childList.end(); ++iter)
81 result = (result && (*iter)->DrawOGL());
87 list<VART::SceneNode*>::const_iterator iter;
88 for (iter = childList.begin(); iter != childList.end(); ++iter)
90 (*iter)->AutoDeleteChildren();
91 if ((*iter)->autoDelete)
98 list<VART::SceneNode*>::const_iterator iter;
100 for (iter = childList.begin(); iter != childList.end(); ++iter)
102 if ((*iter)->GetDescription() == name)
106 if (result)
return result;
115 cerr <<
"\aWarning: SceneNode::GetChilds() is deprecated.\n";
121 assert(resultPtr != NULL);
122 assert(targetPtr != NULL);
124 return RecursiveFindPathTo(targetPtr, resultPtr);
129 assert(resultPtr != NULL);
131 return RecursiveFindPathTo(targetName, resultPtr);
136 list<VART::SceneNode*>::const_iterator iter;
138 if (targetPtr ==
this)
142 for (iter = childList.begin(); iter != childList.end(); ++iter)
144 if ((*iter)->RecursiveFindPathTo(targetPtr, resultPtr))
156 list<VART::SceneNode*>::const_iterator iter;
158 if (description == targetName)
162 for (iter = childList.begin(); iter != childList.end(); ++iter)
164 if ((*iter)->RecursiveFindPathTo(targetName, resultPtr))
180 list<SceneNode*>::const_iterator iter = childList.begin();
181 for (; iter != childList.end(); ++iter)
183 (*iter)->TraverseDepthFirst(operatorPtr);
190 list<const SceneNode*> queue;
193 queue.push_back(
this);
194 while (!queue.empty())
196 nodePtr = queue.front();
199 for (list<SceneNode*>::const_iterator iter = nodePtr->
childList.begin();
200 iter != nodePtr->
childList.end(); ++iter)
201 queue.push_back(*iter);
212 list<SceneNode*>::const_iterator iter = childList.begin();
213 for (; locatorPtr->
NotFinished() && (iter != childList.end()); ++iter)
215 (*iter)->LocateDepthFirst(locatorPtr);
228 list<const SceneNode*> queue;
230 queue.push_back(
this);
231 while (locatorPtr->
NotFinished() && (!queue.empty()))
233 nodePtr = queue.front();
236 list<SceneNode*>::const_iterator iter = nodePtr->
childList.begin();
237 for (; iter != nodePtr->
childList.end(); ++iter)
238 queue.push_back(*iter);
245 list<VART::SceneNode*>::const_iterator iter;
248 cerr <<
"\aWaring: SceneNode::GetNodeTypeList is deprecated. Please use SceneNode::TraverseDepthFirst.\n";
252 if ( dynamic_cast <VART::Joint*>(
this) != NULL )
254 nodeList.push_back(
this );
259 if ( dynamic_cast <VART::Transform*>(
this) != NULL )
261 nodeList.push_back(
this );
266 if ( dynamic_cast <VART::MeshObject*>(
this) != NULL )
268 nodeList.push_back(
this );
275 for (iter = childList.begin(); iter != childList.end(); ++iter)
276 i = i + (*iter)->GetNodeTypeList( type, nodeList);
284 list<SceneNode*>::const_iterator iter = childList.begin();
285 string indentStr(indent,
' ');
287 os << indentStr <<
"Unimplemented XmlPrintOn for " << GetID() <<
"\n";
288 if (recursivePrinting)
289 while (iter != childList.end())
291 (*iter)->XmlPrintOn(os, indent + 2);
virtual void TraverseDepthFirst(SNOperator *operatorPtr) const
Process all children in depth-first order.
Base class for objects that compose a scene graph.
std::list< SceneNode * > childList
Child list.
virtual void TraverseBreadthFirst(SNOperator *operatorPtr) const
Process all children in breadth-first order.
Header file for V-ART class "SceneNode".
virtual SceneNode * RecursiveCopy()
void AddNodeToPath(SceneNode *nodePtr)
Adds a node to internal Path.
virtual void OperateOn(const SceneNode *nodePtr)=0
Process given node.
SceneNode()
Creates an uninitialized scene node.
std::string description
Textual identification.
virtual void OperateOn(const SceneNode *nodePtr)=0
Objects that process scene nodes.
virtual void XmlPrintOn(std::ostream &os, unsigned int indent) const
Recursively outputs XML representation of the scene node.
virtual void LocateBreadthFirst(SNLocator *locatorPtr) const
Seaches for a particular scene node (breadth first)
void AutoDeleteChildren() const
Deletes (dealocate memory) recursively all children marked as 'autoDelete'.
Header file for V-ART class "SnOperator".
Header file for V-ART class "Joint".
virtual void LocateDepthFirst(SNLocator *locatorPtr) const
Seaches for a particular scene node (depth first)
SceneNode & operator=(const SceneNode &node)
std::list< SceneNode * > GetChilds()
bool Finished() const
Indicates whether the traversal has finished.
bool RecursiveFindPathTo(SceneNode *targetPtr, SGPath *resultPtr) const
Recursive auxiliar method for FindPathTo.
Header file for V-ART class "SGPath".
static bool recursivePrinting
void PushFront(SceneNode *nodePtr)
Adds a node to the path beginning.
bool NotFinished() const
Indicates whether the traversal has not finished.
virtual bool DrawOGL() const
Recursive drawing using OpenGL commands.
Header file for V-ART class "SNLocator".
SceneNode * FindChildByName(const std::string &name) const
Recusively searches its children for a given name.
Scene Node Locator – used to find a particular object in the scene graph.
Header file for V-ART class "MeshObject".
bool FindPathTo(SceneNode *targetPtr, SGPath *resultPtr) const
Search target among children.
void Clear()
Erases all elements.
int GetNodeTypeList(TypeID type, std::list< SceneNode * > &nodeList)
Find all the nodes of with typeID 'type'.
bool DetachChild(SceneNode *childPtr)
Removes a child from the child list.
void AddChild(SceneNode &child)
Add a child at the end of child list.