00001 #pragma ident "$Id: NablaOp.cpp 2138 2009-09-26 15:07:27Z architest $"
00002
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "NablaOp.hpp"
00033
00034
00035 namespace gpstk
00036 {
00037
00038
00039
00040 int NablaOp::classIndex = 7100000;
00041
00042
00043
00044 int NablaOp::getIndex() const
00045 { return index; }
00046
00047
00048
00049 std::string NablaOp::getClassName() const
00050 { return "NablaOp"; }
00051
00052
00053
00054
00055
00056
00057
00058
00059 NablaOp::NablaOp()
00060 : lookReferenceSat(true)
00061 {
00062
00063
00064 diffTypes.insert(TypeID::prefitC);
00065 diffTypes.insert(TypeID::dx);
00066 diffTypes.insert(TypeID::dy);
00067 diffTypes.insert(TypeID::dz);
00068
00069
00070 setIndex();
00071
00072 }
00073
00074
00075
00076
00077
00078
00079
00080
00081 NablaOp::NablaOp(const SatID& rSat)
00082 : refSat(rSat), lookReferenceSat(false)
00083 {
00084
00085
00086 diffTypes.insert(TypeID::prefitC);
00087 diffTypes.insert(TypeID::dx);
00088 diffTypes.insert(TypeID::dy);
00089 diffTypes.insert(TypeID::dz);
00090
00091
00092 setIndex();
00093
00094 }
00095
00096
00097
00098
00099
00100
00101
00102
00103 NablaOp& NablaOp::addDiffTypeSet(const TypeIDSet& diffSet)
00104 {
00105
00106
00107 TypeIDSet::const_iterator pos;
00108 for(pos = diffSet.begin(); pos != diffSet.end(); ++pos)
00109 {
00110 diffTypes.insert(*pos);
00111 }
00112
00113 return (*this);
00114
00115 }
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 satTypeValueMap& NablaOp::Process(satTypeValueMap& gData)
00126 throw(ProcessingException)
00127 {
00128
00129 try
00130 {
00131
00132 double maxElevation(0.0);
00133
00134
00135
00136 if (lookReferenceSat)
00137 {
00138
00139
00140
00141 satTypeValueMap::iterator it;
00142 for (it = gData.begin(); it != gData.end(); ++it)
00143 {
00144
00145
00146
00147 if ( gData((*it).first)(TypeID::elevation) > maxElevation )
00148 {
00149
00150 refSat = (*it).first;
00151 maxElevation = gData((*it).first)(TypeID::elevation);
00152
00153 }
00154
00155 }
00156
00157 }
00158
00159
00160
00161 satTypeValueMap refData(gData.extractSatID(refSat));
00162
00163
00164 gData.removeSatID(refSat);
00165
00166
00167 SatIDSet satRejectedSet;
00168
00169
00170
00171 satTypeValueMap::iterator it;
00172 for (it = gData.begin(); it != gData.end(); ++it)
00173 {
00174
00175
00176
00177 TypeIDSet::const_iterator itType;
00178 for(itType = diffTypes.begin(); itType != diffTypes.end(); ++itType)
00179 {
00180
00181 double value1(0.0);
00182 double value2(0.0);
00183
00184 try
00185 {
00186
00187
00188 value1 = gData((*it).first)(*itType);
00189 value2 = refData(refSat)(*itType);
00190
00191
00192 gData((*it).first)((*itType)) = value1 - value2;
00193
00194 }
00195 catch(...)
00196 {
00197
00198
00199
00200 satRejectedSet.insert( (*it).first );
00201
00202 continue;
00203
00204 }
00205
00206 }
00207
00208 }
00209
00210
00211
00212 gData.removeSatID(satRejectedSet);
00213
00214 return gData;
00215
00216 }
00217 catch(Exception& u)
00218 {
00219
00220 ProcessingException e( getClassName() + ":"
00221 + StringUtils::asString( getIndex() ) + ":"
00222 + u.what() );
00223
00224 GPSTK_THROW(e);
00225
00226 }
00227
00228 }
00229
00230
00231
00232 }