VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
featureContext.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
14 #include <features/featureSet.h>
15 #include <features/feature.h>
16 #include <features/pathFeature.h>
17 #include <features/aStarGraph.h>
18 #include <features/areaFeature.h>
20 
23 
24 #include <boost/scoped_ptr.hpp>
25 #include <boost/ptr_container/ptr_map.hpp>
26 
27 #include <tbb/mutex.h>
28 
29 #include <map>
30 #include <string>
31 
32 class DtVectorNetwork;
33 
34 namespace osg
35 {
36  template<typename T>
37  class ref_ptr;
38 }
39 
40 namespace osgEarth
41 {
42  class Map;
43 }
44 
45 namespace MAKVRinTerra
46 {
47  class DtSharedMemoryFeaturesDebugDrawer;
48  class DtFeatureContext;
49  class DtFeaturesDebugger;
50  class DtUnusedFeatureTileTracker;
51 
53  {
54  public:
56  typedef boost::function<DtFeatureSet* (std::string)> FeatureSetCreatorFcn;
57 
60 
63 
65  virtual ~DtFeatureDatabase();
66 
68  virtual bool init(const DtTerrainInterfaceConfig&);
69 
74  static void AddFeatureSetCreator(std::string extension, FeatureSetCreatorFcn factory);
75 
78  static DtFeatureSet* CreateFeatureSetFromFile(std::string file);
79 
84  static DtFeatureSet* ConfigureAttribute(
85  DtFeatureSet* set, std::string attribute, std::string value);
86 
87  static std::auto_ptr<DtFeatureSet> ConfigureAttribute(
88  std::auto_ptr<DtFeatureSet> set, std::string attribute, std::string value);
89 
90  static DtFeatureSet* ConfigureAttributes(
91  DtFeatureSet*,
93  DtAttributeConfigParser& parser);
94 
99  virtual bool loadSrcSpecConfigFor(std::string sourceFile, std::string attribute);
100 
108  virtual bool loadConfig(std::string configFile, DtQuery schema);
109 
114  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(std::string file, bool page=true);
115 
121  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
122  osg::ref_ptr<osgEarth::Map> map,
123  std::string earthfile=std::string(), bool page=true);
124 
129  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(DtFeatureSet* fs, bool page=true);
130 
136  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
137  DtFeatureSet* fs,
138  const DtTerrainInterfaceConfig& config);
139 
144  virtual std::auto_ptr<DtFeatureSet> addVectorNetworkFeatureSource(
145  DtVectorNetwork* network, std::string sourceFile);
146 
153  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
154  DtFeatureSet* fs, std::string source, bool page=true);
155 
159  void addToDebugger(DtFeatureSet* fs, bool draw = false);
160 
162  const DtTerrainInterfaceConfig& config() const;
163 
165  boost::shared_ptr<DtAttributeConfigParser> parser() const;
166 
168  boost::shared_ptr<DtUnusedFeatureTileTracker> tracker() const;
169 
171  boost::shared_ptr<DtFeaturesDebugger> debugger() const;
172 
174  boost::shared_ptr<LoadingQueue> loadingQueue() const;
175 
178  virtual DtFeatureSet* makeSourcePagetables(const DtProj& proj);
179 
182  virtual std::auto_ptr<DtFeatureSet> features(const std::string& queryName) const;
183 
185  virtual std::auto_ptr<DtFeatureSet> allFeatures() const;
186 
187  private:
191  struct Record
192  {
193  typedef boost::shared_ptr<Record> Ptr;
194  typedef std::vector<Ptr> Vector;
195 
196  std::auto_ptr<DtFeatureSet> featureSet;
198 
200  };
201 
203 
204  boost::shared_ptr<DtFeaturesDebugger> myDebugger;
205  boost::shared_ptr<DtAttributeConfigParser> myParser;
206  boost::shared_ptr<DtUnusedFeatureTileTracker> myUnusedTracker;
207 
210 
211  boost::shared_ptr<LoadingQueue> myLoadingQueue;
212  };
213 
215  {
216  public:
217  static DtFeatureContext* Create(DtFeatureDatabase& db, const DtProj& proj);
218 
222  DtFeatureContext(DtFeatureDatabase& loader, const DtProj& proj);
223 
225  ~DtFeatureContext();
226 
228  void shutdown(bool block = true);
229 
232  std::auto_ptr<DtFeatureSet> features(const std::string& queryName) const;
233 
235  std::auto_ptr<DtFeatureSet> allFeatures() const;
236 
239  std::auto_ptr<DtAreaFeatureSet> areas(
240  const std::string& type,
241  const boost::shared_ptr<DtCallbackQueue>& = boost::shared_ptr<DtCallbackQueue>());
242 
245 
248  std::auto_ptr<DtAreaFeatureSet> areas(
249  const AreaConfig& cfg,
250  const boost::shared_ptr<DtCallbackQueue>& = boost::shared_ptr<DtCallbackQueue>());
251 
253  std::auto_ptr<DtPathFeatureSet> paths(std::string type);
254 
256  DtAStarGraph::Ptr pathFinder(std::string type);
257 
259  DtProj::CPtr projection() const;
260 
264  void cleanUpPathFinders();
265 
266  private:
269 
272 
274  boost::scoped_ptr<DtFeatureSet> mySourceFeatures;
275 
277  typedef boost::ptr_map<const std::string, DtFeatureSet> FeatureSetMap;
280  mutable tbb::mutex myFeatureSetMutex;
281  boost::shared_ptr<FeatureQueue> myFeatureLoadingQueue;
282 
284  typedef boost::ptr_map<const AreaConfig, DtAreaFeatureSet> AreaFeatureSetMap;
287  mutable tbb::mutex myAreasMutex;
288  boost::shared_ptr<AreaQueue> myAreaLoadingQueue;
289 
291  typedef boost::ptr_map<const std::string, DtAStarGraph::Ptr> PathFinderMap;
293  mutable tbb::mutex myPathFindersMutex;
294 
296  boost::shared_ptr<DtFeaturesDebugger> myDebugger;
297 
299  boost::shared_ptr<DtAttributeConfigParser> myAttributeParser;
300 
303  };
304 }

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)