![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2008 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtVrlinkConnection.h,v $ $Revision: 1.37 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #pragma once 00014 00015 #include <vrvCore/DtDriver.h> 00016 #include <vrvVrl/DtConnection.h> 00017 00018 #include <vl/entityPub.h> 00019 #include <vrvUtil/DtSignalConnectionManager.h> 00020 00021 #include <boost/unordered_map.hpp> 00022 00023 class DtExerciseConnInitializer; 00024 class DtExerciseConn; 00025 class DtStealthControlPdu; 00026 00027 #ifndef DT_PROTOCOL_NAMESPACE 00028 #error Namespace Protocol Macro DT_PROTOCOL_NAMESPACE not defined. 00029 #endif 00030 00031 #if DtHLA 00032 #include <vl/geodeticRegion.h> 00033 #endif 00034 00035 namespace makVrv 00036 { 00037 namespace DT_PROTOCOL_NAMESPACE 00038 { 00039 class DtEntityStateInterceptorCreator; 00040 00043 class DL_DLL_IGCONVRLINK DtVrlinkConnection : public DtConnection 00044 { 00045 public: 00046 00048 DtVrlinkConnection(DtAgentManagerInterface& aSceneInterface, 00049 const DtCoordinateSystem& coordSystem, 00050 const DtEntityAppearanceMapperFactoryCreator& appFactoryCreator, 00051 DtSharedSettingsManager& settingsManager); 00052 00054 virtual ~DtVrlinkConnection(); 00055 00057 virtual void setExerciseConnInit(const DtExerciseConnInitializer& exConnInitializer); 00058 00063 virtual bool connect(); 00064 00066 virtual bool connected() const; 00067 00072 virtual bool disconnect(); 00073 00075 virtual void tick(); 00076 00078 virtual void setViewControlChanged( bool enabled ); 00079 00081 virtual void observerUpdated(const std::string& name, 00082 double x, double y, double z, 00083 double psi, double theta, double phi); 00084 00085 virtual void observerUpdated(const std::string& observerName, 00086 double x, double y, double z, 00087 double psi, double theta, double phi, 00088 double dx, double dy, double dz, 00089 double dpsi, double dtheta, double dphi); 00090 00092 virtual void stopPublishingObserver(const std::string& observerName); 00093 00095 virtual void startPublishingObserver(const std::string& observerName); 00096 00098 virtual void attachObserverObject(const std::string& observerName, DtUniqueID id); 00099 00101 virtual void detachObjects(const std::string& observerName); 00102 00104 inline DtExerciseConn* exerciseConn() 00105 { 00106 return myExerciseConnection; 00107 } 00108 00110 virtual const std::string& tag() 00111 { 00112 #ifdef DtDIS 00113 const static std::string str("DIS"); 00114 #elif DtHLA_1516_EVOLVED 00115 const static std::string str("HLA1516e"); 00116 #elif DtHLA_1516 00117 const static std::string str("HLA1516"); 00118 #elif DtHLA 00119 const static std::string str("HLA13"); 00120 #else 00121 const static std::string str(""); 00122 #endif 00123 return str; 00124 } 00125 00126 00127 #if DtHLA 00128 inline const DtDDMRegionSet& regions() const 00129 { 00130 return myRegions; 00131 } 00132 00133 virtual void addDdmRegionForObserver(const std::string& observerName); 00134 00135 virtual void removeDdmRegionForObserver(const std::string& observerName); 00136 00138 virtual void setDdmRegionSize(int sizeInMeters); 00139 00140 virtual void setRegionUpdateThreshold(int percentage); 00141 00142 virtual void setUseAltitudeThreshold(bool yesNo); 00143 00144 virtual void setAltitudeThreshold(int meters); 00145 00146 virtual void updateDdmRegion(const std::string& observerName, 00147 const DtVector& observerLocation); 00148 00149 virtual void setRegionOutOfBounds(DtDDMRegionSP region); 00150 00151 boost::signal<void (DtDDMRegionSP)> signal_regionAdded; 00152 boost::signal<void (DtDDMRegionSP)> signal_regionToBeRemoved; 00153 00154 #endif 00155 00156 #if DtDIS 00157 //Check to see if entity is published by this simulation. 00158 bool entityIsPublished(const DtEntityIdentifier& id) const; 00159 #endif 00160 00163 void setSupportsDelayedVisualizerCreation(bool); 00164 bool supportsDelayedVisualizerCreation() const; 00165 00166 // Signal sent before the tick starts 00167 boost::signal<void ()> signal_preTick; 00168 00169 // Signal sent after the tick has been completed 00170 boost::signal<void ()> signal_postTick; 00171 00172 protected: 00173 00175 void addObserverPublisher(const std::string& observerName); 00176 00177 protected: 00178 00179 typedef boost::unordered_map<std::string, DtEntityPublisher*> 00180 ObserverPublisherMap; 00181 00182 00183 00184 //Exercise Connection settings. 00185 DtExerciseConnInitializer* myExConnInitializer; 00186 00188 00189 //Active connection 00190 DtExerciseConn* myExerciseConnection; 00191 00192 #if DtHLA 00193 bool initializeDdm(); 00194 00195 DtDDMRegionSet myRegions; 00196 00197 struct RegionInfo 00198 { 00199 DtGeodeticRegionSP region; 00200 DtVector geocentricLocation; 00201 bool outOfBounds; 00202 }; 00203 00204 typedef boost::unordered_map<std::string, RegionInfo> ObserverRegions; 00205 ObserverRegions myObserverRegions; 00206 int myRegionUpdateThreshold; 00207 int myDdmRegionSize; 00208 bool myUseAltitudeThreshold; 00209 double myAltitudeThreshold; 00210 #endif 00211 00212 00213 //Publishers for observers 00214 ObserverPublisherMap myObserverPublishers; 00215 bool myViewControlsEnabled; 00216 DtSignalConnectionManager myConnections; 00217 00218 bool mySupportsDelayedVisualizerCreation; 00219 }; 00220 } 00221 }