VR-Forces 4.5 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 
134  virtual void addFeatureSource(boost::shared_ptr<DtFeatureSet> fs, bool page=true);
135 
140  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
141  DtFeatureSet* fs,
142  const DtTerrainInterfaceConfig& config);
143 
147  virtual void addFeatureSource(
148  boost::shared_ptr<DtFeatureSet> fs,
149  const DtTerrainInterfaceConfig& config);
150 
155  virtual std::auto_ptr<DtFeatureSet> addVectorNetworkFeatureSource(
156  DtVectorNetwork* network, std::string sourceFile);
157 
164  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
165  DtFeatureSet* fs, std::string source, bool page=true);
166 
170  void addToDebugger(DtFeatureSet* fs, bool draw = false);
171 
173  const DtTerrainInterfaceConfig& config() const;
174 
176  boost::shared_ptr<DtAttributeConfigParser> parser() const;
177 
179  boost::shared_ptr<DtUnusedFeatureTileTracker> tracker() const;
180 
182  boost::shared_ptr<DtFeaturesDebugger> debugger() const;
183 
185  boost::shared_ptr<LoadingQueue> loadingQueue() const;
186 
189  virtual DtFeatureSet* makeSourcePagetables(const DtProj& proj);
190 
193  virtual std::auto_ptr<DtFeatureSet> features(const std::string& queryName) const;
194 
196  virtual std::auto_ptr<DtFeatureSet> allFeatures() const;
197 
198  private:
202  struct Record
203  {
204  typedef boost::shared_ptr<Record> Ptr;
205  typedef std::vector<Ptr> Vector;
206 
207  std::auto_ptr<DtFeatureSet> featureSet;
209 
211  };
212 
214 
215  boost::shared_ptr<DtFeaturesDebugger> myDebugger;
216  boost::shared_ptr<DtAttributeConfigParser> myParser;
217  boost::shared_ptr<DtUnusedFeatureTileTracker> myUnusedTracker;
218 
221 
222  boost::shared_ptr<LoadingQueue> myLoadingQueue;
223  };
224 
226  {
227  public:
228  static DtFeatureContext* Create(DtFeatureDatabase& db, const DtProj& proj);
229 
233  DtFeatureContext(DtFeatureDatabase& loader, const DtProj& proj);
234 
236  ~DtFeatureContext();
237 
239  void shutdown(bool block = true);
240 
243  std::auto_ptr<DtFeatureSet> features(const std::string& queryName) const;
244 
246  std::auto_ptr<DtFeatureSet> allFeatures() const;
247 
250  std::auto_ptr<DtAreaFeatureSet> areas(
251  const std::string& type,
252  const boost::shared_ptr<DtVrfCallbackQueue>& = boost::shared_ptr<DtVrfCallbackQueue>());
253 
256 
259  std::auto_ptr<DtAreaFeatureSet> areas(
260  const AreaConfig& cfg,
261  const boost::shared_ptr<DtVrfCallbackQueue>& = boost::shared_ptr<DtVrfCallbackQueue>());
262 
264  std::auto_ptr<DtPathFeatureSet> paths(std::string type);
265 
267  DtAStarGraph::Ptr pathFinder(std::string type);
268 
270  DtProj::CPtr projection() const;
271 
275  void cleanUpPathFinders();
276 
277  private:
280 
283 
285  boost::scoped_ptr<DtFeatureSet> mySourceFeatures;
286 
288  typedef boost::ptr_map<const std::string, DtFeatureSet> FeatureSetMap;
291  mutable tbb::mutex myFeatureSetMutex;
292  boost::shared_ptr<FeatureQueue> myFeatureLoadingQueue;
293 
295  typedef boost::ptr_map<const AreaConfig, DtAreaFeatureSet> AreaFeatureSetMap;
298  mutable tbb::mutex myAreasMutex;
299  boost::shared_ptr<AreaQueue> myAreaLoadingQueue;
300 
302  typedef boost::ptr_map<const std::string, DtAStarGraph::Ptr> PathFinderMap;
304  mutable tbb::mutex myPathFindersMutex;
305 
307  boost::shared_ptr<DtFeaturesDebugger> myDebugger;
308 
310  boost::shared_ptr<DtAttributeConfigParser> myAttributeParser;
311 
314  };
315 }

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)