Changeset 850 in ntrip for trunk/BNS/bnssp3.cpp
- Timestamp:
- Apr 25, 2008, 12:17:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNS/bnssp3.cpp
r849 r850 25 25 // Constructor 26 26 //////////////////////////////////////////////////////////////////////////// 27 bnsSP3::bnsSP3() { 28 QSettings settings; 29 30 _headerWritten = false; 31 _ID4 = "BNS_"; 32 _ext = ".SP3"; 33 _samplingRate = settings.value("sp3Sampl").toInt(); 34 _intr = settings.value("rnxIntr").toString(); 35 _path = settings.value("rnxPath").toString(); 36 expandEnvVar(_path); 37 if ( _path.length() > 0 && _path[_path.length()-1] != QDir::separator() ) { 38 _path += QDir::separator(); 39 } 27 bnsSP3::bnsSP3(const QString& prep, const QString& ext, const QString& path, 28 const QString& intr, int sampl) 29 : bnsoutf(prep, ext, path, intr, sampl) { 40 30 } 41 31 … … 43 33 //////////////////////////////////////////////////////////////////////////// 44 34 bnsSP3::~bnsSP3() { 45 _out.close();46 }47 48 // Close the Old RINEX File49 ////////////////////////////////////////////////////////////////////////////50 void bnsSP3::closeFile() {51 _out.close();52 }53 54 // Next File Epoch (static)55 ////////////////////////////////////////////////////////////////////////////56 QString bnsSP3::nextEpochStr(const QDateTime& datTim,57 const QString& intStr, QDateTime* nextEpoch) {58 59 QString epoStr;60 61 QTime nextTime;62 QDate nextDate;63 64 int indHlp = intStr.indexOf("min");65 66 if ( indHlp != -1) {67 int step = intStr.left(indHlp-1).toInt();68 char ch = 'A' + datTim.time().hour();69 epoStr = ch;70 if (datTim.time().minute() >= 60-step) {71 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 }81 else {82 for (int limit = step; limit <= 60-step; limit += step) {83 if (datTim.time().minute() < limit) {84 epoStr += QString("%1").arg(limit-step, 2, 10, QChar('0'));85 nextTime.setHMS(datTim.time().hour(), limit, 0);86 nextDate = datTim.date();87 break;88 }89 }90 }91 }92 else if (intStr == "1 hour") {93 char ch = 'A' + datTim.time().hour();94 epoStr = 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 }104 else {105 epoStr = "0";106 nextTime.setHMS(0, 0, 0);107 nextDate = datTim.date().addDays(1);108 }109 110 if (nextEpoch) {111 *nextEpoch = QDateTime(nextDate, nextTime);112 }113 114 return epoStr;115 }116 117 // File Name according to RINEX Standards118 ////////////////////////////////////////////////////////////////////////////119 void bnsSP3::resolveFileName(const QDateTime& datTim) {120 121 QString hlpStr = nextEpochStr(datTim, _intr, &_nextCloseEpoch);122 123 _fName = (_ID4124 + QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0'))125 + hlpStr126 + _ext).toAscii();127 35 } 128 36 … … 130 38 //////////////////////////////////////////////////////////////////////////// 131 39 void bnsSP3::writeHeader(const QDateTime& datTim) { 132 133 // Open the Output File134 // --------------------135 resolveFileName(datTim);136 137 _out.open(_fName.data());138 _out.setf(ios::showpoint | ios::fixed);139 140 40 _out << "THIS IS A DUMMY HEADER" << endl; 141 142 _headerWritten = true;143 41 } 144 42 … … 148 46 const ColumnVector& xx) { 149 47 150 QDateTime datTim = dateAndTimeFromGPSweek(GPSweek, GPSweeks); 151 152 // Close the file 153 // -------------- 154 if (_nextCloseEpoch.isValid() && datTim >= _nextCloseEpoch) { 155 closeFile(); 156 _headerWritten = false; 157 } 158 159 // Write Header 160 // ------------ 161 if (!_headerWritten) { 162 writeHeader(datTim); 163 } 48 bnsoutf::write(GPSweek, GPSweeks, prn, xx); 164 49 165 50 int year, month, day, hour, min;
Note:
See TracChangeset
for help on using the changeset viewer.