source: ntrip/trunk/BNS/bnsrinex.cpp@ 8488

Last change on this file since 8488 was 3045, checked in by mervart, 14 years ago
File size: 2.4 KB
RevLine 
[847]1
2/* -------------------------------------------------------------------------
3 * BKG NTRIP Server
4 * -------------------------------------------------------------------------
5 *
6 * Class: bnsRinex
7 *
8 * Purpose: writes RINEX Clock files
9 *
10 * Author: L. Mervart
11 *
12 * Created: 25-Apr-2008
13 *
14 * Changes:
15 *
16 * -----------------------------------------------------------------------*/
17
[855]18#include <math.h>
[847]19#include <iomanip>
20
21#include "bnsrinex.h"
[3041]22#include "bnssettings.h"
[847]23
24using namespace std;
[3045]25using namespace BNS;
[847]26
27// Constructor
28////////////////////////////////////////////////////////////////////////////
[850]29bnsRinex::bnsRinex(const QString& prep, const QString& ext, const QString& path,
30 const QString& intr, int sampl)
31 : bnsoutf(prep, ext, path, intr, sampl) {
[3041]32 bnsSettings settings;
33 _append = Qt::CheckState(settings.value("fileAppend").toInt()) == Qt::Checked;
[847]34}
35
36// Destructor
37////////////////////////////////////////////////////////////////////////////
38bnsRinex::~bnsRinex() {
39}
40
[850]41// Write One Epoch
42////////////////////////////////////////////////////////////////////////////
[854]43t_irc bnsRinex::write(int GPSweek, double GPSweeks, const QString& prn,
[850]44 const ColumnVector& xx) {
45
[3041]46 if (bnsoutf::write(GPSweek, GPSweeks, prn, xx, _append) == success) {
[850]47
[855]48 QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
49 double sec = fmod(GPSweeks, 60.0);
50
51 _out << "AS " << prn.toAscii().data()
52 << datTim.toString(" yyyy MM dd hh mm").toAscii().data()
[859]53 << fixed << setw(10) << setprecision(6) << sec
54 << " 1 "
55 << scientific << setw(19) << setprecision(12) << xx(4) << endl;
[855]56
[854]57 return success;
58 }
59 else {
60 return failure;
61 }
[847]62}
[858]63
64// Write Header
65////////////////////////////////////////////////////////////////////////////
66void bnsRinex::writeHeader(const QDateTime& datTim) {
67
68 _out << " 3.00 C "
69 << "RINEX VERSION / TYPE" << endl;
70
71 _out << "BNS "
72 << datTim.toString("yyyyMMdd hhmmss").leftJustified(20, ' ', true).toAscii().data()
73 << "PGM / RUN BY / DATE" << endl;
74
75 _out << " 1 AS "
76 << "# / TYPES OF DATA" << endl;
77
78 _out << " "
79 << "END OF HEADER" << endl;
80}
81
Note: See TracBrowser for help on using the repository browser.