openscenegraph
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
34 Switch(const Switch&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
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
46 bool getNewChildDefaultValue() const { return _newChildDefaultValue; }
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
Definition BoundingSphere:35
Definition CopyOp:41
Definition Group:29
virtual bool insertChild(unsigned int index, Node *child)
virtual bool addChild(Node *child)
Definition NodeVisitor:82
Definition Node:72
Definition Switch:27
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)
META_Node(osg, Switch)
bool setAllChildrenOff()
bool setSingleChildOn(unsigned int pos)
virtual void traverse(NodeVisitor &nv)
virtual bool insertChild(unsigned int index, Node *child)
virtual bool addChild(Node *child)
virtual const Switch * asSwitch() const
Definition Switch:37
bool getValue(unsigned int pos) const
virtual BoundingSphere computeBound() const
void setValue(unsigned int pos, bool value)
virtual Switch * asSwitch()
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)
void setValueList(const ValueList &values)
Definition Switch:84
bool setAllChildrenOn()
bool getNewChildDefaultValue() const
Definition Switch:46
bool _newChildDefaultValue
Definition Switch:95
virtual ~Switch()
Definition Switch:92
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
#define OSG_EXPORT
Definition osg/Export:39