VR-Forces 4.2 Class Documentation
Add Simulation Command

Table of Contents

The Add Simulation Command adds a new simulation command which will send a message to the back-end that will simply print a console message.

The example is intended to demonstrate the following:

Adding a New Menu Item to the Condition Menu

Registering a new sim command item in the menu requires deriving a new class from makVrf::DtVrfSimulationCommand, configuring its key methods, and then registering the creator function in the makVrf::DtSimulationCommandMenu. Our command dialog creator class is called vrfAddSimCommandExample::DtSimulationCommandMessageCreator. The key methods of makVrf::DtVrfSimulationCommandDialogCreator that must be customized are:

makVrf::DtVrfSimulationCommandDialogCreator::create() Adds a new dialog object to the heap (vrfAddSimCommandExample::DtSimulationCommandMessageDialog in this example) and returns its pointer
makVrf::DtVrfSimulationCommandDialogCreator::supportsType() Checks message against this dialog's task type.
makVrf::DtVrfSimulationCommandDialogCreator::objectNameFromStatement() Returns empty name.

The makVrf::DtVrfConditionalExpressionCreator class must be then registered with the dialog manager makVrf::DtVrfConditionalDialogManager. In our example, we register it in /examples/condition/conditionGui/addConditionPlugin.cxx.

this particular implementation inserts our menu item just before a menu item in the conditional combo box called "RANDOM"

Since this example is loaded as a plugin, it can be used in conjunction with the released VR-Forces 3D application

To view the new behavior:

  1. Create a new scenario.
  2. Create a M1A2 entity.
  3. Right-click on entity and select 'Plan...'.
  4. In the 'Plan' dialog, select Commands->My Sim Command Message... to bring up dialog for new command.
  5. In 'Simulation Command Message Example' window, type in an arbitrary message. This message will be displayed in the entity's console window when the command is executed.
  6. Click OK in the 'Simulation Command Message Example' window.
  7. Click OK in the 'Plan' dialog for the entity.
  8. Right-click > Information... on the entity to display its information window.
  9. Click on the 'play' button. The Simulation Command Message should display in the information pane.

Note that the text you typed in to the 'My Sim Command' window also appears in the back-end console, prefaced by the name of the entity.

Classes

DtSimulationCommandMessageActionThe menu item that registers the dialog to be created when the menu item is selected.
DtSimulationCommandMessageDialogThe widget that is used to enter the message to print in the back-end console.
DtSimulationCommandMessageLogicThe logic that is used to enter the message to print in the back-end console.
MySimCommandThe subclass of DtSimCommand that is used to communicate the new simulation command.

Plugin Entry Points

/*******************************************************************************
** Copyright (c) 2011 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
//\file addSimCommandPlugin.cxx
//\brief Contains plugin function
//This file defines the generic DT_DLL_VRF_PLUGIN_EXPORT_MACRO. Use that macro when
//you want to export symbols. Also, in your CMakeLists.txt file, make sure to
//define the VRFPLUGIN_EXPORTS define to tell the compiler to define the macro as an
//export
#include "../addSimCommandSim/mySimCommand.h"
#include <vrvCore/DtDe.h>
using namespace makVrf;
bool initDeModule(makVrv::DtDe* de)
{
simCommandMenu.menuConfiguration().addMenuPathAfter(makVrv::DtMenuPath::mainMenu(DtSimulationCommandMenuId).item("DtSimulationCommandMessageMenuItem"),
makVrv::DtMenuPath::mainMenu(DtSimulationCommandMenuId).item(DtSimulationCommandDeleteId));
return true;
}
{
info.pluginName = "Add Sim Command Gui";
info.pluginVersion = "1.00";
info.pluginDescription = "Front-end plugin addition to add new Simluation command";
info.pluginCreator = "MAK Technologies";
info.pluginCreatorEmail = "sales@mak.com";
info.pluginContactWebPage = "www.mak.com";
info.pluginContactMailingAddress = "150 Cambridge Park Drive 3rd Floor - Cambridge, MA 02140 USA";
info.pluginContactPhone = "(617) 876 8085";
}

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)