## class SG_EXPORT osg::Switch

> Switch is a Group node which allows switching between children.

## Inheritance:

### Public Methods

Switch()
Switch(const Switch&, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
  Copy constructor using CopyOp to manage deep vs shallow copy
META_Node(osg, Switch)
virtual void traverse(NodeVisitor& nv)
void setNewChildDefaultValue(bool value)
bool getNewChildDefaultValue() const
virtual bool addChild( Node* child )
virtual bool addChild( Node* child, bool value )
virtual bool removeChild( Node* child )
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()
  Set all the children off (false), and set the new default child value to off (false)
bool setAllChildrenOn()
  Set all the children on (true), and set the new default child value to on (true)
bool setSingleChildOn(unsigned int pos)
  Set a single child to be on, switch off all other children
void setValue(int value)
  Selects the active child Node or enables a special SwitchType mode.
int getValue() const
const ValueList& getValueList() const

### Public Members

enum Values
  Special values for the Switch.
typedef std::vector<bool> ValueList

### Protected Fields

bool _newChildDefaultValue
ValueList _values

### Protected Methods

virtual ~Switch()

### Inherited from Group:

### Public Methods

virtual Group* asGroup()
virtual const Group* asGroup() const
virtual bool insertChild( unsigned int index, Node* child )
virtual bool replaceChild( Node* origChild, Node* newChild )
inline unsigned int getNumChildren() const
virtual bool setChild( unsigned int i, Node* node )
inline Node* getChild( unsigned int i )
inline const Node* getChild( unsigned int i ) const
inline bool containsNode( const Node* node ) const
inline unsigned int getChildIndex( const Node* node ) const

### Protected Fields

NodeList _children

### Protected Methods

virtual bool computeBound() const

### Inherited from Node:

### Public Methods

virtual Object* cloneType() const
virtual Object* clone(const CopyOp& copyop) const
virtual bool isSameKindAs(const Object* obj) const
virtual const char* libraryName() const
virtual const char* className() const
virtual Transform* asTransform()
virtual const Transform* asTransform() const
virtual void accept(NodeVisitor& nv)
virtual void ascend(NodeVisitor& nv)
inline void setName( const std::string& name )
inline void setName( const char* name )
inline const std::string& getName() const
inline const ParentList& getParents() const
inline ParentList getParents()
inline Group* getParent(unsigned int i)
inline const Group* getParent(unsigned int i) const
inline unsigned int getNumParents() const
void setUpdateCallback(NodeCallback* nc)
inline NodeCallback* getUpdateCallback()
inline const NodeCallback* getUpdateCallback() const
inline unsigned int getNumChildrenRequiringUpdateTraversal() const
void setCullCallback(NodeCallback* nc)
inline NodeCallback* getCullCallback()
inline const NodeCallback* getCullCallback() const
void setCullingActive(bool active)
inline bool getCullingActive() const
inline unsigned int getNumChildrenWithCullingDisabled() const
inline bool isCullingActive() const
inline unsigned int getNumChildrenWithOccluderNodes() const
bool containsOccluderNodes() const
inline void setNodeMask(NodeMask nm)
inline NodeMask getNodeMask() const
inline const DescriptionList& getDescriptions() const
inline DescriptionList& getDescriptions()
inline const std::string& getDescription(unsigned int i) const
inline std::string& getDescription(unsigned int i)
inline unsigned int getNumDescriptions() const
void addDescription(const std::string& desc)
inline void setStateSet(osg::StateSet* dstate)
osg::StateSet* getOrCreateStateSet()
inline osg::StateSet* getStateSet()
inline const osg::StateSet* getStateSet() const
inline const BoundingSphere& getBound() const
void dirtyBound()

### Public Members

typedef std::vector<Group*> ParentList
typedef unsigned int NodeMask
typedef std::vector<std::string> DescriptionList

### Protected Fields

mutable BoundingSphere _bsphere
mutable bool _bsphere_computed
std::string _name
ParentList _parents
ref_ptr<NodeCallback> _updateCallback
unsigned int _numChildrenRequiringUpdateTraversal
ref_ptr<NodeCallback> _cullCallback
bool _cullingActive
unsigned int _numChildrenWithCullingDisabled
unsigned int _numChildrenWithOccluderNodes
NodeMask _nodeMask
DescriptionList _descriptions
ref_ptr<StateSet> _stateset

### Protected Methods

void addParent(osg::Group* node)
void removeParent(osg::Group* node)
void setNumChildrenRequiringUpdateTraversal(unsigned int num)
void setNumChildrenWithCullingDisabled(unsigned int num)
void setNumChildrenWithOccluderNodes(unsigned int num)

### Inherited from Object:

### Public Methods

inline void setDataVariance(DataVariance dv)
inline DataVariance getDataVariance() const
inline void setUserData(Referenced* obj)
inline Referenced* getUserData()
inline const Referenced* getUserData() const

### Public Members

enum DataVariance

### Protected Fields

DataVariance _dataVariance
ref_ptr<Referenced> _userData

### Inherited from Referenced:

### Public Methods

inline Referenced& operator = (Referenced&)
static void setDeleteHandler(DeleteHandler* handler)
static DeleteHandler* getDeleteHandler()
inline void ref() const
inline void unref_nodelete() const
inline int referenceCount() const
inline void unref() const

### Protected Fields

mutable int _refCount

## Documentation

> Switch is a Group node which allows switching between children. Typical uses would be for objects which might need to be rendered differently at different times, for instance a switch could be used to represent the different states of a traffic light.

`Switch()`

`Switch(const Switch&, const CopyOp& copyop=CopyOp::SHALLOW_COPY)`
  Copy constructor using CopyOp to manage deep vs shallow copy

`META_Node(osg, Switch)`

`virtual void traverse(NodeVisitor& nv)`

`void setNewChildDefaultValue(bool value)`

`bool getNewChildDefaultValue() const`

`virtual bool addChild( Node* child )`

`virtual bool addChild( Node* child, bool value )`

`virtual bool removeChild( Node* child )`

`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()`
  Set all the children off (false), and set the new default child value to off (false)

`bool setAllChildrenOn()`
  Set all the children on (true), and set the new default child value to on (true)

`bool setSingleChildOn(unsigned int pos)`
  Set a single child to be on, switch off all other children

`enum Values`
  Special values for the Switch. Use these if you want to turn on/off all child nodes.

  `ALL_CHILDREN_ON`
    All children turned on.

  `ALL_CHILDREN_OFF`
    All children off.

  `MULTIPLE_CHILDREN_ON`
    Multiple children turned on

`void setValue(int value)`
  Selects the active child Node or enables a special SwitchType mode.
  Parameters:
    value - the number of the active child (first child == number 0) or SwitchType. Invalid values will be ignored.

`int getValue() const`

`typedef std::vector<bool> ValueList`

`const ValueList& getValueList() const`

`virtual ~Switch()`

`bool _newChildDefaultValue`

`ValueList _values`

This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java

This page was generated with the help of DOC++.