From 634d0feff5970a0f46b07989cbc193482d9ee1c3 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 5 Mar 2014 20:01:35 +0000 Subject: [PATCH] Add missing files. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3836 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- astro.cpp | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ astro.h | 36 ++++++++++++++++++ astro.ui | 37 +++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 astro.cpp create mode 100644 astro.h create mode 100644 astro.ui diff --git a/astro.cpp b/astro.cpp new file mode 100644 index 000000000..13bd9f17a --- /dev/null +++ b/astro.cpp @@ -0,0 +1,107 @@ +#include "astro.h" +#include "ui_astro.h" +#include +#include +#include +#include +#include "commons.h" + +Astro::Astro(QWidget *parent) : + QWidget(parent), + ui(new Ui::Astro) +{ + ui->setupUi(this); + ui->astroTextBrowser->setStyleSheet( + "QTextBrowser { background-color : cyan; color : black; }"); + ui->astroTextBrowser->clear(); +} + +Astro::~Astro() +{ + delete ui; +} + +void Astro::astroUpdate(QDateTime t, QString mygrid, QString hisgrid, + int fQSO, int nsetftx, int ntxFreq, QString azelDir) +{ + static int ntxFreq0=-99; + static bool astroBusy=false; + char cc[300]; + double azsun,elsun,azmoon,elmoon,azmoondx,elmoondx; + double ramoon,decmoon,dgrd,poloffset,xnr,techo; + int ntsky,ndop,ndop00; + QString date = t.date().toString("yyyy MMM dd"); + QString utc = t.time().toString(); + int nyear=t.date().year(); + int month=t.date().month(); + int nday=t.date().day(); + int nhr=t.time().hour(); + int nmin=t.time().minute(); + double sec=t.time().second() + 0.001*t.time().msec(); + int isec=sec; + double uth=nhr + nmin/60.0 + sec/3600.0; +// int nfreq=(int)datcom_.fcenter; + int nfreq=10368; + if(nfreq<10 or nfreq > 50000) nfreq=144; + + if(!astroBusy) { + astroBusy=true; + + astrosub_(&nyear, &month, &nday, &uth, &nfreq, mygrid.toLatin1(), + hisgrid.toLatin1(), &azsun, &elsun, &azmoon, &elmoon, + &azmoondx, &elmoondx, &ntsky, &ndop, &ndop00,&ramoon, &decmoon, + &dgrd, &poloffset, &xnr, &techo, 6, 6); + astroBusy=false; + } + + sprintf(cc, + "Az: %6.1f\n" + "El: %6.1f\n" + "MyDop: %6d\n" + "Delay: %6.2f\n" + "DxAz: %6.1f\n" + "DxEl: %6.1f\n" + "DxDop: %6d\n" + "Dec: %6.1f\n" + "SunAz: %6.1f\n" + "SunEl: %6.1f\n" + "Freq: %6d\n" + "Tsky: %6d\n" + "MNR: %6.1f\n" + "Dgrd: %6.1f", + azmoon,elmoon,ndop00,techo,azmoondx,elmoondx,ndop,decmoon, + azsun,elsun,nfreq,ntsky,xnr,dgrd); + ui->astroTextBrowser->setText(" "+ date + "\nUTC: " + utc + "\n" + cc); + + QString fname=azelDir+"/azel.dat"; + QFile f(fname); + if(!f.open(QIODevice::WriteOnly | QIODevice::Text)) { + QMessageBox mb; + mb.setText("Cannot open " + fname); + mb.exec(); + return; + } + int ndiff=0; + if(ntxFreq != ntxFreq0) ndiff=1; + ntxFreq0=ntxFreq; + QTextStream out(&f); + sprintf(cc,"%2.2d:%2.2d:%2.2d,%5.1f,%5.1f,Moon\n" + "%2.2d:%2.2d:%2.2d,%5.1f,%5.1f,Sun\n" + "%2.2d:%2.2d:%2.2d,%5.1f,%5.1f,Source\n" + "%4d,%6d,Doppler\n" + "%3d,%1d,fQSO\n" + "%3d,%1d,fQSO2\n", + nhr,nmin,isec,azmoon,elmoon, + nhr,nmin,isec,azsun,elsun, + nhr,nmin,isec,0.0,0.0, + nfreq,ndop, + fQSO,nsetftx, + ntxFreq,ndiff); + out << cc; + f.close(); +} + +void Astro::setFontSize(int n) +{ + ui->astroTextBrowser->setFontPointSize(n); +} diff --git a/astro.h b/astro.h new file mode 100644 index 000000000..4a0e45ce9 --- /dev/null +++ b/astro.h @@ -0,0 +1,36 @@ +#ifndef ASTRO_H +#define ASTRO_H + +#include +#include + +namespace Ui { + class Astro; +} + +class Astro : public QWidget +{ + Q_OBJECT + +public: + explicit Astro(QWidget *parent = 0); + void astroUpdate(QDateTime t, QString mygrid, QString hisgrid, + int fQSO, int nsetftx, int ntxFreq, QString azelDir); + void setFontSize(int n); +// ~Astro(); + virtual ~Astro(); + +private: + Ui::Astro *ui; +}; + +extern "C" { + void astrosub_(int* nyear, int* month, int* nday, double* uth, int* nfreq, + const char* mygrid, const char* hisgrid, double* azsun, + double* elsun, double* azmoon, double* elmoon, double* azmoondx, + double* elmoondx, int* ntsky, int* ndop, int* ndop00, + double* ramoon, double* decmoon, double* dgrd, double* poloffset, + double* xnr, double* techo, int len1, int len2); +} + +#endif // ASTRO_H diff --git a/astro.ui b/astro.ui new file mode 100644 index 000000000..df1ce80c7 --- /dev/null +++ b/astro.ui @@ -0,0 +1,37 @@ + + + Astro + + + + 0 + 0 + 262 + 483 + + + + Form + + + + + 0 + 10 + 256 + 451 + + + + + Courier New + 20 + 75 + true + + + + + + +