VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 DtFeatureContext;
48  class DtFeaturesDebugger;
49  class DtUnusedFeatureTileTracker;
50 
52  {
53  public:
55  typedef boost::function<DtFeatureSet* (std::string)> FeatureSetCreatorFcn;
56 
59 
62 
64  virtual ~DtFeatureDatabase();
65 
67  virtual bool init(const DtTerrainInterfaceConfig&);
68 
73  static void AddFeatureSetCreator(std::string extension, FeatureSetCreatorFcn factory);
74 
77  static DtFeatureSet* CreateFeatureSetFromFile(std::string file);
78 
83  static DtFeatureSet* ConfigureAttribute(
84  DtFeatureSet* set, std::string attribute, std::string value);
85 
86  static std::auto_ptr<DtFeatureSet> ConfigureAttribute(
87  std::auto_ptr<DtFeatureSet> set, std::string attribute, std::string value);
88 
89  static DtFeatureSet* ConfigureAttributes(
90  DtFeatureSet*,
92  DtAttributeConfigParser& parser);
93 
98  virtual bool loadSrcSpecConfigFor(std::string sourceFile, std::string attribute);
99 
107  virtual bool loadConfig(std::string configFile, DtQuery schema);
108 
113  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(std::string file, bool page=true);
114 
120  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
121  osg::ref_ptr<osgEarth::Map> map,
122  std::string earthfile=std::string(), bool page=true);
123 
128  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(DtFeatureSet* fs, bool page=true);
129 
133  virtual void addFeatureSource(boost::shared_ptr<DtFeatureSet> fs, bool page=true);
134 
139  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
140  DtFeatureSet* fs,
141  const DtTerrainInterfaceConfig& config);
142 
146  virtual void addFeatureSource(
147  boost::shared_ptr<DtFeatureSet> fs,
148  const DtTerrainInterfaceConfig& config);
149 
154  virtual std::auto_ptr<DtFeatureSet> addVectorNetworkFeatureSource(
155  DtVectorNetwork* network, std::string sourceFile);
156 
163  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
164  DtFeatureSet* fs, std::string source, bool page=true);
165 
168  void addToDebugger(DtFeatureSet* fs);
169 
171  const DtTerrainInterfaceConfig& config() const;
172 
174  boost::shared_ptr<DtAttributeConfigParser> parser() const;
175 
177  boost::shared_ptr<DtUnusedFeatureTileTracker> tracker() const;
178 
180  boost::shared_ptr<DtFeaturesDebugger> debugger() const;
181 
183  boost::shared_ptr<LoadingQueue> loadingQueue() const;
184 
187  virtual DtFeatureSet* makeSourcePagetables(const DtProj& proj);
188 
191  virtual std::auto_ptr<DtFeatureSet> features(const std::string& queryName) const;
192 
194  virtual std::auto_ptr<DtFeatureSet> allFeatures() const;
195 
196  private:
200  struct Record
201  {
202  typedef boost::shared_ptr<Record> Ptr;
203  typedef std::vector<Ptr> Vector;
204 
205  std::auto_ptr<DtFeatureSet> featureSet;
207 
209  };
210 
212 
213  boost::shared_ptr<DtFeaturesDebugger> myDebugger;
214  boost::shared_ptr<DtAttributeConfigParser> myParser;
215  boost::shared_ptr<DtUnusedFeatureTileTracker> myUnusedTracker;
216 
219 
220  boost::shared_ptr<LoadingQueue> myLoadingQueue;
221  };
222 
224  {
225  public:
226  static DtFeatureContext* Create(DtFeatureDatabase& db, const DtProj& proj);
227 
231  DtFeatureContext(DtFeatureDatabase& loader, const DtProj& proj);
232 
234  ~DtFeatureContext();
235 
237  void shutdown(bool block = true);
238 
241  std::auto_ptr<DtFeatureSet> features(const std::string& queryName) const;
242 
244  std::auto_ptr<DtFeatureSet> allFeatures() const;
245 
248  std::auto_ptr<DtAreaFeatureSet> areas(
249  const std::string& type,
250  const boost::shared_ptr<DtVrfCallbackQueue>& = boost::shared_ptr<DtVrfCallbackQueue>());
251 
254 
257  std::auto_ptr<DtAreaFeatureSet> areas(
258  const AreaConfig& cfg,
259  const boost::shared_ptr<DtVrfCallbackQueue>& = boost::shared_ptr<DtVrfCallbackQueue>());
260 
262  std::auto_ptr<DtPathFeatureSet> paths(std::string type);
263 
265  DtAStarGraph::Ptr pathFinder(std::string type);
266 
268  DtProj::CPtr projection() const;
269 
273  void cleanUpPathFinders();
274 
275  private:
278 
281 
283  boost::scoped_ptr<DtFeatureSet> mySourceFeatures;
284 
286  typedef boost::ptr_map<const std::string, DtFeatureSet> FeatureSetMap;
289  mutable tbb::mutex myFeatureSetMutex;
290  boost::shared_ptr<FeatureQueue> myFeatureLoadingQueue;
291 
293  typedef boost::ptr_map<const AreaConfig, DtAreaFeatureSet> AreaFeatureSetMap;
296  mutable tbb::mutex myAreasMutex;
297  boost::shared_ptr<AreaQueue> myAreaLoadingQueue;
298 
300  typedef boost::ptr_map<const std::string, DtAStarGraph::Ptr> PathFinderMap;
302  mutable tbb::mutex myPathFindersMutex;
303 
305  boost::shared_ptr<DtFeaturesDebugger> myDebugger;
306 
308  boost::shared_ptr<DtAttributeConfigParser> myAttributeParser;
309 
312  };
313 }

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)