VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtCDBTileCache.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
10 #pragma once
11 
12 #include <string>
13 
14 #include <osg/ref_ptr>
15 #include <osg/Image>
16 #include <osg/Shape>
17 #include <osgEarth/GeoData>
18 #include <vrvOsg/DtOsgLRUCache.h>
22 
23 #include <map>
24 #include <queue>
25 #include <vector>
26 
27 namespace makVrv { namespace oe { namespace CDB
28 {
34  class DT_DLL_OSGEARTH_CDB_UTILS CDBTileCache : public osg::Referenced
35  {
36  public:
37 
39  CDBTileCache(const std::string& CdbRootPath);
40 
42  virtual ~CDBTileCache();
43 
46  void createCdbGeoCellIndex(const DatasetInfo& datasetInfo, osgEarth::GeoExtent& CdbGeoExtent, bool readMaxLod);
47 
49  bool isCdbGeocellAvailable(const std::string& latitude, const std::string& longitude) const;
50 
52  bool isCdbGeocellAvailable(const int latitude, const int longitude) const;
53 
55  void unregister(const DatasetInfo& datasetInfo);
56 
58  osg::Image* getImage(const std::string& CdbTile);
59 
61  void addImage(const std::string& CdbTile, osg::ref_ptr< osg::Image > rbgImage);
62 
64  float imageHitPercentage();
65 
67  osg::HeightField* getHeightField(const std::string& CdbTile);
68 
70  void addHeightField(const std::string& CdbTile, osg::ref_ptr< osg::HeightField > elevation);
71 
73  float heightFieldHitPercentage();
74 
76  void setCacheSize(int cacheSize);
77 
79  int cacheSize();
80 
82  int maxElevationLod() const;
83 
85  int maxImageryLod() const;
86 
88  int maxRasterMaterialLod() const;
89 
91  typedef std::map<std::string, bool> DtLogitudeGeocellMap;
92 
94  typedef std::map<int, bool> DtLogitudeGeocellIntMap;
95 
97  class CDBDatabaseGeocellMap : public osg::Referenced
98  {
99  public:
101 
103  std::map<std::string, DtLogitudeGeocellMap> myCdbGeoCellMap;
105  std::map<int, DtLogitudeGeocellIntMap> myCdbGeoCellIntMap;
107  std::vector<DatasetInfo> myDatasetList;
108  };
109 
111  typedef std::map<std::string, osg::ref_ptr<CDBDatabaseGeocellMap> > DtDatabasesGeocellMap;
112 
113  // TODO The functions below for the elevation cache are under evaluation and may be removed,
114  // if we implement another cache system for indirect rendering
115 
117  static bool doesElevationCacheExist(const std::string& shpInstanceFile, const std::string& cachePath);
119  static bool getElevationFromCache(const std::string& shpInstanceFile, const std::string& cachePath, std::vector<osg::Vec3d>& modelPoints);
121  static bool saveElevationToCache(const std::string& shpInstanceFile, const std::string& cachePath, const std::vector<osg::Vec3d>& modelPoints);
122 
123  private:
124 
131 
135  //ElevationCDBsCache* myCdbElevationCache;
139 
142 
144  std::string myCdbRootPath;
145 
147  static int theMaxElevationLod;
148 
150  static int theMaxImageryLod;
151 
154 
156  static int theMinLongitude;
157 
159  static int theMaxLongitude;
160 
162  static int theMinLatitude;
163 
165  static int theMaxLatitude;
166 
169  };
170 
171 } } } // namespace mak::osgEarth::CDB
172 
173 

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)