# HG changeset patch # User Heiko Schlittermann (JUMPER) # Date 1327250121 -3600 # Node ID d927333c8ffe094f3793d89f27e93d8c2dbe88f9 # Parent e1abdc4804853155a4f204e41f57f8ce41b32159 parse the B records diff -r e1abdc480485 -r d927333c8ffe igc.cc --- a/igc.cc Sun Jan 22 16:31:20 2012 +0100 +++ b/igc.cc Sun Jan 22 17:35:21 2012 +0100 @@ -11,12 +11,24 @@ QString line = in.readLine(); QString key = line.section(':', 0, 0); QString value = line.section(':', 1, 1).simplified(); - qDebug() << key << "--" << value; - if (key == "FPLTPILOT") thePilot = value; - if (key == "FGTYGLIDERTYPE") theGlider = value; + if (key.startsWith("FPLT")) thePilot = value; + if (key.startsWith("FGTY")) theGlider = value; } break; - case 'B': points << in.readLine(); break; + case 'B': fixes << in.readLine(); break; } } } + +Fix::Fix(const QString &s) +{ + int pos = 0; + theTime = s.mid(pos, 6); pos += 6; + gps.lat = s.mid(pos, 8); pos += 8; + gps.lon = s.mid(pos, 9); pos += 9; + valid = s.mid(pos, 1); pos += 1; + theAlt.press = s.mid(pos, 5).toInt(); pos += 5; + theAlt.gps = s.mid(pos, 5).toInt(); pos += 5; + + qDebug() << theAlt.press << " | " << theAlt.gps; +} diff -r e1abdc480485 -r d927333c8ffe igc.h --- a/igc.h Sun Jan 22 16:31:20 2012 +0100 +++ b/igc.h Sun Jan 22 17:35:21 2012 +0100 @@ -3,6 +3,23 @@ #include "pch.h" +class Fix { + public: + Fix(const QString&); + private: + QString theTime, valid; + struct { + QString lon; + QString lat; + } gps; + struct { + int press; + int gps; + } theAlt; +}; + +typedef QList Fixes; + class IGC { public: void read(QTextStream&); @@ -11,6 +28,7 @@ private: QString theAuthor, thePilot, theGlider; QStringList points; + Fixes fixes; }; #endif