Changeset 7506 in ntrip for trunk/BNC/src/bncoutf.cpp


Ignore:
Timestamp:
Oct 13, 2015, 3:19:43 PM (9 years ago)
Author:
stuerze
Message:

automatic file name generation for ppp output files is added

File:
1 edited

Legend:

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

    r6607 r7506  
    1212 * Created:    25-Apr-2008
    1313 *
    14  * Changes:   
     14 * Changes:
    1515 *
    1616 * -----------------------------------------------------------------------*/
     
    3939    _path        = fileInfo.absolutePath() + QDir::separator();
    4040    _sklBaseName = fileInfo.baseName();
    41     _extension   = fileInfo.completeSuffix(); 
    42    
     41    _extension   = fileInfo.completeSuffix();
     42
    4343    expandEnvVar(_path);
    4444    if (!_extension.isEmpty()) {
     
    4848
    4949  _append = Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked;
     50  _v3filenames = settings.value("PPP/v3filenames").toBool();
    5051}
    5152
     
    6465// Epoch String
    6566////////////////////////////////////////////////////////////////////////////
    66 QString bncoutf::epochStr(const QDateTime& datTim, const QString& intStr) {
    67 
    68   QString epoStr;
     67QString bncoutf::epochStr(const QDateTime& datTim, const QString& intStr,
     68    int sampl) {
     69
     70  QString epoStr = "";
    6971
    7072  int indHlp = intStr.indexOf("min");
     73  if (!sampl) {
     74    sampl++;
     75  }
    7176
    7277  if ( indHlp != -1) {
    7378    int step = intStr.left(indHlp-1).toInt();
    74     char ch = 'A' + datTim.time().hour();
    75     epoStr = QString("_") + ch;
     79    if (_v3filenames) {
     80      epoStr +=  QString("%1").arg(datTim.time().hour(), 2, 10, QChar('0')); // H
     81    } else {
     82      epoStr +=  'A' + datTim.time().hour();
     83    }
     84
    7685    if (datTim.time().minute() >= 60-step) {
    77       epoStr += QString("%1").arg(60-step, 2, 10, QChar('0'));
     86      epoStr += QString("%1").arg(60-step, 2, 10, QChar('0'));               // M
    7887    }
    7988    else {
    8089      for (int limit = step; limit <= 60-step; limit += step) {
    8190        if (datTim.time().minute() < limit) {
    82           epoStr += QString("%1").arg(limit-step, 2, 10, QChar('0'));
     91          epoStr += QString("%1").arg(limit-step, 2, 10, QChar('0'));        // M
    8392          break;
    8493        }
    8594      }
    8695    }
     96
     97    if (_v3filenames) {
     98      epoStr += QString("_%1M").arg(step, 2, 10, QChar('0'));                // period
     99    }
     100
    87101    _numSec = 60 * step;
    88102  }
    89103  else if (intStr == "1 hour") {
    90     char ch = 'A' + datTim.time().hour();
    91     epoStr = QString("_") + ch;
     104    int step = intStr.left(indHlp-1).toInt();
     105    if (_v3filenames) {
     106      epoStr += QString("%1").arg(datTim.time().hour(), 2, 10, QChar('0'));  // H
     107      epoStr += QString("%1").arg(0, 2, 10, QChar('0'));                     // M
     108      epoStr += QString("_%1H").arg(step+1, 2, 10, QChar('0'));              // period
     109    } else {
     110      epoStr +=  'A' + datTim.time().hour();
     111    }
    92112    _numSec = 3600;
    93113  }
    94114  else {
    95     epoStr = "";
     115    int step = intStr.left(indHlp-1).toInt();
     116    if (_v3filenames) {
     117      epoStr += QString("%1").arg(0, 2, 10, QChar('0'));                    // H
     118      epoStr += QString("%1").arg(0, 2, 10, QChar('0'));                    // M
     119      epoStr += QString("_%1D").arg(step+1, 2, 10, QChar('0'));             // period
     120    } else {
     121      epoStr = "0";
     122    }
    96123    _numSec = 86400;
     124  }
     125
     126  if (_v3filenames) {
     127    if (sampl < 60) {
     128      epoStr += QString("_%1S").arg(sampl, 2, 10, QChar('0'));
     129    }
     130    else {
     131      sampl /= 60;
     132      epoStr += QString("_%1M").arg(sampl, 2, 10, QChar('0'));
     133    }
    97134  }
    98135
     
    111148
    112149  QString yyyy     = QString::number(datTim.date().year());
    113   QString doy      = QString("%1%2").arg(dayOfYear,3,10, QLatin1Char('0')).arg(0);
     150  QString doy      = QString("%1").arg(dayOfYear,3,10, QLatin1Char('0'));
    114151  QString gpswd    = QString("%1%2").arg(GPSweek).arg(dayOfWeek);
    115   QString epoStr   = epochStr(datTim, _intr);
    116   QString baseName = _sklBaseName; 
     152  QString epoStr   = epochStr(datTim, _intr, _sampl);
     153  QString baseName = _sklBaseName;
    117154  baseName.replace("${GPSWD}", gpswd);
    118   baseName.replace("${DATE}" , datTim.date().toString(Qt::ISODate));
    119   baseName.replace("${DOY}"  , doy);
    120   _extension.replace("${YY}" , yyyy.right(2));
     155  baseName.replace("${V3}" , QString("_U_%1%2").arg(yyyy).arg(doy));
     156
    121157  return _path + baseName + epoStr + _extension;
    122158}
Note: See TracChangeset for help on using the changeset viewer.