ExtractCombinationData.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: ExtractCombinationData.hpp 1889 2009-05-11 15:47:23Z afarris $"
00002 
00008 #ifndef Extract_CombinationData_GPSTK
00009 #define Extract_CombinationData_GPSTK
00010 
00011 //============================================================================
00012 //
00013 //  This file is part of GPSTk, the GPS Toolkit.
00014 //
00015 //  The GPSTk is free software; you can redistribute it and/or modify
00016 //  it under the terms of the GNU Lesser General Public License as published
00017 //  by the Free Software Foundation; either version 2.1 of the License, or
00018 //  any later version.
00019 //
00020 //  The GPSTk is distributed in the hope that it will be useful,
00021 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 //  GNU Lesser General Public License for more details.
00024 //
00025 //  You should have received a copy of the GNU Lesser General Public
00026 //  License along with GPSTk; if not, write to the Free Software Foundation,
00027 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //  
00029 //  Dagoberto Salazar - gAGE. 2006
00030 //
00031 //============================================================================
00032 
00033 
00034 
00035 #include "ExtractData.hpp"
00036 
00037 
00038 namespace gpstk
00039 {
00040 
00043 
00044 
00046     class ExtractCombinationData : public ExtractData
00047     {
00048     public:
00049 
00051         ExtractCombinationData() throw(InvalidData)
00052         {
00053             valid = false;
00054             checkData = true;
00055         };
00056 
00057 
00066         virtual int getData(const RinexObsData& rinexData, RinexObsHeader::RinexObsType typeObs1,  RinexObsHeader::RinexObsType typeObs2) throw(InvalidData)
00067         {
00068         try {
00069             // Let's make sure each time we start with clean Vectors
00070             availableSV.resize(0);
00071             obsData.resize(0);
00072 
00073             // Create a CheckPRData object with the given limits
00074             CheckPRData checker(minPRange, maxPRange);
00075 
00076             // Let's define the "it" iterator to visit the observations PRN map
00077             // RinexSatMap is a map from SatID to RinexObsTypeMap: 
00078             //      std::map<SatID, RinexObsTypeMap>
00079             RinexObsData::RinexSatMap::const_iterator it;
00080             for (it = rinexData.obs.begin(); it!= rinexData.obs.end(); it++) 
00081             {
00082                 // RinexObsTypeMap is a map from RinexObsType to RinexDatum:
00083                 //   std::map<RinexObsHeader::RinexObsType, RinexDatum>
00084                 RinexObsData::RinexObsTypeMap otmap;
00085                 // Let's define a iterator to visit the observations type map
00086                 RinexObsData::RinexObsTypeMap::const_iterator itObs1;
00087                 // The "second" field of a RinexSatMap (it) is a RinexObsTypeMap (otmap)
00088                 otmap = (*it).second;
00089 
00090                 // Let's find the observation type inside the RinexObsTypeMap that is "otmap"
00091                 itObs1 = otmap.find(typeObs1);
00092 
00093                 // Let's check if we found this type of observation
00094                 if (itObs1!=otmap.end())
00095                 {
00096                     // Find an itObs2 observation inside the RinexObsTypeMap that is "otmap"
00097                     // Let's define a iterator to visit the observations type map
00098                     RinexObsData::RinexObsTypeMap::const_iterator itObs2;
00099                     itObs2 = otmap.find(typeObs2);
00100                     // If we indeed found a typeObs2 observation, let's compute the combination
00101                     if (itObs2!=otmap.end()) 
00102                     {
00103                         // The "second" part of a RinexObsTypeMap is a RinexDatum, whose public
00104                         // attribute "data" indeed holds the actual numerical data
00105                         double combinationValue = getCombination((*itObs1).second.data, (*itObs2).second.data);
00106 
00107                         // Let's check that the combination is between the limits
00108                         if (checker.check(combinationValue) || !(checkData) ) 
00109                         {
00110                             // Store all relevant data of this epoch
00111                             availableSV = availableSV && (*it).first;
00112                             obsData = obsData && combinationValue;
00113                         }
00114                     }
00115                 }
00116             } // End of data extraction from this epoch
00117         }
00118         catch(...) {
00119             InvalidData e("Unable to get combination data from RinexObsData object");
00120             GPSTK_THROW(e);
00121         }
00122 
00123         // Let's record the number of SV with this type of data available
00124         numSV = (int)obsData.size();
00125 
00126         // If everything is fine so far, then the results should be valid
00127         valid = true;
00128 
00129         return numSV;
00130 
00131         };  // end ExtractCombinationData::getData()
00132 
00133 
00135         virtual ~ExtractCombinationData() {};
00136 
00137 
00138     protected:
00140         virtual double getCombination(double obs1, double obs2) throw(InvalidData) = 0;
00141 
00142 
00143    }; // end class ExtractCombinationData
00144    
00145 
00147    
00148 }
00149 
00150 #endif

Generated on Thu Sep 9 03:30:53 2010 for GPS ToolKit Software Library by  doxygen 1.3.9.1