The Add FOM Class GUI example demonstrates the following:
- How to build a plugin module for the VR-Forces Gui
- How to add new FOM object class that can be mapped to an existing object type supported by VR-Forces
- How to receive and process FOM attributes that cannot be mapped to existing object attributes in VR-Forces
- How to add new items to the entity Information dialog
The Add FOM Class example shows how to add a new FOM object class that is not part of the RPR FOM and is therefore not typically supported by VR-Forces. It shows how to map this new object class to an existing RPR-based object, assuming the concepts being simulated are similar, which can then be displayed in the GUI. It also shows how additional attributes that cannot be mapped can be received and displayed in the Information dialog. For more details on this example, please see the Add FOM Class Sim example plugin, which configures the sim to also publish and subscribe this object class.
This example creates a new accessory that is used to configure the VR-Link FOM mapper so that instances of the AlternateEntity FOM class can be decoded to an entity state repository, which is based on the RPR FOM entity classes. It also adds the AlternateEntity FOM class as a supported class of the DtExtendedPropertiesEntityPublisher and DtExtendedPropertiesEntityList classes in order to process additional FOM attributes as state properties.
This example then registers a new page data item to display the SomeOtherAttribute state property. This property is populated by updates to the attribute of the same name in the AlternateEntity object class. This page data item queries the state view of the DtVrfObjectDataState to get the latest state property values.
using namespace makVrv;
using namespace makVrf;
{
makVrfGuiObjectInformationQt::DtInformationDialogManager::instance(*de).informationPageConfiguration().
addPagePathBefore(DtInformationPagePath::page("DtEntityExpandedData.DtEntityInformationPage").informationItem("DtSomeOtherAttributePageItem"),
DtInformationPagePath::page("DtEntityExpandedData.DtEntityInformationPage").informationItem("DtEntityAcceleration"));
makVrfGuiObjectInformationQt::DtInformationDialogManager::instance(*de).informationPageAssembler().
return true;
}
{
info.
pluginDescription =
"Example on adding a new FOM class that maps to an entity.";
}
#include "../addFomClassSim/configFomMap.h"
#include <vrvVrl/DtEntityStateInterceptor.inl>
#include <boost/bind.hpp>
#include <iostream>
using namespace makVrv;
using namespace makVrf;
, myDriver(0)
{
#ifdef DtHLA
#ifdef DtHLA_1516
#ifdef DtHLA_1516_EVOLVED
myName="DtAddFomClassGuiHLA1516eAccessory";
#else
myName="DtAddFomClassGuiHLA1516Accessory";
#endif
#else
myName="DtAddFomClassGuiHLA13Accessory";
#endif
#endif
}
{
{
}
}
{
{
myDriver->signal_simulationCreated.connect(
}
}
{
{
myDriver->signal_simulationCreated.disconnect(
if (vrlCon)
{
}
}
}
{
if(dd)
{
return true;
}
return false;
}
{
if (vrlCon)
{
}
}
{
if (vrlCon)
{
}
}
using namespace makVrf;
{
}
{
return "DtSomeOtherAttributePageItem";
}
{
if (objDataView)
{
if (someOtherAttr)
{
boost::optional<double> field1 =
boost::optional<int> field2 =
if (field1 && field2)
{
return (QString::number(*field1) + " | " + QString::number(*field2));
}
}
}
return "";
}
{
return QObject::tr("Some Other Attribute");
}