VR-Forces 4.6 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) 2016 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 { namespace oe { namespace CDB
39 {
40  class CDBTileKey;
41  class CDBTileVerbose;
42  class CDBModelOptions;
43 
48  class CDBPager : public osg::Group,
49  public osgEarth::MapNodeObserver
50  {
51  public:
52 
54  CDBPager(const osgEarth::Map* map, const CDBModelOptions* CdbModelOptions, const osgDB::Options* dbOptions, osgEarth::SceneGraphCallbacks* sgCallbacks);
55 
57  virtual ~CDBPager();
58 
61  void build();
62 
64  void initialize();
65 
67  virtual osgEarth::MapNode* getMapNode();
68 
70  virtual void setMapNode(osgEarth::MapNode* mapNode);
71 
73  bool getAdditive() { return myAdditive; }
74 
76  void setAdditive(bool additive) { myAdditive = additive; }
77 
79  //int getMinLevel() const { return myMinLevel; }
80 
82  //void setMinLevel(int minLevel) { myMinLevel = minLevel; }
83 
85  //int getMaxLevel() const { return myMaxLevel; }
86 
88  //void setMaxLevel(int maxLevel) { myMaxLevel = maxLevel; }
89 
91  //float getPriorityScale() const { return myPriorityScale; }
92 
94  //void setPriorityScale(float value) { myPriorityScale = value; }
95 
97  //float getPriorityOffset() const { return myPriorityOffset; }
98 
100  //void setPriorityOffset(float value) { myPriorityOffset = value; }
101 
103  void setFileLocationCallback(osgDB::FileLocationCallback* cb) { myFileLocationCallback = cb; }
104 
106  osgDB::FileLocationCallback* getFileLocationCallback() const { return myFileLocationCallback.get(); }
107 
109  void setEnableCancelation(bool value);
110 
112  bool getEnableCancalation() const;
113 
116  virtual CdbGroupNode* createCDBGroupNode(const CDBTileKey& key, osgEarth::ProgressCallback* progress, CdbGroupNode* parentGroup, bool& CdbtileFound, bool& hasChildren);
117 
119  struct Callback : public osg::Referenced
120  {
123  virtual void onCreateNode(const CDBTileKey& key, osg::Node* node) { }
124  };
125 
127  void addCallback(Callback* callback);
128 
130  void removeCallback(Callback* callback);
131 
133  void traverse(osg::NodeVisitor& nv);
134 
135  public:
136 
138  struct ProgressTracker : public osg::NodeCallback {
139  ProgressTracker(osg::NodeCallback*);
140  osg::ref_ptr<osgEarth::ProgressCallback> _progress[4];
141  void operator()(osg::Node*, osg::NodeVisitor*);
142  };
143 
145  osg::Node* loadKey(const CDBTileKey& key, ProgressTracker* progress, CdbGroupNode* parentGroup);
146 
147  protected:
148 
150  osg::Node* buildRootNode();
151 
153  osg::PagedLOD* createPagedNode(const CDBTileKey& key, osgEarth::ProgressCallback* progress, CdbGroupNode* parentGroup);
154 
156  bool loadCdbTileModels(const CDBTileKey& key, CdbGroupNode* groupNode, bool& CdbtileFound) const;
157 
161  inline bool doesLod0Exist(const CDBTileVerbose& verboseKey, int CdbDatasetCode, int CdbComponentSelector1, int CdbComponentSelector2) const;
162 
164  inline Quadrant getQuadrant(const CDBTileKey& key) const;
165 
167  bool writeTileToCache(const std::string& cacheKey, CdbGroupNode* node);
168 
170  CdbGroupNode* readTileFromCache(const CDBTileKey& key, const std::string& cacheKey);
171 
173  void initializeVector(const std::string& instanceshp, const std::string& classdbf, const std::string& extendeddbf) const;
174 
178 
181 
185 
187  osg::ref_ptr< osg::NodeCallback > myProgressMaster;
188 
190  osg::ref_ptr< osgDB::FileLocationCallback > myFileLocationCallback;
191 
194 
197 
200 
202  osg::ref_ptr< osgEarth::SpatialReference > myWgs84;
203 
205  osg::ref_ptr< osgEarth::SpatialReference > mySrs;
206 
209 
211  typedef std::vector< osg::ref_ptr<Callback> > Callbacks;
212 
215 
217  osg::ref_ptr< osgEarth::SceneGraphCallbacks > mySGCallbacks;
218 
220  osg::observer_ptr<osgEarth::MapNode> myMapNode;
221 
223  void fire_onCreateNode(const CDBTileKey& key, osg::Node* node);
224 
226  osg::ref_ptr<CDBTileCache> myTileCache;
227 
230 
232  osg::ref_ptr<osgDB::Options> myDbOptions;
233 
236 
239 
242 
245 
247  mutable osg::ref_ptr<DtCDBDatabase> myCdbDatabase;
248 
251 
255 
257  std::string myCachePath;
258 
260  void processShapeFile(VectFile* shpVector
261  , const std::string& instanceShp
262  , const std::string& classdbf
263  , const CDBTileVerbose& verboseKey
264  , CdbGroupNode* groupNode
265  , bool& wasModelFound) const;
266 
267 
275  osg::ref_ptr<CacheBin> myCacheBin;
277  optional<CachePolicy> myPolicy;
279  osg::ref_ptr<DtCDBVector> myVector;
280  };
281 
282 } } } // namespace makVrv::oe::CDB

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)