Package xode :: Module node :: Class TreeNode
[show private | hide private]
[frames | no frames]

Class TreeNode

Known Subclasses:
Body, Geom, Joint, Mass, Root, Space, World

A node in an XODE parse tree.
Method Summary
  __init__(self, name, parent)
Initialises this node.
  addChild(self, child, name)
Adds a child node.
list getChildren(self)
Return the list of child nodes.
instance of TreeNode getFirstAncestor(self, type)
Find the first ancestor of this node that represents an ODE object of the specified type.
str or None getName(self)
Return this node's name.
instance of transform.Transform getNodeTransform(self)
Return the transform of this node.
instance getODEObject(self)
Return the ODE object represented by this node.
instance of TreeNode or None getParent(self)
Return the parent of this node.
instance of TreeNode getRoot(self)
Finds the root node of this parse tree.
instance of transform.Transform getTransform(self, untilAncestor)
Calculates the absolute transform at this node.
instance of TreeNode namedChild(self, name)
Retrieves a named child node.
  setNodeTransform(self, transform)
  setODEObject(self, obj)
Sets the ODE object represented by this node.
  takeParser(self, parser)
Called to make this node handle further parsing.

Method Details

__init__(self, name, parent)
(Constructor)

Initialises this node. If the parent is not None, parent.addChild() is called.
Parameters:
name - The name of this container or None if there is none.
           (type=str)
parent - The parent of this node or None.
           (type=instance or None)

addChild(self, child, name)

Adds a child node.
Parameters:
child - The child node.
           (type=instance of TreeNode)
name - The child's name. If the child is not named, pass None.
           (type=str or None)

getChildren(self)

Returns:
The list of child nodes.
           (type=list)

getFirstAncestor(self, type)

Find the first ancestor of this node that represents an ODE object of the specified type.
Parameters:
type - The ODE type.
           (type=class)
Returns:
The ancestor node.
           (type=instance of TreeNode)
Raises:
AncestorNotFoundError - If no ancestor matching the criteria was found.

getName(self)

Returns:
This node's name. If it is not named, None is returned.
           (type=str or None)

getNodeTransform(self)

Returns:
The transform of this node.
           (type=instance of transform.Transform)

getODEObject(self)

Returns:
The ODE object represented by this node. None is returned if this node does not represent an ODE object.
           (type=instance)

getParent(self)

Returns:
The parent of this node. None is returned if there is no parent node.
           (type=instance of TreeNode or None)

getRoot(self)

Finds the root node of this parse tree.
Returns:
The root node.
           (type=instance of TreeNode)

getTransform(self, untilAncestor=None)

Calculates the absolute transform at this node. It calculates the transforms recursively from the root node. If untilAncestor is passed, the transform is calculated relative to it. If untilAncestor is passed but is not an ancestor of this node, the transform is calculated from the root node as if None was passed.
Parameters:
untilAncestor - The ancestor to calculate the transform from.
           (type=instance of TreeNode)
Returns:
The absolute transform at this node.
           (type=instance of transform.Transform)

namedChild(self, name)

Retrieves a named child node. If no child by that name is a direct child of this node, all the child nodes are searched recursively until either the named child is found or every node has been searched.
Parameters:
name - The name of the object.
           (type=str)
Returns:
The node.
           (type=instance of TreeNode)
Raises:
KeyError - If no node with the given name was found.

setNodeTransform(self, transform)

Parameters:
transform - This node's transform.
           (type=instance of transform.Transform)

setODEObject(self, obj)

Sets the ODE object represented by this node.
Parameters:
obj - The ODE object.
           (type=instance)

takeParser(self, parser)

Called to make this node handle further parsing. It will release the parser when it has finished.
Parameters:
parser - The parser.
           (type=instance of parser.Parser)

Generated by Epydoc 2.1 on Sun Feb 4 17:54:12 2007 http://epydoc.sf.net