1 |
|
---|
2 | /* -------------------------------------------------------------------------
|
---|
3 | * BKG NTRIP Server
|
---|
4 | * -------------------------------------------------------------------------
|
---|
5 | *
|
---|
6 | * Class: bnsSP3
|
---|
7 | *
|
---|
8 | * Purpose: writes SP3 files
|
---|
9 | *
|
---|
10 | * Author: L. Mervart
|
---|
11 | *
|
---|
12 | * Created: 25-Apr-2008
|
---|
13 | *
|
---|
14 | * Changes:
|
---|
15 | *
|
---|
16 | * -----------------------------------------------------------------------*/
|
---|
17 |
|
---|
18 | #include <iomanip>
|
---|
19 | #include <math.h>
|
---|
20 |
|
---|
21 | #include "bnssp3.h"
|
---|
22 | #include "bnsutils.h"
|
---|
23 |
|
---|
24 | using namespace std;
|
---|
25 |
|
---|
26 | // Constructor
|
---|
27 | ////////////////////////////////////////////////////////////////////////////
|
---|
28 | bnsSP3::bnsSP3(const QString& prep, const QString& ext, const QString& path,
|
---|
29 | const QString& intr, int sampl)
|
---|
30 | : bnsoutf(prep, ext, path, intr, sampl) {
|
---|
31 |
|
---|
32 | _lastGPSweek = 0;
|
---|
33 | _lastGPSweeks = 0.0;
|
---|
34 | }
|
---|
35 |
|
---|
36 | // Destructor
|
---|
37 | ////////////////////////////////////////////////////////////////////////////
|
---|
38 | bnsSP3::~bnsSP3() {
|
---|
39 | }
|
---|
40 |
|
---|
41 | // Write Header
|
---|
42 | ////////////////////////////////////////////////////////////////////////////
|
---|
43 | void bnsSP3::writeHeader(const QDateTime& datTim) {
|
---|
44 | _out << "THIS IS A DUMMY SP3 HEADER" << endl;
|
---|
45 | }
|
---|
46 |
|
---|
47 | // Write One Epoch
|
---|
48 | ////////////////////////////////////////////////////////////////////////////
|
---|
49 | t_irc bnsSP3::write(int GPSweek, double GPSweeks, const QString& prn,
|
---|
50 | const ColumnVector& xx) {
|
---|
51 |
|
---|
52 | if ( bnsoutf::write(GPSweek, GPSweeks, prn, xx) == success) {
|
---|
53 |
|
---|
54 | if (_lastGPSweek != GPSweek || _lastGPSweeks != GPSweeks) {
|
---|
55 | _lastGPSweek = GPSweek;
|
---|
56 | _lastGPSweeks = GPSweeks;
|
---|
57 |
|
---|
58 | QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks);
|
---|
59 | double sec = fmod(GPSweeks, 60.0);
|
---|
60 |
|
---|
61 | _out << datTim.toString("* yyyy MM dd hh mm").toAscii().data()
|
---|
62 | << setw(12) << setprecision(8) << sec << endl;
|
---|
63 | }
|
---|
64 | _out << "P" << prn.toAscii().data()
|
---|
65 | << setw(14) << setprecision(6) << xx(1) / 1000.0
|
---|
66 | << setw(14) << setprecision(6) << xx(2) / 1000.0
|
---|
67 | << setw(14) << setprecision(6) << xx(3) / 1000.0
|
---|
68 | << setw(14) << setprecision(6) << xx(4) * 1e6 << endl;
|
---|
69 |
|
---|
70 | return success;
|
---|
71 | }
|
---|
72 | else {
|
---|
73 | return failure;
|
---|
74 | }
|
---|
75 | }
|
---|