Index: trunk/BNC/src/rinex/reqcanalyze.cpp
===================================================================
--- trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 9775)
+++ trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 9797)
@@ -120,5 +120,5 @@
 
   if (_log) {
-    *_log << "QC Format Version  : " << QString("%1").arg(QC_FORMAT_VERSION,3,'f',1)  << endl << endl;
+    *_log << "QC Format Version  : " << QString("%1").arg(QC_FORMAT_VERSION,3,'f',1)  << '\n' << '\n';
   }
 
@@ -203,6 +203,5 @@
       for (unsigned iObs = 0; iObs < _currEpo->rnxSat.size(); iObs++) {
         const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iObs];
-        if (_navFileNames.size() &&
-            _numExpObs.find(rnxSat.prn) == _numExpObs.end()) {
+        if (_navFileNames.size() && _numExpObs.find(rnxSat.prn) == _numExpObs.end()) {
           _numExpObs[rnxSat.prn] = 0;
         }
@@ -231,5 +230,5 @@
   catch (QString str) {
     if (_log) {
-      *_log << "Exception " << str << endl;
+      *_log << "Exception " << str << '\n';
     }
     else {
@@ -342,7 +341,9 @@
       double rho, eleSat, azSat;
       topos(xyzSta(1), xyzSta(2), xyzSta(3), xc(1), xc(2), xc(3), rho, eleSat, azSat);
-      qcSat._eleSet = true;
-      qcSat._azDeg  = azSat  * 180.0/M_PI;
-      qcSat._eleDeg = eleSat * 180.0/M_PI;
+      if (round(eleSat * 180.0/M_PI) >= 0.0) {
+        qcSat._eleSet = true;
+        qcSat._azDeg  = azSat  * 180.0/M_PI;
+        qcSat._eleDeg = eleSat * 180.0/M_PI;
+      }
     }
     if (satObs._prn.system() == 'R') {
@@ -381,5 +382,5 @@
       t_frequency::type fA = t_frequency::dummy;
       t_frequency::type fB = t_frequency::dummy;
-      char sys             = satObs._prn.system();
+      char sys = satObs._prn.system();
       if (_signalTypes.find(sys) != _signalTypes.end()) {
         for (int iSig = 0; iSig < _signalTypes[sys].size(); iSig++) {
@@ -412,16 +413,14 @@
           for (unsigned jj = 0; jj < satObs._obs.size(); jj++) {
             const t_frqObs* frqObsHlp = satObs._obs[jj];
-            if      (frqObsHlp->_rnxType2ch[0] == t_frequency::toString(fA)[1] &&
-                frqObsHlp->_phaseValid) {
+            if      (frqObsHlp->_rnxType2ch[0] == t_frequency::toString(fA)[1] && frqObsHlp->_phaseValid) {
               foundA = true;
               L_a    = frqObsHlp->_phase * t_CST::c / f_a;
             }
-            else if (frqObsHlp->_rnxType2ch[0] == t_frequency::toString(fB)[1] &&
-                frqObsHlp->_phaseValid) {
+            else if (frqObsHlp->_rnxType2ch[0] == t_frequency::toString(fB)[1] && frqObsHlp->_phaseValid) {
               foundB = true;
               L_b    = frqObsHlp->_phase * t_CST::c / f_b;
             }
           }
-          if (foundA && foundB) {
+          if (foundA && foundB && C_a) {
             qcFrq._setMP = true;
             qcFrq._rawMP = C_a - L_a - 2.0*f_b*f_b/(f_a*f_a-f_b*f_b) * (L_a - L_b);
@@ -748,21 +747,21 @@
   // Summary
   // -------
-  *_log << "Observation File   : " << obsFileName                                   << endl
-        << "RINEX Version      : " << QString("%1").arg(obsFile->version(),4,'f',2) << endl
-        << "Marker Name        : " << _qcFile._markerName                           << endl
-        << "Marker Number      : " << obsFile->markerNumber()                       << endl
-        << "Receiver           : " << _qcFile._receiverType                         << endl
-        << "Antenna            : " << _qcFile._antennaName                          << endl
+  *_log << "Observation File   : " << obsFileName                                   << '\n'
+        << "RINEX Version      : " << QString("%1").arg(obsFile->version(),4,'f',2) << '\n'
+        << "Marker Name        : " << _qcFile._markerName                           << '\n'
+        << "Marker Number      : " << obsFile->markerNumber()                       << '\n'
+        << "Receiver           : " << _qcFile._receiverType                         << '\n'
+        << "Antenna            : " << _qcFile._antennaName                          << '\n'
         << "Position XYZ       : " << QString("%1 %2 %3").arg(obsFile->xyz()(1), 14, 'f', 4)
                                                         .arg(obsFile->xyz()(2), 14, 'f', 4)
-                                                        .arg(obsFile->xyz()(3), 14, 'f', 4) << endl
+                                                        .arg(obsFile->xyz()(3), 14, 'f', 4) << '\n'
         << "Antenna dH/dE/dN   : " << QString("%1 %2 %3").arg(obsFile->antNEU()(3), 8, 'f', 4)
                                                         .arg(obsFile->antNEU()(2), 8, 'f', 4)
-                                                        .arg(obsFile->antNEU()(1), 8, 'f', 4) << endl
+                                                        .arg(obsFile->antNEU()(1), 8, 'f', 4) << '\n'
         << "Start Time         : " << _qcFile._startTime.datestr().c_str()         << ' '
-                                   << _qcFile._startTime.timestr(1,'.').c_str()    << endl
+                                   << _qcFile._startTime.timestr(1,'.').c_str()    << '\n'
         << "End Time           : " << _qcFile._endTime.datestr().c_str()           << ' '
-                                   << _qcFile._endTime.timestr(1,'.').c_str()      << endl
-        << "Interval           : " << _qcFile._interval << " sec"                  << endl;
+                                   << _qcFile._endTime.timestr(1,'.').c_str()      << '\n'
+        << "Interval           : " << _qcFile._interval << " sec"                  << '\n';
 
   // Number of systems
@@ -783,5 +782,5 @@
     *_log << ' ' << itSys.key();
   }
-  *_log << endl;
+  *_log << '\n';
 
   // Observation types per system
@@ -795,5 +794,5 @@
         *_log << " " << type;
       }
-      *_log << endl;
+      *_log << '\n';
     }
   }
@@ -804,9 +803,8 @@
   while (itSys.hasNext()) {
     itSys.next();
-    const QChar&                      sys      = itSys.key();
+    const QChar&  sys = itSys.key();
     const QVector<const t_qcSatSum*>& qcSatVec = itSys.value();
     int numExpectedObs = 0;
-    for(QMap<t_prn, int>::iterator it = _numExpObs.begin();
-        it != _numExpObs.end(); it++) {
+    for(QMap<t_prn, int>::iterator it = _numExpObs.begin(); it != _numExpObs.end(); it++) {
       if (sys == it.key().system()) {
         numExpectedObs += it.value();
@@ -820,11 +818,11 @@
       while (itFrq.hasNext()) {
         itFrq.next();
-        QString           frqType  = itFrq.key(); if (frqType.length() < 2) frqType += '?';
+        QString frqType  = itFrq.key(); if (frqType.length() < 2) frqType += '?';
         const t_qcFrqSum& qcFrqSum = itFrq.value();
         frqMap[frqType].push_back(&qcFrqSum);
       }
     }
-    *_log << endl
-          << prefixSys << "Satellites: " << qcSatVec.size() << endl
+    *_log << '\n'
+          << prefixSys << "Satellites: " << qcSatVec.size() << '\n'
           << prefixSys << "Signals   : " << frqMap.size() << "   ";
     QMapIterator<QString, QVector<const t_qcFrqSum*> > itFrq(frqMap);
@@ -834,10 +832,10 @@
       *_log << ' ' << frqType;
     }
-    *_log << endl;
+    *_log << '\n';
     QString prefixSys2 = "    " + prefixSys;
     itFrq.toFront();
     while (itFrq.hasNext()) {
       itFrq.next();
-      QString                          frqType  = itFrq.key(); if (frqType.length() < 2) frqType += '?';
+      QString frqType  = itFrq.key(); if (frqType.length() < 2) frqType += '?';
       const QVector<const t_qcFrqSum*> qcFrqVec = itFrq.value();
       QString prefixFrq = QString("  ") + frqType + QString(": ");
@@ -870,7 +868,7 @@
       double ratio = (double(numObs) / double(numExpectedObs)) * 100.0;
 
-      *_log << endl
+      *_log << '\n'
             << prefixSys2 << prefixFrq << "Observations      : ";
-      if(_navFileNames.isEmpty() || _navFileIncomplete.contains(sys.toLatin1())) {
+      if(_navFileNames.isEmpty() || numExpectedObs == 0.0  || _navFileIncomplete.contains(sys.toLatin1())) {
         *_log << QString("%1\n").arg(numObs,           6);
       }
@@ -892,5 +890,5 @@
     return;
   }
-  *_log << endl;
+  *_log << '\n';
   for (int iEpo = 0; iEpo < _qcFile._qcEpo.size(); iEpo++) {
     const t_qcEpo& qcEpo = _qcFile._qcEpo[iEpo];
@@ -912,5 +910,5 @@
     *_log << dateStr << QString(" %1").arg(qcEpo._qcSat.size(), 2)
           << QString(" %1").arg(qcEpo._PDOP, 4, 'f', 1)
-          << endl;
+          << '\n';
 
     QMapIterator<t_prn, t_qcSat> itSat(qcEpo._qcSat);
@@ -964,5 +962,5 @@
         }
       }
-      *_log << endl;
+      *_log << '\n';
     }
   }
@@ -988,5 +986,5 @@
   }
   if (_log) {
-    *_log << "Navigation File(s) : " << navFileName  << endl;
+    *_log << "Navigation File(s) : " << navFileName  << '\n';
   }
   QStringListIterator it(_navFileNames);
@@ -1040,5 +1038,5 @@
   }
   if (_log) {
-    *_log << endl;
+    *_log << '\n';
   }
 }
@@ -1047,6 +1045,6 @@
                                    double interval, const ColumnVector& xyzSta) {
 
-  for(QMap<t_prn, int>::iterator it = _numExpObs.begin();
-      it != _numExpObs.end(); it++) {
+
+  for(QMap<t_prn, int>::iterator it = _numExpObs.begin(); it != _numExpObs.end(); it++) {
     t_eph* eph = 0;
     for (int ie = 0; ie < _ephs.size(); ie++) {
@@ -1060,6 +1058,5 @@
       int numExpObs = 0;
       bncTime epoTime;
-      for (epoTime = startTime - interval; epoTime < endTime;
-           epoTime = epoTime + interval) {
+      for (epoTime = startTime - interval; epoTime < endTime; epoTime = epoTime + interval) {
         ColumnVector xc(6);
         ColumnVector vv(3);
@@ -1068,5 +1065,5 @@
           double rho, eleSat, azSat;
           topos(xyzSta(1), xyzSta(2), xyzSta(3), xc(1), xc(2), xc(3), rho, eleSat, azSat);
-          if ((eleSat * 180.0/M_PI) > 0.0) {
+          if (round(eleSat * 180.0/M_PI) >= 0.0) {
             numExpObs++;
           }
