VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtModelMergerCell.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
9 #pragma once
10 
11 #include <vrvOsg/vrvOsg.h>
12 
13 #include <vrvUtil/DtGeoReference.h>
15 
16 #include <osgEarth/GeoData>
17 
18 #include <array>
19 
20 namespace makVrv
21 {
24  {
25  public:
26 
33  {
34  // CTOR
36  {
37 
38  };
39  GroupedModelInfo( osg::Matrix mat ) :
40  myGroupedModelMatrix( mat )
41  {
42 
43  };
44  osg::Matrix myGroupedModelMatrix;
45  };
46 
48  struct ModelInfo
49  {
50  // These should come from the shape file and be unconverted
51  // We want to compare models at LODs, conversions will introduce
52  // floating point issues
53  // DEGREES
54  double lat;
55  double lon;
56  double alt;
57 
58  int lod;
59  unsigned int index;
60 
61  std::string modelFilePath;
62  std::string componentName;
63  osg::Matrix transform;
64  };
65 
67  DtModelMergerCell( double lat, double lon, double maxLat, double maxLon, double alt, int lod,
69 
71  virtual ~DtModelMergerCell();
72 
75  virtual bool addModel( ModelInfo& model );
76 
81  virtual void setMaxModelCount( size_t count );
82  virtual size_t maxModelCount() const;
84 
96  virtual void setMinimumCellSize( double size);
97  virtual double mimimumCellSize() const;
99 
102  virtual double lat()const;
103  virtual double lon()const;
104  virtual double maxLat()const;
105  virtual double maxLon()const;
106  virtual double alt()const;
107  virtual int lod()const;
109 
110  virtual std::array< DtModelMergerCell*, 4>& subCells();
111  virtual std::vector<ModelInfo>& models();
112 
113  virtual osg::ref_ptr< osg::Group > modelsGroupNode();
114  virtual osg::ref_ptr<osg::MatrixTransform> cellTransform();
115 
116  virtual void setCacheDirectory( std::string& cacheDir );
117  virtual void setMappingsCacheDirectory( std::string& mappingsDir );
118  virtual void setLatLonLodString( std::string& str );
119  virtual const std::string& cacheDirectory() const;
120 
123  virtual void runDiskWriteOps();
124 
126  virtual void setOverwrite( bool overwrite );
127 
130  virtual void setIsRootCell( bool isRoot );
131 
133  virtual void setMappingsMap( std::unordered_map<std::string, std::string>* map );
134  virtual void setInfosMap( std::unordered_map<std::string, GroupedModelInfo>* map );
135 
136  virtual void setDbOptions( osg::ref_ptr<osgDB::Options> options );
137 
140  virtual void printMinCellStats();
141  protected:
143  virtual void initCellCoordinates();
144 
146  virtual void createSubCells();
147 
149  virtual bool isPointInCell( const osg::Vec2d& point );
150 
152  virtual void buildTransformForCell();
153 
154  virtual void writeModelsGroupNodeToDisk();
155 
157  virtual void writeGroupedModelInfosToDisk();
158 
161  virtual void writeMappingsToDisk();
162 
164  virtual void runOptimisationsOnNode( osg::ref_ptr<osg::Group> group );
165  protected:
166  double myLat;
167  double myLon;
168  double myMaxLat;
169  double myMaxLon;
170  double myAlt;
173  double myMinSize;
174 
175  int myLod;
176 
182 
183  std::array< DtModelMergerCell*, 4> mySubCells;
184 
188 
190  std::vector<osg::Vec2> myCellCoordinates;
192 
193  std::vector<ModelInfo> myModels;
194 
196 
198 
200 
201  std::string myCacheDirectory;
203  std::string myLatLonLodString;
204 
205  std::unordered_map<std::string, std::string>* myDatabaseFileToGroupNodeFileMap;
206  std::unordered_map<std::string, GroupedModelInfo>* myGroupedModelToInfoMap;
207 
209  };
210 }
double lon
Definition: DtModelMergerCell.h:55
std::vector< osg::Vec2 > myCellCoordinates
Lat Lon degrees.
Definition: DtModelMergerCell.h:190
Info for each model added to the cell.
Definition: DtModelMergerCell.h:48
GroupedModelInfo(osg::Matrix mat)
Definition: DtModelMergerCell.h:39
std::string myLatLonLodString
Definition: DtModelMergerCell.h:203
std::string componentName
Definition: DtModelMergerCell.h:62
unsigned int index
Definition: DtModelMergerCell.h:59
The DtGeoReference class provides a mechanism to convert between geodetic coordinates and topocentric...
Definition: DtGeoReference.h:28
bool myBeenVisualised
Definition: DtModelMergerCell.h:178
GroupedModelInfo()
Definition: DtModelMergerCell.h:35
double myLon
Definition: DtModelMergerCell.h:167
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
bool myIsRootCell
Definition: DtModelMergerCell.h:180
DtGeoReference myShapeFileGeoRef
Definition: DtModelMergerCell.h:187
bool myOverwrite
Definition: DtModelMergerCell.h:179
voidpf void uLong size
Definition: ioapi.h:39
std::unordered_map< std::string, std::string > * myDatabaseFileToGroupNodeFileMap
Definition: DtModelMergerCell.h:205
osg::ref_ptr< osgDB::Options > myDbOptions
Definition: DtModelMergerCell.h:208
bool myIsMinSize
Definition: DtModelMergerCell.h:181
Definition: SGP4.h:67
std::vector< ModelInfo > myModels
Definition: DtModelMergerCell.h:193
double myLat
Definition: DtModelMergerCell.h:166
double myMinSize
Minimum size that the cell can be in metres, x and y Default 200.
Definition: DtModelMergerCell.h:173
osg::ref_ptr< osg::MatrixTransform > myCellTransform
Definition: DtModelMergerCell.h:197
osg::Matrix transform
Definition: DtModelMergerCell.h:63
double alt
Definition: DtModelMergerCell.h:56
size_t myMaxModelCount
Definition: DtModelMergerCell.h:199
int lod
Definition: DtModelMergerCell.h:58
double lat
Definition: DtModelMergerCell.h:54
double myAlt
Definition: DtModelMergerCell.h:170
std::string modelFilePath
Definition: DtModelMergerCell.h:61
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition: DtCoordinateSystem.h:40
double myMaxLon
Definition: DtModelMergerCell.h:169
bool mySubCellsCreated
Definition: DtModelMergerCell.h:177
2D Quad tree based on lat/lon, splits when a max model count is reached
Definition: DtModelMergerCell.h:23
Contains DLL export macros.
std::string myCacheDirectory
Definition: DtModelMergerCell.h:201
double myMaxLat
Definition: DtModelMergerCell.h:168
osg::ref_ptr< osg::Group > myModelsGroupNode
Definition: DtModelMergerCell.h:195
std::string myMappingsCacheDirectory
Definition: DtModelMergerCell.h:202
Contains makVrv::DtGeoReference class.
osg::ref_ptr< osgEarth::SpatialReference > myWgs84
Definition: DtModelMergerCell.h:185
std::array< DtModelMergerCell *, 4 > mySubCells
Definition: DtModelMergerCell.h:183
Struct for info about the myModelsGroupNode that is written to disk. The myModelsGroupNode contains t...
Definition: DtModelMergerCell.h:32
osg::Vec2 myCellSizeInMetres
Definition: DtModelMergerCell.h:191
DtCoordinateSystem & myCoordinateSystem
Definition: DtModelMergerCell.h:186
int myLod
Definition: DtModelMergerCell.h:175
std::unordered_map< std::string, GroupedModelInfo > * myGroupedModelToInfoMap
Definition: DtModelMergerCell.h:206

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)