VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Add Simulation Command (addSimCommandGui)

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.

DtVrfConditionalDialogManager::instance(*de).addConditionalExpressionBefore("DtNorthConditionalAction", "RANDOM", new vrfAddConditionalExample::DtNorthConditionalCreator);

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

How to Run the Example

Usage

In the Launcher, click the Plug-ins button to bring up the Plug-ins Selection dialog. Enable the plugin.

To view the new behavior:

  1. Start VR-Forces GUI and SIM.
  2. Create a new scenario - e.g. EntityLevel SMS on Ground_DB II terrain.
  3. Create a M1A2 entity.
  4. Right-click on entity and select 'Plan...'.
  5. In the 'Plan' dialog, select Commands -> My Sim Command Message... to bring up dialog for new command.
  6. In 'Simulation Command Message Example' dialog, type in an arbitrary message. It will get displayed in the entity's console window when the command is executed.
  7. Click OK to close the 'Simulation Command Message Example' dialog.
  8. Click OK to close the 'Plan' dialog for the entity.
  9. Right-click>Information on the entity to display its information window.
  10. Click on the 'play' button.
  11. Note that the text you typed in to the 'Simulation Command Message Example' dialog appears in the entity information window and 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;
{
simCommandMenu.menuConfiguration().addMenuPathAfter(makVrv::DtMenuPath::mainMenu(DtSimulationCommandMenuId).item("DtSimulationCommandMessageMenuItem"),
return true;
}
{
info.pluginName = "Add Sim Command Gui";
info.pluginVersion = "1.00";
info.pluginDescription = "Front-end plugin addition to add new Simulation command";
info.pluginCreator = "MAK Technologies";
info.pluginCreatorEmail = "sales@mak.com";
info.pluginContactWebPage = "www.mak.com";
info.pluginContactMailingAddress = "10 Fawcett Street, Suite 204, Cambridge, MA 02138 USA";
info.pluginContactPhone = "(617) 876 8085";
}

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)