![]() |
VR-Forces 4.3 Class Documentation
|
This class's main responsibility is to handle keyboard and mouse events from OSG (Qt events are routed through OSG when a Qt window is used). More...

Public Types | |
| typedef std::list < DtEventProcessorInterface * > | EventProcessorList |
| A list of DtEventProcessorInterface, called in order for each event until one handles it. | |
| typedef std::map< std::string, makArchives::DtObserverStateRecord > | ObserverStateMap |
| A map of observer names, to DtObserverStateRecords. | |
| typedef std::map< std::string, DtObserverConfiguration > | ObserverConfigurationMap |
| A map of observer names, to DtObserverConfigurations. | |
Public Member Functions | |
| DtInputDriver (DtAgentManager &agentManager, const std::string &instanceName) | |
| CTOR. | |
| virtual | ~DtInputDriver () |
| DTOR. | |
| virtual bool | onStart () |
| Create and initialize our listener. | |
| virtual bool | onStop () |
| Uninitialize and destroy our listener. | |
| virtual bool | onTick () |
| Tick our keyboard/mouse listener. | |
| virtual const std::string & | className () const |
| Get the class name for the input driver. | |
| virtual bool | processKeyEvent (const DtKeyEvent &keyEvent, DtChannel *channel) |
| handle a key event from our listener | |
| virtual bool | processMouseEvent (const DtMouseEvent &mouseEvent, DtChannel *channel) |
| handle a mouse event from our listener | |
| virtual void | hideMouse (DtChannel *channel, float mouseX, float mouseY) |
| hide the mouse cursor | |
| virtual bool | isMouseHidden () const |
| Check to see if the mouse is hidden. | |
| virtual void | showMouse (DtChannel *channel) |
| show the mouse cursor | |
| virtual void | centerMouse (DtChannel *channel) |
| warp the mouse cursor to the center of the view | |
| virtual void | setMousePosition (DtChannel *channel, float x, float y) |
| warp the mouse cursor to the given window position | |
| virtual void | clearState () |
| clear any remembered keyboard modifiers and stop any observer motion | |
| DtChannel * | currentChannel () const |
| the last channel a mouse or keyboard event was received in. | |
| virtual void | addEventProcessorToFront (DtEventProcessorInterface *epi) |
| This transfers resource management of the event processor to the input driver. | |
| virtual void | addEventProcessorToBack (DtEventProcessorInterface *epi) |
| Add an event processor to the driver. | |
| virtual EventProcessorList & | eventProcessorList () |
| Get the list of event processors. | |
| virtual DtEventProcessorInterface * | findEventProcessor (const std::string &className) |
| Find an event processor owned by the input driver that has the specified class name. | |
| virtual void | removeEventProcessor (DtEventProcessorInterface *epi) |
| Remove an event processor from the driver. | |
| bool | saveKeyMapToFile (const DtKeyMap &keyMap, const std::string &filename) const |
| Save a key map to a file. | |
| DtKeyMap * | loadKeyMapFromFile (const std::string &filename, bool createBackup=false) |
| Save a key map to a file. | |
| void | setKeyMap (const std::string &mapName) |
| explicitly set a key map | |
| const std::string & | keyMap () const |
| Get the name of the current keyMap. | |
| DtKeyMap * | createKeyMap (const std::string &mapName) |
| create a (blank) key map | |
| DtKeyMap * | findKeyMap (const std::string &mapName) |
| lookup a key map | |
| void | addKeyBinding (DtKeyMap *map, DtKeyState::KeyType key, std::string functionName, DtKeyState::KeyModifier modifiers=DtKeyState::NO_MODIFIER, bool replace=false, DtKeyEvent::KeyEventType eventType=DtKeyEvent::KEY_DOWN) |
| bind a key down or key up event (possibly modified) to a function name | |
| void | addBinaryKeyBinding (DtKeyMap *map, DtKeyState::KeyType key, std::string binaryName, DtKeyState::KeyModifier modifiers=DtKeyState::NO_MODIFIER, bool replace=false) |
| bind the up and down events for a key (possibly modified) to a binary function set | |
| virtual void | realizeConfiguration (const DtInputDriverConfiguration &configuration) |
| Realize the driver using the configuration. | |
| virtual void | realizeObserverConfiguration (const DtObserverConfiguration &configuration) |
| const ObserverConfigurationMap & | observerConfigurations () const |
| void | addObserverConfiguration (const DtObserverConfiguration &config) |
| name is already in the config... | |
| void | addObserverState (const std::string &observerName, const makArchives::DtObserverStateRecord &stateRecord) |
| put this state onto the observerState map and, if the observer currently exists, set its state from this record | |
| void | initializeObserver (DtObserver *observer, const makArchives::DtObserverStateRecord &stateRecord) |
| set the state of the specified observer from stateRecord. | |
| virtual void | addObserver (DtObserver *observer) |
| Observer Management. | |
| virtual void | removeObserver (DtObserver *observer) |
| Remove an observer object from the manager. | |
| virtual void | removeObserver (const std::string &name) |
| Remove an observer object from the manager. | |
| virtual std::vector< DtObserver * > | observers () const |
| Get a list of all observers. | |
| void | setCurrentObserver (const std::string &observerName) |
| Set the current observer by name. | |
| DtObserver * | currentObserver () const |
| Get the current observer. | |
| void | setTerrainContextEnabled (bool enabled) |
| Set whether terrain context menus are enabed. | |
| bool | terrainContextEnabled () const |
| virtual void | performObserverAction (DtViewStateProcessor::ObserverAction &action) |
| View controls: | |
| virtual void | toggleTerrainScaling () |
| Toggle terrain scaling on or off. | |
| virtual void | incrementTerrainScaleFactor () |
| Increment terrain scale factor. | |
| virtual void | decrementTerrainScaleFactor () |
| Decrement terrain scale factor. | |
| virtual void | toggleEntityLabels () |
| Toggle entity labels on or off. | |
| virtual void | toggleRotateEntitySymbols () |
| Toggle entity symbol rotate on or off. | |
| virtual void | toggleTacticalGraphics () |
| Toggle tactical graphics display on or off. | |
| virtual void | toggleEntityHatLines () |
| Toggle entity height above terrain lines display on or off. | |
| virtual void | toggleTacticalGraphicsHatLines () |
| Toggle tactical graphics height above terrain lines display on or off. | |
| virtual void | toggleEntityHatMode () |
| Toggle entity height above terrain mode. | |
| virtual void | toggleTacticalGraphicsHatMode () |
| Toggle tactical graphics height above terrain mode. | |
| virtual void | togglePropTransparencySelected () |
| Toggles the transparency of all selected props. | |
| void | resetObservers (DtUniqueID id) |
| Reset all of the observers to the unique id. | |
| void | setAllowObserverReset (bool allow) |
| Control whether reset observers functions or not. | |
| void | saveObservers (const std::string &filename) |
| Create an observer settings file. | |
| void | loadObservers (const std::string &filename) |
| Load an observer settings file. | |
| DtElementEntry::ObjectType | typeFromId (const DtUniqueID &id) |
| virtual DtObserver * | findObserverByName (const std::string &name) |
| Find an observer by its name. | |
| virtual const DtObserver * | findObserverByName (const std::string &name) const |
| Find an observer by its name. | |
Public Member Functions inherited from makVrv::DtDriver | |
| DtDriver (DtAgentManager &agentManager, const std::string &instanceName) | |
| CTOR. | |
| virtual | ~DtDriver () |
| DTOR. | |
| virtual void | realizeConfiguration (const DtConfiguration &configuration) |
| Realize the driver using the configuration. | |
| virtual DtConfiguration | createConfiguration () const |
| Create a configuration for the driver. | |
| DtAgentManager & | agentManager () |
| Get the master scene for this host. | |
| virtual DtAgentManagerInterface & | sceneInterface () |
| Get the scene manager interface for creating agents. | |
| bool | started () const |
| Get this driver's active state. | |
| virtual const std::string & | instanceName () const |
| Get this driver's instance name. | |
| virtual bool | autoStart () const |
| Get whether this driver is set to automatically start if it is persistent. | |
| virtual void | setAutoStart (bool autoStart) |
| Set whether this driver automatically starts if it is persistent. | |
| virtual bool | isWindowDependent () const |
| Get whether this driver is set to automatically start when the first window is created and stop when the last window is destroyed. | |
| virtual void | setIsWindowDependent (bool dep) |
| Set whether this driver is set to automatically start when the first window is created and stop when the last window is destroyed. | |
| virtual void | setIsUserControllable (bool) |
| Set whether this driver can be started and stopped by the user. | |
| virtual bool | isUserControllable () const |
| Get whether this driver can be started and stopped by the user. | |
| virtual void | setIsPersistent (bool per) |
| Set if the driver is persistent and should be saved between runs. | |
| virtual bool | isPersistent () const |
| Get if the driver is persistent and should be saved between runs. | |
| virtual bool | isOnDriverSelectionList () const |
| Returns whether or not this driver is to be automatically started/stopped from the driver selection list. | |
| virtual void | setOnDriverSelectionList (bool) |
| Sets whether or not this item is on the driver selection list. | |
| bool | objectFromAgentManager (const DtUniqueID &id) const |
| check to see if the object was created using this driver's agent manager. | |
Protected Types | |
| typedef std::map< std::string, DtObserver * > | ObserversMap |
| Observer Manager bound. | |
Protected Member Functions | |
| void | setCurrentObserver (DtObserver *observer) |
| virtual void | initializeKeyMapManager (const std::string &defaultKeyMap) |
| This will eventually load up key maps. | |
| virtual void | bindFunctions () |
| virtual void | createMaps () |
| This creates the default key maps by hand. Kept around for now. | |
| virtual void | loadMaps (bool loadFromFactory=false) |
| Load all the key maps (*.kmpx) files in the $APP_DIR/settings directory. | |
| void | removeObserver (ObserversMap &observers, DtObserver *observer) |
| void | removeObserver (ObserversMap &observers, const std::string &name) |
| void | destroyObservers () |
| bool | setCurrentObserverFromChannel (const DtChannel &channel) |
| void | slot_channelCreated (DtChannelManager *channelManager, DtChannel *channel) |
| void | slot_channelDestroyed (DtChannelManager *channelManager, DtChannel *channel) |
| void | slot_channelConfigurationModified (const std::string &deName, const std::string &winName, const std::string &oldChannelName, const DtChannelConfiguration &config) |
| void | slot_attachedToChanged (DtObserver *observer) |
| void | createRequiredObservers (const std::string &engineName) |
| virtual void | slot_displayEngineAdded (const DtDeRecord &igRecord) |
| Called when a display engine is added. Restarts this driver. | |
| std::string | restoreObserversPart1 () |
| Create a temporary observer settings file using a default filename - called when a display engine is added, before shutting down. | |
| void | restoreObserversPart2 (const std::string &filename) |
| Loads a temporary observer settings file and deletes the file. | |
| virtual void | slot_displayEngineRealized (const std::string &, const std::string &engineName) |
Protected Member Functions inherited from makVrv::DtDriver | |
| void | applyChangesAndDelete (DtElementChanges *changes) |
| Function for apply changes from a changes object and deleting it. | |
| void | reportElementCreated (DtElementID id, DtElementID parentId, DtElementEntry::ElementType type) |
| Report an element created. | |
| void | reportElementAttribute (DtElementID id, DtElementAttribute *attribute) |
| Report an element attribute changed. | |
| void | reportElementDestroyed (DtElementID id) |
| Report an element destroyed. | |
| void | start () |
| Start the driver. | |
| void | stop () |
| Stop the driver. | |
| bool | tick () |
| Tick the host driver. | |
| virtual void | setInstanceName (const std::string &name) |
| set the Instance name. | |
| virtual void | installAccessories () |
| Installs accessories on this driver. | |
| virtual void | uninstallAccessories () |
| Removes accessories from this driver. | |
Protected Attributes | |
| DtDe & | myDe |
| EventProcessorList | myEventProcessors |
| ObserversMap | myObservers |
| DtObserverController * | myObserverController |
| ObserverConfigurationMap | myObserverConfigurations |
| ObserverStateMap | myObserverStates |
| std::string | myClassName |
| DtKeyAndMouseEventListener * | myKeyAndMouseEventListener |
| DtObserver * | myCurrentObserver |
| Temp, so we can look this up ONCE each event. | |
| bool | myAllowResetFlag |
| Control whether observers can be reset. | |
| bool | myIsTerrainContextEnabled |
| Switch to enable or disable terrain context menus;. | |
| DtChannel * | myCurrentChannel |
| DtKeyMapManager & | myCachedKeyMapManager |
| bool | mySyncingObservers |
Protected Attributes inherited from makVrv::DtDriver | |
| DtAgentManager & | myAgentManager |
| bool | myStartedFlag |
| std::string | myName |
| DtConfiguration | myConfiguration |
| bool | myPersistentFlag |
| bool | myUserControllableFlag |
| bool | myRequestStateDiffPendingFlag |
| DtElementChanges | myChanges |
Private Member Functions | |
| DtInputDriver (const DtInputDriver &) | |
| Copy Constructor (not implemented) | |
| DtInputDriver & | operator= (const DtInputDriver &) |
| Assignment Operator (not implemented) | |
This class's main responsibility is to handle keyboard and mouse events from OSG (Qt events are routed through OSG when a Qt window is used).
| typedef std::list<DtEventProcessorInterface*> makVrv::DtInputDriver::EventProcessorList |
A list of DtEventProcessorInterface, called in order for each event until one handles it.
| typedef std::map<std::string, makArchives::DtObserverStateRecord> makVrv::DtInputDriver::ObserverStateMap |
A map of observer names, to DtObserverStateRecords.
| typedef std::map<std::string, DtObserverConfiguration> makVrv::DtInputDriver::ObserverConfigurationMap |
A map of observer names, to DtObserverConfigurations.
|
protected |
Observer Manager bound.
| makVrv::DtInputDriver::DtInputDriver | ( | DtAgentManager & | agentManager, |
| const std::string & | instanceName | ||
| ) |
CTOR.
|
virtual |
DTOR.
|
private |
Copy Constructor (not implemented)
|
virtual |
Create and initialize our listener.
Implements makVrv::DtDriver.
|
virtual |
Uninitialize and destroy our listener.
Implements makVrv::DtDriver.
|
virtual |
Tick our keyboard/mouse listener.
Implements makVrv::DtDriver.
|
virtual |
Get the class name for the input driver.
Implements makVrv::DtDriver.
|
virtual |
handle a key event from our listener
|
virtual |
handle a mouse event from our listener
|
virtual |
hide the mouse cursor
|
virtual |
Check to see if the mouse is hidden.
|
virtual |
show the mouse cursor
|
virtual |
warp the mouse cursor to the center of the view
|
virtual |
warp the mouse cursor to the given window position
|
virtual |
clear any remembered keyboard modifiers and stop any observer motion
| DtChannel* makVrv::DtInputDriver::currentChannel | ( | ) | const |
the last channel a mouse or keyboard event was received in.
Note that this may be Null if no events have happened on any channel OR if the last channel that received an event has been destroyed. Do not hold onto channel pointers unless you are also listening for channelToBeDestroyed signals.
|
virtual |
This transfers resource management of the event processor to the input driver.
|
virtual |
Add an event processor to the driver.
It will be added to the back of the processor list in priority. This transfers resource management of the event processor to the input driver.
|
virtual |
Get the list of event processors.
Intended for more complex ordering of several event processors by mutating the list. Processors in the list are managed by the input driver.
|
virtual |
Find an event processor owned by the input driver that has the specified class name.
Returns 0 if none is found.
|
virtual |
Remove an event processor from the driver.
This will remove the first processor in the list that matches the passed-in pointer. This relinquishes resource management of the event processor from the input driver.
| bool makVrv::DtInputDriver::saveKeyMapToFile | ( | const DtKeyMap & | keyMap, |
| const std::string & | filename | ||
| ) | const |
Save a key map to a file.
| DtKeyMap* makVrv::DtInputDriver::loadKeyMapFromFile | ( | const std::string & | filename, |
| bool | createBackup = false |
||
| ) |
Save a key map to a file.
If createBackup is true, creates a backup object in the key map manager to manage key map backups
| void makVrv::DtInputDriver::setKeyMap | ( | const std::string & | mapName | ) |
explicitly set a key map
Note that if you name a map that does not exist, the input driver will throw an exception
| const std::string& makVrv::DtInputDriver::keyMap | ( | ) | const |
Get the name of the current keyMap.
| DtKeyMap* makVrv::DtInputDriver::createKeyMap | ( | const std::string & | mapName | ) |
create a (blank) key map
| DtKeyMap* makVrv::DtInputDriver::findKeyMap | ( | const std::string & | mapName | ) |
lookup a key map
| void makVrv::DtInputDriver::addKeyBinding | ( | DtKeyMap * | map, |
| DtKeyState::KeyType | key, | ||
| std::string | functionName, | ||
| DtKeyState::KeyModifier | modifiers = DtKeyState::NO_MODIFIER, |
||
| bool | replace = false, |
||
| DtKeyEvent::KeyEventType | eventType = DtKeyEvent::KEY_DOWN |
||
| ) |
bind a key down or key up event (possibly modified) to a function name
| void makVrv::DtInputDriver::addBinaryKeyBinding | ( | DtKeyMap * | map, |
| DtKeyState::KeyType | key, | ||
| std::string | binaryName, | ||
| DtKeyState::KeyModifier | modifiers = DtKeyState::NO_MODIFIER, |
||
| bool | replace = false |
||
| ) |
bind the up and down events for a key (possibly modified) to a binary function set
|
virtual |
Realize the driver using the configuration.
|
virtual |
| const ObserverConfigurationMap& makVrv::DtInputDriver::observerConfigurations | ( | ) | const |
| void makVrv::DtInputDriver::addObserverConfiguration | ( | const DtObserverConfiguration & | config | ) |
name is already in the config...
If the input driver is already started, this will create the observer indicated. In any event, the configuration goes onto the configuration list (so it will be created on inputDriver start
| void makVrv::DtInputDriver::addObserverState | ( | const std::string & | observerName, |
| const makArchives::DtObserverStateRecord & | stateRecord | ||
| ) |
put this state onto the observerState map and, if the observer currently exists, set its state from this record
| void makVrv::DtInputDriver::initializeObserver | ( | DtObserver * | observer, |
| const makArchives::DtObserverStateRecord & | stateRecord | ||
| ) |
set the state of the specified observer from stateRecord.
This does NOT put the state record onto the onbserverState map; use addObserverState to do that
|
virtual |
Observer Management.
add an observer object to the manager
|
virtual |
Remove an observer object from the manager.
|
virtual |
Remove an observer object from the manager.
|
virtual |
Get a list of all observers.
|
virtual |
Find an observer by its name.
|
virtual |
Find an observer by its name.
| void makVrv::DtInputDriver::setCurrentObserver | ( | const std::string & | observerName | ) |
Set the current observer by name.
| DtObserver* makVrv::DtInputDriver::currentObserver | ( | ) | const |
Get the current observer.
| void makVrv::DtInputDriver::setTerrainContextEnabled | ( | bool | enabled | ) |
Set whether terrain context menus are enabed.
| bool makVrv::DtInputDriver::terrainContextEnabled | ( | ) | const |
|
virtual |
View controls:
Run a function on the "main" observer
|
virtual |
Toggle terrain scaling on or off.
|
virtual |
Increment terrain scale factor.
|
virtual |
Decrement terrain scale factor.
|
virtual |
Toggle entity labels on or off.
|
virtual |
Toggle entity symbol rotate on or off.
|
virtual |
Toggle tactical graphics display on or off.
|
virtual |
Toggle entity height above terrain lines display on or off.
|
virtual |
Toggle tactical graphics height above terrain lines display on or off.
|
virtual |
Toggle entity height above terrain mode.
|
virtual |
Toggle tactical graphics height above terrain mode.
|
virtual |
Toggles the transparency of all selected props.
| void makVrv::DtInputDriver::resetObservers | ( | DtUniqueID | id | ) |
Reset all of the observers to the unique id.
| void makVrv::DtInputDriver::setAllowObserverReset | ( | bool | allow | ) |
Control whether reset observers functions or not.
This is used during saving/loading scene for connecting slaves not to modify the observers.
| void makVrv::DtInputDriver::saveObservers | ( | const std::string & | filename | ) |
Create an observer settings file.
| void makVrv::DtInputDriver::loadObservers | ( | const std::string & | filename | ) |
Load an observer settings file.
| DtElementEntry::ObjectType makVrv::DtInputDriver::typeFromId | ( | const DtUniqueID & | id | ) |
|
protected |
|
protectedvirtual |
This will eventually load up key maps.
|
protectedvirtual |
|
protectedvirtual |
This creates the default key maps by hand. Kept around for now.
|
protectedvirtual |
Load all the key maps (*.kmpx) files in the $APP_DIR/settings directory.
If loadFromFactory is true, loads from factory directory, not app directory
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protectedvirtual |
Called when a display engine is added. Restarts this driver.
Reimplemented from makVrv::DtDriver.
|
protected |
Create a temporary observer settings file using a default filename - called when a display engine is added, before shutting down.
Returns the name of the file.
|
protected |
Loads a temporary observer settings file and deletes the file.
|
protectedvirtual |
|
private |
Assignment Operator (not implemented)
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Temp, so we can look this up ONCE each event.
|
protected |
Control whether observers can be reset.
|
protected |
Switch to enable or disable terrain context menus;.
|
protected |
|
protected |
|
protected |