VR-Vantage API Documentation
DtVrlinkConnection.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/DtDriver.h>
13 #include <vrvVrl/DtConnection.h>
14 
15 #include <vl/entityPub.h>
17 
18 #include <boost/unordered_map.hpp>
19 
20 class DtExerciseConnInitializer;
21 class DtExerciseConn;
23 
24 #ifndef DT_PROTOCOL_NAMESPACE
25 #error Namespace Protocol Macro DT_PROTOCOL_NAMESPACE not defined.
26 #endif
27 
28 #if DtHLA
29 #include <vl/geodeticRegion.h>
30 #endif
31 
32 namespace makVrv
33 {
34  namespace DT_PROTOCOL_NAMESPACE
35  {
37 
41  {
42  public:
43 
46  const DtCoordinateSystem& coordSystem,
47  const DtEntityAppearanceMapperFactoryCreator& appFactoryCreator,
48  DtSharedSettingsManager& settingsManager);
49 
51  virtual ~DtVrlinkConnection();
52 
54  virtual void setExerciseConnInit(const DtExerciseConnInitializer& exConnInitializer);
55 
60  virtual bool connect();
61 
63  virtual bool connected() const;
64 
69  virtual bool disconnect();
70 
72  virtual void tick();
73 
75  virtual void setViewControlChanged( bool enabled );
76 
78  virtual void observerUpdated(const std::string& name,
79  double x, double y, double z,
80  double psi, double theta, double phi);
81 
82  virtual void observerUpdated(const std::string& observerName,
83  double x, double y, double z,
84  double psi, double theta, double phi,
85  double dx, double dy, double dz,
86  double dpsi, double dtheta, double dphi);
87 
89  virtual void stopPublishingObserver(const std::string& observerName);
90 
92  virtual void startPublishingObserver(const std::string& observerName);
93 
95  virtual void attachObserverObject(const std::string& observerName, DtUniqueID id);
96 
98  virtual void detachObjects(const std::string& observerName);
99 
101  inline DtExerciseConn* exerciseConn()
102  {
103  return myExerciseConnection;
104  }
105 
107  virtual const std::string& tag()
108  {
109 #ifdef DtDIS
110  const static std::string str("DIS");
111 #elif DtHLA_1516_EVOLVED
112  const static std::string str("HLA1516e");
113 #elif DtHLA_1516
114  const static std::string str("HLA1516");
115 #elif DtHLA
116  const static std::string str("HLA13");
117 #else
118  const static std::string str("");
119 #endif
120  return str;
121  }
122 
123 
124 #if DtHLA
125  inline const DtDDMRegionSet& regions() const
126  {
127  return myRegions;
128  }
129 
130  virtual void addDdmRegionForObserver(const std::string& observerName);
131 
132  virtual void removeDdmRegionForObserver(const std::string& observerName);
133 
135  virtual void setDdmRegionSize(int sizeInMeters);
136 
137  virtual void setRegionUpdateThreshold(int percentage);
138 
139  virtual void setUseAltitudeThreshold(bool yesNo);
140 
141  virtual void setAltitudeThreshold(int meters);
142 
143  virtual void updateDdmRegion(const std::string& observerName,
144  const DtVector& observerLocation);
145 
146  virtual void setRegionOutOfBounds(DtDDMRegionSP region);
147 
148  boost::signal<void (DtDDMRegionSP)> signal_regionAdded;
149  boost::signal<void (DtDDMRegionSP)> signal_regionToBeRemoved;
150 
151 #endif
152 
153 #if DtDIS
154  //Check to see if entity is published by this simulation.
155  bool entityIsPublished(const DtEntityIdentifier& id) const;
156 
158  virtual bool timeoutProcessing() const;
159 
161  virtual void setTimeoutProcessing(bool enabled);
162 
164  virtual double timeoutInterval() const;
165 
167  virtual void setTimeoutInterval(double interval);
168 #endif
169 
172  void setSupportsDelayedVisualizerCreation(bool);
173  bool supportsDelayedVisualizerCreation() const;
174 
175  // Signal sent before the tick starts
176  boost::signal<void ()> signal_preTick;
177 
178  // Signal sent after the tick has been completed
179  boost::signal<void ()> signal_postTick;
180 
181  protected:
182 
184  void addObserverPublisher(const std::string& observerName);
185 
186  protected:
187 
188  typedef boost::unordered_map<std::string, DtEntityPublisher*>
190 
191  //Exercise Connection settings.
192  DtExerciseConnInitializer* myExConnInitializer;
193 
195 
196  //Active connection
197  DtExerciseConn* myExerciseConnection;
198 
199 #if DtHLA
200  bool initializeDdm();
201 
202  DtDDMRegionSet myRegions;
203 
204  struct RegionInfo
205  {
206  DtGeodeticRegionSP region;
209  };
210 
211  typedef boost::unordered_map<std::string, RegionInfo> ObserverRegions;
217 #endif
218 
219 #if DtDIS
220  bool myTimeoutProcessing;
221  double myTimeoutInterval;
222 #endif
223 
224 
225  //Publishers for observers
229 
231  };
232  }
233 }


Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)