VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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:
39  unsigned int mySwitchState;
40  };
41 
60  : public osg::Group
61  , public DtMultiReferencedNodeContainer<DtSwitchInstanceState>
62  {
63  public:
64 
68  typedef std::list<DtString> StateNameList;
69 
72  typedef std::list<DtString> ValueNameList;
73 
76  typedef boost::unordered_map<DtString, int> ValueChildMap;
77 
78  public:
79 
82 
85  const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
86 
88  virtual ~DtDynamicTerrainSwitchNode();
89 
96  virtual void setState( DynamicTerrain::NodePathHash hashIndex, int state );
97 
102  virtual void setState( DynamicTerrain::NodePathHash hashIndex, const std::string& valueName );
103 
106  virtual void setState( int state );
107 
110  virtual void setState( const std::string& valueName );
111 
114  virtual int numStates() const;
115 
118  virtual void setStateNames(const StateNameList& stateNames );
119 
122  virtual const StateNameList& stateNames() const;
123 
127  virtual void addValues( int state, const ValueNameList& valueNames );
128 
130  virtual void addSequence( DtDynamicTerrainSequenceNode* sequence,
131  DynamicTerrain::NodePathHash seqIndex, DynamicTerrain::NodePathHash switchIndex, int childCount );
132 
134  virtual const ValueChildMap& valueToChildMap() const;
135 
136  protected:
137 
142  virtual void traverse(osg::NodeVisitor& nv);
143 
149  virtual void setStateBindable( DynamicTerrain::NodePathHash hashIndex, int state );
150 
151  protected:
152 
153  // Each instance of a sequence has a hash index and the switch child it
154  // is associated with
156  {
157  osg::ref_ptr<DtDynamicTerrainSequenceNode> mySequence;
160  };
161 
162  // This is a list of SequenceDescriptors, since a switch might have multiples attached
163  typedef std::list<SequenceDescriptor> SequenceInstanceList;
164 
165  // SwitchToSequenceMap defines a map from switch reference to a sequence instance list for sequence
166  // references associated with that switch reference
167  typedef boost::unordered_map< DynamicTerrain::NodePathHash, SequenceInstanceList> SwitchToSequenceMap;
168 
169  // The map from switch reference to sequence references
171 
172  // All the names discovered for this switch when parsed. Only the first is currently used
174 
175  // The map from value names to the states/children they correspond to
177  };
178 }

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)