VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtInputDriver.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
12 #include <vrvCore/DtDriver.h>
16 
17 #include <string>
18 #include <vector>
19 
20 namespace makVrv
21 {
22  class DtAgentManager;
23  class DtChannel;
24  class DtChannelManager;
25  class DtDe;
26  class DtEventProcessorInterface;
27  class DtInputDriverConfiguration;
28  class DtKeyAndMouseEventListener;
29  class DtKeyMap;
30  class DtKeyMapManager;
31  class DtMouseEvent;
32  class DtPinchGesture;
33  class DtObserver;
34  class DtObserverController;
35  class DtChannelConfiguration;
36  class DtObserverAnimator;
37  class DtObserverViewsManager;
38  class DtMouseHideProcessor;
39 
44  {
45  public:
48  typedef std::list<DtEventProcessorInterface*> EventProcessorList;
49 
51  typedef std::map<std::string, makArchives::DtObserverStateRecord> ObserverStateMap;
52 
54  typedef std::map<std::string, DtObserverConfiguration> ObserverConfigurationMap;
55 
57  DtInputDriver(DtAgentManager& agentManager,
58  const std::string& instanceName);
59 
61  virtual ~DtInputDriver();
62 
64  virtual bool onStart();
65 
67  virtual bool onStop();
68 
70  virtual bool onTick();
71 
73  virtual const std::string& className() const;
74 
76  virtual bool processKeyEvent(const DtKeyEvent& keyEvent,
77  DtChannel* channel);
78 
80  virtual bool processMouseEvent(const DtMouseEvent& mouseEvent,
81  DtChannel* channel);
82 
83  virtual bool processPinchGesture(const DtPinchGesture& pinchGesture,
84  DtChannel* channel);
85 
87  // hides the mouse if it hasn't moved for some period of time
88  virtual void setMouseHideProccessorEnabled(bool enabled);
89 
91  virtual void hideMouse(DtChannel* channel, float mouseX, float mouseY);
92 
94  virtual bool isMouseHidden() const;
95 
97  virtual void showMouse(DtChannel* channel);
98 
100  virtual void centerMouse(DtChannel* channel);
101 
103  virtual void setMousePosition(DtChannel* channel, float x, float y);
104 
107  virtual void clearState();
108 
110  DtChannel* currentChannel() const;
118  virtual DtChannel* findCurrentChannel() const;
120 
123  virtual void addEventProcessorToFront(DtEventProcessorInterface* epi);
124 
129  virtual void addEventProcessorToBack(DtEventProcessorInterface* epi);
130 
134  virtual EventProcessorList& eventProcessorList();
135 
138  virtual DtEventProcessorInterface* findEventProcessor(
139  const std::string& className);
140 
145  virtual void removeEventProcessor(DtEventProcessorInterface* epi);
146 
148  bool saveKeyMapToFile(const DtKeyMap& keyMap, const std::string& filename) const;
149 
152  DtKeyMap* loadKeyMapFromFile(const std::string& filename, bool createBackup = false);
153 
155  //
158  void setKeyMap(const std::string& mapName);
159 
161  const std::string& keyMap() const;
162 
164  DtKeyMap* createKeyMap(const std::string& mapName);
165 
167  DtKeyMap* findKeyMap(const std::string& mapName);
168 
170  void addKeyBinding(DtKeyMap* map, DtKeyState::KeyType key,
171  const std::string& functionName,
173  bool replace = false,
175 
178  void addBinaryKeyBinding(DtKeyMap* map, DtKeyState::KeyType key,
179  const std::string& binaryName,
181  bool replace = false);
182 
184  virtual void realizeConfiguration(
185  const DtConfiguration& configuration);
186 
187  virtual void realizeObserverConfiguration(
188  const DtObserverConfiguration& configuration);
189 
190  const ObserverConfigurationMap& observerConfigurations() const;
191 
198  void addObserverConfiguration(const DtObserverConfiguration& config);
199 
202  void addObserverState(const std::string& observerName,
203  const makArchives::DtObserverStateRecord& stateRecord);
204 
208  void initializeObserver(DtObserver* observer,
209  const makArchives::DtObserverStateRecord& stateRecord);
210 
211  //-----
213 
215  virtual void addObserver(DtObserver* observer);
216 
218  virtual void removeObserver(DtObserver* observer);
219 
221  virtual void removeObserver(const std::string& name);
222 
224  virtual std::vector<DtObserver*> observers() const;
225 
227  virtual DtObserver* findObserverByName(const std::string& name);
229  virtual const DtObserver* findObserverByName(const std::string& name) const;
231 
233  virtual void setCurrentObserver(const std::string& observerName);
234 
236  DtObserver* currentObserver() const;
242  virtual DtObserver* findCurrentObserver() const;
244 
246  void setTerrainContextEnabled(bool enabled);
247  bool terrainContextEnabled() const;
248 
250 
252  virtual void performObserverAction(const DtViewStateProcessor::ObserverAction& action);
253 
255  virtual void toggleTerrainScaling();
256 
258  virtual void toggleWireframe();
259 
261  virtual void toggleSimulationTimePaused();
262 
264  virtual void incrementTerrainScaleFactor();
265 
267  virtual void decrementTerrainScaleFactor();
268 
270  virtual void toggleEntityLabels();
271 
273  virtual void toggleRotateEntitySymbols();
274 
276  virtual void toggleTacticalGraphics();
277 
279  virtual void toggleEntityHatLines();
280 
282  virtual void toggleTacticalGraphicsHatLines();
284  virtual void toggleEntityHatMode();
285 
287  virtual void toggleTacticalGraphicsHatMode();
288 
290  virtual void togglePropTransparencySelected();
291 
294  virtual void toggleViewControl();
295 
297  void resetObservers(DtUniqueID id);
298 
301  virtual void setAllowObserverReset(bool allow);
302  virtual bool allowObserverReset();
303 
307  virtual void setObserverRestoreOnSlaveConnectEnabled(bool enable);
308  virtual bool isObserverRestoreOnSlaveConnectEnabled();
309 
311  void saveObservers(const std::string& filename);
312 
316  void loadObservers(const std::string& filename, bool force = false);
317 
318  DtElementEntry::ObjectType typeFromId(const DtUniqueID& id);
319 
323  virtual void animateObserver(DtObserverAnimator* newAnimator);
324 
326  virtual void removeAnimatorFromObserver(DtObserver *observer);
327 
329  virtual void takeScreenCapture();
330 
332  virtual void toggleDeveloperDebugUI();
333 
335  const DtObserverViewsManager& observerViewsManager() const;
337  DtObserverViewsManager& observerViewsManager();
339 
340 
341  protected:
342 
343  void setCurrentObserver(DtObserver* observer);
344 
346  virtual void initializeKeyMapManager(const std::string& defaultKeyMap);
347  virtual void bindFunctions();
349  virtual void createMaps();
350 
353  virtual void loadMaps(bool loadFromFactory = false);
354 
356  typedef std::map<std::string, DtObserver*> ObserversMap;
357 
358  void removeObserver(ObserversMap& observers, DtObserver* observer);
359  void removeObserver(ObserversMap& observers, const std::string& name);
360 
361  void destroyObservers();
362 
363  bool setCurrentObserverFromChannel(const DtChannel& channel);
364 
365  void slot_channelCreated(DtChannelManager* channelManager, DtChannel* channel);
366  void slot_channelDestroyed(DtChannelManager* channelManager, DtChannel* channel);
367  void slot_channelConfigurationModified(const std::string& deName,
368  const std::string& winName, const std::string& oldChannelName,
369  const DtChannelConfiguration& config);
370  void slot_attachedToChanged(DtObserver* observer);
371 
372 
373  void createRequiredObservers(const std::string& engineName);
374 
376  virtual void slot_displayEngineAdded(const DtDeRecord& igRecord);
377 
381  std::string restoreObserversPart1();
382 
384  void restoreObserversPart2(const std::string& filename);
385 
386  virtual void slot_displayEngineRealized(const std::string&,
387  const std::string& engineName);
388 
392  bool trimmedMatch(DtObserver* observer);
393 
395  bool showObserverNameWarning();
396 
399  void setShowObserverNameWarning(bool warn);
400 
401  private:
404 
406  DtInputDriver& operator=(const DtInputDriver&);
407 
408  protected:
410 
412 
415 
418 
419  std::string myClassName;
421 
424 
427 
430 
432 
434 
436  std::list<DtObserverAnimator*> myAnimatingObservers;
437 
438  // Pointer to the DtObserverViewsManager
440 
441  // Object used to hide mouse (if enabled) when mouse hasn't moved for some period
442  // of time
444 
446 
448  };
449 
453  {
454  public:
455 
458 
460  virtual ~DtInputDriverCreator();
461 
463  static DtInputDriverCreator& instance(DtDe& de);
464 
468  static void registerInstance(DtDe& de, DtInputDriverCreator* creator);
469 
471  virtual DtInputDriver* create(DtAgentManager& sm);
472 
473  };
474 
475 }
bool myShowObserverNameWarning
Definition: DtInputDriver.h:447
Creator class for the DtInputDriver.
Definition: DtInputDriver.h:452
boost::function< void(DtObserver &)> ObserverAction
Definition: DtViewStateProcessor.h:29
Virtual base class.
Definition: DtVirtualBaseClass.h:19
std::map< std::string, DtObserver * > ObserversMap
Observer Manager bound.
Definition: DtInputDriver.h:356
ObserversMap myObservers
Definition: DtInputDriver.h:413
DtMouseHideProcessor * myMouseHideProcessor
Definition: DtInputDriver.h:443
ObserverStateMap myObserverStates
Definition: DtInputDriver.h:417
This class encapsulates a Key event.
Definition: DtKeyEvent.h:16
bool myIsTerrainContextEnabled
Switch to enable or disable terrain context menus;.
Definition: DtInputDriver.h:429
TODO: This class is used to encapsulate a set of default observer settings and parameters.
Definition: DtObserverConfiguration.h:22
DtPinchGesture represents a Pinch Multitouch Gesture.
Definition: DtPinchGesture.h:26
DtChannel * myCurrentChannel
Definition: DtInputDriver.h:431
std::list< DtEventProcessorInterface * > EventProcessorList
A list of DtEventProcessorInterface, called in order for each event until one handles it...
Definition: DtInputDriver.h:48
A Record of an IG instance.
Definition: DtDeRecord.h:24
std::map< std::string, DtObserverConfiguration > ObserverConfigurationMap
A map of observer names, to DtObserverConfigurations.
Definition: DtInputDriver.h:54
Contains makVrv::DtObserverConfiguration class.
EventProcessorList myEventProcessors
Definition: DtInputDriver.h:411
A DtObserverSettingsRecord contains the state of an observer.
Definition: DtObserverStateRecord.h:20
This class encapsulates a mouse button event.
Definition: DtMouseEvent.h:19
a Key Map contains a map of keys to FunctionMapEntrys, as well as a list of functions to execute when...
Definition: DtKeyMap.h:312
KeyModifier
Describe which modifier(s) are pressed.
Definition: DtKeyState.h:136
Definition: DtKeyEvent.h:22
std::map< std::string, makArchives::DtObserverStateRecord > ObserverStateMap
A map of observer names, to DtObserverStateRecords.
Definition: DtInputDriver.h:51
DtObserver * myCurrentObserver
Temp, so we can look this up ONCE each event.
Definition: DtInputDriver.h:423
unsigned int ObjectType
Definition: DtElementEntry.h:50
The manager for owning key maps.
Definition: DtKeyMapManager.h:32
The abstract Channel Class.
Definition: DtChannel.h:30
A facade for a DtObserverObject.
Definition: DtObserver.h:37
The DtDriver is an abstract class.
Definition: DtDriver.h:31
DtDe & myDe
Definition: DtInputDriver.h:409
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
This class&#39;s main responsibility is to handle keyboard and mouse events from OSG (Qt events are route...
Definition: DtInputDriver.h:43
bool myAllowResetFlag
Control whether observers can be reset.
Definition: DtInputDriver.h:426
ObserverConfigurationMap myObserverConfigurations
Definition: DtInputDriver.h:416
Contains makVrv::DtKeyMapManager class.
bool myObserverRestoreOnSlaveConnectEnabled
Definition: DtInputDriver.h:445
The DtAgentManager manages the distributed scene object framework.
Definition: DtAgentManager.h:38
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
Contains makVrv:DtDriver class.
DtKeyMapManager & myCachedKeyMapManager
Definition: DtInputDriver.h:433
Definition: DtKeyState.h:137
Base class for handling DtChannels.
Definition: DtChannelManager.h:32
DtObserverViewsManager * myObserverViewsManager
Definition: DtInputDriver.h:439
Contains makArchives::DtObserverStateRecord class.
Encapsulates the process of animating an observer to a given location.
Definition: DtObserverAnimator.h:37
Configuration for a single channel Serialized and sent to remote displays as necessary to configure r...
Definition: DtChannelConfiguration.h:26
Manager for the observer view records loaded in the application.
Definition: DtObserverViewsManager.h:28
The base implementation of a configuration.
Definition: DtConfiguration.h:24
DtMouseHideProcessor tracks mouse move events and when they happen.
Definition: DtMouseHideProcessor.h:32
std::string myClassName
Definition: DtInputDriver.h:419
DtObserverController * myObserverController
Definition: DtInputDriver.h:414
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
DtKeyAndMouseEventListener * myKeyAndMouseEventListener
Definition: DtInputDriver.h:420
The DtEventProcessorInterface defines the generic interface for classes which handle input events...
Definition: DtEventProcessorInterface.h:34
KeyType
Enumerate the key types. These are based on Virtual Key Codes.
Definition: DtKeyState.h:25
KeyEventType
Enumerate the types of key events supported.
Definition: DtKeyEvent.h:20
bool mySyncingObservers
Definition: DtInputDriver.h:435
This class&#39;s main responsibility is to provide the functions used to control an observer.
Definition: DtObserverController.h:29
This abstract base class defines the interface for OS-specific keyboard and mouse event listeners...
Definition: DtKeyAndMouseEventListener.h:25
std::list< DtObserverAnimator * > myAnimatingObservers
Definition: DtInputDriver.h:436

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)