| 1 |
|
|---|
| 2 | /* -------------------------------------------------------------------------
|
|---|
| 3 | * Bernese NTRIP Client
|
|---|
| 4 | * -------------------------------------------------------------------------
|
|---|
| 5 | *
|
|---|
| 6 | * Class: bncRinex
|
|---|
| 7 | *
|
|---|
| 8 | * Purpose: writes RINEX files
|
|---|
| 9 | *
|
|---|
| 10 | * Author: L. Mervart
|
|---|
| 11 | *
|
|---|
| 12 | * Created: 27-Aug-2006
|
|---|
| 13 | *
|
|---|
| 14 | * Changes:
|
|---|
| 15 | *
|
|---|
| 16 | * -----------------------------------------------------------------------*/
|
|---|
| 17 |
|
|---|
| 18 | #include <iomanip>
|
|---|
| 19 |
|
|---|
| 20 | #include "bncrinex.h"
|
|---|
| 21 |
|
|---|
| 22 | #include "RTCM3/rtcm3torinex.h"
|
|---|
| 23 |
|
|---|
| 24 | using namespace std;
|
|---|
| 25 |
|
|---|
| 26 | // Constructor
|
|---|
| 27 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 28 | bncRinex::bncRinex(const char* StatID) {
|
|---|
| 29 | _statID = StatID;
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | // Destructor
|
|---|
| 33 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 34 | bncRinex::~bncRinex() {
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | // Stores Observation into Internal Array
|
|---|
| 38 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 39 | void bncRinex::deepCopy(const Observation* obs) {
|
|---|
| 40 | Observation* newObs = new Observation();
|
|---|
| 41 | memcpy(newObs, obs, sizeof(*obs));
|
|---|
| 42 | _obs.push_back(newObs);
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | // Write One Epoch into the RINEX File
|
|---|
| 46 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 47 | void bncRinex::dumpEpoch() {
|
|---|
| 48 |
|
|---|
| 49 | // Easy Return
|
|---|
| 50 | // -----------
|
|---|
| 51 | if (_obs.isEmpty()) {
|
|---|
| 52 | return;
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | // Time of Epoch
|
|---|
| 56 | // -------------
|
|---|
| 57 | struct converttimeinfo cti;
|
|---|
| 58 | Observation* firstObs = *_obs.begin();
|
|---|
| 59 | converttime(&cti, firstObs->GPSWeek, firstObs->GPSWeeks);
|
|---|
| 60 |
|
|---|
| 61 | cout.setf(std::ios::fixed);
|
|---|
| 62 |
|
|---|
| 63 | cout << setw(3) << cti.year%100
|
|---|
| 64 | << setw(3) << cti.month
|
|---|
| 65 | << setw(3) << cti.day
|
|---|
| 66 | << setw(3) << cti.hour
|
|---|
| 67 | << setw(3) << cti.minute
|
|---|
| 68 | << setw(11) << setprecision(7)
|
|---|
| 69 | << cti.second + fmod(firstObs->sec, 1.0)
|
|---|
| 70 | << " " << 0 << setw(3) << _obs.size();
|
|---|
| 71 |
|
|---|
| 72 | QListIterator<Observation*> it(_obs); int iSat = 0;
|
|---|
| 73 | while (it.hasNext()) {
|
|---|
| 74 | iSat++;
|
|---|
| 75 | Observation* ob = it.next();
|
|---|
| 76 | cout << " " << setw(2) << int(ob->SVPRN);
|
|---|
| 77 | if (iSat == 12 && it.hasNext()) {
|
|---|
| 78 | cout << endl << " ";
|
|---|
| 79 | iSat = 0;
|
|---|
| 80 | }
|
|---|
| 81 | }
|
|---|
| 82 | cout << endl;
|
|---|
| 83 |
|
|---|
| 84 | cout.precision(3);
|
|---|
| 85 |
|
|---|
| 86 | it.toFront();
|
|---|
| 87 | while (it.hasNext()) {
|
|---|
| 88 | Observation* ob = it.next();
|
|---|
| 89 | cout << setw(14) << ob->C1
|
|---|
| 90 | << setw(14) << ob->P2
|
|---|
| 91 | << setw(14) << ob->L1
|
|---|
| 92 | << setw(14) << ob->L2 << endl;
|
|---|
| 93 | delete ob;
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | _obs.clear();
|
|---|
| 97 | }
|
|---|
| 98 |
|
|---|