![]() |
VR-Forces 4.3.1 Class Documentation
|
The Add Set example creates a new "Set" command that allows a user to set an entity's current speed and heading.
When the command is selected from the Set menu, a dialog box that allows entry of desired speed/ heading is created. The larger architecture of GUI and Menus in the VR Forces Front End is described in VR-Vantage Architecture Walkthrough - The GUI Layer and GUI Architecture.
The front-end example demonstrates the following:
Most of the work in placing, registering and associating a menu item in this example is done in addSet/addSetGui/addSetPlugin.cxx. Adding an item to the set menu involves establishing a menu item object derived from the makVrf::DtVrfTaskSetMenuItem class. This example creates a menu item called vrfAddSetExample::DtSetSpeedAndHeadingMenuItem. A string called the menuItemIdName linking this entry to its menu item object must be inserted into the makVrf::DtSetMenu relative to another menuItemIdName:
Now the actual menu item object vrfAddSetExample::DtSetSpeedAndHeadingMenuItem must be instantiated and registered with the set menu assembler:
The menu item inserted in the first quoted bit of code is associated in the Set Menu by the common text string vrfAddSetExample::DtSetSpeedAndHeadingMenuItemIdName. A string like this one is central to the identification of all menu items and our vrfAddSetExample::DtSetSpeedAndHeadingMenuItem object is initialized with this string.
In this example, the dialog box object is derived from DtSetSpeedAndHeadingDialog - a Qt object ultimately derived from QWidget. The actual layout and definition of the interface is entirely specified in the contents() method, and the accessors and mutators are also contained in this object. There is an associated creator object deriving from DtVrfTaskSetDialogCreator - in our case, DtSetSpeedAndHeadingDialogCreator - that is registered with the DtVrfTaskSetDialogManager in the constructor of the menu item (DtSetSpeedAndHeadingMenuItem).
The back-end set-creator function, DtSetSpeedAndHeadingRequest.creator(), is registered with the DtVrfSimMessager in the front-end plugin initialization, initDeModule. It links the back-end creator with the front-end via the common string DtSetSpeedAndHeadingString. In the back-end, the creator function is registered with the factory in DtInitializeVrfPlugin in addSetSim\plugin.cxx. The message sent through the DtSetSpeedAndHeadingRequest is passed on to the entity-specific controllers generated in the back-end.
Since this example is loaded as a plugin, it can be used in conjunction with the released VR-Forces application
This example demonstrates how to add a new kind of set data request (set heading and ordered speed).
To view the new behavior:
| DtSetSpeedAndHeadingMenuItem | The menu item that will register the dialog to be shown when this set is requested. |
| DtSetSpeedAndHeadingDialog | The Qt widget that generates the dialog box used to enter the speed and heading information. |
| DtSetSpeedAndHeadingRequest | The subclass of DtSetDataRequest that is used to communicate the new set request between the front-end and the back-end. |