Merge branch 'next' of gitorious.org:fg/flightgear into next
This commit is contained in:
commit
9e764ed4b0
6 changed files with 50 additions and 20 deletions
|
@ -345,7 +345,7 @@ flightgear::WayptRef FGRouteMgr::removeWayptAtIndex(int aIndex)
|
||||||
{
|
{
|
||||||
int index = aIndex;
|
int index = aIndex;
|
||||||
if (aIndex < 0) { // negative indices count the the end
|
if (aIndex < 0) { // negative indices count the the end
|
||||||
index = _route.size() - index;
|
index = _route.size() + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((index < 0) || (index >= numWaypts())) {
|
if ((index < 0) || (index >= numWaypts())) {
|
||||||
|
@ -1027,7 +1027,7 @@ void FGRouteMgr::jumpToIndex(int index)
|
||||||
|
|
||||||
void FGRouteMgr::currentWaypointChanged()
|
void FGRouteMgr::currentWaypointChanged()
|
||||||
{
|
{
|
||||||
Waypt* cur = (_currentIndex<numWaypts()) ? currentWaypt() : NULL;
|
Waypt* cur = currentWaypt();
|
||||||
Waypt* next = nextWaypt();
|
Waypt* next = nextWaypt();
|
||||||
|
|
||||||
wp0->getChild("id")->setStringValue(cur ? cur->ident() : "");
|
wp0->getChild("id")->setStringValue(cur ? cur->ident() : "");
|
||||||
|
@ -1050,6 +1050,8 @@ int FGRouteMgr::findWayptIndex(const SGGeod& aPos) const
|
||||||
|
|
||||||
Waypt* FGRouteMgr::currentWaypt() const
|
Waypt* FGRouteMgr::currentWaypt() const
|
||||||
{
|
{
|
||||||
|
if ((_currentIndex < 0) || (_currentIndex >= numWaypts()))
|
||||||
|
return NULL;
|
||||||
return wayptAtIndex(_currentIndex);
|
return wayptAtIndex(_currentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1064,7 +1066,7 @@ Waypt* FGRouteMgr::previousWaypt() const
|
||||||
|
|
||||||
Waypt* FGRouteMgr::nextWaypt() const
|
Waypt* FGRouteMgr::nextWaypt() const
|
||||||
{
|
{
|
||||||
if ((_currentIndex + 1) >= numWaypts()) {
|
if ((_currentIndex < 0) || ((_currentIndex + 1) >= numWaypts())) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1353,4 +1355,3 @@ void FGRouteMgr::setDestinationICAO(const char* aIdent)
|
||||||
|
|
||||||
arrivalChanged();
|
arrivalChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -697,6 +697,8 @@ void GPS::routeManagerSequenced()
|
||||||
int index = _routeMgr->currentIndex(),
|
int index = _routeMgr->currentIndex(),
|
||||||
count = _routeMgr->numWaypts();
|
count = _routeMgr->numWaypts();
|
||||||
if ((index < 0) || (index >= count)) {
|
if ((index < 0) || (index >= count)) {
|
||||||
|
_currentWaypt=NULL;
|
||||||
|
_prevWaypt=NULL;
|
||||||
SG_LOG(SG_INSTR, SG_ALERT, "GPS: malformed route, index=" << index);
|
SG_LOG(SG_INSTR, SG_ALERT, "GPS: malformed route, index=" << index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -971,6 +973,8 @@ void GPS::driveAutopilot()
|
||||||
|
|
||||||
void GPS::wp1Changed()
|
void GPS::wp1Changed()
|
||||||
{
|
{
|
||||||
|
if (!_currentWaypt)
|
||||||
|
return;
|
||||||
if (_mode == "leg") {
|
if (_mode == "leg") {
|
||||||
_wayptController.reset(WayptController::createForWaypt(this, _currentWaypt));
|
_wayptController.reset(WayptController::createForWaypt(this, _currentWaypt));
|
||||||
} else if (_mode == "obs") {
|
} else if (_mode == "obs") {
|
||||||
|
@ -1082,7 +1086,7 @@ double GPS::getCDIDeflection() const
|
||||||
|
|
||||||
const char* GPS::getWP0Ident() const
|
const char* GPS::getWP0Ident() const
|
||||||
{
|
{
|
||||||
if (!_dataValid || (_mode != "leg")) {
|
if (!_dataValid || (_mode != "leg") || (!_prevWaypt)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1096,7 +1100,7 @@ const char* GPS::getWP0Name() const
|
||||||
|
|
||||||
const char* GPS::getWP1Ident() const
|
const char* GPS::getWP1Ident() const
|
||||||
{
|
{
|
||||||
if (!_dataValid) {
|
if ((!_dataValid)||(!_currentWaypt)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,12 +92,19 @@ SGPropertyNode_ptr createServiceableProp(SGPropertyNode* aParent, const char* aN
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
FGNavRadio::FGNavRadio(SGPropertyNode *node) :
|
FGNavRadio::FGNavRadio(SGPropertyNode *node) :
|
||||||
|
term_tbl(NULL),
|
||||||
|
low_tbl(NULL),
|
||||||
|
high_tbl(NULL),
|
||||||
lon_node(fgGetNode("/position/longitude-deg", true)),
|
lon_node(fgGetNode("/position/longitude-deg", true)),
|
||||||
lat_node(fgGetNode("/position/latitude-deg", true)),
|
lat_node(fgGetNode("/position/latitude-deg", true)),
|
||||||
alt_node(fgGetNode("/position/altitude-ft", true)),
|
alt_node(fgGetNode("/position/altitude-ft", true)),
|
||||||
|
_operable(false),
|
||||||
play_count(0),
|
play_count(0),
|
||||||
last_time(0),
|
last_time(0),
|
||||||
target_radial(0.0),
|
target_radial(0.0),
|
||||||
|
effective_range(0.0),
|
||||||
|
target_gs(0.0),
|
||||||
|
twist(0.0),
|
||||||
horiz_vel(0.0),
|
horiz_vel(0.0),
|
||||||
last_x(0.0),
|
last_x(0.0),
|
||||||
last_loc_dist(0.0),
|
last_loc_dist(0.0),
|
||||||
|
@ -107,6 +114,16 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
|
||||||
_name(node->getStringValue("name", "nav")),
|
_name(node->getStringValue("name", "nav")),
|
||||||
_num(node->getIntValue("number", 0)),
|
_num(node->getIntValue("number", 0)),
|
||||||
_time_before_search_sec(-1.0),
|
_time_before_search_sec(-1.0),
|
||||||
|
_gsCart(SGVec3d::zeros()),
|
||||||
|
_gsAxis(SGVec3d::zeros()),
|
||||||
|
_gsVertical(SGVec3d::zeros()),
|
||||||
|
_dmeInRange(false),
|
||||||
|
_toFlag(false),
|
||||||
|
_fromFlag(false),
|
||||||
|
_cdiDeflection(0.0),
|
||||||
|
_cdiCrossTrackErrorM(0.0),
|
||||||
|
_gsNeedleDeflection(0.0),
|
||||||
|
_gsNeedleDeflectionNorm(0.0),
|
||||||
_sgr(NULL)
|
_sgr(NULL)
|
||||||
{
|
{
|
||||||
SGPath path( globals->get_fg_root() );
|
SGPath path( globals->get_fg_root() );
|
||||||
|
@ -120,8 +137,7 @@ FGNavRadio::FGNavRadio(SGPropertyNode *node) :
|
||||||
term_tbl = new SGInterpTable( term.str() );
|
term_tbl = new SGInterpTable( term.str() );
|
||||||
low_tbl = new SGInterpTable( low.str() );
|
low_tbl = new SGInterpTable( low.str() );
|
||||||
high_tbl = new SGInterpTable( high.str() );
|
high_tbl = new SGInterpTable( high.str() );
|
||||||
|
|
||||||
|
|
||||||
string branch("/instrumentation/" + _name);
|
string branch("/instrumentation/" + _name);
|
||||||
_radio_node = fgGetNode(branch.c_str(), _num, true);
|
_radio_node = fgGetNode(branch.c_str(), _num, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,8 +137,6 @@ class FGNavRadio : public SGSubsystem, public SGPropertyChangeListener
|
||||||
string dme_fx_name;
|
string dme_fx_name;
|
||||||
|
|
||||||
double target_radial;
|
double target_radial;
|
||||||
SGTimeStamp prev_time;
|
|
||||||
SGTimeStamp curr_time;
|
|
||||||
double effective_range;
|
double effective_range;
|
||||||
double target_gs;
|
double target_gs;
|
||||||
double twist;
|
double twist;
|
||||||
|
|
|
@ -69,8 +69,8 @@ bool geocRadialIntersection(const SGGeoc& a, double r1, const SGGeoc& b, double
|
||||||
double crs12 = SGGeodesy::courseRad(a, b),
|
double crs12 = SGGeodesy::courseRad(a, b),
|
||||||
crs21 = SGGeodesy::courseRad(b, a);
|
crs21 = SGGeodesy::courseRad(b, a);
|
||||||
|
|
||||||
double degCrs12 = crs12 * SG_RADIANS_TO_DEGREES;
|
//double degCrs12 = crs12 * SG_RADIANS_TO_DEGREES;
|
||||||
double degCrs21 = crs21 * SG_RADIANS_TO_DEGREES;
|
//double degCrs21 = crs21 * SG_RADIANS_TO_DEGREES;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (sin(diffLon) < 0.0) {
|
if (sin(diffLon) < 0.0) {
|
||||||
|
@ -157,7 +157,9 @@ class BasicWayptCtl : public WayptController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BasicWayptCtl(RNAV* aRNAV, const WayptRef& aWpt) :
|
BasicWayptCtl(RNAV* aRNAV, const WayptRef& aWpt) :
|
||||||
WayptController(aRNAV, aWpt)
|
WayptController(aRNAV, aWpt),
|
||||||
|
_distanceM(0.0),
|
||||||
|
_courseDev(0.0)
|
||||||
{
|
{
|
||||||
if (aWpt->flag(WPT_DYNAMIC)) {
|
if (aWpt->flag(WPT_DYNAMIC)) {
|
||||||
throw sg_exception("BasicWayptCtrl doesn't work with dynamic waypoints");
|
throw sg_exception("BasicWayptCtrl doesn't work with dynamic waypoints");
|
||||||
|
@ -226,7 +228,10 @@ class RunwayCtl : public WayptController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RunwayCtl(RNAV* aRNAV, const WayptRef& aWpt) :
|
RunwayCtl(RNAV* aRNAV, const WayptRef& aWpt) :
|
||||||
WayptController(aRNAV, aWpt)
|
WayptController(aRNAV, aWpt),
|
||||||
|
_runway(NULL),
|
||||||
|
_distanceM(0.0),
|
||||||
|
_courseDev(0.0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,8 +370,8 @@ class InterceptCtl : public WayptController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InterceptCtl(RNAV* aRNAV, const WayptRef& aWpt) :
|
InterceptCtl(RNAV* aRNAV, const WayptRef& aWpt) :
|
||||||
WayptController(aRNAV, aWpt)
|
WayptController(aRNAV, aWpt),
|
||||||
|
_trueRadial(0.0)
|
||||||
{
|
{
|
||||||
if (_waypt->type() != "radialIntercept") {
|
if (_waypt->type() != "radialIntercept") {
|
||||||
throw sg_exception("invalid waypoint type", "InterceptCtl ctor");
|
throw sg_exception("invalid waypoint type", "InterceptCtl ctor");
|
||||||
|
@ -412,8 +417,9 @@ class DMEInterceptCtl : public WayptController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DMEInterceptCtl(RNAV* aRNAV, const WayptRef& aWpt) :
|
DMEInterceptCtl(RNAV* aRNAV, const WayptRef& aWpt) :
|
||||||
WayptController(aRNAV, aWpt)
|
WayptController(aRNAV, aWpt),
|
||||||
|
_dme(NULL),
|
||||||
|
_distanceNm(0.0)
|
||||||
{
|
{
|
||||||
if (_waypt->type() != "dmeIntercept") {
|
if (_waypt->type() != "dmeIntercept") {
|
||||||
throw sg_exception("invalid waypoint type", "DMEInterceptCtl ctor");
|
throw sg_exception("invalid waypoint type", "DMEInterceptCtl ctor");
|
||||||
|
@ -546,7 +552,9 @@ private:
|
||||||
|
|
||||||
DirectToController::DirectToController(RNAV* aRNAV, const WayptRef& aWpt, const SGGeod& aOrigin) :
|
DirectToController::DirectToController(RNAV* aRNAV, const WayptRef& aWpt, const SGGeod& aOrigin) :
|
||||||
WayptController(aRNAV, aWpt),
|
WayptController(aRNAV, aWpt),
|
||||||
_origin(aOrigin)
|
_origin(aOrigin),
|
||||||
|
_distanceM(0.0),
|
||||||
|
_courseDev(0.0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,7 +608,9 @@ SGGeod DirectToController::position() const
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
OBSController::OBSController(RNAV* aRNAV, const WayptRef& aWpt) :
|
OBSController::OBSController(RNAV* aRNAV, const WayptRef& aWpt) :
|
||||||
WayptController(aRNAV, aWpt)
|
WayptController(aRNAV, aWpt),
|
||||||
|
_distanceM(0.0),
|
||||||
|
_courseDev(0.0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
WayptController(RNAV* aRNAV, const WayptRef& aWpt) :
|
WayptController(RNAV* aRNAV, const WayptRef& aWpt) :
|
||||||
_waypt(aWpt),
|
_waypt(aWpt),
|
||||||
|
_targetTrack(0),
|
||||||
_rnav(aRNAV),
|
_rnav(aRNAV),
|
||||||
_isDone(false)
|
_isDone(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
Loading…
Add table
Reference in a new issue