本文整理汇总了C++中KKStr::ToDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ KKStr::ToDouble方法的具体用法?C++ KKStr::ToDouble怎么用?C++ KKStr::ToDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KKStr
的用法示例。
在下文中一共展示了KKStr::ToDouble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImportGPSDataGPGGA
void ImportGPSDataGPGGA (const KKStr& fileName)
{
RunLog log;
DataBasePtr dbConn = new DataBase (log);
ifstream i (fileName.Str ());
if (!i.is_open ())
{
log.Level (-1) << endl << endl
<< "ImpotrtGPSData Could not open file[" << fileName << "]" << endl
<< endl;
return;
}
log.Level (10) << endl << endl << endl << endl << endl
<< "ImpotrtGPSData FileName[" << fileName << "]" << endl << endl
<< endl;
char buff[20480];
bool firstPass = true;
int lastMinute = 0;
int linesRead = 0;
KKStr ln (256);
DateTime lastDateTime;
while (i.getline (buff, sizeof (buff)))
{
linesRead++;
ln = buff;
ln.TrimLeft ();
if (!ln.LocateStr ("GPGGA"))
continue;
VectorKKStr fields = ln.Parse (",");
if (fields.size () < 8)
continue;
if (!fields[2].EqualIgnoreCase ("$GPGGA"))
continue;
/*
0 1 2 3 4 5 6 7 8
06/01/2010, 23:59:59.818, $GPGGA, 235958, 2840.927, N, 08828.458, W, 2, 09,22.10,0,M,,,14,0000*12
06/02/2010, 00:00:10.818, $GPGGA, 000009, 2840.931, N, 08828.482, W, 1, 09,0.89,0,M,,,,*2D
06/02/2010, 00:00:21.802, $GPGGA, 000020, 2840.929, N, 08828.505, W, 1, 09,0.89,0,M,,,,*21
06/02/2010, 00:00:31.818, $GPGGA, 000030, 2840.924, N, 08828.526, W, 1, 09,0.89,0,M,,,,*2C
06/02/2010, 00:00:42.818, $GPGGA, 000041, 2840.917, N, 08828.547, W, 1, 09,0.89,0,M,,,,*2D
06/02/2010, 00:00:53.802, $GPGGA, 000052, 2840.906, N, 08828.568, W, 1, 09,1.00,0,M,,,,*22
06/02/2010, 00:01:03.802, $GPGGA, 000102, 2840.895, N, 08828.585, W, 1, 09,0.89,0,M,,,,*2E
06/02/2010, 00:01:13.818, $GPGGA, 000112, 2840.883, N, 08828.600, W, 1, 09,0.89,0,M,,,,*26
*/
KKStr dateStr = fields[0];
KKStr timeStr = fields[1];
KKStr latStr = fields[4];
KKStr logStr = fields[6];
auto x = latStr.LocateCharacter ('.');
if (!x)
continue;
KKStr latMinStr = latStr.SubStrPart (x - 2);
KKStr latDegStr = latStr.SubStrSeg (0, x - 2);
double latitude = latDegStr.ToDouble () + latMinStr.ToDouble () / 60.0;
if (fields[5].EqualIgnoreCase ("S"))
latitude = 0.0 - latitude;
x = logStr.LocateCharacter ('.');
if (!x)
continue;
KKStr logMinStr = logStr.SubStrPart (x - 2);
KKStr logDegStr = logStr.SubStrSeg (0, x - 2);
double longitude = logDegStr.ToDouble () + logMinStr.ToDouble () / 60.0;
if (fields[7].EqualIgnoreCase ("W"))
longitude = 0.0 - longitude;
DateType gmtDate (dateStr);
TimeType gmtTime (timeStr);
DateTime gmtDateTime (gmtDate, gmtTime);
DateTime localTime = gmtDateTime;
localTime.HoursAdd (-4);
DateTime startDT = localTime;
DateTime endDT = localTime;
if (firstPass)
{
firstPass = false;
startDT.SecondsAdd (-180);
}
//.........这里部分代码省略.........