VR-Forces 4.1 Class Documentation
featureContext.h
Go to the documentation of this file.
1 
2 
3 
4 
5 #pragma once
6 
9 #include <features/featureSet.h>
10 #include <features/feature.h>
11 #include <features/pathFeature.h>
12 #include <features/pathFinder.h>
14 
17 
18 #include <boost/scoped_ptr.hpp>
19 #include <boost/ptr_container/ptr_map.hpp>
20 
21 #include <tbb/mutex.h>
22 
23 #include <map>
24 #include <string>
25 
26 namespace osg
27 {
28  template<typename T>
29  class ref_ptr;
30 }
31 
32 namespace osgEarth
33 {
34  class Map;
35 }
36 
37 namespace MAKVRinTerra
38 {
39  class DtSharedMemoryFeaturesDebugDrawer;
40  class DtFeatureContext;
41  class DtFeaturesDebugger;
42  class DtUnusedFeatureTileTracker;
43 
45  {
46  public:
48  typedef boost::function<DtFeatureSet* (std::string)> FeatureSetCreatorFcn;
49 
52  DtFeatureLoader(boost::shared_ptr<DtTerrainInterfaceConfig> config, DtConsoleCommandManager* manager = 0);
53 
55  virtual ~DtFeatureLoader();
56 
59  static void AddFeatureSetCreator(const std::string& extension, FeatureSetCreatorFcn);
60  static DtFeatureSet* CreateFeatureSetFromFile(const std::string& forFile);
61 
63  virtual bool loadConfig(std::string file);
64 
67  virtual bool loadConfig(std::string file, const DtQuery& schema);
68 
75  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(std::string file, bool page=true,
76  std::string makLayerName = "");
77 
83  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
84  osg::ref_ptr<osgEarth::Map> map, std::string earthfile, bool page=true);
85 
91  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
92  DtFeatureSet* fs, std::string label="", bool page=true);
93 
97  void addToDebugger(std::string label, DtFeatureSet*, bool draw = false);
98 
101  virtual DtFeatureContext* makeContext(const DtProj& proj);
102 
103  private:
107  struct Record
108  {
109  typedef boost::shared_ptr<Record> Ptr;
110  typedef std::vector<Ptr> Vector;
111 
112  std::auto_ptr<DtFeatureSet> featureSet;
113  std::string label;
114  bool page;
115 
116  Record(DtFeatureSet*, std::string label, bool page);
117  };
118 
119  boost::shared_ptr<DtTerrainInterfaceConfig> myTerrainInterfaceConfig;
121  boost::shared_ptr<DtAttributeConfigParser> myParser;
122  boost::shared_ptr<DtUnusedFeatureTileTracker> myUnusedTracker;
123  boost::shared_ptr<DtFeaturesDebugger> myDebugger;
125  };
126 
128  {
129  public:
130  typedef boost::ptr_map<std::string, DtObstacleFeatureSet> ObstacleFeatureSetMap;
131  typedef boost::ptr_map<std::string, DtPathFinder> PathFinderMap;
132 
134  DtFeatureSet*,
135  const DtProj&,
136  boost::shared_ptr<DtAttributeConfigParser>,
137  boost::shared_ptr<DtTerrainInterfaceConfig> config,
138  boost::shared_ptr<DtUnusedFeatureTileTracker> = boost::shared_ptr<DtUnusedFeatureTileTracker>(),
139  boost::shared_ptr<DtFeaturesDebugger> = boost::shared_ptr<DtFeaturesDebugger>());
140 
141  ~DtFeatureContext();
142 
143  std::auto_ptr<DtFeatureSet> features();
144 
145  std::auto_ptr<DtObstacleFeatureSet> obstacles(const std::string& type);
146  std::auto_ptr<DtPathFeatureSet> paths(const std::string& type);
147  DtPathFinder& pathFinder(const std::string& type);
148 
149  DtFeaturesDebugger& debugger();
150 
151  DtQuery findQuery(const std::string& name) const;
152 
153  DtProj::CPtr projection() const;
154 
158  void cleanUpPathFinders();
159 
160  private:
162 
163  boost::scoped_ptr<DtFeatureSet> myFeatures;
164 
166  mutable tbb::mutex myObstaclesMutex;
167 
170  mutable tbb::mutex myPathFindersMutex;
171 
172  boost::shared_ptr<DtAttributeConfigParser> myAttributeParser;
173  boost::shared_ptr<DtTerrainInterfaceConfig> myTerrainInterfaceConfig;
174 
175  boost::shared_ptr<DtFeaturesDebugger> myDebugger;
176  boost::shared_ptr<DtUnusedFeatureTileTracker> myUnusedTracker;
177  };
178 }

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)