VR-Forces 4.8 Class Documentation
 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) 2020 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 
22 
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 
52  class CDBPager : public osg::Group,
53  public osgEarth::MapNodeObserver
54  {
55  public:
56 
58  CDBPager(const osgEarth::Map* map, const CDBModelOptions* CdbModelOptions, const osgDB::Options* dbOptions, osgEarth::SceneGraphCallbacks* sgCallbacks, DtDe& de);
59 
61  virtual ~CDBPager();
62 
65  void build();
66 
68  void initialize();
69 
71  virtual osgEarth::MapNode* getMapNode();
72 
75  virtual void setMapNode(osgEarth::MapNode* mapNode);
76 
77  //virtual void setMap(const osgEarth::Map* map);
78 
80  bool getAdditive() { return myAdditive; }
81 
83  void setAdditive(bool additive) { myAdditive = additive; }
84 
86  //int getMinLevel() const { return myMinLevel; }
87 
89  //void setMinLevel(int minLevel) { myMinLevel = minLevel; }
90 
92  //int getMaxLevel() const { return myMaxLevel; }
93 
95  //void setMaxLevel(int maxLevel) { myMaxLevel = maxLevel; }
96 
98  //float getPriorityScale() const { return myPriorityScale; }
99 
101  //void setPriorityScale(float value) { myPriorityScale = value; }
102 
104  //float getPriorityOffset() const { return myPriorityOffset; }
105 
107  //void setPriorityOffset(float value) { myPriorityOffset = value; }
108 
110  void setFileLocationCallback(osgDB::FileLocationCallback* cb) { myFileLocationCallback = cb; }
111 
113  osgDB::FileLocationCallback* getFileLocationCallback() const { return myFileLocationCallback.get(); }
114 
116  void setEnableCancellation(bool value);
117 
119  bool getEnableCancellation() const;
120 
123  virtual CdbGroupNode* createCDBGroupNode(const CDBTileKey& key, osgEarth::ProgressCallback* progress, CdbGroupNode* parentGroup, bool& CdbtileFound, bool& hasChildren);
124 
126  struct Callback : public osg::Referenced
127  {
130  virtual void onCreateNode(const CDBTileKey& key, osg::Node* node) { }
131  };
132 
134  void addCallback(Callback* callback);
135 
137  void removeCallback(Callback* callback);
138 
140  void traverse(osg::NodeVisitor& nv);
141 
142  public:
143 
145  struct ProgressTracker : public osg::NodeCallback {
146  ProgressTracker(osg::NodeCallback*);
148  void operator()(osg::Node*, osg::NodeVisitor*);
149  };
150 
152  osg::Node* loadKey(const CDBTileKey& key, ProgressTracker* progress, CdbGroupNode* parentGroup);
153 
154  protected:
155 
157  osg::Node* buildRootNode();
158 
160  osg::PagedLOD* createPagedNode(const CDBTileKey& key, osgEarth::ProgressCallback* progress, CdbGroupNode* parentGroup);
161 
163  bool loadCdbTileModels(const CDBTileKey& key, ProgressCallback* progress, CdbGroupNode* groupNode, bool& CdbtileFound) const;
164 
168  inline bool doesLod0Exist(const CDBTileVerbose& verboseKey, int CdbDatasetCode, int CdbComponentSelector1, int CdbComponentSelector2) const;
169 
171  inline Quadrant getQuadrant(const CDBTileKey& key) const;
172 
174  bool writeTileToCache(const std::string& cacheKey, CdbGroupNode* node);
175 
177  CdbGroupNode* readTileFromCache(const CDBTileKey& key, const std::string& cacheKey);
178 
180  void initializeVector(const std::string& instanceshp, const std::string& classdbf, const std::string& extendeddbf) const;
181 
185 
188 
192 
195 
198 
201 
204 
207 
210 
213 
216 
218  typedef std::vector< osg::ref_ptr<Callback> > Callbacks;
219 
222 
225 
227  osg::observer_ptr<osgEarth::MapNode> myMapNode;
228  //osg::observer_ptr<const osgEarth::Map> myMap;
229 
231  void fire_onCreateNode(const CDBTileKey& key, osg::Node* node);
232 
235 
238 
241 
244 
247 
250 
253 
256 
259 
263 
265  std::string myCachePath;
266 
268  bool processShapeFile(VectFile* shpVector
269  , const std::string& instanceShp
270  , const std::string& classdbf
271  , const CDBTileVerbose& verboseKey
272  , CdbGroupNode* groupNode
273  , ProgressCallback* progress
274  , bool& wasModelFound) const;
275 
276 
286  optional<CachePolicy> myPolicy;
289 
291 
293  };
294 
295 } } } // namespace makVrv::oe::CDB
DatasetInfo myCurrentDataset
Current CDB Dataset of this pager.
Definition: DtCDBPager.h:249
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:80
Hold the unique CDB tile key information CDB LOD goes from -10 to 23.
Definition: DtCDBTileKey.h:28
osg::ref_ptr< DtCDBDatabase > myCdbDatabase
CDB database object.
Definition: DtCDBPager.h:255
osg::Node * buildRootNode()
The root node is a special node.
osg::ref_ptr< CDBTileCache > myTileCache
CDB Tile cache object.
Definition: DtCDBPager.h:234
Threading::Atomic myCacheReads
Number of cache reads.
Definition: DtCDBPager.h:280
int myMinLevel
CDB min lod (-10)
Definition: DtCDBPager.h:187
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:130
int myMaxLevel
CDB max lod (23) Could eventually set to limit max lod.
Definition: DtCDBPager.h:191
bool getEnableCancellation() const
return the cancellation of cdb tiles flag
void operator()(osg::Node *, osg::NodeVisitor *)
bool myCanCancel
TODO.
Definition: DtCDBPager.h:206
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:215
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:147
DtDe & myDe
Definition: DtCDBPager.h:290
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:227
CDB osg node class CdbGroupNode as the following structure for GT models Each quadrant does not have ...
Definition: DtCDBGroupNode.h:59
OpenThreads::Atomic Atomic
Definition: DtOsgThreadingUtils.h:15
float myPriorityScale
Osg Paged Lod priority scale value.
Definition: DtCDBPager.h:200
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:194
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.
bool myMapNodeRequired
Definition: DtCDBPager.h:292
void setAdditive(bool additive)
Set additive or non-additive lods for this page.
Definition: DtCDBPager.h:83
osg::ref_ptr< osgEarth::SceneGraphCallbacks > mySGCallbacks
Model scene graph callback.
Definition: DtCDBPager.h:224
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:265
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:184
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:282
static const DtCDBPagerConfig myConfig
Static class with predefine information.
Definition: DtCDBPager.h:278
std::vector< osg::ref_ptr< Callback > > Callbacks
Callback ref pointer vector typedef.
Definition: DtCDBPager.h:218
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.
bool processShapeFile(VectFile *shpVector, const std::string &instanceShp, const std::string &classdbf, const CDBTileVerbose &verboseKey, CdbGroupNode *groupNode, ProgressCallback *progress, bool &wasModelFound) const
Manage the processing (read dbf, shp, flt and textures) of shapefiles.
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:110
osgDB::FileLocationCallback * getFileLocationCallback() const
Get the file location callback.
Definition: DtCDBPager.h:113
CDB model earth file options for &quot;cdb&quot; model driver.
float myPriorityOffset
Osg Paged Lod priority offset value.
Definition: DtCDBPager.h:203
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:288
osg::ref_ptr< osgEarth::SpatialReference > myWgs84
Spatial reference pointer geocentric.
Definition: DtCDBPager.h:209
Quadrant
Definition: DtCDBGroupNode.h:35
void initializeVector(const std::string &instanceshp, const std::string &classdbf, const std::string &extendeddbf) const
Initialize vector pointer for current dataset in a thread safe matter.
osg::ref_ptr< osgEarth::SpatialReference > mySrs
Spatial reference pointer (flat earth projection)
Definition: DtCDBPager.h:212
osg::ref_ptr< CacheBin > myCacheBin
Pointer to cache object that read/write the nodes.
Definition: DtCDBPager.h:284
DatasetsModelRangeTable myDatasetsModelRangeTable
Possible list of map that can contain specific paging values for specific datasets.
Definition: DtCDBPager.h:246
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
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:252
Callbacks myCallbacks
callback vector
Definition: DtCDBPager.h:221
osg::ref_ptr< osgDB::Options > myDbOptions
Database option.
Definition: DtCDBPager.h:240
DtCDBModelRangeTable myDefaultModelRangeTable
Table with LOd switch paging distance.
Definition: DtCDBPager.h:243
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:262
Progress tracker class.
Definition: DtCDBPager.h:145
CDB Dataset class.
Definition: DtCDBDatasets.h:78
DtCDBModelRangeTable.
osg::ref_ptr< osgDB::FileLocationCallback > myFileLocationCallback
File location callback (needed for speed tree and light points)
Definition: DtCDBPager.h:197
const CDBModelOptions * myCdbModelOptions
CDB option class.
Definition: DtCDBPager.h:237
CDBDatasets * myCDBDatasets
CDB Dataset information manager.
Definition: DtCDBPager.h:258
Create the CDB scene graph nodes One instance of this class will be instantiate for every CDB model d...
Definition: DtCDBPager.h:52
optional< CachePolicy > myPolicy
Cache policy set in the earth file.
Definition: DtCDBPager.h:286
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:126

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)