# End Source File\r
# Begin Source File\r
\r
+SOURCE=.\src\FDM\LaRCsim\ls_trim.c\r
+\r
+!IF "$(CFG)" == "FlightGear - Win32 Release"\r
+\r
+# PROP Intermediate_Dir "Release\Lib_LaRCsim"\r
+\r
+!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"\r
+\r
+# PROP Intermediate_Dir "Debug\Lib_LaRCsim"\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\src\FDM\LaRCsim\c172_aero.c\r
\r
!IF "$(CFG)" == "FlightGear - Win32 Release"\r
# PROP Default_Filter ""\r
# Begin Source File\r
\r
+SOURCE=.\src\GUI\apt_dlg.cxx\r
+\r
+!IF "$(CFG)" == "FlightGear - Win32 Release"\r
+\r
+# PROP Intermediate_Dir "Release\Lib_GUI"\r
+\r
+!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"\r
+\r
+# PROP Intermediate_Dir "Debug\Lib_GUI"\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\src\GUI\gui.cxx\r
\r
!IF "$(CFG)" == "FlightGear - Win32 Release"\r
\r
!ENDIF \r
\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\src\GUI\gui_local.cxx\r
+\r
+!IF "$(CFG)" == "FlightGear - Win32 Release"\r
+\r
+# PROP Intermediate_Dir "Release\Lib_GUI"\r
+\r
+!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"\r
+\r
+# PROP Intermediate_Dir "Debug\Lib_GUI"\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\src\GUI\mouse.cxx\r
+\r
+!IF "$(CFG)" == "FlightGear - Win32 Release"\r
+\r
+# PROP Intermediate_Dir "Release\Lib_GUI"\r
+\r
+!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"\r
+\r
+# PROP Intermediate_Dir "Debug\Lib_GUI"\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\src\GUI\net_dlg.cxx\r
+\r
+!IF "$(CFG)" == "FlightGear - Win32 Release"\r
+\r
+# PROP Intermediate_Dir "Release\Lib_GUI"\r
+\r
+!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"\r
+\r
+# PROP Intermediate_Dir "Debug\Lib_GUI"\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\src\GUI\trackball.c\r
+\r
+!IF "$(CFG)" == "FlightGear - Win32 Release"\r
+\r
+# PROP Intermediate_Dir "Release\Lib_GUI"\r
+\r
+!ELSEIF "$(CFG)" == "FlightGear - Win32 Debug"\r
+\r
+# PROP Intermediate_Dir "Debug\Lib_GUI"\r
+\r
+!ENDIF \r
+\r
# End Source File\r
# End Group\r
# Begin Group "Lib_Joystick"\r
void FGAutopilot::update_old_control_values() {
- old_aileron = FGBFI::getAileron();
- old_elevator = FGBFI::getElevator();
- old_elevator_trim = FGBFI::getElevatorTrim();
- old_rudder = FGBFI::getRudder();
+ old_aileron = controls.get_aileron();
+ old_elevator = controls.get_elevator();
+ old_elevator_trim = controls.get_elevator_trim();
+ old_rudder = controls.get_rudder();
}
globals->get_options()->get_xsize(),
globals->get_options()->get_ysize() );
- if (current_panel != 0)
- current_panel->update();
}
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgpath.hxx>
+
#include <Main/globals.hxx>
+#include <Main/fg_props.hxx>
#include <Objects/texload.h>
#include <Time/light.hxx>
*/
FGPanel::~FGPanel ()
{
+ unbind();
for (instrument_list_type::iterator it = _instruments.begin();
it != _instruments.end();
it++) {
}
+/**
+ * Initialize the panel.
+ */
+void
+FGPanel::init ()
+{
+ // NO-OP
+}
+
+
+/**
+ * Bind panel properties.
+ */
+void
+FGPanel::bind ()
+{
+ fgTie("/sim/panel/visibility", &_visibility);
+ fgTie("/sim/panel/x-offset", &_x_offset);
+ fgTie("/sim/panel/y-offset", &_y_offset);
+}
+
+
+/**
+ * Unbind panel properties.
+ */
+void
+FGPanel::unbind ()
+{
+ fgUntie("/sim/panel/visibility");
+ fgUntie("/sim/panel/x-offset");
+ fgUntie("/sim/panel/y-offset");
+}
+
+
/**
* Update the panel.
*/
void
-FGPanel::update () const
+FGPanel::update ()
{
// Do nothing if the panel isn't visible.
if (!fgPanelVisible())
#include <map>
#include <plib/fnt.h>
+#include <Main/fgfs.hxx>
+
FG_USING_STD(vector);
FG_USING_STD(map);
// the appropriate instruments for processing.
////////////////////////////////////////////////////////////////////////
-class FGPanel
+class FGPanel : public FGSubsystem
{
public:
FGPanel (int window_x, int window_y, int window_w, int window_h);
virtual ~FGPanel ();
+ // Update the panel (every frame).
+ virtual void init ();
+ virtual void bind ();
+ virtual void unbind ();
+ virtual void update ();
+
// transfer pointer ownership!!!
virtual void addInstrument (FGPanelInstrument * instrument);
- // Update the panel (every frame).
- virtual void update () const;
-
// Background texture.
virtual void setBackground (ssgTexture * texture);
#include <Main/bfi.hxx>
#include <Navaids/ilslist.hxx>
#include <Navaids/navlist.hxx>
+#include <Time/event.hxx>
#include "radiostack.hxx"
FGRadioStack *current_radiostack;
+// periodic radio station search wrapper
+static void fgRadioSearch( void ) {
+ current_radiostack->search();
+}
+
// Constructor
FGRadioStack::FGRadioStack() {
nav1_radial = 0.0;
nav2_radial = 0.0;
nav2_dme_dist = 0.0;
need_update = true;
+ longitudeVal = globals->get_props()->getValue("/position/longitude");
+ latitudeVal = globals->get_props()->getValue("/position/latitude");
+ altitudeVal = globals->get_props()->getValue("/position/altitude");
}
// Destructor
-FGRadioStack::~FGRadioStack() {
+FGRadioStack::~FGRadioStack()
+{
+ unbind(); // FIXME: should be called externally
+}
+
+
+void
+FGRadioStack::init ()
+{
+ search();
+ update();
+
+ // Search radio database once per second
+ global_events.Register( "fgRadioSearch()", fgRadioSearch,
+ fgEVENT::FG_EVENT_READY, 1000);
+}
+
+void
+FGRadioStack::bind ()
+{
+ // User inputs
+ fgTie("/radios/nav1/frequencies/selected", this,
+ &FGRadioStack::get_nav1_freq, &FGRadioStack::set_nav1_freq);
+ fgTie("/radios/nav1/frequencies/standby", this,
+ &FGRadioStack::get_nav1_alt_freq, &FGRadioStack::set_nav1_alt_freq);
+ fgTie("/radios/nav1/radials/selected", this,
+ &FGRadioStack::get_nav1_sel_radial,
+ &FGRadioStack::set_nav1_sel_radial);
+
+ // Radio outputs
+ fgTie("/radios/nav1/radials/actual", this, &FGRadioStack::get_nav1_radial);
+ fgTie("/radios/nav1/to-flag", this, &FGRadioStack::get_nav1_to_flag);
+ fgTie("/radios/nav1/from-flag", this, &FGRadioStack::get_nav1_from_flag);
+ fgTie("/radios/nav1/in-range", this, &FGRadioStack::get_nav1_inrange);
+ fgTie("/radios/nav1/dme/distance", this, &FGRadioStack::get_nav1_dme_dist);
+ fgTie("/radios/nav1/dme/in-range", this,
+ &FGRadioStack::get_nav1_dme_inrange);
+
+ // User inputs
+ fgTie("/radios/nav2/frequencies/selected", this,
+ &FGRadioStack::get_nav2_freq, &FGRadioStack::set_nav2_freq);
+ fgTie("/radios/nav2/frequencies/standby", this,
+ &FGRadioStack::get_nav2_alt_freq, &FGRadioStack::set_nav2_alt_freq);
+ fgTie("/radios/nav2/radials/selected", this,
+ &FGRadioStack::get_nav2_sel_radial,
+ &FGRadioStack::set_nav2_sel_radial);
+
+ // Radio outputs
+ fgTie("/radios/nav2/radials/actual", this, &FGRadioStack::get_nav2_radial);
+ fgTie("/radios/nav2/to-flag", this, &FGRadioStack::get_nav2_to_flag);
+ fgTie("/radios/nav2/from-flag", this, &FGRadioStack::get_nav2_from_flag);
+ fgTie("/radios/nav2/in-range", this, &FGRadioStack::get_nav2_inrange);
+ fgTie("/radios/nav2/dme/distance", this, &FGRadioStack::get_nav2_dme_dist);
+ fgTie("/radios/nav2/dme/in-range", this,
+ &FGRadioStack::get_nav2_dme_inrange);
+
+ // User inputs
+ fgTie("/radios/adf/frequencies/selected", this,
+ &FGRadioStack::get_adf_freq, &FGRadioStack::set_adf_freq);
+ fgTie("/radios/adf/frequencies/standby", this,
+ &FGRadioStack::get_adf_alt_freq, &FGRadioStack::set_adf_alt_freq);
+ fgTie("/radios/adf/rotation", this,
+ &FGRadioStack::get_adf_rotation, &FGRadioStack::set_adf_rotation);
}
+void
+FGRadioStack::unbind ()
+{
+ fgUntie("/radios/nav1/frequencies/selected");
+ fgUntie("/radios/nav1/frequencies/standby");
+ fgUntie("/radios/nav1/radials/actual");
+ fgUntie("/radios/nav1/radials/selected");
+ fgUntie("/radios/nav1/to-flag");
+ fgUntie("/radios/nav1/from-flag");
+ fgUntie("/radios/nav1/in-range");
+ fgUntie("/radios/nav1/dme/distance");
+ fgUntie("/radios/nav1/dme/in-range");
+
+ fgUntie("/radios/nav2/frequencies/selected");
+ fgUntie("/radios/nav2/frequencies/standby");
+ fgUntie("/radios/nav2/radials/actual");
+ fgUntie("/radios/nav2/radials/selected");
+ fgUntie("/radios/nav2/to-flag");
+ fgUntie("/radios/nav2/from-flag");
+ fgUntie("/radios/nav2/in-range");
+ fgUntie("/radios/nav2/dme/distance");
+ fgUntie("/radios/nav2/dme/in-range");
+
+ fgUntie("/radios/adf/frequencies/selected");
+ fgUntie("/radios/adf/frequencies/standby");
+ fgUntie("/radios/adf/rotation");
+}
// Search the database for the current frequencies given current location
-void FGRadioStack::update( double lon, double lat, double elev ) {
+void
+FGRadioStack::update()
+{
+ double lon = longitudeVal->getDoubleValue() * DEG_TO_RAD;
+ double lat = latitudeVal->getDoubleValue() * DEG_TO_RAD;
+ double elev = altitudeVal->getDoubleValue() * FEET_TO_METER;
+
need_update = false;
Point3D aircraft = sgGeodToCart( Point3D( lon, lat, elev ) );
// Update current nav/adf radio stations based on current postition
-void FGRadioStack::search( double lon, double lat, double elev ) {
+void FGRadioStack::search ()
+{
+ double lon = longitudeVal->getDoubleValue() * DEG_TO_RAD;
+ double lat = latitudeVal->getDoubleValue() * DEG_TO_RAD;
+ double elev = altitudeVal->getDoubleValue() * FEET_TO_METER;
+
// nav1
FGILS ils;
FGNav nav;
} else {
nav1_valid = false;
nav1_radial = 0;
- nav2_dme_dist = 0;
+ nav1_dme_dist = 0;
// cout << "not picking up vor1. :-(" << endl;
}
}
-// periodic radio station search wrapper
-void fgRadioSearch( void ) {
- current_radiostack->search( cur_fdm_state->get_Longitude(),
- cur_fdm_state->get_Latitude(),
- cur_fdm_state->get_Altitude() * FEET_TO_METER );
+/**
+ * Return true if the NAV1 TO flag should be active.
+ */
+bool
+FGRadioStack::get_nav1_to_flag () const
+{
+ if (nav1_inrange) {
+ double offset = fabs(nav1_heading - nav1_radial);
+ if (nav1_loc)
+ return (offset <= 8.0 || offset >= 352.0);
+ else
+ return (offset <= 20.0 || offset >= 340.0);
+ } else {
+ return false;
+ }
}
+
+
+/**
+ * Return true if the NAV1 FROM flag should be active.
+ */
+bool
+FGRadioStack::get_nav1_from_flag () const
+{
+ if (nav1_inrange) {
+ double offset = fabs(nav1_heading - nav1_radial);
+ if (nav1_loc)
+ return (offset >= 172.0 && offset <= 188.0);
+ else
+ return (offset >= 160.0 && offset <= 200.0);
+ } else {
+ return false;
+ }
+}
+
+
+/**
+ * Return true if the NAV2 TO flag should be active.
+ */
+bool
+FGRadioStack::get_nav2_to_flag () const
+{
+ if (nav2_inrange) {
+ double offset = fabs(nav2_heading - nav2_radial);
+ if (nav2_loc)
+ return (offset <= 8.0 || offset >= 352.0);
+ else
+ return (offset <= 20.0 || offset >= 340.0);
+ } else {
+ return false;
+ }
+}
+
+
+/**
+ * Return true if the NAV2 FROM flag should be active.
+ */
+bool
+FGRadioStack::get_nav2_from_flag () const
+{
+ if (nav2_inrange) {
+ double offset = fabs(nav2_heading - nav2_radial);
+ if (nav2_loc)
+ return (offset >= 172.0 && offset <= 188.0);
+ else
+ return (offset >= 160.0 && offset <= 200.0);
+ } else {
+ return false;
+ }
+}
+
+
#define _FG_RADIOSTACK_HXX
+#include <Main/fgfs.hxx>
+#include <Main/fg_props.hxx>
+
#include <simgear/compiler.h>
#include <Navaids/ilslist.hxx>
#include <Navaids/navlist.hxx>
-class FGRadioStack {
+
+class FGRadioStack : public FGSubsystem
+{
+
+ SGValue * latitudeVal;
+ SGValue * longitudeVal;
+ SGValue * altitudeVal;
bool need_update;
FGRadioStack();
~FGRadioStack();
- // Update nav/adf radios based on current postition
- void search( double lon, double lat, double elev );
+ void init ();
+ void bind ();
+ void unbind ();
+ void update ();
// Update nav/adf radios based on current postition
- void update( double lon, double lat, double elev );
+ void search ();
// NAV1 Setters
inline void set_nav1_freq( double freq ) {
// Calculated values.
inline bool get_nav1_inrange() const { return nav1_inrange; }
+ bool get_nav1_to_flag () const;
+ bool get_nav1_from_flag () const;
inline bool get_nav1_has_dme() const { return nav1_has_dme; }
+ inline bool get_nav1_dme_inrange () const {
+ return nav1_inrange && nav1_has_dme;
+ }
inline bool get_nav1_has_gs() const { return nav1_has_gs; }
inline bool get_nav1_loc() const { return nav1_loc; }
inline double get_nav1_loclon() const { return nav1_loclon; }
inline double get_nav1_target_gs() const { return nav1_target_gs; }
inline bool get_nav2_inrange() const { return nav2_inrange; }
+ bool get_nav2_to_flag () const;
+ bool get_nav2_from_flag () const;
inline bool get_nav2_has_dme() const { return nav2_has_dme; }
+ inline bool get_nav2_dme_inrange () const {
+ return nav2_inrange && nav2_has_dme;
+ }
inline bool get_nav2_has_gs() const { return nav2_has_gs; }
inline bool get_nav2_loc() const { return nav2_loc; }
inline double get_nav2_loclon() const { return nav2_loclon; }
extern FGRadioStack *current_radiostack;
-
-// periodic radio station search wrapper
-void fgRadioSearch( void );
-
-
#endif // _FG_RADIOSTACK_HXX
scaling capability for the vacuum pump later on.
When we have a real engine model, we can ask it.
*/
- the_ENGINE_rpm = FGBFI::getThrottle() * 26.0;
+ the_ENGINE_rpm = controls.get_throttle(0) * 26.0;
/**************************
This is just temporary, until the static source works,
//
// Copyright (C) 2000 David Megginson - david@megginson.com
//
+// THIS CLASS IS DEPRECATED; USE THE PROPERTY MANAGER INSTEAD.
+//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
FG_LOG(FG_GENERAL, FG_INFO, "Starting BFI reinit");
// TODO: add more AP stuff
- double elevator = FGBFI::getElevator();
- double aileron = FGBFI::getAileron();
- double rudder = FGBFI::getRudder();
- double throttle = FGBFI::getThrottle();
- double elevator_trim = FGBFI::getElevatorTrim();
- double flaps = FGBFI::getFlaps();
- double brake = FGBFI::getBrakes();
bool apHeadingLock = FGBFI::getAPHeadingLock();
double apHeadingMag = FGBFI::getAPHeadingMag();
bool apAltitudeLock = FGBFI::getAPAltitudeLock();
cur_light_params.Update();
fgUpdateLocalTime();
fgUpdateWeatherDatabase();
- fgRadioSearch();
+ current_radiostack->search();
// Restore all of the old states.
- FGBFI::setElevator(elevator);
- FGBFI::setAileron(aileron);
- FGBFI::setRudder(rudder);
- FGBFI::setThrottle(throttle);
- FGBFI::setElevatorTrim(elevator_trim);
- FGBFI::setFlaps(flaps);
- FGBFI::setBrakes(brake);
FGBFI::setAPHeadingLock(apHeadingLock);
FGBFI::setAPHeadingMag(apHeadingMag);
FGBFI::setAPAltitudeLock(apAltitudeLock);
fgTie("/sim/time/gmt", getDateString, setDateString);
fgTie("/sim/time/gmt-string", getGMTString);
fgTie("/sim/hud/visibility", getHUDVisible, setHUDVisible);
- fgTie("/sim/panel/visibility", getPanelVisible, setPanelVisible);
- fgTie("/sim/panel/x-offset", getPanelXOffset, setPanelXOffset);
- fgTie("/sim/panel/y-offset", getPanelYOffset, setPanelYOffset);
// Position
fgTie("/position/airport-id", getTargetAirport, setTargetAirport);
fgTie("/velocities/speed-east", getSpeedEast);
fgTie("/velocities/speed-down", getSpeedDown);
- // Controls
-#if 0
- fgTie("/controls/throttle", getThrottle, setThrottle);
- fgTie("/controls/mixture", getMixture, setMixture);
- fgTie("/controls/propellor-pitch", getPropAdvance, setPropAdvance);
- fgTie("/controls/flaps", getFlaps, setFlaps);
- fgTie("/controls/aileron", getAileron, setAileron);
- fgTie("/controls/rudder", getRudder, setRudder);
- fgTie("/controls/elevator", getElevator, setElevator);
- fgTie("/controls/elevator-trim", getElevatorTrim, setElevatorTrim);
- fgTie("/controls/brakes/all", getBrakes, setBrakes);
- fgTie("/controls/brakes/left", getLeftBrake, setLeftBrake);
- fgTie("/controls/brakes/right", getRightBrake, setRightBrake);
- fgTie("/controls/brakes/center", getRightBrake, setCenterBrake);
-#endif
-
// Autopilot
fgTie("/autopilot/locks/altitude", getAPAltitudeLock, setAPAltitudeLock);
fgTie("/autopilot/settings/altitude", getAPAltitude, setAPAltitude);
getAPHeadingMag, setAPHeadingMag);
fgTie("/autopilot/locks/nav1", getAPNAV1Lock, setAPNAV1Lock);
- // Radio navigation
- fgTie("/radios/nav1/frequencies/selected", getNAV1Freq, setNAV1Freq);
- fgTie("/radios/nav1/frequencies/standby", getNAV1AltFreq, setNAV1AltFreq);
- fgTie("/radios/nav1/radials/actual", getNAV1Radial);
- fgTie("/radios/nav1/radials/selected",
- getNAV1SelRadial, setNAV1SelRadial);
- fgTie("/radios/nav1/dme/distance", getNAV1DistDME);
- fgTie("/radios/nav1/to-flag", getNAV1TO);
- fgTie("/radios/nav1/from-flag", getNAV1FROM);
- fgTie("/radios/nav1/in-range", getNAV1InRange);
- fgTie("/radios/nav1/dme/in-range", getNAV1DMEInRange);
-
- fgTie("/radios/nav2/frequencies/selected", getNAV2Freq, setNAV2Freq);
- fgTie("/radios/nav2/frequencies/standby",
- getNAV2AltFreq, setNAV2AltFreq);
- fgTie("/radios/nav2/radials/actual", getNAV2Radial);
- fgTie("/radios/nav2/radials/selected",
- getNAV2SelRadial, setNAV2SelRadial);
- fgTie("/radios/nav2/dme/distance", getNAV2DistDME);
- fgTie("/radios/nav2/to-flag", getNAV2TO);
- fgTie("/radios/nav2/from-flag", getNAV2FROM);
- fgTie("/radios/nav2/in-range", getNAV2InRange);
- fgTie("/radios/nav2/dme/in-range", getNAV2DMEInRange);
-
- fgTie("/radios/adf/frequencies/selected", getADFFreq, setADFFreq);
- fgTie("/radios/adf/frequencies/standby", getADFAltFreq, setADFAltFreq);
- fgTie("/radios/adf/rotation", getADFRotation, setADFRotation);
-
// Weather
fgTie("/environment/visibility", getVisibility, setVisibility);
fgTie("/environment/wind-north", getWindNorth, setWindNorth);
}
-/**
- * Return true if the 2D panel is visible.
- */
-bool
-FGBFI::getPanelVisible ()
-{
- return globals->get_options()->get_panel_status();
-}
-
-
-/**
- * Ensure that the 2D panel is visible or hidden.
- */
-void
-FGBFI::setPanelVisible (bool visible)
-{
- if (globals->get_options()->get_panel_status() != visible) {
- globals->get_options()->toggle_panel();
- }
-}
-
-
-/**
- * Get the panel's current x-shift.
- */
-int
-FGBFI::getPanelXOffset ()
-{
- if (current_panel != 0)
- return current_panel->getXOffset();
- else
- return 0;
-}
-
-
-/**
- * Set the panel's current x-shift.
- */
-void
-FGBFI::setPanelXOffset (int offset)
-{
- if (current_panel != 0)
- current_panel->setXOffset(offset);
-}
-
-
-/**
- * Get the panel's current y-shift.
- */
-int
-FGBFI::getPanelYOffset ()
-{
- if (current_panel != 0)
- return current_panel->getYOffset();
- else
- return 0;
-}
-
-
-/**
- * Set the panel's current y-shift.
- */
-void
-FGBFI::setPanelYOffset (int offset)
-{
- if (current_panel != 0)
- current_panel->setYOffset(offset);
-}
-
-
-
-
\f
////////////////////////////////////////////////////////////////////////
// Position
// Controls
////////////////////////////////////////////////////////////////////////
+#if 0
/**
* Get the throttle setting, from 0.0 (none) to 1.0 (full).
}
-
+#endif
\f
////////////////////////////////////////////////////////////////////////
}
-\f
-////////////////////////////////////////////////////////////////////////
-// Radio navigation.
-////////////////////////////////////////////////////////////////////////
-
-double
-FGBFI::getNAV1Freq ()
-{
- return current_radiostack->get_nav1_freq();
-}
-
-double
-FGBFI::getNAV1AltFreq ()
-{
- return current_radiostack->get_nav1_alt_freq();
-}
-
-double
-FGBFI::getNAV1Radial ()
-{
- return current_radiostack->get_nav1_radial();
-}
-
-double
-FGBFI::getNAV1SelRadial ()
-{
- return current_radiostack->get_nav1_sel_radial();
-}
-
-double
-FGBFI::getNAV1DistDME ()
-{
- return current_radiostack->get_nav1_dme_dist();
-}
-
-bool
-FGBFI::getNAV1TO ()
-{
- if (current_radiostack->get_nav1_inrange()) {
- double heading = current_radiostack->get_nav1_heading();
- double radial = current_radiostack->get_nav1_radial();
-// double var = FGBFI::getMagVar();
- if (current_radiostack->get_nav1_loc()) {
- double offset = fabs(heading - radial);
- return (offset<= 8.0 || offset >= 352.0);
- } else {
-// double offset =
-// fabs(heading - var - radial);
- double offset = fabs(heading - radial);
- return (offset <= 20.0 || offset >= 340.0);
- }
- } else {
- return false;
- }
-}
-
-bool
-FGBFI::getNAV1FROM ()
-{
- if (current_radiostack->get_nav1_inrange()) {
- double heading = current_radiostack->get_nav1_heading();
- double radial = current_radiostack->get_nav1_radial();
-// double var = FGBFI::getMagVar();
- if (current_radiostack->get_nav1_loc()) {
- double offset = fabs(heading - radial);
- return (offset >= 172.0 && offset<= 188.0);
- } else {
-// double offset =
-// fabs(heading - var - radial);
- double offset = fabs(heading - radial);
- return (offset >= 160.0 && offset <= 200.0);
- }
- } else {
- return false;
- }
-}
-
-bool
-FGBFI::getNAV1InRange ()
-{
- return current_radiostack->get_nav1_inrange();
-}
-
-bool
-FGBFI::getNAV1DMEInRange ()
-{
- return (current_radiostack->get_nav1_inrange() &&
- current_radiostack->get_nav1_has_dme());
-}
-
-double
-FGBFI::getNAV2Freq ()
-{
- return current_radiostack->get_nav2_freq();
-}
-
-double
-FGBFI::getNAV2AltFreq ()
-{
- return current_radiostack->get_nav2_alt_freq();
-}
-
-double
-FGBFI::getNAV2Radial ()
-{
- return current_radiostack->get_nav2_radial();
-}
-
-double
-FGBFI::getNAV2SelRadial ()
-{
- return current_radiostack->get_nav2_sel_radial();
-}
-
-double
-FGBFI::getNAV2DistDME ()
-{
- return current_radiostack->get_nav2_dme_dist();
-}
-
-bool
-FGBFI::getNAV2TO ()
-{
- if (current_radiostack->get_nav2_inrange()) {
- double heading = current_radiostack->get_nav2_heading();
- double radial = current_radiostack->get_nav2_radial();
-// double var = FGBFI::getMagVar();
- if (current_radiostack->get_nav2_loc()) {
- double offset = fabs(heading - radial);
- return (offset<= 8.0 || offset >= 352.0);
- } else {
-// double offset =
-// fabs(heading - var - radial);
- double offset = fabs(heading - radial);
- return (offset <= 20.0 || offset >= 340.0);
- }
- } else {
- return false;
- }
-}
-
-bool
-FGBFI::getNAV2FROM ()
-{
- if (current_radiostack->get_nav2_inrange()) {
- double heading = current_radiostack->get_nav2_heading();
- double radial = current_radiostack->get_nav2_radial();
-// double var = FGBFI::getMagVar();
- if (current_radiostack->get_nav2_loc()) {
- double offset = fabs(heading - radial);
- return (offset >= 172.0 && offset<= 188.0);
- } else {
-// double offset =
-// fabs(heading - var - radial);
- double offset = fabs(heading - radial);
- return (offset >= 160.0 && offset <= 200.0);
- }
- } else {
- return false;
- }
-}
-
-
-bool
-FGBFI::getNAV2InRange ()
-{
- return current_radiostack->get_nav2_inrange();
-}
-
-bool
-FGBFI::getNAV2DMEInRange ()
-{
- return (current_radiostack->get_nav2_inrange() &&
- current_radiostack->get_nav2_has_dme());
-}
-
-double
-FGBFI::getADFFreq ()
-{
- return current_radiostack->get_adf_freq();
-}
-
-double
-FGBFI::getADFAltFreq ()
-{
- return current_radiostack->get_adf_alt_freq();
-}
-
-double
-FGBFI::getADFRotation ()
-{
- return current_radiostack->get_adf_rotation();
-}
-
-void
-FGBFI::setNAV1Freq (double freq)
-{
- current_radiostack->set_nav1_freq(freq);
-}
-
-void
-FGBFI::setNAV1AltFreq (double freq)
-{
- current_radiostack->set_nav1_alt_freq(freq);
-}
-
-void
-FGBFI::setNAV1SelRadial (double radial)
-{
- current_radiostack->set_nav1_sel_radial(radial);
-}
-
-void
-FGBFI::setNAV2Freq (double freq)
-{
- current_radiostack->set_nav2_freq(freq);
-}
-
-void
-FGBFI::setNAV2AltFreq (double freq)
-{
- current_radiostack->set_nav2_alt_freq(freq);
-}
-
-void
-FGBFI::setNAV2SelRadial (double radial)
-{
- current_radiostack->set_nav2_sel_radial(radial);
-}
-
-void
-FGBFI::setADFFreq (double freq)
-{
- current_radiostack->set_adf_freq(freq);
-}
-
-void
-FGBFI::setADFAltFreq (double freq)
-{
- current_radiostack->set_adf_alt_freq(freq);
-}
-
-void
-FGBFI::setADFRotation (double rot)
-{
- current_radiostack->set_adf_rotation(rot);
-}
-
-
\f
////////////////////////////////////////////////////////////////////////
// GPS
//
// Copyright (C) 2000 David Megginson - david@megginson.com
//
+// THIS INTERFACE IS DEPRECATED; USE THE PROPERTY MANAGER INSTEAD.
+//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
static bool getHUDVisible ();
static void setHUDVisible (bool hudVisible);
- static bool getPanelVisible ();
- static void setPanelVisible (bool panelVisible);
-
- static int getPanelXOffset (); // pixels
- static void setPanelXOffset (int i); // pixels
-
- static int getPanelYOffset (); // pixels
- static void setPanelYOffset (int i); // pixels
-
-
// Position
static double getLatitude (); // degrees
static void setLatitude (double latitude); // degrees
// static void setSpeedDown (double speed);
+#if 0
// Controls
static double getThrottle (); // 0.0:1.0
static void setThrottle (double throttle); // 0.0:1.0
static double getCenterBrake (); // 0.0:1.0
static void setCenterBrake (double brake); // 0.0:1.0
+#endif
// Autopilot
static bool getAPAltitudeLock ();
static bool getAPNAV1Lock ();
static void setAPNAV1Lock (bool lock);
- // Radio Navigation
- static double getNAV1Freq ();
- static void setNAV1Freq (double freq);
-
- static double getNAV1AltFreq ();
- static void setNAV1AltFreq (double freq);
-
- static double getNAV1Radial (); // degrees
-
- static double getNAV1SelRadial (); // degrees
- static void setNAV1SelRadial (double radial); // degrees
-
- static double getNAV1DistDME (); // nautical miles
-
- static bool getNAV1TO ();
-
- static bool getNAV1FROM ();
-
- static bool getNAV1InRange ();
-
- static bool getNAV1DMEInRange ();
-
- static double getNAV2Freq ();
- static void setNAV2Freq (double freq);
-
- static double getNAV2AltFreq ();
- static void setNAV2AltFreq (double freq);
-
- static double getNAV2Radial (); // degrees
-
- static double getNAV2SelRadial (); // degrees
- static void setNAV2SelRadial (double radial); // degrees
-
- static double getNAV2DistDME (); // nautical miles
-
- static bool getNAV2TO ();
-
- static bool getNAV2FROM ();
-
- static bool getNAV2InRange ();
-
- static bool getNAV2DMEInRange ();
-
- static double getADFFreq ();
- static void setADFFreq (double freq);
-
- static double getADFAltFreq ();
- static void setADFAltFreq (double freq);
-
- static double getADFRotation (); // degrees
- static void setADFRotation (double rot); // degrees
// GPS
static string getTargetAirport ();
p_fix.append( "Navaids/default.fix" );
current_fixlist->init( p_fix );
- // Initialize the underlying radio stack model
+ // Radio stack subsystem.
current_radiostack = new FGRadioStack;
-
- current_radiostack->search( cur_fdm_state->get_Longitude(),
- cur_fdm_state->get_Latitude(),
- cur_fdm_state->get_Altitude() * FEET_TO_METER );
-
- current_radiostack->update( cur_fdm_state->get_Longitude(),
- cur_fdm_state->get_Latitude(),
- cur_fdm_state->get_Altitude() * FEET_TO_METER );
-
- // Search radio database once per second
- global_events.Register( "fgRadioSearch()", fgRadioSearch,
- fgEVENT::FG_EVENT_READY, 1000);
-
+ current_radiostack->init();
+ current_radiostack->bind();
// Initialize the Cockpit subsystem
if( fgCockpitInit( ¤t_aircraft )) {
"Error reading new panel from " << panel_path );
} else {
FG_LOG( FG_INPUT, FG_INFO, "Loaded new panel from " << panel_path );
+ current_panel->init();
+ current_panel->bind();
}
// Initialize the BFI
return;
}
FG_LOG(FG_INPUT, FG_INFO, "Loaded new panel from " << panel_path);
+ current_panel->unbind();
delete current_panel;
current_panel = new_panel;
return;
// set up moving parts
if (flaps_selector != NULL) {
- flaps_selector->select( (FGBFI::getFlaps() > 0.5f) ? 1 : 2 );
+ flaps_selector->select( (controls.get_flaps() > 0.5f) ? 1 : 2 );
}
if (prop_selector != NULL) {
glDisable( GL_DEPTH_TEST );
// glDisable( GL_CULL_FACE );
// glDisable( GL_TEXTURE_2D );
+
+ // update the controls subsystem
+ controls.update();
+
hud_and_panel->apply();
fgCockpitUpdate();
+ // update the panel subsystem
+ if (current_panel != 0)
+ current_panel->update();
+
// We can do translucent menus, so why not. :-)
menus->apply();
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
cur_fdm_state->get_Latitude() );
// Update radio stack model
- current_radiostack->update( cur_fdm_state->get_Longitude(),
- cur_fdm_state->get_Latitude(),
- cur_fdm_state->get_Altitude() * FEET_TO_METER );
+ current_radiostack->update();
}