VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDynamicTerrainParser.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
17 
19 
20 #include <vlutil/vlString.h>
21 
22 #include <osg/Matrixd>
23 #include <osg/Group>
24 #include <boost/unordered_map.hpp>
25 
26 #include <vector>
27 #include <stack>
28 #include <boost/thread/mutex.hpp>
29 
30 namespace osgSim
31 {
32  class MultiSwitch;
33 }
34 
35 namespace osg
36 {
37  class sequence;
38 }
39 
40 namespace makVrv
41 {
42  class DtDe;
43  class DtDynamicTerrainSequenceNode;
44 
66  {
67  public:
70 
73  typedef std::vector< osg::Matrixd > StateTransformList;
74 
77  typedef std::vector< DynamicTerrain::NodePathHash > StateIndexList;
78 
84  typedef std::vector<osg::ref_ptr< DtDynamicTerrainSwitchNode> > TerrainSwitchList;
86 
89  DtDynamicTerrainParser(DtDe& de, bool addInstances = true);
90 
94  DtDynamicTerrainParser(DtDe& de, DtDynamicTerrainWorld& world, DtModelSemanticsMapper& modelSematicsMapper, bool addInstances = true);
95 
96  private:
99 
100  public:
102  virtual ~DtDynamicTerrainParser();
103 
110  osg::Node& node,
111  const osg::Matrix& matrix = osg::Matrix::identity());
112 
116  osg::Node& node,
117  const osg::Matrix& matrix = osg::Matrix::identity());
118 
120  DtDynamicTerrainWorld::FeatureHandle featureHandle() const { return myFeatureHandles; }
121 
124  static std::string parserFormat();
125 
128  virtual void apply( osg::Group& group );
129  virtual void apply( osgSim::MultiSwitch& multiswitch );
130  virtual void apply( DtDynamicTerrainSwitchNode& terrainSwitch );
131  virtual void apply( osg::Sequence& sequence );
132  virtual void apply( DtDynamicTerrainSequenceNode& terrainSequence );
134 
137  const StateTransformList& stateTransforms() const;
138  void addStateTransform(const osg::Matrixd& mat );
139 
140  const TerrainSwitchList& terrainSwitches() const;
141  void addTerrainSwitch( DtDynamicTerrainSwitchNode* tSwitch );
142 
143  const StateIndexList& stateIndices() const;
144  void addStateIndex( DynamicTerrain::NodePathHash index );
146 
147  protected:
152  virtual void runVisitor(osg::Node&, const osg::Matrix&);
153 
158  virtual bool parseSwitchNames( const std::string& desc,
159  osgSim::MultiSwitch& multiswitch, std::list<DtString>& stateNames );
160 
165  virtual void parseSwitchValues( const osg::Node& node, std::list<DtString>& valueNames );
166 
169  virtual void parseValueListString( const std::string& valueList, std::list<DtString>& valueNames );
170 
171  virtual void pushSwitch( DtDynamicTerrainSwitchNode* switchNode );
172  virtual void popSwitch();
173  virtual DtDynamicTerrainSwitchNode* findCurrentSwitch() const;
174 
175  virtual void pushSwitchIndex( DynamicTerrain::NodePathHash index );
176  virtual void popSwitchIndex();
177  virtual DynamicTerrain::NodePathHash findCurrentSwitchIndex() const;
178 
179  virtual void pushSwitchChildCount( int child );
180  virtual void popSwitchChildCount();
181  virtual int findCurrentSwitchChildCount() const;
182  virtual void incrementSwitchChildCount();
183  virtual void decrementSwitchChildCount();
184 
185  protected:
186 
188 
192  std::stack<std::string> myStateNames;
193  std::stack<osg::ref_ptr<DtDynamicTerrainSwitchNode> > myCurrentSwitchStack;
194  std::stack<DynamicTerrain::NodePathHash> myCurrentSwitchIndexStack;
196 
197  // maps node's hash to it's parents hash
198  typedef boost::unordered_map<DynamicTerrain::NodePathHash, DynamicTerrain::NodePathHash> ParentHashMap;
200 
202 
203  static boost::mutex theParserMutex;
204 
206  };
207 
211  {
212  public:
213 
216  static void registerCreator(DtDe& de);
217 
220 
223 
225  virtual DtModelParser* create(DtDe& de);
226  };
227 
228 }
DtDynamicTerrainWorld & myWorld
Definition: DtDynamicTerrainParser.h:187
Implementation of the model parser for Dynamic Terrain The DtDynamicTerrainParser visits all the node...
Definition: DtDynamicTerrainParser.h:65
std::stack< std::string > myStateNames
Definition: DtDynamicTerrainParser.h:192
StateIndexList myStateIndexList
Definition: DtDynamicTerrainParser.h:190
std::vector< osg::ref_ptr< DtDynamicTerrainSwitchNode > > TerrainSwitchList
TerrainSwitchList defines a vector of all the dynamic terrain switches discovered.
Definition: DtDynamicTerrainParser.h:84
DtDynamicTerrainSwitchNode replaces an osgSim::multiswitch in a terrain patch (or page) that is tagge...
Definition: DtDynamicTerrainSwitchNode.h:74
size_t NodePathHash
Typedef used to represent a hash of an OSG Node path to a referenced node.
Definition: DtMultiReferencedNodeContainer.h:25
DtDynamicTerrainWorld::FeatureHandle myFeatureHandles
Definition: DtDynamicTerrainParser.h:201
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Abstract base class used to parse a model.
Definition: DtModelParser.h:22
std::vector< DynamicTerrain::NodePathHash > StateIndexList
StateIndexList defines a vector of a NodePathHash values associated with each switch reference discov...
Definition: DtDynamicTerrainParser.h:77
static boost::mutex theParserMutex
Definition: DtDynamicTerrainParser.h:203
boost::unordered_map< DynamicTerrain::NodePathHash, DynamicTerrain::NodePathHash > ParentHashMap
Definition: DtDynamicTerrainParser.h:198
std::vector< osg::Matrixd > StateTransformList
StateTransformList defines a vector of the world locations of each dynamic terrain switch reference d...
Definition: DtDynamicTerrainParser.h:73
std::stack< osg::ref_ptr< DtDynamicTerrainSwitchNode > > myCurrentSwitchStack
Definition: DtDynamicTerrainParser.h:193
Contains makVrv::DtDynamicTerrainStateManipulatorFactory class.
Create an articulated model parser.
Definition: DtDynamicTerrainParser.h:210
Factory for creating objects which implement some kind of manipulation of the state of dynamically ch...
Definition: DtDynamicTerrainStateManipulatorFactory.h:67
std::stack< int > myCurrentSwitchChildCountStack
Definition: DtDynamicTerrainParser.h:195
StateTransformList myStateTransformList
Definition: DtDynamicTerrainParser.h:189
ParentHashMap myParentHashMap
Definition: DtDynamicTerrainParser.h:199
bool myAddInstances
Definition: DtDynamicTerrainParser.h:205
DtDynamicTerrainWorld::FeatureHandle featureHandle() const
Accessor the handle to the features which have been paged in by calls to parse.
Definition: DtDynamicTerrainParser.h:120
Contains makVrv::DtArticulatedModelParser class.
DtDynamicTerrainSequenceNode replaces an osg::Sequence in a terrain patch (or page) that is tagged wi...
Definition: DtDynamicTerrainSequenceNode.h:62
Contains makVrv::DtDynamicTerrainWorld class.
Contains DLL export macros.
Feature Insertion/Removal/Paging Features represent parts of the terrain which are individually ident...
Definition: DtDynamicTerrainWorld.h:99
Contains makVrv::DtDynamicTerrainSwitchNode class.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
TerrainSwitchList myTerrainSwitchList
Definition: DtDynamicTerrainParser.h:191
An abstract creator class for the model parser.
Definition: DtModelParser.h:35
Container for dynamic terrain features, change requests, and queries.
Definition: DtDynamicTerrainWorld.h:71
The DtModelSemanticsMapper object is responsible for mapping Names of model semantics declarations (f...
Definition: DtModelSemanticsMapper.h:27
std::stack< DynamicTerrain::NodePathHash > myCurrentSwitchIndexStack
Definition: DtDynamicTerrainParser.h:194
Default implementation of the model parser for Articulated models.
Definition: DtArticulatedModelParser.h:37

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)