source: ntrip/trunk/BNC/src/pppCrdFile.cpp@ 11019

Last change on this file since 11019 was 11019, checked in by stuerze, 3 hours ago

added epoch/velocity fields to PPP coordinates file to allow BNC to propagate the reference coordinates related to a dedicated reference epoch to the current epoch

File size: 3.6 KB
Line 
1
2// Part of BNC, a utility for retrieving decoding and
3// converting GNSS data streams from NTRIP broadcasters.
4//
5// Copyright (C) 2007
6// German Federal Agency for Cartography and Geodesy (BKG)
7// http://www.bkg.bund.de
8// Czech Technical University Prague, Department of Geodesy
9// http://www.fsv.cvut.cz
10//
11// Email: euref-ip@bkg.bund.de
12//
13// This program is free software; you can redistribute it and/or
14// modify it under the terms of the GNU General Public License
15// as published by the Free Software Foundation, version 2.
16//
17// This program is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program; if not, write to the Free Software
24// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26/* -------------------------------------------------------------------------
27 * BKG NTRIP Client
28 * -------------------------------------------------------------------------
29 *
30 * Class: t_pppCrdFile
31 *
32 * Purpose: Read a priori coordinate file
33 *
34 * Author: L. Mervart
35 *
36 * Created: 29-Jul-2014
37 *
38 * Changes:
39 *
40 * -----------------------------------------------------------------------*/
41
42#include <cstdlib>
43#include <fstream>
44#include <sstream>
45#include "pppCrdFile.h"
46#include "bncutils.h"
47
48using namespace std;
49using namespace BNC_PPP;
50
51//
52//////////////////////////////////////////////////////////////////////////////
53void t_pppCrdFile::readCrdFile(const string& fileName, vector<t_staInfo>& staInfoVec) {
54
55 staInfoVec.clear();
56
57 ifstream inFile(fileName.c_str());
58 while (inFile.good()) {
59 string line; getline(inFile,line);
60 stripWhiteSpace(line);
61 if ( line.empty() || line[0] == '#'|| line[0] == '!') {
62 continue;
63 }
64
65 istringstream in;
66
67 t_staInfo staInfo;
68
69 size_t q1 = line.find('"');
70 if (q1 != string::npos) {
71 size_t q2 = line.find('"', q1+1);
72 if (q2 == string::npos) {
73 continue;
74 }
75 staInfo._name = line.substr(q1+1, q2-q1-1);
76 in.str(line.substr(q2+1));
77 }
78 else {
79 in.str(line);
80 in >> staInfo._name;
81 }
82
83 in >> staInfo._xyz(1) >> staInfo._xyz(2) >> staInfo._xyz(3);
84
85 // Optional 'EPOCH:<decimalYear>' and 'VEL:<vx>,<vy>,<vz>' keyword tokens
86 // (ITRF reference epoch and velocity in m/year of the coordinate above),
87 // may appear in any order before the antenna eccentricity / name fields.
88 while (!in.eof()) {
89 streampos posBeforeToken = in.tellg();
90 string token;
91 if (!(in >> token)) {
92 break;
93 }
94 if (token.compare(0, 6, "EPOCH:") == 0) {
95 staInfo._epoch = atof(token.substr(6).c_str());
96 }
97 else if (token.compare(0, 4, "VEL:") == 0) {
98 string velStr = token.substr(4);
99 for (string::iterator it = velStr.begin(); it != velStr.end(); ++it) {
100 if (*it == ',') *it = ' ';
101 }
102 istringstream velIn(velStr);
103 velIn >> staInfo._velocity(1) >> staInfo._velocity(2) >> staInfo._velocity(3);
104 }
105 else {
106 in.seekg(posBeforeToken);
107 break;
108 }
109 }
110
111 if (!in.eof()) {
112 in >> staInfo._neuAnt(1) >> staInfo._neuAnt(2) >> staInfo._neuAnt(3);
113 }
114
115 if (!in.eof()) {
116 std::string hlp;
117 getline(in, hlp);
118 stripWhiteSpace(hlp);
119 staInfo._antenna.assign( hlp.substr(0,20));
120 hlp = hlp.erase(0, 20);
121 if (hlp.length()) {
122 stripWhiteSpace(hlp);
123 staInfo._receiver = hlp;
124 }
125 }
126
127 staInfoVec.push_back(staInfo);
128 }
129}
Note: See TracBrowser for help on using the repository browser.