Added the missing insertChild(index,child) and insertChild(index,child,value) into

osg::Switch.
This commit is contained in:
Robert Osfield 2003-11-20 12:03:51 +00:00
parent 7136a00b9a
commit 62c955fa19
2 changed files with 27 additions and 0 deletions

View File

@ -45,6 +45,10 @@ class SG_EXPORT Switch : public Group
virtual bool addChild( Node *child, bool value );
virtual bool insertChild( unsigned int index, Node *child );
virtual bool insertChild( unsigned int index, Node *child, bool value );
virtual bool removeChild( Node *child );
void setValue(unsigned int pos,bool value);

View File

@ -63,6 +63,29 @@ bool Switch::addChild( Node *child, bool value )
return false;
}
bool Switch::insertChild( unsigned int index, Node *child )
{
return insertChild(index,child,_newChildDefaultValue);
}
bool Switch::insertChild( unsigned int index, Node *child, bool value )
{
if (Group::insertChild(index,child))
{
if (index>=_values.size())
{
_values.push_back(value);
}
else
{
_values.insert(_values.begin()+index, value);
}
return true;
}
return false;
}
bool Switch::removeChild( Node *child )
{
// find the child's position.