VR-Forces 4.1.1 Class Documentation
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/pathFinder.h>
19 
22 
23 #include <boost/scoped_ptr.hpp>
24 #include <boost/ptr_container/ptr_map.hpp>
25 
26 #include <tbb/mutex.h>
27 
28 #include <map>
29 #include <string>
30 
31 namespace osg
32 {
33  template<typename T>
34  class ref_ptr;
35 }
36 
37 namespace osgEarth
38 {
39  class Map;
40 }
41 
42 namespace MAKVRinTerra
43 {
44  class DtSharedMemoryFeaturesDebugDrawer;
45  class DtFeatureContext;
46  class DtFeaturesDebugger;
47  class DtUnusedFeatureTileTracker;
48 
50  {
51  public:
53  typedef boost::function<DtFeatureSet* (std::string)> FeatureSetCreatorFcn;
54 
57  DtFeatureLoader(boost::shared_ptr<DtTerrainInterfaceConfig> config, DtConsoleCommandManager* manager = 0);
58 
60  virtual ~DtFeatureLoader();
61 
64  static void AddFeatureSetCreator(const std::string& extension, FeatureSetCreatorFcn);
65  static DtFeatureSet* CreateFeatureSetFromFile(const std::string& forFile);
66 
68  virtual bool loadConfig(std::string file);
69 
72  virtual bool loadConfig(std::string file, const DtQuery& schema);
73 
80  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(std::string file, bool page=true,
81  std::string makLayerName = "");
82 
88  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
89  osg::ref_ptr<osgEarth::Map> map, std::string earthfile, bool page=true);
90 
96  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
97  DtFeatureSet* fs, std::string label="", bool page=true);
98 
102  void addToDebugger(std::string label, DtFeatureSet*, bool draw = false);
103 
106  virtual DtFeatureContext* makeContext(const DtProj& proj);
107 
108  private:
112  struct Record
113  {
114  typedef boost::shared_ptr<Record> Ptr;
115  typedef std::vector<Ptr> Vector;
116 
117  std::auto_ptr<DtFeatureSet> featureSet;
118  std::string label;
119  bool page;
120 
121  Record(DtFeatureSet*, std::string label, bool page);
122  };
123 
124  boost::shared_ptr<DtTerrainInterfaceConfig> myTerrainInterfaceConfig;
126  boost::shared_ptr<DtAttributeConfigParser> myParser;
127  boost::shared_ptr<DtUnusedFeatureTileTracker> myUnusedTracker;
128  boost::shared_ptr<DtFeaturesDebugger> myDebugger;
130  };
131 
133  {
134  public:
135  typedef boost::ptr_map<std::string, DtObstacleFeatureSet> ObstacleFeatureSetMap;
136  typedef boost::ptr_map<std::string, DtPathFinder> PathFinderMap;
137 
139  DtFeatureSet*,
140  const DtProj&,
141  boost::shared_ptr<DtAttributeConfigParser>,
142  boost::shared_ptr<DtTerrainInterfaceConfig> config,
143  boost::shared_ptr<DtUnusedFeatureTileTracker> = boost::shared_ptr<DtUnusedFeatureTileTracker>(),
144  boost::shared_ptr<DtFeaturesDebugger> = boost::shared_ptr<DtFeaturesDebugger>());
145 
146  ~DtFeatureContext();
147 
148  std::auto_ptr<DtFeatureSet> features();
149 
150  std::auto_ptr<DtObstacleFeatureSet> obstacles(const std::string& type);
151  std::auto_ptr<DtPathFeatureSet> paths(const std::string& type);
152  DtPathFinder& pathFinder(const std::string& type);
153 
154  DtFeaturesDebugger& debugger();
155 
156  DtQuery findQuery(const std::string& name) const;
157 
158  DtProj::CPtr projection() const;
159 
163  void cleanUpPathFinders();
164 
165  private:
167 
168  boost::scoped_ptr<DtFeatureSet> myFeatures;
169 
171  mutable tbb::mutex myObstaclesMutex;
172 
175  mutable tbb::mutex myPathFindersMutex;
176 
177  boost::shared_ptr<DtAttributeConfigParser> myAttributeParser;
178  boost::shared_ptr<DtTerrainInterfaceConfig> myTerrainInterfaceConfig;
179 
180  boost::shared_ptr<DtFeaturesDebugger> myDebugger;
181  boost::shared_ptr<DtUnusedFeatureTileTracker> myUnusedTracker;
182  };
183 }

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)