This is a HLA only example.
MC02 Talk Example
MC02 is an complex DDM extension to RPR which creates all sorts of regions for different types of entities. This is a talk program which uses a subset of the MC02 DDM standard to publish entities in a DDM area related to their force type instead of their geographic location, like the DDMTalk example. This program only works in HLA and is closely related to the Talk example.
MC02 Listen Example
MC02 is a complex DDM extension to RPR which creates all sorts of regions for different types of entities. MC02 Listen is exactly like Listen , but adds HLA MC02 DDM to the mix.
MC02 Talk-Listen Example Code
MC02 Talk Example Code
int main( int argc, char* argv[] )
{
appInit.setExecName("VR-LinkMC02");
appInit.setFedFileName("VR-LinkMC02.fed");
appInit.setUseAdvisories(false);
appInit.parseCmdLine();
try
{
blueRegion = baRegion;
baRegion->notifyRtiOfUpdate();
blueRegSet.insert(baRegion);
std::shared_ptr<DtRedAirRegion> raRegion(
new DtRedAirRegion(&exConn));
redRegion = raRegion;
raRegion->notifyRtiOfUpdate();
redRegSet.insert(raRegion);
}
{
DtWarn <<
"Caught exception: " << regionException << std::endl;
}
double refLongitude =
DtDeg2Rad(-121.326577);
DtTopoView blueTopoView(blueEsr, refLatitude, refLongitude);
DtTopoView redTopoView(redEsr, refLatitude, refLongitude);
while (simTime <= 10.0)
{
blueTopoView.setLocation(bluePosition);
redTopoView.setLocation(redPosition);
blueTopoView.setVelocity(velocity);
redTopoView.setVelocity(velocity);
bluePosition[0] += velocity[0] * dt;
redPosition[0] += velocity[0] * dt;
simTime += dt;
}
return 0;
}
MC02 Listen Example Code
#include <iostream>
int keybrdTick();
int main( int argc, char* argv[] )
{
appInit.setExecName("VR-LinkMC02");
appInit.setFedFileName("VR-LinkMC02.fed");
appInit.parseCmdLine();
try
{
baRegion->notifyRtiOfUpdate();
blueRegion = baRegion;
blueRegSet.insert(blueRegion);
}
{
DtWarn <<
"Caught exception: " << regionException << std::endl;
return 1;
}
int forever = 1;
while (forever)
{
if (keybrdTick() == -1)
break;
if (first)
{
double refLongitude =
DtDeg2Rad(-121.326577);
DtTopoView topoView(esr, refLatitude, refLongitude);
std::cout << "Position of first entity: "
<< topoView.location().string() << std::endl;
std::cout <<
"\tName: " << first->
globalId() << std::endl;
}
}
return 0;
}
int keybrdTick()
{
if (keyPtr && (*keyPtr == 'q' || *keyPtr == 'Q'))
return -1;
else
return 0;
}