![]() |
VR-Forces 4.0.4 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 (XR only) | |
| virtual void | incrementTerrainScaleFactor () |
| Increment terrain scale factor (XR only) | |
| virtual void | decrementTerrainScaleFactor () |
| Decrement terrain scale factor (XR only) | |
| virtual void | toggleEntityLabels () |
| Toggle entity labels 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. | |
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 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 |
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.
typedef std::map<std::string, DtObserver*> makVrv::DtInputDriver::ObserversMap [protected] |
Observer Manager bound.
| makVrv::DtInputDriver::DtInputDriver | ( | DtAgentManager & | agentManager, |
| const std::string & | instanceName | ||
| ) |
CTOR.
| virtual makVrv::DtInputDriver::~DtInputDriver | ( | ) | [virtual] |
DTOR.
| makVrv::DtInputDriver::DtInputDriver | ( | const DtInputDriver & | ) | [private] |
Copy Constructor (not implemented)
| virtual bool makVrv::DtInputDriver::onStart | ( | ) | [virtual] |
Create and initialize our listener.
Implements makVrv::DtDriver.
| virtual bool makVrv::DtInputDriver::onStop | ( | ) | [virtual] |
Uninitialize and destroy our listener.
Implements makVrv::DtDriver.
| virtual bool makVrv::DtInputDriver::onTick | ( | ) | [virtual] |
Tick our keyboard/mouse listener.
Implements makVrv::DtDriver.
| virtual const std::string& makVrv::DtInputDriver::className | ( | ) | const [virtual] |
Get the class name for the input driver.
Implements makVrv::DtDriver.
| virtual bool makVrv::DtInputDriver::processKeyEvent | ( | const DtKeyEvent & | keyEvent, |
| DtChannel * | channel | ||
| ) | [virtual] |
handle a key event from our listener
| virtual bool makVrv::DtInputDriver::processMouseEvent | ( | const DtMouseEvent & | mouseEvent, |
| DtChannel * | channel | ||
| ) | [virtual] |
handle a mouse event from our listener
| virtual void makVrv::DtInputDriver::hideMouse | ( | DtChannel * | channel, |
| float | mouseX, | ||
| float | mouseY | ||
| ) | [virtual] |
hide the mouse cursor
| virtual bool makVrv::DtInputDriver::isMouseHidden | ( | ) | const [virtual] |
Check to see if the mouse is hidden.
| virtual void makVrv::DtInputDriver::showMouse | ( | DtChannel * | channel | ) | [virtual] |
show the mouse cursor
| virtual void makVrv::DtInputDriver::centerMouse | ( | DtChannel * | channel | ) | [virtual] |
warp the mouse cursor to the center of the view
| virtual void makVrv::DtInputDriver::setMousePosition | ( | DtChannel * | channel, |
| float | x, | ||
| float | y | ||
| ) | [virtual] |
warp the mouse cursor to the given window position
| virtual void makVrv::DtInputDriver::clearState | ( | ) | [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 void makVrv::DtInputDriver::addEventProcessorToFront | ( | DtEventProcessorInterface * | epi | ) | [virtual] |
This transfers resource management of the event processor to the input driver.
| virtual void makVrv::DtInputDriver::addEventProcessorToBack | ( | DtEventProcessorInterface * | epi | ) | [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 EventProcessorList& makVrv::DtInputDriver::eventProcessorList | ( | ) | [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 DtEventProcessorInterface* makVrv::DtInputDriver::findEventProcessor | ( | const std::string & | className | ) | [virtual] |
Find an event processor owned by the input driver that has the specified class name.
Returns 0 if none is found.
| virtual void makVrv::DtInputDriver::removeEventProcessor | ( | DtEventProcessorInterface * | epi | ) | [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 void makVrv::DtInputDriver::realizeConfiguration | ( | const DtInputDriverConfiguration & | configuration | ) | [virtual] |
Realize the driver using the configuration.
| virtual void makVrv::DtInputDriver::realizeObserverConfiguration | ( | const DtObserverConfiguration & | 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 void makVrv::DtInputDriver::addObserver | ( | DtObserver * | observer | ) | [virtual] |
Observer Management.
add an observer object to the manager
| virtual void makVrv::DtInputDriver::removeObserver | ( | DtObserver * | observer | ) | [virtual] |
Remove an observer object from the manager.
| virtual void makVrv::DtInputDriver::removeObserver | ( | const std::string & | name | ) | [virtual] |
Remove an observer object from the manager.
| virtual std::vector<DtObserver*> makVrv::DtInputDriver::observers | ( | ) | const [virtual] |
Get a list of all observers.
| virtual DtObserver* makVrv::DtInputDriver::findObserverByName | ( | const std::string & | name | ) | [virtual] |
Find an observer by its name.
| virtual const DtObserver* makVrv::DtInputDriver::findObserverByName | ( | const std::string & | name | ) | const [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.
| virtual void makVrv::DtInputDriver::performObserverAction | ( | DtViewStateProcessor::ObserverAction & | action | ) | [virtual] |
View controls:
Run a function on the "main" observer
| virtual void makVrv::DtInputDriver::toggleTerrainScaling | ( | ) | [virtual] |
Toggle terrain scaling on or off (XR only)
| virtual void makVrv::DtInputDriver::incrementTerrainScaleFactor | ( | ) | [virtual] |
Increment terrain scale factor (XR only)
| virtual void makVrv::DtInputDriver::decrementTerrainScaleFactor | ( | ) | [virtual] |
Decrement terrain scale factor (XR only)
| virtual void makVrv::DtInputDriver::toggleEntityLabels | ( | ) | [virtual] |
Toggle entity labels on or off.
| virtual void makVrv::DtInputDriver::toggleTacticalGraphics | ( | ) | [virtual] |
Toggle tactical graphics display on or off.
| virtual void makVrv::DtInputDriver::toggleEntityHatLines | ( | ) | [virtual] |
Toggle entity height above terrain lines display on or off.
| virtual void makVrv::DtInputDriver::toggleTacticalGraphicsHatLines | ( | ) | [virtual] |
Toggle tactical graphics height above terrain lines display on or off.
| virtual void makVrv::DtInputDriver::toggleEntityHatMode | ( | ) | [virtual] |
Toggle entity height above terrain mode.
| virtual void makVrv::DtInputDriver::toggleTacticalGraphicsHatMode | ( | ) | [virtual] |
Toggle tactical graphics height above terrain mode.
| virtual void makVrv::DtInputDriver::togglePropTransparencySelected | ( | ) | [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.
| void makVrv::DtInputDriver::setCurrentObserver | ( | DtObserver * | observer | ) | [protected] |
| virtual void makVrv::DtInputDriver::initializeKeyMapManager | ( | const std::string & | defaultKeyMap | ) | [protected, virtual] |
This will eventually load up key maps.
| virtual void makVrv::DtInputDriver::bindFunctions | ( | ) | [protected, virtual] |
| virtual void makVrv::DtInputDriver::createMaps | ( | ) | [protected, virtual] |
This creates the default key maps by hand. Kept around for now.
| virtual void makVrv::DtInputDriver::loadMaps | ( | bool | loadFromFactory = false | ) | [protected, virtual] |
Load all the key maps (*.kmpx) files in the $APP_DIR/settings directory.
If loadFromFactory is true, loads from factory directory, not app directory
| void makVrv::DtInputDriver::removeObserver | ( | ObserversMap & | observers, |
| DtObserver * | observer | ||
| ) | [protected] |
| void makVrv::DtInputDriver::removeObserver | ( | ObserversMap & | observers, |
| const std::string & | name | ||
| ) | [protected] |
| void makVrv::DtInputDriver::destroyObservers | ( | ) | [protected] |
| bool makVrv::DtInputDriver::setCurrentObserverFromChannel | ( | const DtChannel & | channel | ) | [protected] |
| void makVrv::DtInputDriver::slot_channelCreated | ( | DtChannelManager * | channelManager, |
| DtChannel * | channel | ||
| ) | [protected] |
| void makVrv::DtInputDriver::slot_channelDestroyed | ( | DtChannelManager * | channelManager, |
| DtChannel * | channel | ||
| ) | [protected] |
| void makVrv::DtInputDriver::slot_channelConfigurationModified | ( | const std::string & | deName, |
| const std::string & | winName, | ||
| const std::string & | oldChannelName, | ||
| const DtChannelConfiguration & | config | ||
| ) | [protected] |
| void makVrv::DtInputDriver::slot_attachedToChanged | ( | DtObserver * | observer | ) | [protected] |
| void makVrv::DtInputDriver::createRequiredObservers | ( | const std::string & | engineName | ) | [protected] |
| virtual void makVrv::DtInputDriver::slot_displayEngineAdded | ( | const DtDeRecord & | igRecord | ) | [protected, virtual] |
Called when a display engine is added. Restarts this driver.
Reimplemented from makVrv::DtDriver.
| std::string makVrv::DtInputDriver::restoreObserversPart1 | ( | ) | [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.
| void makVrv::DtInputDriver::restoreObserversPart2 | ( | const std::string & | filename | ) | [protected] |
Loads a temporary observer settings file and deletes the file.
| virtual void makVrv::DtInputDriver::slot_displayEngineRealized | ( | const std::string & | , |
| const std::string & | engineName | ||
| ) | [protected, virtual] |
| DtInputDriver& makVrv::DtInputDriver::operator= | ( | const DtInputDriver & | ) | [private] |
Assignment Operator (not implemented)
DtDe& makVrv::DtInputDriver::myDe [protected] |
ObserversMap makVrv::DtInputDriver::myObservers [protected] |
std::string makVrv::DtInputDriver::myClassName [protected] |
DtObserver* makVrv::DtInputDriver::myCurrentObserver [protected] |
Temp, so we can look this up ONCE each event.
bool makVrv::DtInputDriver::myAllowResetFlag [protected] |
Control whether observers can be reset.
bool makVrv::DtInputDriver::myIsTerrainContextEnabled [protected] |
Switch to enable or disable terrain context menus;.
DtChannel* makVrv::DtInputDriver::myCurrentChannel [protected] |
bool makVrv::DtInputDriver::mySyncingObservers [protected] |