Changeset 3184 in ntrip
- Timestamp:
- Mar 29, 2011, 8:19:50 PM (14 years ago)
- Location:
- trunk/BNC
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncclockrinex.cpp
r3181 r3184 26 26 // Constructor 27 27 //////////////////////////////////////////////////////////////////////////// 28 bncClockRinex::bncClockRinex(const QString& prep, const QString& ext, const QString& path,29 const QString& intr,int sampl)30 : bncoutf( prep, ext, path, intr, sampl) {28 bncClockRinex::bncClockRinex(const QString& sklFileName, const QString& intr, 29 int sampl) 30 : bncoutf(sklFileName, intr, sampl) { 31 31 bncSettings settings; 32 _append = Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked;33 32 } 34 33 … … 43 42 const ColumnVector& xx) { 44 43 45 if ( bncoutf::write(GPSweek, GPSweeks, prn, xx, _append) == success) {44 if (reopen(GPSweek, GPSweeks) == success) { 46 45 47 46 QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks); -
trunk/BNC/bncclockrinex.h
r3181 r3184 10 10 class bncClockRinex : public bncoutf { 11 11 public: 12 bncClockRinex(const QString& prep, const QString& ext, const QString& path, 13 const QString& intr, int sampl); 12 bncClockRinex(const QString& sklFileName, const QString& intr, int sampl); 14 13 virtual ~bncClockRinex(); 15 14 virtual t_irc write(int GPSweek, double GPSweeks, const QString& prn, -
trunk/BNC/bncoutf.cpp
r3174 r3184 20 20 21 21 #include "bncoutf.h" 22 #include "bncsettings.h" 22 23 23 24 using namespace std; … … 25 26 // Constructor 26 27 //////////////////////////////////////////////////////////////////////////// 27 bncoutf::bncoutf(const QString& prep, const QString& ext, const QString& path, 28 const QString& intr, int sampl) { 28 bncoutf::bncoutf(const QString& sklFileName, const QString& intr, int sampl) { 29 30 bncSettings settings; 29 31 30 32 _headerWritten = false; 31 _prep = prep;32 _ext = ext;33 33 _sampl = sampl; 34 34 _intr = intr; 35 _path = path; 35 36 QFileInfo fileInfo(sklFileName); 37 _path = fileInfo.absolutePath() + QDir::separator(); 38 _sklBaseName = fileInfo.baseName(); 39 _extension = fileInfo.completeSuffix(); 40 36 41 expandEnvVar(_path); 37 if ( _path.length() > 0 && _path[_path.length()-1] != QDir::separator()) {38 _ path += QDir::separator();42 if (!_extension.isEmpty()) { 43 _extension = "." + _extension; 39 44 } 45 46 _append = Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked; 40 47 } 41 48 … … 52 59 } 53 60 54 // Next File Epoch (static)61 // Epoch String 55 62 //////////////////////////////////////////////////////////////////////////// 56 QString bncoutf::nextEpochStr(const QDateTime& datTim, 57 const QString& intStr, QDateTime* nextEpoch) { 63 QString bncoutf::epochStr(const QDateTime& datTim, const QString& intStr) { 58 64 59 65 QString epoStr; 60 61 QTime nextTime;62 QDate nextDate;63 66 64 67 int indHlp = intStr.indexOf("min"); … … 70 73 if (datTim.time().minute() >= 60-step) { 71 74 epoStr += QString("%1").arg(60-step, 2, 10, QChar('0')); 72 if (datTim.time().hour() < 23) {73 nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);74 nextDate = datTim.date();75 }76 else {77 nextTime.setHMS(0, 0, 0);78 nextDate = datTim.date().addDays(1);79 }80 75 } 81 76 else { … … 83 78 if (datTim.time().minute() < limit) { 84 79 epoStr += QString("%1").arg(limit-step, 2, 10, QChar('0')); 85 nextTime.setHMS(datTim.time().hour(), limit, 0);86 nextDate = datTim.date();87 80 break; 88 81 } … … 93 86 char ch = 'A' + datTim.time().hour(); 94 87 epoStr = QString("_") + ch; 95 if (datTim.time().hour() < 23) {96 nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);97 nextDate = datTim.date();98 }99 else {100 nextTime.setHMS(0, 0, 0);101 nextDate = datTim.date().addDays(1);102 }103 88 } 104 89 else { 105 90 epoStr = ""; 106 nextTime.setHMS(0, 0, 0);107 nextDate = datTim.date().addDays(1);108 }109 110 if (nextEpoch) {111 *nextEpoch = QDateTime(nextDate, nextTime, Qt::UTC);112 91 } 113 92 … … 117 96 // File Name according to RINEX Standards 118 97 //////////////////////////////////////////////////////////////////////////// 119 void bncoutf::resolveFileName(int GPSweek, const QDateTime& datTim) { 120 121 QString epoStr = nextEpochStr(datTim, _intr, &_nextCloseEpoch); 98 QString bncoutf::resolveFileName(int GPSweek, const QDateTime& datTim) { 122 99 123 100 int dayOfWeek = datTim.date().dayOfWeek(); … … 125 102 dayOfWeek = 0; 126 103 } 104 QString gpswd = QString().arg(GPSweek).arg(dayOfWeek); 105 QString baseName = _sklBaseName.replace("${GPSWD}", gpswd); 106 QString epoStr = epochStr(datTim, _intr); 127 107 128 _fName = (_path + _prep 129 + QString("%1").arg(GPSweek) 130 + QString("%1").arg(dayOfWeek) 131 + epoStr 132 + _ext).toAscii(); 108 return _path + baseName + epoStr + _extension; 133 109 } 134 110 135 // Write One Epoch111 // Re-Open Output File 136 112 //////////////////////////////////////////////////////////////////////////// 137 t_irc bncoutf::write(int GPSweek, double GPSweeks, const QString&, 138 const ColumnVector&, bool append) { 113 t_irc bncoutf::reopen(int GPSweek, double GPSweeks) { 139 114 140 115 if (_sampl != 0 && fmod(GPSweeks, _sampl) != 0.0) { … … 144 119 QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks); 145 120 121 QString newFileName = resolveFileName(GPSweek, datTim); 122 146 123 // Close the file 147 124 // -------------- 148 if ( _nextCloseEpoch.isValid() && datTim >= _nextCloseEpoch) {125 if (newFileName != _fName) { 149 126 closeFile(); 150 127 _headerWritten = false; 128 _fName = newFileName; 151 129 } 152 130 153 // Write Header154 // ------------ 131 // Re-Open File, Write Header 132 // -------------------------- 155 133 if (!_headerWritten) { 156 resolveFileName(GPSweek, datTim);157 134 _out.setf(ios::showpoint | ios::fixed); 158 if ( append && QFile::exists(_fName)) {159 _out.open(_fName. data(), ios::out | ios::app);135 if (_append && QFile::exists(_fName)) { 136 _out.open(_fName.toAscii().data(), ios::out | ios::app); 160 137 } 161 138 else { 162 _out.open(_fName. data());139 _out.open(_fName.toAscii().data()); 163 140 writeHeader(datTim); 164 141 } … … 168 145 return success; 169 146 } 147 148 // Write String 149 //////////////////////////////////////////////////////////////////////////// 150 t_irc bncoutf::write(int GPSweek, double GPSweeks, const QString& str) { 151 reopen(GPSweek, GPSweeks); 152 _out << str.toAscii().data(); 153 _out.flush(); 154 return success; 155 } -
trunk/BNC/bncoutf.h
r3183 r3184 10 10 class bncoutf { 11 11 public: 12 bncoutf(const QString& prep, const QString& ext, const QString& path, 13 const QString& intr, int sampl); 12 bncoutf(const QString& sklFileName, const QString& intr, int sampl); 14 13 virtual ~bncoutf(); 15 16 virtual t_irc write(int GPSweek, double GPSweeks, const QString& prn, 17 const ColumnVector& xx, bool append); 14 t_irc write(int GPSweek, double GPSweeks, const QString& str); 18 15 19 16 protected: 20 virtual void writeHeader(const QDateTime& /* datTim */) {} 21 virtual void closeFile(); 17 virtual t_irc reopen(int GPSweek, double GPSweeks); 18 virtual void writeHeader(const QDateTime& /* datTim */) {} 19 virtual void closeFile(); 22 20 std::ofstream _out; 23 21 int _sampl; 24 22 25 23 private: 26 QString nextEpochStr(const QDateTime& datTim, 27 const QString& intStr, 28 QDateTime* nextEpoch = 0); 29 void resolveFileName(int GPSweek, const QDateTime& datTim); 24 QString epochStr(const QDateTime& datTim, const QString& intStr); 25 QString resolveFileName(int GPSweek, const QDateTime& datTim); 30 26 31 bool 32 Q DateTime _nextCloseEpoch;33 QString _path;34 QString _intr;35 QString _ext;36 QString _prep;37 QByteArray _fName;27 bool _headerWritten; 28 QString _path; 29 QString _sklBaseName; 30 QString _extension; 31 QString _intr; 32 QString _fName; 33 bool _append; 38 34 }; 39 35 -
trunk/BNC/bncsp3.cpp
r3181 r3184 26 26 // Constructor 27 27 //////////////////////////////////////////////////////////////////////////// 28 bncSP3::bncSP3(const QString& prep, const QString& ext, const QString& path, 29 const QString& intr, int sampl) 30 : bncoutf(prep, ext, path, intr, sampl) { 28 bncSP3::bncSP3(const QString& sklFileName, const QString& intr, int sampl) 29 : bncoutf(sklFileName, intr, sampl) { 31 30 32 31 _lastGPSweek = 0; … … 42 41 //////////////////////////////////////////////////////////////////////////// 43 42 t_irc bncSP3::write(int GPSweek, double GPSweeks, const QString& prn, 44 const ColumnVector& xx , bool append) {43 const ColumnVector& xx) { 45 44 46 if ( bncoutf::write(GPSweek, GPSweeks, prn, xx, append) == success) {45 if (reopen(GPSweek, GPSweeks) == success) { 47 46 48 47 if (_lastGPSweek != GPSweek || _lastGPSweeks != GPSweeks) { -
trunk/BNC/bncsp3.h
r3181 r3184 10 10 class bncSP3 : public bncoutf { 11 11 public: 12 bncSP3(const QString& prep, const QString& ext, const QString& path, 13 const QString& intr, int sampl); 12 bncSP3(const QString& sklFileName, const QString& intr, int sampl); 14 13 virtual ~bncSP3(); 15 virtualt_irc write(int GPSweek, double GPSweeks, const QString& prn,16 const ColumnVector& xx, bool append);14 t_irc write(int GPSweek, double GPSweeks, const QString& prn, 15 const ColumnVector& xx); 17 16 18 17 private: -
trunk/BNC/combination/bnccomb.cpp
r3181 r3184 180 180 } 181 181 else { 182 QString prep = "BNC"; 183 QString ext = ".sp3"; 184 QString path = settings.value("cmbSP3Path").toString(); 182 QString sklFileName = settings.value("cmbSP3Path").toString() 183 + QDir::separator() + "BNC.sp3"; 185 184 QString interval = ""; 186 185 int sampl = 0; 187 _sp3 = new bncSP3(prep, ext, path, interval, sampl); 188 } 189 190 _append = Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked; 186 _sp3 = new bncSP3(sklFileName, interval, sampl); 187 } 191 188 192 189 // ANTEX File … … 449 446 } 450 447 } 451 _sp3->write(resTime.gpsw(), resTime.gpssec(), corr->prn, xc , _append);448 _sp3->write(resTime.gpsw(), resTime.gpssec(), corr->prn, xc); 452 449 } 453 450 -
trunk/BNC/combination/bnccomb.h
r3181 r3184 90 90 std::ofstream* _out; 91 91 bncSP3* _sp3; 92 bool _append;93 92 bncAntex* _antex; 94 93 }; -
trunk/BNC/upload/bncuploadcaster.cpp
r3182 r3184 49 49 _outSocket = 0; 50 50 _sOpenTrial = 0; 51 52 _append = Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked;53 51 54 52 if (outFileName.isEmpty()) {
Note:
See TracChangeset
for help on using the changeset viewer.