VR-Forces Developer's Guide
 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 
121  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
123  std::string earthfile=std::string(), bool page=true,
124  const std::vector<std::string>& loadIfNameBeginsWith = std::vector<std::string>());
125 
130  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(DtFeatureSet* fs, bool page=true);
131 
135  virtual void addFeatureSource(boost::shared_ptr<DtFeatureSet> fs, bool page=true);
136 
141  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
142  DtFeatureSet* fs,
143  const DtTerrainInterfaceConfig& config);
144 
148  virtual void addFeatureSource(
149  boost::shared_ptr<DtFeatureSet> fs,
150  const DtTerrainInterfaceConfig& config);
151 
156  virtual std::auto_ptr<DtFeatureSet> addVectorNetworkFeatureSource(
157  DtVectorNetwork* network, std::string sourceFile);
158 
165  virtual std::auto_ptr<DtFeatureSet> addFeatureSource(
166  DtFeatureSet* fs, std::string source, bool page=true);
167 
170  void addToDebugger(DtFeatureSet* fs);
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 }
Represents a set of DtFeature objects or others which conform to the DtFeature concept.
Definition: featureSet.h:101
#define DT_DLL_features
stop complaining about multiple independent base classes for boost::noncopyable this should probably ...
Definition: featuresDefines.h:41
Class DtTerrainInterfaceConfig is a readable-writable class holding terrain interface configuration o...
Definition: terrainInterfaceConfig.h:32
std::vector< Ptr > Vector
Definition: featureContext.h:205
DtQueueLoadingFeatureSet< DtFeatureSet >::Queue LoadingQueue
Async queue for loading feature sets.
Definition: featureContext.h:58
DtUnusedFeatureTileTracker::Ptr myUnusedTracker
Unused tile tracker.
Definition: featureContext.h:313
Each record represents one feature set and all the info needed to load it. We need to collect all the...
Definition: featureContext.h:202
Definition: featureContext.h:37
DtFeatureSet::List myFeatures
Definition: featureContext.h:220
std::auto_ptr< DtFeatureSet > featureSet
Definition: featureContext.h:207
boost::shared_ptr< FeatureQueue > myFeatureLoadingQueue
Definition: featureContext.h:292
boost::shared_ptr< DtAStarGraph > Ptr
Definition: aStarGraph.h:89
boost::ptr_map< const AreaConfig, DtAreaFeatureSet > AreaFeatureSetMap
Area stuff.
Definition: featureContext.h:295
boost::scoped_ptr< DtFeatureSet > mySourceFeatures
Reads from set of per-source page tables.
Definition: featureContext.h:285
Simple asynchronous callback queue.
Definition: vrfCallbackQueue.h:32
boost::ptr_map< const std::string, DtFeatureSet > FeatureSetMap
Plain features.
Definition: featureContext.h:288
boost::shared_ptr< DtUnusedFeatureTileTracker > myUnusedTracker
Definition: featureContext.h:217
tbb::mutex myPathFindersMutex
Definition: featureContext.h:304
DtProj::CPtr myProjection
Local projection.
Definition: featureContext.h:279
DtTerrainInterfaceConfig config
Definition: featureContext.h:208
DtTerrainInterfaceConfig myTerrainInterfaceConfig
Terrain interface config object.
Definition: featureContext.h:282
boost::shared_ptr< LoadingQueue > myLoadingQueue
Definition: featureContext.h:222
boost::shared_ptr< DtUnusedFeatureTileTracker > Ptr
Definition: unusedFeatureTileTracker.h:52
DtQueueLoadingFeatureSet< DtFeatureSet >::Queue FeatureQueue
Definition: featureContext.h:289
boost::shared_ptr< AreaQueue > myAreaLoadingQueue
Definition: featureContext.h:299
Feature system config file.
FeatureSetMap myFeatureSets
Definition: featureContext.h:290
Represents some coordinate system. The terms &quot;coordinate system&quot;, &quot;projection&quot;, &quot;spatial reference&quot;...
Definition: proj.h:44
Represents a set of characeters a DtFeature object can have. DtQuery objects are the way to communica...
Definition: query.h:38
boost::ptr_map< const std::string, DtAStarGraph::Ptr > PathFinderMap
Path finder for path planning.
Definition: featureContext.h:302
boost::shared_ptr< DtAttributeConfigParser > myParser
Definition: featureContext.h:216
boost::shared_ptr< DtAttributeConfigParser > myAttributeParser
Feature config parser.
Definition: featureContext.h:310
boost::shared_ptr< const DtProj > CPtr
Definition: proj.h:48
Definition: featureContext.h:51
const char * source
Definition: lz4.h:442
PathFinderMap myPathFinders
Definition: featureContext.h:303
boost::shared_ptr< DtFeaturesDebugger > myDebugger
Top level feature debugger.
Definition: featureContext.h:307
Parser for feature system configuration file. Constructs a set of DtQuery objects, each with a name from the configuration file. Also constructs a list of DtFeatureTransform objects, using DtQuery names as filters.
Definition: attributeConfigParser.h:78
DtTerrainInterfaceConfig myTerrainInterfaceConfig
Definition: featureContext.h:213
AreaFeatureSetMap myAreaFeatureSets
Definition: featureContext.h:297
tbb::mutex myFeatureSetMutex
Definition: featureContext.h:291
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
tbb::mutex myAreasMutex
Definition: featureContext.h:298
boost::function< DtFeatureSet *(std::string)> FeatureSetCreatorFcn
Factory function for creating feature sets.
Definition: featureContext.h:55
Record::Vector myRecords
Definition: featureContext.h:219
boost::shared_ptr< Record > Ptr
Definition: featureContext.h:204
DtQueueLoadingFeatureSet< DtAreaFeatureSet >::Queue AreaQueue
Definition: featureContext.h:296
boost::shared_ptr< DtFeaturesDebugger > myDebugger
Definition: featureContext.h:215
DtAreaFeatureSetAdapter::Config AreaConfig
Configuration information for areas.
Definition: featureContext.h:255
DtFeatureSet used to combine multiple feature sets into one. This class allows all feature set algori...
Definition: featureSetList.h:26
Definition: featureContext.h:225
Configuration object for processing areas.
Definition: areaFeature.h:47
std::vector< DtFeatureTransform > TransformVector
Sequence of transforms.
Definition: attributeConfigParser.h:89
Definition: vectorNetwork.h:37

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)