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 
26 
27 CEE_NAMESPACE_BEGIN_DECL(CEE_NAMESPACE_CDBAPI)
28 class VectFile;
29 class VectAttribute;
30 class VectFeature;
31 CEE_NAMESPACE_END_DECL(CEE_NAMESPACE_CDBAPI)
32 
33 namespace osgDB
34 {
35  class Options;
36 }
37 
38 namespace makVrv
39 {
40  class DtDe;
41 
42 namespace oe { namespace CDB
43 {
44  class CDBTileKey;
45  class CDBTileVerbose;
46  class CDBModelOptions;
47  class DtCDBClassIndex;
48 
50  class DtSceneGraphFrameNumberCallback : public osg::NodeCallback
70  {
71  public:
74 
76  void operator()( osg::Node* node, osg::NodeVisitor* nv ) override;
77 
78  unsigned myFrameNumber;
80  };
81 
83 
86  class DtPagedLodFrameNumberCallback : public osg::NodeCallback
87  {
88  public:
91 
93  void operator()( osg::Node*, osg::NodeVisitor* ) override;
94 
96  };
97 
101  class DtCdbGroupNodeProgress : public osg::Referenced
102  {
103  public:
104  DtCdbGroupNodeProgress( DtSceneGraphFrameNumberCallback* master, bool canCancel );
105 
108  bool isCanceled() const;
109 
111  void touch( const osg::FrameStamp* stamp );
112 
115  osg::observer_ptr<DtSceneGraphFrameNumberCallback> myScenegraphFrameNumberCallback;
116  };
118 
123  class CDBPager : public osg::Group, public osgEarth::MapNodeObserver
124  {
125  public:
126 
128  CDBPager( const osgEarth::Map* map, const CDBModelOptions& CdbModelOptions, const osgDB::Options* dbOptions,
129  osgEarth::SceneGraphCallbacks* sgCallbacks, DtDe& de );
130 
132  virtual ~CDBPager();
133 
136  void build();
137 
139  void initialize();
140 
142  virtual osgEarth::MapNode* getMapNode();
143 
146  virtual void setMapNode( osgEarth::MapNode* mapNode );
147 
148  //virtual void setMap(const osgEarth::Map* map);
149 
151  //int getMinLevel() const { return myMinLevel; }
152 
154  //void setMinLevel(int minLevel) { myMinLevel = minLevel; }
155 
157  //int getMaxLevel() const { return myMaxLevel; }
158 
160  //void setMaxLevel(int maxLevel) { myMaxLevel = maxLevel; }
161 
163  //float getPriorityScale() const { return myPriorityScale; }
164 
166  //void setPriorityScale(float value) { myPriorityScale = value; }
167 
169  //float getPriorityOffset() const { return myPriorityOffset; }
170 
172  //void setPriorityOffset(float value) { myPriorityOffset = value; }
173 
175  void setFileLocationCallback( osgDB::FileLocationCallback* cb )
176  {
178  }
179 
181  osgDB::FileLocationCallback* getFileLocationCallback() const
182  {
183  return myFileLocationCallback.get();
184  }
185 
187  void setEnableCancellation( bool value );
188 
190  bool getEnableCancellation() const;
191 
194  virtual osg::ref_ptr<CdbGroupNode> createCDBGroupNode( const CDBTileKey& key, DtCdbGroupNodeProgress* progress, CdbGroupNode* parentGroup, bool& CdbtileFound, bool& hasChildren );
195 
197  struct Callback : public osg::Referenced
198  {
201  virtual void onCreateNode( const CDBTileKey& key, osg::Node* node )
202  {
203  }
204  };
205 
207  void addCallback( Callback* callback );
208 
210  void removeCallback( Callback* callback );
211 
213  void traverse( osg::NodeVisitor& nv );
214 
215  public:
217  osg::Node* loadKey( CDBTileKey key, DtPagedLodFrameNumberCallback* progress, CdbGroupNode* parentGroup );
218 
219  protected:
220 
222  osg::Node* buildRootNode();
223 
225  osg::PagedLOD* createPagedNode( const CDBTileKey& key, DtCdbGroupNodeProgress* progress, CdbGroupNode* parentGroup );
226 
228  bool loadCdbTileModels( const CDBTileKey& key, DtCdbGroupNodeProgress* progress, CdbGroupNode* groupNode, bool& CdbtileFound ) const;
229 
233  inline bool doesLod0Exist( const CDBTileVerbose& verboseKey, int CdbDatasetCode, int CdbComponentSelector1, int CdbComponentSelector2 ) const;
234 
236  inline Quadrant getQuadrant( const CDBTileKey& key ) const;
237 
239  bool writeTileToCache( const std::string& cacheKey, CdbGroupNode* node );
240 
242  CdbGroupNode* readTileFromCache( const CDBTileKey& key, const std::string& cacheKey );
243 
245  void initializeVector( const std::string& instanceshp, DtCDBInstanceIndex& instanceAttrIndexes,
246  const std::string& classdbf, DtCDBClassIndex& classAttrIndexes,
247  const std::string& extendeddbf ) const;
248 
251 
255 
258 
261 
264 
267 
270 
273 
276 
279 
281  typedef std::vector< osg::ref_ptr<Callback> > Callbacks;
282 
285 
288 
290  osg::observer_ptr<osgEarth::MapNode> myMapNode;
291  //osg::observer_ptr<const osgEarth::Map> myMap;
292 
294  void fire_onCreateNode( const CDBTileKey& key, osg::Node* node );
295 
298 
301 
304 
307 
310 
313 
316 
319 
322 
326 
328  std::string myCachePath;
329 
331  std::string myAppDataPath;
332 
334  bool processShapeFile( VectFile* shpVector
335  , const std::string& instanceShp
336  , DtCDBInstanceIndex& instanceAttrIndexes
337  , const std::string& classdbf
338  , DtCDBClassIndex& classAttrIndexes
339  , CdbGroupNode* groupNode
340  , DtCdbGroupNodeProgress* progress
341  , bool& wasModelFound ) const;
342 
343 
345  static const DtCDBDbfConfig myConfig;
353  optional<CachePolicy> myPolicy;
356 
358 
360  };
361 
362 } } } // namespace makVrv::oe::CDB
DatasetInfo myCurrentDataset
Current CDB Dataset of this pager.
Definition: DtCDBPager.h:312
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:257
osg::PagedLOD * createPagedNode(const CDBTileKey &key, DtCdbGroupNodeProgress *progress, CdbGroupNode *parentGroup)
Creates a PagedLOD for the given TileKEy.
Hold the unique CDB tile key information CDB LOD goes from -10 to 23. Negative keys to zero are all 1...
Definition: DtCDBTileKey.h:46
osg::ref_ptr< DtCDBDatabase > myCdbDatabase
CDB database object.
Definition: DtCDBPager.h:318
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:297
Threading::Atomic myCacheReads
Number of cache reads.
Definition: DtCDBPager.h:347
int myMinLevel
CDB min lod (-10)
Definition: DtCDBPager.h:250
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:201
int myMaxLevel
CDB max lod (23) Could eventually set to limit max lod.
Definition: DtCDBPager.h:254
bool getEnableCancellation() const
return the cancellation of cdb tiles flag
bool myCanCancel
TODO.
Definition: DtCDBPager.h:269
Definition: featureContext.h:36
bool myCanCancel
Definition: DtCDBPager.h:79
Abstract class to manage vector information.
void removeCallback(Callback *callback)
Removes a pager callback.
Class the parse CDB folder before loading it to speed up the actual reading later.
void addCallback(Callback *callback)
Adds a pager callback.
void touch(const osg::FrameStamp *stamp)
called by DtPagedLodFrameNumberCallback
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:278
void fire_onCreateNode(const CDBTileKey &key, osg::Node *node)
create node based on CDB key
void operator()(osg::Node *node, osg::NodeVisitor *nv) override
Sets myFrameNumber.
DtDe & myDe
Definition: DtCDBPager.h:357
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:290
&quot;Progress&quot; and cancellation callbacks, defined as if the frame number on the callback has been update...
Definition: DtCDBPager.h:69
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:82
OpenThreads::Atomic Atomic
Definition: DtOsgThreadingUtils.h:15
static const DtCDBDbfConfig myConfig
Static class with predefine information.
Definition: DtCDBPager.h:345
osg::ref_ptr< DtCdbGroupNodeProgress > myGroupNodeProgressArray[4]
Definition: DtCDBPager.h:95
float myPriorityScale
Osg Paged Lod priority scale value.
Definition: DtCDBPager.h:263
DtPagedLodFrameNumberCallback(DtSceneGraphFrameNumberCallback *, bool canCancel)
CTOR.
Class used to find CDB Tiles information.
Definition: DtCDBTile.h:52
const CDBModelOptions myCdbModelOptions
CDB option class.
Definition: DtCDBPager.h:300
bool myMapNodeRequired
Definition: DtCDBPager.h:359
osg::ref_ptr< osgEarth::SceneGraphCallbacks > mySGCallbacks
Model scene graph callback.
Definition: DtCDBPager.h:287
void traverse(osg::NodeVisitor &nv)
traverse function
virtual ~CDBPager()
DTOR.
bool writeTileToCache(const std::string &cacheKey, CdbGroupNode *node)
write cdb tile to cache
osg::observer_ptr< DtSceneGraphFrameNumberCallback > myScenegraphFrameNumberCallback
Definition: DtCDBPager.h:115
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:23
The DtCdbGroupNodeProgressthat gets passed to createPagedNode() to use. It will report cancellation i...
Definition: DtCDBPager.h:101
Paged LOD callback touches DtCdbGroupNodeProgress for each of its (up to) four children.
Definition: DtCDBPager.h:86
std::string myCachePath
Cache path for this dataset.
Definition: DtCDBPager.h:328
virtual void setMapNode(osgEarth::MapNode *mapNode)
Set the map node of the CDB pager (not set by osgearth anymore)
unsigned myFrameNumber
Definition: DtCDBPager.h:78
Threading::Atomic myCacheHits
Number of cache hits.
Definition: DtCDBPager.h:349
std::vector< osg::ref_ptr< Callback > > Callbacks
Callback ref pointer vector typedef.
Definition: DtCDBPager.h:281
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
unsigned myLastTouchedFrame
Definition: DtCDBPager.h:114
Quadrant getQuadrant(const CDBTileKey &key) const
Return the tile quadrant based on the key uref and rref.
DtCdbGroupNodeProgress(DtSceneGraphFrameNumberCallback *master, bool canCancel)
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:175
bool myCanCancel
Definition: DtCDBPager.h:113
osgDB::FileLocationCallback * getFileLocationCallback() const
Get the file location callback.
Definition: DtCDBPager.h:181
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:266
void initialize()
Initialized every CDB model dataset (once)
functions class that help find CDB tiles information
osg::ref_ptr< DtCDBVector > myVector
pointer to manage different types of vector object
Definition: DtCDBPager.h:355
bool isCanceled() const
Has this progress call back been touched by DtSceneGraphFrameNumberCallback It is cancelled if it has...
osg::ref_ptr< osgEarth::SpatialReference > myWgs84
Spatial reference pointer geocentric.
Definition: DtCDBPager.h:272
Quadrant
Definition: DtCDBTileKey.h:32
osg::ref_ptr< osgEarth::SpatialReference > mySrs
Spatial reference pointer (flat earth projection)
Definition: DtCDBPager.h:275
osg::ref_ptr< CacheBin > myCacheBin
Pointer to cache object that read/write the nodes.
Definition: DtCDBPager.h:351
std::string myAppDataPath
appData path set by cmdline or env variable
Definition: DtCDBPager.h:331
DatasetsModelRangeTable myDatasetsModelRangeTable
Possible list of map that can contain specific paging values for specific datasets.
Definition: DtCDBPager.h:309
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:315
Callbacks myCallbacks
callback vector
Definition: DtCDBPager.h:284
osg::ref_ptr< osgDB::Options > myDbOptions
Database option.
Definition: DtCDBPager.h:303
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:306
CDB Model Tile paging range.
Definition: DtCDBModelRangeTable.h:22
void operator()(osg::Node *, osg::NodeVisitor *) override
Touches DtCdbGroupNodeProgress.
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:325
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:260
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:321
Create the CDB scene graph nodes One instance of this class will be instantiate for every CDB model d...
Definition: DtCDBPager.h:123
optional< CachePolicy > myPolicy
Cache policy set in the earth file.
Definition: DtCDBPager.h:353
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:197

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)