VR-Forces 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) 2023 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  int maxT2dGeometryLod() const;
92 
94  int minT2dGeometryLod() const;
95 
97  typedef std::map<std::string, bool> DtLogitudeGeocellMap;
98 
100  typedef std::map<int, bool> DtLogitudeGeocellIntMap;
101 
103  class CDBDatabaseGeocellMap : public osg::Referenced
104  {
105  public:
107 
109  std::map<std::string, DtLogitudeGeocellMap> myCdbGeoCellMap;
111  std::map<int, DtLogitudeGeocellIntMap> myCdbGeoCellIntMap;
113  std::vector<DatasetInfo> myDatasetList;
114  };
115 
117  typedef std::map<std::string, osg::ref_ptr<CDBDatabaseGeocellMap> > DtDatabasesGeocellMap;
118 
119  // TODO The functions below for the elevation cache are under evaluation and may be removed,
120  // if we implement another cache system for indirect rendering
121 
123  static bool doesElevationCacheExist(const std::string& shpInstanceFile, const std::string& cachePath);
125  static bool getElevationFromCache(const std::string& shpInstanceFile, const std::string& cachePath, std::vector<osg::Vec3d>& modelPoints);
127  static bool saveElevationToCache(const std::string& shpInstanceFile, const std::string& cachePath, const std::vector<osg::Vec3d>& modelPoints);
128 
129  private:
130 
137 
141  //ElevationCDBsCache* myCdbElevationCache;
145 
148 
150  std::string myCdbRootPath;
151 
153  static int theMaxElevationLod;
154 
156  static int theMaxImageryLod;
157 
160 
162  static int theMinT2dLod;
163 
165  static int theMaxT2dLod;
166 
168  static int theMinLongitude;
169 
171  static int theMaxLongitude;
172 
174  static int theMinLatitude;
175 
177  static int theMaxLatitude;
178 
181  };
182 
183 } } } // namespace mak::osgEarth::CDB
184 
185 
static int theMinT2dLod
Minimum LOD of the t2d model geometry dataset.
Definition: DtCDBTileCache.h:162
Threading::Mutex myMutex
Mutex object to allow thread safety.
Definition: DtCDBTileCache.h:180
std::map< std::string, bool > DtLogitudeGeocellMap
type for the longitude map as a string representation
Definition: DtCDBTileCache.h:97
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:142
std::map< int, bool > DtLogitudeGeocellIntMap
type for the longitude map as an integer representation
Definition: DtCDBTileCache.h:100
#define DT_DLL_OSGEARTH_CDB_UTILS
Definition: DtCDBExport.h:18
static int theMaxImageryLod
Maximum LOD of the imagery dataset.
Definition: DtCDBTileCache.h:156
makVrv::LRUCache< std::string, osg::ref_ptr< osg::HeightField > > ElevationCDBsCache
LRU cache map type for elevation.
Definition: DtCDBTileCache.h:139
static int theMaxLatitude
Max Latitude.
Definition: DtCDBTileCache.h:177
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:111
for each CDB database keep track of the lat/lon geocell that exist
Definition: DtCDBTileCache.h:103
static int theMaxElevationLod
Maximum LOD of the elevation dataset.
Definition: DtCDBTileCache.h:153
static int theMaxLongitude
Max Longitude.
Definition: DtCDBTileCache.h:171
static int theMinLatitude
Min Latitude.
Definition: DtCDBTileCache.h:174
makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > > ImageCDBsCache
LRU cache map type for imagery.
Definition: DtCDBTileCache.h:132
std::vector< DatasetInfo > myDatasetList
List of datasets using this map.
Definition: DtCDBTileCache.h:113
size_t myNbCacheSize
Default number of cache file 20, but can be set via the config.
Definition: DtCDBTileCache.h:147
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:136
std::string myCdbRootPath
Current CDB Root path.
Definition: DtCDBTileCache.h:150
OpenThreads::Mutex Mutex
Definition: DtOsgThreadingUtils.h:12
ImageCDBsCache myCdbImageryCache
LRU cache map for imagery.
Definition: DtCDBTileCache.h:134
static int theMinLongitude
Min Longitude.
Definition: DtCDBTileCache.h:168
std::map< std::string, osg::ref_ptr< CDBDatabaseGeocellMap > > DtDatabasesGeocellMap
Type for the map of the existing geocell by CDB database.
Definition: DtCDBTileCache.h:117
static int theMaxRasterMaterialLod
Maximum LOD of the raster material dataset.
Definition: DtCDBTileCache.h:159
Threading::Mutex myCdbElevationCacheMutex
Elevation Mutex object to allow thread safety.
Definition: DtCDBTileCache.h:144
static int theMaxT2dLod
Maximum LOD of the t2d model geometry dataset.
Definition: DtCDBTileCache.h:165

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)