VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F18 Initialization Class

The DtF18Initializer class is a subclass of VR-Link's DtVrlApplicationInitializer.

This class processes the command line and reads the F18's mtl file.


Header file:

/*******************************************************************************
** Copyright (c) 1992-2010 VT MAK
** All rights reserved.
*******************************************************************************/
#pragma once
{
public:
DtF18Initializer(int argc, char* argv[], DtString AppName);
virtual ~DtF18Initializer();
private:
public:
virtual void parseCmdLine();
virtual void initializeMtlParams();
virtual void setInitialPosition(const DtVector& loc);
virtual DtVector initialPosition() const;
virtual void setLispFileName(const DtString& name);
virtual DtString lispFileName() const;
virtual void setDeadReckonAlgorithm(unsigned long alg);
virtual unsigned long deadReckonAlgorithm() const;
virtual void setInitialTurnRadius(double radius);
virtual double initialTurnRadius() const;
virtual void setInitialSpeed(double speed);
virtual double initialSpeed() const;
virtual void setEntityTypeStr(const DtString& type);
virtual DtString entityTypeStr() const;
virtual void setF18Markings(const DtString& markings);
virtual DtString f18Markings() const;
virtual void setF18Name(const DtString& name);
virtual DtString f18Name() const;
virtual void setDestroyedToFinalDelay(double delay);
virtual double destroyedToFinalDelay() const;
virtual void setInitialHeading(double heading);
virtual double initialHeading() const;
virtual void setLethalDetonationRange(double range);
virtual double lethalDetonationRange() const;
virtual void setMunitionFlightTime(double time);
virtual double munitionFlightTime() const;
virtual void setInitialPitch(double pitch);
virtual double initialPitch() const;
virtual void setInitialRoll(double roll);
virtual double initialRoll() const;
virtual void setAutoRoll(bool onOff);
virtual bool autoRoll() const;
virtual void setEntityNumber(int number);
virtual int entityNumber() const;
virtual void setHaveArtParts(bool onOff);
virtual bool haveArtParts() const;
virtual void setDeltaTime(DtTime time);
virtual DtTime deltaTime() const;
#ifdef DtHLA_1516_EVOLVED
virtual void setSuppressDefaultModules(bool onOff);
virtual bool suppressDefaultModules();
#endif
virtual void setRefLatitude(double lat);
virtual double refLatitude() const;
virtual void setRefLongitude(double lon);
virtual double refLongitude() const;
#if DtHLA
virtual void setApplicationNumber(int num);
virtual int applicationNumber() const;
virtual void setSiteId(int id);
virtual int siteId() const;
#endif
protected:
virtual void loadMtlFile(const DtString& fileName);
protected:
#ifdef DtHLA_1516_EVOLVED
DtConfigVariable<bool> mySuppressDefaultModules;
#endif
#if DtHLA
#endif
};

Implementation:

/****************************************************************************
* Copyright (c) 2015 VT MAK
* All rights reserved.
****************************************************************************/
#include "f18Init.h"
#include <vlpi/disEnums.h>
#include <stdio.h>
// Constructor -- Initialize the base class (will initialize protocol-specific
// parameters), command line arguments and mtl parameters
DtF18Initializer::DtF18Initializer( int argc, char* argv[], DtString appName )
: DtVrlApplicationInitializer( argc, argv, appName )
, myInitialPosition( mySettings, "initialPosition", DtVector(0.0,0.0,-1230.0),
"Initial Location", DtBaseConfigVariable::DtScopeBoth, false, "L" )
, myLispFileName( mySettings, "&lispFile", "f18.xml", "LISP File Name" )
, myDeadReckonAlgorithm( mySettings, "deadReckonAlgorithm", DtDrDrmRvw, "Dead Reckon Algorithm",
DtBaseConfigVariable::DtScopeBoth, false, "D" )
, myInitialTurnRadius( mySettings, "initialTRadius", -250.0, "Initial Turn Radius",
DtBaseConfigVariable::DtScopeBoth, false, "r" )
, myInitialSpeed( mySettings, "initialSpeed", 40.0, "Initial Speed" )
, myEntityTypeString( mySettings, "entity&TypeStr", "1:2:225:1:9:0:0", "Entity Type String" )
, myMarkings( mySettings, "f18&Markings", "MAK-VRLink-F18", "F18 Markings" )
, myName( mySettings, "f18Name", "MaK-F18", "F18 Object Name" )
, myDestroyedToFinalDelay( mySettings, "&destroyedToFinalDelay", 20.0,
"Destroyed To Final Delay" )
, myInitialHeading( mySettings, "initial&Heading", 180.0, "Initial Heading" )
, myTopoOrigin( mySettings, "topo&Origin", "35.699760,-121.326577",
"Topographic Coordinate System Origin" )
, myWorldPosition( mySettings, "worldPos", DtVector(0.0,0.0,0.0),
"Initial Position in Geocentric Coordinates", DtBaseConfigVariable::DtScopeBoth, false, "W" )
, myLethalDetonationRange( mySettings, "lethalDetonationRange", 20.0, "Lethal Detonation Range",
DtBaseConfigVariable::DtScopeConfigFile )
, myMunitionFlightTime( mySettings, "munitionFlightTime", 3.0, "Munition Flight Time",
DtBaseConfigVariable::DtScopeConfigFile )
, myInitialPitch( mySettings, "initialPitch", 0.0, "Initial Pitch",
DtBaseConfigVariable::DtScopeConfigFile )
, myInitialRoll( mySettings, "initialRoll", 0.0, "Initial Roll",
DtBaseConfigVariable::DtScopeConfigFile )
, myAutoRoll( mySettings, "autoRoll", true, "Auto Roll",
DtBaseConfigVariable::DtScopeConfigFile )
, myEntityNumber( mySettings, "entNum", 1, "Entity Number",
DtBaseConfigVariable::DtScopeConfigFile )
, myHaveArtParts( mySettings, "haveArtParts", false, "Have Articulated Parts",
DtBaseConfigVariable::DtScopeConfigFile )
, myRefLatitude( mySettings, "refLatitude", 35.699760, "Reference Latitude",
DtBaseConfigVariable::DtScopeConfigFile )
, myRefLongitude( mySettings, "refLongitude", -121.326577, "Reference Longitude",
DtBaseConfigVariable::DtScopeConfigFile )
, myDeltaTime( mySettings, "deltaTime", 0.05, "Delta Time",
DtBaseConfigVariable::DtScopeConfigFile )
#ifdef DtHLA_1516_EVOLVED
, mySuppressDefaultModules( mySettings, "suppressDefaultModules", false, "Suppress Default Modules (HLA1516-2010 only)",
DtBaseConfigVariable::DtScopeBoth )
#endif
, myMtlAutoRoll( 1 )
#if DtHLA
, myConfigVarApplicationNumber(mySettings, "&appNumber", 2, "Application Number")
, mySiteId(mySettings, "&siteId", 1, "Site ID")
#endif
, myMtlHaveArtParts( 0 )
, myMtlInitialPosition( 0.0, 0.0, -1230.0 )
{
mySettings.setChangeOnce(true);
}
{
}
{
//myMtlEnv->registerConfigVar( mySuppressDefaultModules );
myMtlEnv->registerVar( "haveArtParts", &myMtlHaveArtParts );
myMtlEnv->registerVar( "initialPos[0]", &myMtlInitialPosition[0] );
myMtlEnv->registerVar( "initialPos[1]", &myMtlInitialPosition[1] );
myMtlEnv->registerVar( "initialPos[2]", &myMtlInitialPosition[2] );
#if DtHLA
#endif
}
// Parses the command line
{
// Note that we're manually parsing the command line here in order to
// see whether a file has been specified. This is due to the support of
// MTL files. If the command line is parsed, and then an MTL file is loaded,
// the command line values will be overridden. This is not the case with XML.
// As long as "changeOnce" is set to true on the application settings object,
// values can only be changed once. In other words, if the command line is parsed,
// and values are set, and a file is then loaded, the values set by the command
// line will not be overridden. This is not the case with MTL yet.
for ( int index = 1; index < myArgc; ++index )
{
if ( ! strcmp(myArgv[index],"-l") || ! strcmp(myArgv[index],"--lispFile") )
{
if ( index + 1 < myArgc )
{
break;
}
}
}
if ( myInitialPosition.isSet() )
{
// NOTE: only -L specifies X, Y, and -Z (north, east, and up)
// All local positions are north, east, down [not up]
DtVector posVec = myInitialPosition.value();
posVec[2] = -posVec[2];
myInitialPosition.setValue( posVec );
}
{
double refLat = myRefLatitude.defaultValue();
double refLon = myRefLongitude.defaultValue();
int numReads = sscanf( myTopoOrigin.value().c_str(), "%lf,%lf", &refLat, &refLon );
if ( numReads > 0 )
{
if ( numReads > 1 )
{
}
}
}
if ( myWorldPosition.isSet() )
{
DtGeodeticCoord initPos;
initPos.setGeocentric( myWorldPosition.value() );
}
}
//--------------------------------------------------------------
// ACCESSORS/MODIFIERS
// Provide a way to inspect/modify the data
//--------------------------------------------------------------
{
myInitialPosition.setValue( loc );
}
{
return myInitialPosition.value();
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
myMarkings.setValue( markings );
}
{
return myMarkings.value();
}
{
myName.setValue( name );
}
{
return myName.value();
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
return myInitialRoll.value();
}
{
myAutoRoll.setValue( onOff );
}
{
return myAutoRoll.value();
}
{
}
{
}
{
}
{
return myRefLatitude.value();
}
{
}
{
}
{
}
{
}
{
}
{
return myDeltaTime.value();
}
#ifdef DtHLA_1516_EVOLVED
void DtF18Initializer::setSuppressDefaultModules(bool onOff)
{
mySuppressDefaultModules.setValue(onOff);
}
bool DtF18Initializer::suppressDefaultModules()
{
return mySuppressDefaultModules.value();
}
#endif
void DtF18Initializer::loadMtlFile( const DtString& fileName )
{
}
#if DtHLA
{
}
{
}
{
mySiteId.setValue( id );
}
{
return mySiteId.value();
}
#endif

Document ID: Generated on Mon Apr 25 03:39:01 EDT 2022 from SVN revision 242502
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)