VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Add Object List Folder

Table of Contents

The Add ObjectList Folder example demonstrates the following:

The Add Object List Folder example is a simple example that shows how to add a new folder to the Simulation Object list and then to assign objects to this folder. The example will place Routes into this folder instead of under the Tactical Graphics folder.

It should be noted that you should only put unorganized objects into this folder. If organized objects (such as Tanks or Humans) are placed into this folder you will not be able to change their force by dragging/dropping to a new Force level folder. If you do try and organize Simulation Objects this way do be aware of the limitiations

Usage

Since this example is loaded as a plugin, it will need to be enabled in the Launcher. In the Launcher, click the Plug-ins button to bring up the Plug-ins Selection dialog. Enable the plugin. Then launch VR-Forces.

  1. Start vrfGui.
  2. Start vrfSim.
  3. Create a new scenario.
  4. Create a route.

The 'Simulation Object' panel will display the new Routes folder with the newly created route underneath it


Plugin Entry Points and Code

/*******************************************************************************
** Copyright (c) 2018 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
#include <QtWidgets/QTreeWidget>
#include <boost/bind.hpp>
using namespace makVrf;
using namespace makVrv;
// The force id that will be used to identify the route root node. This is needed to uniquely identify it and is based on
// the current user base
void SetupRouteRootNode(DtVrfOrganizedObjectListPageLogic* logic, DtDe* de)
{
DtVrfObjectListViewItem* item = logic->createRootNode(QObject::tr("Routes"), RouteForceRootNode);
// Set the icon
item->setIcon(0, QIcon(QString::fromStdString(de->dePathConfiguration().dataPath() + "/images/overlay/small/line.png")));
QFont f(item->font(0));
f.setBold(true);
// Hide until something is added to it
item->setFont(0, f);
// Cannot drop anything on this item, nor change it's name, nor drag it
item->setFlags(item->flags() & ~(Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled));
// Uncomment this line to have the item be initially collapsed
// item->setExpanded(false);
}
void FindRouteRootNode(DtElementEntry* element,
{
// If the state type is a route type then change the rootNode to be the root node of the route
if (DtEntityType(state->state().myEntityType.c_str()) == DtEntityType(17, 0, 0, 2, 0, 0, 0))
{
rootNode = logic->rootNodeForItem(RouteForceRootNode);
}
}
bool initDeModule(DtDe* de)
{
return true;
}
{
// Connect signals to set up the root node and to return it when a route is discovered
boost::bind(&SetupRouteRootNode, _1, &de));
boost::bind(&FindRouteRootNode, _1, _2, _3, _4, &de));
}
{
info.pluginName = "Add Object List Folder";
info.pluginDescription = "This example will show how to add a folder to the object list for organizing routes";
info.pluginVersion = "1.00";
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 Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)