VR-Forces 5.0.1 Developer's Guide
 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 
Threading::Mutex myMutex
Mutex object to allow thread safety.
Definition: DtCDBTileCache.h:168
std::map< std::string, bool > DtLogitudeGeocellMap
type for the longitude map as a string representation
Definition: DtCDBTileCache.h:91
CDB Tile cache manager Used by CDBTileSource to try to avoid reading the the same CDB tile many time ...
Definition: DtCDBTileCache.h:34
Least-recently-used cache class.
Definition: DtOsgLRUCache.h:41
used to export/import dll function from this dll to another (osgdb_osgearth_cdb)
CDB Class that hold the Dataset informationNote: A DUPLICATED class also exist in the Openflight Plug...
ElevationCDBsCache myCdbElevationCache
LRU cache map for elevation.
Definition: DtCDBTileCache.h:136
std::map< int, bool > DtLogitudeGeocellIntMap
type for the longitude map as an integer representation
Definition: DtCDBTileCache.h:94
#define DT_DLL_OSGEARTH_CDB_UTILS
Definition: DtCDBExport.h:18
static int theMaxImageryLod
Maximum LOD of the imagery dataset.
Definition: DtCDBTileCache.h:150
makVrv::LRUCache< std::string, osg::ref_ptr< osg::HeightField > > ElevationCDBsCache
LRU cache map type for elevation.
Definition: DtCDBTileCache.h:133
static int theMaxLatitude
Max Latitude.
Definition: DtCDBTileCache.h:165
std::map< int, DtLogitudeGeocellIntMap > myCdbGeoCellIntMap
latitude and longitude map as an integer representation (its set once at the start and used by many) ...
Definition: DtCDBTileCache.h:105
for each CDB database keep track of the lat/lon geocell that exist
Definition: DtCDBTileCache.h:97
static int theMaxElevationLod
Maximum LOD of the elevation dataset.
Definition: DtCDBTileCache.h:147
static int theMaxLongitude
Max Longitude.
Definition: DtCDBTileCache.h:159
static int theMinLatitude
Min Latitude.
Definition: DtCDBTileCache.h:162
makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > > ImageCDBsCache
LRU cache map type for imagery.
Definition: DtCDBTileCache.h:126
std::vector< DatasetInfo > myDatasetList
List of datasets using this map.
Definition: DtCDBTileCache.h:107
size_t myNbCacheSize
Default number of cache file 20, but can be set via the config.
Definition: DtCDBTileCache.h:141
CDB Dataset information class.
Definition: DtCDBDatasetInfo.h:23
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1), const ImVec4 &border_col=ImVec4(0, 0, 0, 0))
Threading::Mutex myCdbImageryCacheMutex
Image Mutex object to allow thread safety.
Definition: DtCDBTileCache.h:130
std::string myCdbRootPath
Current CDB Root path.
Definition: DtCDBTileCache.h:144
OpenThreads::Mutex Mutex
Definition: DtOsgThreadingUtils.h:12
ImageCDBsCache myCdbImageryCache
LRU cache map for imagery.
Definition: DtCDBTileCache.h:128
static int theMinLongitude
Min Longitude.
Definition: DtCDBTileCache.h:156
std::map< std::string, osg::ref_ptr< CDBDatabaseGeocellMap > > DtDatabasesGeocellMap
Type for the map of the existing geocell by CDB database.
Definition: DtCDBTileCache.h:111
static int theMaxRasterMaterialLod
Maximum LOD of the raster material dataset.
Definition: DtCDBTileCache.h:153
Threading::Mutex myCdbElevationCacheMutex
Elevation Mutex object to allow thread safety.
Definition: DtCDBTileCache.h:138

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)