--- a/igc.h Fri Jan 27 17:22:55 2012 +0100
+++ b/igc.h Fri Jan 27 22:36:11 2012 +0100
@@ -3,20 +3,37 @@
#include "pch.h"
+/*! Fix - describes one GPS fix.
+ *
+ * A GPS fix is represented by a timestamp (no day included?),
+ * a longitude, a latitude, the barometric altitude, the
+ * GPS altitude and a flag, if the GPS altitude is valid.
+ */
class Fix {
public:
- enum Source { baro, gps };
+ //! Selector for the source of the altitude.
+ enum Source {
+ baro, //!< source from barometer
+ gps, //!< source from gps
+ };
Fix() { }
- Fix(const QString&);
+ Fix(const QString&); //!< parse the string for the fix
+ //! Get the altitude.
+ //! \param s source of the altitude (gps or baro)
+ //! \return altitude in m
int altitude(Source s = gps) const { return alt_[s]; }
- QTime time() const { return time_; }
- bool is3d() const { return is3d_; }
- QPair<QTime, int> altitudeFix(Source s) const { return qMakePair(time_, alt_[s]); }
+
+ QTime time() const { return time_; } //!< time of the fix
+ bool is3d() const { return is3d_; } //!< is the gps alt valid?
- QString longitude() const { return gps_.lon; }
- QString latitude() const { return gps_.lat; };
+ //! Get an altitude fix (time+altitude)
+ //! \param s source of the altitude (default: gps)
+ QPair<QTime, int> altitudeFix(Source s = gps) const { return qMakePair(time_, alt_[s]); }
+
+ QString longitude() const { return gps_.lon; } //!< longitude of the fix
+ QString latitude() const { return gps_.lat; }; //!< latitude of the fix
private:
QTime time_;
@@ -25,21 +42,30 @@
int alt_[2];
};
+//! List of Fixes.
typedef QList<Fix> Fixes;
+/*! Representation of the IGC file.
+ *
+ * This class represends the contents of an IGC file.
+ * It reads from a text stream an stores the header data as well as the
+ * fixes. The checksum verification is not implemented currently.
+ */
class IGC {
public:
- void read(QTextStream&);
- QString device() const { return device_; }
- QString pilot() const { return pilot_; }
- QString glider() const { return glider_; }
- QDate date() const { return date_; }
+
+ //! Read the IGC records.
+ //! \param s a (file) stream containing the records
+ void read(QTextStream& s);
+ QString device() const { return device_; } //!< the generator of the IGC file
+ QString pilot() const { return pilot_; } //!< pilots name
+ QString glider() const { return glider_; } //!< type of glider
+ QDate date() const { return date_; } //!< date of the record (start date?)
- Fixes fixes() const { return fixes_; }
- Fixes fixes() { return fixes_; }
+ Fixes fixes() const { return fixes_; } //!< list of fixes
- Fix start() const { return start_; }
- Fix landing() const { return landing_; }
+ Fix start() const { return start_; } //!< the very first fix
+ Fix landing() const { return landing_; } //!< the very last fix
private:
QString device_, pilot_, glider_;