VR-Forces 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 Along Route... 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 Along Route... task.
  5. In the displayed Move Along Route... 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 along route dialog. Will show how to add a new UI element to the existing dialog
class MyTaskMoveAlongRouteDialog : public makVrf::DtTaskMoveAlongRouteDialog
{
public:
MyTaskMoveAlongRouteDialog(makVrv::DtDe& de, QWidget* parent, const Qt::WindowFlags& flags = 0)
: makVrf::DtTaskMoveAlongRouteDialog(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::set<makVrv::DtUniqueID>& data) override
{
QLabel* label = new QLabel(tr("Modified By Example"), canvas);
((QVBoxLayout*)canvas->layout())->insertWidget(2, label);
return canvas;
}
};
//Override of creator for task move along route dialog. Will create new instance
//of the move along route dialog
class MyTaskMoveAlongRouteDialogCreator : public makVrf::DtTaskMoveAlongRouteDialogCreator
{
public:
virtual makVrf::DtTaskSetDialogInterface* create(makVrv::DtDe& de, QWidget* parent) override
{
return new MyTaskMoveAlongRouteDialog(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 along route dialog
//And add the new creator
manager.addTaskDialogCreator(DtTaskMoveAlongRouteAction, new MyTaskMoveAlongRouteDialogCreator);
return true;
}
{
info.pluginName = "Modify Task";
info.pluginDescription = "This example shows how to modify an existing task dialog (Move Along Route...) 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 Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)