[73] | 1 |
|
---|
| 2 | /* -------------------------------------------------------------------------
|
---|
[93] | 3 | * BKG NTRIP Client
|
---|
[73] | 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 |
|
---|
[82] | 18 | #include <QSettings>
|
---|
| 19 | #include <QDir>
|
---|
[156] | 20 | #include <QUrl>
|
---|
[82] | 21 | #include <QDate>
|
---|
| 22 | #include <QFile>
|
---|
| 23 | #include <QTextStream>
|
---|
[75] | 24 | #include <iomanip>
|
---|
| 25 |
|
---|
[73] | 26 | #include "bncrinex.h"
|
---|
[157] | 27 | #include "bncapp.h"
|
---|
[82] | 28 | #include "bncutils.h"
|
---|
[126] | 29 | #include "bncconst.h"
|
---|
[75] | 30 |
|
---|
| 31 | using namespace std;
|
---|
| 32 |
|
---|
[73] | 33 | // Constructor
|
---|
| 34 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 35 | bncRinex::bncRinex(const char* StatID) {
|
---|
[77] | 36 | _statID = StatID;
|
---|
| 37 | _headerWritten = false;
|
---|
[82] | 38 | readSkeleton();
|
---|
[132] | 39 |
|
---|
| 40 | QSettings settings;
|
---|
| 41 | _rnxScriptName = settings.value("rnxScript").toString();
|
---|
| 42 | expandEnvVar(_rnxScriptName);
|
---|
[153] | 43 |
|
---|
| 44 | // Find the corresponding mountPoint
|
---|
| 45 | // ---------------------------------
|
---|
| 46 | QListIterator<QString> it(settings.value("mountPoints").toStringList());
|
---|
| 47 | while (it.hasNext()) {
|
---|
| 48 | QString hlp = it.next();
|
---|
| 49 | if (hlp.indexOf(_statID) != -1) {
|
---|
[156] | 50 | QUrl url(hlp);
|
---|
| 51 | _mountPoint = url.host() + url.path();
|
---|
[153] | 52 | break;
|
---|
| 53 | }
|
---|
| 54 | }
|
---|
[157] | 55 |
|
---|
| 56 | _pgmName = ((bncApp*)qApp)->bncVersion().leftJustified(20, ' ', true);
|
---|
[158] | 57 | _userName = QString("${USER}");
|
---|
[157] | 58 | expandEnvVar(_userName);
|
---|
[158] | 59 | _userName = _userName.leftJustified(20, ' ', true);
|
---|
[73] | 60 | }
|
---|
| 61 |
|
---|
| 62 | // Destructor
|
---|
| 63 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 64 | bncRinex::~bncRinex() {
|
---|
[77] | 65 | _out.close();
|
---|
[73] | 66 | }
|
---|
| 67 |
|
---|
[82] | 68 | // Read Skeleton Header File
|
---|
| 69 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 70 | void bncRinex::readSkeleton() {
|
---|
| 71 |
|
---|
| 72 | // Resolve Skeleton File Name
|
---|
| 73 | // --------------------------
|
---|
| 74 | QSettings settings;
|
---|
| 75 | QString sklName = settings.value("rnxPath").toString();
|
---|
| 76 | expandEnvVar(sklName);
|
---|
| 77 | if ( sklName[sklName.length()-1] != QDir::separator() ) {
|
---|
| 78 | sklName += QDir::separator();
|
---|
| 79 | }
|
---|
| 80 | sklName += _statID.left(4) + "." + settings.value("rnxSkel").toString();
|
---|
| 81 |
|
---|
| 82 | // Read the File
|
---|
| 83 | // -------------
|
---|
| 84 | QFile skl(sklName);
|
---|
| 85 | if ( skl.exists() && skl.open(QIODevice::ReadOnly) ) {
|
---|
| 86 | QTextStream in(&skl);
|
---|
| 87 | while ( !in.atEnd() ) {
|
---|
| 88 | _headerLines.append( in.readLine() );
|
---|
| 89 | if (_headerLines.last().indexOf("END OF HEADER") != -1) {
|
---|
| 90 | break;
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
| 93 | }
|
---|
| 94 | }
|
---|
| 95 |
|
---|
| 96 | // File Name according to RINEX Standards
|
---|
| 97 | ////////////////////////////////////////////////////////////////////////////
|
---|
[125] | 98 | void bncRinex::resolveFileName(const QDateTime& datTim) {
|
---|
[82] | 99 |
|
---|
| 100 | QSettings settings;
|
---|
| 101 | QString path = settings.value("rnxPath").toString();
|
---|
| 102 | expandEnvVar(path);
|
---|
| 103 |
|
---|
| 104 | if ( path[path.length()-1] != QDir::separator() ) {
|
---|
| 105 | path += QDir::separator();
|
---|
| 106 | }
|
---|
| 107 |
|
---|
[127] | 108 | QString intStr = settings.value("rnxIntr").toString();
|
---|
| 109 | QString hlpStr;
|
---|
[129] | 110 |
|
---|
| 111 | QTime nextTime;
|
---|
| 112 | QDate nextDate;
|
---|
| 113 |
|
---|
[199] | 114 | if (intStr == "5 min") {
|
---|
[127] | 115 | char ch = 'A' + datTim.time().hour();
|
---|
| 116 | hlpStr = ch;
|
---|
[199] | 117 | if (datTim.time().minute() < 5) {
|
---|
| 118 | hlpStr += "00";
|
---|
| 119 | nextTime.setHMS(datTim.time().hour(), 5, 0);
|
---|
| 120 | nextDate = datTim.date();
|
---|
| 121 | }
|
---|
| 122 | else if (datTim.time().minute() < 10) {
|
---|
| 123 | hlpStr += "5";
|
---|
| 124 | nextTime.setHMS(datTim.time().hour(), 10, 0);
|
---|
| 125 | nextDate = datTim.date();
|
---|
| 126 | }
|
---|
| 127 | else if (datTim.time().minute() < 15) {
|
---|
| 128 | hlpStr += "10";
|
---|
| 129 | nextTime.setHMS(datTim.time().hour(), 15, 0);
|
---|
| 130 | nextDate = datTim.date();
|
---|
| 131 | }
|
---|
| 132 | else if (datTim.time().minute() < 20) {
|
---|
| 133 | hlpStr += "15";
|
---|
| 134 | nextTime.setHMS(datTim.time().hour(), 20, 0);
|
---|
| 135 | nextDate = datTim.date();
|
---|
| 136 | }
|
---|
| 137 | else if (datTim.time().minute() < 25) {
|
---|
| 138 | hlpStr += "20";
|
---|
| 139 | nextTime.setHMS(datTim.time().hour(), 25, 0);
|
---|
| 140 | nextDate = datTim.date();
|
---|
| 141 | }
|
---|
| 142 | else if (datTim.time().minute() < 30) {
|
---|
| 143 | hlpStr += "25";
|
---|
| 144 | nextTime.setHMS(datTim.time().hour(), 30, 0);
|
---|
| 145 | nextDate = datTim.date();
|
---|
| 146 | }
|
---|
| 147 | else if (datTim.time().minute() < 35) {
|
---|
| 148 | hlpStr += "30";
|
---|
| 149 | nextTime.setHMS(datTim.time().hour(), 35, 0);
|
---|
| 150 | nextDate = datTim.date();
|
---|
| 151 | }
|
---|
| 152 | else if (datTim.time().minute() < 40) {
|
---|
| 153 | hlpStr += "35";
|
---|
| 154 | nextTime.setHMS(datTim.time().hour(), 40, 0);
|
---|
| 155 | nextDate = datTim.date();
|
---|
| 156 | }
|
---|
| 157 | else if (datTim.time().minute() < 45) {
|
---|
| 158 | hlpStr += "40";
|
---|
| 159 | nextTime.setHMS(datTim.time().hour(), 45, 0);
|
---|
| 160 | nextDate = datTim.date();
|
---|
| 161 | }
|
---|
| 162 | else if (datTim.time().minute() < 50) {
|
---|
| 163 | hlpStr += "45";
|
---|
| 164 | nextTime.setHMS(datTim.time().hour(), 50, 0);
|
---|
| 165 | nextDate = datTim.date();
|
---|
| 166 | }
|
---|
| 167 | else if (datTim.time().minute() < 55) {
|
---|
| 168 | hlpStr += "50";
|
---|
| 169 | nextTime.setHMS(datTim.time().hour(), 55, 0);
|
---|
| 170 | nextDate = datTim.date();
|
---|
| 171 | }
|
---|
| 172 | else {
|
---|
| 173 | hlpStr += "55";
|
---|
| 174 | if (datTim.time().hour() < 23) {
|
---|
| 175 | nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
|
---|
| 176 | nextDate = datTim.date();
|
---|
| 177 | }
|
---|
| 178 | else {
|
---|
| 179 | nextTime.setHMS(0, 0, 0);
|
---|
| 180 | nextDate = datTim.date().addDays(1);
|
---|
| 181 | }
|
---|
| 182 | }
|
---|
| 183 | }
|
---|
| 184 | else if (intStr == "10 min") {
|
---|
| 185 | char ch = 'A' + datTim.time().hour();
|
---|
| 186 | hlpStr = ch;
|
---|
| 187 | if (datTim.time().minute() < 10) {
|
---|
| 188 | hlpStr += "00";
|
---|
| 189 | nextTime.setHMS(datTim.time().hour(), 10, 0);
|
---|
| 190 | nextDate = datTim.date();
|
---|
| 191 | }
|
---|
| 192 | else if (datTim.time().minute() < 20) {
|
---|
| 193 | hlpStr += "10";
|
---|
| 194 | nextTime.setHMS(datTim.time().hour(), 20, 0);
|
---|
| 195 | nextDate = datTim.date();
|
---|
| 196 | }
|
---|
| 197 | else if (datTim.time().minute() < 30) {
|
---|
| 198 | hlpStr += "20";
|
---|
| 199 | nextTime.setHMS(datTim.time().hour(), 30, 0);
|
---|
| 200 | nextDate = datTim.date();
|
---|
| 201 | }
|
---|
| 202 | else if (datTim.time().minute() < 40) {
|
---|
| 203 | hlpStr += "30";
|
---|
| 204 | nextTime.setHMS(datTim.time().hour(), 40, 0);
|
---|
| 205 | nextDate = datTim.date();
|
---|
| 206 | }
|
---|
| 207 | else if (datTim.time().minute() < 50) {
|
---|
| 208 | hlpStr += "40";
|
---|
| 209 | nextTime.setHMS(datTim.time().hour(), 50, 0);
|
---|
| 210 | nextDate = datTim.date();
|
---|
| 211 | }
|
---|
| 212 | else {
|
---|
| 213 | hlpStr += "50";
|
---|
| 214 | if (datTim.time().hour() < 23) {
|
---|
| 215 | nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
|
---|
| 216 | nextDate = datTim.date();
|
---|
| 217 | }
|
---|
| 218 | else {
|
---|
| 219 | nextTime.setHMS(0, 0, 0);
|
---|
| 220 | nextDate = datTim.date().addDays(1);
|
---|
| 221 | }
|
---|
| 222 | }
|
---|
| 223 | }
|
---|
| 224 | else if (intStr == "15 min") {
|
---|
| 225 | char ch = 'A' + datTim.time().hour();
|
---|
| 226 | hlpStr = ch;
|
---|
[127] | 227 | if (datTim.time().minute() < 15) {
|
---|
| 228 | hlpStr += "00";
|
---|
[129] | 229 | nextTime.setHMS(datTim.time().hour(), 15, 0);
|
---|
| 230 | nextDate = datTim.date();
|
---|
[127] | 231 | }
|
---|
| 232 | else if (datTim.time().minute() < 30) {
|
---|
| 233 | hlpStr += "15";
|
---|
[129] | 234 | nextTime.setHMS(datTim.time().hour(), 30, 0);
|
---|
| 235 | nextDate = datTim.date();
|
---|
[127] | 236 | }
|
---|
| 237 | else if (datTim.time().minute() < 45) {
|
---|
| 238 | hlpStr += "30";
|
---|
[129] | 239 | nextTime.setHMS(datTim.time().hour(), 45, 0);
|
---|
| 240 | nextDate = datTim.date();
|
---|
[127] | 241 | }
|
---|
| 242 | else {
|
---|
| 243 | hlpStr += "45";
|
---|
[129] | 244 | if (datTim.time().hour() < 23) {
|
---|
| 245 | nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
|
---|
| 246 | nextDate = datTim.date();
|
---|
| 247 | }
|
---|
| 248 | else {
|
---|
| 249 | nextTime.setHMS(0, 0, 0);
|
---|
| 250 | nextDate = datTim.date().addDays(1);
|
---|
| 251 | }
|
---|
[127] | 252 | }
|
---|
| 253 | }
|
---|
[199] | 254 | else if (intStr == "30 min") {
|
---|
| 255 | char ch = 'A' + datTim.time().hour();
|
---|
| 256 | hlpStr = ch;
|
---|
| 257 | if (datTim.time().minute() < 30) {
|
---|
| 258 | hlpStr += "00";
|
---|
| 259 | nextTime.setHMS(datTim.time().hour(), 30, 0);
|
---|
| 260 | nextDate = datTim.date();
|
---|
| 261 | }
|
---|
| 262 | else {
|
---|
| 263 | hlpStr += "30";
|
---|
| 264 | if (datTim.time().hour() < 23) {
|
---|
| 265 | nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
|
---|
| 266 | nextDate = datTim.date();
|
---|
| 267 | }
|
---|
| 268 | else {
|
---|
| 269 | nextTime.setHMS(0, 0, 0);
|
---|
| 270 | nextDate = datTim.date().addDays(1);
|
---|
| 271 | }
|
---|
| 272 | }
|
---|
| 273 | }
|
---|
[127] | 274 | else if (intStr == "1 hour") {
|
---|
| 275 | char ch = 'A' + datTim.time().hour();
|
---|
| 276 | hlpStr = ch;
|
---|
[129] | 277 | if (datTim.time().hour() < 23) {
|
---|
| 278 | nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
|
---|
| 279 | nextDate = datTim.date();
|
---|
| 280 | }
|
---|
| 281 | else {
|
---|
| 282 | nextTime.setHMS(0, 0, 0);
|
---|
| 283 | nextDate = datTim.date().addDays(1);
|
---|
| 284 | }
|
---|
[127] | 285 | }
|
---|
| 286 | else {
|
---|
| 287 | hlpStr = "0";
|
---|
[129] | 288 | nextTime.setHMS(0, 0, 0);
|
---|
| 289 | nextDate = datTim.date().addDays(1);
|
---|
[127] | 290 | }
|
---|
[129] | 291 | _nextCloseEpoch = QDateTime(nextDate, nextTime);
|
---|
[82] | 292 |
|
---|
[183] | 293 | QString ID4 = _statID.left(4);
|
---|
| 294 |
|
---|
| 295 | // Check name conflict
|
---|
| 296 | // -------------------
|
---|
| 297 | QString distStr;
|
---|
| 298 | int num = 0;
|
---|
| 299 | QListIterator<QString> it(settings.value("mountPoints").toStringList());
|
---|
| 300 | while (it.hasNext()) {
|
---|
| 301 | QString mp = it.next();
|
---|
| 302 | if (mp.indexOf(ID4) != -1) {
|
---|
| 303 | ++num;
|
---|
| 304 | }
|
---|
| 305 | }
|
---|
| 306 | if (num > 1) {
|
---|
| 307 | distStr = "_" + _statID.mid(4);
|
---|
| 308 | }
|
---|
| 309 |
|
---|
| 310 | path += ID4 +
|
---|
[127] | 311 | QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
|
---|
[183] | 312 | hlpStr + distStr +
|
---|
[127] | 313 | datTim.toString(".yyO");
|
---|
[82] | 314 |
|
---|
| 315 | _fName = path.toAscii();
|
---|
| 316 | }
|
---|
| 317 |
|
---|
[77] | 318 | // Write RINEX Header
|
---|
| 319 | ////////////////////////////////////////////////////////////////////////////
|
---|
[125] | 320 | void bncRinex::writeHeader(const QDateTime& datTim) {
|
---|
[77] | 321 |
|
---|
| 322 | // Open the Output File
|
---|
| 323 | // --------------------
|
---|
[125] | 324 | resolveFileName(datTim);
|
---|
[82] | 325 | _out.open(_fName.data());
|
---|
[85] | 326 | _out.setf(ios::showpoint | ios::fixed);
|
---|
[77] | 327 |
|
---|
[82] | 328 | // Copy Skeleton Header
|
---|
| 329 | // --------------------
|
---|
| 330 | if (_headerLines.size() > 0) {
|
---|
| 331 | QStringListIterator it(_headerLines);
|
---|
| 332 | while (it.hasNext()) {
|
---|
| 333 | QString line = it.next();
|
---|
[157] | 334 | if (line.indexOf("PGM / RUN BY / DATE") != -1) {
|
---|
[159] | 335 | QString hlp = QDate::currentDate().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
|
---|
[157] | 336 | _out << _pgmName.toAscii().data() << _userName.toAscii().data()
|
---|
| 337 | << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
|
---|
| 338 | }
|
---|
| 339 | else if (line.indexOf("# / TYPES OF OBSERV") != -1) {
|
---|
[82] | 340 | _out << " 4 P1 P2 L1 L2"
|
---|
| 341 | " # / TYPES OF OBSERV" << endl;
|
---|
| 342 | }
|
---|
| 343 | else if (line.indexOf("TIME OF FIRST OBS") != -1) {
|
---|
[125] | 344 | _out << datTim.toString(" yyyy MM dd"
|
---|
| 345 | " hh mm ss.zzz0000").toAscii().data();
|
---|
| 346 | _out << " TIME OF FIRST OBS" << endl;
|
---|
[188] | 347 | QString hlp = QString("STREAM %1").arg(_mountPoint)
|
---|
[156] | 348 | .leftJustified(60, ' ', true);
|
---|
| 349 | _out << hlp.toAscii().data() << "COMMENT" << endl;
|
---|
[82] | 350 | }
|
---|
| 351 | else {
|
---|
| 352 | _out << line.toAscii().data() << endl;
|
---|
| 353 | }
|
---|
| 354 | }
|
---|
| 355 | }
|
---|
[78] | 356 |
|
---|
[82] | 357 | // Write Dummy Header
|
---|
| 358 | // ------------------
|
---|
| 359 | else {
|
---|
| 360 | double approxPos[3]; approxPos[0] = approxPos[1] = approxPos[2] = 0.0;
|
---|
| 361 | double antennaNEU[3]; antennaNEU[0] = antennaNEU[1] = antennaNEU[2] = 0.0;
|
---|
| 362 |
|
---|
| 363 | _out << " 2.10 OBSERVATION DATA G (GPS) RINEX VERSION / TYPE" << endl;
|
---|
[159] | 364 | QString hlp = QDate::currentDate().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
|
---|
[157] | 365 | _out << _pgmName.toAscii().data() << _userName.toAscii().data()
|
---|
| 366 | << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
|
---|
[86] | 367 | _out.setf(ios::left);
|
---|
[82] | 368 | _out << setw(60) << _statID.data() << "MARKER NAME" << endl;
|
---|
| 369 | _out << setw(60) << "BKG" << "OBSERVER / AGENCY" << endl;
|
---|
| 370 | _out << setw(20) << "unknown"
|
---|
| 371 | << setw(20) << "unknown"
|
---|
| 372 | << setw(20) << "unknown" << "REC # / TYPE / VERS" << endl;
|
---|
| 373 | _out << setw(20) << "unknown"
|
---|
| 374 | << setw(20) << "unknown"
|
---|
| 375 | << setw(20) << " " << "ANT # / TYPE" << endl;
|
---|
[86] | 376 | _out.unsetf(ios::left);
|
---|
[82] | 377 | _out << setw(14) << setprecision(4) << approxPos[0]
|
---|
| 378 | << setw(14) << setprecision(4) << approxPos[1]
|
---|
| 379 | << setw(14) << setprecision(4) << approxPos[2]
|
---|
| 380 | << " " << "APPROX POSITION XYZ" << endl;
|
---|
| 381 | _out << setw(14) << setprecision(4) << antennaNEU[0]
|
---|
| 382 | << setw(14) << setprecision(4) << antennaNEU[1]
|
---|
| 383 | << setw(14) << setprecision(4) << antennaNEU[2]
|
---|
| 384 | << " " << "ANTENNA: DELTA H/E/N" << endl;
|
---|
| 385 | _out << " 1 1 WAVELENGTH FACT L1/2" << endl;
|
---|
| 386 | _out << " 4 P1 P2 L1 L2 # / TYPES OF OBSERV" << endl;
|
---|
[125] | 387 | _out << datTim.toString(" yyyy MM dd"
|
---|
| 388 | " hh mm ss.zzz0000").toAscii().data();
|
---|
| 389 | _out << " " << "TIME OF FIRST OBS" << endl;
|
---|
[188] | 390 | hlp = QString("STREAM %1").arg(_mountPoint)
|
---|
[157] | 391 | .leftJustified(60, ' ', true);
|
---|
[156] | 392 | _out << hlp.toAscii().data() << "COMMENT" << endl;
|
---|
[82] | 393 | _out << " END OF HEADER" << endl;
|
---|
| 394 | }
|
---|
[78] | 395 |
|
---|
[77] | 396 | _headerWritten = true;
|
---|
| 397 | }
|
---|
| 398 |
|
---|
[73] | 399 | // Stores Observation into Internal Array
|
---|
| 400 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 401 | void bncRinex::deepCopy(const Observation* obs) {
|
---|
[74] | 402 | Observation* newObs = new Observation();
|
---|
| 403 | memcpy(newObs, obs, sizeof(*obs));
|
---|
| 404 | _obs.push_back(newObs);
|
---|
[73] | 405 | }
|
---|
| 406 |
|
---|
| 407 | // Write One Epoch into the RINEX File
|
---|
| 408 | ////////////////////////////////////////////////////////////////////////////
|
---|
[160] | 409 | void bncRinex::dumpEpoch(long maxTime) {
|
---|
[73] | 410 |
|
---|
[160] | 411 | // Select observations older than maxTime
|
---|
| 412 | // --------------------------------------
|
---|
| 413 | QList<Observation*> dumpList;
|
---|
| 414 | QMutableListIterator<Observation*> mIt(_obs);
|
---|
| 415 | while (mIt.hasNext()) {
|
---|
| 416 | Observation* ob = mIt.next();
|
---|
| 417 | if (ob->GPSWeek * 7*24*3600 + ob->GPSWeeks < maxTime) {
|
---|
| 418 | dumpList.push_back(ob);
|
---|
| 419 | mIt.remove();
|
---|
| 420 | }
|
---|
| 421 | }
|
---|
| 422 |
|
---|
[75] | 423 | // Easy Return
|
---|
| 424 | // -----------
|
---|
[160] | 425 | if (dumpList.isEmpty()) {
|
---|
[75] | 426 | return;
|
---|
| 427 | }
|
---|
| 428 |
|
---|
| 429 | // Time of Epoch
|
---|
| 430 | // -------------
|
---|
[160] | 431 | Observation* firstObs = *dumpList.begin();
|
---|
[75] | 432 |
|
---|
[125] | 433 | QDateTime datTim = dateAndTimeFromGPSweek( firstObs->GPSWeek,
|
---|
| 434 | firstObs->GPSWeeks +
|
---|
| 435 | fmod(firstObs->sec, 1.0) );
|
---|
| 436 |
|
---|
[130] | 437 | // Close the file
|
---|
| 438 | // --------------
|
---|
| 439 | if (_nextCloseEpoch.isValid() && datTim >= _nextCloseEpoch) {
|
---|
| 440 | closeFile();
|
---|
| 441 | _headerWritten = false;
|
---|
| 442 | }
|
---|
| 443 |
|
---|
[78] | 444 | // Write RINEX Header
|
---|
| 445 | // ------------------
|
---|
| 446 | if (!_headerWritten) {
|
---|
[125] | 447 | writeHeader(datTim);
|
---|
[78] | 448 | }
|
---|
| 449 |
|
---|
[131] | 450 | _out << datTim.toString(" yy MM dd hh mm ss.zzz0000").toAscii().data()
|
---|
[160] | 451 | << " " << 0 << setw(3) << dumpList.size();
|
---|
[75] | 452 |
|
---|
[160] | 453 | QListIterator<Observation*> it(dumpList); int iSat = 0;
|
---|
[74] | 454 | while (it.hasNext()) {
|
---|
[75] | 455 | iSat++;
|
---|
| 456 | Observation* ob = it.next();
|
---|
[77] | 457 | _out << " " << setw(2) << int(ob->SVPRN);
|
---|
[75] | 458 | if (iSat == 12 && it.hasNext()) {
|
---|
[77] | 459 | _out << endl << " ";
|
---|
[75] | 460 | iSat = 0;
|
---|
| 461 | }
|
---|
[74] | 462 | }
|
---|
[77] | 463 | _out << endl;
|
---|
[75] | 464 |
|
---|
| 465 | it.toFront();
|
---|
| 466 | while (it.hasNext()) {
|
---|
| 467 | Observation* ob = it.next();
|
---|
[77] | 468 |
|
---|
| 469 | char lli = ' ';
|
---|
| 470 | char snr = ' ';
|
---|
| 471 | _out << setw(14) << setprecision(3) << ob->C1 << lli << snr;
|
---|
| 472 | _out << setw(14) << setprecision(3) << ob->P2 << lli << snr;
|
---|
[126] | 473 | _out << setw(14) << setprecision(3) << ob->L1 / t_CST::lambda1 << lli << snr;
|
---|
| 474 | _out << setw(14) << setprecision(3) << ob->L2 / t_CST::lambda2 << lli << snr;
|
---|
[77] | 475 | _out << endl;
|
---|
| 476 |
|
---|
[75] | 477 | delete ob;
|
---|
| 478 | }
|
---|
| 479 |
|
---|
[77] | 480 | _out.flush();
|
---|
[73] | 481 | }
|
---|
| 482 |
|
---|
[130] | 483 | // Close the Old RINEX File
|
---|
| 484 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 485 | void bncRinex::closeFile() {
|
---|
| 486 | _out.close();
|
---|
[132] | 487 | if (!_rnxScriptName.isEmpty()) {
|
---|
| 488 | _rnxScript.start(_rnxScriptName, QStringList() << _fName);
|
---|
| 489 | }
|
---|
[130] | 490 | }
|
---|