OpenSceneGraph 3.6.5
Switch
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_SWITCH
15#define OSG_SWITCH 1
16
17#include <osg/Group>
18
19namespace osg {
20
26class OSG_EXPORT Switch : public Group
27{
28 public :
29
30
32
35
36 virtual Switch* asSwitch() { return this; }
37 virtual const Switch* asSwitch() const { return this; }
38
39
41
42 virtual void traverse(NodeVisitor& nv);
43
44 void setNewChildDefaultValue(bool value) { _newChildDefaultValue = value; }
45
47
50
51 virtual bool addChild( Node *child );
52
53 virtual bool addChild( Node *child, bool value );
54
55 virtual bool insertChild( unsigned int index, Node *child );
56
57 virtual bool insertChild( unsigned int index, Node *child, bool value );
58
59 virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove);
60
61
62 void setValue(unsigned int pos,bool value);
63
64 bool getValue(unsigned int pos) const;
65
66 void setChildValue(const Node* child,bool value);
67
68 bool getChildValue(const Node* child) const;
69
73
77
79 bool setSingleChildOn(unsigned int pos);
80
81
82 typedef std::vector<bool> ValueList;
83
84 void setValueList(const ValueList& values) { _values=values; }
85
86 const ValueList& getValueList() const { return _values; }
87
89
90 protected :
91
92 virtual ~Switch() {}
93
94 // This is effectively a bit mask.
97};
98
99}
100
101#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
BoundingSphered BoundingSphere
Definition BoundingSphere:308
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
virtual bool insertChild(unsigned int index, Node *child)
Insert Node to Group at specific location.
virtual bool addChild(Node *child)
Add Node to Group.
Base class for all internal nodes in the scene graph.
Definition Node:72
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
bool getChildValue(const Node *child) const
void setNewChildDefaultValue(bool value)
Definition Switch:44
const ValueList & getValueList() const
Definition Switch:86
virtual bool addChild(Node *child, bool value)
void setChildValue(const Node *child, bool value)
virtual bool removeChildren(unsigned int pos, unsigned int numChildrenToRemove)
Remove children from Group.
META_Node(osg, Switch)
bool setAllChildrenOff()
Set all the children off (false), and set the new default child value to off (false).
bool setSingleChildOn(unsigned int pos)
Set a single child on, switch off all other children.
virtual void traverse(NodeVisitor &nv)
Traverse downwards : calls children's accept method with NodeVisitor.
virtual bool insertChild(unsigned int index, Node *child)
Insert Node to Group at specific location.
virtual bool addChild(Node *child)
Add Node to Group.
virtual const Switch * asSwitch() const
convert 'const this' into a const Switch pointer if Node is a Switch, otherwise return 0.
Definition Switch:37
bool getValue(unsigned int pos) const
virtual BoundingSphere computeBound() const
Compute the bounding sphere around Node's geometry or children.
void setValue(unsigned int pos, bool value)
virtual Switch * asSwitch()
Convert 'this' into a Switch pointer if Node is a Switch, otherwise return 0.
Definition Switch:36
virtual bool insertChild(unsigned int index, Node *child, bool value)
ValueList _values
Definition Switch:96
std::vector< bool > ValueList
Definition Switch:82
Switch(const Switch &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
void setValueList(const ValueList &values)
Definition Switch:84
bool setAllChildrenOn()
Set all the children on (true), and set the new default child value to on (true).
bool getNewChildDefaultValue() const
Definition Switch:46
bool _newChildDefaultValue
Definition Switch:95
virtual ~Switch()
Definition Switch:92
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.