VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Modify Task (modifyTask)

Table of Contents

The Modify Task example demonstrates the following:

Modifying Task Dialog

This example adds a new label to the dialog called "Modified By Example" to the Move To Waypoint... task in order to show how an existing dialog can be modified.

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 ground entity (e.g. M1A2 Abrams MBT) , and a Waypoint.
  4. Right click on the entity and select from the context menu the Task -> Movement -> Move to Waypoint... task.
  5. In the displayed Move To Waypoint... dialog, notice the "Modified By Example" label at the bottom, which was added by the example plugin.

Plugin Entry Points

/*******************************************************************************
** Copyright (c) 2011 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
//\file modifyTaskPlugin.cxx
//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 <vrvCore/DtDe.h>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLayout>
//Override of task move to dialog. Will show how to add a new UI element to the existing dialog
class MyTaskMoveToDialog : public makVrf::DtTaskMoveToDialog
{
public:
MyTaskMoveToDialog(makVrv::DtDe& de, QWidget* parent, const Qt::WindowFlags& flags = 0)
: makVrf::DtTaskMoveToDialog(de, parent, flags)
{
}
protected:
//Override the contents method, calling the parent method first to create the contents, then
//hide the movement box
virtual QWidget* contents(const std::vector<makVrv::DtSimEntry*>& data)
{
QWidget* canvas = makVrf::DtTaskMoveToDialog::contents(data);
QLabel* label = new QLabel(tr("Modified By Example"), canvas);
((QVBoxLayout*)canvas->layout())->insertWidget(2, label);
return canvas;
}
};
//Override of creator for task move to dialog. Will create new instance
//of the move to dialog
class MyTaskMoveToDialogCreator : public makVrf::DtTaskMoveToDialogCreator
{
public:
virtual makVrf::DtTaskSetDialogInterface* create(makVrv::DtDe& de, QWidget* parent)
{
return new MyTaskMoveToDialog(de, parent, theTaskSetCreationFlags);
}
};
{
//The DtVrfTaskSetDialogManager is the class that holds all the creators
//for task and set dialogs. Install an override creator here to create
//an instance of the move to dialog
//And add the new creator
manager.addTaskDialogCreator(DtTaskMoveToAction, new MyTaskMoveToDialogCreator);
return true;
}
{
info.pluginName = "Modify Task";
info.pluginDescription = "This example shows how to modify an existing task dialog (Move To Waypoint...) to add your own functionality.";
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 Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)