VR-Forces 4.6.1 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) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
12 #include <vrvCore/DtDriver.h>
16 #include <boost/signal.hpp>
17 
18 #include <string>
19 #include <vector>
20 
21 namespace makVrv
22 {
23  class DtAgentManager;
24  class DtChannel;
25  class DtChannelManager;
26  class DtDe;
27  class DtEventProcessorInterface;
28  class DtInputDriverConfiguration;
29  class DtKeyAndMouseEventListener;
30  class DtKeyMap;
31  class DtKeyMapManager;
32  class DtMouseEvent;
33  class DtPinchGesture;
34  class DtObserver;
35  class DtObserverController;
36  class DtChannelConfiguration;
37  class DtObserverAnimator;
38  class DtObserverViewsManager;
39  class DtMouseHideProcessor;
40 
45  {
46  public:
49  typedef std::list<DtEventProcessorInterface*> EventProcessorList;
50 
52  typedef std::map<std::string, makArchives::DtObserverStateRecord> ObserverStateMap;
53 
55  typedef std::map<std::string, DtObserverConfiguration> ObserverConfigurationMap;
56 
58  DtInputDriver(DtAgentManager& agentManager,
59  const std::string& instanceName);
60 
62  virtual ~DtInputDriver();
63 
65  virtual bool onStart();
66 
68  virtual bool onStop();
69 
71  virtual bool onTick();
72 
74  virtual const std::string& className() const;
75 
77  virtual bool processKeyEvent(const DtKeyEvent& keyEvent,
78  DtChannel* channel);
79 
81  virtual bool processMouseEvent(const DtMouseEvent& mouseEvent,
82  DtChannel* channel);
83 
84  virtual bool processPinchGesture(const DtPinchGesture& pinchGesture,
85  DtChannel* channel);
86 
88  virtual void hideMouse(DtChannel* channel, float mouseX, float mouseY);
89 
91  virtual bool isMouseHidden() const;
92 
94  virtual void showMouse(DtChannel* channel);
95 
97  virtual void centerMouse(DtChannel* channel);
98 
100  virtual void setMousePosition(DtChannel* channel, float x, float y);
101 
104  virtual void clearState();
105 
111  DtChannel* currentChannel() const;
112 
115  virtual void addEventProcessorToFront(DtEventProcessorInterface* epi);
116 
121  virtual void addEventProcessorToBack(DtEventProcessorInterface* epi);
122 
126  virtual EventProcessorList& eventProcessorList();
127 
130  virtual DtEventProcessorInterface* findEventProcessor(
131  const std::string& className);
132 
137  virtual void removeEventProcessor(DtEventProcessorInterface* epi);
138 
140  bool saveKeyMapToFile(const DtKeyMap& keyMap, const std::string& filename) const;
141 
144  DtKeyMap* loadKeyMapFromFile(const std::string& filename, bool createBackup = false);
145 
147  //
150  void setKeyMap(const std::string& mapName);
151 
153  const std::string& keyMap() const;
154 
156  DtKeyMap* createKeyMap(const std::string& mapName);
157 
159  DtKeyMap* findKeyMap(const std::string& mapName);
160 
162  void addKeyBinding(DtKeyMap* map, DtKeyState::KeyType key,
163  const std::string& functionName,
165  bool replace = false,
167 
170  void addBinaryKeyBinding(DtKeyMap* map, DtKeyState::KeyType key,
171  const std::string& binaryName,
173  bool replace = false);
174 
176  virtual void realizeConfiguration(
177  const DtConfiguration& configuration);
178 
179  virtual void realizeObserverConfiguration(
180  const DtObserverConfiguration& configuration);
181 
182  const ObserverConfigurationMap& observerConfigurations() const;
183 
190  void addObserverConfiguration(const DtObserverConfiguration& config);
191 
194  void addObserverState(const std::string& observerName,
195  const makArchives::DtObserverStateRecord& stateRecord);
196 
200  void initializeObserver(DtObserver* observer,
201  const makArchives::DtObserverStateRecord& stateRecord);
202 
203  //-----
205 
207  virtual void addObserver(DtObserver* observer);
208 
210  virtual void removeObserver(DtObserver* observer);
211 
213  virtual void removeObserver(const std::string& name);
214 
216  virtual std::vector<DtObserver*> observers() const;
217 
219 
220  virtual DtObserver* findObserverByName(const std::string& name);
221  virtual const DtObserver* findObserverByName(const std::string& name) const;
223 
225  void setCurrentObserver(const std::string& observerName);
226 
228  DtObserver* currentObserver() const;
229 
231  void setTerrainContextEnabled(bool enabled);
232  bool terrainContextEnabled() const;
233 
235 
237  virtual void performObserverAction(const DtViewStateProcessor::ObserverAction& action);
238 
240  virtual void toggleTerrainScaling();
241 
243  virtual void toggleWireframe();
244 
246  virtual void toggleSimulationTimePaused();
247 
249  virtual void incrementTerrainScaleFactor();
250 
252  virtual void decrementTerrainScaleFactor();
253 
255  virtual void toggleEntityLabels();
256 
258  virtual void toggleRotateEntitySymbols();
259 
261  virtual void toggleTacticalGraphics();
262 
264  virtual void toggleEntityHatLines();
265 
267  virtual void toggleTacticalGraphicsHatLines();
269  virtual void toggleEntityHatMode();
270 
272  virtual void toggleTacticalGraphicsHatMode();
273 
275  virtual void togglePropTransparencySelected();
276 
279  virtual void toggleViewControl();
280 
282  void resetObservers(DtUniqueID id);
283 
286  void setAllowObserverReset(bool allow);
287 
289  void saveObservers(const std::string& filename);
290 
294  void loadObservers(const std::string& filename, bool force = false);
295 
296  DtElementEntry::ObjectType typeFromId(const DtUniqueID& id);
297 
301  virtual void animateObserver(DtObserverAnimator* newAnimator);
302 
304  virtual void removeAnimatorFromObserver(DtObserver *observer);
305 
307  virtual void takeScreenCapture();
308 
310  virtual void toggleDeveloperDebugUI();
311 
313  DtObserverViewsManager& observerViewsManager() const;
314 
315 
316  protected:
317 
318  void setCurrentObserver(DtObserver* observer);
319 
321  virtual void initializeKeyMapManager(const std::string& defaultKeyMap);
322  virtual void bindFunctions();
324  virtual void createMaps();
325 
328  virtual void loadMaps(bool loadFromFactory = false);
329 
331  typedef std::map<std::string, DtObserver*> ObserversMap;
332 
333  void removeObserver(ObserversMap& observers, DtObserver* observer);
334  void removeObserver(ObserversMap& observers, const std::string& name);
335 
336  void destroyObservers();
337 
338  bool setCurrentObserverFromChannel(const DtChannel& channel);
339 
340  void slot_channelCreated(DtChannelManager* channelManager, DtChannel* channel);
341  void slot_channelDestroyed(DtChannelManager* channelManager, DtChannel* channel);
342  void slot_channelConfigurationModified(const std::string& deName,
343  const std::string& winName, const std::string& oldChannelName,
344  const DtChannelConfiguration& config);
345  void slot_attachedToChanged(DtObserver* observer);
346 
347 
348  void createRequiredObservers(const std::string& engineName);
349 
351  virtual void slot_displayEngineAdded(const DtDeRecord& igRecord);
352 
356  std::string restoreObserversPart1();
357 
359  void restoreObserversPart2(const std::string& filename);
360 
361  virtual void slot_displayEngineRealized(const std::string&,
362  const std::string& engineName);
363 
364  private:
367 
369  DtInputDriver& operator=(const DtInputDriver&);
370 
371  protected:
373 
375 
378 
381 
382  std::string myClassName;
384 
387 
390 
393 
395 
397 
399  std::list<DtObserverAnimator*> myAnimatingObservers;
400 
401  // Pointer to the DtObserverViewsManager
403 
404  // Object used to hide mouse (if enabled) when mouse hasn't moved for some period
405  // of time
407  };
408 
412  {
413  public:
414 
417 
419  virtual ~DtInputDriverCreator();
420 
422  static DtInputDriverCreator& instance(DtDe& de);
423 
427  static void registerInstance(DtDe& de, DtInputDriverCreator* creator);
428 
430  virtual DtInputDriver* create(DtAgentManager& sm);
431 
432  };
433 
434 }

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)