VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtCDBVector.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright(c) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 #include <osgEarth/Map>
12 #include <osgEarth/Progress>
13 #include <osgEarth/MapNodeObserver>
14 
16 
20 
24 #include <Vect/Cee_VectFeature.h>
25 #include <Cee_CdbDB.h>
26 #include <vrvUtil/DtProfiler.h>
27 //#include <osgEarth/ElevationQuery>
28 #include <boost/thread/condition_variable.hpp>
29 #include <tbb/atomic.h>
30 #include <tbb/tbb.h>
31 #include <thread>
32 //#define NotTBBGetElevation 1
33 
34 #include <vector>
35 
36 namespace osgEarth
37 {
38  class SpatialReference;
39 
40  namespace Util
41  {
42  class ElevationQuery;
43  }
44 }
45 
46 namespace makVrv {
47  class DtIndirectGeometryRegistrar;
48  class DtIndirectGeometry;
49  namespace oe {
50  namespace CDB
51 {
52  class DatasetInfo;
53  class CDBTileKey;
54  class CDBTileVerbose;
55  class CDBModelOptions;
56  class CdbGroupNode;
57  class CDBDatasets;
58 
59  // get
61  {
62  public:
64  virtual ~DtTbbGetElevationHelper();
65  public:
66  virtual void getElevations(std::vector<osg::Vec3d>& modelPoints
67  , int nbFeature
68  , osgEarth::Util::ElevationQuery& wElevationQuery
69  , const osgEarth::SpatialReference* pointsSRS
70  , bool ignoreZ
71  );
72  };
73 
76  class DtCDBVector : public osg::Referenced
77  {
78  public:
80  DtCDBVector(const DatasetInfo& CurrentDataset, osg::ref_ptr<DtCDBDatabase> cdbDb, const osgDB::Options* dbOptions, const CDBModelOptions* cdbModelOptions, DtDe& de);
82  ~DtCDBVector();
83 
85  virtual void initialize(const std::string& shpInstanceFile, DtCDBInstanceIndex& instanceAttrIndexes,
86  const std::string& dbfClassFile, DtCDBClassIndex& classAttrIndexes,
87  const std::string& dbfExtendedFile) = 0;
89  virtual bool isInitialized() const { return myIsInitialized; };
91  virtual void readInstance(const std::string& dbfClassFile, DtCDBInstanceIndex& instanceAttrIndexes, const CDBTileKey& key, const std::string& shpInstanceFile, VectFile* shpVector,
92  const osgEarth::Util::ElevationQuery& elevationQuery, VecInstancesDbfRow& vecInstanceRow, const CDBTileVerbose& verboseKey,
93  const MapStringToClassDbfRow& classMap, const std::string* datasetCachePath = NULL) = 0;
95  virtual void readClass(const std::string& dbfClassFile, DtCDBClassIndex& classAttrIndexes, const CDBTileKey& key, const CDBTileVerbose& verboseKey, MapStringToClassDbfRow& classMap) = 0;
97  //virtual void readExtended() = 0;
99  virtual void processFeature(const std::string& dbfClassFile, const CDBTileKey& key, CdbGroupNode* groupNode, VecInstancesDbfRow& vecInstanceRow,
100  osgEarth::ProgressCallback* progress, bool& wasModelFound) = 0;
102  bool getModelPoint(const VectFeature* feature, osg::Vec3d& modelPoint);
104  bool isValidName(std::string &filename) const;
106  void setMapNode(osgEarth::MapNode* mapNode) { myMapNode = mapNode; };
107 
110 
112  virtual void finishTileLoadAndWait(CdbGroupNode* groupNode) { ; }
113 
115  virtual void finishLoadingIndirectAndWait(DtIndirectGeometry * indirectGeometry);
116 
119 
121  virtual void markTaskFinished();
122 
123  protected:
129  osg::observer_ptr<osgEarth::MapNode> myMapNode;
135  std::string myShpInstanceFile;
137  std::string myDbfClassFile;
139  std::string myDbfExtendedFile;
149  std::string myCDBRootPath;
151  std::string myFACC;
153  std::string myFSC;
155  std::string myCNAM;
157  unsigned int myCMIX;
158 
160  //int myClassIndexCNAM;
162  //int myClassIndexFACC;
164  //int myClassIndexFSC;
166  //int myClassIndexCMIX;
167 
170 
173 
176 
177  static tbb::atomic<int> theTotalNumActiveAsyncTasks;
178  tbb::atomic<int> myActiveAsyncTasks;
179  boost::condition_variable myWaitCondition;
180  boost::mutex myWaitMutex;
181 
183 
184  static const std::thread::id theMainThreadId;
185 
186  const bool myEnableIntersections = true;
187  };
188 }}} // namespace makVrv::oe::CDB
std::string myDbfClassFile
Dbf class filename.
Definition: DtCDBVector.h:137
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
static const DtCDBPagerConfig myVectorConfig
Static class with predefine information.
Definition: DtCDBVector.h:131
CDBSigSizeTable mySigSizeTable
Significant Size table for the current dataset.
Definition: DtCDBVector.h:147
RenderingMethod myRenderingMethod
Vector rendering method.
Definition: DtCDBVector.h:175
CDB Class that hold the Dataset informationNote: A DUPLICATED class also exist in the Openflight Plug...
DatasetInfo myCurrentDataset
Dataset information.
Definition: DtCDBVector.h:133
Abstract class to manage Cdb class/instance attributes indexes (dbf) information. ...
Definition: featureContext.h:37
Indirect geometry can have multiple models and their corresponding ids registered in it...
Definition: DtIndirectGeometryRegistrar.h:106
boost::condition_variable myWaitCondition
Definition: DtCDBVector.h:179
bool myIsInitialized
Was the indexes read.
Definition: DtCDBVector.h:125
std::string myDbfExtendedFile
Dbf extented attributes filename.
Definition: DtCDBVector.h:139
tbb::atomic< int > myActiveAsyncTasks
Definition: DtCDBVector.h:178
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
CDB class that hold definition (like DBF column name, config file, etc)
Definition: DtCDBPagerConfig.h:18
osg::ref_ptr< osgDB::Options > & getDbOptions()
needed by async loaders
Definition: DtCDBVector.h:118
RenderingMethod
Rendering enum method.
Definition: DtRenderingMethod.h:14
const CDBModelOptions * myCdbModelOptions
CDB option class.
Definition: DtCDBVector.h:143
bool isValidName(std::string &filename) const
Check if a cdb filename is valid.
\ ::, which allows us to hook into our indirect engine to render using indirect rendering...
Definition: DtIndirectGeometry.h:115
boost::mutex myWaitMutex
Definition: DtCDBVector.h:180
static const std::thread::id theMainThreadId
Definition: DtCDBVector.h:184
CDB Dataset information class.
Definition: DtCDBDatasetInfo.h:23
virtual DtIndirectGeometryRegistrar * indirectGeometryRegistrar()
access to indirect classes
Definition: DtCDBVector.h:109
void setMapNode(osgEarth::MapNode *mapNode)
The observer map node.
Definition: DtCDBVector.h:106
osg::observer_ptr< osgEarth::MapNode > myMapNode
observer pointer to the plugin map node
Definition: DtCDBVector.h:129
std::string myCNAM
Class Name field value (common attributes)
Definition: DtCDBVector.h:155
virtual void processFeature(const std::string &dbfClassFile, const CDBTileKey &key, CdbGroupNode *groupNode, VecInstancesDbfRow &vecInstanceRow, osgEarth::ProgressCallback *progress, bool &wasModelFound)=0
Read extended dbf indexes (not yet supported)
CDB Configuration file holding constant definition.
CDBDatasets * myCDBDatasets
CDB Dataset information manager.
Definition: DtCDBVector.h:172
Used to pass option(s) Used to pass option from the OSG earth file this &quot;cdb&quot; model driver...
Definition: DtCDBModelOptions.h:28
Definition: DtCDBVector.h:60
Contains the classes allowing the profiler to work, DtProfileManager, DtProfileSample, and DtProfileIterator.
std::string myCDBRootPath
Copy of CDB root path (from myDbOptions)
Definition: DtCDBVector.h:149
virtual void getElevations(std::vector< osg::Vec3d > &modelPoints, int nbFeature, osgEarth::Util::ElevationQuery &wElevationQuery, const osgEarth::SpatialReference *pointsSRS, bool ignoreZ)
Abstract Vector handler class.
Definition: DtCDBVector.h:76
DtCDBVector(const DatasetInfo &CurrentDataset, osg::ref_ptr< DtCDBDatabase > cdbDb, const osgDB::Options *dbOptions, const CDBModelOptions *cdbModelOptions, DtDe &de)
CTOR.
std::string myShpInstanceFile
Dbf instance filename.
Definition: DtCDBVector.h:135
unsigned int myCMIX
Composite Material Index field value (common attributes)
Definition: DtCDBVector.h:157
std::vector< osg::ref_ptr< DtCDBinstanceRow > > VecInstancesDbfRow
Definition: DtCDBClassRow.h:69
virtual void initialize(const std::string &shpInstanceFile, DtCDBInstanceIndex &instanceAttrIndexes, const std::string &dbfClassFile, DtCDBClassIndex &classAttrIndexes, const std::string &dbfExtendedFile)=0
Read the index of the needed fields and set myIsInitialized flag to true.
virtual void finishLoadingIndirectAndWait(DtIndirectGeometry *indirectGeometry)
forces the pager to wait till tile is really ready, shared code that useful for derived classes ...
osg::ref_ptr< DtCDBDatabase > myCdbDatabase
Valid CDB database pointer.
Definition: DtCDBVector.h:141
CDB Significant Size Table class (to be filled from ../appData/cdb/SignificantSize_SwitchDistance.xml) Note: A DUPLICATED class also exist in the Openflight Plugin of MakOSG and this one in Vantage osgdb_osgearth_model_cdb TODO REMOVE THIS ONE AND REFERENCE THE MakOsg FLT one once we MERGE IN THE TRUNK.
virtual void readClass(const std::string &dbfClassFile, DtCDBClassIndex &classAttrIndexes, const CDBTileKey &key, const CDBTileVerbose &verboseKey, MapStringToClassDbfRow &classMap)=0
Read class dbf indexes and information.
virtual void finishTileLoadAndWait(CdbGroupNode *groupNode)
forces the pager to wait till tile is really ready, implemented in derived classes, but not in Lightpoint
Definition: DtCDBVector.h:112
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
static tbb::atomic< int > theTotalNumActiveAsyncTasks
Definition: DtCDBVector.h:177
Utility class to pass CDB lat/lon/ured/rref) values.
Definition: DtCDBTileVerbose.h:17
bool getModelPoint(const VectFeature *feature, osg::Vec3d &modelPoint)
Get the vector point.
osg::ref_ptr< osgDB::Options > myDbOptions
Database option.
Definition: DtCDBVector.h:145
virtual void readInstance(const std::string &dbfClassFile, DtCDBInstanceIndex &instanceAttrIndexes, const CDBTileKey &key, const std::string &shpInstanceFile, VectFile *shpVector, const osgEarth::Util::ElevationQuery &elevationQuery, VecInstancesDbfRow &vecInstanceRow, const CDBTileVerbose &verboseKey, const MapStringToClassDbfRow &classMap, const std::string *datasetCachePath=NULL)=0
Read instance dbf indexes and information.
std::map< std::string, osg::ref_ptr< DtCDBClassRow > > MapStringToClassDbfRow
Definition: DtCDBClassRow.h:31
virtual void markTaskFinished()
called exclusively by async loaders
Abstract class to manage Cdb class vector row (dbf) information.
int myTileLod
keep a copy of the current tile CDB LOD
Definition: DtCDBVector.h:169
osg::ref_ptr< osgEarth::SpatialReference > myWgs84
Spatial reference pointer geocentric.
Definition: DtCDBVector.h:127
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
virtual bool isInitialized() const
Check if initialize() was called.
Definition: DtCDBVector.h:89
DtDe & myDe
Definition: DtCDBVector.h:182
Hold all the Significant size information of one dataset.
Definition: DtCDBSigSizeTable.h:20
const bool myEnableIntersections
Definition: DtCDBVector.h:186
std::string myFACC
Feature Attribute Classification Code field value (common attributes)
Definition: DtCDBVector.h:151
std::string myFSC
FACC Sub Code field value (common attributes)
Definition: DtCDBVector.h:153

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)