VR-Forces 4.3.1 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 #include <boost/foreach.hpp>
25 
26 #include <deque>
27 
28 namespace osg
29 {
30  class Node;
31 }
32 
33 namespace makVrv
34 {
35  class DtDe;
36  class DtStreamedSpeedTreeForest;
37 
40  class DT_DLL_VRVST DtStreamedSpeedTreeThread : public OpenThreads::Thread, public DtVirtualBaseClass
41  {
42  public:
44  static DtStreamedSpeedTreeThread& instance(DtDe& de);
45 
47  virtual ~DtStreamedSpeedTreeThread();
48 
50  enum RequestStatus { UNUSED, WORKING, DONE };
51 
56  {
59 
62 
66  osg::Node* dataNode;
67 
74  };
75 
78  {
80  osgEarth::Features::CustomFeatureNode::MarkerRequestList requests;
81 
87 
90 
95  float treeMinScale;
96  float treeMaxScale;
98 
100  osg::Node* dataNode;
101  };
102 
104  typedef std::list<TreeRequestOutput> RequestOutputList;
105 
107  typedef boost::unordered_set<osg::Node*> NodeSet;
108 
110  typedef boost::unordered_set<DtStreamedSpeedTreeForest*> ForestSet;
111 
113  typedef boost::unordered_set<std::string> StringSet;
114 
119  RequestOutputList& requestOutput();
120 
125  NodeSet& unloaded();
126 
128  void setForestDeleted(DtStreamedSpeedTreeForest* forest);
129 
131  void setNodeUnloaded(osg::Node* node);
132 
134  void enqueue(
135  const osgEarth::Features::CustomFeatureNode::MarkerRequestList& requests,
136  TreeRequestOutput* out,
138  osg::Node* dataNode,
139  bool useScaleRandomization,
140  bool useOrientationRandomization,
141  float treeMinScale,
142  float treeMaxScale);
143 
145  virtual void run();
146 
148  void handleRequest(const TreeRequestMsg& msg);
149 
151  bool isForestDeleted(DtStreamedSpeedTreeForest* forest);
152 
154  bool isNodeUnloaded(osg::Node* node);
155 
159  static std::size_t hash_value(const std::string& modelDefName,
160  const osgEarth::Features::CustomFeatureNode::OsgEarthMarkerRequest& val);
161 
165  static void mergeTreeRequests(DtDe& de);
166 
167  protected:
168 
171  protected:
172 
174 
178  std::deque<TreeRequestMsg> myMessageQueue;
179 
181  boost::mutex myMessageQueueMutex;
182 
187 
193 
199 
205 
208  };
209 }

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)