VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtCDBPager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright(c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 #include <Cee_CdbDB.h>
12 
13 #include <osgEarth/MapNodeObserver>
14 #include <osgEarth/Map>
15 
19 
21 
27 
28 CEE_NAMESPACE_BEGIN_DECL(CEE_NAMESPACE_CDBAPI)
29 class VectFile;
30 class VectAttribute;
31 class VectFeature;
32 CEE_NAMESPACE_END_DECL(CEE_NAMESPACE_CDBAPI)
33 
34 namespace osgDB
35 {
36  class Options;
37 }
38 
39 namespace makVrv
40 {
41  class DtDe;
42 
43 namespace oe { namespace CDB
44 {
45  class CDBTileKey;
46  class CDBTileVerbose;
47  class CDBModelOptions;
48  class DtCDBClassIndex;
49 
54  class CDBPager : public osg::Group, public osgEarth::MapNodeObserver
55  {
56  public:
57 
59  CDBPager( const osgEarth::Map* map, const CDBModelOptions& CdbModelOptions, const osgDB::Options* dbOptions,
60  osgEarth::SceneGraphCallbacks* sgCallbacks, DtDe& de );
61 
63  virtual ~CDBPager();
64 
67  void build();
68 
70  void initialize();
71 
73  virtual osgEarth::MapNode* getMapNode();
74 
77  virtual void setMapNode( osgEarth::MapNode* mapNode );
78 
79  //virtual void setMap(const osgEarth::Map* map);
80 
82  //int getMinLevel() const { return myMinLevel; }
83 
85  //void setMinLevel(int minLevel) { myMinLevel = minLevel; }
86 
88  //int getMaxLevel() const { return myMaxLevel; }
89 
91  //void setMaxLevel(int maxLevel) { myMaxLevel = maxLevel; }
92 
94  //float getPriorityScale() const { return myPriorityScale; }
95 
97  //void setPriorityScale(float value) { myPriorityScale = value; }
98 
100  //float getPriorityOffset() const { return myPriorityOffset; }
101 
103  //void setPriorityOffset(float value) { myPriorityOffset = value; }
104 
106  void setFileLocationCallback( osgDB::FileLocationCallback* cb )
107  {
109  }
110 
112  osgDB::FileLocationCallback* getFileLocationCallback() const
113  {
114  return myFileLocationCallback.get();
115  }
116 
118  void setEnableCancellation( bool value );
119 
121  bool getEnableCancellation() const;
122 
125  virtual osg::ref_ptr<CdbGroupNode> createCDBGroupNode( const CDBTileKey& key, DtCdbGroupNodeProgress* progress, CdbGroupNode* parentGroup, bool& CdbtileFound, bool& hasChildren );
126 
128  struct Callback : public osg::Referenced
129  {
132  virtual void onCreateNode( const CDBTileKey& key, osg::Node* node )
133  {
134  }
135  };
136 
138  void addCallback( Callback* callback );
139 
141  void removeCallback( Callback* callback );
142 
144  void traverse( osg::NodeVisitor& nv );
145 
146  public:
148  osg::Node* loadKey( CDBTileKey key, DtPagedLodFrameNumberCallback* progress, CdbGroupNode* parentGroup );
149 
150  protected:
151 
153  osg::Node* buildRootNode();
154 
156  osg::PagedLOD* createPagedNode( const CDBTileKey& key, DtCdbGroupNodeProgress* progress, CdbGroupNode* parentGroup );
157 
159  bool loadCdbTileModels( const CDBTileKey& key, DtCdbGroupNodeProgress* progress, CdbGroupNode* groupNode, bool& CdbtileFound ) const;
160 
164  inline bool doesLod0Exist( const CDBTileVerbose& verboseKey, int CdbDatasetCode, int CdbComponentSelector1, int CdbComponentSelector2 ) const;
165 
167  inline Quadrant getQuadrant( const CDBTileKey& key ) const;
168 
170  bool writeTileToCache( const std::string& cacheKey, CdbGroupNode* node );
171 
173  CdbGroupNode* readTileFromCache( const CDBTileKey& key, const std::string& cacheKey );
174 
176  void initializeVector( const std::string& instanceshp, DtCDBInstanceIndex& instanceAttrIndexes,
177  const std::string& classdbf, DtCDBClassIndex& classAttrIndexes,
178  const std::string& extendeddbf ) const;
179 
182 
186 
189 
192 
195 
198 
201 
204 
207 
210 
212  typedef std::vector< osg::ref_ptr<Callback> > Callbacks;
213 
216 
219 
221  osg::observer_ptr<osgEarth::MapNode> myMapNode;
222  //osg::observer_ptr<const osgEarth::Map> myMap;
223 
225  void fire_onCreateNode( const CDBTileKey& key, osg::Node* node );
226 
229 
232 
235 
238 
241 
244 
247 
250 
253 
257 
259  std::string myCachePath;
260 
262  std::string myAppDataPath;
263 
265  bool processShapeFile( VectFile* shpVector
266  , const std::string& instanceShp
267  , DtCDBInstanceIndex& instanceAttrIndexes
268  , const std::string& classdbf
269  , DtCDBClassIndex& classAttrIndexes
270  , CdbGroupNode* groupNode
271  , DtCdbGroupNodeProgress* progress
272  , bool& wasModelFound ) const;
273 
274 
276  static const DtCDBDbfConfig myConfig;
284  optional<CachePolicy> myPolicy;
287 
289 
291  };
292 
293 } } } // namespace makVrv::oe::CDB
DatasetInfo myCurrentDataset
Current CDB Dataset of this pager.
Definition: DtCDBPager.h:243
std::map< DatasetInfo, LodMap > DatasetsModelRangeTable
Possible list of map that can contain specific paging values for specific datasets.
Definition: DtCDBModelRangeTable.h:40
osg::ref_ptr< DtSceneGraphFrameNumberCallback > mySceneGraphFrameNumberCallback
Main thread framestamp tracker.
Definition: DtCDBPager.h:188
osg::PagedLOD * createPagedNode(const CDBTileKey &key, DtCdbGroupNodeProgress *progress, CdbGroupNode *parentGroup)
Creates a PagedLOD for the given TileKEy.
Abstract class to manage vector information.
Hold the unique CDB tile key information CDB LOD goes from -10 to 23. Negative keys to zero are all 1...
Definition: DtCDBTileKey.h:47
osg::ref_ptr< DtCDBDatabase > myCdbDatabase
CDB database object.
Definition: DtCDBPager.h:249
osg::Node * buildRootNode()
The root node is a special node.
CDB Configuration file holding constant definition.
osg::ref_ptr< CDBTileCache > myTileCache
CDB Tile cache object.
Definition: DtCDBPager.h:228
Threading::Atomic myCacheReads
Number of cache reads.
Definition: DtCDBPager.h:278
int myMinLevel
CDB min lod (-10)
Definition: DtCDBPager.h:181
virtual void onCreateNode(const CDBTileKey &key, osg::Node *node)
Called after a new tile is created, but before it&#39;s merged into the live scene graph. Runs in a pager thread.
Definition: DtCDBPager.h:132
int myMaxLevel
CDB max lod (23) Could eventually set to limit max lod.
Definition: DtCDBPager.h:185
bool getEnableCancellation() const
return the cancellation of cdb tiles flag
bool myCanCancel
TODO.
Definition: DtCDBPager.h:200
Definition: featureContext.h:36
void removeCallback(Callback *callback)
Removes a pager callback.
Class the parse CDB folder before loading it to speed up the actual reading later.
osg::ref_ptr< DtCDBVectorModel > myVector
pointer to manage different types of vector object
Definition: DtCDBPager.h:286
void addCallback(Callback *callback)
Adds a pager callback.
CdbGroupNode * readTileFromCache(const CDBTileKey &key, const std::string &cacheKey)
read cdb tile from cache
osgEarth::Threading::Mutex myMutex
Mutex object to allow thread safety.
Definition: DtCDBPager.h:209
void fire_onCreateNode(const CDBTileKey &key, osg::Node *node)
create node based on CDB key
DtDe & myDe
Definition: DtCDBPager.h:288
virtual osgEarth::MapNode * getMapNode()
Gets the map node from its observer reference.
bool doesLod0Exist(const CDBTileVerbose &verboseKey, int CdbDatasetCode, int CdbComponentSelector1, int CdbComponentSelector2) const
Check is the LOD 0 of the dataset exist (because some CDB database exist, that are not CDB compliant ...
osg::observer_ptr< osgEarth::MapNode > myMapNode
observer pointer on the map node
Definition: DtCDBPager.h:221
CDB osg node class CdbGroupNode as the following structure for GT models Each quadrant does not have ...
Definition: DtCDBGroupNode.h:49
Class used to keep &quot;instance&quot; indexes attributes dbf information.
Definition: DtCDBAttributeIndex.h:111
OpenThreads::Atomic Atomic
Definition: DtOsgThreadingUtils.h:15
static const DtCDBDbfConfig myConfig
Static class with predefine information.
Definition: DtCDBPager.h:276
float myPriorityScale
Osg Paged Lod priority scale value.
Definition: DtCDBPager.h:194
Class used to find CDB Tiles information.
Definition: DtCDBTile.h:55
const CDBModelOptions myCdbModelOptions
CDB option class.
Definition: DtCDBPager.h:231
Generic utility class.
bool myMapNodeRequired
Definition: DtCDBPager.h:290
osg::ref_ptr< osgEarth::SceneGraphCallbacks > mySGCallbacks
Model scene graph callback.
Definition: DtCDBPager.h:218
void traverse(osg::NodeVisitor &nv)
traverse function
virtual ~CDBPager()
DTOR.
bool writeTileToCache(const std::string &cacheKey, CdbGroupNode *node)
write cdb tile to cache
void setEnableCancellation(bool value)
Enable or disable the cancellation of cdb tiles by osg earth while they are getting built...
CDB Dataset information class.
Definition: DtCDBDatasetInfo.h:24
The DtCdbGroupNodeProgressthat gets passed to createPagedNode() to use. It will report cancellation i...
Definition: DtCDBUtils.h:209
Paged LOD callback touches DtCdbGroupNodeProgress for each of its (up to) four children.
Definition: DtCDBUtils.h:194
std::string myCachePath
Cache path for this dataset.
Definition: DtCDBPager.h:259
virtual void setMapNode(osgEarth::MapNode *mapNode)
Set the map node of the CDB pager (not set by osgearth anymore)
Threading::Atomic myCacheHits
Number of cache hits.
Definition: DtCDBPager.h:280
std::vector< osg::ref_ptr< Callback > > Callbacks
Callback ref pointer vector typedef.
Definition: DtCDBPager.h:212
OpenThreads::Mutex Mutex
Definition: DtOsgThreadingUtils.h:12
Used to pass option(s) Used to pass option from the OSG earth file this &quot;cdb&quot; model driver...
Definition: DtCDBModelOptions.h:28
Quadrant getQuadrant(const CDBTileKey &key) const
Return the tile quadrant based on the key uref and rref.
void build()
Build the root nodes for every CDB model dataset may be called a second.
void setFileLocationCallback(osgDB::FileLocationCallback *cb)
Get the CDB min LOD.
Definition: DtCDBPager.h:106
osgDB::FileLocationCallback * getFileLocationCallback() const
Get the file location callback.
Definition: DtCDBPager.h:112
Reference wrapper class for CdbDB.
CDB model earth file options for &quot;cdb&quot; model driver.
CDBPager(const osgEarth::Map *map, const CDBModelOptions &CdbModelOptions, const osgDB::Options *dbOptions, osgEarth::SceneGraphCallbacks *sgCallbacks, DtDe &de)
CTOR.
float myPriorityOffset
Osg Paged Lod priority offset value.
Definition: DtCDBPager.h:197
void initialize()
Initialized every CDB model dataset (once)
functions class that help find CDB tiles information
osg::ref_ptr< osgEarth::SpatialReference > myWgs84
Spatial reference pointer geocentric.
Definition: DtCDBPager.h:203
Quadrant
Definition: DtCDBTileKey.h:33
osg::ref_ptr< osgEarth::SpatialReference > mySrs
Spatial reference pointer (flat earth projection)
Definition: DtCDBPager.h:206
osg::ref_ptr< CacheBin > myCacheBin
Pointer to cache object that read/write the nodes.
Definition: DtCDBPager.h:282
std::string myAppDataPath
appData path set by cmdline or env variable
Definition: DtCDBPager.h:262
DatasetsModelRangeTable myDatasetsModelRangeTable
Possible list of map that can contain specific paging values for specific datasets.
Definition: DtCDBPager.h:240
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
Utility class to pass CDB lat/lon/ured/rref) values.
Definition: DtCDBTileVerbose.h:17
osg::Node * loadKey(CDBTileKey key, DtPagedLodFrameNumberCallback *progress, CdbGroupNode *parentGroup)
Loads the PagedLOD hierarchy for this key.
CDBTile * myCdbTilePtr
CDB Tile utility object.
Definition: DtCDBPager.h:246
Callbacks myCallbacks
callback vector
Definition: DtCDBPager.h:215
osg::ref_ptr< osgDB::Options > myDbOptions
Database option.
Definition: DtCDBPager.h:234
virtual osg::ref_ptr< CdbGroupNode > createCDBGroupNode(const CDBTileKey &key, DtCdbGroupNodeProgress *progress, CdbGroupNode *parentGroup, bool &CdbtileFound, bool &hasChildren)
Creates a node for the given TileKey. Doesn&#39;t do anything with paging, just gets the raw data...
DtCDBModelRangeTable myDefaultModelRangeTable
Table with LOd switch paging distance.
Definition: DtCDBPager.h:237
CDB Model Tile paging range.
Definition: DtCDBModelRangeTable.h:22
unsigned int myLastNumBlacklistedFilenames
Keep the black list filename number so that osgearth does not try to re-create the non existing CDB t...
Definition: DtCDBPager.h:256
void initializeVector(const std::string &instanceshp, DtCDBInstanceIndex &instanceAttrIndexes, const std::string &classdbf, DtCDBClassIndex &classAttrIndexes, const std::string &extendeddbf) const
Initialize vector pointer for current dataset in a thread safe matter.
bool loadCdbTileModels(const CDBTileKey &key, DtCdbGroupNodeProgress *progress, CdbGroupNode *groupNode, bool &CdbtileFound) const
Read the CDB tile shapefiles and load the models.
Class used to keep &quot;class&quot; indexes attributes index dbf information.
Definition: DtCDBAttributeIndex.h:22
CDB Dataset class. Hold Dataset information Helper class to retreive CBD Dataset information.
Definition: DtCDBDatasets.h:78
DtCDBModelRangeTable.
osg::ref_ptr< osgDB::FileLocationCallback > myFileLocationCallback
File location callback (needed for speed tree and light points)
Definition: DtCDBPager.h:191
CDB class that hold definition (like DBF column name, config file, etc)Renamed DtCDBDbfConfig from Dt...
Definition: DtCDBDbfConfig.h:20
CDBDatasets * myCDBDatasets
CDB Dataset information manager.
Definition: DtCDBPager.h:252
Create the CDB scene graph nodes One instance of this class will be instantiate for every CDB model d...
Definition: DtCDBPager.h:54
optional< CachePolicy > myPolicy
Cache policy set in the earth file.
Definition: DtCDBPager.h:284
bool processShapeFile(VectFile *shpVector, const std::string &instanceShp, DtCDBInstanceIndex &instanceAttrIndexes, const std::string &classdbf, DtCDBClassIndex &classAttrIndexes, CdbGroupNode *groupNode, DtCdbGroupNodeProgress *progress, bool &wasModelFound) const
Manage the processing (read dbf, shp, flt and textures) of shapefiles.
Callback structure for pager events.
Definition: DtCDBPager.h:128

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)