VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtDynamicTerrainSwitchNode.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
15 
16 #include <vlutil/vlString.h>
17 
18 #include <osg/Group>
19 #include <osg/Sequence>
20 
21 #include <boost/unordered_map.hpp>
22 
23 #include <list>
24 
25 namespace osg
26 {
27  class NodeVisitor;
28 }
29 
30 namespace makVrv
31 {
32  class DtDynamicTerrainSequenceNode;
33 
36  {
37  public:
38  unsigned int mySwitchState;
39  };
40 
59  : public osg::Group
60  , public DtMultiReferencedNodeContainer<DtSwitchInstanceState>
61  {
62  public:
63 
67  typedef std::list<DtString> StateNameList;
68 
71  typedef std::list<DtString> ValueNameList;
72 
75  typedef boost::unordered_map<DtString, int> ValueChildMap;
76 
77  public:
78 
81 
84  const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
85 
87  virtual ~DtDynamicTerrainSwitchNode();
88 
95  virtual void setState( DynamicTerrain::NodePathHash hashIndex, int state );
96 
101  virtual void setState( DynamicTerrain::NodePathHash hashIndex, const std::string& valueName );
102 
105  virtual void setState( int state );
106 
109  virtual void setState( const std::string& valueName );
110 
113  virtual int numStates() const;
114 
117  virtual void setStateNames(const StateNameList& stateNames );
118 
121  virtual const StateNameList& stateNames() const;
122 
126  virtual void addValues( int state, const ValueNameList& valueNames );
127 
129  virtual void addSequence( DtDynamicTerrainSequenceNode* sequence,
130  DynamicTerrain::NodePathHash seqIndex, DynamicTerrain::NodePathHash switchIndex, int childCount );
131 
133  virtual const ValueChildMap& valueToChildMap() const;
134 
135  protected:
136 
141  virtual void traverse(osg::NodeVisitor& nv);
142 
148  virtual void setStateBindable( DynamicTerrain::NodePathHash hashIndex, int state );
149 
150  protected:
151 
152  // Each instance of a sequence has a hash index and the switch child it
153  // is associated with
155  {
156  osg::ref_ptr<DtDynamicTerrainSequenceNode> mySequence;
159  };
160 
161  // This is a list of SequenceDescriptors, since a switch might have multiples attached
162  typedef std::list<SequenceDescriptor> SequenceInstanceList;
163 
164  // SwitchToSequenceMap defines a map from switch reference to a sequence instance list for sequence
165  // references associated with that switch reference
166  typedef boost::unordered_map< DynamicTerrain::NodePathHash, SequenceInstanceList> SwitchToSequenceMap;
167 
168  // The map from switch reference to sequence references
170 
171  // All the names discovered for this switch when parsed. Only the first is currently used
173 
174  // The map from value names to the states/children they correspond to
176  };
177 }

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)