- Timestamp:
- Oct 18, 2011, 2:26:26 AM (12 years ago)
- Location:
- trunk/Utilities/GpsLocationConverter
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Utilities/GpsLocationConverter/GpsLocationConverter_i.c
r29 r31 7 7 8 8 /* File created by MIDL compiler version 7.00.0555 */ 9 /* at Wed Oct 12 21:18:2620119 /* at Tue Oct 18 12:15:23 2011 10 10 */ 11 11 /* Compiler settings for GpsLocationConverter.idl: -
trunk/Utilities/GpsLocationConverter/GpsLocationConverter_i.h
r29 r31 5 5 6 6 /* File created by MIDL compiler version 7.00.0555 */ 7 /* at Wed Oct 12 21:18:2620117 /* at Tue Oct 18 12:15:23 2011 8 8 */ 9 9 /* Compiler settings for GpsLocationConverter.idl: -
trunk/Utilities/GpsLocationConverter/MainDialog.h
r30 r31 103 103 const INT nPartialLatitudeSecond = (INT) fPartialLatitudeSecond; 104 104 sLatitude.AppendFormat(_T("%02d"), nPartialLatitudeSecond); 105 sLatitude.AppendFormat(_T(".%02d 105 sLatitude.AppendFormat(_T(".%02d"), (INT) ((fPartialLatitudeSecond - nPartialLatitudeSecond) * 100 + 0.5 - 1E-6)); 106 106 #pragma endregion 107 107 #pragma region Latitude … … 116 116 const INT nPartialLongitudeSecond = (INT) fPartialLongitudeSecond; 117 117 sLongitude.AppendFormat(_T("%02d"), nPartialLongitudeSecond); 118 sLongitude.AppendFormat(_T(".%02d 118 sLongitude.AppendFormat(_T(".%02d"), (INT) ((fPartialLongitudeSecond - nPartialLongitudeSecond) * 100 + 0.5 - 1E-6)); 119 119 #pragma endregion 120 120 psTexts[ 8] = sLatitude; … … 216 216 #pragma endregion 217 217 #pragma region Degrees, Minutes and Seconds 218 static CAtlStaticRegExp<> g_ExpressionE0(_T("^[\t ]*") 219 _T("{[NSCÞ]}") _T("[\t ]*") _T("{[0-9]+}[^0-9]+?{[0-9]+}[^0-9\\.]+?{[0-9]+}") 220 _T("[^0-9\\.]+?") 221 _T("{[EWÂÇ]}") _T("[\t ]*") _T("{[0-9]+}[^0-9]+?{[0-9]+}[^0-9\\.]+?{[0-9]+}") 222 _T(""), FALSE); 223 static CAtlStaticRegExp<> g_ExpressionE1(_T("^[\t ]*") 224 _T("{[EWÂÇ]}") _T("[\t ]*") _T("{[0-9]+}[^0-9]+?{[0-9]+}[^0-9\\.]+?{[0-9]+}") 225 _T("[^0-9\\.]+?") 226 _T("{[NSCÞ]}") _T("[\t ]*") _T("{[0-9]+}[^0-9]+?{[0-9]+}[^0-9\\.]+?{[0-9]+}") 227 _T(""), FALSE); 228 static CAtlStaticRegExp<> g_ExpressionE2(_T("^[\t ]*") 229 _T("{[0-9]+}[^0-9]+?{[0-9]+}[^0-9\\.]+?{[0-9]+}") _T("[\t ]*") _T("{[NSCÞ]}") 230 _T("[^0-9\\.]+?") 231 _T("{[0-9]+}[^0-9]+?{[0-9]+}[^0-9\\.]+?{[0-9]+}") _T("[\t ]*") _T("{[EWÂÇ]}") 232 _T(""), FALSE); 233 static CAtlStaticRegExp<> g_ExpressionE3(_T("^[\t ]*") 234 _T("{[0-9]+}[^0-9]+?{[0-9]+}[^0-9\\.]+?{[0-9]+}") _T("[\t ]*") _T("{[EWÂÇ]}") 235 _T("[^0-9\\.]+?") 236 _T("{[0-9]+}[^0-9]+?{[0-9]+}[^0-9\\.]+?{[0-9]+}") _T("[\t ]*") _T("{[NSCÞ]}") 237 _T(""), FALSE); 218 #define LATITUDE_SYMBOL _T("{[NSCÞ]}") 219 #define LONGITUDE_SYMBOL _T("{[EWÂÇ]}") 220 #define VALUE _T("{[0-9]+}[^0-9]+?{[0-9]+}[^0-9\\.]+?{[0-9]+(\\.([0-9]+)?)?}") 221 #define OPTIONAL_WHITESPACE _T("[\t ]*") 222 #define SEPARATOR _T("[^0-9\\.]+?") 223 static CAtlStaticRegExp<> g_ExpressionE0(_T("^") OPTIONAL_WHITESPACE LATITUDE_SYMBOL OPTIONAL_WHITESPACE VALUE SEPARATOR LONGITUDE_SYMBOL OPTIONAL_WHITESPACE VALUE _T(""), FALSE); 224 static CAtlStaticRegExp<> g_ExpressionE1(_T("^") OPTIONAL_WHITESPACE LONGITUDE_SYMBOL OPTIONAL_WHITESPACE VALUE SEPARATOR LATITUDE_SYMBOL OPTIONAL_WHITESPACE VALUE _T(""), FALSE); 225 static CAtlStaticRegExp<> g_ExpressionE2(_T("^") OPTIONAL_WHITESPACE VALUE OPTIONAL_WHITESPACE LATITUDE_SYMBOL SEPARATOR VALUE OPTIONAL_WHITESPACE LONGITUDE_SYMBOL _T(""), FALSE); 226 static CAtlStaticRegExp<> g_ExpressionE3(_T("^") OPTIONAL_WHITESPACE VALUE OPTIONAL_WHITESPACE LONGITUDE_SYMBOL SEPARATOR VALUE OPTIONAL_WHITESPACE LATITUDE_SYMBOL _T(""), FALSE); 227 #undef LATITUDE_SYMBOL 228 #undef LONGITUDE_SYMBOL 229 #undef VALUE 230 #undef OPTIONAL_WHITESPACE 231 #undef SEPARATOR 238 232 INT nLayoutE = -1; 239 233 if(g_ExpressionE0.Match(sText, &MatchContext)) … … 258 252 INT nLatitudeDegrees, nLongitudeDegrees; 259 253 INT nLatitudeMinutes, nLongitudeMinutes; 260 INT nLatitudeSeconds, nLongitudeSeconds;254 DOUBLE fLatitudeSeconds, fLongitudeSeconds; 261 255 if(FALSE || 262 256 !AtlStringToInteger(MatchContext.GetMatchString(g_pnMap[nLayoutE][1]), nLatitudeDegrees) || 263 257 !AtlStringToInteger(MatchContext.GetMatchString(g_pnMap[nLayoutE][2]), nLatitudeMinutes) || 264 !AtlStringTo Integer(MatchContext.GetMatchString(g_pnMap[nLayoutE][3]), nLatitudeSeconds) ||258 !AtlStringToDouble(MatchContext.GetMatchString(g_pnMap[nLayoutE][3]), fLatitudeSeconds) || 265 259 !AtlStringToInteger(MatchContext.GetMatchString(g_pnMap[nLayoutE][5]), nLongitudeDegrees) || 266 260 !AtlStringToInteger(MatchContext.GetMatchString(g_pnMap[nLayoutE][6]), nLongitudeMinutes) || 267 !AtlStringTo Integer(MatchContext.GetMatchString(g_pnMap[nLayoutE][7]), nLongitudeSeconds) ||261 !AtlStringToDouble(MatchContext.GetMatchString(g_pnMap[nLayoutE][7]), fLongitudeSeconds) || 268 262 FALSE) 269 263 return FALSE; … … 271 265 if(nLatitudeMinutes >= 60 || nLongitudeMinutes >= 60) 272 266 return FALSE; 273 _A( nLatitudeSeconds >= 0 && nLongitudeSeconds >= 0);274 if( nLatitudeSeconds >= 60 || nLongitudeSeconds >= 60)275 return FALSE; 276 const DOUBLE fLatitude = nLatitudeSign * (nLatitudeDegrees + (nLatitudeMinutes + nLatitudeSeconds / 60.0) / 60.0);277 const DOUBLE fLongitude = nLongitudeSign * (nLongitudeDegrees + (nLongitudeMinutes + nLongitudeSeconds / 60.0) / 60.0);267 _A(fLatitudeSeconds >= 0 && fLongitudeSeconds >= 0); 268 if(fLatitudeSeconds >= 60 || fLongitudeSeconds >= 60) 269 return FALSE; 270 const DOUBLE fLatitude = nLatitudeSign * (nLatitudeDegrees + (nLatitudeMinutes + fLatitudeSeconds / 60.0) / 60.0); 271 const DOUBLE fLongitude = nLongitudeSign * (nLongitudeDegrees + (nLongitudeMinutes + fLongitudeSeconds / 60.0) / 60.0); 278 272 SetLocation(fLatitude, fLongitude); 279 273 return TRUE;
Note: See TracChangeset
for help on using the changeset viewer.