Changeset 6563 in ntrip


Ignore:
Timestamp:
Jan 23, 2015, 4:32:40 PM (7 years ago)
Author:
stuerze
Message:

try to catch incorrect user input

Location:
trunk/BNC/src/rinex
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/rinex/reqcanalyze.cpp

    r6560 r6563  
    7070  _navFileNames    = settings.value("reqcNavFile").toString().split(",", QString::SkipEmptyParts);
    7171  _reqcPlotSignals = settings.value("reqcSkyPlotSignals").toString();
    72   if (_reqcPlotSignals.isEmpty()) {_reqcPlotSignals = "G:1&2 R:1&2 J:1&2 E:1&5 S:1&5 C:1&7";}
     72  _defaultSignalTypes << "G:1&2" << "R:1&2" << "J:1&2" << "E:1&5" << "S:1&5" << "C:1&7";
     73  if (_reqcPlotSignals.isEmpty()) {
     74    _reqcPlotSignals = _defaultSignalTypes.join(" ");
     75  }
    7376  analyzePlotSignals(_signalTypes);
    7477
     
    146149
    147150  for (int ii = 0; ii < signalsOpt.size(); ii++) {
    148     QStringList hlp = signalsOpt.at(ii).split(QRegExp("[:&]"), QString::SkipEmptyParts);
    149     if (hlp.size() > 1 && hlp[0].length() == 1) {
    150       char system = hlp[0].toAscii().constData()[0];
    151       signalTypes[system].append(hlp[1]);
    152       if (hlp.size() > 2) {
    153         signalTypes[system].append(hlp[2]);
     151    QStringList input = signalsOpt.at(ii).split(QRegExp("[:&]"), QString::SkipEmptyParts);
     152    if (input.size() > 1 && input[0].length() == 1) {
     153      char system = input[0].toAscii().constData()[0];
     154      QStringList sysValid       = _defaultSignalTypes.filter(QString(system));
     155      QStringList defaultSignals = sysValid.at(0).split(QRegExp("[:&]"));
     156      if (sysValid.isEmpty()) {continue;}
     157      if (input[1][0].isDigit()) {
     158        signalTypes[system].append(input[1]);
     159      }
     160      else {
     161        signalTypes[system].append(defaultSignals[1]);
     162      }
     163      if (input.size() > 2) {
     164        if (input[2][0].isDigit()) {
     165          signalTypes[system].append(input[2]);
     166        }
     167        else {
     168          signalTypes[system].append(defaultSignals[2]);
     169        }
     170      } else {
     171        signalTypes[system].append(defaultSignals[2]);
     172        if (signalTypes[system][0] == signalTypes[system][1]) {
     173          signalTypes[system][0] = defaultSignals[1];
     174        }
    154175      }
    155176    }
     
    518539  for(QMap<char, QVector<QString> >::iterator it = _signalTypes.begin();
    519540      it != _signalTypes.end(); it++) {
    520     mp1Title += QString(it.key()) + ":" + it.value()[0] + " ";
    521     sn1Title += QString(it.key()) + ":" + it.value()[0] + " ";
    522     mp2Title += QString(it.key()) + ":" + it.value()[1] + " ";
    523     sn2Title += QString(it.key()) + ":" + it.value()[1] + " ";
     541      mp1Title += QString(it.key()) + ":" + it.value()[0] + " ";
     542      sn1Title += QString(it.key()) + ":" + it.value()[0] + " ";
     543      mp2Title += QString(it.key()) + ":" + it.value()[1] + " ";
     544      sn2Title += QString(it.key()) + ":" + it.value()[1] + " ";
    524545  }
    525546
  • trunk/BNC/src/rinex/reqcanalyze.h

    r6539 r6563  
    189189  QString                       _reqcPlotSignals;
    190190  QMap<char, QVector<QString> > _signalTypes;
     191  QStringList                   _defaultSignalTypes;
    191192  QVector<t_eph*>               _ephs;
    192193  t_rnxObsFile::t_rnxEpo*       _currEpo;
Note: See TracChangeset for help on using the changeset viewer.