Changeset 3659 in ntrip for trunk/BNC/rnxnavfile.cpp


Ignore:
Timestamp:
Feb 3, 2012, 5:34:05 PM (12 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/rnxnavfile.cpp

    r3658 r3659  
    4242#include "rnxnavfile.h"
    4343#include "bncutils.h"
     44#include "RTCM3/ephemeris.h"
    4445
    4546using namespace std;
     
    4950t_rnxNavFile::t_rnxNavHeader::t_rnxNavHeader() {
    5051  _version = 0.0;
     52  _glonass = false;
    5153}
    5254
     
    7274      QTextStream in(value.toAscii(), QIODevice::ReadOnly);
    7375      in >> _version;
     76      if (value.indexOf("GLONASS") != -1) {
     77        _glonass = true;
     78      }
    7479    }
    7580  }
     
    96101}
    97102
     103// Read Next Ephemeris
     104////////////////////////////////////////////////////////////////////////////
     105t_irc t_rnxNavFile::getNextEph(t_eph* eph) {
     106
     107  while (_stream->status() == QTextStream::Ok && !_stream->atEnd()) {
     108    QString line = _stream->readLine();
     109    if (line.isEmpty()) {
     110      continue;
     111    }
     112    QStringList hlp = line.split(QRegExp("\\s+"), QString::SkipEmptyParts);
     113    QString prn;
     114    if (version() >= 3.0) {
     115      prn = hlp.at(0);
     116    }
     117    else {
     118      if (glonass()) {
     119        prn = 'R' + QString("%1").arg(hlp.at(0).toInt(), 2, QChar('0'));
     120      }
     121      else {
     122        prn = 'G' + QString("%1").arg(hlp.at(0).toInt(), 2, QChar('0'));
     123      }
     124    }
     125    QStringList lines; lines << line;
     126    if      (prn[0] == 'G') {
     127      for (int ii = 1; ii < 8; ii++) {
     128        lines << _stream->readLine();
     129      }
     130      eph = new t_ephGPS(version(), lines);
     131    }
     132    else if (prn[0] == 'R') {
     133      for (int ii = 1; ii < 4; ii++) {
     134        lines << _stream->readLine();
     135      }
     136      eph = new t_ephGlo(version(), lines);
     137    }
     138    else if (prn[0] == 'E') {
     139      for (int ii = 1; ii < 8; ii++) {
     140        lines << _stream->readLine();
     141      }
     142      eph = new t_ephGal(version(), lines);
     143    }
     144    else {
     145      return failure;
     146    }
     147    if (!eph->ok()) {
     148      delete eph;
     149      eph = 0;
     150      return failure;
     151    }
     152  }
     153
     154  return success;
     155}
Note: See TracChangeset for help on using the changeset viewer.