From 34d941f914c732e9c1a048440d54ebba0b6a0727 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 1 Jun 2001 17:51:39 +0000 Subject: [PATCH] - implemented get/setViewOffset and get/setGoalViewOffset - tied to properties /sim/view/offset and /sim/view/goal-offset --- src/Main/bfi.cxx | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/Main/bfi.cxx b/src/Main/bfi.cxx index c1ab91178..1137c0359 100644 --- a/src/Main/bfi.cxx +++ b/src/Main/bfi.cxx @@ -181,6 +181,8 @@ FGBFI::init () // Simulation fgTie("/sim/aircraft-dir", getAircraftDir, setAircraftDir); + fgTie("/sim/view/offset", getViewOffset, setViewOffset); + fgTie("/sim/view/goal-offset", getGoalViewOffset, setGoalViewOffset); fgTie("/sim/time/gmt", getDateString, setDateString); fgTie("/sim/time/gmt-string", getGMTString); @@ -201,6 +203,7 @@ FGBFI::init () // Autopilot fgTie("/autopilot/locks/altitude", getAPAltitudeLock, setAPAltitudeLock); fgTie("/autopilot/settings/altitude", getAPAltitude, setAPAltitude); + fgTie("/autopilot/locks/glide-slope", getAPGSLock, setAPGSLock); fgTie("/autopilot/settings/climb-rate", getAPClimb, setAPClimb, false); fgTie("/autopilot/locks/heading", getAPHeadingLock, setAPHeadingLock); fgTie("/autopilot/settings/heading-bug", getAPHeadingBug, setAPHeadingBug, @@ -280,6 +283,39 @@ FGBFI::setAircraftDir (string dir) } +/** + * Get the current view offset in degrees. + */ +double +FGBFI::getViewOffset () +{ + return (globals->get_current_view() + ->get_view_offset() * SGD_RADIANS_TO_DEGREES); +} + +void +FGBFI::setViewOffset (double offset) +{ + globals->get_current_view()->set_view_offset(offset * SGD_DEGREES_TO_RADIANS); +} + +double +FGBFI::getGoalViewOffset () +{ + return (globals->get_current_view() + ->get_goal_view_offset() * SGD_RADIANS_TO_DEGREES); +} + +void +FGBFI::setGoalViewOffset (double offset) +{ + globals->get_current_view() + ->set_goal_view_offset(offset * SGD_DEGREES_TO_RADIANS); +} + + + + /** * Return the current Zulu time. */ @@ -772,6 +808,27 @@ FGBFI::setAPAltitudeLock (bool lock) } +/** + * Get the autopilot altitude lock (true=on). + */ +bool +FGBFI::getAPGSLock () +{ + return current_autopilot->get_AltitudeEnabled(); +} + + +/** + * Set the autopilot altitude lock (true=on). + */ +void +FGBFI::setAPGSLock (bool lock) +{ + current_autopilot->set_AltitudeMode(FGAutopilot::FG_ALTITUDE_GS1); + current_autopilot->set_AltitudeEnabled(lock); +} + + /** * Get the autopilot target altitude in feet. */