Main Page | Class List | Class Members

osgchips::Stacks Class Reference

Container of osgchips::Stack instances. More...

List of all members.

Public Member Functions

 Stacks ()
 Stacks (ChipBank *chipBank)
virtual bool addStack (Stack *stack)
virtual bool replaceStack (Stack *origStack, Stack *newStack)
virtual bool setStack (unsigned int index, Stack *stack)
unsigned int getNumStacks () const
StackgetStack (unsigned int index)
const StackgetStack (unsigned int index) const
bool unserialize (struct _xmlDoc *doc, osgDB::Registry *registry)
bool unserialize (const std::string &fileName, osgDB::Registry *registry)


Detailed Description

Container of osgchips::Stack instances.

All osgchips::Stack instances must be children of an osgchips::Stacks instance to be displayed. It provides a square bounding box (osgchips::Stacks do not provide bounding boxes) and picking based on the bounding box. As a result, osgchips::Stacks will behave as expected if the stacks are close to each other. If there are large gaps between them, the gaps will be included in the bounding box.

osgchips::Stacks is publicly derived from osg::Geode and imposes a single constraints in the use of public osg::Geode methods by the application: instead of using getNumChildren, addChild, replaceChild, getChild and setChild the application must use getNumStacks, addStack, replaceStack, getStack and setStack respectively.


Constructor & Destructor Documentation

osgchips::Stacks::Stacks  ) 
 

Create an osgchips::Stack container that relies on the osgchips::ChipBank singleton for chip mesh information.

osgchips::Stacks::Stacks ChipBank chipBank  ) 
 

Create an osgchips::Stack container that relies on chipBank for chip mesh information.

Parameters:
chipBank pointer to chip types and mesh repository


Member Function Documentation

virtual bool osgchips::Stacks::addStack Stack stack  )  [virtual]
 

Append stack to the list of children.

Parameters:
stack the child to add
Returns:
true on success, false on error.

unsigned int osgchips::Stacks::getNumStacks  )  const [inline]
 

Return the current number of stacks.

Returns:
the number of stacks

const Stack* osgchips::Stacks::getStack unsigned int  index  )  const [inline]
 

Return a read only pointer to the stack at position index in the list of children.

Returns:
a pointer to a osgchips::Stack or NULL if the index is invalid.

Stack* osgchips::Stacks::getStack unsigned int  index  )  [inline]
 

Return a pointer to the stack at position index in the list of children.

Returns:
a pointer to a osgchips::Stack or NULL if the index is invalid.

virtual bool osgchips::Stacks::replaceStack Stack origStack,
Stack newStack
[virtual]
 

Remove origStack from the list of children and insert newStack at the same position.

Parameters:
origStack the stack to remove
newStack the stack to insert
Returns:
true on success, false on error.

virtual bool osgchips::Stacks::setStack unsigned int  index,
Stack stack
[virtual]
 

Insert stack at position index in the list of children, shifting the children already at position index or above.

Parameters:
index the position in the list of children, counting from zero
stack the stack to insert
Returns:
true on success, false on error.

bool osgchips::Stacks::unserialize const std::string &  fileName,
osgDB::Registry *  registry
 

Parse the fileName and interpret any osgchips XML element to fill the osgchips::ChipBank singleton. The registry can be obtained by the osgDB::Registry::instance() static method.

See the other prototype for more information.

Parameters:
fileName path name to a valid XML document.
registry a pointer to the OpenSceneGraph registry
Returns:
true on success, false on error.

bool osgchips::Stacks::unserialize struct _xmlDoc *  doc,
osgDB::Registry *  registry
 

Look for an osgchips XML element and fill the osgchips::ChipBank singleton. The registry can be obtained by the osgDB::Registry::instance() static method.

It is not mandatory for the XML document to contain an osgchips element. The XML document may contain more than one osgchips element. Each element will add content to the osgchips::ChipBank singleton and add children to the container.

Parameters:
doc a valid libxml2 pointer to the in-memory representation of an XML document.
registry a pointer to the OpenSceneGraph registry
Returns:
true on success, false on error.


The documentation for this class was generated from the following file:
Generated on Wed Dec 15 14:45:58 2004 for osgchips by  doxygen 1.3.9.1