VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Unit Status (unitStatus)

The Unit Status example demonstrates the following:

The Unit Status example demonstrates how to add a new panel to the application and to display information in that panel about an item that is selected on the terrain map.

The example supplies a .ui file that shows how to create a dialog box using Qt Designer and how that .ui file translates itself into a .cpp and .h file that can be subclassed and extended for use in the VR-Forces GUI.

Using the Qt connection call, the panel connects to functions that send out updates when an entity is updated. This shows how user interface objects can have their states change when some aspect of an entity changes.

Usage

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

To view the new behavior:

  1. Start vrfGui.
  2. Start vrfSim.
  3. Create a new scenario.
  4. Create a tank.
  5. Click on tank to select it.

The 'Unit Status' panel will display information about the currently selected entity.

Classes

DtUnitStatusThe toolbar widget that displays information about the currently selected unit.
DtUnitStatusLogicThe logic for setting the information into the widget.

Plugin Entry Points

/*******************************************************************************
** Copyright (c) 2011 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
//\file unitStatusPlugin.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 "DtUnitStatus.h"
//VR-Vantage includes
using namespace makVrf;
{
//If the configuration for the panel already exists, this means that the
//display configuration file was saved with this plugin active. In this case,
//leave the panel where the display configuration file says. This will be
//where the user had it when they closed the app.
"DtUnitStatusPanel"))
{
//If it was not in the configuration, make a new dockable panel, and start it on
//the left side dock area.
configuration.myPageConfiguration.addPageCollection("DtUnitStatusPanel",
//Add the widget to that panel.
makVrv::DtPagePath::collection("DtUnitStatusPanel").page("DtUnitStatus"));
}
state->myDockedGeometry.myTop = 1000;
}
{
//Register new widget with the system so that it can be created.
//NOTE: This does not actually display the widget anywhere.
//Add the widget to the display configuration so that it will be displayed.
//Each page must be on a panel, so in this case we add a panel that will
//contain only this page.
if(igApp)
{
//If the configuration for the panel already exists, this means that the
//display configuration file was saved with this plugin active. In this case,
//leave the panel where the display configuration file says. This will be
//where the user had it when they closed the app.
"DtUnitStatusPanel"))
{
//If it was not in the configuration, make a new dockable panel, and start it on
//the left side dock area.
igApp->masterModePageConfiguration().addPageCollection("DtUnitStatusPanel",
//Add the widget to that panel.
makVrv::DtPagePath::collection("DtUnitStatusPanel").page("DtUnitStatus"));
}
// Since we want this page to be shown for whatever configuration is made current, connect to the layout
// manager's signal for a layout to be realized so this can be added to it
// Connect to pre-assemble message to add this right before assembly (to be shown)
makVrv::DtMenuPath::mainMenu(DtViewMenuId).item("DtUnitStatusPanel"),
makVrv::DtMenuPath::mainMenu(DtViewMenuId).item("DtTerrainPanel"));
}
return true;
}
{
info.pluginName = "unitStatus";
info.pluginDescription = "This example shows how to add a new panel";
info.pluginVersion = "1.00";
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 Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)