Add --carrier-position command line argument
Takes special values "FLOLS" and "abeam" to set up aligned for final approach or at the 180 for the carrier flight deck. Or alternatively a catapult or parking position.
This commit is contained in:
parent
faee5dbabf
commit
52a6245b49
5 changed files with 128 additions and 87 deletions
|
@ -148,7 +148,7 @@ void LauncherArgumentTokenizer::setArgString(QString argString)
|
||||||
|
|
||||||
const std::set<std::string> positionalArgs({
|
const std::set<std::string> positionalArgs({
|
||||||
"lat", "lon", "vor", "ndb", "fix"
|
"lat", "lon", "vor", "ndb", "fix"
|
||||||
"airport", "parkpos", "runway", "carrier"
|
"airport", "parking-id", "runway", "carrier", "carrier-position"
|
||||||
});
|
});
|
||||||
|
|
||||||
bool LauncherArgumentTokenizer::haveArgsIn(const std::set<std::string>& args) const
|
bool LauncherArgumentTokenizer::haveArgsIn(const std::set<std::string>& args) const
|
||||||
|
|
|
@ -687,7 +687,7 @@ void LocationController::setLocationProperties()
|
||||||
"runway-requested" << "navaid-id" << "offset-azimuth-deg" <<
|
"runway-requested" << "navaid-id" << "offset-azimuth-deg" <<
|
||||||
"offset-distance-nm" << "glideslope-deg" <<
|
"offset-distance-nm" << "glideslope-deg" <<
|
||||||
"speed-set" << "on-ground" << "airspeed-kt" <<
|
"speed-set" << "on-ground" << "airspeed-kt" <<
|
||||||
"airport-id" << "runway" << "parkpos" << "carrier" << "abeam";
|
"airport-id" << "runway" << "parkpos" << "carrier" << "carrier-position";
|
||||||
|
|
||||||
Q_FOREACH(QString s, props) {
|
Q_FOREACH(QString s, props) {
|
||||||
SGPropertyNode* c = presets->getChild(s.toStdString());
|
SGPropertyNode* c = presets->getChild(s.toStdString());
|
||||||
|
@ -717,15 +717,16 @@ void LocationController::setLocationProperties()
|
||||||
fgSetString("/sim/presets/carrier", m_carrierName.toStdString());
|
fgSetString("/sim/presets/carrier", m_carrierName.toStdString());
|
||||||
|
|
||||||
if (m_useCarrierFLOLS) {
|
if (m_useCarrierFLOLS) {
|
||||||
fgSetBool("/sim/presets/runway-requested", true );
|
if (m_abeam) {
|
||||||
// treat the FLOLS as a runway, for the purposes of communication with position-init
|
fgSetString("/sim/presets/carrier-position", "abeam");
|
||||||
fgSetString("/sim/presets/runway", "FLOLS");
|
} else {
|
||||||
|
fgSetString("/sim/presets/carrier-position", "FLOLS");
|
||||||
|
}
|
||||||
fgSetDouble("/sim/presets/offset-distance-nm", m_offsetDistance.convertToUnit(Units::NauticalMiles).value);
|
fgSetDouble("/sim/presets/offset-distance-nm", m_offsetDistance.convertToUnit(Units::NauticalMiles).value);
|
||||||
fgSetBool("/sim/presets/abeam", m_abeam);
|
|
||||||
applyAltitude();
|
applyAltitude();
|
||||||
applyAirspeed();
|
applyAirspeed();
|
||||||
} else if (!m_carrierParking.isEmpty()) {
|
} else if (!m_carrierParking.isEmpty()) {
|
||||||
fgSetString("/sim/presets/parkpos", m_carrierParking.toStdString());
|
fgSetString("/sim/presets/carrier-position", m_carrierParking.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_tuneNAV1) {
|
if (m_tuneNAV1) {
|
||||||
|
@ -924,13 +925,16 @@ void LocationController::onCollectConfig()
|
||||||
m_config->setArg("carrier", m_carrierName);
|
m_config->setArg("carrier", m_carrierName);
|
||||||
|
|
||||||
if (!m_carrierParking.isEmpty()) {
|
if (!m_carrierParking.isEmpty()) {
|
||||||
m_config->setArg("parkpos", m_carrierParking);
|
m_config->setArg("carrier-position", m_carrierParking);
|
||||||
} else if (m_useCarrierFLOLS) {
|
} else if (m_useCarrierFLOLS) {
|
||||||
m_config->setArg("runway", QStringLiteral("FLOLS"));
|
if (m_abeam) {
|
||||||
|
m_config->setArg("carrier-position", QStringLiteral("abeam"));
|
||||||
|
} else {
|
||||||
|
m_config->setArg("carrier-position", QStringLiteral("FLOLS"));
|
||||||
|
}
|
||||||
const double offsetNm = m_offsetDistance.convertToUnit(Units::NauticalMiles).value;
|
const double offsetNm = m_offsetDistance.convertToUnit(Units::NauticalMiles).value;
|
||||||
m_config->setArg("offset-distance", QString::number(offsetNm));
|
m_config->setArg("offset-distance", QString::number(offsetNm));
|
||||||
|
|
||||||
if (m_abeam) m_config->setArg("carrier-abeam", QStringLiteral("true"));
|
|
||||||
applyAltitude();
|
applyAltitude();
|
||||||
applyAirspeed();
|
applyAirspeed();
|
||||||
}
|
}
|
||||||
|
@ -951,7 +955,7 @@ void LocationController::onCollectConfig()
|
||||||
// pick by default
|
// pick by default
|
||||||
applyOnFinal();
|
applyOnFinal();
|
||||||
} else if (m_useAvailableParking) {
|
} else if (m_useAvailableParking) {
|
||||||
m_config->setArg("parkpos", QStringLiteral("AVAILABLE"));
|
m_config->setArg("parking-id", QStringLiteral("AVAILABLE"));
|
||||||
} else if (onRunway) {
|
} else if (onRunway) {
|
||||||
if (m_airportLocation->type() == FGPositioned::AIRPORT) {
|
if (m_airportLocation->type() == FGPositioned::AIRPORT) {
|
||||||
m_config->setArg("runway", QString::fromStdString(m_detailLocation->ident()));
|
m_config->setArg("runway", QString::fromStdString(m_detailLocation->ident()));
|
||||||
|
@ -969,7 +973,7 @@ void LocationController::onCollectConfig()
|
||||||
}
|
}
|
||||||
} else if (atParking) {
|
} else if (atParking) {
|
||||||
// parking selection
|
// parking selection
|
||||||
m_config->setArg("parkpos", QString::fromStdString(m_detailLocation->ident()));
|
m_config->setArg("parking-id", QString::fromStdString(m_detailLocation->ident()));
|
||||||
}
|
}
|
||||||
// of location is an airport
|
// of location is an airport
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -63,7 +63,7 @@ Item {
|
||||||
Column {
|
Column {
|
||||||
id: selectionGrid
|
id: selectionGrid
|
||||||
spacing: Style.margin
|
spacing: Style.margin
|
||||||
width: parent.width
|
width: parent.width * 0.3
|
||||||
|
|
||||||
StyledText { // heading text
|
StyledText { // heading text
|
||||||
id: headingText
|
id: headingText
|
||||||
|
@ -103,8 +103,6 @@ Item {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
enabled: flolsRadio.selected
|
enabled: flolsRadio.selected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Abeam the FLOLS
|
// Abeam the FLOLS
|
||||||
|
@ -132,70 +130,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Offset selection
|
|
||||||
readonly property bool offsetEnabled: (flolsRadio.selected || abeamRadio.selected)
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Style.margin
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: Style.margin
|
|
||||||
spacing: Style.margin
|
|
||||||
|
|
||||||
Item {
|
|
||||||
height: 1; width: Style.strutSize
|
|
||||||
}
|
|
||||||
|
|
||||||
NumericalEdit {
|
|
||||||
id: offsetNmEdit
|
|
||||||
quantity: _location.offsetDistance
|
|
||||||
onCommit: _location.offsetDistance = newValue;
|
|
||||||
label: qsTr("at")
|
|
||||||
unitsMode: Units.Distance
|
|
||||||
live: true
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
enabled: selectionGrid.offsetEnabled
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: qsTr(" from the FLOLS (aka the ball)")
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
enabled: selectionGrid.offsetEnabled
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
height: 1; width: Style.strutSize
|
|
||||||
}
|
|
||||||
|
|
||||||
ToggleSwitch {
|
|
||||||
id: airspeedToggle
|
|
||||||
enabled: selectionGrid.offsetEnabled
|
|
||||||
checked: _location.speedEnabled
|
|
||||||
onCheckedChanged: _location.speedEnabled = checked;
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
NumericalEdit {
|
|
||||||
id: airspeedSpinbox
|
|
||||||
label: qsTr("Airspeed:")
|
|
||||||
unitsMode: Units.SpeedWithoutMach
|
|
||||||
enabled: _location.speedEnabled && selectionGrid.offsetEnabled
|
|
||||||
quantity: _location.airspeed
|
|
||||||
onCommit: _location.airspeed = newValue
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
height: 1; width: Style.strutSize
|
|
||||||
}
|
|
||||||
|
|
||||||
LocationAltitudeRow
|
|
||||||
{
|
|
||||||
enabled: selectionGrid.offsetEnabled
|
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
|
|
||||||
} // of Offset selection
|
|
||||||
|
|
||||||
// parking row
|
// parking row
|
||||||
Row {
|
Row {
|
||||||
|
@ -213,7 +147,11 @@ Item {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
group: radioGroup
|
group: radioGroup
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (selected) parkingChoice.setLocation();
|
if (selected) {
|
||||||
|
parkingChoice.setLocation();
|
||||||
|
_location.useCarrierFLOLS = false;
|
||||||
|
_location.abeam = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
selected : (! _location.abeam) && (! _location.useCarrierFLOLS)
|
selected : (! _location.abeam) && (! _location.useCarrierFLOLS)
|
||||||
}
|
}
|
||||||
|
@ -256,9 +194,85 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: offsetGrid
|
||||||
|
spacing: Style.margin
|
||||||
|
anchors.leftMargin: Style.margin
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Style.margin
|
||||||
|
width: parent.width * 0.7
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
// Offset selection
|
||||||
|
readonly property bool offsetEnabled: (flolsRadio.selected || abeamRadio.selected)
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Style.margin
|
||||||
|
anchors.rightMargin: Style.margin
|
||||||
|
width : parent.width * 0.7
|
||||||
|
|
||||||
|
NumericalEdit {
|
||||||
|
id: offsetNmEdit
|
||||||
|
quantity: _location.offsetDistance
|
||||||
|
onCommit: _location.offsetDistance = newValue;
|
||||||
|
label: qsTr("at")
|
||||||
|
unitsMode: Units.Distance
|
||||||
|
live: true
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
enabled: offsetGrid.offsetEnabled
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: qsTr(" from the FLOLS (aka the ball)")
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
enabled: offsetGrid.offsetEnabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Style.margin
|
||||||
|
anchors.rightMargin: Style.margin
|
||||||
|
width : parent.width * 0.7
|
||||||
|
|
||||||
|
ToggleSwitch {
|
||||||
|
id: airspeedToggle
|
||||||
|
enabled: offsetGrid.offsetEnabled
|
||||||
|
checked: _location.speedEnabled
|
||||||
|
onCheckedChanged: _location.speedEnabled = checked;
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
NumericalEdit {
|
||||||
|
id: airspeedSpinbox
|
||||||
|
label: qsTr("Airspeed:")
|
||||||
|
unitsMode: Units.SpeedWithoutMach
|
||||||
|
enabled: _location.speedEnabled && offsetGrid.offsetEnabled
|
||||||
|
quantity: _location.airspeed
|
||||||
|
onCommit: _location.airspeed = newValue
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
height: 1; width: Style.strutSize
|
||||||
|
}
|
||||||
|
|
||||||
|
LocationAltitudeRow
|
||||||
|
{
|
||||||
|
enabled: offsetGrid.offsetEnabled
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
|
||||||
|
} // of Offset selection
|
||||||
|
|
||||||
ToggleSwitch {
|
ToggleSwitch {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
anchors.leftMargin: Style.margin
|
anchors.leftMargin: Style.margin
|
||||||
label: qsTr("Tune navigation radio (TACAN) to carrier")
|
label: qsTr("Tune navigation radio (TACAN) to carrier")
|
||||||
checked: _location.tuneNAV1
|
checked: _location.tuneNAV1
|
||||||
|
|
|
@ -698,6 +698,7 @@ clearLocation ()
|
||||||
fgSetString("/sim/presets/ndb-id", "");
|
fgSetString("/sim/presets/ndb-id", "");
|
||||||
fgSetString("/sim/presets/carrier", "");
|
fgSetString("/sim/presets/carrier", "");
|
||||||
fgSetString("/sim/presets/parkpos", "");
|
fgSetString("/sim/presets/parkpos", "");
|
||||||
|
fgSetString("/sim/presets/carrier-position", "");
|
||||||
fgSetString("/sim/presets/fix", "");
|
fgSetString("/sim/presets/fix", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,6 +757,13 @@ fgOptCarrier( const char * arg )
|
||||||
return FG_OPTIONS_OK;
|
return FG_OPTIONS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
fgOptCarrierPos( const char * arg )
|
||||||
|
{
|
||||||
|
fgSetString("/sim/presets/carrier-position", arg);
|
||||||
|
return FG_OPTIONS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fgOptParkpos( const char * arg )
|
fgOptParkpos( const char * arg )
|
||||||
{
|
{
|
||||||
|
@ -1679,8 +1687,7 @@ struct OptionDesc {
|
||||||
{"ndb", true, OPTION_FUNC, "", false, "", fgOptNDB },
|
{"ndb", true, OPTION_FUNC, "", false, "", fgOptNDB },
|
||||||
{"ndb-frequency", true, OPTION_DOUBLE, "/sim/presets/ndb-freq", false, "", fgOptVOR },
|
{"ndb-frequency", true, OPTION_DOUBLE, "/sim/presets/ndb-freq", false, "", fgOptVOR },
|
||||||
{"carrier", true, OPTION_FUNC, "", false, "", fgOptCarrier },
|
{"carrier", true, OPTION_FUNC, "", false, "", fgOptCarrier },
|
||||||
{"carrier-abeam", true, OPTION_BOOL, "/sim/presets/carrier-abeam", true, "", 0 },
|
{"carrier-position", true, OPTION_FUNC, "", false, "", fgOptCarrierPos },
|
||||||
{"parkpos", true, OPTION_FUNC, "", false, "", fgOptParkpos },
|
|
||||||
{"fix", true, OPTION_FUNC, "", false, "", fgOptFIX },
|
{"fix", true, OPTION_FUNC, "", false, "", fgOptFIX },
|
||||||
{"offset-distance", true, OPTION_DOUBLE, "/sim/presets/offset-distance-nm", false, "", 0 },
|
{"offset-distance", true, OPTION_DOUBLE, "/sim/presets/offset-distance-nm", false, "", 0 },
|
||||||
{"offset-azimuth", true, OPTION_DOUBLE, "/sim/presets/offset-azimuth-deg", false, "", 0 },
|
{"offset-azimuth", true, OPTION_DOUBLE, "/sim/presets/offset-azimuth-deg", false, "", 0 },
|
||||||
|
@ -1839,6 +1846,7 @@ struct OptionDesc {
|
||||||
{"livery", true, OPTION_FUNC, "", false, "", fgOptLivery },
|
{"livery", true, OPTION_FUNC, "", false, "", fgOptLivery },
|
||||||
{"ai-scenario", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptScenario },
|
{"ai-scenario", true, OPTION_FUNC | OPTION_MULTI, "", false, "", fgOptScenario },
|
||||||
{"parking-id", true, OPTION_FUNC, "", false, "", fgOptParkpos },
|
{"parking-id", true, OPTION_FUNC, "", false, "", fgOptParkpos },
|
||||||
|
{"parkpos", true, OPTION_FUNC, "", false, "", fgOptParkpos },
|
||||||
{"version", false, OPTION_IGNORE, "", false, "", 0 },
|
{"version", false, OPTION_IGNORE, "", false, "", 0 },
|
||||||
{"json-report", false, OPTION_IGNORE, "", false, "", 0 },
|
{"json-report", false, OPTION_IGNORE, "", false, "", 0 },
|
||||||
{"enable-fpe", false, OPTION_IGNORE, "", false, "", 0},
|
{"enable-fpe", false, OPTION_IGNORE, "", false, "", 0},
|
||||||
|
|
|
@ -836,20 +836,35 @@ void finalizePosition()
|
||||||
* carrier, recalculate the 'initial' position here
|
* carrier, recalculate the 'initial' position here
|
||||||
*/
|
*/
|
||||||
std::string carrier = fgGetString("/sim/presets/carrier");
|
std::string carrier = fgGetString("/sim/presets/carrier");
|
||||||
|
std::string carrierpos = fgGetString("/sim/presets/carrier-position");
|
||||||
std::string parkpos = fgGetString("/sim/presets/parkpos");
|
std::string parkpos = fgGetString("/sim/presets/parkpos");
|
||||||
std::string runway = fgGetString("/sim/presets/runway");
|
std::string runway = fgGetString("/sim/presets/runway");
|
||||||
std::string apt = fgGetString("/sim/presets/airport-id");
|
std::string apt = fgGetString("/sim/presets/airport-id");
|
||||||
const bool rwy_req = fgGetBool("/sim/presets/runway-requested");
|
|
||||||
const bool abeam = fgGetBool("/sim/presets/carrier-abeam");
|
|
||||||
|
|
||||||
if (!carrier.empty())
|
if (!carrier.empty())
|
||||||
{
|
{
|
||||||
const bool atFLOLS = rwy_req && (runway == "FLOLS" || parkpos == "FLOLS");
|
/* /sim/presets/carrier-position can take a number of different values
|
||||||
|
- name of a parking/cataputt
|
||||||
|
- FLOLS - to position on final approach
|
||||||
|
- abeam - on an abeam position from the FLOLS, heading downwind
|
||||||
|
- <empty> indicating a start position of a catapult
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Convert to lower case to simplify comparison
|
||||||
|
std::transform(carrierpos.begin(),
|
||||||
|
carrierpos.end(),
|
||||||
|
carrierpos.begin(),
|
||||||
|
[](unsigned char c) { return std::tolower(c); });
|
||||||
|
|
||||||
|
const bool inair = (carrierpos == "flols") || (carrierpos == "abeam");
|
||||||
|
const bool abeam = (carrierpos == "abeam");
|
||||||
InitPosResult carrierResult;
|
InitPosResult carrierResult;
|
||||||
if (atFLOLS) {
|
if (inair) {
|
||||||
carrierResult = setFinalPosFromCarrierFLOLS(carrier, abeam);
|
carrierResult = setFinalPosFromCarrierFLOLS(carrier, abeam);
|
||||||
} else {
|
} else {
|
||||||
carrierResult = setFinalPosFromCarrier(carrier, parkpos);
|
// We don't simply use carrierpos as it is now lower case, and the
|
||||||
|
// search against parking/catapult positions is case-sensitive.
|
||||||
|
carrierResult = setFinalPosFromCarrier(carrier, fgGetString("/sim/presets/carrier-position"));
|
||||||
}
|
}
|
||||||
if (carrierResult == ExactPosition) {
|
if (carrierResult == ExactPosition) {
|
||||||
done = true;
|
done = true;
|
||||||
|
|
Loading…
Reference in a new issue