00001 #pragma ident "$Id: XYZ2NEU.cpp 3140 2012-06-18 15:03:02Z susancummins $"
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 "XYZ2NEU.hpp"
00033
00034
00035 namespace gpstk
00036 {
00037
00038
00039 std::string XYZ2NEU::getClassName() const
00040 { return "XYZ2NEU"; }
00041
00042
00043
00044
00045
00046
00047
00048 XYZ2NEU::XYZ2NEU(const Position& refPos)
00049 {
00050
00051 setLatLon( refPos.getGeodeticLatitude(),
00052 refPos.getLongitude() );
00053
00054 }
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 XYZ2NEU& XYZ2NEU::setLat(const double& lat)
00066 {
00067
00068 if ( (lat > 90.0) ||
00069 (lat < -90.0) )
00070 {
00071 refLat = 0.0;
00072 }
00073 else
00074 {
00075 refLat = (lat*DEG_TO_RAD);
00076 }
00077
00078 init();
00079
00080 return (*this);
00081
00082 }
00083
00084
00085
00086
00087
00088
00089
00090 XYZ2NEU& XYZ2NEU::setLon(const double& lon)
00091 {
00092
00093 refLon = (lon*DEG_TO_RAD);
00094
00095 init();
00096
00097 return (*this);
00098
00099 }
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 XYZ2NEU& XYZ2NEU::setLatLon( const double& lat,
00113 const double& lon )
00114 {
00115
00116
00117 if ( (lat > 90.0) ||
00118 (lat < -90.0) )
00119 {
00120 refLat = 0.0;
00121 }
00122 else
00123 {
00124 refLat = (lat*DEG_TO_RAD);
00125 }
00126
00127 refLon = (lon*DEG_TO_RAD);
00128
00129 init();
00130
00131 return (*this);
00132
00133 }
00134
00135
00136
00137
00138
00139
00140
00141
00142 satTypeValueMap& XYZ2NEU::Process(satTypeValueMap& gData)
00143 throw(ProcessingException)
00144 {
00145
00146 try
00147 {
00148
00149 Matrix<double> neuMatrix;
00150
00151
00152 Matrix<double> dMatrix(gData.getMatrixOfTypes(inputSet));
00153
00154
00155
00156 neuMatrix = dMatrix*rotationMatrix;
00157
00158 gData.insertMatrix(outputSet, neuMatrix);
00159
00160 return gData;
00161
00162 }
00163 catch(Exception& u)
00164 {
00165
00166 ProcessingException e( getClassName() + ":"
00167 + u.what() );
00168
00169 GPSTK_THROW(e);
00170
00171 }
00172
00173 }
00174
00175
00176
00177
00178
00179 void XYZ2NEU::init()
00180 {
00181
00182
00183 rotationMatrix.resize(3,3);
00184
00185
00186 rotationMatrix(0,0) = -std::sin(refLat)*std::cos(refLon);
00187 rotationMatrix(1,0) = -std::sin(refLat)*std::sin(refLon);
00188 rotationMatrix(2,0) = std::cos(refLat);
00189 rotationMatrix(0,1) = -std::sin(refLon);
00190 rotationMatrix(1,1) = std::cos(refLon);
00191 rotationMatrix(2,1) = 0.0;
00192 rotationMatrix(0,2) = std::cos(refLat)*std::cos(refLon);
00193 rotationMatrix(1,2) = std::cos(refLat)*std::sin(refLon);
00194 rotationMatrix(2,2) = std::sin(refLat);
00195
00196
00197 inputSet.clear();
00198 inputSet.insert(TypeID::dx);
00199 inputSet.insert(TypeID::dy);
00200 inputSet.insert(TypeID::dz);
00201
00202 outputSet.clear();
00203 outputSet.insert(TypeID::dLat);
00204 outputSet.insert(TypeID::dLon);
00205 outputSet.insert(TypeID::dH);
00206
00207 }
00208
00209
00210 }