VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtStreamedSpeedTreeForest.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2026 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/DtUniqueID.h>
13 #include <vrvCore/DtTreeRecord.h>
14 
15 #include <vrvSt/vrvSt.h>
16 
19 
20 #include <map>
21 #include <set>
22 #include <unordered_map>
23 
24 #include <tbb/mutex.h>
25 
26 namespace osg
27 {
28  class Node;
29  class Observer;
30 }
31 
32 namespace osgEarth
33 {
34  class Map;
35  class MapNode;
36  class Layer;
37  class VisibleLayer;
38 }
39 
40 namespace osgEarth
41 {
42  class CustomFeatureNode;
43 }
44 
45 namespace makVrv
46 {
47  class DtDe;
48  class DtSpeedTreeForest;
49  class DtOsgTerrainPatchObject;
50  class CellNodeObserver;
51 
54 
57 
59  template <>
60  inline const char* creatorTypeName<DtStreamedSpeedTreeForest>() { return "DtStreamedSpeedTreeForestCreator"; }
61 
66  {
68 
69  public:
70 
72  virtual ~DtStreamedSpeedTreeForest();
73 
75  DtStreamedSpeedTreeForest() = delete;
76 
79 
81  DtStreamedSpeedTreeForest& operator=(const DtStreamedSpeedTreeForest& other) = delete;
82 
83  protected:
84 
87 
88  public:
89 
93  virtual void onDataLoaded(const DtOsgTerrainPatchObject& patch,
94  const osgEarth::Layer* layer, const osg::Node* data);
95 
98  virtual void onDataUnLoaded(const osgEarth::Layer* layer, const osg::Node* data);
99 
102  virtual void onLayerVisibilityChanged(const osgEarth::VisibleLayer* layer);
103 
107  virtual bool removeForestFromMapData(const osg::Node* dataNode);
108 
112  virtual void addTreesAndMapToCell(const osg::Node* dataNode, DtVectorTreeRecords& treeRecords);
113 
118  virtual void addTreesAndProcessUninitialized(const osg::Node* dataNode,
119  std::unordered_map<std::string, std::vector<DtTreeRecord*>>& modelDefsToTrees);
120 
121  protected:
122 
125  virtual void processNewFeatures(const DtOsgTerrainPatchObject& patch, const osg::Node* data);
126 
128  virtual void processNewFeature(const DtOsgTerrainPatchObject& patch,
129  const osgEarth::CustomFeatureNode* featureNode, const osg::Node* data);
130 
132  virtual bool observerExists(const osg::Node* data) const;
133 
135  virtual void createObserver(const osgEarth::Layer* layer, const osg::Node* data);
136 
139  virtual void destroyObserver(const osg::Node* data);
140 
142  virtual void removeAndDestroyAllObservers();
143 
146  virtual void mapDataToCell(const osg::Node* dataNode, DtUniqueID cellID);
147 
148  protected:
149 
152  static bool verifyExists(const osg::Observer* lhs, const osg::Node* data);
153 
154  typedef std::map<std::string, std::pair<std::string, bool>> MarkerToModelDefinition;
155 
159  static bool getValidTreeModelDefinition(DtDe& de, std::string& strCleanModelName,
160  const std::string& strModelName, MarkerToModelDefinition& cache);
161 
162  protected:
163 
165 
167 
168  typedef std::unordered_map<const osg::Node*, CellNodeObserver*> MapCellsToObservers;
170 
171  typedef std::set<DtUniqueID> IdSet;
172  typedef std::unordered_map<const osg::Node*, IdSet> MapCellsToSubCells;
175 
176  std::thread::id myOwningThreadId;
177  };
178 }
DtSpeedTreeForest * myForest
Definition: DtStreamedSpeedTreeForest.h:166
std::map< std::string, std::pair< std::string, bool > > MarkerToModelDefinition
Definition: DtStreamedSpeedTreeForest.h:154
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
DtDe & myDe
Definition: DtStreamedSpeedTreeForest.h:164
DtStreamedSpeedTreeForest manages the streaming management for the DtSpeedTreeForest that it contains...
Definition: DtStreamedSpeedTreeForest.h:65
#define DT_DLL_VRVST
Definition: vrvSt.h:20
const char * creatorTypeName< DtStreamedSpeedTreeForest >()
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtStreamedSpeedTreeForest.h:60
Contains DLL export macros.
std::vector< DtTreeRecord * > DtVectorTreeRecords
Definition: DtTreeRecord.h:139
tbb::mutex myMapCellsToSubCellsMutex
Definition: DtStreamedSpeedTreeForest.h:174
DtVirtualBaseClassCreator< DtStreamedSpeedTreeForest, DtUniqueID > DtStreamedSpeedTreeForestCreator
creator
Definition: DtStreamedSpeedTreeForest.h:53
std::unordered_map< const osg::Node *, CellNodeObserver * > MapCellsToObservers
Definition: DtStreamedSpeedTreeForest.h:168
MapCellsToSubCells myMapCellsToSubCells
Definition: DtStreamedSpeedTreeForest.h:173
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
Contains makVrv::DtVirtualBaseClass class.
DtSpeedTreeForest is the SpeedTree implementation of a distributed DtForestObject.
Definition: DtSpeedTreeForest.h:50
Custom Feature Node.
Definition: CustomFeatureNode.h:43
std::thread::id myOwningThreadId
Definition: DtStreamedSpeedTreeForest.h:176
A DtOsgTerrainPatchObject contains the methods for loading a file as a terrain. When loading a file a...
Definition: DtOsgTerrainPatchObject.h:54
std::set< DtUniqueID > IdSet
Definition: DtStreamedSpeedTreeForest.h:171
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
MapCellsToObservers myMapCellsToObservers
Definition: DtStreamedSpeedTreeForest.h:169
friend DtStreamedSpeedTreeForestCreator
Definition: DtStreamedSpeedTreeForest.h:67
Contains makVrv::DtUniqueID type.
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
Contains makVrv::DtTreeRecord class.
std::unordered_map< const osg::Node *, IdSet > MapCellsToSubCells
Definition: DtStreamedSpeedTreeForest.h:172

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)