VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtStreamedSpeedTreeThread.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvSt/vrvSt.h>
13 
14 #include <vrvCore/DtTreeRecord.h>
15 
17 
18 #include <osgdb_osgearth_model_feature_custom/CustomFeatureNode.h>
19 
20 #include <OpenThreads/Thread>
21 
22 #include <boost/thread/mutex.hpp>
23 #include <boost/unordered_set.hpp>
24 
25 #include <deque>
26 
27 namespace osg
28 {
29  class Node;
30 }
31 
32 namespace makVrv
33 {
34  class DtDe;
35  class DtStreamedSpeedTreeForest;
36 
39  class DT_DLL_VRVST DtStreamedSpeedTreeThread : public OpenThreads::Thread, public DtVirtualBaseClass
40  {
41  public:
43  static DtStreamedSpeedTreeThread& instance(DtDe& de);
44 
46  virtual ~DtStreamedSpeedTreeThread();
47 
49  enum RequestStatus { UNUSED, WORKING, DONE };
50 
55  {
58 
61 
65  osg::Node* dataNode;
66 
73  };
74 
77  {
79  osgEarth::Features::CustomFeatureNode::MarkerRequestList requests;
80 
86 
89 
94  float treeMinScale;
95  float treeMaxScale;
97 
99  osg::Node* dataNode;
100  };
101 
103  typedef std::list<TreeRequestOutput> RequestOutputList;
104 
106  typedef boost::unordered_set<osg::Node*> NodeSet;
107 
109  typedef boost::unordered_set<DtStreamedSpeedTreeForest*> ForestSet;
110 
112  typedef boost::unordered_set<std::string> StringSet;
113 
118  RequestOutputList& requestOutput();
119 
124  NodeSet& unloaded();
125 
127  void setForestDeleted(DtStreamedSpeedTreeForest* forest);
128 
130  void setNodeUnloaded(osg::Node* node);
131 
133  void enqueue(
134  const osgEarth::Features::CustomFeatureNode::MarkerRequestList& requests,
135  TreeRequestOutput* out,
137  osg::Node* dataNode,
138  bool useScaleRandomization,
139  bool useOrientationRandomization,
140  float treeMinScale,
141  float treeMaxScale);
142 
144  virtual void run();
145 
147  void handleRequest(const TreeRequestMsg& msg);
148 
150  bool isForestDeleted(DtStreamedSpeedTreeForest* forest);
151 
153  bool isNodeUnloaded(osg::Node* node);
154 
158  static std::size_t hash_value(const std::string& modelDefName,
159  const osgEarth::Features::CustomFeatureNode::OsgEarthMarkerRequest& val);
160 
164  static void mergeTreeRequests(DtDe& de);
165 
166  protected:
167 
170  protected:
171 
173 
177  std::deque<TreeRequestMsg> myMessageQueue;
178 
180  boost::mutex myMessageQueueMutex;
181 
186 
192 
198 
204 
207  };
208 }

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)