1 // bfi.cxx - Big Friendly Interface implementation
3 // Written by David Megginson, started February, 2000.
5 // Copyright (C) 2000 David Megginson - david@megginson.com
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #if defined( FG_HAVE_NATIVE_SGI_COMPILERS )
29 # include <iostream.h>
34 #include <simgear/constants.h>
35 #include <simgear/debug/logstream.hxx>
36 #include <simgear/ephemeris/ephemeris.hxx>
37 #include <simgear/math/fg_types.hxx>
38 #include <simgear/misc/props.hxx>
39 #include <simgear/timing/sg_time.hxx>
41 #include <Aircraft/aircraft.hxx>
42 #include <FDM/UIUCModel/uiuc_aircraftdir.h>
43 #include <Controls/controls.hxx>
44 #include <Autopilot/newauto.hxx>
45 #include <Scenery/scenery.hxx>
46 #include <Time/light.hxx>
47 #include <Time/event.hxx>
48 #include <Time/sunpos.hxx>
49 #include <Time/tmp.hxx>
50 #include <Cockpit/radiostack.hxx>
51 #ifndef FG_OLD_WEATHER
52 # include <WeatherCM/FGLocalWeatherDatabase.h>
54 # include <Weather/weather.hxx>
57 #include "globals.hxx"
58 #include "options.hxx"
60 #include "fg_init.hxx"
62 FG_USING_NAMESPACE(std);
69 ////////////////////////////////////////////////////////////////////////
71 ////////////////////////////////////////////////////////////////////////
73 bool FGBFI::_needReinit = false;
77 ////////////////////////////////////////////////////////////////////////
79 ////////////////////////////////////////////////////////////////////////
83 * Initialize the BFI by binding its functions to properties.
85 * TODO: perhaps these should migrate into the individual modules
86 * (i.e. they should register themselves).
91 FG_LOG(FG_GENERAL, FG_INFO, "Starting BFI init");
93 current_properties.tieInt("/sim/flight-model",
94 getFlightModel, setFlightModel);
95 // current_properties.tieString("/sim/aircraft",
96 // getAircraft, setAircraft);
98 current_properties.tieBool("/sim/hud/visibility",
99 getHUDVisible, setHUDVisible);
100 current_properties.tieBool("/sim/panel/visibility",
101 getPanelVisible, setPanelVisible);
104 current_properties.tieDouble("/position/latitude",
105 getLatitude, setLatitude);
106 current_properties.tieDouble("/position/longitude",
107 getLongitude, setLongitude);
108 current_properties.tieDouble("/position/altitude",
109 getAltitude, setAltitude);
110 current_properties.tieDouble("/position/altitude-agl",
114 current_properties.tieDouble("/orientation/heading",
115 getHeading, setHeading);
116 current_properties.tieDouble("/orientation/heading-magnetic",
118 current_properties.tieDouble("/orientation/pitch",
120 current_properties.tieDouble("/orientation/roll",
124 current_properties.tieDouble("/velocities/airspeed",
126 current_properties.tieDouble("/velocities/side-slip",
128 current_properties.tieDouble("/velocities/vertical-speed",
129 getVerticalSpeed, 0);
130 current_properties.tieDouble("/velocities/speed-north",
131 getSpeedNorth, setSpeedNorth);
132 current_properties.tieDouble("/velocities/speed-east",
133 getSpeedEast, setSpeedEast);
134 current_properties.tieDouble("/velocities/speed-down",
135 getSpeedDown, setSpeedDown);
138 current_properties.tieDouble("/controls/throttle",
139 getThrottle, setThrottle);
140 current_properties.tieDouble("/controls/flaps",
142 current_properties.tieDouble("/controls/aileron",
143 getAileron, setAileron);
144 current_properties.tieDouble("/controls/rudder",
145 getRudder, setRudder);
146 current_properties.tieDouble("/controls/elevator",
147 getElevator, setElevator);
148 current_properties.tieDouble("/controls/elevator-trim",
149 getElevatorTrim, setElevatorTrim);
150 current_properties.tieDouble("/controls/brake",
154 current_properties.tieBool("/autopilot/locks/altitude",
155 getAPAltitudeLock, setAPAltitudeLock);
156 current_properties.tieDouble("/autopilot/settings/altitude",
157 getAPAltitude, setAPAltitude);
158 current_properties.tieBool("/autopilot/locks/heading",
159 getAPHeadingLock, setAPHeadingLock);
160 current_properties.tieDouble("/autopilot/settings/heading-magnetic",
161 getAPHeadingMag, setAPHeadingMag);
162 current_properties.tieBool("/autopilot/locks/nav1",
163 getAPNAV1Lock, setAPNAV1Lock);
166 current_properties.tieDouble("/radios/nav1/frequencies/selected",
167 getNAV1Freq, setNAV1Freq);
168 current_properties.tieDouble("/radios/nav1/frequencies/standby",
169 getNAV1AltFreq, setNAV1AltFreq);
170 current_properties.tieDouble("/radios/nav1/radials/actual",
172 current_properties.tieDouble("/radios/nav1/radials/selected",
173 getNAV1SelRadial, setNAV1SelRadial);
174 current_properties.tieDouble("/radios/nav1/dme/distance",
176 current_properties.tieBool("/radios/nav1/in-range",
178 current_properties.tieBool("/radios/nav1/dme/in-range",
179 getNAV1DMEInRange, 0);
181 current_properties.tieDouble("/radios/nav2/frequencies/selected",
182 getNAV2Freq, setNAV2Freq);
183 current_properties.tieDouble("/radios/nav2/frequencies/standby",
184 getNAV2AltFreq, setNAV2AltFreq);
185 current_properties.tieDouble("/radios/nav2/radials/actual",
187 current_properties.tieDouble("/radios/nav2/radials/selected",
188 getNAV2SelRadial, setNAV2SelRadial);
189 current_properties.tieDouble("/radios/nav2/dme/distance",
191 current_properties.tieBool("/radios/nav2/in-range",
193 current_properties.tieBool("/radios/nav2/dme/in-range",
194 getNAV2DMEInRange, 0);
196 current_properties.tieDouble("/radios/adf/frequencies/selected",
197 getADFFreq, setADFFreq);
198 current_properties.tieDouble("/radios/adf/frequencies/standby",
199 getADFAltFreq, setADFAltFreq);
200 current_properties.tieDouble("/radios/adf/rotation",
201 getADFRotation, setADFRotation);
203 FG_LOG(FG_GENERAL, FG_INFO, "Ending BFI init");
208 * Reinitialize FGFS if required.
210 * Some changes (especially those in aircraft position) require that
211 * FGFS be reinitialized afterwards. Rather than reinitialize after
212 * every change, the setter methods simply set a flag so that there
213 * can be a single reinit at the end of the frame.
225 * Reinitialize FGFS to use the new BFI settings.
230 // Save the state of everything
231 // that's going to get clobbered
232 // when we reinit the subsystems.
234 cout << "BFI: start reinit\n";
236 setHeading(getHeading());
237 setPitch(getPitch());
239 setSpeedNorth(getSpeedNorth());
240 setSpeedEast(getSpeedEast());
241 setSpeedDown(getSpeedDown());
242 setLatitude(getLatitude());
243 setLongitude(getLongitude());
244 setAltitude(getAltitude());
246 // TODO: add more AP stuff
247 double elevator = getElevator();
248 double aileron = getAileron();
249 double rudder = getRudder();
250 double throttle = getThrottle();
251 double elevator_trim = getElevatorTrim();
252 double flaps = getFlaps();
253 double brake = getBrake();
254 bool apHeadingLock = getAPHeadingLock();
255 double apHeadingMag = getAPHeadingMag();
256 bool apAltitudeLock = getAPAltitudeLock();
257 double apAltitude = getAPAltitude();
258 const string &targetAirport = getTargetAirport();
259 bool gpsLock = getGPSLock();
260 double gpsLatitude = getGPSTargetLatitude();
261 double gpsLongitude = getGPSTargetLongitude();
263 setTargetAirport("");
264 cout << "Target airport is " << current_options.get_airport_id() << endl;
266 fgReInitSubsystems();
268 // FIXME: this is wrong.
269 // All of these are scheduled events,
270 // and it should be possible to force
271 // them all to run once.
274 cur_light_params.Update();
276 fgUpdateWeatherDatabase();
279 // Restore all of the old states.
280 setElevator(elevator);
283 setThrottle(throttle);
284 setElevatorTrim(elevator_trim);
287 setAPHeadingLock(apHeadingLock);
288 setAPHeadingMag(apHeadingMag);
289 setAPAltitudeLock(apAltitudeLock);
290 setAPAltitude(apAltitude);
291 setTargetAirport(targetAirport);
293 setGPSTargetLatitude(gpsLatitude);
294 setGPSTargetLongitude(gpsLongitude);
298 cout << "BFI: end reinit\n";
303 ////////////////////////////////////////////////////////////////////////
305 ////////////////////////////////////////////////////////////////////////
309 * Return the flight model as an integer.
311 * TODO: use a string instead.
314 FGBFI::getFlightModel ()
316 return current_options.get_flight_model();
321 * Return the current aircraft as a string.
324 FGBFI::getAircraft ()
326 return current_options.get_aircraft();
331 * Return the current aircraft directory (UIUC) as a string.
334 FGBFI::getAircraftDir ()
341 * Set the flight model as an integer.
343 * TODO: use a string instead.
346 FGBFI::setFlightModel (int model)
348 current_options.set_flight_model(model);
354 * Set the current aircraft.
357 FGBFI::setAircraft (const string &aircraft)
359 current_options.set_aircraft(aircraft);
365 * Set the current aircraft directory (UIUC).
368 FGBFI::setAircraftDir (const string &dir)
376 * Return the current Zulu time.
381 return globals->get_time_params()->get_cur_time();
386 * Set the current Zulu time.
389 FGBFI::setTimeGMT (time_t time)
391 // FIXME: need to update lighting
393 current_options.set_time_offset(time);
394 current_options.set_time_offset_type(fgOPTIONS::FG_TIME_GMT_ABSOLUTE);
395 globals->get_time_params()->update( cur_fdm_state->get_Longitude(),
396 cur_fdm_state->get_Latitude(),
397 globals->get_warp() );
403 * Return true if the HUD is visible.
406 FGBFI::getHUDVisible ()
408 return current_options.get_hud_status();
413 * Ensure that the HUD is visible or hidden.
416 FGBFI::setHUDVisible (bool visible)
418 current_options.set_hud_status(visible);
423 * Return true if the 2D panel is visible.
426 FGBFI::getPanelVisible ()
428 return current_options.get_panel_status();
433 * Ensure that the 2D panel is visible or hidden.
436 FGBFI::setPanelVisible (bool visible)
438 if (current_options.get_panel_status() != visible) {
439 current_options.toggle_panel();
445 ////////////////////////////////////////////////////////////////////////
447 ////////////////////////////////////////////////////////////////////////
451 * Return the current latitude in degrees (negative for south).
454 FGBFI::getLatitude ()
456 return current_aircraft.fdm_state->get_Latitude() * RAD_TO_DEG;
461 * Set the current latitude in degrees (negative for south).
464 FGBFI::setLatitude (double latitude)
466 current_options.set_lat(latitude);
467 current_aircraft.fdm_state->set_Latitude(latitude * DEG_TO_RAD);
473 * Return the current longitude in degrees (negative for west).
476 FGBFI::getLongitude ()
478 return current_aircraft.fdm_state->get_Longitude() * RAD_TO_DEG;
483 * Set the current longitude in degrees (negative for west).
486 FGBFI::setLongitude (double longitude)
488 current_options.set_lon(longitude);
489 current_aircraft.fdm_state->set_Longitude(longitude * DEG_TO_RAD);
495 * Return the current altitude in feet.
498 FGBFI::getAltitude ()
500 return current_aircraft.fdm_state->get_Altitude();
506 * Return the current altitude in above the terrain.
511 return current_aircraft.fdm_state->get_Altitude()
512 - scenery.cur_elev * METER_TO_FEET;
517 * Set the current altitude in feet.
520 FGBFI::setAltitude (double altitude)
522 fgFDMForceAltitude(getFlightModel(), altitude * FEET_TO_METER);
523 // current_options.set_altitude(altitude * FEET_TO_METER);
524 // current_aircraft.fdm_state->set_Altitude(altitude);
530 ////////////////////////////////////////////////////////////////////////
532 ////////////////////////////////////////////////////////////////////////
536 * Return the current heading in degrees.
541 return current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG;
546 * Return the current heading in degrees.
549 FGBFI::getHeadingMag ()
551 return current_aircraft.fdm_state->get_Psi() * RAD_TO_DEG - getMagVar();
556 * Set the current heading in degrees.
559 FGBFI::setHeading (double heading)
561 current_options.set_heading(heading);
562 current_aircraft.fdm_state->set_Euler_Angles(getRoll() * DEG_TO_RAD,
563 getPitch() * DEG_TO_RAD,
564 heading * DEG_TO_RAD);
570 * Return the current pitch in degrees.
575 return current_aircraft.fdm_state->get_Theta() * RAD_TO_DEG;
580 * Set the current pitch in degrees.
583 FGBFI::setPitch (double pitch)
586 current_options.set_pitch(pitch);
587 current_aircraft.fdm_state->set_Euler_Angles(getRoll() * DEG_TO_RAD,
589 getHeading() * DEG_TO_RAD);
595 * Return the current roll in degrees.
600 return current_aircraft.fdm_state->get_Phi() * RAD_TO_DEG;
605 * Set the current roll in degrees.
608 FGBFI::setRoll (double roll)
610 current_options.set_roll(roll);
611 current_aircraft.fdm_state->set_Euler_Angles(roll * DEG_TO_RAD,
612 getPitch() * DEG_TO_RAD,
613 getHeading() * DEG_TO_RAD);
619 ////////////////////////////////////////////////////////////////////////
621 ////////////////////////////////////////////////////////////////////////
625 * Return the current airspeed in knots.
628 FGBFI::getAirspeed ()
630 // FIXME: should we add speed-up?
631 return current_aircraft.fdm_state->get_V_calibrated_kts();
636 * Return the current sideslip (FIXME: units unknown).
639 FGBFI::getSideSlip ()
641 return current_aircraft.fdm_state->get_Beta();
646 * Return the current climb rate in feet/minute
649 FGBFI::getVerticalSpeed ()
651 // What about meters?
652 return current_aircraft.fdm_state->get_Climb_Rate() * 60.0;
657 * Get the current north velocity (units??).
660 FGBFI::getSpeedNorth ()
662 return current_aircraft.fdm_state->get_V_north();
667 * Set the current north velocity (units??).
670 FGBFI::setSpeedNorth (double speed)
672 current_options.set_uBody(speed);
673 current_aircraft.fdm_state->set_Velocities_Local(speed,
681 * Get the current east velocity (units??).
684 FGBFI::getSpeedEast ()
686 return current_aircraft.fdm_state->get_V_east();
691 * Set the current east velocity (units??).
694 FGBFI::setSpeedEast (double speed)
696 current_options.set_vBody(speed);
697 current_aircraft.fdm_state->set_Velocities_Local(getSpeedNorth(),
705 * Get the current down velocity (units??).
708 FGBFI::getSpeedDown ()
710 return current_aircraft.fdm_state->get_V_down();
715 * Set the current down velocity (units??).
718 FGBFI::setSpeedDown (double speed)
720 current_options.set_wBody(speed);
721 current_aircraft.fdm_state->set_Velocities_Local(getSpeedNorth(),
729 ////////////////////////////////////////////////////////////////////////
731 ////////////////////////////////////////////////////////////////////////
735 * Get the throttle setting, from 0.0 (none) to 1.0 (full).
738 FGBFI::getThrottle ()
740 // FIXME: add throttle selector
741 return controls.get_throttle(0);
746 * Set the throttle, from 0.0 (none) to 1.0 (full).
749 FGBFI::setThrottle (double throttle)
751 // FIXME: allow throttle selection
753 controls.set_throttle(0, throttle);
758 * Get the flaps setting, from 0.0 (none) to 1.0 (full).
763 return controls.get_flaps();
768 * Set the flaps, from 0.0 (none) to 1.0 (full).
771 FGBFI::setFlaps (double flaps)
774 controls.set_flaps(flaps);
779 * Get the aileron, from -1.0 (left) to 1.0 (right).
784 return controls.get_aileron();
789 * Set the aileron, from -1.0 (left) to 1.0 (right).
792 FGBFI::setAileron (double aileron)
795 controls.set_aileron(aileron);
800 * Get the rudder setting, from -1.0 (left) to 1.0 (right).
805 return controls.get_rudder();
810 * Set the rudder, from -1.0 (left) to 1.0 (right).
813 FGBFI::setRudder (double rudder)
816 controls.set_rudder(rudder);
821 * Get the elevator setting, from -1.0 (down) to 1.0 (up).
824 FGBFI::getElevator ()
826 return controls.get_elevator();
831 * Set the elevator, from -1.0 (down) to 1.0 (up).
834 FGBFI::setElevator (double elevator)
837 controls.set_elevator(elevator);
842 * Get the elevator trim, from -1.0 (down) to 1.0 (up).
845 FGBFI::getElevatorTrim ()
847 return controls.get_elevator_trim();
852 * Set the elevator trim, from -1.0 (down) to 1.0 (up).
855 FGBFI::setElevatorTrim (double trim)
858 controls.set_elevator_trim(trim);
863 * Get the brake setting, from 0.0 (none) to 1.0 (full).
868 // FIXME: add brake selector
869 return controls.get_brake(0);
874 * Set the brake, from 0.0 (none) to 1.0 (full).
877 FGBFI::setBrake (double brake)
880 // FIXME: allow brake selection
881 controls.set_brake(0, brake);
886 ////////////////////////////////////////////////////////////////////////
888 ////////////////////////////////////////////////////////////////////////
892 * Get the autopilot altitude lock (true=on).
895 FGBFI::getAPAltitudeLock ()
897 return current_autopilot->get_AltitudeEnabled();
902 * Set the autopilot altitude lock (true=on).
905 FGBFI::setAPAltitudeLock (bool lock)
907 current_autopilot->set_AltitudeMode(FGAutopilot::FG_ALTITUDE_LOCK);
908 current_autopilot->set_AltitudeEnabled(lock);
913 * Get the autopilot target altitude in feet.
916 FGBFI::getAPAltitude ()
918 return current_autopilot->get_TargetAltitude() * METER_TO_FEET;
923 * Set the autopilot target altitude in feet.
926 FGBFI::setAPAltitude (double altitude)
928 current_autopilot->set_TargetAltitude( altitude );
933 * Get the autopilot heading lock (true=on).
936 FGBFI::getAPHeadingLock ()
939 (current_autopilot->get_HeadingEnabled() &&
940 current_autopilot->get_HeadingMode() == FGAutopilot::FG_HEADING_LOCK);
945 * Set the autopilot heading lock (true=on).
948 FGBFI::setAPHeadingLock (bool lock)
951 // We need to do this so that
952 // it's possible to lock onto a
953 // heading other than the current
955 double heading = getAPHeadingMag();
956 current_autopilot->set_HeadingMode(FGAutopilot::FG_HEADING_LOCK);
957 current_autopilot->set_HeadingEnabled(true);
958 setAPHeadingMag(heading);
959 } else if (current_autopilot->get_HeadingMode() ==
960 FGAutopilot::FG_HEADING_LOCK) {
961 current_autopilot->set_HeadingEnabled(false);
967 * Get the autopilot target heading in degrees.
970 FGBFI::getAPHeadingMag ()
972 return current_autopilot->get_TargetHeading() - getMagVar();
977 * Set the autopilot target heading in degrees.
980 FGBFI::setAPHeadingMag (double heading)
982 current_autopilot->set_TargetHeading( heading + getMagVar() );
987 * Return true if the autopilot is locked to NAV1.
990 FGBFI::getAPNAV1Lock ()
993 (current_autopilot->get_HeadingEnabled() &&
994 current_autopilot->get_HeadingMode() == FGAutopilot::FG_HEADING_NAV1);
999 * Set the autopilot NAV1 lock.
1002 FGBFI::setAPNAV1Lock (bool lock)
1005 current_autopilot->set_HeadingMode(FGAutopilot::FG_HEADING_NAV1);
1006 current_autopilot->set_HeadingEnabled(true);
1007 } else if (current_autopilot->get_HeadingMode() ==
1008 FGAutopilot::FG_HEADING_NAV1) {
1009 current_autopilot->set_HeadingEnabled(false);
1015 ////////////////////////////////////////////////////////////////////////
1016 // Radio navigation.
1017 ////////////////////////////////////////////////////////////////////////
1020 FGBFI::getNAV1Freq ()
1022 return current_radiostack->get_nav1_freq();
1026 FGBFI::getNAV1AltFreq ()
1028 return current_radiostack->get_nav1_alt_freq();
1032 FGBFI::getNAV1Radial ()
1034 return current_radiostack->get_nav1_radial();
1038 FGBFI::getNAV1SelRadial ()
1040 return current_radiostack->get_nav1_sel_radial();
1044 FGBFI::getNAV1DistDME ()
1046 return current_radiostack->get_nav1_dme_dist();
1050 FGBFI::getNAV1InRange ()
1052 return current_radiostack->get_nav1_inrange();
1056 FGBFI::getNAV1DMEInRange ()
1058 return (current_radiostack->get_nav1_inrange() &&
1059 current_radiostack->get_nav1_has_dme());
1063 FGBFI::getNAV2Freq ()
1065 return current_radiostack->get_nav2_freq();
1069 FGBFI::getNAV2AltFreq ()
1071 return current_radiostack->get_nav2_alt_freq();
1075 FGBFI::getNAV2Radial ()
1077 return current_radiostack->get_nav2_radial();
1081 FGBFI::getNAV2SelRadial ()
1083 return current_radiostack->get_nav2_sel_radial();
1087 FGBFI::getNAV2DistDME ()
1089 return current_radiostack->get_nav2_dme_dist();
1093 FGBFI::getNAV2InRange ()
1095 return current_radiostack->get_nav2_inrange();
1099 FGBFI::getNAV2DMEInRange ()
1101 return (current_radiostack->get_nav2_inrange() &&
1102 current_radiostack->get_nav2_has_dme());
1106 FGBFI::getADFFreq ()
1108 return current_radiostack->get_adf_freq();
1112 FGBFI::getADFAltFreq ()
1114 return current_radiostack->get_adf_alt_freq();
1118 FGBFI::getADFRotation ()
1120 return current_radiostack->get_adf_rotation();
1124 FGBFI::setNAV1Freq (double freq)
1126 current_radiostack->set_nav1_freq(freq);
1130 FGBFI::setNAV1AltFreq (double freq)
1132 current_radiostack->set_nav1_alt_freq(freq);
1136 FGBFI::setNAV1SelRadial (double radial)
1138 current_radiostack->set_nav1_sel_radial(radial);
1142 FGBFI::setNAV2Freq (double freq)
1144 current_radiostack->set_nav2_freq(freq);
1148 FGBFI::setNAV2AltFreq (double freq)
1150 current_radiostack->set_nav2_alt_freq(freq);
1154 FGBFI::setNAV2SelRadial (double radial)
1156 current_radiostack->set_nav2_sel_radial(radial);
1160 FGBFI::setADFFreq (double freq)
1162 current_radiostack->set_adf_freq(freq);
1166 FGBFI::setADFAltFreq (double freq)
1168 current_radiostack->set_adf_alt_freq(freq);
1172 FGBFI::setADFRotation (double rot)
1174 current_radiostack->set_adf_rotation(rot);
1179 ////////////////////////////////////////////////////////////////////////
1181 ////////////////////////////////////////////////////////////////////////
1185 * Get the autopilot GPS lock (true=on).
1188 FGBFI::getGPSLock ()
1190 return (current_autopilot->get_HeadingEnabled() &&
1191 (current_autopilot->get_HeadingMode() ==
1192 FGAutopilot::FG_HEADING_WAYPOINT ));
1197 * Set the autopilot GPS lock (true=on).
1200 FGBFI::setGPSLock (bool lock)
1203 current_autopilot->set_HeadingMode(FGAutopilot::FG_HEADING_WAYPOINT);
1204 current_autopilot->set_HeadingEnabled(true);
1205 } else if (current_autopilot->get_HeadingMode() ==
1206 FGAutopilot::FG_HEADING_WAYPOINT) {
1207 current_autopilot->set_HeadingEnabled(false);
1213 * Get the GPS target airport code.
1216 FGBFI::getTargetAirport ()
1218 return current_options.get_airport_id();
1223 * Set the GPS target airport code.
1226 FGBFI::setTargetAirport (const string &airportId)
1228 current_options.set_airport_id(airportId);
1233 * Get the GPS target latitude in degrees (negative for south).
1236 FGBFI::getGPSTargetLatitude ()
1238 return current_autopilot->get_TargetLatitude();
1243 * Set the GPS target latitude in degrees (negative for south).
1246 FGBFI::setGPSTargetLatitude (double latitude)
1248 current_autopilot->set_TargetLatitude( latitude );
1253 * Get the GPS target longitude in degrees (negative for west).
1256 FGBFI::getGPSTargetLongitude ()
1258 return current_autopilot->get_TargetLongitude();
1263 * Set the GPS target longitude in degrees (negative for west).
1266 FGBFI::setGPSTargetLongitude (double longitude)
1268 current_autopilot->set_TargetLongitude( longitude );
1273 ////////////////////////////////////////////////////////////////////////
1275 ////////////////////////////////////////////////////////////////////////
1279 * Get the current visible (units??).
1282 FGBFI::getVisibility ()
1284 #ifndef FG_OLD_WEATHER
1285 return WeatherDatabase->getWeatherVisibility();
1287 return current_weather.get_visibility();
1293 * Check whether clouds are enabled.
1298 return current_options.get_clouds();
1303 * Check the height of the clouds ASL (units?).
1306 FGBFI::getCloudsASL ()
1308 return current_options.get_clouds_asl();
1313 * Set the current visibility (units??).
1316 FGBFI::setVisibility (double visibility)
1318 #ifndef FG_OLD_WEATHER
1319 WeatherDatabase->setWeatherVisibility(visibility);
1321 current_weather.set_visibility(visibility);
1327 * Switch clouds on or off.
1330 FGBFI::setClouds (bool clouds)
1332 cout << "Set clouds to " << clouds << endl;
1333 current_options.set_clouds(clouds);
1339 * Set the cloud height.
1342 FGBFI::setCloudsASL (double cloudsASL)
1344 current_options.set_clouds_asl(cloudsASL);
1350 ////////////////////////////////////////////////////////////////////////
1352 ////////////////////////////////////////////////////////////////////////
1355 * Return the magnetic variation
1360 return cur_magvar.get_magvar() * RAD_TO_DEG;
1365 * Return the magnetic variation
1370 return cur_magvar.get_magdip() * RAD_TO_DEG;