VR-Forces 5.0.3 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) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 
12 #include <Cee_CdbDB.h>
13 
14 #include <osgEarth/MapNodeObserver>
15 #include <osgEarth/Map>
16 
23 
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 
53  class CDBPager : public osg::Group,
54  public osgEarth::MapNodeObserver
55  {
56  public:
57 
59  CDBPager(const osgEarth::Map* map, const CDBModelOptions* CdbModelOptions, const osgDB::Options* dbOptions, osgEarth::SceneGraphCallbacks* sgCallbacks, DtDe& de);
60 
62  virtual ~CDBPager();
63 
66  void build();
67 
69  void initialize();
70 
72  virtual osgEarth::MapNode* getMapNode();
73 
76  virtual void setMapNode(osgEarth::MapNode* mapNode);
77 
78  //virtual void setMap(const osgEarth::Map* map);
79 
81  bool getAdditive() { return myAdditive; }
82 
84  void setAdditive(bool additive) { myAdditive = additive; }
85 
87  //int getMinLevel() const { return myMinLevel; }
88 
90  //void setMinLevel(int minLevel) { myMinLevel = minLevel; }
91 
93  //int getMaxLevel() const { return myMaxLevel; }
94 
96  //void setMaxLevel(int maxLevel) { myMaxLevel = maxLevel; }
97 
99  //float getPriorityScale() const { return myPriorityScale; }
100 
102  //void setPriorityScale(float value) { myPriorityScale = value; }
103 
105  //float getPriorityOffset() const { return myPriorityOffset; }
106 
108  //void setPriorityOffset(float value) { myPriorityOffset = value; }
109 
111  void setFileLocationCallback(osgDB::FileLocationCallback* cb) { myFileLocationCallback = cb; }
112 
114  osgDB::FileLocationCallback* getFileLocationCallback() const { return myFileLocationCallback.get(); }
115 
117  void setEnableCancellation(bool value);
118 
120  bool getEnableCancellation() const;
121 
124  virtual CdbGroupNode* createCDBGroupNode(const CDBTileKey& key, osgEarth::ProgressCallback* progress, CdbGroupNode* parentGroup, bool& CdbtileFound, bool& hasChildren);
125 
127  struct Callback : public osg::Referenced
128  {
131  virtual void onCreateNode(const CDBTileKey& key, osg::Node* node) { }
132  };
133 
135  void addCallback(Callback* callback);
136 
138  void removeCallback(Callback* callback);
139 
141  void traverse(osg::NodeVisitor& nv);
142 
143  public:
144 
146  struct ProgressTracker : public osg::NodeCallback {
147  ProgressTracker(osg::NodeCallback*);
149  void operator()(osg::Node*, osg::NodeVisitor*);
150  };
151 
153  osg::Node* loadKey(const CDBTileKey& key, ProgressTracker* progress, CdbGroupNode* parentGroup);
154 
155  protected:
156 
158  osg::Node* buildRootNode();
159 
161  osg::PagedLOD* createPagedNode(const CDBTileKey& key, osgEarth::ProgressCallback* progress, CdbGroupNode* parentGroup);
162 
164  bool loadCdbTileModels(const CDBTileKey& key, ProgressCallback* progress, CdbGroupNode* groupNode, bool& CdbtileFound) const;
165 
169  inline bool doesLod0Exist(const CDBTileVerbose& verboseKey, int CdbDatasetCode, int CdbComponentSelector1, int CdbComponentSelector2) const;
170 
172  inline Quadrant getQuadrant(const CDBTileKey& key) const;
173 
175  bool writeTileToCache(const std::string& cacheKey, CdbGroupNode* node);
176 
178  CdbGroupNode* readTileFromCache(const CDBTileKey& key, const std::string& cacheKey);
179 
181  void initializeVector(const std::string& instanceshp, DtCDBInstanceIndex& instanceAttrIndexes,
182  const std::string& classdbf, DtCDBClassIndex& classAttrIndexes,
183  const std::string& extendeddbf) const;
184 
188 
191 
195 
198 
201 
204 
207 
210 
213 
216 
219 
221  typedef std::vector< osg::ref_ptr<Callback> > Callbacks;
222 
225 
228 
230  osg::observer_ptr<osgEarth::MapNode> myMapNode;
231  //osg::observer_ptr<const osgEarth::Map> myMap;
232 
234  void fire_onCreateNode(const CDBTileKey& key, osg::Node* node);
235 
238 
241 
244 
247 
250 
253 
256 
259 
262 
266 
268  std::string myCachePath;
269 
271  bool processShapeFile(VectFile* shpVector
272  , const std::string& instanceShp
273  , DtCDBInstanceIndex& instanceAttrIndexes
274  , const std::string& classdbf
275  , DtCDBClassIndex& classAttrIndexes
276  , const CDBTileVerbose& verboseKey
277  , CdbGroupNode* groupNode
278  , ProgressCallback* progress
279  , bool& wasModelFound) const;
280 
281 
291  optional<CachePolicy> myPolicy;
294 
296 
298  };
299 
300 } } } // namespace makVrv::oe::CDB
DatasetInfo myCurrentDataset
Current CDB Dataset of this pager.
Definition: DtCDBPager.h:252
std::map< DatasetInfo, LodMap > DatasetsModelRangeTable
Possible list of map that can contain specific paging values for specific datasets.
Definition: DtCDBModelRangeTable.h:40
bool getAdditive()
Get whether this pager uses additive lods or not.
Definition: DtCDBPager.h:81
Hold the unique CDB tile key information CDB LOD goes from -10 to 23. Negative keys to zero are all 1...
Definition: DtCDBTileKey.h:28
osg::ref_ptr< DtCDBDatabase > myCdbDatabase
CDB database object.
Definition: DtCDBPager.h:258
osg::Node * buildRootNode()
The root node is a special node.
osg::ref_ptr< CDBTileCache > myTileCache
CDB Tile cache object.
Definition: DtCDBPager.h:237
Threading::Atomic myCacheReads
Number of cache reads.
Definition: DtCDBPager.h:285
int myMinLevel
CDB min lod (-10)
Definition: DtCDBPager.h:190
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:131
int myMaxLevel
CDB max lod (23) Could eventually set to limit max lod.
Definition: DtCDBPager.h:194
bool getEnableCancellation() const
return the cancellation of cdb tiles flag
void operator()(osg::Node *, osg::NodeVisitor *)
Abstract class to manage Cdb class/instance attributes indexes (dbf) information. ...
bool myCanCancel
TODO.
Definition: DtCDBPager.h:209
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.
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:218
void fire_onCreateNode(const CDBTileKey &key, osg::Node *node)
create node based on CDB key
osg::ref_ptr< osgEarth::ProgressCallback > _progress[4]
Definition: DtCDBPager.h:148
DtDe & myDe
Definition: DtCDBPager.h:295
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:230
CDB osg node class CdbGroupNode as the following structure for GT models Each quadrant does not have ...
Definition: DtCDBGroupNode.h:59
Class used to keep &quot;instance&quot; indexes attributes dbf information.
Definition: DtCDBAttributeIndex.h:66
OpenThreads::Atomic Atomic
Definition: DtOsgThreadingUtils.h:15
float myPriorityScale
Osg Paged Lod priority scale value.
Definition: DtCDBPager.h:203
bool loadCdbTileModels(const CDBTileKey &key, ProgressCallback *progress, CdbGroupNode *groupNode, bool &CdbtileFound) const
Read the CDB tile shapefiles and load the models.
osg::ref_ptr< osg::NodeCallback > myProgressMaster
master framestamp tracker
Definition: DtCDBPager.h:197
Class used to find CDB Tiles information.
Definition: DtCDBTile.h:52
CDB class that hold definition (like DBF column name, config file, etc)
Definition: DtCDBPagerConfig.h:18
virtual CdbGroupNode * createCDBGroupNode(const CDBTileKey &key, osgEarth::ProgressCallback *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...
bool myMapNodeRequired
Definition: DtCDBPager.h:297
void setAdditive(bool additive)
Set additive or non-additive lods for this page.
Definition: DtCDBPager.h:84
osg::ref_ptr< osgEarth::SceneGraphCallbacks > mySGCallbacks
Model scene graph callback.
Definition: DtCDBPager.h:227
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...
osg::Node * loadKey(const CDBTileKey &key, ProgressTracker *progress, CdbGroupNode *parentGroup)
Loads the PagedLOD hierarchy for this key.
CDB Dataset information class.
Definition: DtCDBDatasetInfo.h:23
std::string myCachePath
Cache path for this dataset.
Definition: DtCDBPager.h:268
bool myAdditive
Is a pager in additive mode or not (default is not) TODO this could be removed (additive mode is not ...
Definition: DtCDBPager.h:187
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:287
static const DtCDBPagerConfig myConfig
Static class with predefine information.
Definition: DtCDBPager.h:283
std::vector< osg::ref_ptr< Callback > > Callbacks
Callback ref pointer vector typedef.
Definition: DtCDBPager.h:221
OpenThreads::Mutex Mutex
Definition: DtOsgThreadingUtils.h:12
CDB Configuration file holding constant definition.
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:111
osgDB::FileLocationCallback * getFileLocationCallback() const
Get the file location callback.
Definition: DtCDBPager.h:114
CDB model earth file options for &quot;cdb&quot; model driver.
float myPriorityOffset
Osg Paged Lod priority offset value.
Definition: DtCDBPager.h:206
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:293
osg::ref_ptr< osgEarth::SpatialReference > myWgs84
Spatial reference pointer geocentric.
Definition: DtCDBPager.h:212
Quadrant
Definition: DtCDBGroupNode.h:35
osg::ref_ptr< osgEarth::SpatialReference > mySrs
Spatial reference pointer (flat earth projection)
Definition: DtCDBPager.h:215
osg::ref_ptr< CacheBin > myCacheBin
Pointer to cache object that read/write the nodes.
Definition: DtCDBPager.h:289
DatasetsModelRangeTable myDatasetsModelRangeTable
Possible list of map that can contain specific paging values for specific datasets.
Definition: DtCDBPager.h:249
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:70
Utility class to pass CDB lat/lon/ured/rref) values.
Definition: DtCDBTileVerbose.h:17
osg::PagedLOD * createPagedNode(const CDBTileKey &key, osgEarth::ProgressCallback *progress, CdbGroupNode *parentGroup)
Creates a PagedLOD for the given TileKEy.
CDBTile * myCdbTilePtr
CDB Tile utility object.
Definition: DtCDBPager.h:255
Callbacks myCallbacks
callback vector
Definition: DtCDBPager.h:224
osg::ref_ptr< osgDB::Options > myDbOptions
Database option.
Definition: DtCDBPager.h:243
DtCDBModelRangeTable myDefaultModelRangeTable
Table with LOd switch paging distance.
Definition: DtCDBPager.h:246
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:265
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.
Progress tracker class.
Definition: DtCDBPager.h:146
Class used to keep &quot;class&quot; indexes attributes index dbf information.
Definition: DtCDBAttributeIndex.h:19
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:200
bool processShapeFile(VectFile *shpVector, const std::string &instanceShp, DtCDBInstanceIndex &instanceAttrIndexes, const std::string &classdbf, DtCDBClassIndex &classAttrIndexes, const CDBTileVerbose &verboseKey, CdbGroupNode *groupNode, ProgressCallback *progress, bool &wasModelFound) const
Manage the processing (read dbf, shp, flt and textures) of shapefiles.
const CDBModelOptions * myCdbModelOptions
CDB option class.
Definition: DtCDBPager.h:240
CDBDatasets * myCDBDatasets
CDB Dataset information manager.
Definition: DtCDBPager.h:261
Create the CDB scene graph nodes One instance of this class will be instantiate for every CDB model d...
Definition: DtCDBPager.h:53
optional< CachePolicy > myPolicy
Cache policy set in the earth file.
Definition: DtCDBPager.h:291
CDBPager(const osgEarth::Map *map, const CDBModelOptions *CdbModelOptions, const osgDB::Options *dbOptions, osgEarth::SceneGraphCallbacks *sgCallbacks, DtDe &de)
CTOR.
Callback structure for pager events.
Definition: DtCDBPager.h:127

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)