Changeset 6331 in ntrip for trunk/BNC/src


Ignore:
Timestamp:
Nov 24, 2014, 4:38:47 PM (10 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncoutf.cpp

    r5985 r6331  
    3535  _numSec        = 0;
    3636
    37   QFileInfo fileInfo(sklFileName);
    38   _path        = fileInfo.absolutePath() + QDir::separator();
    39   _sklBaseName = fileInfo.baseName();
    40   _extension   = fileInfo.completeSuffix();
    41 
    42   expandEnvVar(_path);
    43   if (!_extension.isEmpty()) {
    44     _extension = "." + _extension;
     37  if (! sklFileName.isEmpty()) {
     38    QFileInfo fileInfo(sklFileName);
     39    _path        = fileInfo.absolutePath() + QDir::separator();
     40    _sklBaseName = fileInfo.baseName();
     41    _extension   = fileInfo.completeSuffix();
     42   
     43    expandEnvVar(_path);
     44    if (!_extension.isEmpty()) {
     45      _extension = "." + _extension;
     46    }
    4547  }
    4648
  • trunk/BNC/src/bncsp3.cpp

    r4991 r6331  
    1717
    1818#include <iomanip>
     19#include <sstream>
    1920#include <math.h>
    2021
     
    2627// Constructor
    2728////////////////////////////////////////////////////////////////////////////
     29bncSP3::bncSP3(const QString& fileName) : bncoutf(QString(), QString(), 0) {
     30  _inpOut    = input;
     31  _currEpoch = 0;
     32  _prevEpoch = 0;
     33
     34  _stream.open(fileName.toAscii().data());
     35  if (!_stream.good()) {
     36    throw "t_sp3File: cannot open file " + fileName;
     37  } 
     38
     39  while (_stream.good()) {
     40    getline(_stream, _lastLine);
     41    if (_lastLine[0] == '*') {
     42      break;
     43    }
     44  }
     45}
     46
     47// Constructor
     48////////////////////////////////////////////////////////////////////////////
    2849bncSP3::bncSP3(const QString& sklFileName, const QString& intr, int sampl)
    2950  : bncoutf(sklFileName, intr, sampl) {
     51  _inpOut    = output;
     52  _currEpoch = 0;
     53  _prevEpoch = 0;
    3054}
    3155
     
    3357////////////////////////////////////////////////////////////////////////////
    3458bncSP3::~bncSP3() {
     59  delete _currEpoch;
     60  delete _prevEpoch;
    3561}
    3662
     
    133159}
    134160
     161// Read Next Epoch
     162////////////////////////////////////////////////////////////////////////////
     163const bncSP3::t_sp3Epoch* bncSP3::nextEpoch() {
     164
     165  delete _prevEpoch; _prevEpoch = _currEpoch; _currEpoch = 0;
     166
     167  while (true) {
     168
     169    if (!_currEpoch) {
     170      _currEpoch = new t_sp3Epoch();
     171      istringstream in(_lastLine.substr(1).c_str());
     172      int    YY, MM, DD, hh, mm;
     173      double ss;
     174      in >> YY >> MM >> DD >> hh >> mm >> ss;
     175      _currEpoch->_tt.set(YY, MM, DD, hh, mm, ss);
     176    }
     177
     178    getline(_stream, _lastLine);
     179    if (_stream.eof() || _lastLine.find("EOF") == 0) {
     180      throw "t_sp3File: end of file";
     181      break;
     182    }
     183    if (_lastLine[0] == '*') {
     184      break;
     185    }
     186
     187    t_sp3Sat* sp3Sat = new t_sp3Sat();
     188    istringstream in(_lastLine.substr(1).c_str());
     189    in >> sp3Sat->_prn >> sp3Sat->_xyz(1) >> sp3Sat->_xyz(2) >> sp3Sat->_xyz(3) >> sp3Sat->_clk;
     190
     191    sp3Sat->_xyz *= 1.e3;
     192    sp3Sat->_clk *= t_CST::c * 1.e-6;
     193
     194    _currEpoch->_sp3Sat.push_back(sp3Sat);
     195  }
     196
     197  return _currEpoch;
     198}
  • trunk/BNC/src/bncsp3.h

    r4991 r6331  
    88#include "bncoutf.h"
    99#include "bnctime.h"
     10#include "t_prn.h"
    1011
    1112class bncSP3 : public bncoutf {
    1213 public:
    13   bncSP3(const QString& sklFileName, const QString& intr, int sampl);
     14
     15  class t_sp3Sat {
     16   public:
     17    t_sp3Sat() {
     18      _xyz.ReSize(3);
     19      _xyz = 0.0;
     20      _clk = 0.0;
     21    }
     22    ~t_sp3Sat() {}
     23    t_prn        _prn;
     24    ColumnVector _xyz;
     25    double       _clk;
     26  };
     27
     28  class t_sp3Epoch {
     29   public:
     30    t_sp3Epoch() {}
     31    ~t_sp3Epoch() {
     32      for (int ii = 0; ii < _sp3Sat.size(); ii++) {
     33        delete _sp3Sat[ii];
     34      }
     35    }
     36    bncTime            _tt;
     37    QVector<t_sp3Sat*> _sp3Sat;
     38  };
     39
     40  bncSP3(const QString& fileName); // input
     41  bncSP3(const QString& sklFileName, const QString& intr, int sampl); // output
    1442  virtual ~bncSP3();
    1543  t_irc write(int GPSweek, double GPSweeks, const QString& prn,
     
    1745
    1846 private:
     47  enum e_inpOut {input, output};
     48
    1949  virtual void writeHeader(const QDateTime& datTim);
    2050  virtual void closeFile();
    21   bncTime _lastEpoTime;
     51  const t_sp3Epoch* nextEpoch();
     52  const t_sp3Epoch* currEpoch() const {return _currEpoch;}
     53  const t_sp3Epoch* prevEpoch() const {return _prevEpoch;}
     54
     55  e_inpOut      _inpOut;
     56  bncTime       _lastEpoTime;
     57  std::ifstream _stream;
     58  std::string   _lastLine;
     59  t_sp3Epoch*   _currEpoch;
     60  t_sp3Epoch*   _prevEpoch;
    2261};
    2362
Note: See TracChangeset for help on using the changeset viewer.