VR-Forces 4.1.1 Class Documentation
Interface Manipulation

The Interface Manipulation example demonstrates the following:

The Interface Manipulation example creates a starting dialog that allows different options for the GUI to be entered into. One is the normal VRF GUI, one is a "Simple Scenario Player" that allows the user to load terrains or scenarios and observe them - but not interact with them. The other option created by this example is a "Simple Scenario Viewer" that allows the user only to observe simulation activity, but not to interact with it in any way.

/*******************************************************************************
** Copyright (c) 2012 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
//\file interfaceManipulationPluginInit.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 <QtGui/QApplication>
#include <QtGui/QDialog>
#include <QtGui/QLayout>
#include <QtGui/QPushButton>
#include <QtGui/QLabel>
#include <QtGui/QComboBox>
#include <boost/bind.hpp>
static int theUiType = 0;
void sessionStartupDialogLoadOnlyMode(makVrf::DtSessionStartupDialog* d)
{
}
//Finalize setup of items that can only be done after initialization
{
if (theUiType > 0)
{
//Disable the terrain context menu
if (theUiType == 3)
{
}
}
}
void createSimpleScenarioPlayer(makVrv::DtVrvApplication& app, makVrv::DtDe& de)
{
//Get rid of the auto hide panel. This allows users to create props and entities, which
//this example does not want
"DtAutoHidePanel", makVrv::DtUserInterfaceAssembler::instance(de).findWidgetBuilder("DtAutoHidePanel"));
//When the session startup dialog is created, manipulate to only allow the load scenario options
(boost::bind(&sessionStartupDialogLoadOnlyMode, _1));
//Disable all context menus
simplePlayer.addMenuPath(makVrv::DtMenuPath::mainMenu("DtFileMenu").item("DtOpenTerrainItem"));
simplePlayer.addMenuPath(makVrv::DtMenuPath::mainMenu("DtFileMenu").item("DtLoadScenarioMenuItem"));
simplePlayer.addMenuPath(makVrv::DtMenuPath::mainMenu("DtFileMenu").item("DtCloseScenarioMenuItem"));
simplePlayer.addMenuPath(makVrv::DtMenuPath::mainMenu("DtFileMenu").separator("DtScenarioSeparator"));
simplePlayer.addMenuPath(makVrv::DtMenuPath::mainMenu("DtFileMenu").item("DtExitItem"));
simplePlayer.addMenuPath(makVrv::DtMenuPath::mainMenu("DtViewMenu").item("DtFullScreenItem"));
simplePlayer.addMenuPath(makVrv::DtMenuPath::mainMenu("DtSimulationMenu"));
simplePlayer.addMenuPath(makVrv::DtMenuPath::mainMenu("DtSimulationMenu").item("DtRewindScenarioMenuItem"));
simplePlayer.addMenuPath(makVrv::DtMenuPath::mainMenu("DtSimulationMenu").item("DtPlayScenarioMenuItem"));
simplePlayer.addMenuPath(makVrv::DtMenuPath::mainMenu("DtSimulationMenu").item("DtPauseScenarioMenuItem"));
app.masterModeMenuConfiguration() = simplePlayer;
//Clear out all toolbars except for observer settings
toolbars.addToolbarPath(makVrv::DtToolbarPath::row("Top_Row").toolbar("DtObserverSettingsToolbar"));
toolbars.addToolbarPath(makVrv::DtToolbarPath::toolbar("DtObserverSettingsToolbar").widget("DtObserverSelectionWidget"));
toolbars.addToolbarPath(makVrv::DtToolbarPath::toolbar("DtObserverSettingsToolbar").widget("DtObserverModeSelectionWidget"));
toolbars.addToolbarPath(makVrv::DtToolbarPath::toolbar("DtObserverSettingsToolbar").separator("DtObserverSettingsToolbarSeparator"));
toolbars.addToolbarPath(makVrv::DtToolbarPath::toolbar("DtObserverSettingsToolbar").widget("DtSetModelSetToolButton"));
//Clear out page collections so there are no dock widgets
}
void createSimpleScenarioViewer(makVrv::DtVrvApplication& app, makVrv::DtDe& de)
{
//Get rid of the auto hide panel. This allows users to create props and entities, which
//this example does not want
"DtAutoHidePanel", makVrv::DtUserInterfaceAssembler::instance(de).findWidgetBuilder("DtAutoHidePanel"));
//Do not show session startup dialog
//Disable all context menus
simplePlayer.addMenuPath(makVrv::DtMenuPath::mainMenu("DtFileMenu").item("DtExitItem"));
simplePlayer.addMenuPath(makVrv::DtMenuPath::mainMenu("DtViewMenu").item("DtFullScreenItem"));
//Clear out all toolbars except for observer settings
toolbars.addToolbarPath(makVrv::DtToolbarPath::row("Top_Row").toolbar("DtObserverSettingsToolbar"));
toolbars.addToolbarPath(makVrv::DtToolbarPath::toolbar("DtObserverSettingsToolbar").widget("DtObserverSelectionWidget"));
toolbars.addToolbarPath(makVrv::DtToolbarPath::toolbar("DtObserverSettingsToolbar").widget("DtObserverModeSelectionWidget"));
toolbars.addToolbarPath(makVrv::DtToolbarPath::toolbar("DtObserverSettingsToolbar").separator("DtObserverSettingsToolbarSeparator"));
toolbars.addToolbarPath(makVrv::DtToolbarPath::toolbar("DtObserverSettingsToolbar").widget("DtSetModelSetToolButton"));
//Clear out the menus except exit and full screen
app.masterModeMenuConfiguration() = simplePlayer;
//Clear out page collections so there are no dock widgets
}
void showMapAreaOnly(makVrv::DtVrvApplication& app, makVrv::DtDe& de)
{
"DtAutoHidePanel", makVrv::DtUserInterfaceAssembler::instance(de).findWidgetBuilder("DtAutoHidePanel"));
app.masterModeMenuConfiguration() = simplePlayer;
}
void chooseInterface(makVrv::DtVrvApplication& app, makVrv::DtDe& de)
{
//Create the qApplication if it has not already been created
if (!qApp)
{
appProvider.qAppInstance();
}
//Put up a dialog to allow the user to choose an interface type. Default, Player or Viewer. The choice
//will then be used when the application is being initialized
QDialog* dlg = new QDialog(0, Qt::Tool);
QVBoxLayout* lay = new QVBoxLayout(dlg);
dlg->setWindowTitle("Select User Interface");
lay->setMargin(4);
lay->setSpacing(4);
QComboBox* combo = new QComboBox(dlg);
lay->addWidget(combo);
combo->addItem("Default");
combo->addItem("Simple Scenario Player");
combo->addItem("Simple Scenario Viewer");
combo->addItem("Map Area Only");
QSpacerItem* item = new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding);
QHBoxLayout* hLay = new QHBoxLayout;
hLay->setMargin(0);
hLay->setSpacing(0);
lay->addLayout(hLay);
hLay->addItem(item);
QPushButton* ok = new QPushButton("&OK", dlg);
QObject::connect(ok, SIGNAL(released()), dlg, SLOT(accept()));
hLay->addWidget(ok);
dlg->exec();
theUiType = combo->currentIndex();
if (combo->currentIndex() == 1)
{
createSimpleScenarioPlayer(app, de);
}
else if (combo->currentIndex() == 2)
{
createSimpleScenarioViewer(app, de);
}
else if (combo->currentIndex() == 3)
{
showMapAreaOnly(app, de);
}
delete dlg;
}
{
if(igApp)
{
chooseInterface(*igApp, *de);
return true;
}
else
{
return false;
}
}
{
info.pluginName = "Interface Manipulation";
info.pluginDescription = "This example shows how to manipulate the user interface.";
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 Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)