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 |
|
---|
24 | using namespace std;
|
---|
25 |
|
---|
26 | // Constructor
|
---|
27 | ////////////////////////////////////////////////////////////////////////////
|
---|
28 | bnsRinex::bnsRinex(const QString& prep, const QString& ext, const QString& path,
|
---|
29 | const QString& intr, int sampl)
|
---|
30 | : bnsoutf(prep, ext, path, intr, sampl) {
|
---|
31 | bnsSettings settings;
|
---|
32 | _append = Qt::CheckState(settings.value("fileAppend").toInt()) == Qt::Checked;
|
---|
33 | }
|
---|
34 |
|
---|
35 | // Destructor
|
---|
36 | ////////////////////////////////////////////////////////////////////////////
|
---|
37 | bnsRinex::~bnsRinex() {
|
---|
38 | }
|
---|
39 |
|
---|
40 | // Write One Epoch
|
---|
41 | ////////////////////////////////////////////////////////////////////////////
|
---|
42 | t_irc bnsRinex::write(int GPSweek, double GPSweeks, const QString& prn,
|
---|
43 | const ColumnVector& xx) {
|
---|
44 |
|
---|
45 | if (bnsoutf::write(GPSweek, GPSweeks, prn, xx, _append) == success) {
|
---|
46 |
|
---|
47 | QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
|
---|
48 | double sec = fmod(GPSweeks, 60.0);
|
---|
49 |
|
---|
50 | _out << "AS " << prn.toAscii().data()
|
---|
51 | << datTim.toString(" yyyy MM dd hh mm").toAscii().data()
|
---|
52 | << fixed << setw(10) << setprecision(6) << sec
|
---|
53 | << " 1 "
|
---|
54 | << scientific << setw(19) << setprecision(12) << xx(4) << endl;
|
---|
55 |
|
---|
56 | return success;
|
---|
57 | }
|
---|
58 | else {
|
---|
59 | return failure;
|
---|
60 | }
|
---|
61 | }
|
---|
62 |
|
---|
63 | // Write Header
|
---|
64 | ////////////////////////////////////////////////////////////////////////////
|
---|
65 | void bnsRinex::writeHeader(const QDateTime& datTim) {
|
---|
66 |
|
---|
67 | _out << " 3.00 C "
|
---|
68 | << "RINEX VERSION / TYPE" << endl;
|
---|
69 |
|
---|
70 | _out << "BNS "
|
---|
71 | << datTim.toString("yyyyMMdd hhmmss").leftJustified(20, ' ', true).toAscii().data()
|
---|
72 | << "PGM / RUN BY / DATE" << endl;
|
---|
73 |
|
---|
74 | _out << " 1 AS "
|
---|
75 | << "# / TYPES OF DATA" << endl;
|
---|
76 |
|
---|
77 | _out << " "
|
---|
78 | << "END OF HEADER" << endl;
|
---|
79 | }
|
---|
80 |
|
---|