VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
environmentConditionRemoteNetInterface.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
18 #include <vlpi/metocEnums.h>
19 #include <tbb/spin_mutex.h>
20 
21 //#include <vl/reflectedWeatherHLA.h>
22 
27 class DtEnvironmentConditionStateRepository;
28 
29 namespace makVrf
30 {
31 
32  class DtTroposphereStateComponent;
33  class DtSubsurfaceStateComponent;
34  class DtLandSurfaceStateComponent;
35  class DtWaterSurfaceStateComponent;
36  class DtSubsurfaceStateComponent;
37 
39  {
50  };
52  {
53 
54  private:
56 
62  public:
63 
66  DtStateData* vrfObject, DtVrlinkNetworkInterface*, bool publishObject = true);
67 
70 
71 
72  virtual void onTick() override;
73 
74 
75 #if DtHLA
76  virtual RTI::ObjectClassHandle objectClassHandle() const override;
77 
78 #endif
79 
80  virtual DtString type() const override;
81 
82  static DtSimObjectNetInterface* creator(
83  DtStateData* vrfObject, DtVrlinkNetworkInterface*, bool publishObject);
84 
85  template<typename T, typename V>
86  void setReflectedObject(T* ro)
87  {
88  if (myObject != ro)
89  {
91  removeBaseUpdateCallback();
92  myObject = ro;
93  setEnvironmentConditionTypeFromObject(ro);
94  //setup
95  myObject->baseAddPostUpdateCallback(reflectedObjectUpdateCallbackFunction, this);
96  setUpdateReceived(true);
97  setupFromNetworkRepository<V>();
98 
99  }
100  };
101 
102  virtual void clearReflectedObject(bool shouldRemoveStateComponent = true);
103  static void reflectedObjectUpdateCallbackFunction(DtReflectedObject* obj, void* userData);
104 
105  protected:
106  template<typename T>
108  {
109  return nextFrameVrfObject()->nextFrameState()->getStateComponent<T>();
110  };
111 
112  template<typename T>
114  {
115  return nextFrameVrfObject()->hasStateComponent<T>();
116  };
117 
118  template<typename T>
120  {
121  return nextFrameVrfObject()->addStateComponent<T>();
122  };
123  template<typename T>
125  {
126  return !nextFrameVrfObject()->hasStateComponent<T>() ? createVrfStateComponent<T>() : getVrfStateComponent<T>();
127  };
128 
129  void removeStateComponent();
130 
131  template<typename T>
133  {
137  initializeRemoteStateComponents<T>();
138  updateFromReflectedObject();
139  };
140 
141  template<typename T>
143  {
144  switch (myEnvironmentConditionType)
145  {
150  getOrCreateVrfStateComponent<DtEnvironmentalLocationStateComponent>();
151  getOrCreateVrfStateComponent<DtVrfGeometryStateComponent>();
152  break;
153  }
154  myStateComponent = getOrCreateVrfStateComponent<T>();
155  };
156 
157  virtual void updateFromReflectedObject();
158  virtual int mapMetocCloudTypeToVrvCloudType(DtCloudTypeEnum32) const;
159  virtual int mapHazeTypeToObscurant(DtHazeTypeEnum32 type) const;
160  virtual DtVrfWeatherPrecipitationType mapMetocPrecipitationTypeToVrfPrecipitationType(DtPrecipitationTypeEnum32) const;
161  virtual makVrf::DtTroposphereStateComponent* updateTroposphere(const DtTroposphereLayerStateRepository* stateRep, bool shouldSetDefaultsForMakExtensions = true);
162  virtual void updateMAKTroposphere(const DtTroposphereLayerStateRepository* stateRep);
163  virtual void updateFromMetocGeoreference(const DtEnvironmentConditionStateRepository* stateRep);
164  virtual makVrf::DtSubsurfaceStateComponent* updateSubsurface(const DtSubsurfaceLayerStateRepository* stateRep, bool shouldSetDefaultsForMakExtensions = true);
165  virtual void updateMAKSubsurface(const DtSubsurfaceLayerStateRepository* stateRep);
166  virtual makVrf::DtLandSurfaceStateComponent* updateLandSurface(const DtLandSurfaceStateRepository* stateRep, bool shouldSetDefaultsForMakExtensions = true);
167  virtual void updateMAKLandSurface(const DtLandSurfaceStateRepository* stateRep);
168  virtual makVrf::DtWaterSurfaceStateComponent* updateWaterSurface(const DtWaterSurfaceStateRepository* stateRep, bool shouldSetDefaultsForMakExtensions=true);
169  virtual void updateMAKWaterSurface(const DtWaterSurfaceStateRepository* stateRep);
170  virtual void removeBaseUpdateCallback();
171  virtual DtReflectedObject* reflectedObject() const;
172 
173  virtual void setEnvironmentConditionType(DtEnvironmentConditionType type);
174  virtual DtEnvironmentConditionType environmentConditionType() const;
175 
176  virtual void setEnvironmentConditionTypeFromObject(DtReflectedObject* obj);
177  protected:
184  static std::unordered_map<std::string, DtEnvironmentConditionType> theHLAClassNameToEnvironmentConditionTypeMap;
185 
186  typedef std::map<DtVrlUuid, double> DtAltitudeByUuidMapType;
190 public:
191 
192  static const int DtGlobalWeatherPriority;
193  static const int DtDefaultWeatherPriority;
194 
196  };
197 
198 
199 
200 
201 }
DtVrfWeatherPrecipitationType
Definition: vrfWeatherStateEnums.h:13
Definition: environmentConditionRemoteNetInterface.h:41
Definition: environmentConditionRemoteNetInterface.h:44
DtFrameStateInterface * myStateComponent
Definition: environmentConditionRemoteNetInterface.h:183
Definition: environmentConditionRemoteNetInterface.h:47
static const int DtDefaultWeatherPriority
Definition: environmentConditionRemoteNetInterface.h:193
DtEnvironmentConditionType myEnvironmentConditionType
This is important since the interface is generic, but it can be instantiated by any environment condi...
Definition: environmentConditionRemoteNetInterface.h:182
Definition: environmentConditionRemoteNetInterface.h:49
Definition: environmentConditionRemoteNetInterface.h:40
Definition: environmentConditionRemoteNetInterface.h:48
Definition: simRemoteEnvironmentalNetInterface.h:38
DtEnvironmentConditionType
Definition: environmentConditionRemoteNetInterface.h:38
Definition: environmentConditionRemoteNetInterface.h:43
Definition: environmentConditionRemoteNetInterface.h:45
void setReflectedObject(T *ro)
Definition: environmentConditionRemoteNetInterface.h:86
1) Define the interface class that will be used to represent the next and current frames...
Definition: waterSurfaceStateComponent.h:76
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:339
Definition: environmentConditionRemoteNetInterface.h:51
Class Description: DtSimObjectNetInterface.
Definition: simObjectNetInterface.h:50
tbb::spin_mutex myTroposphereLayerAltitudeByUuidMapMutex
Definition: environmentConditionRemoteNetInterface.h:195
T * createVrfStateComponent()
Definition: environmentConditionRemoteNetInterface.h:119
1) Define the interface class that will be used to represent the next and current frames...
Definition: subsurfaceStateComponent.h:103
static const int DtGlobalWeatherPriority
Definition: environmentConditionRemoteNetInterface.h:192
DtReflectedObject * myObject
Note that this is a reflected object because this class, while weather, also covers subsurface layers...
Definition: environmentConditionRemoteNetInterface.h:180
std::map< DtVrlUuid, double > DtAltitudeByUuidMapType
Definition: environmentConditionRemoteNetInterface.h:186
Definition: subsurfaceStateComponent.h:20
1) Define the interface class that will be used to represent the next and current frames...
Definition: landSurfaceStateComponent.h:86
Definition: environmentConditionRemoteNetInterface.h:42
T * getOrCreateVrfStateComponent()
Definition: environmentConditionRemoteNetInterface.h:124
T * getVrfStateComponent()
Definition: environmentConditionRemoteNetInterface.h:107
static std::unordered_map< std::string, DtEnvironmentConditionType > theHLAClassNameToEnvironmentConditionTypeMap
Definition: environmentConditionRemoteNetInterface.h:184
DtAltitudeByUuidMapType myTroposphereLayerAltitudeByUuidMap
TODO consider replacing this with just &quot;myLastReceivedAltitude&quot; since this class is not shared betwee...
Definition: environmentConditionRemoteNetInterface.h:188
bool hasStateComponent()
Definition: environmentConditionRemoteNetInterface.h:113
void setupFromNetworkRepository()
initializes parts of the local repository from the network state rep. This needs to be done after the...
Definition: environmentConditionRemoteNetInterface.h:132
This is a simple base class that will be used to return a pointer to current or next frame state...
Definition: stateComponent.h:291
1) Define the interface class that will be used to represent the next and current frames...
Definition: troposphereStateComponent.h:46
DtVrfSubsurfaceLayer myLastSubsurfaceLayer
Definition: environmentConditionRemoteNetInterface.h:189
void initializeRemoteStateComponents()
Definition: environmentConditionRemoteNetInterface.h:142
Definition: environmentConditionRemoteNetInterface.h:46

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)