later. Some machines may not support the ncurses console output. Borland is one
of those environments which does not, so the ncurses stuff is commented out.
-ARGUMENTS
---------------------------------------------------------------------------------
-
-
HISTORY
--------------------------------------------------------------------------------
12/02/98 JSB Created
INCLUDES
*******************************************************************************/
-/*
-#if !defined( __BORLANDC__ )
-# define HAVE_NCURSES
+#ifdef FGFS
+# include <Include/compiler.h>
+# ifdef FG_HAVE_STD_INCLUDES
+# include <iostream>
+# else
+# include <iostream.h>
+# endif
+#else
+# include <iostream>
+#endif
+#ifdef HAVE_CURSES
+# include <ncurses.h>
#endif
-*/
#include "FGOutput.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <iostream.h>
-
-#ifndef HAVE_NCURSES
- #include "FGPosition.h"
-#else
- #include <ncurses.h>
- #include "FGPosition.h"
-#endif
+#include "FGState.h"
+#include "FGFDMExec.h"
+#include "FGAtmosphere.h"
+#include "FGFCS.h"
+#include "FGAircraft.h"
+#include "FGTranslation.h"
+#include "FGRotation.h"
+#include "FGPosition.h"
+#include "FGAuxiliary.h"
/*******************************************************************************
************************************ CODE **************************************
*******************************************************************************/
-FGOutput::FGOutput(void) : FGModel()
+FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
{
- strcpy(Name, "FGOutput");
+ Name = "FGOutput";
FirstPass = true;
-#ifdef HAVE_NCURSES
+#ifdef HAVE_CURSES
initscr();
cbreak();
noecho();
void FGOutput::ConsoleOutput(void)
{
- char buffer[20];
+#ifdef HAVE_CURSES
+ string buffer;
-#ifdef HAVE_NCURSES
clear();
move(1,1); insstr("Quaternions");
move(2,5); insstr("Q0");
move(2,27); insstr("Q2");
move(2,38); insstr("Q3");
- move(3,1); sprintf(buffer,"%4.4f",State->GetQ0()); insstr(buffer);
- move(3,12); sprintf(buffer,"%4.4f",State->GetQ1()); insstr(buffer);
- move(3,23); sprintf(buffer,"%4.4f",State->GetQ2()); insstr(buffer);
- move(3,34); sprintf(buffer,"%4.4f",State->GetQ3()); insstr(buffer);
+ move(3,1); buffer = Rotation->GetQ0(); insstr(buffer.c_str());
+ move(3,12); buffer = Rotation->GetQ1(); insstr(buffer.c_str());
+ move(3,23); buffer = Rotation->GetQ2(); insstr(buffer.c_str());
+ move(3,34); buffer = Rotation->GetQ3(); insstr(buffer.c_str());
move(0,0); insstr("Time: ");
move(0,6); insstr(gcvt(State->Getsim_time(),6,buffer));
move(2,55); insstr("Tht");
move(2,64); insstr("Psi");
- move(3,45); sprintf(buffer,"%3.3f",State->Getphi()); insstr(buffer);
- move(3,54); sprintf(buffer,"%3.3f",State->Gettht()); insstr(buffer);
- move(3,63); sprintf(buffer,"%3.3f",State->Getpsi()); insstr(buffer);
+ move(3,45); buffer = Rotation->Getphi(); insstr(buffer.c_str());
+ move(3,54); buffer = Rotation->Gettht(); insstr(buffer.c_str());
+ move(3,63); buffer = Rotation->Getpsi(); insstr(buffer.c_str());
move(5,47); insstr("U");
move(5,56); insstr("V");
move(5,65); insstr("W");
- move(6,45); sprintf(buffer,"%5.2f",State->GetU()); insstr(buffer);
- move(6,54); sprintf(buffer,"%5.2f",State->GetV()); insstr(buffer);
- move(6,63); sprintf(buffer,"%5.2f",State->GetW()); insstr(buffer);
+ move(6,45); buffer = Translation->GetU(); insstr(buffer.c_str());
+ move(6,54); buffer = Translation->GetV(); insstr(buffer.c_str());
+ move(6,63); buffer = Translation->GetW(); insstr(buffer.c_str());
move(8,47); insstr("Fx");
move(8,56); insstr("Fy");
move(8,65); insstr("Fz");
- move(9,45); sprintf(buffer,"%5.2f",State->GetFx()); insstr(buffer);
- move(9,54); sprintf(buffer,"%5.2f",State->GetFy()); insstr(buffer);
- move(9,63); sprintf(buffer,"%5.2f",State->GetFz()); insstr(buffer);
+ move(9,45); buffer = Aircraft->GetFx(); insstr(buffer.c_str());
+ move(9,54); buffer = Aircraft->GetFy(); insstr(buffer.c_str());
+ move(9,63); buffer = Aircraft->GetFz(); insstr(buffer.c_str());
move(11,47); insstr("Fn");
move(11,56); insstr("Fe");
move(11,65); insstr("Fd");
- move(12,45); sprintf(buffer,"%5.2f",Position->GetFn()); insstr(buffer);
- move(12,54); sprintf(buffer,"%5.2f",Position->GetFe()); insstr(buffer);
- move(12,63); sprintf(buffer,"%5.2f",Position->GetFd()); insstr(buffer);
+ move(12,45); buffer = Position->GetFn(); insstr(buffer.c_str());
+ move(12,54); buffer = Position->GetFe(); insstr(buffer.c_str());
+ move(12,63); buffer = Position->GetFd(); insstr(buffer.c_str());
move(14,47); insstr("Latitude");
move(14,57); insstr("Longitude");
move(14,67); insstr("Altitude");
- move(15,47); sprintf(buffer,"%5.2f",State->Getlatitude()); insstr(buffer);
- move(15,57); sprintf(buffer,"%5.2f",State->Getlongitude()); insstr(buffer);
- move(15,67); sprintf(buffer,"%5.2f",State->Geth()); insstr(buffer);
+ move(15,47); buffer = State->Getlatitude(); insstr(buffer.c_str());
+ move(15,57); buffer = State->Getlongitude(); insstr(buffer.c_str());
+ move(15,67); buffer = State->Geth(); insstr(buffer.c_str());
refresh();
} else {
cout << State->Getsim_time() << ",";
cout << State->Geth() << ",";
- cout << State->Getphi() << ",";
- cout << State->Gettht() << ",";
- cout << State->Getpsi() << ",";
- cout << State->Getrho() << ",";
+ cout << Rotation->Getphi() << ",";
+ cout << Rotation->Gettht() << ",";
+ cout << Rotation->Getpsi() << ",";
+ cout << Atmosphere->Getrho() << ",";
cout << State->GetVt() << ",";
- cout << State->GetU() << ",";
- cout << State->GetV() << ",";
- cout << State->GetW() << ",";
- cout << State->GetVn() << ",";
- cout << State->GetVe() << ",";
- cout << State->GetVd() << ",";
- cout << State->GetUdot() << ",";
- cout << State->GetVdot() << ",";
- cout << State->GetWdot() << ",";
- cout << State->GetFx() << ",";
- cout << State->GetFy() << ",";
- cout << State->GetFz() << ",";
+ cout << Translation->GetU() << ",";
+ cout << Translation->GetV() << ",";
+ cout << Translation->GetW() << ",";
+ cout << Position->GetVn() << ",";
+ cout << Position->GetVe() << ",";
+ cout << Position->GetVd() << ",";
+ cout << Translation->GetUdot() << ",";
+ cout << Translation->GetVdot() << ",";
+ cout << Translation->GetWdot() << ",";
+ cout << Aircraft->GetFx() << ",";
+ cout << Aircraft->GetFy() << ",";
+ cout << Aircraft->GetFz() << ",";
cout << State->Getlatitude() << ",";
cout << State->Getlongitude() << ",";
cout << State->Getqbar() << ",";
- cout << State->Getalpha() << "";
+ cout << Translation->Getalpha() << "";
cout << endl;
}
}