[3645] | 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_rnxObsFile
|
---|
| 30 | *
|
---|
| 31 | * Purpose: Reads RINEX Observation File
|
---|
| 32 | *
|
---|
| 33 | * Author: L. Mervart
|
---|
| 34 | *
|
---|
| 35 | * Created: 24-Jan-2012
|
---|
| 36 | *
|
---|
| 37 | * Changes:
|
---|
| 38 | *
|
---|
| 39 | * -----------------------------------------------------------------------*/
|
---|
| 40 |
|
---|
| 41 | #include <iostream>
|
---|
| 42 | #include "rnxobsfile.h"
|
---|
[3646] | 43 | #include "bncutils.h"
|
---|
[3645] | 44 |
|
---|
| 45 | using namespace std;
|
---|
| 46 |
|
---|
| 47 | // Constructor
|
---|
| 48 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3646] | 49 | t_rnxObsFile::t_rnxObsHeader::t_rnxObsHeader() {
|
---|
[3656] | 50 | _antNEU[0] = _antNEU[1] = _antNEU[2] = 0.0;
|
---|
| 51 | _xyz[0] = _xyz[1] = _xyz[2] = 0.0;
|
---|
| 52 | _version = 0.0;
|
---|
[3645] | 53 | }
|
---|
| 54 |
|
---|
| 55 | // Destructor
|
---|
| 56 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3646] | 57 | t_rnxObsFile::t_rnxObsHeader::~t_rnxObsHeader() {
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | // Read Header
|
---|
| 61 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 62 | t_irc t_rnxObsFile::t_rnxObsHeader::read(QTextStream* stream) {
|
---|
[3649] | 63 | while (stream->status() == QTextStream::Ok && !stream->atEnd()) {
|
---|
[3646] | 64 | QString line = stream->readLine();
|
---|
[3656] | 65 | if (line.isEmpty()) {
|
---|
| 66 | continue;
|
---|
| 67 | }
|
---|
[3651] | 68 | QString value = line.left(60).trimmed();
|
---|
| 69 | QString key = line.mid(60).trimmed();
|
---|
| 70 | if (key == "END OF HEADER") {
|
---|
[3650] | 71 | break;
|
---|
| 72 | }
|
---|
[3652] | 73 | else if (key == "RINEX VERSION / TYPE") {
|
---|
| 74 | QTextStream in(value.toAscii(), QIODevice::ReadOnly);
|
---|
[3651] | 75 | in >> _version;
|
---|
| 76 | }
|
---|
[3652] | 77 | else if (key == "MARKER NAME") {
|
---|
| 78 | _markerName = value;
|
---|
| 79 | }
|
---|
| 80 | else if (key == "ANT # / TYPE") {
|
---|
| 81 | _antennaName = value.mid(20);
|
---|
| 82 | }
|
---|
[3656] | 83 | else if (key == "APPROX POSITION XYZ") {
|
---|
| 84 | QTextStream in(value.toAscii(), QIODevice::ReadOnly);
|
---|
| 85 | in >> _xyz[0] >> _xyz[1] >> _xyz[2];
|
---|
| 86 | }
|
---|
| 87 | else if (key == "ANTENNA: DELTA H/E/N") {
|
---|
| 88 | QTextStream in(value.toAscii(), QIODevice::ReadOnly);
|
---|
| 89 | in >> _antNEU[2] >> _antNEU[1] >> _antNEU[0];
|
---|
| 90 | }
|
---|
[3646] | 91 | }
|
---|
| 92 |
|
---|
[3651] | 93 | cout << "RINEX Version = " << _version << endl;
|
---|
[3652] | 94 | cout << "Antenna Name >" << _antennaName.toAscii().data() << "<\n";
|
---|
| 95 | cout << "Marker Name >" << _markerName.toAscii().data() << "<\n";
|
---|
[3651] | 96 |
|
---|
[3646] | 97 | return success;
|
---|
| 98 | }
|
---|
| 99 |
|
---|
| 100 | // Constructor
|
---|
| 101 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 102 | t_rnxObsFile::t_rnxObsFile(QString fileName) {
|
---|
| 103 | expandEnvVar(fileName);
|
---|
| 104 | _file = new QFile(fileName);
|
---|
| 105 | _file->open(QIODevice::ReadOnly | QIODevice::Text);
|
---|
| 106 | _stream = new QTextStream();
|
---|
| 107 | _stream->setDevice(_file);
|
---|
| 108 | _header.read(_stream);
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | // Destructor
|
---|
| 112 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3645] | 113 | t_rnxObsFile::~t_rnxObsFile() {
|
---|
[3646] | 114 | delete _stream;
|
---|
| 115 | delete _file;
|
---|
[3645] | 116 | }
|
---|
| 117 |
|
---|
| 118 | // Retrieve single Epoch
|
---|
| 119 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 120 | t_irc t_rnxObsFile::getEpoch() {
|
---|
[3656] | 121 | while (_stream->status() == QTextStream::Ok && !_stream->atEnd()) {
|
---|
| 122 | QString line = _stream->readLine();
|
---|
| 123 | if (line.isEmpty()) {
|
---|
| 124 | continue;
|
---|
| 125 | }
|
---|
| 126 | }
|
---|
[3645] | 127 | return success;
|
---|
| 128 | }
|
---|