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) 2024 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  class treemodel
119  {
120  public:
121  treemodel(const std::string& name, double width, double height, double sim_trunk_height,
122  double sim_trunk_width, double sim_crown_offset, double sim_crown_height, double sim_crown_width, osg::ref_ptr<osg::Geode> geode) :
123  myName(name),
124  myWidth(width),
125  myHeight(height),
126  myTrunkHeight(sim_trunk_height),
127  myTrunkWidth(sim_trunk_width),
128  myCrownOffset(sim_crown_offset),
129  myCrownHeight(sim_crown_height),
130  myCrownWidth(sim_crown_width),
131  myGeode(geode)
132  {
133  }
134 
135  treemodel(const treemodel& tree) :
136  myName(tree.myName),
137  myWidth(tree.myWidth),
138  myHeight(tree.myHeight),
139  myTrunkHeight(tree.myTrunkHeight),
140  myTrunkWidth(tree.myTrunkWidth),
141  myCrownOffset(tree.myCrownOffset),
142  myCrownHeight(tree.myCrownHeight),
143  myCrownWidth(tree.myCrownWidth),
144  myGeode(tree.myGeode)
145  {
146  }
147 
148  std::string myName;
149  double myWidth;
150  double myHeight;
152  double myTrunkWidth;
155  double myCrownWidth;
157  };
158 
159  typedef std::map<std::string, treemodel> DtTreeMap;
165  typedef std::map<std::string, bool> DtTreeErrorMap;
167 
169  std::set<std::string> myErrorMessages;
170 
172  osgEarth::Procedural::VegetationFeatureGenerator myFeatureGenerator;
173 
176 
179 
182  std::string mySimVegetationFile;
183 };
double myHeight
Definition: osgEarthVegetationLayerSourcePager.h:150
std::set< std::string > myErrorMessages
list of error messages
Definition: osgEarthVegetationLayerSourcePager.h:169
DtTreeErrorMap myErrorMap
Definition: osgEarthVegetationLayerSourcePager.h:166
double myCrownOffset
Definition: osgEarthVegetationLayerSourcePager.h:153
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:135
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:118
virtual DtString type() const =0
virtual DtTerrainSourceTracker * createTerrainSourceTracker(DtVantageTerrainEngine *)=0
Creates and returns a DtTerrainSourceTracker.
double myWidth
Definition: osgEarthVegetationLayerSourcePager.h:149
double myCrownWidth
Definition: osgEarthVegetationLayerSourcePager.h:155
osg::ref_ptr< osg::Geode > myGeode
Definition: osgEarthVegetationLayerSourcePager.h:156
double myCrownHeight
Definition: osgEarthVegetationLayerSourcePager.h:154
DtTreeMap myTreeMap
Tree Map.
Definition: osgEarthVegetationLayerSourcePager.h:161
std::map< std::string, bool > DtTreeErrorMap
Keep track of the model name that don&#39;t have a config.
Definition: osgEarthVegetationLayerSourcePager.h:165
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:148
double myTrunkHeight
Definition: osgEarthVegetationLayerSourcePager.h:151
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:121
DtOsgEarthVegetationLayerSourcePager is a derived terrainSourcePager that handles a streaming terrain...
Definition: osgEarthVegetationLayerSourcePager.h:27
double myTrunkWidth
Definition: osgEarthVegetationLayerSourcePager.h:152
std::string myVegetationLayerGroupName
vegetation layer group (1 group by pager/tracker since they don&#39;t have the same lod) ...
Definition: osgEarthVegetationLayerSourcePager.h:178
osgEarth::Procedural::VegetationFeatureGenerator myFeatureGenerator
Used to extract procedural trees/shrub/ect.
Definition: osgEarthVegetationLayerSourcePager.h:172
#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:175
std::map< std::string, treemodel > DtTreeMap
Definition: osgEarthVegetationLayerSourcePager.h:159
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
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:163
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:182

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)