- Timestamp:
- Apr 25, 2008, 12:17:27 PM (17 years ago)
- Location:
- trunk/BNS
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNS/bns.cpp
r849 r850 87 87 } 88 88 else { 89 _rnx = new bnsRinex(); 89 QString prep = "BNS"; 90 QString ext = ".rnx"; 91 QString path = settings.value("rnxPath").toString(); 92 QString intr = settings.value("rnxIntr").toString(); 93 int sampl = settings.value("rnxSampl").toInt(); 94 _rnx = new bnsRinex(prep, ext, path, intr, sampl); 90 95 } 91 96 … … 96 101 } 97 102 else { 98 _sp3 = new bnsSP3(); 103 QString prep = "BNS"; 104 QString ext = ".clk"; 105 QString path = settings.value("sp3Path").toString(); 106 QString intr = settings.value("sp3Intr").toString(); 107 int sampl = settings.value("sp3Sampl").toInt(); 108 _sp3 = new bnsSP3(prep, ext, path, intr, sampl); 99 109 } 100 110 } -
trunk/BNS/bns.pro
r848 r850 23 23 24 24 HEADERS = bns.h bnswindow.h bnshlpdlg.h bnshtml.h \ 25 bnseph.h bnsutils.h bnsrinex.h bnssp3.h 25 bnseph.h bnsutils.h bnsrinex.h bnssp3.h bnsoutf.h 26 26 27 27 HEADERS += newmat/controlw.h newmat/include.h newmat/myexcept.h \ … … 30 30 31 31 SOURCES = bnsmain.cpp bns.cpp bnswindow.cpp bnshlpdlg.cpp bnshtml.cpp \ 32 bnseph.cpp bnsutils.cpp bnsrinex.cpp bnssp3.cpp 32 bnseph.cpp bnsutils.cpp bnsrinex.cpp bnssp3.cpp bnsoutf.cpp 33 33 34 34 SOURCES += newmat/bandmat.cpp newmat/cholesky.cpp newmat/evalue.cpp \ -
trunk/BNS/bnsrinex.cpp
r847 r850 24 24 // Constructor 25 25 //////////////////////////////////////////////////////////////////////////// 26 bnsRinex::bnsRinex() { 26 bnsRinex::bnsRinex(const QString& prep, const QString& ext, const QString& path, 27 const QString& intr, int sampl) 28 : bnsoutf(prep, ext, path, intr, sampl) { 27 29 } 28 30 … … 32 34 } 33 35 34 // 36 // Write Header 37 //////////////////////////////////////////////////////////////////////////// 38 void bnsRinex::writeHeader(const QDateTime& datTim) { 39 _out << "THIS IS A DUMMY HEADER" << endl; 40 } 41 42 // Write One Epoch 35 43 //////////////////////////////////////////////////////////////////////////// 36 44 void bnsRinex::write(int GPSweek, double GPSweeks, const QString& prn, 37 const ColumnVector& xx) { 45 const ColumnVector& xx) { 46 47 bnsoutf::write(GPSweek, GPSweeks, prn, xx); 48 38 49 } -
trunk/BNS/bnsrinex.h
r847 r850 6 6 #include <QtCore> 7 7 8 class bnsRinex { 8 #include "bnsoutf.h" 9 10 class bnsRinex : public bnsoutf { 9 11 public: 10 bnsRinex(); 11 ~bnsRinex(); 12 void write(int GPSweek, double GPSweeks, const QString& prn, 13 const ColumnVector& xx); 12 bnsRinex(const QString& prep, const QString& ext, const QString& path, 13 const QString& intr, int sampl); 14 virtual ~bnsRinex(); 15 virtual void write(int GPSweek, double GPSweeks, const QString& prn, 16 const ColumnVector& xx); 17 14 18 private: 19 virtual void writeHeader(const QDateTime& datTim); 15 20 }; 16 21 -
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; -
trunk/BNS/bnssp3.h
r849 r850 6 6 #include <QtCore> 7 7 8 class bnsSP3 { 8 #include "bnsoutf.h" 9 10 class bnsSP3 : public bnsoutf { 9 11 public: 10 bnsSP3(); 11 ~bnsSP3(); 12 void write(int GPSweek, double GPSweeks, const QString& prn, 13 const ColumnVector& xx); 14 15 static QString nextEpochStr(const QDateTime& datTim, 16 const QString& intStr, 17 QDateTime* nextEpoch = 0); 12 bnsSP3(const QString& prep, const QString& ext, const QString& path, 13 const QString& intr, int sampl); 14 virtual ~bnsSP3(); 15 virtual void write(int GPSweek, double GPSweeks, const QString& prn, 16 const ColumnVector& xx); 18 17 19 18 private: 20 void resolveFileName(const QDateTime& datTim); 21 void writeHeader(const QDateTime& datTim); 22 void closeFile(); 23 24 int _samplingRate; 25 bool _headerWritten; 26 QDateTime _nextCloseEpoch; 27 std::ofstream _out; 28 QString _path; 29 QString _intr; 30 QString _ext; 31 QString _ID4; 32 QByteArray _fName; 19 virtual void writeHeader(const QDateTime& datTim); 33 20 }; 34 21
Note:
See TracChangeset
for help on using the changeset viewer.