source: ntrip/trunk/BNC/src/rinex/reqcedit.cpp@ 7474

Last change on this file since 7474 was 7474, checked in by stuerze, 9 years ago

in case of RINEX3 to RINEX 2 conversion now some comment lines are written into the RINEX header

File size: 21.4 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters.
3//
4// Copyright (C) 2007
5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
7// Czech Technical University Prague, Department of Geodesy
8// http://www.fsv.cvut.cz
9//
10// Email: euref-ip@bkg.bund.de
11//
12// This program is free software; you can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation, version 2.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
25/* -------------------------------------------------------------------------
26 * BKG NTRIP Client
27 * -------------------------------------------------------------------------
28 *
29 * Class: t_reqcEdit
30 *
31 * Purpose: Edit/Concatenate RINEX Files
32 *
33 * Author: L. Mervart
34 *
35 * Created: 11-Apr-2012
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iostream>
42#include "reqcedit.h"
43#include "bnccore.h"
44#include "bncsettings.h"
45#include "bncutils.h"
46#include "rnxobsfile.h"
47#include "rnxnavfile.h"
48
49using namespace std;
50
51// Constructor
52////////////////////////////////////////////////////////////////////////////
53t_reqcEdit::t_reqcEdit(QObject* parent) : QThread(parent) {
54
55 bncSettings settings;
56
57 _logFileName = settings.value("reqcOutLogFile").toString(); expandEnvVar(_logFileName);
58 _logFile = 0;
59 _log = 0;
60 _obsFileNames = settings.value("reqcObsFile").toString().split(",", QString::SkipEmptyParts);
61 _outObsFileName = settings.value("reqcOutObsFile").toString();
62 _navFileNames = settings.value("reqcNavFile").toString().split(",", QString::SkipEmptyParts);
63 _outNavFileName = settings.value("reqcOutNavFile").toString();
64 int version = settings.value("reqcRnxVersion").toInt();
65 if (version < 3) {
66 _rnxVersion = t_rnxObsHeader::defaultRnxObsVersion2;
67 }
68 else {
69 _rnxVersion = t_rnxObsHeader::defaultRnxObsVersion3;
70 }
71 _samplingRate = settings.value("reqcSampling").toInt();
72 _begTime = bncTime(settings.value("reqcStartDateTime").toString().toAscii().data());
73 _endTime = bncTime(settings.value("reqcEndDateTime").toString().toAscii().data());
74
75}
76
77// Destructor
78////////////////////////////////////////////////////////////////////////////
79t_reqcEdit::~t_reqcEdit() {
80 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
81 delete _rnxObsFiles[ii];
82 }
83 for (int ii = 0; ii < _ephs.size(); ii++) {
84 delete _ephs[ii];
85 }
86 delete _log; _log = 0;
87 delete _logFile; _logFile = 0;
88}
89
90//
91////////////////////////////////////////////////////////////////////////////
92void t_reqcEdit::run() {
93
94 // Open Log File
95 // -------------
96 if (!_logFileName.isEmpty()) {
97 _logFile = new QFile(_logFileName);
98 if (_logFile->open(QIODevice::WriteOnly | QIODevice::Text)) {
99 _log = new QTextStream();
100 _log->setDevice(_logFile);
101 }
102 }
103
104 // Log File Header
105 // ---------------
106 if (_log) {
107 *_log << QByteArray(78, '-') << endl;
108 *_log << "Concatenation of RINEX Observation and/or Navigation Files\n";
109 *_log << QByteArray(78, '-') << endl;
110
111 *_log << QByteArray("Program").leftJustified(15) << ": "
112 << BNC_CORE->pgmName() << endl;
113 *_log << QByteArray("Run by").leftJustified(15) << ": "
114 << BNC_CORE->userName() << endl;
115 *_log << QByteArray("Date").leftJustified(15) << ": "
116 << QDateTime::currentDateTime().toUTC().toString("yyyy-MM-dd hh:mm:ss") << endl;
117 *_log << QByteArray("RINEX Version").leftJustified(15) << ": "
118 << _rnxVersion << endl;
119 *_log << QByteArray("Sampling").leftJustified(15) << ": "
120 << _samplingRate << endl;
121 *_log << QByteArray("Start time").leftJustified(15) << ": "
122 << _begTime.datestr().c_str() << ' '
123 << _begTime.timestr(0).c_str() << endl;
124 *_log << QByteArray("End time").leftJustified(15) << ": "
125 << _endTime.datestr().c_str() << ' '
126 << _endTime.timestr(0).c_str() << endl;
127 *_log << QByteArray("Input Obs Files").leftJustified(15) << ": "
128 << _obsFileNames.join(",") << endl;
129 *_log << QByteArray("Input Nav Files").leftJustified(15) << ": "
130 << _navFileNames.join(",") << endl;
131 *_log << QByteArray("Output Obs File").leftJustified(15) << ": "
132 << _outObsFileName << endl;
133 *_log << QByteArray("Output Nav File").leftJustified(15) << ": "
134 << _outNavFileName << endl;
135
136 *_log << QByteArray(78, '-') << endl;
137 _log->flush();
138 }
139
140 // Handle Observation Files
141 // ------------------------
142 editObservations();
143
144 // Handle Navigations Files
145 // ------------------------
146 editEphemerides();
147
148 // Exit (thread)
149 // -------------
150 if (BNC_CORE->mode() != t_bncCore::interactive) {
151 qApp->exit(0);
152 }
153 else {
154 emit finished();
155 deleteLater();
156 }
157}
158
159// Initialize input observation files, sort them according to start time
160////////////////////////////////////////////////////////////////////////////
161void t_reqcEdit::initRnxObsFiles(const QStringList& obsFileNames,
162 QVector<t_rnxObsFile*>& rnxObsFiles,
163 QTextStream* log) {
164
165 QStringListIterator it(obsFileNames);
166 while (it.hasNext()) {
167 QString fileName = it.next();
168 if (fileName.indexOf('*') != -1 || fileName.indexOf('?') != -1) {
169 QFileInfo fileInfo(fileName);
170 QDir dir = fileInfo.dir();
171 QStringList filters; filters << fileInfo.fileName();
172 QListIterator<QFileInfo> it(dir.entryInfoList(filters));
173 while (it.hasNext()) {
174 QString filePath = it.next().filePath();
175 t_rnxObsFile* rnxObsFile = 0;
176 try {
177 rnxObsFile = new t_rnxObsFile(filePath, t_rnxObsFile::input);
178 rnxObsFiles.append(rnxObsFile);
179 }
180 catch (...) {
181 delete rnxObsFile;
182 if (log) {
183 *log << "Error in rnxObsFile " << filePath.toAscii().data() << endl;
184 }
185 }
186 }
187 }
188 else {
189 t_rnxObsFile* rnxObsFile = 0;
190 try {
191 rnxObsFile = new t_rnxObsFile(fileName, t_rnxObsFile::input);
192 rnxObsFiles.append(rnxObsFile);
193 }
194 catch (...) {
195 if (log) {
196 *log << "Error in rnxObsFile " << fileName.toAscii().data() << endl;
197 }
198 }
199 }
200 }
201 qStableSort(rnxObsFiles.begin(), rnxObsFiles.end(),
202 t_rnxObsFile::earlierStartTime);
203}
204
205//
206////////////////////////////////////////////////////////////////////////////
207void t_reqcEdit::editObservations() {
208
209 // Easy Exit
210 // ---------
211 if (_obsFileNames.isEmpty() || _outObsFileName.isEmpty()) {
212 return;
213 }
214
215 t_reqcEdit::initRnxObsFiles(_obsFileNames, _rnxObsFiles, _log);
216
217 // Initialize output observation file
218 // ----------------------------------
219 t_rnxObsFile outObsFile(_outObsFileName, t_rnxObsFile::output);
220
221 // Select observation types
222 // ------------------------
223 bncSettings settings;
224 QStringList useObsTypes = settings.value("reqcUseObsTypes").toString().split(" ", QString::SkipEmptyParts);
225
226 // Put together all observation types
227 // ----------------------------------
228 if (_rnxObsFiles.size() > 1 && useObsTypes.size() == 0) {
229 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
230 t_rnxObsFile* obsFile = _rnxObsFiles[ii];
231 for (int iSys = 0; iSys < obsFile->numSys(); iSys++) {
232 char sys = obsFile->system(iSys);
233 if (sys != ' ') {
234 for (int iType = 0; iType < obsFile->nTypes(sys); iType++) {
235 QString type = obsFile->obsType(sys, iType);
236 if (_rnxVersion < 3.0) {
237 useObsTypes << type;
238 }
239 else {
240 useObsTypes << QString(sys) + ":" + type;
241 }
242 }
243 }
244 }
245 }
246 useObsTypes.removeDuplicates();
247 }
248
249 // Put together all phase shifts
250 // -----------------------------
251 QStringList phaseShifts;
252 if (_rnxVersion >= 3.0 && _rnxObsFiles.size() > 1) {
253 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
254 t_rnxObsFile* obsFile = _rnxObsFiles[ii];
255 phaseShifts << obsFile->phaseShifts();
256 }
257 phaseShifts.removeDuplicates();
258 }
259
260 // Put together all GLONASS biases
261 // -------------------------------
262 QStringList gloBiases;
263 if (_rnxVersion >= 3.0 && _rnxObsFiles.size() > 1) {
264 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
265 t_rnxObsFile* obsFile = _rnxObsFiles[ii];
266 if (ii == 0 && obsFile->numGloBiases() == 4) {
267 break;
268 }
269 else {
270 gloBiases << obsFile->gloBiases();
271 }
272 }
273 gloBiases.removeDuplicates();
274 }
275
276 // Put together all GLONASS slots
277 // -----------------------------
278 QStringList gloSlots;
279 if (_rnxVersion >= 3.0 && _rnxObsFiles.size() > 1) {
280 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
281 t_rnxObsFile* obsFile = _rnxObsFiles[ii];
282 if (ii == 0 &&
283 obsFile->numGloSlots() == signed(t_prn::MAXPRN_GLONASS)) {
284 break;
285 }
286 else {
287 gloSlots << obsFile->gloSlots();
288 }
289 }
290 gloSlots.removeDuplicates();
291 }
292
293 // Loop over all input observation files
294 // -------------------------------------
295 for (int ii = 0; ii < _rnxObsFiles.size(); ii++) {
296 t_rnxObsFile* obsFile = _rnxObsFiles[ii];
297 if (_log) {
298 *_log << "Processing File: " << obsFile->fileName() << " start: "
299 << obsFile->startTime().datestr().c_str() << ' '
300 << obsFile->startTime().timestr(0).c_str() << endl;
301 }
302 if (ii == 0) {
303 outObsFile.setHeader(obsFile->header(), int(_rnxVersion), &useObsTypes,
304 &phaseShifts, &gloBiases, &gloSlots);
305 if (_begTime.valid() && _begTime > outObsFile.startTime()) {
306 outObsFile.setStartTime(_begTime);
307 }
308 if (_samplingRate > outObsFile.interval()) {
309 outObsFile.setInterval(_samplingRate);
310 }
311 editRnxObsHeader(outObsFile);
312 bncSettings settings;
313 QMap<QString, QString> txtMap;
314 QString runBy = settings.value("reqcRunBy").toString();
315 if (!runBy.isEmpty()) {
316 txtMap["RUN BY"] = runBy;
317 }
318 QString comment = settings.value("reqcComment").toString();
319 if (!comment.isEmpty()) {
320 txtMap["COMMENT"] = comment;
321 }
322 if (int(_rnxVersion) < int(obsFile->header().version())) {
323 addRnxConversionDetails(obsFile, txtMap);
324 }
325 outObsFile.header().write(outObsFile.stream(), &txtMap);
326 }
327 t_rnxObsFile::t_rnxEpo* epo = 0;
328 try {
329 while ( (epo = obsFile->nextEpoch()) != 0) {
330 if (_begTime.valid() && epo->tt < _begTime) {
331 continue;
332 }
333 if (_endTime.valid() && epo->tt > _endTime) {
334 break;
335 }
336
337 if (_samplingRate == 0 ||
338 fmod(round(epo->tt.gpssec()), _samplingRate) == 0) {
339 applyLLI(obsFile, epo);
340 outObsFile.writeEpoch(epo);
341 }
342 else {
343 rememberLLI(obsFile, epo);
344 }
345 }
346 }
347 catch (QString str) {
348 if (_log) {
349 *_log << "Exception " << str << endl;
350 }
351 else {
352 qDebug() << str;
353 }
354 return;
355 }
356 catch (...) {
357 if (_log) {
358 *_log << "Exception unknown" << endl;
359 }
360 else {
361 qDebug() << "Exception unknown";
362 }
363 return;
364 }
365 }
366}
367
368// Change RINEX Header Content
369////////////////////////////////////////////////////////////////////////////
370void t_reqcEdit::editRnxObsHeader(t_rnxObsFile& obsFile) {
371
372 bncSettings settings;
373
374 QString oldMarkerName = settings.value("reqcOldMarkerName").toString();
375 QString newMarkerName = settings.value("reqcNewMarkerName").toString();
376 if (!newMarkerName.isEmpty()) {
377 if (oldMarkerName.isEmpty() ||
378 QRegExp(oldMarkerName).exactMatch(obsFile.markerName())) {
379 obsFile.setMarkerName(newMarkerName);
380 }
381 }
382
383 QString oldAntennaName = settings.value("reqcOldAntennaName").toString();
384 QString newAntennaName = settings.value("reqcNewAntennaName").toString();
385 if (!newAntennaName.isEmpty()) {
386 if (oldAntennaName.isEmpty() ||
387 QRegExp(oldAntennaName).exactMatch(obsFile.antennaName())) {
388 obsFile.setAntennaName(newAntennaName);
389 }
390 }
391
392 QString oldAntennaNumber = settings.value("reqcOldAntennaNumber").toString();
393 QString newAntennaNumber = settings.value("reqcNewAntennaNumber").toString();
394 if (!newAntennaNumber.isEmpty()) {
395 if (oldAntennaNumber.isEmpty() ||
396 QRegExp(oldAntennaNumber).exactMatch(obsFile.antennaNumber())) {
397 obsFile.setAntennaNumber(newAntennaNumber);
398 }
399 }
400
401
402 const ColumnVector& obsFileAntNEU = obsFile.antNEU();
403 QString oldAntennadN = settings.value("reqcOldAntennadN").toString();
404 QString newAntennadN = settings.value("reqcNewAntennadN").toString();
405 if(!newAntennadN.isEmpty()) {
406 if (oldAntennadN.isEmpty() ||
407 oldAntennadN.toDouble() == obsFileAntNEU(1)) {
408 obsFile.setAntennaN(newAntennadN.toDouble());
409 }
410 }
411 QString oldAntennadE = settings.value("reqcOldAntennadE").toString();
412 QString newAntennadE = settings.value("reqcNewAntennadE").toString();
413 if(!newAntennadE.isEmpty()) {
414 if (oldAntennadE.isEmpty() ||
415 oldAntennadE.toDouble() == obsFileAntNEU(2)) {
416 obsFile.setAntennaE(newAntennadE.toDouble());
417 }
418 }
419 QString oldAntennadU = settings.value("reqcOldAntennadU").toString();
420 QString newAntennadU = settings.value("reqcNewAntennadU").toString();
421 if(!newAntennadU.isEmpty()) {
422 if (oldAntennadU.isEmpty() ||
423 oldAntennadU.toDouble() == obsFileAntNEU(3)) {
424 obsFile.setAntennaU(newAntennadU.toDouble());
425 }
426 }
427
428 QString oldReceiverType = settings.value("reqcOldReceiverName").toString();
429 QString newReceiverType = settings.value("reqcNewReceiverName").toString();
430 if (!newReceiverType.isEmpty()) {
431 if (oldReceiverType.isEmpty() ||
432 QRegExp(oldReceiverType).exactMatch(obsFile.receiverType())) {
433 obsFile.setReceiverType(newReceiverType);
434 }
435 }
436
437 QString oldReceiverNumber = settings.value("reqcOldReceiverNumber").toString();
438 QString newReceiverNumber = settings.value("reqcNewReceiverNumber").toString();
439 if (!newReceiverNumber.isEmpty()) {
440 if (oldReceiverNumber.isEmpty() ||
441 QRegExp(oldReceiverNumber).exactMatch(obsFile.receiverNumber())) {
442 obsFile.setReceiverNumber(newReceiverNumber);
443 }
444 }
445}
446
447//
448////////////////////////////////////////////////////////////////////////////
449void t_reqcEdit::rememberLLI(const t_rnxObsFile* obsFile,
450 const t_rnxObsFile::t_rnxEpo* epo) {
451
452 if (_samplingRate == 0) {
453 return;
454 }
455
456 for (unsigned iSat = 0; iSat < epo->rnxSat.size(); iSat++) {
457 const t_rnxObsFile::t_rnxSat& rnxSat = epo->rnxSat[iSat];
458 char sys = rnxSat.prn.system();
459 QString prn(rnxSat.prn.toString().c_str());
460
461 for (int iType = 0; iType < obsFile->nTypes(sys); iType++) {
462 QString type = obsFile->obsType(sys, iType);
463 if (!_lli[prn].contains(iType)) {
464 _lli[prn][iType] = 0;
465 }
466 if (rnxSat.obs.contains(type) && rnxSat.obs[type].lli & 1) {
467 _lli[prn][iType] |= 1;
468 }
469 }
470 }
471}
472
473//
474////////////////////////////////////////////////////////////////////////////
475void t_reqcEdit::applyLLI(const t_rnxObsFile* obsFile,
476 t_rnxObsFile::t_rnxEpo* epo) {
477
478 if (_samplingRate == 0) {
479 return;
480 }
481
482 for (unsigned iSat = 0; iSat < epo->rnxSat.size(); iSat++) {
483 t_rnxObsFile::t_rnxSat& rnxSat = epo->rnxSat[iSat];
484 char sys = rnxSat.prn.system();
485 QString prn(rnxSat.prn.toString().c_str());
486
487 for (int iType = 0; iType < obsFile->nTypes(sys); iType++) {
488 QString type = obsFile->obsType(sys, iType);
489 if (_lli[prn].contains(iType) && _lli[prn][iType] & 1) {
490 if (rnxSat.obs.contains(type)) {
491 rnxSat.obs[type].lli |= 1;
492 }
493 }
494 }
495 }
496
497 _lli.clear();
498}
499
500/// Read All Ephemerides
501////////////////////////////////////////////////////////////////////////////
502void t_reqcEdit::readEphemerides(const QStringList& navFileNames,
503 QVector<t_eph*>& ephs) {
504
505 QStringListIterator it(navFileNames);
506 while (it.hasNext()) {
507 QString fileName = it.next();
508 if (fileName.indexOf('*') != -1 || fileName.indexOf('?') != -1) {
509 QFileInfo fileInfo(fileName);
510 QDir dir = fileInfo.dir();
511 QStringList filters; filters << fileInfo.fileName();
512 QListIterator<QFileInfo> it(dir.entryInfoList(filters));
513 while (it.hasNext()) {
514 QString filePath = it.next().filePath();
515 appendEphemerides(filePath, ephs);
516 }
517 }
518 else {
519 appendEphemerides(fileName, ephs);
520 }
521 }
522 qStableSort(ephs.begin(), ephs.end(), t_eph::earlierTime);
523}
524
525//
526////////////////////////////////////////////////////////////////////////////
527void t_reqcEdit::editEphemerides() {
528
529 // Easy Exit
530 // ---------
531 if (_navFileNames.isEmpty() || _outNavFileName.isEmpty()) {
532 return;
533 }
534
535 // Read Ephemerides
536 // ----------------
537 t_reqcEdit::readEphemerides(_navFileNames, _ephs);
538
539 // Check Satellite Systems
540 // -----------------------
541 bool haveGPS = false;
542 bool haveGlonass = false;
543 for (int ii = 0; ii < _ephs.size(); ii++) {
544 const t_eph* eph = _ephs[ii];
545 if (eph->type() == t_eph::GPS) {
546 haveGPS = true;
547 }
548 else if (eph->type() == t_eph::GLONASS) {
549 haveGlonass = true;
550 }
551 }
552
553 // Initialize output navigation file
554 // ---------------------------------
555 t_rnxNavFile outNavFile(_outNavFileName, t_rnxNavFile::output);
556
557 outNavFile.setGlonass(haveGlonass);
558
559 if ( (haveGPS && haveGlonass) || _rnxVersion >= 3.0) {
560 outNavFile.setVersion(t_rnxNavFile::defaultRnxNavVersion3);
561 }
562 else {
563 outNavFile.setVersion(t_rnxNavFile::defaultRnxNavVersion2);
564 }
565
566 bncSettings settings;
567 QMap<QString, QString> txtMap;
568 QString runBy = settings.value("reqcRunBy").toString();
569 if (!runBy.isEmpty()) {
570 txtMap["RUN BY"] = runBy;
571 }
572 QString comment = settings.value("reqcComment").toString();
573 if (!comment.isEmpty()) {
574 txtMap["COMMENT"] = comment;
575 }
576
577 outNavFile.writeHeader(&txtMap);
578
579 // Loop over all ephemerides
580 // -------------------------
581 for (int ii = 0; ii < _ephs.size(); ii++) {
582 const t_eph* eph = _ephs[ii];
583 bncTime begTime = _begTime;
584 bncTime endTime = _endTime;
585 if (eph->type() == t_eph::BDS) {
586 begTime += 14;
587 endTime += 14;
588 }
589 if (begTime.valid() && eph->TOC() < begTime) {
590 continue;
591 }
592 if (endTime.valid() && eph->TOC() > endTime) {
593 break;
594 }
595 outNavFile.writeEph(eph);
596 }
597}
598
599//
600////////////////////////////////////////////////////////////////////////////
601void t_reqcEdit::appendEphemerides(const QString& fileName,
602 QVector<t_eph*>& ephs) {
603
604 t_rnxNavFile rnxNavFile(fileName, t_rnxNavFile::input);
605 for (unsigned ii = 0; ii < rnxNavFile.ephs().size(); ii++) {
606 t_eph* eph = rnxNavFile.ephs()[ii];
607 bool isNew = true;
608 for (int iOld = 0; iOld < ephs.size(); iOld++) {
609 const t_eph* ephOld = ephs[iOld];
610 if (ephOld->prn() == eph->prn() &&
611 ephOld->TOC() == eph->TOC()) {
612 isNew = false;
613 break;
614 }
615 }
616 if (isNew) {
617 if (eph->type() == t_eph::GPS) {
618 ephs.append(new t_ephGPS(*dynamic_cast<t_ephGPS*>(eph)));
619 }
620 else if (eph->type() == t_eph::GLONASS) {
621 ephs.append(new t_ephGlo(*dynamic_cast<t_ephGlo*>(eph)));
622 }
623 else if (eph->type() == t_eph::Galileo) {
624 ephs.append(new t_ephGal(*dynamic_cast<t_ephGal*>(eph)));
625 }
626 else if (eph->type() == t_eph::QZSS) {
627 ephs.append(new t_ephGPS(*dynamic_cast<t_ephGPS*>(eph)));
628 }
629 else if (eph->type() == t_eph::SBAS) {
630 ephs.append(new t_ephSBAS(*dynamic_cast<t_ephSBAS*>(eph)));
631 }
632 else if (eph->type() == t_eph::BDS) {
633 ephs.append(new t_ephBDS(*dynamic_cast<t_ephBDS*>(eph)));
634 }
635 }
636 }
637}
638
639void t_reqcEdit::addRnxConversionDetails(const t_rnxObsFile* obsFile,
640 QMap<QString, QString>& txtMap) {
641
642 int key = 0;
643 QString systems = obsFile->header().usedSystems();
644 QString comment = QString("RINEX 3 => 2 CONVERSION DETAILS:");
645 QString commentKey = QString("COMMENT %1").arg(key, 3, 10, QChar('0'));
646 txtMap.insert(commentKey, comment);
647
648 for(int ii = 0; ii < obsFile->numSys(); ii++) {
649 key++;
650 char sys = systems[ii].toAscii();
651 QString preferredAttrib = obsFile->signalPriorities(sys);
652 comment = QString("%1: Signal priority = %2").arg(sys).arg(preferredAttrib);
653 commentKey = QString("COMMENT %1").arg(key, 3, 10, QChar('0'));
654 txtMap.insert(commentKey, comment);
655 QStringList types = obsFile->header().obsTypes(sys);
656 for (int jj = 0; jj < types.size(); jj++) {
657 key++;
658 QString inType = types[jj];
659 for (int iPref = 0; iPref < preferredAttrib.length(); iPref++) {
660 if (preferredAttrib[iPref] == '?' ||
661 (inType.length() == 2 && preferredAttrib[iPref] == '_' ) ||
662 (inType.length() == 3 && preferredAttrib[iPref] == inType[2]) ) {
663 QString outType = t_rnxObsFile::type3to2(sys, inType);
664 comment = QString("%1: %2 => %3").arg(sys).arg(inType).arg(outType);
665 commentKey = QString("COMMENT %1").arg(key, 3, 10, QChar('0'));
666 txtMap.insert(commentKey, comment);
667 break;
668 }
669 }
670 }
671 }
672}
Note: See TracBrowser for help on using the repository browser.