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

Last change on this file since 10561 was 3045, checked in by mervart, 14 years ago
File size: 2.4 KB
Line 
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
18#include <math.h>
19#include <iomanip>
20
21#include "bnsrinex.h"
22#include "bnssettings.h"
23
24using namespace std;
25using namespace BNS;
26
27// Constructor
28////////////////////////////////////////////////////////////////////////////
29bnsRinex::bnsRinex(const QString& prep, const QString& ext, const QString& path,
30 const QString& intr, int sampl)
31 : bnsoutf(prep, ext, path, intr, sampl) {
32 bnsSettings settings;
33 _append = Qt::CheckState(settings.value("fileAppend").toInt()) == Qt::Checked;
34}
35
36// Destructor
37////////////////////////////////////////////////////////////////////////////
38bnsRinex::~bnsRinex() {
39}
40
41// Write One Epoch
42////////////////////////////////////////////////////////////////////////////
43t_irc bnsRinex::write(int GPSweek, double GPSweeks, const QString& prn,
44 const ColumnVector& xx) {
45
46 if (bnsoutf::write(GPSweek, GPSweeks, prn, xx, _append) == success) {
47
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()
53 << fixed << setw(10) << setprecision(6) << sec
54 << " 1 "
55 << scientific << setw(19) << setprecision(12) << xx(4) << endl;
56
57 return success;
58 }
59 else {
60 return failure;
61 }
62}
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.