VR-Forces 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) 2025 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 
24 
25 #include <tbb/concurrent_hash_map.h>
26 
27 #include <Vect/Cee_VectFeature.h>
28 #include <Cee_CdbDB.h>
29 
30 namespace osgEarth
31 {
32  class SpatialReference;
33 }
34 
35 namespace makVrv
36 {
37  class DtIndirectGeometryRegistrar;
38  class DtIndirectGeometry;
39  class DtOsgGraphMergeOperation;
40 
41  namespace oe { namespace CDB {
42 
43  class DatasetInfo;
44  class CDBTileKey;
45  class CDBTileVerbose;
46  class CDBModelOptions;
47  class CdbGroupNode;
48  class CDBDatasets;
49  class DtCDBClassIndex;
50  class DtCDBInstanceIndex;
51  class DtCdbGroupNodeProgress;
52 
55  class DtCDBVector : public osg::Referenced
56  {
57  public:
59  DtCDBVector(const DatasetInfo& CurrentDataset, osg::ref_ptr<DtCDBDatabase> cdbDb, const osgDB::Options* dbOptions, const CDBModelOptions* cdbModelOptions, DtDe& de);
61  ~DtCDBVector();
62 
64  virtual void initialize(const std::string& shpInstanceFile, DtCDBInstanceIndex& instanceAttrIndexes,
65  const std::string& dbfClassFile, DtCDBClassIndex& classAttrIndexes,
66  const std::string& dbfExtendedFile) = 0;
68  virtual bool isInitialized() const { return myIsInitialized; };
69 
71  virtual void readInstance(const std::string& dbfClassFile, DtCDBInstanceIndex& instanceAttrIndexes, const CDBTileKey& key,
72  const std::string& shpInstanceFile, VectFile* shpVector, VecInstancesDbfRow& vecInstanceRow, const MapStringToClassDbfRow& classMap) = 0;
73 
75  virtual void readClass(const std::string& dbfClassFile, DtCDBClassIndex& classAttrIndexes, const CDBTileKey& key, MapStringToClassDbfRow& classMap) = 0;
77  //virtual void readExtended() = 0;
79  virtual void processFeature(const std::string& dbfClassFile, const CDBTileKey& key, CdbGroupNode* groupNode, VecInstancesDbfRow& vecInstanceRow,
80  DtCdbGroupNodeProgress* progress, bool& wasModelFound) = 0;
81 
83  bool getModelPoint(const VectFeature* feature, osg::Vec3d& modelPoint);
84 
86  void setMapNode( osgEarth::MapNode* mapNode );
87 
90 
92  virtual void finishTileLoad(CdbGroupNode* groupNode) { ; }
93 
96  virtual void optimizeNodeGraphStateSharing(CdbGroupNode* groupNode);
97 
99  virtual void finishLoadingIndirect(DtIndirectGeometry * indirectGeometry);
100 
104  virtual bool performFeatureInitializationWithPriority() const;
105 
109 
111  virtual bool getMCOD() const { return myMCOD; }
112 
114  void setDatasetCachePath( const std::string& cachePath );
115 
119  const RenderingMethod renderingMethod() const;
121 
125  virtual void mapIsolatedNodeToParentNode( osg::ref_ptr<CdbGroupNode> isolatedTempNode,
126  osg::ref_ptr<CdbGroupNode> parentNode );
127 
131  virtual void mergeGroupNodeIntoLiveScenegraph( osg::ref_ptr<CdbGroupNode> isolatedTempNode, int priority );
132  protected:
133 
138  virtual std::string createMCODTableString(const std::map<std::string, color2DArray>& baseMaterialMap);
139 
145  osg::observer_ptr<osgEarth::MapNode> myMapNode;
146 
148  osg::observer_ptr<osgEarth::ElevationPool> myElevationPool;
149 
151  osgEarth::ElevationPool::WorkingSet* myElevationPoolWorkingSet;
152 
158  std::string myDatasetCachePath;
160  std::string myShpInstanceFile;
162  std::string myDbfClassFile;
164  std::string myDbfExtendedFile;
174  std::string myCDBRootPath;
176  std::string myFACC;
178  std::string myFSC;
180  std::string myCNAM;
182  unsigned int myCMIX;
183 
185  //int myClassIndexCNAM;
187  //int myClassIndexFACC;
189  //int myClassIndexFSC;
191  //int myClassIndexCMIX;
192 
195 
198 
201 
203 
204  const bool myEnableIntersections = true;
205 
206  const float myModelScaling = 1.0f;
207 
208  // Color Map to transform CDB Raster Material to MCOD color
210 
213 
216  bool myMCOD;
217 
219 
221  {
222  size_t hash( const osg::ref_ptr<CdbGroupNode>& key ) const
223  {
224  return std::hash<const CdbGroupNode*>()(key.get());
225  }
226  bool equal( const osg::ref_ptr<CdbGroupNode >& lhs, const osg::ref_ptr<CdbGroupNode>& rhs ) const
227  {
228  return lhs.get() == rhs.get();
229  }
230  };
231 
233  tbb::concurrent_hash_map< osg::ref_ptr<CdbGroupNode>, osg::ref_ptr<CdbGroupNode>, GroupPtrHash>;
235  };
236 }}} // namespace makVrv::oe::CDB
bool equal(const osg::ref_ptr< CdbGroupNode > &lhs, const osg::ref_ptr< CdbGroupNode > &rhs) const
Definition: DtCDBVector.h:226
std::string myDbfClassFile
Dbf class filename.
Definition: DtCDBVector.h:162
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
CDB Configuration file holding constant definition.
CDBSigSizeTable mySigSizeTable
Significant Size table for the current dataset.
Definition: DtCDBVector.h:172
RenderingMethod myRenderingMethod
Vector rendering method.
Definition: DtCDBVector.h:200
CDB Class that hold the Dataset informationNote: A DUPLICATED class also exist in the Openflight Plug...
size_t hash(const osg::ref_ptr< CdbGroupNode > &key) const
Definition: DtCDBVector.h:222
DatasetInfo myCurrentDataset
Dataset information.
Definition: DtCDBVector.h:156
virtual void readClass(const std::string &dbfClassFile, DtCDBClassIndex &classAttrIndexes, const CDBTileKey &key, MapStringToClassDbfRow &classMap)=0
Read class dbf indexes and information.
Utility class for Material Classification on Demand (MCOD) for CDB raster/model dataset.
virtual void readInstance(const std::string &dbfClassFile, DtCDBInstanceIndex &instanceAttrIndexes, const CDBTileKey &key, const std::string &shpInstanceFile, VectFile *shpVector, VecInstancesDbfRow &vecInstanceRow, const MapStringToClassDbfRow &classMap)=0
Read instance dbf indexes and information.
Definition: featureContext.h:36
Indirect geometry can have multiple models and their corresponding ids registered in it...
Definition: DtIndirectGeometryRegistrar.h:111
bool myIsInitialized
Was the indexes read.
Definition: DtCDBVector.h:141
std::string myDbfExtendedFile
Dbf extented attributes filename.
Definition: DtCDBVector.h:164
makVrv::oe::CDB::mcodColorMap myMCODTerrainColorMap
Definition: DtCDBVector.h:209
virtual bool getMCOD() const
do we need MCOD
Definition: DtCDBVector.h:111
bool myMCOD
flag to check if we want to enable MCOD for this dataset will be turn on if we have a mcod color map ...
Definition: DtCDBVector.h:216
osgEarth::ElevationPool::WorkingSet * myElevationPoolWorkingSet
elevation pool working set
Definition: DtCDBVector.h:151
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
virtual std::string createMCODTableString(const std::map< std::string, color2DArray > &baseMaterialMap)
Create an MCOD string table to pass as an option when reading the FLT model. OSG OpenFlight plugin wi...
std::vector< osg::ref_ptr< DtCDBinstanceRow > > VecInstancesDbfRow
Definition: DtCDBClassRow.h:88
osg::ref_ptr< osgDB::Options > & getDbOptions()
needed by async loaders
Definition: DtCDBVector.h:108
RenderingMethod
Rendering enum method.
Definition: DtRenderingMethod.h:14
const CDBModelOptions * myCdbModelOptions
CDB option class.
Definition: DtCDBVector.h:168
static const DtCDBDbfConfig myVectorConfig
Static class with predefine information.
Definition: DtCDBVector.h:154
Utility class to manage CDB Base Material Table.
virtual void processFeature(const std::string &dbfClassFile, const CDBTileKey &key, CdbGroupNode *groupNode, VecInstancesDbfRow &vecInstanceRow, DtCdbGroupNodeProgress *progress, bool &wasModelFound)=0
Read extended dbf indexes (not yet supported)
tbb::concurrent_hash_map< osg::ref_ptr< CdbGroupNode >, osg::ref_ptr< CdbGroupNode >, GroupPtrHash > DtIsolatedNodeToLiveNodeMap
Definition: DtCDBVector.h:233
std::map< std::string, color2DArray > mcodColorMap
Definition: DtCDBMcod.h:28
osg::ref_ptr< DtCDBBaseMaterialTable > myProceduralBaseMaterialTable
Base Material table use to map Procedural class index.
Definition: DtCDBVector.h:212
virtual void mergeGroupNodeIntoLiveScenegraph(osg::ref_ptr< CdbGroupNode > isolatedTempNode, int priority)
Merge an isolated graph group node into the live scene graph, looks up the live group node in myIsola...
\ ::, which allows us to hook into our indirect engine to render using indirect rendering...
Definition: DtIndirectGeometry.h:120
CDB Dataset information class.
Definition: DtCDBDatasetInfo.h:23
virtual DtIndirectGeometryRegistrar * indirectGeometryRegistrar()
access to indirect classes
Definition: DtCDBVector.h:89
The DtCdbGroupNodeProgressthat gets passed to createPagedNode() to use. It will report cancellation i...
Definition: DtCDBPager.h:101
void setMapNode(osgEarth::MapNode *mapNode)
The observer map node.
osg::observer_ptr< osgEarth::MapNode > myMapNode
observer pointer to the plugin map node
Definition: DtCDBVector.h:145
std::string myCNAM
Class Name field value (common attributes)
Definition: DtCDBVector.h:180
CDBDatasets * myCDBDatasets
CDB Dataset information manager.
Definition: DtCDBVector.h:197
Used to pass option(s) Used to pass option from the OSG earth file this &quot;cdb&quot; model driver...
Definition: DtCDBModelOptions.h:28
std::string myCDBRootPath
Copy of CDB root path (from myDbOptions)
Definition: DtCDBVector.h:174
const float myModelScaling
Definition: DtCDBVector.h:206
Abstract Vector handler class.
Definition: DtCDBVector.h:55
DtIsolatedNodeToLiveNodeMap myIsolatedGroupNodeToLiveGroupNodes
Definition: DtCDBVector.h:234
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:160
unsigned int myCMIX
Composite Material Index field value (common attributes)
Definition: DtCDBVector.h:182
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.
osg::ref_ptr< DtCDBDatabase > myCdbDatabase
Valid CDB database pointer.
Definition: DtCDBVector.h:166
DtOsgGraphMergeOperation adds a non-live isolated child Group onto a parent Group which is already li...
Definition: DtOsgGraphMergeOperation.h:41
std::unordered_map< std::string, osg::ref_ptr< DtCDBClassRow > > MapStringToClassDbfRow
Definition: DtCDBClassRow.h:52
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 mapIsolatedNodeToParentNode(osg::ref_ptr< CdbGroupNode > isolatedTempNode, osg::ref_ptr< CdbGroupNode > parentNode)
Map a non live group node to a group node that is live in the main scene graph Once the non live grou...
virtual bool performFeatureInitializationWithPriority() const
Whether or not feature initialization should be performed with priority based on LOD This function al...
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
Definition: DtCDBVector.h:220
bool getModelPoint(const VectFeature *feature, osg::Vec3d &modelPoint)
Get the vector point.
osg::ref_ptr< osgDB::Options > myDbOptions
Database option.
Definition: DtCDBVector.h:170
void setDatasetCachePath(const std::string &cachePath)
The cache path for the data set.
Abstract class to manage Cdb class vector row (dbf) information.
virtual void finishTileLoad(CdbGroupNode *groupNode)
Finish loading the tile, implemented in derived classes, but not in Lightpoint.
Definition: DtCDBVector.h:92
int myTileLod
keep a copy of the current tile CDB LOD
Definition: DtCDBVector.h:194
osg::ref_ptr< osgEarth::SpatialReference > myWgs84
Spatial reference pointer geocentric.
Definition: DtCDBVector.h:143
makVrv::DtOsgGraphMergeOperation * myMergeOperation
Definition: DtCDBVector.h:218
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
osg::observer_ptr< osgEarth::ElevationPool > myElevationPool
observer pointer to the elevation pool on the map node
Definition: DtCDBVector.h:148
std::string myDatasetCachePath
The cache path for the data set.
Definition: DtCDBVector.h:158
virtual bool isInitialized() const
Check if initialize() was called.
Definition: DtCDBVector.h:68
virtual void finishLoadingIndirect(DtIndirectGeometry *indirectGeometry)
forces the pager to wait till tile is really ready, shared code that useful for derived classes ...
DtDe & myDe
Definition: DtCDBVector.h:202
CDB class that hold definition (like DBF column name, config file, etc)Renamed DtCDBDbfConfig from Dt...
Definition: DtCDBDbfConfig.h:20
Hold all the Significant size information of one dataset.
Definition: DtCDBSigSizeTable.h:20
RenderingMethod renderingMethod()
Get the rendering method.
virtual void optimizeNodeGraphStateSharing(CdbGroupNode *groupNode)
Runs an optimization step for the given node for state sharing. This should be called after loading b...
const bool myEnableIntersections
Definition: DtCDBVector.h:204
std::string myFACC
Feature Attribute Classification Code field value (common attributes)
Definition: DtCDBVector.h:176
std::string myFSC
FACC Sub Code field value (common attributes)
Definition: DtCDBVector.h:178

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)