VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sharedMemoryFeaturesDebugDrawer.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 
10 
11 #pragma once
12 
13 #include <features/feature.h>
14 #include <features/featureSet.h>
17 
19 
20 #include <tbb/recursive_mutex.h>
21 #include <tbb/spin_mutex.h>
22 #include <tbb/spin_rw_mutex.h>
23 #include <tbb/atomic.h>
24 #include <tbb/tbb_thread.h>
25 #include <tbb/mutex.h>
26 #include <tbb/compat/condition_variable>
27 
28 #include <boost/shared_ptr.hpp>
29 #include <boost/enable_shared_from_this.hpp>
30 
31 namespace MAKVRinTerra
32 {
41  : public DtFeatureSet::Source
42  {
43  public:
44  typedef tbb::recursive_mutex Mutex;
45 
49  {
50  public:
54  ScopedFrame(DtSharedMemoryFeaturesDebugDrawer& drawer, bool erase = true);
55 
56  bool drawFeature(const DtFeature&);
57 
58  bool draw(const DtFeatureGeometry&);
59  bool draw(const DtFeatureGeometry&, unsigned width);
61  bool draw(const DtFeatureGeometry&, DtDebugDrawerGeometryMemoryColor, unsigned width);
63  double height, unsigned width);
64 
65  bool drawAbove(const DtFeatureGeometry&,
66  DtDebugDrawerGeometryMemoryColor, double addHeight = 1000);
67 
68  bool drawAsPoints(const DtFeatureGeometry&);
69  bool drawAsPoints(const DtFeatureGeometry&, DtDebugDrawerGeometryMemoryColor);
70 
71  private:
74  };
75 
76  friend class ScopedFrame;
77 
78  typedef boost::shared_ptr<DtSharedMemoryFeaturesDebugDrawer> Ptr;
79 
80  Ptr shared_from_this();
81 
85  static Ptr Make(
86  const std::string& tag = "Features",
87  DtFeatureSet* fs = 0,
90  unsigned long initialSize = 5*DtDebugDrawerSharedMemoryManager::MB,
91  unsigned long maxSize = 50*DtDebugDrawerSharedMemoryManager::MB,
92  double factor = 1.0);
93 
94  static Ptr Make(
95  const std::string& tag,
96  DtFeatureSet* fs,
97  unsigned long initialSize = 5*DtDebugDrawerSharedMemoryManager::MB,
98  unsigned long maxSize = 50*DtDebugDrawerSharedMemoryManager::MB,
99  double factor = 1.0,
102 
104 
105  virtual void setEnabled(bool);
106 
108  void addFeatureSet(DtFeatureSet*);
109 
111 
112  virtual void setPointColor(const DtDebugDrawerGeometryMemoryColor&);
113  virtual void setPathColor(const DtDebugDrawerGeometryMemoryColor&);
114  virtual void setAreaColor(const DtDebugDrawerGeometryMemoryColor&);
115  virtual void setPointRadius(unsigned radius);
116  virtual void setLineWidth(unsigned width);
117  virtual void setDeletedColor(const DtDebugDrawerGeometryMemoryColor&);
119 
123  virtual void setHeight(double);
124 
125  void forceRedraw();
126  void clear();
127 
128  FeaturePtr addFeaturePtr(DtFeature*);
129 
130  private:
132  const std::string& tag, DtDebugDrawerNameManager::MemoryType,
133  unsigned long initialSize, unsigned long maxSize, double factor);
134 
136  virtual void draw();
137 
138  struct FeatureAdder;
139  friend struct FeatureAdder;
140 
141  typedef std::pair<std::string, DtFeatureSet*> FeatureSetPair;
142  typedef std::vector<FeatureSetPair> FeatureSetMap;
143 
144  struct Record
145  {
146  boost::shared_ptr<DtFeatureSet> featureSet;
147  DetachCallback detachCallback;
148 
149  Record(const boost::shared_ptr<DtFeatureSet>& fs, const DetachCallback& cb);
150  };
151 
152  typedef std::vector<Record> FeatureSetVector;
153 
154  mutable Mutex myMutex;
155  boost::scoped_ptr<DtMultiBufferDebugDrawer> myMemManager;
156 
158 
164  unsigned myPointRadius;
165  double myHeight;
167  unsigned myLineWidth;
168 
169  typedef tbb::mutex ConditionMutex;
170  typedef tbb::interface5::unique_lock<tbb::mutex> ConditionLock;
171 
173  mutable tbb::interface5::condition_variable myCondition;
178 
179  boost::scoped_ptr<tbb::tbb_thread> myThread;
180 
182  boost::scoped_ptr<DuplicateRemover> myDrawnFeatureHashes;
183  };
184 }

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)