Index: /trunk/BNC/src/rinex/reqcanalyze.cpp
===================================================================
--- /trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 4354)
+++ /trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 4355)
@@ -175,4 +175,133 @@
                                    .arg(obs.satNum, 2, 10, QChar('0'));
 
+      t_satStat& satStat = _satStat[prn];
+
+      satStat.addObs(obs);
+    }
+
+  } // while (_currEpo)
+
+  // Analyze the Multipath
+  // ---------------------
+  QVector<t_polarPoint*>* dataMP1 = new QVector<t_polarPoint*>;
+  QVector<t_polarPoint*>* dataMP2 = new QVector<t_polarPoint*>;
+
+  QMapIterator<QString, t_satStat> it(_satStat);
+  while (it.hasNext()) {
+    it.next();
+    QString          prn     = it.key();
+    const t_satStat& satStat = it.value();
+    analyzeMultipath(prn, satStat, xyz, dataMP1, dataMP2);
+  }
+
+  emit displayGraph(dataMP1, dataMP2);
+
+  _log->flush();
+}
+
+//  
+////////////////////////////////////////////////////////////////////////////
+void t_reqcAnalyze::t_satStat::addObs(const t_obs& obs) { 
+
+  t_anaObs* newObs = new t_anaObs(obs.GPSWeek, obs.GPSWeeks);
+  bool      okFlag = false;
+
+  // Compute the Multipath
+  // ----------------------
+  if (obs.l1() != 0.0 && obs.l2() != 0.0) {
+    double f1 = t_CST::f1(obs.satSys, obs.slotNum);
+    double f2 = t_CST::f2(obs.satSys, obs.slotNum);
+
+    double L1 = obs.l1() * t_CST::c / f1;
+    double L2 = obs.l2() * t_CST::c / f2;
+
+    if (obs.p1() != 0.0) {
+      newObs->_MP1 = obs.p1() - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2);
+      okFlag = true;
+    }
+    if (obs.p2() != 0.0) {
+      newObs->_MP2 = obs.p2() - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2);
+      okFlag = true;
+    }
+  }
+
+  // Remember the Observation
+  // ------------------------
+  if (okFlag) {
+    anaObs << newObs;
+  }
+  else {
+    delete newObs;
+  }
+}
+
+//  
+////////////////////////////////////////////////////////////////////////////
+void t_reqcAnalyze::analyzeMultipath(const QString& prn, 
+                                     const t_satStat& satStat,
+                                     const ColumnVector& xyz,
+                                     QVector<t_polarPoint*>* dataMP1, 
+                                     QVector<t_polarPoint*>* dataMP2) {
+
+  const int    LENGTH = 10;  // number of epochs in one chunk
+  const double SLIP   = 5.0; // cycle-slip threshold
+
+  int numEpo = satStat.anaObs.size();
+
+  for (int chunkStart = 0; chunkStart + LENGTH < numEpo; chunkStart += LENGTH) {
+
+    // Compute Mean
+    // ------------
+    bool   slipFlag = false;
+    double mean1    = 0.0;
+    double mean2    = 0.0;
+
+    for (int ii = 0; ii < LENGTH; ii++) {
+      int iEpo = chunkStart + ii;
+      const t_anaObs* anaObs = satStat.anaObs[iEpo];
+      mean1 += anaObs->_MP1;
+      mean2 += anaObs->_MP2;
+  
+      // Check Slip
+      // ----------
+      if (ii > 0) {
+        double diff1 = anaObs->_MP1 - satStat.anaObs[iEpo-1]->_MP1;
+        double diff2 = anaObs->_MP2 - satStat.anaObs[iEpo-1]->_MP2;
+        if (fabs(diff1) > SLIP || fabs(diff2) > SLIP) {
+          slipFlag = true;
+          break;
+        }
+      }
+    }
+
+    if (slipFlag) {
+      continue;
+    }
+
+    mean1 /= LENGTH;
+    mean2 /= LENGTH;
+
+    // Compute Standard Deviation
+    // --------------------------
+    double stddev1 = 0.0;
+    double stddev2 = 0.0;
+    for (int ii = 0; ii < LENGTH; ii++) {
+      int iEpo = chunkStart + ii;
+      const t_anaObs* anaObs = satStat.anaObs[iEpo];
+      double diff1 = anaObs->_MP1 - mean1;
+      double diff2 = anaObs->_MP2 - mean2;
+      stddev1 += diff1 * diff1;
+      stddev2 += diff2 * diff2;
+    }
+    double MP1 = sqrt(stddev1 / (LENGTH-1));
+    double MP2 = sqrt(stddev2 / (LENGTH-1));
+
+    const t_anaObs* anaObs0 = satStat.anaObs[chunkStart];
+
+    // Compute the Azimuth and Zenith Distance
+    // ---------------------------------------
+    double az  = 0.0;
+    double zen = 0.0;
+    if (xyz.size()) {
       t_eph* eph = 0;
       for (int ie = 0; ie < _ephs.size(); ie++) {
@@ -182,156 +311,32 @@
         }
       }
-
-      t_satStat& satStat = _satStat[prn];
-
-      satStat.addObs(obs, eph, xyz);
-    }
-
-  } // while (_currEpo)
-
-  // Analyze the Multipath
-  // ---------------------
-  QVector<t_polarPoint*>* dataMP1 = new QVector<t_polarPoint*>;
-  QVector<t_polarPoint*>* dataMP2 = new QVector<t_polarPoint*>;
-
-  QMapIterator<QString, t_satStat> it(_satStat);
-  while (it.hasNext()) {
-    it.next();
-    QString          prn     = it.key();
-    const t_satStat& satStat = it.value();
-    analyzeMultipath(prn, satStat, dataMP1, dataMP2);
-  }
-
-  emit displayGraph(dataMP1, dataMP2);
-
-  _log->flush();
-}
-
-//  
-////////////////////////////////////////////////////////////////////////////
-void t_reqcAnalyze::t_satStat::addObs(const t_obs& obs, const t_eph* eph, 
-                                      const ColumnVector& xyz) {
-
-  t_anaObs* newObs = new t_anaObs(obs);
-  bool      okFlag = false;
-
-  // Compute the Multipath
-  // ----------------------
-  if (obs.l1() != 0.0 && obs.l2() != 0.0) {
-    double f1 = t_CST::f1(obs.satSys, obs.slotNum);
-    double f2 = t_CST::f2(obs.satSys, obs.slotNum);
-
-    double L1 = obs.l1() * t_CST::c / f1;
-    double L2 = obs.l2() * t_CST::c / f2;
-
-    if (obs.p1() != 0.0) {
-      newObs->MP1 = obs.p1() - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2);
-      okFlag = true;
-    }
-    if (obs.p2() != 0.0) {
-      newObs->MP2 = obs.p2() - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2);
-      okFlag = true;
-    }
-  }
-
-  // Remember the Observation
-  // ------------------------
-  if (okFlag) {
-    anaObs << newObs;
-  }
-  else {
-    delete newObs;
-    return;
-  }
-
-  // Compute the Azimuth and Zenith Distance
-  // ---------------------------------------
-  if (eph && xyz.size()) {
-    double xSat, ySat, zSat, clkSat;
-    eph->position(obs.GPSWeek, obs.GPSWeeks, xSat, ySat, zSat, clkSat);
-
-    double rho, eleSat, azSat;
-    topos(xyz(1), xyz(2), xyz(3), xSat, ySat, zSat, rho, eleSat, azSat);
-
-    newObs->az  = azSat * 180.0/M_PI;
-    newObs->zen = 90.0 - eleSat * 180.0/M_PI;
-  }
-}
-
-//  
-////////////////////////////////////////////////////////////////////////////
-void t_reqcAnalyze::analyzeMultipath(const QString& prn, 
-                                     const t_satStat& satStat,
-                                     QVector<t_polarPoint*>* dataMP1, 
-                                     QVector<t_polarPoint*>* dataMP2) {
-
-  const int    LENGTH = 10;  // number of epochs in one chunk
-  const double SLIP   = 5.0; // cycle-slip threshold
-
-  int numEpo = satStat.anaObs.size();
-
-  for (int chunkStart = 0; chunkStart + LENGTH < numEpo; chunkStart += LENGTH) {
-
-    // Compute Mean
-    // ------------
-    bool   slipFlag = false;
-    double mean1    = 0.0;
-    double mean2    = 0.0;
-
-    for (int ii = 0; ii < LENGTH; ii++) {
-      int iEpo = chunkStart + ii;
-      const t_anaObs* anaObs = satStat.anaObs[iEpo];
-      mean1 += anaObs->MP1;
-      mean2 += anaObs->MP2;
-  
-      // Check Slip
-      // ----------
-      if (ii > 0) {
-        double diff1 = anaObs->MP1 - satStat.anaObs[iEpo-1]->MP1;
-        double diff2 = anaObs->MP2 - satStat.anaObs[iEpo-1]->MP2;
-        if (fabs(diff1) > SLIP || fabs(diff2) > SLIP) {
-          slipFlag = true;
-          break;
-        }
+      
+      if (eph) {
+        double xSat, ySat, zSat, clkSat;
+        eph->position(anaObs0->_GPSWeek, anaObs0->_GPSWeeks, 
+                      xSat, ySat, zSat, clkSat);
+      
+        double rho, eleSat, azSat;
+        topos(xyz(1), xyz(2), xyz(3), xSat, ySat, zSat, rho, eleSat, azSat);
+      
+        az  = azSat * 180.0/M_PI;
+        zen = 90.0 - eleSat * 180.0/M_PI;
       }
     }
-
-    if (slipFlag) {
-      continue;
-    }
-
-    mean1 /= LENGTH;
-    mean2 /= LENGTH;
-
-    // Compute Standard Deviation
-    // --------------------------
-    double stddev1 = 0.0;
-    double stddev2 = 0.0;
-    for (int ii = 0; ii < LENGTH; ii++) {
-      int iEpo = chunkStart + ii;
-      const t_anaObs* anaObs = satStat.anaObs[iEpo];
-      double diff1 = anaObs->MP1 - mean1;
-      double diff2 = anaObs->MP2 - mean2;
-      stddev1 += diff1 * diff1;
-      stddev2 += diff2 * diff2;
-    }
-    double MP1 = sqrt(stddev1 / (LENGTH-1));
-    double MP2 = sqrt(stddev2 / (LENGTH-1));
 
     // Add new Point
     // -------------
-    const t_anaObs* anaObs = satStat.anaObs[chunkStart];
-    (*dataMP1) << (new t_polarPoint(anaObs->az, anaObs->zen, MP1));
-    (*dataMP2) << (new t_polarPoint(anaObs->az, anaObs->zen, MP2));
+    (*dataMP1) << (new t_polarPoint(az, zen, MP1));
+    (*dataMP2) << (new t_polarPoint(az, zen, MP2));
 
     _log->setRealNumberNotation(QTextStream::FixedNotation);
 
     _log->setRealNumberPrecision(2);
-    *_log << "MP1 " << prn << " " << anaObs->az << " " << anaObs->zen << " ";
+    *_log << "MP1 " << prn << " " << az << " " << zen << " ";
     _log->setRealNumberPrecision(3);
     *_log << MP1 << endl;
 
     _log->setRealNumberPrecision(2);
-    *_log << "MP2 " << prn << " " << anaObs->az << " " << anaObs->zen << " ";
+    *_log << "MP2 " << prn << " " << az << " " << zen << " ";
     _log->setRealNumberPrecision(3);
     *_log << MP2 << endl;
Index: /trunk/BNC/src/rinex/reqcanalyze.h
===================================================================
--- /trunk/BNC/src/rinex/reqcanalyze.h	(revision 4354)
+++ /trunk/BNC/src/rinex/reqcanalyze.h	(revision 4355)
@@ -56,11 +56,14 @@
   class t_anaObs {
    public:
-    t_anaObs(const t_obs& obsIn) :
-      obs(obsIn), az(0.0), zen(0.0), MP1(0.0), MP2(0.0) {}
-    t_obs  obs;
-    double az;
-    double zen;
-    double MP1;
-    double MP2;
+    t_anaObs(int GPSWeek, double GPSWeeks) {
+      _GPSWeek  = GPSWeek;
+      _GPSWeeks = GPSWeeks;
+      _MP1      = 0.0;
+      _MP2      = 0.0;
+    }
+    int    _GPSWeek;
+    double _GPSWeeks;
+    double _MP1;
+    double _MP2;
   };
 
@@ -73,10 +76,12 @@
       }
     }
-    void addObs(const t_obs& obs, const t_eph* eph, const ColumnVector& xyz);
+    void addObs(const t_obs& obs);
     QVector<t_anaObs*> anaObs;
   };
 
   void analyzeFile(t_rnxObsFile* obsFile);
-  void analyzeMultipath(const QString& prn, const t_satStat& satStat,
+  void analyzeMultipath(const QString& prn, 
+                        const t_satStat& satStat,
+                        const ColumnVector& xyz,
                         QVector<t_polarPoint*>* dataMP1, 
                         QVector<t_polarPoint*>* dataMP2);
