Merge branch 'next' of gitorious.org:fg/flightgear into next
This commit is contained in:
commit
894f066370
14 changed files with 212 additions and 91 deletions
src
|
@ -31,7 +31,6 @@
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/structure/exception.hxx>
|
||||||
|
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
#include <FDM/fdm_shell.hxx>
|
|
||||||
|
|
||||||
#include "replay.hxx"
|
#include "replay.hxx"
|
||||||
#include "flightrecorder.hxx"
|
#include "flightrecorder.hxx"
|
||||||
|
@ -235,43 +234,52 @@ FGReplay::update( double dt )
|
||||||
|
|
||||||
if ( disable_replay->getBoolValue() )
|
if ( disable_replay->getBoolValue() )
|
||||||
{
|
{
|
||||||
current_replay_state = replay_master->getIntValue();
|
if (fgGetBool("/sim/freeze/master",false)||
|
||||||
replay_master->setIntValue(0);
|
fgGetBool("/sim/freeze/clock",false))
|
||||||
replay_time->setDoubleValue(0);
|
{
|
||||||
replay_time_str->setStringValue("");
|
fgSetBool("/sim/freeze/master",false);
|
||||||
disable_replay->setBoolValue(0);
|
fgSetBool("/sim/freeze/clock",false);
|
||||||
speed_up->setDoubleValue(1.0);
|
last_replay_state = 1;
|
||||||
fgSetString("/sim/messages/copilot", "Replay stopped");
|
}
|
||||||
|
else
|
||||||
|
if ((replay_master->getIntValue() != 3)||
|
||||||
|
(last_replay_state == 3))
|
||||||
|
{
|
||||||
|
current_replay_state = replay_master->getIntValue();
|
||||||
|
replay_master->setIntValue(0);
|
||||||
|
replay_time->setDoubleValue(0);
|
||||||
|
replay_time_str->setStringValue("");
|
||||||
|
disable_replay->setBoolValue(0);
|
||||||
|
speed_up->setDoubleValue(1.0);
|
||||||
|
speed_up->setDoubleValue(1.0);
|
||||||
|
if (fgGetBool("/sim/replay/mute",false))
|
||||||
|
{
|
||||||
|
fgSetBool("/sim/sound/enabled",true);
|
||||||
|
fgSetBool("/sim/replay/mute",false);
|
||||||
|
}
|
||||||
|
fgSetString("/sim/messages/copilot", "Replay stopped. Your controls!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int replay_state = replay_master->getIntValue();
|
int replay_state = replay_master->getIntValue();
|
||||||
|
|
||||||
if ((replay_state > 0)&&
|
|
||||||
(last_replay_state == 0))
|
|
||||||
{
|
|
||||||
// replay is starting, suspend FDM
|
|
||||||
/* FIXME we need to suspend/resume the FDM - not the entire FDM shell.
|
|
||||||
* FDM isn't available via the global subsystem manager yet, so need a
|
|
||||||
* method at the FDMshell for now */
|
|
||||||
((FDMShell*) globals->get_subsystem("flight"))->getFDM()->suspend();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if ((replay_state == 0)&&
|
if ((replay_state == 0)&&
|
||||||
(last_replay_state > 0))
|
(last_replay_state > 0))
|
||||||
{
|
{
|
||||||
if (current_replay_state == 3)
|
if (current_replay_state == 3)
|
||||||
{
|
{
|
||||||
// "my controls!" requested: pilot takes control at current replay position...
|
// take control at current replay position ("My controls!").
|
||||||
// May need to uncrash the aircraft here :)
|
// May need to uncrash the aircraft here :)
|
||||||
fgSetBool("/sim/crashed", false);
|
fgSetBool("/sim/crashed", false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// replay was active, restore most recent frame
|
// normal replay exit, restore most recent frame
|
||||||
replay(DBL_MAX);
|
replay(DBL_MAX);
|
||||||
}
|
}
|
||||||
// replay is finished, resume FDM
|
|
||||||
((FDMShell*) globals->get_subsystem("flight"))->getFDM()->resume();
|
// replay is finished
|
||||||
|
last_replay_state = replay_state;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remember recent state
|
// remember recent state
|
||||||
|
@ -282,7 +290,8 @@ FGReplay::update( double dt )
|
||||||
case 0:
|
case 0:
|
||||||
// replay inactive, keep recording
|
// replay inactive, keep recording
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: // normal replay
|
||||||
|
case 3: // prepare to resume normal flight at current replay position
|
||||||
{
|
{
|
||||||
// replay active
|
// replay active
|
||||||
double current_time = replay_time->getDoubleValue();
|
double current_time = replay_time->getDoubleValue();
|
||||||
|
@ -312,8 +321,6 @@ FGReplay::update( double dt )
|
||||||
return; // don't record the replay session
|
return; // don't record the replay session
|
||||||
}
|
}
|
||||||
case 2: // normal replay operation
|
case 2: // normal replay operation
|
||||||
case 3: // replay operation, prepare to resume normal flight at current replay position
|
|
||||||
// replay paused, no-op
|
|
||||||
return; // don't record the replay session
|
return; // don't record the replay session
|
||||||
default:
|
default:
|
||||||
throw sg_range_exception("unknown FGReplay state");
|
throw sg_range_exception("unknown FGReplay state");
|
||||||
|
|
|
@ -284,16 +284,20 @@ void Gear::calcForce(RigidBody* body, State *s, float* v, float* rot)
|
||||||
|
|
||||||
// Don't bother if it's not down
|
// Don't bother if it's not down
|
||||||
if(_extension < 1)
|
if(_extension < 1)
|
||||||
return;
|
{
|
||||||
|
_wow = 0;
|
||||||
|
_frac = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Dont bother if we are in the "wrong" ground
|
// Dont bother if we are in the "wrong" ground
|
||||||
if (!((_onWater&&!_ground_isSolid)||(_onSolid&&_ground_isSolid))) {
|
if (!((_onWater&&!_ground_isSolid)||(_onSolid&&_ground_isSolid))) {
|
||||||
_wow = 0;
|
_wow = 0;
|
||||||
_frac = 0;
|
_frac = 0;
|
||||||
_compressDist = 0;
|
_compressDist = 0;
|
||||||
_rollSpeed = 0;
|
_rollSpeed = 0;
|
||||||
_casterAngle = 0;
|
_casterAngle = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The ground plane transformed to the local frame.
|
// The ground plane transformed to the local frame.
|
||||||
|
|
|
@ -195,9 +195,10 @@ void YASim::update(double dt)
|
||||||
int iterations = _calc_multiloop(dt);
|
int iterations = _calc_multiloop(dt);
|
||||||
|
|
||||||
// If we're crashed, then we don't care
|
// If we're crashed, then we don't care
|
||||||
if(_fdm->getAirplane()->getModel()->isCrashed()) {
|
if(fgGetBool("/sim/crashed") || _fdm->getAirplane()->getModel()->isCrashed()) {
|
||||||
if(!fgGetBool("/sim/crashed"))
|
if(!fgGetBool("/sim/crashed"))
|
||||||
fgSetBool("/sim/crashed", true);
|
fgSetBool("/sim/crashed", true);
|
||||||
|
_fdm->getAirplane()->getModel()->setCrashed(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +312,7 @@ void YASim::copyToYASim(bool copyState)
|
||||||
Math::set3(v, s.v);
|
Math::set3(v, s.v);
|
||||||
|
|
||||||
if(copyState || needCopy)
|
if(copyState || needCopy)
|
||||||
model->setState(&s);
|
model->setState(&s);
|
||||||
|
|
||||||
// wind
|
// wind
|
||||||
Math::tmul33(xyz2ned, wind, wind);
|
Math::tmul33(xyz2ned, wind, wind);
|
||||||
|
@ -505,3 +506,19 @@ void YASim::copyFromYASim()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Reinit the FDM.
|
||||||
|
* This is only used after a replay session and when the user requested to resume at
|
||||||
|
* a past point of time. In thise case the FDM must reload all values from the property
|
||||||
|
* tree (as given by the replay system). */
|
||||||
|
void YASim::reinit()
|
||||||
|
{
|
||||||
|
// Process inputs. Use excessive value for dt to make sure all transition effects
|
||||||
|
// have reached their final state (i.e. gear is extended/retracted) - which is vital
|
||||||
|
// for many properties to be complete before the first FDM run (otherwise the gear may
|
||||||
|
// still be up, thrust-reversers/speed-brakes/... may still be partially deployed...).
|
||||||
|
_fdm->getExternalInput(1000);
|
||||||
|
|
||||||
|
// get current FDM values from the property tree
|
||||||
|
copyToYASim(true);
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ public:
|
||||||
// Load externally set stuff into the FDM
|
// Load externally set stuff into the FDM
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void bind();
|
virtual void bind();
|
||||||
|
virtual void reinit();
|
||||||
|
|
||||||
// Run an iteration
|
// Run an iteration
|
||||||
virtual void update(double dt);
|
virtual void update(double dt);
|
||||||
|
|
|
@ -72,6 +72,17 @@ void FDMShell::init()
|
||||||
{
|
{
|
||||||
_props = globals->get_props();
|
_props = globals->get_props();
|
||||||
fgSetBool("/sim/fdm-initialized", false);
|
fgSetBool("/sim/fdm-initialized", false);
|
||||||
|
|
||||||
|
_wind_north = _props->getNode("environment/wind-from-north-fps", true);
|
||||||
|
_wind_east = _props->getNode("environment/wind-from-east-fps", true);
|
||||||
|
_wind_down = _props->getNode("environment/wind-from-down-fps", true);
|
||||||
|
_control_fdm_atmo = _props->getNode("environment/params/control-fdm-atmosphere", true);
|
||||||
|
_temp_degc = _props->getNode("environment/temperature-degc", true);
|
||||||
|
_pressure_inhg = _props->getNode("environment/pressure-inhg", true);
|
||||||
|
_density_slugft = _props->getNode("environment/density-slugft3", true);
|
||||||
|
_data_logging = _props->getNode("/sim/temp/fdm-data-logging", true);
|
||||||
|
_replay_master = _props->getNode("/sim/freeze/replay-state", true);
|
||||||
|
|
||||||
createImplementation();
|
createImplementation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,30 +149,42 @@ void FDMShell::update(double dt)
|
||||||
|
|
||||||
// pull environmental data in, since the FDMs are lazy
|
// pull environmental data in, since the FDMs are lazy
|
||||||
_impl->set_Velocities_Local_Airmass(
|
_impl->set_Velocities_Local_Airmass(
|
||||||
_props->getDoubleValue("environment/wind-from-north-fps", 0.0),
|
_wind_north->getDoubleValue(),
|
||||||
_props->getDoubleValue("environment/wind-from-east-fps", 0.0),
|
_wind_east->getDoubleValue(),
|
||||||
_props->getDoubleValue("environment/wind-from-down-fps", 0.0));
|
_wind_down->getDoubleValue());
|
||||||
|
|
||||||
if (_props->getBoolValue("environment/params/control-fdm-atmosphere")) {
|
if (_control_fdm_atmo->getBoolValue()) {
|
||||||
// convert from Rankine to Celsius
|
// convert from Rankine to Celsius
|
||||||
double tempDegC = _props->getDoubleValue("environment/temperature-degc");
|
double tempDegC = _temp_degc->getDoubleValue();
|
||||||
_impl->set_Static_temperature((9.0/5.0) * (tempDegC + 273.15));
|
_impl->set_Static_temperature((9.0/5.0) * (tempDegC + 273.15));
|
||||||
|
|
||||||
// convert from inHG to PSF
|
// convert from inHG to PSF
|
||||||
double pressureInHg = _props->getDoubleValue("environment/pressure-inhg");
|
double pressureInHg = _pressure_inhg->getDoubleValue();
|
||||||
_impl->set_Static_pressure(pressureInHg * 70.726566);
|
_impl->set_Static_pressure(pressureInHg * 70.726566);
|
||||||
// keep in slugs/ft^3
|
// keep in slugs/ft^3
|
||||||
_impl->set_Density(_props->getDoubleValue("environment/density-slugft3"));
|
_impl->set_Density(_density_slugft->getDoubleValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool doLog = _props->getBoolValue("/sim/temp/fdm-data-logging", false);
|
bool doLog = _data_logging->getBoolValue();
|
||||||
if (doLog != _dataLogging) {
|
if (doLog != _dataLogging) {
|
||||||
_dataLogging = doLog;
|
_dataLogging = doLog;
|
||||||
_impl->ToggleDataLogging(doLog);
|
_impl->ToggleDataLogging(doLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_impl->is_suspended())
|
switch(_replay_master->getIntValue())
|
||||||
_impl->update(dt);
|
{
|
||||||
|
case 0:
|
||||||
|
// normal FDM operation
|
||||||
|
_impl->update(dt);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// resume FDM operation at current replay position
|
||||||
|
_impl->reinit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// replay is active
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FDMShell::createImplementation()
|
void FDMShell::createImplementation()
|
||||||
|
@ -251,14 +274,3 @@ void FDMShell::createImplementation()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Return FDM subsystem.
|
|
||||||
*/
|
|
||||||
|
|
||||||
SGSubsystem* FDMShell::getFDM()
|
|
||||||
{
|
|
||||||
/* FIXME we could drop/replace this method, when _impl was a added
|
|
||||||
* to the global subsystem manager - like other proper subsystems... */
|
|
||||||
return _impl;
|
|
||||||
}
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class FDMShell : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FDMShell();
|
FDMShell();
|
||||||
~FDMShell();
|
virtual ~FDMShell();
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void reinit();
|
virtual void reinit();
|
||||||
|
@ -50,7 +50,6 @@ public:
|
||||||
virtual void unbind();
|
virtual void unbind();
|
||||||
|
|
||||||
virtual void update(double dt);
|
virtual void update(double dt);
|
||||||
SGSubsystem* getFDM();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -58,8 +57,12 @@ private:
|
||||||
|
|
||||||
TankPropertiesList _tankProperties;
|
TankPropertiesList _tankProperties;
|
||||||
FGInterface* _impl;
|
FGInterface* _impl;
|
||||||
SGPropertyNode* _props; // root property tree for this FDM instance
|
SGPropertyNode_ptr _props; // root property tree for this FDM instance
|
||||||
bool _dataLogging;
|
bool _dataLogging;
|
||||||
|
|
||||||
|
SGPropertyNode_ptr _wind_north, _wind_east,_wind_down;
|
||||||
|
SGPropertyNode_ptr _control_fdm_atmo,_temp_degc,_pressure_inhg;
|
||||||
|
SGPropertyNode_ptr _density_slugft, _data_logging, _replay_master;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // of FG_FDM_SHELL_HXX
|
#endif // of FG_FDM_SHELL_HXX
|
||||||
|
|
|
@ -42,6 +42,7 @@ class GraphicsContext;
|
||||||
// gui.cxx
|
// gui.cxx
|
||||||
extern void guiStartInit(osg::GraphicsContext*);
|
extern void guiStartInit(osg::GraphicsContext*);
|
||||||
extern bool guiFinishInit();
|
extern bool guiFinishInit();
|
||||||
|
extern bool openBrowser(string address);
|
||||||
extern void mkDialog(const char *txt);
|
extern void mkDialog(const char *txt);
|
||||||
extern void guiErrorMessage(const char *txt);
|
extern void guiErrorMessage(const char *txt);
|
||||||
extern void guiErrorMessage(const char *txt, const sg_throwable &throwable);
|
extern void guiErrorMessage(const char *txt, const sg_throwable &throwable);
|
||||||
|
|
|
@ -156,46 +156,60 @@ void guiErrorMessage (const char *txt, const sg_throwable &throwable)
|
||||||
the Gui callback functions
|
the Gui callback functions
|
||||||
____________________________________________________________________*/
|
____________________________________________________________________*/
|
||||||
|
|
||||||
|
void helpCb()
|
||||||
// Hier Neu :-) This is my newly added code
|
|
||||||
// Added by David Findlay <nedz@bigpond.com>
|
|
||||||
// on Sunday 3rd of December
|
|
||||||
|
|
||||||
|
|
||||||
void helpCb ()
|
|
||||||
{
|
{
|
||||||
string command;
|
openBrowser( "Docs/index.html" );
|
||||||
|
}
|
||||||
SGPath path( globals->get_fg_root() );
|
|
||||||
path.append( "Docs/index.html" );
|
bool openBrowser(string address)
|
||||||
|
{
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
// do not resolve addresses with given protocol, i.e. "http://...", "ftp://..."
|
||||||
|
if (address.find("://")==string::npos)
|
||||||
|
{
|
||||||
|
// resolve local file path
|
||||||
|
SGPath path(address);
|
||||||
|
path = globals->resolve_maybe_aircraft_path(address);
|
||||||
|
if (!path.isNull())
|
||||||
|
address = path.str();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mkDialog ("Sorry, file not found!");
|
||||||
|
SG_LOG(SG_GENERAL, SG_ALERT, "openBrowser: Cannot find requested file '"
|
||||||
|
<< address << "'.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
command = globals->get_browser();
|
string command = globals->get_browser();
|
||||||
string::size_type pos;
|
string::size_type pos;
|
||||||
if ((pos = command.find("%u", 0)) != string::npos)
|
if ((pos = command.find("%u", 0)) != string::npos)
|
||||||
command.replace(pos, 2, path.str());
|
command.replace(pos, 2, address);
|
||||||
else
|
else
|
||||||
command += " " + path.str();
|
command += " " + address;
|
||||||
|
|
||||||
command += " &";
|
command += " &";
|
||||||
system( command.c_str() );
|
ok = (system( command.c_str() ) == 0);
|
||||||
|
|
||||||
#else // _WIN32
|
#else // _WIN32
|
||||||
|
|
||||||
// Look for favorite browser
|
// Look for favorite browser
|
||||||
char win32_name[1024];
|
char win32_name[1024];
|
||||||
# ifdef __CYGWIN__
|
# ifdef __CYGWIN__
|
||||||
cygwin32_conv_to_full_win32_path(path.c_str(),win32_name);
|
cygwin32_conv_to_full_win32_path(address.c_str(),win32_name);
|
||||||
# else
|
# else
|
||||||
strncpy(win32_name,path.c_str(), 1024);
|
strncpy(win32_name,address.c_str(), 1024);
|
||||||
# endif
|
# endif
|
||||||
ShellExecute ( NULL, "open", win32_name, NULL, NULL,
|
ShellExecute ( NULL, "open", win32_name, NULL, NULL,
|
||||||
SW_SHOWNORMAL ) ;
|
SW_SHOWNORMAL ) ;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mkDialog ("Help started in your web browser window.");
|
mkDialog("The file is shown in your web browser window.");
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( TR_HIRES_SNAP)
|
#if defined( TR_HIRES_SNAP)
|
||||||
|
|
|
@ -37,14 +37,6 @@ do_hires_snapshot_dialog (const SGPropertyNode * arg)
|
||||||
}
|
}
|
||||||
#endif // TR_HIRES_SNAP
|
#endif // TR_HIRES_SNAP
|
||||||
|
|
||||||
extern void helpCb ();
|
|
||||||
static bool
|
|
||||||
do_help_dialog (const SGPropertyNode * arg)
|
|
||||||
{
|
|
||||||
helpCb();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
const char * name;
|
const char * name;
|
||||||
SGCommandMgr::command_t command;
|
SGCommandMgr::command_t command;
|
||||||
|
@ -52,7 +44,6 @@ static struct {
|
||||||
#if defined(TR_HIRES_SNAP)
|
#if defined(TR_HIRES_SNAP)
|
||||||
{ "old-hires-snapshot-dialog", do_hires_snapshot_dialog },
|
{ "old-hires-snapshot-dialog", do_hires_snapshot_dialog },
|
||||||
#endif
|
#endif
|
||||||
{ "old-help-dialog", do_help_dialog },
|
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -119,8 +119,17 @@ DME::update (double delta_time_sec)
|
||||||
if (_time_before_search_sec < 0) {
|
if (_time_before_search_sec < 0) {
|
||||||
_time_before_search_sec = 1.0;
|
_time_before_search_sec = 1.0;
|
||||||
|
|
||||||
_navrecord = globals->get_dmelist()->findByFreq( frequency_mhz,
|
if( fgGetBool( "/sim/realism/dme-fallback-to-loc", true ) ) {
|
||||||
globals->get_aircraft_position());
|
if( NULL == (_navrecord = globals->get_loclist()->findByFreq( frequency_mhz,
|
||||||
|
globals->get_aircraft_position())) ) {
|
||||||
|
|
||||||
|
_navrecord = globals->get_dmelist()->findByFreq( frequency_mhz,
|
||||||
|
globals->get_aircraft_position());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_navrecord = globals->get_dmelist()->findByFreq( frequency_mhz,
|
||||||
|
globals->get_aircraft_position());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's off, don't bother.
|
// If it's off, don't bother.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Written by Curtis Olson, started April 2000.
|
// Written by Curtis Olson, started April 2000.
|
||||||
// Rewritten by Torsten Dreyer, August 2011
|
// Rewritten by Torsten Dreyer, August 2011
|
||||||
//
|
//
|
||||||
// Copyright (C) 2000 - 2002 Curtis L. Olson - http://www.flightgear.org/~curt
|
// Copyright (C) 2000 - 2011 Curtis L. Olson - http://www.flightgear.org/~curt
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License as
|
// modify it under the terms of the GNU General Public License as
|
||||||
|
@ -33,6 +33,7 @@
|
||||||
#include <simgear/math/interpolater.hxx>
|
#include <simgear/math/interpolater.hxx>
|
||||||
#include <simgear/sg_inlines.h>
|
#include <simgear/sg_inlines.h>
|
||||||
#include <simgear/props/propertyObject.hxx>
|
#include <simgear/props/propertyObject.hxx>
|
||||||
|
#include <simgear/misc/strutils.hxx>
|
||||||
|
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
#include <Navaids/navlist.hxx>
|
#include <Navaids/navlist.hxx>
|
||||||
|
@ -144,6 +145,7 @@ public:
|
||||||
virtual double getRange_nm( const SGGeod & aircraftPosition );
|
virtual double getRange_nm( const SGGeod & aircraftPosition );
|
||||||
virtual void display( NavIndicator & navIndicator ) = 0;
|
virtual void display( NavIndicator & navIndicator ) = 0;
|
||||||
virtual bool valid() const { return NULL != _navRecord && true == _serviceable; }
|
virtual bool valid() const { return NULL != _navRecord && true == _serviceable; }
|
||||||
|
virtual const std::string getIdent() const { return _ident; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual double computeSignalQuality_norm( const SGGeod & aircraftPosition );
|
virtual double computeSignalQuality_norm( const SGGeod & aircraftPosition );
|
||||||
|
@ -220,7 +222,7 @@ void NavRadioComponentWithIdent::update( double dt, const SGGeod & aircraftPosit
|
||||||
_audioIdent->setIdent("", 0.0 );
|
_audioIdent->setIdent("", 0.0 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_audioIdent->setIdent( _navRecord->get_trans_ident(), SGMiscd::clip(_identVolume, 0.0, 1.0) );
|
_audioIdent->setIdent( _ident, SGMiscd::clip(_identVolume, 0.0, 1.0) );
|
||||||
}
|
}
|
||||||
|
|
||||||
NavRadioComponent::NavRadioComponent( const std::string & name, SGPropertyNode_ptr rootNode ) :
|
NavRadioComponent::NavRadioComponent( const std::string & name, SGPropertyNode_ptr rootNode ) :
|
||||||
|
@ -851,6 +853,11 @@ private:
|
||||||
NavRadioImpl * _navRadioImpl;
|
NavRadioImpl * _navRadioImpl;
|
||||||
SGPropertyNode_ptr is_valid_node;
|
SGPropertyNode_ptr is_valid_node;
|
||||||
SGPropertyNode_ptr nav_serviceable_node;
|
SGPropertyNode_ptr nav_serviceable_node;
|
||||||
|
SGPropertyNode_ptr nav_id_node;
|
||||||
|
SGPropertyNode_ptr id_c1_node;
|
||||||
|
SGPropertyNode_ptr id_c2_node;
|
||||||
|
SGPropertyNode_ptr id_c3_node;
|
||||||
|
SGPropertyNode_ptr id_c4_node;
|
||||||
} _legacy;
|
} _legacy;
|
||||||
|
|
||||||
const static int VOR_COMPONENT = 0;
|
const static int VOR_COMPONENT = 0;
|
||||||
|
@ -937,7 +944,7 @@ void NavRadioImpl::update( double dt )
|
||||||
if( _stationTTL <= 0.0 )
|
if( _stationTTL <= 0.0 )
|
||||||
_stationTTL = 30.0;
|
_stationTTL = 30.0;
|
||||||
|
|
||||||
_legacy.init();
|
_legacy.update( dt );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavRadioImpl::Legacy::init()
|
void NavRadioImpl::Legacy::init()
|
||||||
|
@ -945,6 +952,12 @@ void NavRadioImpl::Legacy::init()
|
||||||
is_valid_node = _navRadioImpl->_rootNode->getChild("data-is-valid", 0, true);
|
is_valid_node = _navRadioImpl->_rootNode->getChild("data-is-valid", 0, true);
|
||||||
nav_serviceable_node = _navRadioImpl->_rootNode->getChild("serviceable", 0, true);
|
nav_serviceable_node = _navRadioImpl->_rootNode->getChild("serviceable", 0, true);
|
||||||
|
|
||||||
|
nav_id_node = _navRadioImpl->_rootNode->getChild("nav-id", 0, true );
|
||||||
|
id_c1_node = _navRadioImpl->_rootNode->getChild("nav-id_asc1", 0, true );
|
||||||
|
id_c2_node = _navRadioImpl->_rootNode->getChild("nav-id_asc2", 0, true );
|
||||||
|
id_c3_node = _navRadioImpl->_rootNode->getChild("nav-id_asc3", 0, true );
|
||||||
|
id_c4_node = _navRadioImpl->_rootNode->getChild("nav-id_asc4", 0, true );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavRadioImpl::Legacy::update( double dt )
|
void NavRadioImpl::Legacy::update( double dt )
|
||||||
|
@ -952,6 +965,18 @@ void NavRadioImpl::Legacy::update( double dt )
|
||||||
is_valid_node->setBoolValue(
|
is_valid_node->setBoolValue(
|
||||||
_navRadioImpl->_components[VOR_COMPONENT]->valid() || _navRadioImpl->_components[LOC_COMPONENT]->valid()
|
_navRadioImpl->_components[VOR_COMPONENT]->valid() || _navRadioImpl->_components[LOC_COMPONENT]->valid()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
string ident = _navRadioImpl->_components[VOR_COMPONENT]->getIdent();
|
||||||
|
if( ident.empty() )
|
||||||
|
ident = _navRadioImpl->_components[LOC_COMPONENT]->getIdent();
|
||||||
|
|
||||||
|
nav_id_node->setStringValue( ident );
|
||||||
|
|
||||||
|
ident = simgear::strutils::rpad( ident, 4, ' ' );
|
||||||
|
id_c1_node->setIntValue( (int)ident[0] );
|
||||||
|
id_c2_node->setIntValue( (int)ident[1] );
|
||||||
|
id_c3_node->setIntValue( (int)ident[2] );
|
||||||
|
id_c4_node->setIntValue( (int)ident[3] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,23 @@
|
||||||
|
// navradio.hxx -- class to manage a nav radio instance
|
||||||
|
//
|
||||||
|
// Written by Torsten Dreyer, started August 2011
|
||||||
|
//
|
||||||
|
// Copyright (C) 2000 - 2011 Curtis L. Olson - http://www.flightgear.org/~curt
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful, but
|
||||||
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
#ifndef _FG_INSTRUMENTATION_NAVRADIO_HXX
|
#ifndef _FG_INSTRUMENTATION_NAVRADIO_HXX
|
||||||
|
|
|
@ -215,11 +215,13 @@ bool FGEventHandler::handle(const osgGA::GUIEventAdapter& ea,
|
||||||
button = 3;
|
button = 3;
|
||||||
else if (ea.getScrollingDeltaY() < 0)
|
else if (ea.getScrollingDeltaY() < 0)
|
||||||
button = 4;
|
button = 4;
|
||||||
|
else
|
||||||
|
button = -1;
|
||||||
} else if (ea.getScrollingMotion() == osgGA::GUIEventAdapter::SCROLL_UP)
|
} else if (ea.getScrollingMotion() == osgGA::GUIEventAdapter::SCROLL_UP)
|
||||||
button = 3;
|
button = 3;
|
||||||
else
|
else
|
||||||
button = 4;
|
button = 4;
|
||||||
if (mouseClickHandler) {
|
if (mouseClickHandler && button != -1) {
|
||||||
(*mouseClickHandler)(button, 0, x, y, mainWindow, &ea);
|
(*mouseClickHandler)(button, 0, x, y, mainWindow, &ea);
|
||||||
(*mouseClickHandler)(button, 1, x, y, mainWindow, &ea);
|
(*mouseClickHandler)(button, 1, x, y, mainWindow, &ea);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1040,6 +1040,20 @@ do_dialog_update (const SGPropertyNode * arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
do_open_browser (const SGPropertyNode * arg)
|
||||||
|
{
|
||||||
|
string path;
|
||||||
|
if (arg->hasValue("path"))
|
||||||
|
path = arg->getStringValue("path");
|
||||||
|
else
|
||||||
|
if (arg->hasValue("url"))
|
||||||
|
path = arg->getStringValue("url");
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return openBrowser(path);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply a value in the active XML-configured dialog.
|
* Apply a value in the active XML-configured dialog.
|
||||||
|
@ -1468,6 +1482,7 @@ static struct {
|
||||||
{ "dialog-close", do_dialog_close },
|
{ "dialog-close", do_dialog_close },
|
||||||
{ "dialog-update", do_dialog_update },
|
{ "dialog-update", do_dialog_update },
|
||||||
{ "dialog-apply", do_dialog_apply },
|
{ "dialog-apply", do_dialog_apply },
|
||||||
|
{ "open-browser", do_open_browser },
|
||||||
{ "gui-redraw", do_gui_redraw },
|
{ "gui-redraw", do_gui_redraw },
|
||||||
{ "add-model", do_add_model },
|
{ "add-model", do_add_model },
|
||||||
{ "set-cursor", do_set_cursor },
|
{ "set-cursor", do_set_cursor },
|
||||||
|
|
Loading…
Add table
Reference in a new issue