00001 00007 //============================================================================ 00008 // 00009 // This file is part of GPSTk, the GPS Toolkit. 00010 // 00011 // The GPSTk is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU Lesser General Public License as published 00013 // by the Free Software Foundation; either version 2.1 of the License, or 00014 // any later version. 00015 // 00016 // The GPSTk is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU Lesser General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Lesser General Public 00022 // License along with GPSTk; if not, write to the Free Software Foundation, 00023 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 // 00025 // Wei Yan - Chinese Academy of Sciences . 2009, 2010 00026 // 00027 //============================================================================ 00028 00029 00030 #include "DoubleOp.hpp" 00031 00032 namespace gpstk 00033 { 00034 // Index initially assigned to this class 00035 int DoubleOp::classIndex = 8000000; 00036 00037 00038 // Returns an index identifying this object. 00039 int DoubleOp::getIndex() const 00040 { return index; } 00041 00042 00043 // Returns a string identifying this object. 00044 std::string DoubleOp::getClassName() const 00045 { return "DoubleOp"; } 00046 00047 00048 /* Returns a reference to a satTypeValueMap object after differencing 00049 * data type values given in 'diffTypes' field with respect to 00050 * reference station data in 'refData' field. 00051 * 00052 * @param gData Data object holding the data. 00053 */ 00054 satTypeValueMap& DoubleOp::Process(satTypeValueMap& gData) 00055 throw(ProcessingException) 00056 { 00057 00058 try 00059 { 00060 // First, we get difference data between two stations 00061 sdStations.Process(gData); 00062 00063 // Second, we should check if the elevation of the ref satellite 00064 // is useable, if not, pick up a new ref satellite with the highest 00065 // elevation 00066 bool lookHigestElevation = true; 00067 00068 if(refSatID.isValid()) 00069 { 00070 satTypeValueMap::iterator it = gData.find(refSatID); 00071 if(it!=gData.end()) 00072 { 00073 double elev = gData(it->first)(TypeID::elevation); 00074 if(elev > refSatMinElev) lookHigestElevation = false; 00075 } 00076 } 00077 00078 if(lookHigestElevation) 00079 { 00080 double maxElevation(0.0); 00081 00082 // Loop through all satellites in reference station data set, 00083 // looking for reference satellite 00084 satTypeValueMap::iterator it; 00085 for (it = gData.begin(); it != gData.end(); ++it) 00086 { 00087 00088 // The satellite with the highest elevation will usually be 00089 // the reference satellite 00090 if ( gData((*it).first)(TypeID::elevation) > maxElevation ) 00091 { 00092 00093 refSatID = (*it).first; 00094 maxElevation = gData((*it).first)(TypeID::elevation); 00095 } 00096 00097 } // end for 00098 00099 } // End 'if(lookHigestElevation)' 00100 00101 // At last, We get the final DD data 00102 sdSatellites.setRefSat(refSatID); 00103 sdSatellites.Process(gData); 00104 00105 return gData; 00106 00107 } 00108 catch(Exception& u) 00109 { 00110 // Throw an exception if something unexpected happens 00111 ProcessingException e( getClassName() + ":" 00112 + StringUtils::asString( getIndex() ) + ":" 00113 + u.what() ); 00114 00115 GPSTK_THROW(e); 00116 00117 } 00118 00119 } // End of method 'DoubleOp::Process()' 00120 00121 00122 } // End of namespace gpstk 00123
1.3.9.1