Switch
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_SWITCH
#define OSG_SWITCH 1
#include <osg/Group>
namespace osg {
class OSG_EXPORT Switch : public Group
{
public :
Switch();
Switch(const Switch&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual Switch* asSwitch() { return this; }
virtual const Switch* asSwitch() const { return this; }
META_Node(osg, Switch);
virtual void traverse(NodeVisitor& nv);
void setNewChildDefaultValue(bool value) { _newChildDefaultValue = value; }
bool getNewChildDefaultValue() const { return _newChildDefaultValue; }
using osg::Group::addChild;
using osg::Group::insertChild;
virtual bool addChild( Node *child );
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 removeChildren(unsigned int pos,unsigned int numChildrenToRemove);
void setValue(unsigned int pos,bool value);
bool getValue(unsigned int pos) const;
void setChildValue(const Node* child,bool value);
bool getChildValue(const Node* child) const;
bool setAllChildrenOff();
bool setAllChildrenOn();
bool setSingleChildOn(unsigned int pos);
typedef std::vector<bool> ValueList;
void setValueList(const ValueList& values) { _values=values; }
const ValueList& getValueList() const { return _values; }
virtual BoundingSphere computeBound() const;
protected :
virtual ~Switch() {}
// This is effectively a bit mask.
bool _newChildDefaultValue;
ValueList _values;
};
}
#endif
Group
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Group::insertChild
virtual bool insertChild(unsigned int index, Node *child)
osg::Group::addChild
virtual bool addChild(Node *child)
osg::Group::Group
Group()
osg::NodeVisitor
Definition NodeVisitor:82
osg::Node
Definition Node:72
osg::Switch::getChildValue
bool getChildValue(const Node *child) const
osg::Switch::setNewChildDefaultValue
void setNewChildDefaultValue(bool value)
Definition Switch:44
osg::Switch::getValueList
const ValueList & getValueList() const
Definition Switch:86
osg::Switch::addChild
virtual bool addChild(Node *child, bool value)
osg::Switch::setChildValue
void setChildValue(const Node *child, bool value)
osg::Switch::removeChildren
virtual bool removeChildren(unsigned int pos, unsigned int numChildrenToRemove)
osg::Switch::META_Node
META_Node(osg, Switch)
osg::Switch::Switch
Switch()
osg::Switch::setAllChildrenOff
bool setAllChildrenOff()
osg::Switch::setSingleChildOn
bool setSingleChildOn(unsigned int pos)
osg::Switch::traverse
virtual void traverse(NodeVisitor &nv)
osg::Switch::insertChild
virtual bool insertChild(unsigned int index, Node *child)
osg::Switch::addChild
virtual bool addChild(Node *child)
osg::Switch::asSwitch
virtual const Switch * asSwitch() const
Definition Switch:37
osg::Switch::getValue
bool getValue(unsigned int pos) const
osg::Switch::computeBound
virtual BoundingSphere computeBound() const
osg::Switch::setValue
void setValue(unsigned int pos, bool value)
osg::Switch::asSwitch
virtual Switch * asSwitch()
Definition Switch:36
osg::Switch::insertChild
virtual bool insertChild(unsigned int index, Node *child, bool value)
osg::Switch::_values
ValueList _values
Definition Switch:96
osg::Switch::ValueList
std::vector< bool > ValueList
Definition Switch:82
osg::Switch::Switch
Switch(const Switch &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
osg::Switch::setValueList
void setValueList(const ValueList &values)
Definition Switch:84
osg::Switch::setAllChildrenOn
bool setAllChildrenOn()
osg::Switch::getNewChildDefaultValue
bool getNewChildDefaultValue() const
Definition Switch:46
osg::Switch::_newChildDefaultValue
bool _newChildDefaultValue
Definition Switch:95
osg::Switch::~Switch
virtual ~Switch()
Definition Switch:92
osg
Definition AlphaFunc:19
osg::BoundingSphere
BoundingSphered BoundingSphere
Definition BoundingSphere:314
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39