Bookshelf Contents Previous Next Glossary Index Search

AlGroupNode

A DAG node that can contain a list of DAG nodes.

Synopsis

#include <AlGroupNode.h>
class AlGroupNode : public AlDagNode
AlGroupNode();
virtual ~AlGroupNode();
virtual AlObject* copyWrapper() const;
statusCode create();
virtual AlObjectType type() const;
AlDagNode* childNode() const;
AlDagNode* childNode(AlTM&) const;
AlGroupNode* nextInstance() const;
AlGroupNode* prevInstance() const;
statusCode nextInstanceD();
statusCode prevInstanceD();
boolean isInstanceable();
boolean isInstanceNode();
boolean isAncestorAnInstance();
statusCode addChildNode( AlDagNode* );
AlGroupNode* createInstance();
statusCode applyIteratorToChildren( AlIterator*, int& );

Description

This class encapsulates the functionality for creating, manipulating and deleting a group node. A group node is a DAG node that refers to a list of child DAG nodes. It is this type of DAG node that allows the hierarchical grouping of DAG nodes.

The transformations that can be defined for a group node are inherited by each child DAG node. This means that a group node's transformations are combined with a child node's transformations to define a global transformation for the object that the child node refers to.

A group node's list of child DAG nodes can be shared by more than one group node. If a group node's list of child nodes is shared by another group node, both group nodes are considered "instanced". This can be achieved by using the createInstance() method to create an instanced group node from another group node. The instanced group node is created as a sibling of the group node. There are methods for finding the next and previous instanced group node among its siblings and for determining whether a group node is an instanced node.

To create a group node, the user must call the constructor and then the create method for an AlGroupNode object. If a group node is not an instanced group node, deleting it will cause the deletion of all the child DAG nodes and the deletion of any objects the child DAG nodes refer to. Deleting an instanced group node will not cause all of its child nodes to be deleted since the list of child nodes is shared by another instanced group node.

Note on AlGroupNode::deleteObject()

If a group node is an instanced group node, then only the group node is removed from its list of siblings and is deleted. The list of child DAG nodes an instanced DAG node refers to is not deleted. If this group node is not an instanced group node (i.e. none of its siblings share its list of child DAG nodes), then the group node is removed from the list of siblings it belongs to and the group node and every child node of the group node is deleted.

Summary

AlGroupNode::AlGroupNode()

Description

Constructs an AlGroupNode wrapper object. Use the create() method to initialize an AlGroupNode. Use the create() method to allocate a Dag_node data structure

AlGroupNode::~AlGroupNode()

Description

Destructor for AlGroupNode wrapper object.

AlObject* AlGroupNode::copyWrapper() const

Description

Returns an exact duplicate of this AlGroupNode wrapper.

statusCode AlGroupNode::create()

Description

Creates a new group node with no children.

Return Codes

sSuccess - group node was successfully created

sFailure - group node could not be created

AlObjectType AlGroupNode::type() const

Description

Returns the class identifier 'kGroupNodeType'.

boolean AlGroupNode::isInstanceable()

Description

Returns FALSE if this group node contains a non-instanceable DAG node. Otherwise it returns TRUE.

boolean AlGroupNode::isInstanceNode()

Description

Returns TRUE if this object shares its list of children with another sibling AlGroupNode.

boolean AlGroupNode::isAncestorAnInstance()

Description

Returns TRUE if this group node or one of its ancestors is an instance group node.

AlDagNode* AlGroupNode::childNode() const

Description

Returns a pointer to the first AlDagNode of its list of child AlDagNodes. Returns NULL if the list of children is empty.

AlDagNode* AlGroupNode::childNode(AlTM& tm) const

Description

Returns a pointer to the first AlDagNode of its list of child AlDagNodes. Returns NULL if the list of children is empty. The AlTM will be updated with the groupNode's TM if a childNode exists.

Arguments

> tm - the transformation matrix to be updated with the groupNode's TM

AlGroupNode* AlGroupNode::nextInstance() const

Description

Returns a pointer to the object's next sibling node in the list that is an instanced group node. Returns NULL if there is no next instanced sibling.

AlGroupNode* AlGroupNode::prevInstance() const

Description

Returns a pointer to the object's previous sibling node in the list that is an instanced group node. Returns NULL if there is no previous instanced sibling.

statusCode AlGroupNode::nextInstanceD()

Description

Destructively points this wrapper to the object's next sibling node in the list that is an instanced group node.

Return Codes

sSuccess - wrapper now points to the next sibling

sFailure - there is no next instanced sibling

sInvalidObject - the groupnode was invalid

statusCode AlGroupNode::prevInstanceD()

Description

Destructively points this wrapper to the object's previous sibling node in the list that is an instanced group node.

Return Codes

sSuccess - wrapper now points to the previous sibling

sFailure - there is no previous instanced sibling

sInvalidObject - the groupnode was invalid

statusCode AlGroupNode::addChildNode( AlDagNode *child )

Description

Adds an AlDagNode to the end of the list of child AlDagNodes. If the AlDagNode is already a child of this object, then nothing is done. Otherwise, the AlDagNode is removed from the list of siblings it belongs to and added to the end of this object's list of children. If the AlDagNode is an AlGroupNode and it has siblings that are instanced AlGroupNodes, those instanced siblings are also made children of this object. It is illegal for the AlDagNode argument to be NULL or for it to not have had its create() method called.

Arguments

< child - the AlDagNode to be made a child of this object

Return Codes

sSuccess - the argument is now a child of this object

sInvalidArgument - 'child' was not valid

sFailure - the AlDagNode could not be made a child of this object

sInvalidObject - the groupnode was invalid

statusCode AlGroupNode::applyIteratorToChildren( AlIterator* iter, int& rc )

Description

Applies the passed-in AlIterator to each of the children of this object.

Arguments

< iter - the iterator to apply to each child

> rc - the result of the last application of the iterator

Return Codes

sSuccess - the iterator was successfully applied

sInvalidObject - the groupnode was invalid



Bookshelf Contents Previous Next Glossary Index Search

[email protected]
Copyright © 1998, Alias|Wavefront, a division of Silicon Graphics Limited. All rights reserved.