VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtVrlinkDriver.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvVrl/vrvVrl.h>
13 #include <vrvCore/DtDriver.h>
17 #include <vlutil/vlThread.h>
18 
19 #include <vlutil/vlRunnable.h>
20 
21 #include <boost/function.hpp>
22 #include <vrvUtil/signalslib.h>
23 
24 class DtThread;
25 class DtEntityType;
26 
27 namespace makVrv
28 {
29  class DtAsynchronousEventQueue;
30  class DtAsynchronousAgentManager;
31  class DtConnection;
32  class DtEntityTypeMapper;
33  class DtObserver;
34  class DtSelectionManager;
35  class DtMouseState;
36  class DtColorValue;
37 
41  protected DtRunnable
42  {
43  public:
44 
46  DtVrlinkDriver(DtAgentManager& agentManager,
47  const std::string& uniqueName, const std::string& className);
48 
50  virtual ~DtVrlinkDriver();
51 
53  virtual const std::string& className() const;
54 
56  virtual bool observersPublished() const;
57 
59  virtual void setObserversPublished(bool isPublished);
60 
63  virtual bool overrideGlobalViewControl() const;
64 
67  virtual void setOverrideGlobalViewControl(bool enabled);
68 
72  virtual bool viewControlEnabled() const;
73 
76  virtual void setLocalViewControlEnabled(bool enabled);
77 
80  virtual bool localViewControlEnabled() const;
81 
84  virtual void setConnectionFrameTime( double frameTime );
85 
88  virtual double connectionFrameTime() const;
89 
96  void setUseTopoForFlatEarthVectorConversion( bool flag );
97  bool useTopoForFlatEarthVectorConversion() const;
98 
100  virtual void queueDriverFunction(const boost::function<void ()>& function);
101 
103  virtual void queueConnectionFunction(const boost::function<void ()>& function);
104 
106  bool useThreadFlag() const
107  {
108  return myUseThreadFlag;
109  }
110 
112  {
113  return myConnection;
114  }
115 
117  boost::signalslib::signal<void (DtConnection*)> signal_connectionCreated;
118 
120  boost::signalslib::signal<void (DtConnection*)> signal_connectionAboutToBeDestroyed;
121 
122  protected:
123 
125  virtual DtConnection* createConnection() = 0;
126 
129  virtual bool onStart();
130 
133  virtual bool onStop();
134 
136  virtual void run();
137 
139  void startPublishingObservers();
140 
142  void stopPublishingObservers();
143 
146  virtual bool onTick();
147 
150  void startThread();
151 
154  void stopThread();
155 
157  void setConnectionState( bool state );
158 
160  virtual void slot_displayEngineAdded( const DtDeRecord& igRecord );
161 
163  virtual void slot_globalViewControlEnabledSet( bool );
164 
166 
168  virtual void connectToDynamicSignals();
169 
172  virtual void disconnectFromDynamicSignals();
173 
174  virtual void slot_onViewChanged(
176 
177  virtual void slot_onCurrentSelectionChanged(
178  const DtSelectionManager::IdSet& selected,
179  const DtSelectionManager::IdSet& deselected);
180 
181  virtual void slot_onElementHasHoveredWidget(
182  const DtElementID& sceneObjectId,
183  bool isHovered);
184 
185  virtual void slot_onVertexSelected( const DtUniqueID& selected,
186  const DtUniqueID& parentOfSelected);
187 
188  virtual void slot_onVertexDeselected( const DtUniqueID& deselected,
189  const DtUniqueID& parentOfDeselected);
190 
200  virtual void slot_infoLabelsArePinned(
201  const DtSelectionManager::IdSet& elementIds, bool arePinned);
202 
204  virtual void slot_entityTrackHistoryColorOverride(
205  const DtElementID& entityId, const DtColorValue& color, bool overrideColor);
206 
208  virtual void slot_onCoordinateSystemChanged(
209  const std::string& coordinateSystem,
210  const std::string& coordinateParameters );
211 
213  virtual void toggleEntitySelected(const DtUniqueID& id);
214 
215  virtual void performObserverAction(
217 
219 
220  virtual void slot_onObserverDestroyed(DtObserver* observer);
221 
222  virtual void slot_onObserverCreated(DtObserver* observer);
223 
225  virtual void startPublishingObserver( DtObserver* observer );
226 
228  virtual void stopPublishingObserver( DtObserver* observer );
229 
231  virtual void updateObservers();
232 
235  virtual void slot_pause();
236 
239  virtual void slot_resume();
240 
242  typedef std::vector<boost::function<void ()> > FunctionCallList;
243 
244  enum FunctionType {Create, Update, Destroy};
245 
247  virtual void runFunctionQueue(FunctionCallQueue& queue);
248 
249  protected:
250 
251  //Main thread variables.
252  std::string myClassName;
253 
255  //Cross thread variables. They are used between the two threads for
256  //communication.
258  DtThreadStartSP myStart;
259  DtThread* myThread;
260 
265 
269 
271 
274  double myLastSimTime; // only used when single threaded
281 
283 
284  };
285 }
The base class for protocol specific VRLink Simulations.
Definition: DtConnection.h:43
boost::function< void(DtObserver &)> ObserverAction
Definition: DtViewStateProcessor.h:29
#define DT_DLL_VRVVRL
Definition: vrvVrl.h:19
An asynchronous interface to the scene manager.
Definition: DtAsynchronousAgentManager.h:24
The master window of the scene.
Definition: DtSelectionManager.h:28
A Record of an IG instance.
Definition: DtDeRecord.h:24
Contains makVrv:DtSelectionManager class.
Contains makVrv::DtLockedBufferedQueue class.
A locked buffered queue which allows multiple writers and a single reader. Internally the queue is st...
Definition: DtLockedBufferedQueue.h:24
A facade for a DtObserverObject.
Definition: DtObserver.h:37
The DtDriver is an abstract class. Developers derive from this to create logic that &quot;directs&quot; things ...
Definition: DtDriver.h:31
The asynchronous event queue. To create an asynchronous event queue the the makVrv::DtMainEventQueue ...
Definition: DtAsynchronousEventQueue.h:24
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
The DtAgentManager manages the distributed scene object framework. This includes the objects and upda...
Definition: DtAgentManager.h:38
Contains makVrv:DtDriver class.
Contains DLL export macros.
std::set< DtUniqueID > IdSet
Definition: DtSelectionManager.h:32
Template for Color values in [0,1] range.
Definition: DtColorValue.h:20

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)