VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
osgEarthVegetationLayerSourcePager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2026 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
12 
13 #include <osgEarthProcedural/VegetationLayer>
14 #include <osgEarthProcedural/VegetationFeatureGenerator>
15 
16 #include <tbb/spin_rw_mutex.h>
17 #include <tbb/task_arena.h>
18 
19 #include <set>
20 #include <string>
21 #include <map>
22 
24 
29 {
30 public:
31 
33  DtOsgEarthVegetationLayerSourcePager(DtVantageTerrainEngine* terrainEngine, osgEarth::MapNode* mapNode);
34 
36  virtual ~DtOsgEarthVegetationLayerSourcePager() override;
37 
39  virtual bool init() override;
40 
43 
44  virtual DtString type() const override;
45 
47  virtual void setVegetationLayer(osg::ref_ptr<osgEarth::Procedural::VegetationLayer> veglayer);
48 
50  virtual void setVegetationLayerGroupName(const std::string& veglayerGroup);
51 
53  virtual void setSimVegetationConfigFile(const std::string& simVegetationFile);
54 
56  virtual unsigned int vegetationLayerGroupLod() const;
57 
59  virtual std::string vegetationLayerGroupName() const;
60 
61  /*
62 
66  unsigned reloadPagesWithinExtent(const osgEarth::GeoExtent & extent, bool isRemoval = false);
67 
68  virtual unsigned queuePageReloadsWithinExtent(const osgEarth::GeoExtent & extent, const DtUUID& dynamicUuid, bool isRemoval = false);
69  */
71  virtual osg::ref_ptr<osg::MatrixTransform> createTree(osgEarth::Procedural::VegetationLayer::Placement& treePlacement);
72 
73 protected:
74 
77  virtual void readXmlConfigFile();
78 
84  virtual bool reloadTile(const osgEarth::TileKey& tileKey, bool isRemoval = false, unsigned numEvents = 1) override;
85 
91  virtual std::shared_ptr<DtTileData> createTileDataFromVegetationLayer(
92  const osgEarth::TileKey& tilekey,
93  DtTerrainIntersectIDType intersectId,
94  bool createIfAlreadyLoaded = false) const;
95 
97  virtual bool pageInTile(const osgEarth::TileKey& tileKey, DtTerrainIntersectIDType intersectId = 0) override;
98 
100  virtual bool pageOutTile(const osgEarth::TileKey& tileKey) override;
101 
112  virtual void addTile(const osgEarth::TileKey& tilekey, const std::shared_ptr<DtTileData>& tile) override;
113 
116  //virtual void addEmptyTile(const osgEarth::TileKey& tilekey, DtTerrainIntersectIDType intersectId = 0);
117 
118  public:
120  {
121  public:
122  treemodel(const std::string& name, double width, double height, double sim_trunk_height,
123  double sim_trunk_width, double sim_crown_offset, double sim_crown_height, double sim_crown_width, osg::ref_ptr<osg::Geode> geode) :
124  myName(name),
125  myWidth(width),
126  myHeight(height),
127  myTrunkHeight(sim_trunk_height),
128  myTrunkWidth(sim_trunk_width),
129  myCrownOffset(sim_crown_offset),
130  myCrownHeight(sim_crown_height),
131  myCrownWidth(sim_crown_width),
132  myGeode(geode)
133  {
134  }
135 
136  treemodel(const treemodel& tree) :
137  myName(tree.myName),
138  myWidth(tree.myWidth),
139  myHeight(tree.myHeight),
140  myTrunkHeight(tree.myTrunkHeight),
141  myTrunkWidth(tree.myTrunkWidth),
142  myCrownOffset(tree.myCrownOffset),
143  myCrownHeight(tree.myCrownHeight),
144  myCrownWidth(tree.myCrownWidth),
145  myGeode(tree.myGeode)
146  {
147  }
148 
149  std::string myName;
150  double myWidth;
151  double myHeight;
153  double myTrunkWidth;
156  double myCrownWidth;
158  };
159 
160  typedef std::map<std::string, treemodel> DtTreeMap;
161 
162  protected:
163 
169  typedef std::map<std::string, bool> DtTreeErrorMap;
171 
173  tbb::spin_mutex myErrorMapMutex;
174 
176  std::set<std::string> myErrorMessages;
177 
179  osgEarth::Procedural::VegetationFeatureGenerator myFeatureGenerator;
180 
183 
186 
189  std::string mySimVegetationFile;
190 };
double myHeight
Definition: osgEarthVegetationLayerSourcePager.h:151
std::set< std::string > myErrorMessages
list of error messages
Definition: osgEarthVegetationLayerSourcePager.h:176
DtTreeErrorMap myErrorMap
Definition: osgEarthVegetationLayerSourcePager.h:170
double myCrownOffset
Definition: osgEarthVegetationLayerSourcePager.h:154
virtual bool pageInTile(const osgEarth::TileKey &tileKey, DtTerrainIntersectIDType intersectId=0)=0
Load a ground cover terrain patch in memory.
treemodel(const treemodel &tree)
Definition: osgEarthVegetationLayerSourcePager.h:136
unsigned long long DtTerrainIntersectIDType
Definition: terrainInterfaceDefines.h:28
Used when a tile cannot be created by osgEarth&#39;s tileBuilder. Creates a Terrain Tile with all heights...
Definition: osgEarthVegetationLayerSourcePager.h:119
virtual DtString type() const =0
virtual DtTerrainSourceTracker * createTerrainSourceTracker(DtVantageTerrainEngine *)=0
Creates and returns a DtTerrainSourceTracker.
double myWidth
Definition: osgEarthVegetationLayerSourcePager.h:150
double myCrownWidth
Definition: osgEarthVegetationLayerSourcePager.h:156
osg::ref_ptr< osg::Geode > myGeode
Definition: osgEarthVegetationLayerSourcePager.h:157
double myCrownHeight
Definition: osgEarthVegetationLayerSourcePager.h:155
DtTreeMap myTreeMap
Tree Map.
Definition: osgEarthVegetationLayerSourcePager.h:165
std::map< std::string, bool > DtTreeErrorMap
Keep track of the model name that don&#39;t have a config.
Definition: osgEarthVegetationLayerSourcePager.h:169
Base class for Terrain Source trackers. Determines if the necessary data To perform an intersection i...
Definition: terrainSourceTracker.h:75
std::string myName
Definition: osgEarthVegetationLayerSourcePager.h:149
double myTrunkHeight
Definition: osgEarthVegetationLayerSourcePager.h:152
DtOsgEarthBaseGroundCoverSourcePager is a derived terrainSourcePager and based class for common code ...
Definition: osgEarthBaseGroundCoverSourcePager.h:29
treemodel(const std::string &name, double width, double height, double sim_trunk_height, double sim_trunk_width, double sim_crown_offset, double sim_crown_height, double sim_crown_width, osg::ref_ptr< osg::Geode > geode)
Definition: osgEarthVegetationLayerSourcePager.h:122
DtOsgEarthVegetationLayerSourcePager is a derived terrainSourcePager that handles a streaming terrain...
Definition: osgEarthVegetationLayerSourcePager.h:27
double myTrunkWidth
Definition: osgEarthVegetationLayerSourcePager.h:153
std::string myVegetationLayerGroupName
vegetation layer group (1 group by pager/tracker since they don&#39;t have the same lod) ...
Definition: osgEarthVegetationLayerSourcePager.h:185
osgEarth::Procedural::VegetationFeatureGenerator myFeatureGenerator
Used to extract procedural trees/shrub/ect.
Definition: osgEarthVegetationLayerSourcePager.h:179
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
virtual void addTile(const osgEarth::TileKey &tilekey, const std::shared_ptr< DtTileData > &tile)=0
Adds a configured tile data object to the terrain.
osg::ref_ptr< osgEarth::Procedural::VegetationLayer > myVegLayer
vegetation layer of the pager
Definition: osgEarthVegetationLayerSourcePager.h:182
std::map< std::string, treemodel > DtTreeMap
Definition: osgEarthVegetationLayerSourcePager.h:160
This class wraps the VR-Vantage Display Engine, and uses as a terrain loader and intersector. This is the terrain engine that powers the DtVantageTerrainImplementation. The DtVantageTerrainEngine runs the DtDe it its own thread, and processes commands thought the command queue.
Definition: vantageTerrainEngine.h:112
Definition: osgEarthVegetationLayerSourceTracker.h:25
tbb::spin_mutex myErrorMapMutex
Mutex for keeping consistency of myErrorMap.
Definition: osgEarthVegetationLayerSourcePager.h:173
virtual bool init() override=0
Called after pager is configured.
virtual bool pageOutTile(const osgEarth::TileKey &tileKey)=0
Unload a ground cover terrain patch.
DtTreeMap myVegetationConfigMap
Config from \17\latest\TerrainData\TerrainConfiguration\osgEarthCatalogs\simVegetation.xml.
Definition: osgEarthVegetationLayerSourcePager.h:167
virtual bool reloadTile(const osgEarth::TileKey &tileKey, bool isRemoval=false, unsigned numEvents=1)=0
Reloads a tile and keeps track of cratering events that affect the tile.
std::string mySimVegetationFile
vegetation xml config file that contain the sim boxes geometries Should be ...xml ...
Definition: osgEarthVegetationLayerSourcePager.h:189

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)