Merge branch 'next' of git://gitorious.org/fg/flightgear into next
This commit is contained in:
commit
eea6bd1e37
39 changed files with 1598 additions and 1418 deletions
42
configure.ac
42
configure.ac
|
@ -773,23 +773,31 @@ if test "x$ac_cv_header_zlib_h" != "xyes"; then
|
|||
fi
|
||||
|
||||
dnl Check for Subversion library support
|
||||
# libsvn support defaults to yes
|
||||
save_LIBS=$LIBS
|
||||
save_CPPFLAGS=$CPPFLAGS
|
||||
LIBS="`apr-1-config --link-ld`"
|
||||
CPPFLAGS="-I/usr/include/subversion-1 `apr-1-config --includes`"
|
||||
AC_CHECK_HEADERS([svn_client.h])
|
||||
if test "x$ac_cv_header_svn_client_h" != "xyes"; then
|
||||
echo "TerraSync will shell out for command line subversion"
|
||||
svn_LIBS=""
|
||||
svn_CPPFLAGS=""
|
||||
else
|
||||
echo "TerraSync will use integrated subversion library"
|
||||
AC_ARG_WITH(libsvn, [ --without-libsvn Do not use libsvn for terrasync [default=no]], [], [with_libsvn=yes])
|
||||
if test "x$with_libsvn" = "xyes"; then
|
||||
LIBS="`apr-1-config --link-ld`"
|
||||
CPPFLAGS="-I/usr/include/subversion-1 `apr-1-config --includes --cppflags`"
|
||||
AC_CHECK_HEADERS([svn_client.h])
|
||||
if test "x$ac_cv_header_svn_client_h" = "xyes"; then
|
||||
echo "TerraSync will use libsvn"
|
||||
AC_SEARCH_LIBS(svn_client_checkout, svn_client-1)
|
||||
AC_SEARCH_LIBS(svn_cmdline_init, svn_subr-1)
|
||||
svn_LIBS=$LIBS
|
||||
svn_CPPFLAGS=$CPPFLAGS
|
||||
AC_SUBST(svn_LIBS)
|
||||
AC_SUBST(svn_CPPFLAGS)
|
||||
else
|
||||
echo "Libsvn not found. TerraSync will use command line subversion"
|
||||
svn_LIBS=""
|
||||
svn_CPPFLAGS=""
|
||||
fi
|
||||
else
|
||||
echo "Libsvn explicitly disabled. TerraSync will use command line subversion"
|
||||
svn_LIBS=""
|
||||
svn_CPPFLAGS=""
|
||||
fi
|
||||
LIBS=$save_LIBS
|
||||
CPPFLAGS=$save_CPPFLAGS
|
||||
|
@ -908,9 +916,9 @@ echo "================="
|
|||
echo "Prefix: $prefix"
|
||||
|
||||
if test "x$with_logging" != "x"; then
|
||||
echo "Debug messages: $with_logging"
|
||||
echo "Log messages: $with_logging"
|
||||
else
|
||||
echo "Debug messages: yes"
|
||||
echo "Log messages: yes"
|
||||
fi
|
||||
|
||||
echo -n "Automake version: "
|
||||
|
@ -921,15 +929,15 @@ if test "x$with_multiplayer" != "xno"; then
|
|||
fi
|
||||
|
||||
if test "x$with_threads" = "xyes"; then
|
||||
echo "threads: yes"
|
||||
echo "Threads: yes"
|
||||
else
|
||||
echo "threads: no"
|
||||
echo "Threads: no"
|
||||
fi
|
||||
|
||||
if test "x$with_eventinput" = "xyes"; then
|
||||
echo "event input: yes"
|
||||
echo "Event input: yes"
|
||||
else
|
||||
echo "event input: no"
|
||||
echo "Event input: no"
|
||||
fi
|
||||
|
||||
if test "x$enable_sp_fdms" != "xno"; then
|
||||
|
@ -939,8 +947,8 @@ else
|
|||
fi
|
||||
|
||||
if test "x$enable_atcdcl" = "xyes"; then
|
||||
echo "Build depricated ATC/AI module: yes"
|
||||
echo "Build deprecated ATC/AI module: yes"
|
||||
else
|
||||
echo "Build depricated ATC/AI module: no"
|
||||
echo "Build deprecated ATC/AI module: no"
|
||||
fi
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
@ -206,9 +206,8 @@ KLN89::KLN89(RenderArea2D* instrument)
|
|||
}
|
||||
_activeFP = _flightPlans[0];
|
||||
|
||||
// Hackish
|
||||
_entJump = -1;
|
||||
_entRestoreCrsr = false;
|
||||
_entJump = _clrJump = -1;
|
||||
_jumpRestoreCrsr = false;
|
||||
|
||||
_dispMsg = false;
|
||||
|
||||
|
@ -490,8 +489,8 @@ void KLN89::CrsrPressed() {
|
|||
_pages[(unsigned int)_cleanUpPage]->CleanUp();
|
||||
_cleanUpPage = -1;
|
||||
}
|
||||
_entRestoreCrsr = false;
|
||||
_entJump = -1;
|
||||
_jumpRestoreCrsr = false;
|
||||
_entJump = _clrJump = -1;
|
||||
((KLN89Page*)_activePage)->SetEntInvert(false);
|
||||
if(_mode == KLN89_MODE_DISP) {
|
||||
_mode = KLN89_MODE_CRSR;
|
||||
|
@ -512,8 +511,8 @@ void KLN89::EntPressed() {
|
|||
}
|
||||
_curPage = _entJump;
|
||||
_activePage = _pages[(unsigned int)_entJump];
|
||||
if(_entRestoreCrsr) _mode = KLN89_MODE_CRSR;
|
||||
_entJump = -1;
|
||||
if(_jumpRestoreCrsr) _mode = KLN89_MODE_CRSR;
|
||||
_entJump = _clrJump = -1;
|
||||
}
|
||||
if(_activePage == _dir_page) {
|
||||
_dir_page->EntPressed();
|
||||
|
@ -525,6 +524,12 @@ void KLN89::EntPressed() {
|
|||
}
|
||||
|
||||
void KLN89::ClrPressed() {
|
||||
if(_clrJump >= 0) {
|
||||
_curPage = _clrJump;
|
||||
_activePage = _pages[(unsigned int)_clrJump];
|
||||
if(_jumpRestoreCrsr) _mode = KLN89_MODE_CRSR;
|
||||
_entJump = _clrJump = -1;
|
||||
}
|
||||
_activePage->ClrPressed();
|
||||
}
|
||||
|
||||
|
@ -775,10 +780,10 @@ void KLN89::DrawMap(bool draw_avs) {
|
|||
GPSWaypoint* wp1 = _activeFP->waypoints[i];
|
||||
SGVec3d p0 = mapProj.ConvertToLocal(SGGeod::fromRad(wp0->lon, wp0->lat));
|
||||
SGVec3d p1 = mapProj.ConvertToLocal(SGGeod::fromRad(wp1->lon, wp1->lat));
|
||||
int mx0 = int(p0.x() / meter_per_pix) + 56;
|
||||
int my0 = int(p0.y() / meter_per_pix) + (_mapOrientation == 0 ? 19 : 10);
|
||||
int mx1 = int(p1.x() / meter_per_pix) + 56;
|
||||
int my1 = int(p1.y() / meter_per_pix) + (_mapOrientation == 0 ? 19 : 10);
|
||||
int mx0 = int(p0.x() / meter_per_pix + 0.5) + 56;
|
||||
int my0 = int(p0.y() / meter_per_pix + 0.5) + (_mapOrientation == 0 ? 19 : 10);
|
||||
int mx1 = int(p1.x() / meter_per_pix + 0.5) + 56;
|
||||
int my1 = int(p1.y() / meter_per_pix + 0.5) + (_mapOrientation == 0 ? 19 : 10);
|
||||
if(i == 1) {
|
||||
xvec.push_back(mx0);
|
||||
yvec.push_back(my0);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
@ -213,9 +213,12 @@ private:
|
|||
// And a facility to save the immediately preceeding active page
|
||||
KLN89Page* _lastActivePage;
|
||||
|
||||
// Hackish
|
||||
int _entJump; // The page to jump back to if ent is pressed. -1 indicates no jump
|
||||
bool _entRestoreCrsr; // Indicates that pressing ENT at this point should restore cursor mode
|
||||
// Ugly hack. Housekeeping to allow us to temporarily display one page, while remembering which
|
||||
// other page to "jump" back to. Used when the waypoint pages are used to review waypoint entry
|
||||
// from the flightplan page.
|
||||
int _entJump; // The page to jump back to if ENT is pressed. -1 indicates no jump.
|
||||
int _clrJump; // The page to jump back to if CLR is pressed. -1 indicates no jump.
|
||||
bool _jumpRestoreCrsr; // Indicates that jump back at this point should restore cursor mode.
|
||||
|
||||
// Misc pages that aren't in the cyclic list.
|
||||
// Direct To
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
@ -295,15 +295,20 @@ void KLN89FplPage::Update(double dt) {
|
|||
}
|
||||
} else if(_kln89->_mode == KLN89_MODE_CRSR && _bEntWp && _uLinePos == i+4) {
|
||||
if(!_kln89->_blink) {
|
||||
if(_wLinePos >= _entWp->id.size()) {
|
||||
_kln89->DrawText(_entWp->id, 2, 4, 3-i);
|
||||
if(_wLinePos >= _entWpStr.size()) {
|
||||
_kln89->DrawText(_entWpStr, 2, 4, 3-i);
|
||||
_kln89->DrawChar(' ', 2, 4+_wLinePos, 3-i, false, true);
|
||||
} else {
|
||||
_kln89->DrawText(_entWp->id.substr(0, _wLinePos), 2, 4, 3-i);
|
||||
_kln89->DrawChar(_entWp->id[_wLinePos], 2, 4+_wLinePos, 3-i, false, true);
|
||||
_kln89->DrawText(_entWp->id.substr(_wLinePos+1, _entWp->id.size()-_wLinePos-1), 2, 5+_wLinePos, 3-i);
|
||||
_kln89->DrawText(_entWpStr.substr(0, _wLinePos), 2, 4, 3-i);
|
||||
_kln89->DrawChar(_entWpStr[_wLinePos], 2, 4+_wLinePos, 3-i, false, true);
|
||||
_kln89->DrawText(_entWpStr.substr(_wLinePos+1, _entWpStr.size()-_wLinePos-1), 2, 5+_wLinePos, 3-i);
|
||||
}
|
||||
}
|
||||
// Draw the param - this is "----" during waypoint entry (not for the first row though or we draw through the label!)
|
||||
if(i != 0) {
|
||||
_kln89->DrawText("----", 2, 12, 3-i);
|
||||
}
|
||||
|
||||
drawID = false;
|
||||
}
|
||||
if(drawID) {
|
||||
|
@ -316,10 +321,16 @@ void KLN89FplPage::Update(double dt) {
|
|||
//cout << "last_pos = " << last_pos << endl;
|
||||
if(last_pos > 0 && last_pos < waylist.size() && i > 0) {
|
||||
// Draw the param
|
||||
if(_actFpMode == 0) {
|
||||
if(_actFpMode == 0) { // DIS
|
||||
if(_kln89->_mode == KLN89_MODE_CRSR && _bEntWp && _uLinePos < i+4) {
|
||||
// This means that we are beyond the waypoint being entered. In DIS mode
|
||||
// this means that we dash out the field.
|
||||
_kln89->DrawText("----", 2, 12, 3-i);
|
||||
} else {
|
||||
string s = _params[last_pos - 1];
|
||||
_kln89->DrawText(s, 2, 16-s.size(), 3-i);
|
||||
} else if(_actFpMode == 3) {
|
||||
}
|
||||
} else if(_actFpMode == 3) { // DTK
|
||||
string s = _params[last_pos - 1];
|
||||
_kln89->DrawText(s, 2, 15-s.size(), 3-i);
|
||||
_kln89->DrawSpecialChar(0, 2, 15, 3-i);
|
||||
|
@ -348,10 +359,19 @@ void KLN89FplPage::Update(double dt) {
|
|||
if(i > 0) {
|
||||
// Draw the param
|
||||
//cout << "i > 0 param draw...\n";
|
||||
if(_actFpMode == 0) {
|
||||
if(_actFpMode == 0) { // DIS
|
||||
if(_kln89->_mode == KLN89_MODE_CRSR && _bEntWp && _uLinePos < i+4) {
|
||||
// This means that we are beyond the waypoint being entered. In DIS mode
|
||||
// this means that we dash out the field.
|
||||
_kln89->DrawText("----", 2, 12, 3-i);
|
||||
} else {
|
||||
string s = _params[_fplPos + i - 1];
|
||||
_kln89->DrawText(s, 2, 16-s.size(), 3-i);
|
||||
} else if(_actFpMode == 3) {
|
||||
}
|
||||
} else if(_actFpMode == 3) { // DTK
|
||||
// TODO - figure out properly what to do in DTK mode when beyond a waypoint being entered.
|
||||
// I *think* it is OK to do the same as here, but maybe not for the waypoint immediately
|
||||
// beyond the one being entered - need to check.
|
||||
string s = _params[_fplPos + i - 1];
|
||||
_kln89->DrawText(s, 2, 15-s.size(), 3-i);
|
||||
_kln89->DrawSpecialChar(0, 2, 15, 3-i);
|
||||
|
@ -437,16 +457,22 @@ void KLN89FplPage::Update(double dt) {
|
|||
_kln89->DrawEnt();
|
||||
}
|
||||
} else if(_kln89->_mode == KLN89_MODE_CRSR && _bEntWp && _uLinePos == i+4) {
|
||||
// This means that we are drawing a waypoint currently being entered
|
||||
if(!_kln89->_blink) {
|
||||
if(_wLinePos >= _entWp->id.size()) {
|
||||
_kln89->DrawText(_entWp->id, 2, 4, 2-i);
|
||||
if(_wLinePos >= _entWpStr.size()) {
|
||||
_kln89->DrawText(_entWpStr, 2, 4, 2-i);
|
||||
_kln89->DrawChar(' ', 2, 4+_wLinePos, 2-i, false, true);
|
||||
} else {
|
||||
_kln89->DrawText(_entWp->id.substr(0, _wLinePos), 2, 4, 2-i);
|
||||
_kln89->DrawChar(_entWp->id[_wLinePos], 2, 4+_wLinePos, 2-i, false, true);
|
||||
_kln89->DrawText(_entWp->id.substr(_wLinePos+1, _entWp->id.size()-_wLinePos-1), 2, 5+_wLinePos, 2-i);
|
||||
_kln89->DrawText(_entWpStr.substr(0, _wLinePos), 2, 4, 2-i);
|
||||
_kln89->DrawChar(_entWpStr[_wLinePos], 2, 4+_wLinePos, 2-i, false, true);
|
||||
_kln89->DrawText(_entWpStr.substr(_wLinePos+1, _entWpStr.size()-_wLinePos-1), 2, 5+_wLinePos, 2-i);
|
||||
}
|
||||
}
|
||||
// Draw the param - this is "----" during waypoint entry (not for the first row though or we draw through the label!)
|
||||
if(i != 0) {
|
||||
_kln89->DrawText("----", 2, 12, 2-i);
|
||||
}
|
||||
|
||||
drawID = false;
|
||||
}
|
||||
if(drawID) {
|
||||
|
@ -456,11 +482,18 @@ void KLN89FplPage::Update(double dt) {
|
|||
}
|
||||
if(last_pos > 0 && last_pos < waylist.size() && i > 0) {
|
||||
// Draw the param
|
||||
if(_fpMode == 0) {
|
||||
// TODO - we should also handle DTK mode params here.
|
||||
if(_fpMode == 0) { // DIS
|
||||
if(_kln89->_mode == KLN89_MODE_CRSR && _bEntWp && _uLinePos < i+4) {
|
||||
// This means that we are beyond the waypoint being entered. In DIS mode
|
||||
// this means that we dash out the field.
|
||||
_kln89->DrawText("----", 2, 12, 2-i);
|
||||
} else {
|
||||
string s = _params[last_pos - 1];
|
||||
_kln89->DrawText(s, 2, 16-s.size(), 2-i);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if(!(_kln89->_mode == KLN89_MODE_CRSR && _uLinePos == (i + 4) && _kln89->_blink)) {
|
||||
|
@ -468,7 +501,13 @@ void KLN89FplPage::Update(double dt) {
|
|||
}
|
||||
if(i > 0) {
|
||||
// Draw the param
|
||||
if(_fpMode == 0) {
|
||||
// TODO - we should also handle DTK mode params here.
|
||||
if(_fpMode == 0) { // DIS
|
||||
if(_kln89->_mode == KLN89_MODE_CRSR && _bEntWp && _uLinePos < i+4) {
|
||||
// This means that we are beyond the waypoint being entered. In DIS mode
|
||||
// this means that we dash out the field.
|
||||
_kln89->DrawText("----", 2, 12, 2-i);
|
||||
} else {
|
||||
string s = _params[_fplPos + i - 1];
|
||||
_kln89->DrawText(s, 2, 16-s.size(), 2-i);
|
||||
}
|
||||
|
@ -477,6 +516,7 @@ void KLN89FplPage::Update(double dt) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
KLN89Page::Update(dt);
|
||||
}
|
||||
|
@ -600,8 +640,27 @@ void KLN89FplPage::ClrPressed() {
|
|||
// TODO - see if we need to delete a waypoint
|
||||
if(_uLinePos >= 4) {
|
||||
if(_delWp) {
|
||||
// If we are already displaying a clear waypoint dialog in response to the CLR button,
|
||||
// then a further press of the CLR button cancels the dialog.
|
||||
_kln89->_mode = KLN89_MODE_DISP;
|
||||
_delWp = false;
|
||||
} else if(_bEntWp) {
|
||||
// If we are currently entering a waypoint, then CLR deletes it unconditionally
|
||||
// without a confirmation dialog and cancels waypoint entry.
|
||||
int pos = _uLinePos - 4 + _fplPos;
|
||||
// Sanity check - the calculated wp position should never be off the end of the waypoint list.
|
||||
if(pos > static_cast<int>(_kln89->_flightPlans[_subPage]->waypoints.size()) - 1) {
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "ERROR - _uLinePos too big in KLN89FplPage::ClrPressed!\n");
|
||||
return;
|
||||
}
|
||||
_kln89->_flightPlans[_subPage]->waypoints.erase(_kln89->_flightPlans[_subPage]->waypoints.begin() + pos);
|
||||
_bEntWp = false;
|
||||
_entWp = NULL;
|
||||
_entWpStr.clear();
|
||||
_wLinePos = 0;
|
||||
// We can also get here from the waypoint review page, so clear _bEntExp as well
|
||||
_bEntExp = false;
|
||||
// Do we need to re-calc _fplPos here?
|
||||
} else {
|
||||
// First check that we're not trying to delete an approach waypoint. Note that we can delete the approach by deleting the header though.
|
||||
// Check for approach waypoints or header/fences in flightplan 0
|
||||
|
@ -685,22 +744,30 @@ void KLN89FplPage::EntPressed() {
|
|||
int pos = _uLinePos - 4 + _fplPos;
|
||||
// Sanity check - the calculated wp position should never be off the end of the waypoint list.
|
||||
if(pos > static_cast<int>(_kln89->_flightPlans[_subPage]->waypoints.size()) - 1) {
|
||||
cout << "ERROR - _uLinePos too big in KLN89FplPage::EntPressed!\n";
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "ERROR - _uLinePos too big in KLN89FplPage::EntPressed!\n");
|
||||
return;
|
||||
}
|
||||
_kln89->_flightPlans[_subPage]->waypoints.erase(_kln89->_flightPlans[_subPage]->waypoints.begin() + pos);
|
||||
_delWp = false;
|
||||
// Do we need to re-calc _fplPos here?
|
||||
} else if(_bEntExp) {
|
||||
// We get here if we have just approved a waypoint review for addition with the ENT button
|
||||
_bEntWp = false;
|
||||
_bEntExp = false;
|
||||
_entWp = NULL; // DON'T delete it! - it's been pushed onto the waypoint list at this point.
|
||||
_entWpStr.clear();
|
||||
_kln89->_cleanUpPage = -1;
|
||||
_wLinePos = 0;
|
||||
// TODO - in actual fact the previously underlined waypoint stays in the same position and underlined
|
||||
// in some or possibly all circumstances - need to check this out and match it, but not too important
|
||||
// for now.
|
||||
// The cursor should be moved either to the next waypoint in the list, or to the empty position at
|
||||
// the end of the list if the waypoint just entered was the last one in the list. Unfortunately
|
||||
// that means that we have to deal with the horrible _uLinePos / _fplPos interaction yet again :-(
|
||||
if(_uLinePos == 4) {
|
||||
// We can't handle this case by calling K1R1, since we want to jump the field type
|
||||
_uLinePos = 5;
|
||||
} else {
|
||||
// Just call Knob1Right1 and let that handle the horrible logic :-)
|
||||
Knob1Right1();
|
||||
}
|
||||
} else if(_bEntWp) {
|
||||
if(_entWp != NULL) {
|
||||
// TODO - should be able to get rid of this switch I think and use the enum values.
|
||||
|
@ -731,12 +798,12 @@ void KLN89FplPage::EntPressed() {
|
|||
((KLN89Page*)_kln89->_pages[4])->SetEntInvert(true);
|
||||
break;
|
||||
default:
|
||||
cout << "Error - unknown waypoint type found in KLN89::FplPage::EntPressed()\n";
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "Error - unknown waypoint type found in KLN89::FplPage::EntPressed()\n");
|
||||
}
|
||||
_kln89->_activePage->SetId(_entWp->id);
|
||||
_kln89->_entJump = 7;
|
||||
_kln89->_entJump = _kln89->_clrJump = 7;
|
||||
_kln89->_cleanUpPage = 7;
|
||||
_kln89->_entRestoreCrsr = true;
|
||||
_kln89->_jumpRestoreCrsr = true;
|
||||
_kln89->_mode = KLN89_MODE_DISP;
|
||||
}
|
||||
_bEntExp = true;
|
||||
|
@ -867,7 +934,7 @@ void KLN89FplPage::Knob1Right1() {
|
|||
}
|
||||
if(_kln89->_flightPlans[_subPage]->waypoints.size() == 1 || _fplPos == _kln89->_flightPlans[_subPage]->waypoints.size() + hfcount - 1) {
|
||||
// 1: Don't move
|
||||
} else if(_fplPos >= _kln89->_flightPlans[_subPage]->waypoints.size() + hfcount - (_subPage == 0 ? 4 : 3)) {
|
||||
} else if((int)_fplPos >= static_cast<int>(_kln89->_flightPlans[_subPage]->waypoints.size()) + hfcount - (_subPage == 0 ? 4 : 3)) {
|
||||
_uLinePos++;
|
||||
} else {
|
||||
_fplPos++;
|
||||
|
@ -956,8 +1023,15 @@ void KLN89FplPage::Knob2Left1() {
|
|||
|
||||
GPSWaypoint* wp = _kln89->FindFirstById(_entWpStr.substr(0, _wLinePos+1));
|
||||
if(NULL == wp) {
|
||||
// no-op
|
||||
// No ID matches the partial ID entered so _entWpStr must be shortened to the cursor
|
||||
// position if it was longer due to a match on the previous character.
|
||||
if(_entWpStr.size() > _wLinePos+1) {
|
||||
_entWpStr = _entWpStr.substr(0, _wLinePos+1);
|
||||
}
|
||||
} else {
|
||||
// There is a matching full ID to the entered partial ID, so copy the full ID
|
||||
// into _entWpStr
|
||||
_entWpStr = wp->id;
|
||||
if(_entWp) {
|
||||
*_entWp = *wp; // copy
|
||||
delete wp;
|
||||
|
@ -1020,17 +1094,24 @@ void KLN89FplPage::Knob2Right1() {
|
|||
ShowScratchpadMessage("Invald", " Add ");
|
||||
} else {
|
||||
if((_wLinePos + 1) > _entWpStr.size()) {
|
||||
_entWpStr += '9';
|
||||
_entWpStr += 'A';
|
||||
} else {
|
||||
_entWpStr[_wLinePos] = _kln89->DecChar(_entWpStr[_wLinePos], (_wLinePos == 0 ? false : true));
|
||||
_entWpStr[_wLinePos] = _kln89->IncChar(_entWpStr[_wLinePos], (_wLinePos == 0 ? false : true));
|
||||
}
|
||||
_bEntWp = true;
|
||||
_fp0SelWpId.clear(); // Waypoints don't become the DTO default whilst being entered.
|
||||
|
||||
GPSWaypoint* wp = _kln89->FindFirstById(_entWpStr.substr(0, _wLinePos+1));
|
||||
if(NULL == wp) {
|
||||
// no-op
|
||||
// No ID matches the partial ID entered so _entWpStr must be shortened to the cursor
|
||||
// position if it was longer due to a match on the previous character.
|
||||
if(_entWpStr.size() > _wLinePos+1) {
|
||||
_entWpStr = _entWpStr.substr(0, _wLinePos+1);
|
||||
}
|
||||
} else {
|
||||
// There is a matching full ID to the entered partial ID, so copy the full ID
|
||||
// into _entWpStr
|
||||
_entWpStr = wp->id;
|
||||
if(_entWp) {
|
||||
*_entWp = *wp; // copy
|
||||
delete wp;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
@ -251,15 +251,24 @@ void KLN89NavPage::Update(double dt) {
|
|||
_kln89->DrawText("-:--", 2, 11, 0);
|
||||
}
|
||||
} else { // if(3 == _subPage)
|
||||
//
|
||||
// Switch the cursor off if scan-pull is out on this page.
|
||||
//
|
||||
if(fgGetBool("/instrumentation/kln89/scan-pull")) { _kln89->_mode = KLN89_MODE_DISP; }
|
||||
// The moving map page the core KLN89 class draws this.
|
||||
|
||||
//
|
||||
// Draw the moving map if valid.
|
||||
// We call the core KLN89 class to do this.
|
||||
//
|
||||
if(_kln89->_mapOrientation == 2 && _kln89->_groundSpeed_kts < 2) {
|
||||
// Don't draw it if in track up mode and groundspeed < 2kts, as per real-life unit.
|
||||
} else {
|
||||
_kln89->DrawMap(!_suspendAVS);
|
||||
}
|
||||
// Now draw any annotation over it.
|
||||
|
||||
//
|
||||
// Now that the map has been drawn, add the annotation (scale, etc).
|
||||
//
|
||||
int scale = KLN89MapScales[_kln89->_mapScaleUnits][_kln89->_mapScaleIndex];
|
||||
string scle_str = GPSitoa(scale);
|
||||
if(crsr) {
|
||||
|
@ -325,7 +334,10 @@ void KLN89NavPage::Update(double dt) {
|
|||
}
|
||||
}
|
||||
}
|
||||
// And do part of the field 1 update, since NAV 4 is a special case for the last line.
|
||||
|
||||
//
|
||||
// Do part of the field 1 update, since NAV 4 is a special case for the last line.
|
||||
//
|
||||
_kln89->DrawChar('>', 1, 0, 0);
|
||||
if(crsr && _uLinePos == 1) _kln89->Underline(1, 1, 0, 5);
|
||||
if(!(crsr && _uLinePos == 1 && _kln89->_blink)) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
|
|
@ -232,7 +232,7 @@ DCLGPS::~DCLGPS() {
|
|||
}
|
||||
|
||||
void DCLGPS::draw(osg::State& state) {
|
||||
_instrument->draw(state);
|
||||
_instrument->Draw(state);
|
||||
}
|
||||
|
||||
void DCLGPS::init() {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
@ -57,7 +57,7 @@ RenderArea2D::RenderArea2D(int logx, int logy, int sizex, int sizey, int posx, i
|
|||
_ra2d_debug = false;
|
||||
}
|
||||
|
||||
void RenderArea2D::draw(osg::State& state) {
|
||||
void RenderArea2D::Draw(osg::State& state) {
|
||||
|
||||
static osg::ref_ptr<osg::StateSet> renderArea2DStateSet;
|
||||
if(!renderArea2DStateSet.valid()) {
|
||||
|
@ -82,27 +82,29 @@ void RenderArea2D::draw(osg::State& state) {
|
|||
glDisable(GL_CLIP_PLANE2);
|
||||
glDisable(GL_CLIP_PLANE3);
|
||||
|
||||
oldDrawBackground();
|
||||
DoDrawBackground();
|
||||
|
||||
for(unsigned int i = 0; i < drawing_list.size(); ++i) {
|
||||
RA2DPrimitive prim = drawing_list[i];
|
||||
switch(prim.type) {
|
||||
case RA2D_LINE:
|
||||
oldDrawLine(prim.x1, prim.y1, prim.x2, prim.y2);
|
||||
DoDrawLine(prim.x1, prim.y1, prim.x2, prim.y2);
|
||||
break;
|
||||
case RA2D_QUAD:
|
||||
if(prim.debug) {
|
||||
//cout << "Clipping = " << _clipx1 << ", " << _clipy1 << " to " << _clipx2 << ", " << _clipy2 << '\n';
|
||||
//cout << "Drawing quad " << prim.x1 << ", " << prim.y1 << " to " << prim.x2 << ", " << prim.y2 << '\n';
|
||||
}
|
||||
oldDrawQuad(prim.x1, prim.y1, prim.x2, prim.y2, prim.invert);
|
||||
DoDrawQuad(prim.x1, prim.y1, prim.x2, prim.y2, prim.invert);
|
||||
break;
|
||||
case RA2D_PIXEL:
|
||||
oldDrawPixel(prim.x1, prim.y1, prim.invert);
|
||||
DoDrawPixel(prim.x1, prim.y1, prim.invert);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
drawing_list.clear();
|
||||
|
||||
glPopAttrib();
|
||||
|
||||
state.popStateSet();
|
||||
|
@ -111,6 +113,10 @@ void RenderArea2D::draw(osg::State& state) {
|
|||
state.setClientActiveTextureUnit(0);
|
||||
}
|
||||
|
||||
void RenderArea2D::Flush() {
|
||||
drawing_list.clear();
|
||||
}
|
||||
|
||||
// Set clipping region in logical units
|
||||
void RenderArea2D::SetClipRegion(int x1, int y1, int x2, int y2) {
|
||||
_clipx1 = x1;
|
||||
|
@ -145,7 +151,8 @@ void RenderArea2D::SetActualSize(int sizex, int sizey) {
|
|||
}
|
||||
|
||||
void RenderArea2D::DrawPixel(int x, int y, bool invert) {
|
||||
// Clipping is currently performed in oldDrawPixel - could clip here instead though.
|
||||
// Clip
|
||||
if(x < _clipx1 || x > _clipx2 || y < _clipy1 || y > _clipy2) return;
|
||||
|
||||
RA2DPrimitive prim;
|
||||
prim.x1 = x;
|
||||
|
@ -157,8 +164,11 @@ void RenderArea2D::DrawPixel(int x, int y, bool invert) {
|
|||
drawing_list.push_back(prim);
|
||||
}
|
||||
|
||||
void RenderArea2D::oldDrawPixel(int x, int y, bool invert) {
|
||||
// Clip
|
||||
void RenderArea2D::DoDrawPixel(int x, int y, bool invert) {
|
||||
// Clip. In theory this shouldn't be necessary, since all input is clipped before adding
|
||||
// to the drawing list, but it ensures that any errors in clipping lines etc will only
|
||||
// spill over the clip area within the instrument, and still be clipped from straying
|
||||
// outside the instrument.
|
||||
if(x < _clipx1 || x > _clipx2 || y < _clipy1 || y > _clipy2) return;
|
||||
|
||||
// Scale to position within background
|
||||
|
@ -178,17 +188,57 @@ void RenderArea2D::oldDrawPixel(int x, int y, bool invert) {
|
|||
|
||||
//cout << "DP: " << fx1 << ", " << fy1 << " ... " << fx2 << ", " << fy2 << '\n';
|
||||
|
||||
doSetColor(invert ? _backgroundColor : _pixelColor);
|
||||
SetRenderColor(invert ? _backgroundColor : _pixelColor);
|
||||
SGVec2f corners[4] = {
|
||||
SGVec2f(fx1, fy1),
|
||||
SGVec2f(fx2, fy1),
|
||||
SGVec2f(fx2, fy2),
|
||||
SGVec2f(fx1, fy2)
|
||||
};
|
||||
doDrawQuad(corners);
|
||||
RenderQuad(corners);
|
||||
}
|
||||
|
||||
void RenderArea2D::DrawLine(int x1, int y1, int x2, int y2) {
|
||||
// We need to clip the line to the current region before storing it in the drawing
|
||||
// list, since when we come to actually draw it the clip region may have changed.
|
||||
|
||||
// Liang-Barsky clipping algorithm
|
||||
int p[4], q[4];
|
||||
float u1 = 0.0f, u2 = 1.0f;
|
||||
p[0] = -(x2 - x1); q[0] = (x1 - _clipx1);
|
||||
p[1] = (x2 - x1); q[1] = (_clipx2 - x1);
|
||||
p[2] = -(y2 - y1); q[2] = (y1 - _clipy1);
|
||||
p[3] = (y2 - y1); q[3] = (_clipy2 - y1);
|
||||
|
||||
for(int i=0; i<4; ++i) {
|
||||
if(p[i] == 0) {
|
||||
if(q[i] < 0) {
|
||||
// Then we have a trivial rejection of a line parallel to a clip plane
|
||||
// completely outside the clip region.
|
||||
return;
|
||||
}
|
||||
} else if(p[i] < 0) {
|
||||
float r = (float)q[i]/(float)p[i];
|
||||
u1 = (u1 > r ? u1 : r);
|
||||
} else { // p[i] > 0
|
||||
float r = (float)q[i]/(float)p[i];
|
||||
u2 = (u2 < r ? u2 : r);
|
||||
}
|
||||
if(u1 > u2) {
|
||||
// Then the line is completely outside the clip area.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float fx1 = x1 + u1 * (float)(x2 - x1);
|
||||
float fy1 = y1 + u1 * (float)(y2 - y1);
|
||||
float fx2 = x1 + u2 * (float)(x2 - x1);
|
||||
float fy2 = y1 + u2 * (float)(y2 - y1);
|
||||
x1 = (int)(fx1 + 0.5);
|
||||
y1 = (int)(fy1 + 0.5);
|
||||
x2 = (int)(fx2 + 0.5);
|
||||
y2 = (int)(fy2 + 0.5);
|
||||
|
||||
RA2DPrimitive prim;
|
||||
prim.x1 = x1;
|
||||
prim.y1 = y1;
|
||||
|
@ -199,7 +249,7 @@ void RenderArea2D::DrawLine(int x1, int y1, int x2, int y2) {
|
|||
drawing_list.push_back(prim);
|
||||
}
|
||||
|
||||
void RenderArea2D::oldDrawLine(int x1, int y1, int x2, int y2) {
|
||||
void RenderArea2D::DoDrawLine(int x1, int y1, int x2, int y2) {
|
||||
// Crude implementation of Bresenham line drawing algorithm.
|
||||
|
||||
// Our lines are non directional, so first order the points x-direction-wise to leave only 4 octants to consider.
|
||||
|
@ -220,7 +270,7 @@ void RenderArea2D::oldDrawLine(int x1, int y1, int x2, int y2) {
|
|||
int y = y1;
|
||||
int yn = dx/2;
|
||||
for(int x=x1; x<=x2; ++x) {
|
||||
DrawPixel(x, y);
|
||||
DoDrawPixel(x, y);
|
||||
yn += dy;
|
||||
if(yn >= dx) {
|
||||
yn -= dx;
|
||||
|
@ -234,7 +284,7 @@ void RenderArea2D::oldDrawLine(int x1, int y1, int x2, int y2) {
|
|||
// Must be a more elegant way to roll the next two cases into one!
|
||||
if(flip_y) {
|
||||
for(int y=y1; y>=y2; --y) {
|
||||
DrawPixel(x, y);
|
||||
DoDrawPixel(x, y);
|
||||
xn += dx;
|
||||
if(xn >= dy) {
|
||||
xn -= dy;
|
||||
|
@ -243,7 +293,7 @@ void RenderArea2D::oldDrawLine(int x1, int y1, int x2, int y2) {
|
|||
}
|
||||
} else {
|
||||
for(int y=y1; y<=y2; ++y) {
|
||||
DrawPixel(x, y);
|
||||
DoDrawPixel(x, y);
|
||||
xn += dx;
|
||||
if(xn >= dy) {
|
||||
xn -= dy;
|
||||
|
@ -255,7 +305,7 @@ void RenderArea2D::oldDrawLine(int x1, int y1, int x2, int y2) {
|
|||
}
|
||||
|
||||
void RenderArea2D::DrawQuad(int x1, int y1, int x2, int y2, bool invert) {
|
||||
// Clip and sanity-check.
|
||||
// Force the input to be ordered with x1 < x2 and y1 < y2.
|
||||
if(x1 > x2) {
|
||||
int x = x2;
|
||||
x2 = x1;
|
||||
|
@ -266,6 +316,8 @@ void RenderArea2D::DrawQuad(int x1, int y1, int x2, int y2, bool invert) {
|
|||
y2 = y1;
|
||||
y1 = y;
|
||||
}
|
||||
|
||||
// Clip the input to the current drawing region.
|
||||
x1 = x1 < _clipx1 ? _clipx1 : x1;
|
||||
if(x1 > _clipx2) { return; }
|
||||
x2 = x2 > _clipx2 ? _clipx2 : x2;
|
||||
|
@ -286,7 +338,7 @@ void RenderArea2D::DrawQuad(int x1, int y1, int x2, int y2, bool invert) {
|
|||
drawing_list.push_back(prim);
|
||||
}
|
||||
|
||||
void RenderArea2D::oldDrawQuad(int x1, int y1, int x2, int y2, bool invert) {
|
||||
void RenderArea2D::DoDrawQuad(int x1, int y1, int x2, int y2, bool invert) {
|
||||
// Scale to position within background
|
||||
float fx1 = (float)x1, fy1 = (float)y1;
|
||||
float fx2 = (float)x2, fy2 = (float)y2;
|
||||
|
@ -308,22 +360,22 @@ void RenderArea2D::oldDrawQuad(int x1, int y1, int x2, int y2, bool invert) {
|
|||
|
||||
//cout << "DP: " << fx1 << ", " << fy1 << " ... " << fx2 << ", " << fy2 << '\n';
|
||||
|
||||
doSetColor(invert ? _backgroundColor : _pixelColor);
|
||||
SetRenderColor(invert ? _backgroundColor : _pixelColor);
|
||||
SGVec2f corners[4] = {
|
||||
SGVec2f(fx1, fy1),
|
||||
SGVec2f(fx2, fy1),
|
||||
SGVec2f(fx2, fy2),
|
||||
SGVec2f(fx1, fy2)
|
||||
};
|
||||
doDrawQuad(corners);
|
||||
RenderQuad(corners);
|
||||
}
|
||||
|
||||
void RenderArea2D::DrawBackground() {
|
||||
// TODO
|
||||
// Currently a NO-OP
|
||||
}
|
||||
|
||||
void RenderArea2D::oldDrawBackground() {
|
||||
doSetColor(_backgroundColor);
|
||||
void RenderArea2D::DoDrawBackground() {
|
||||
SetRenderColor(_backgroundColor);
|
||||
SGVec2f corners[4] = {
|
||||
SGVec2f(_posx, _posy),
|
||||
SGVec2f(_posx + _sizex, _posy),
|
||||
|
@ -331,11 +383,7 @@ void RenderArea2D::oldDrawBackground() {
|
|||
SGVec2f(_posx, _posy + _sizey)
|
||||
};
|
||||
|
||||
doDrawQuad(corners);
|
||||
}
|
||||
|
||||
void RenderArea2D::Flush() {
|
||||
drawing_list.clear();
|
||||
RenderQuad(corners);
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
|
@ -344,12 +392,12 @@ void RenderArea2D::Flush() {
|
|||
//
|
||||
// -----------------------------------------
|
||||
|
||||
void RenderArea2D::doSetColor( const float *rgba ) {
|
||||
void RenderArea2D::SetRenderColor( const float *rgba ) {
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, rgba);
|
||||
glColor4fv( rgba );
|
||||
}
|
||||
|
||||
void RenderArea2D::doDrawQuad( const SGVec2f *p) {
|
||||
void RenderArea2D::RenderQuad( const SGVec2f *p) {
|
||||
glBegin(GL_QUADS);
|
||||
glNormal3f(0.0f, 0.0f, 0.0f);
|
||||
glVertex2fv( p[0].data() );
|
||||
|
@ -359,8 +407,7 @@ void RenderArea2D::doDrawQuad( const SGVec2f *p) {
|
|||
glEnd();
|
||||
}
|
||||
|
||||
void RenderArea2D::doDrawQuad( const SGVec2f *p, const SGVec4f *color ) {
|
||||
|
||||
void RenderArea2D::RenderQuad( const SGVec2f *p, const SGVec4f *color ) {
|
||||
glBegin(GL_QUADS);
|
||||
glNormal3f(0.0f, 0.0f, 0.0f);
|
||||
glColor4fv( color[0].data() ); glVertex2fv( p[0].data() );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
// Written by David Luff, started 2005.
|
||||
//
|
||||
// Copyright (C) 2005 - David C Luff - david.luff@nottingham.ac.uk
|
||||
// Copyright (C) 2005 - David C Luff - daveluff AT ntlworld.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
|
@ -60,8 +60,6 @@ public:
|
|||
RenderArea2D(int logx, int logy, int sizex, int sizey, int posx, int posy);
|
||||
~RenderArea2D();
|
||||
|
||||
void draw(osg::State& state);
|
||||
|
||||
void SetPixelColor(const float* rgba);
|
||||
void SetBackgroundColor(const float* rgba);
|
||||
void SetPosition(int posx, int posy);
|
||||
|
@ -73,23 +71,17 @@ public:
|
|||
// Set clip region to be the same as the rendered area (default)
|
||||
void ResetClipRegion();
|
||||
|
||||
// Drawing specified in logical units
|
||||
// The DrawXXX functions place the shapes in the buffer, specified
|
||||
// in logical units, and clipped to the current clip region.
|
||||
void DrawPixel(int x, int y, bool invert = false);
|
||||
void DrawLine(int x1, int y1, int x2, int y2);
|
||||
void DrawQuad(int x1, int y1, int x2, int y2, bool invert = false);
|
||||
void DrawBackground();
|
||||
// Draw a pixel specified by *logical* position
|
||||
void DrawPixel(int x, int y, bool invert = false);
|
||||
|
||||
// The old drawing functions have been renamed in order to buffer the drawing for FG
|
||||
//
|
||||
// Drawing specified in logical units
|
||||
void oldDrawLine(int x1, int y1, int x2, int y2);
|
||||
void oldDrawQuad(int x1, int y1, int x2, int y2, bool invert = false);
|
||||
void oldDrawBackground();
|
||||
// Draw a pixel specified by *logical* position
|
||||
void oldDrawPixel(int x, int y, bool invert = false);
|
||||
// Call Draw to have the buffer contents drawn and then cleared.
|
||||
void Draw(osg::State& state);
|
||||
|
||||
// Flush the buffer pipeline
|
||||
// Clear the buffer contents
|
||||
void Flush();
|
||||
|
||||
// Turn debugging on or off.
|
||||
|
@ -104,10 +96,16 @@ private:
|
|||
float _backgroundColor[4];
|
||||
float _pixelColor[4];
|
||||
|
||||
// Actual drawing routines copied from Atlas
|
||||
void doSetColor( const float *rgb );
|
||||
void doDrawQuad( const SGVec2f *p);
|
||||
void doDrawQuad( const SGVec2f *p, const SGVec4f *color );
|
||||
// Drawing specified in logical units
|
||||
void DoDrawPixel(int x, int y, bool invert = false);
|
||||
void DoDrawLine(int x1, int y1, int x2, int y2);
|
||||
void DoDrawQuad(int x1, int y1, int x2, int y2, bool invert = false);
|
||||
void DoDrawBackground();
|
||||
|
||||
// Actual rendering routines copied from Atlas
|
||||
void SetRenderColor( const float *rgb );
|
||||
void RenderQuad( const SGVec2f *p);
|
||||
void RenderQuad( const SGVec2f *p, const SGVec4f *color );
|
||||
|
||||
vector<RA2DPrimitive> drawing_list;
|
||||
|
||||
|
|
|
@ -697,8 +697,6 @@ do_timeofday (const SGPropertyNode * arg)
|
|||
= fgGetNode("/position/longitude-deg");
|
||||
static const SGPropertyNode *latitude
|
||||
= fgGetNode("/position/latitude-deg");
|
||||
static const SGPropertyNode *cur_time_override
|
||||
= fgGetNode("/sim/time/cur-time-override", true);
|
||||
|
||||
int orig_warp = globals->get_warp();
|
||||
SGTime *t = globals->get_time_params();
|
||||
|
@ -759,13 +757,9 @@ do_timeofday (const SGPropertyNode * arg)
|
|||
* SGD_DEGREES_TO_RADIANS,
|
||||
180.0, false );
|
||||
}
|
||||
// cout << "warp = " << warp << endl;
|
||||
globals->set_warp( orig_warp + warp );
|
||||
|
||||
t->update( longitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS,
|
||||
latitude->getDoubleValue() * SGD_DEGREES_TO_RADIANS,
|
||||
cur_time_override->getLongValue(),
|
||||
globals->get_warp() );
|
||||
|
||||
fgSetInt("/sim/time/warp", orig_warp + warp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -256,7 +256,14 @@ static const char *
|
|||
getDateString ()
|
||||
{
|
||||
static char buf[64]; // FIXME
|
||||
struct tm * t = globals->get_time_params()->getGmt();
|
||||
|
||||
SGTime * st = globals->get_time_params();
|
||||
if (!st) {
|
||||
buf[0] = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
struct tm * t = st->getGmt();
|
||||
sprintf(buf, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d",
|
||||
t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
||||
t->tm_hour, t->tm_min, t->tm_sec);
|
||||
|
@ -270,9 +277,6 @@ getDateString ()
|
|||
static void
|
||||
setDateString (const char * date_string)
|
||||
{
|
||||
static const SGPropertyNode *cur_time_override
|
||||
= fgGetNode("/sim/time/cur-time-override", true);
|
||||
|
||||
SGTime * st = globals->get_time_params();
|
||||
struct tm * current_time = st->getGmt();
|
||||
struct tm new_time;
|
||||
|
@ -298,16 +302,13 @@ setDateString (const char * date_string)
|
|||
// values, one way or another.
|
||||
new_time.tm_year -= 1900;
|
||||
new_time.tm_mon -= 1;
|
||||
|
||||
// Now, tell flight gear to use
|
||||
// the new time. This was far
|
||||
// too difficult, by the way.
|
||||
long int warp =
|
||||
mktime(&new_time) - mktime(current_time) + globals->get_warp();
|
||||
double lon = fgGetDouble("/position/longitude-deg") * SG_DEGREES_TO_RADIANS;
|
||||
double lat = fgGetDouble("/position/latitude-deg") * SG_DEGREES_TO_RADIANS;
|
||||
globals->set_warp(warp);
|
||||
st->update(lon, lat, cur_time_override->getLongValue(), warp);
|
||||
|
||||
fgSetInt("/sim/time/warp", warp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -317,7 +318,13 @@ static const char *
|
|||
getGMTString ()
|
||||
{
|
||||
static char buf[16];
|
||||
struct tm *t = globals->get_time_params()->getGmt();
|
||||
SGTime * st = globals->get_time_params();
|
||||
if (!st) {
|
||||
buf[0] = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
struct tm *t = st->getGmt();
|
||||
snprintf(buf, 16, "%.2d:%.2d:%.2d",
|
||||
t->tm_hour, t->tm_min, t->tm_sec);
|
||||
return buf;
|
||||
|
@ -367,30 +374,6 @@ getTrackMag ()
|
|||
return magtrack;
|
||||
}
|
||||
|
||||
static long
|
||||
getWarp ()
|
||||
{
|
||||
return globals->get_warp();
|
||||
}
|
||||
|
||||
static void
|
||||
setWarp (long warp)
|
||||
{
|
||||
globals->set_warp(warp);
|
||||
}
|
||||
|
||||
static long
|
||||
getWarpDelta ()
|
||||
{
|
||||
return globals->get_warp_delta();
|
||||
}
|
||||
|
||||
static void
|
||||
setWarpDelta (long delta)
|
||||
{
|
||||
globals->set_warp_delta(delta);
|
||||
}
|
||||
|
||||
static bool
|
||||
getWindingCCW ()
|
||||
{
|
||||
|
@ -515,9 +498,6 @@ FGProperties::bind ()
|
|||
fgTie("/environment/magnetic-variation-deg", getMagVar);
|
||||
fgTie("/environment/magnetic-dip-deg", getMagDip);
|
||||
|
||||
fgTie("/sim/time/warp", getWarp, setWarp, false);
|
||||
fgTie("/sim/time/warp-delta", getWarpDelta, setWarpDelta);
|
||||
|
||||
// Misc. Temporary junk.
|
||||
fgTie("/sim/temp/winding-ccw", getWindingCCW, setWindingCCW, false);
|
||||
}
|
||||
|
@ -545,9 +525,6 @@ FGProperties::unbind ()
|
|||
fgUntie("/environment/magnetic-variation-deg");
|
||||
fgUntie("/environment/magnetic-dip-deg");
|
||||
|
||||
fgUntie("/sim/time/warp");
|
||||
fgUntie("/sim/time/warp-delta");
|
||||
|
||||
// Misc. Temporary junk.
|
||||
fgUntie("/sim/temp/winding-ccw");
|
||||
fgUntie("/sim/temp/full-screen");
|
||||
|
|
|
@ -122,8 +122,6 @@ FGGlobals::FGGlobals() :
|
|||
soundmgr( new SGSoundMgr ),
|
||||
sim_time_sec( 0.0 ),
|
||||
fg_root( "" ),
|
||||
warp( 0 ),
|
||||
warp_delta( 0 ),
|
||||
time_params( NULL ),
|
||||
ephem( NULL ),
|
||||
mag( NULL ),
|
||||
|
@ -401,4 +399,24 @@ FGGlobals::get_current_view () const
|
|||
return viewmgr->get_current_view();
|
||||
}
|
||||
|
||||
long int FGGlobals::get_warp() const
|
||||
{
|
||||
return fgGetInt("/sim/time/warp");
|
||||
}
|
||||
|
||||
void FGGlobals::set_warp( long int w )
|
||||
{
|
||||
fgSetInt("/sim/time/warp", w);
|
||||
}
|
||||
|
||||
long int FGGlobals::get_warp_delta() const
|
||||
{
|
||||
return fgGetInt("/sim/time/warp-delta");
|
||||
}
|
||||
|
||||
void FGGlobals::set_warp_delta( long int d )
|
||||
{
|
||||
fgSetInt("/sim/time/warp-delta", d);
|
||||
}
|
||||
|
||||
// end of globals.cxx
|
||||
|
|
|
@ -104,14 +104,6 @@ private:
|
|||
|
||||
std::string browser;
|
||||
|
||||
// An offset in seconds from the true time. Allows us to adjust
|
||||
// the effective time of day.
|
||||
long int warp;
|
||||
|
||||
// How much to change the value of warp each iteration. Allows us
|
||||
// to make time progress faster than normal (or even run in reverse.)
|
||||
long int warp_delta;
|
||||
|
||||
// Time structure
|
||||
SGTime *time_params;
|
||||
|
||||
|
@ -227,13 +219,11 @@ public:
|
|||
inline const std::string &get_browser () const { return browser; }
|
||||
void set_browser (const std::string &b) { browser = b; }
|
||||
|
||||
inline long int get_warp() const { return warp; }
|
||||
inline void set_warp( long int w ) { warp = w; }
|
||||
inline void inc_warp( long int w ) { warp += w; }
|
||||
long int get_warp() const;
|
||||
void set_warp( long int w );
|
||||
|
||||
inline long int get_warp_delta() const { return warp_delta; }
|
||||
inline void set_warp_delta( long int d ) { warp_delta = d; }
|
||||
inline void inc_warp_delta( long int d ) { warp_delta += d; }
|
||||
long int get_warp_delta() const;
|
||||
void set_warp_delta( long int d );
|
||||
|
||||
inline SGTime *get_time_params() const { return time_params; }
|
||||
inline void set_time_params( SGTime *t ) { time_params = t; }
|
||||
|
|
|
@ -1552,6 +1552,10 @@ parse_option (const string& arg)
|
|||
SG_LOG( SG_GENERAL, SG_ALERT, "Bad property assignment: " << arg );
|
||||
return FG_OPTIONS_ERROR;
|
||||
}
|
||||
} else if ( arg.find("-psn_") == 0) {
|
||||
// on Mac, when launched from the GUI, we are passed the ProcessSerialNumber
|
||||
// as an argument (and no others). Silently ignore the argument here.
|
||||
return FG_OPTIONS_OK;
|
||||
} else if ( arg.find( "--" ) == 0 ) {
|
||||
size_t pos = arg.find( '=' );
|
||||
string arg_name, arg_value;
|
||||
|
|
|
@ -58,10 +58,15 @@ void TimeManager::init()
|
|||
_firstUpdate = true;
|
||||
_inited = true;
|
||||
_dtRemainder = 0.0;
|
||||
_adjustWarpOnUnfreeze = false;
|
||||
|
||||
_maxDtPerFrame = fgGetNode("/sim/max-simtime-per-frame", true);
|
||||
_clockFreeze = fgGetNode("/sim/freeze/clock", true);
|
||||
_timeOverride = fgGetNode("/sim/time/cur-time-override", true);
|
||||
_warp = fgGetNode("/sim/time/warp", true);
|
||||
_warp->addChangeListener(this);
|
||||
|
||||
_warpDelta = fgGetNode("/sim/time/warp-delta", true);
|
||||
|
||||
_longitudeDeg = fgGetNode("/position/longitude-deg", true);
|
||||
_latitudeDeg = fgGetNode("/position/latitude-deg", true);
|
||||
|
@ -70,16 +75,17 @@ void TimeManager::init()
|
|||
zone.append("Timezone");
|
||||
double lon = _longitudeDeg->getDoubleValue() * SG_DEGREES_TO_RADIANS;
|
||||
double lat = _latitudeDeg->getDoubleValue() * SG_DEGREES_TO_RADIANS;
|
||||
|
||||
_impl = new SGTime(lon, lat, zone.str(), _timeOverride->getLongValue());
|
||||
|
||||
globals->set_warp_delta(0);
|
||||
_warpDelta->setIntValue(0);
|
||||
|
||||
globals->get_event_mgr()->addTask("updateLocalTime", this,
|
||||
&TimeManager::updateLocalTime, 30*60 );
|
||||
updateLocalTime();
|
||||
|
||||
_impl->update(lon, lat, _timeOverride->getLongValue(),
|
||||
globals->get_warp());
|
||||
_warp->getIntValue());
|
||||
globals->set_time_params(_impl);
|
||||
|
||||
// frame/update-rate counters
|
||||
|
@ -95,14 +101,38 @@ void TimeManager::postinit()
|
|||
|
||||
void TimeManager::reinit()
|
||||
{
|
||||
shutdown();
|
||||
init();
|
||||
postinit();
|
||||
}
|
||||
|
||||
void TimeManager::shutdown()
|
||||
{
|
||||
_warp->removeChangeListener(this);
|
||||
|
||||
globals->set_time_params(NULL);
|
||||
delete _impl;
|
||||
_impl = NULL;
|
||||
_inited = false;
|
||||
globals->get_event_mgr()->removeTask("updateLocalTime");
|
||||
}
|
||||
|
||||
init();
|
||||
postinit();
|
||||
void TimeManager::valueChanged(SGPropertyNode* aProp)
|
||||
{
|
||||
if (aProp == _warp) {
|
||||
if (_clockFreeze->getBoolValue()) {
|
||||
// if the warp is changed manually while frozen, don't modify it when
|
||||
// un-freezing - the user wants to unfreeze with exactly the warp
|
||||
// they specified.
|
||||
_adjustWarpOnUnfreeze = false;
|
||||
}
|
||||
|
||||
double lon = _longitudeDeg->getDoubleValue() * SG_DEGREES_TO_RADIANS;
|
||||
double lat = _latitudeDeg->getDoubleValue() * SG_DEGREES_TO_RADIANS;
|
||||
_impl->update(lon, lat,
|
||||
_timeOverride->getLongValue(),
|
||||
_warp->getIntValue());
|
||||
}
|
||||
}
|
||||
|
||||
void TimeManager::computeTimeDeltas(double& simDt, double& realDt)
|
||||
|
@ -177,25 +207,32 @@ void TimeManager::computeTimeDeltas(double& simDt, double& realDt)
|
|||
void TimeManager::update(double dt)
|
||||
{
|
||||
bool freeze = _clockFreeze->getBoolValue();
|
||||
time_t now = time(NULL);
|
||||
|
||||
if (freeze) {
|
||||
// clock freeze requested
|
||||
if (_timeOverride->getLongValue() == 0) {
|
||||
fgSetLong( "/sim/time/cur-time-override", _impl->get_cur_time());
|
||||
globals->set_warp(0);
|
||||
_timeOverride->setLongValue(now);
|
||||
_adjustWarpOnUnfreeze = true;
|
||||
}
|
||||
} else {
|
||||
// no clock freeze requested
|
||||
if (_lastClockFreeze) {
|
||||
if (_adjustWarpOnUnfreeze) {
|
||||
// clock just unfroze, let's set warp as the difference
|
||||
// between frozen time and current time so we don't get a
|
||||
// time jump (and corresponding sky object and lighting
|
||||
// jump.)
|
||||
globals->set_warp(_timeOverride->getLongValue() - time(NULL));
|
||||
fgSetLong( "/sim/time/cur-time-override", 0 );
|
||||
int adjust = _timeOverride->getLongValue() - now;
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "adjusting on un-freeze:" << adjust);
|
||||
_warp->setIntValue(_warp->getIntValue() + adjust);
|
||||
}
|
||||
_timeOverride->setLongValue(0);
|
||||
}
|
||||
|
||||
if ( globals->get_warp_delta() != 0 ) {
|
||||
globals->inc_warp( globals->get_warp_delta() );
|
||||
int warpDelta = _warpDelta->getIntValue();
|
||||
if (warpDelta != 0) {
|
||||
_warp->setIntValue(_warp->getIntValue() + warpDelta);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,7 +241,7 @@ void TimeManager::update(double dt)
|
|||
double lat = _latitudeDeg->getDoubleValue() * SG_DEGREES_TO_RADIANS;
|
||||
_impl->update(lon, lat,
|
||||
_timeOverride->getLongValue(),
|
||||
globals->get_warp());
|
||||
_warp->getIntValue());
|
||||
|
||||
computeFrameRate();
|
||||
}
|
||||
|
@ -304,7 +341,7 @@ void TimeManager::updateLocalTime()
|
|||
void TimeManager::initTimeOffset()
|
||||
{
|
||||
// Handle potential user specified time offsets
|
||||
int orig_warp = globals->get_warp();
|
||||
int orig_warp = _warp->getIntValue();
|
||||
time_t cur_time = _impl->get_cur_time();
|
||||
time_t currGMT = sgTimeGetGMT( gmtime(&cur_time) );
|
||||
time_t systemLocalTime = sgTimeGetGMT( localtime(&cur_time) );
|
||||
|
@ -355,10 +392,8 @@ void TimeManager::initTimeOffset()
|
|||
warp = 0;
|
||||
}
|
||||
|
||||
globals->set_warp( orig_warp + warp );
|
||||
_impl->update(lon, lat, _timeOverride->getLongValue(),
|
||||
globals->get_warp() );
|
||||
_warp->setIntValue( orig_warp + warp );
|
||||
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "After fgInitTimeOffset(): warp = "
|
||||
<< globals->get_warp() );
|
||||
<< _warp->getIntValue() );
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
// forward decls
|
||||
class SGTime;
|
||||
|
||||
class TimeManager : public SGSubsystem
|
||||
class TimeManager : public SGSubsystem, public SGPropertyChangeListener
|
||||
{
|
||||
public:
|
||||
TimeManager();
|
||||
|
@ -36,10 +36,14 @@ public:
|
|||
virtual void init();
|
||||
virtual void reinit();
|
||||
virtual void postinit();
|
||||
virtual void shutdown();
|
||||
|
||||
void update(double dt);
|
||||
|
||||
// SGPropertyChangeListener overrides
|
||||
virtual void valueChanged(SGPropertyNode *);
|
||||
private:
|
||||
|
||||
/**
|
||||
* Ensure a consistent update-rate using a combination of
|
||||
* sleep()-ing and busy-waiting.
|
||||
|
@ -64,7 +68,11 @@ private:
|
|||
SGPropertyNode_ptr _maxDtPerFrame;
|
||||
SGPropertyNode_ptr _clockFreeze;
|
||||
SGPropertyNode_ptr _timeOverride;
|
||||
SGPropertyNode_ptr _warp;
|
||||
SGPropertyNode_ptr _warpDelta;
|
||||
|
||||
bool _lastClockFreeze;
|
||||
bool _adjustWarpOnUnfreeze;
|
||||
|
||||
SGPropertyNode_ptr _longitudeDeg;
|
||||
SGPropertyNode_ptr _latitudeDeg;
|
||||
|
|
Loading…
Add table
Reference in a new issue