Updraft  1.0
Open source glider flight visualisation tool.
igcinfo.h
Go to the documentation of this file.
00001 #ifndef UPDRAFT_SRC_PLUGINS_IGCVIEWER_IGCINFO_H_
00002 #define UPDRAFT_SRC_PLUGINS_IGCVIEWER_IGCINFO_H_
00003 
00004 #include <QTime>
00005 #include <QList>
00006 
00007 #include "util/util.h"
00008 
00009 namespace Updraft {
00010 namespace IgcViewer {
00011 
00014 struct TrackFix {
00015   TrackFix(QTime timestamp, Util::Location location,
00016     double x, double y, double z, qreal terrainHeight) :
00017     timestamp(timestamp), location(location), x(x), y(y), z(z),
00018     terrainHeight(terrainHeight) {}
00019 
00020   QTime timestamp;
00021 
00023   Util::Location location;
00024 
00026   qreal x, y, z;
00027 
00029   qreal terrainHeight;
00030 };
00031 
00035 class FixInfo {
00036  public:
00037   virtual ~FixInfo() {}
00038 
00041   virtual void init(const QList<TrackFix> *fixList);
00042 
00045   virtual qreal value(int i) const = 0;
00046 
00048   virtual int indexOfTime(QTime time);
00049 
00052   qreal time(int i) const;
00053 
00055   qreal maxTime() const { return time(count() - 1); }
00056 
00059   qreal absoluteTime(int i);
00060 
00062   QTime timestamp(int i);
00063 
00065   qreal absoluteMaxTime();
00066 
00068   qreal absoluteMinTime();
00069 
00071   virtual void resetGlobalScale();
00072 
00074   virtual void addGlobalScale(const FixInfo* other);
00075 
00077   int count() const { return fixList->count(); }
00078 
00080   qreal min() const { return min_; }
00081 
00083   qreal max() const { return max_; }
00084 
00087   qreal robustMin() const { return robustMin_; }
00088 
00091   qreal robustMax() const { return robustMax_; }
00092 
00094   qreal globalMin() const { return globalMin_; }
00095 
00097   qreal globalMax() const { return globalMax_; }
00098 
00101   qreal globalRobustMin() const { return globalRobustMin_; }
00102 
00105   qreal globalRobustMax() const { return globalRobustMax_; }
00106 
00107  protected:
00108   const QList<TrackFix> *fixList;
00109   qreal min_, max_;
00110   qreal robustMin_, robustMax_;
00111   qreal globalMin_, globalMax_;
00112   qreal globalRobustMin_, globalRobustMax_;
00113 };
00114 
00116 class AltitudeFixInfo : public FixInfo {
00117  public:
00118   qreal value(int i) const;
00119 };
00120 
00122 class SpeedFixInfo : public FixInfo {
00123  public:
00124   qreal value(int i) const;
00125 
00126  private:
00130   qreal speedBefore(int i) const;
00131 
00133   virtual qreal distanceBefore(int i) const = 0;
00134 };
00135 
00137 class GroundSpeedFixInfo : public SpeedFixInfo {
00138  public:
00139   qreal value(int i) const;
00140 
00141  private:
00142   qreal distanceBefore(int i) const;
00143 };
00144 
00146 class VerticalSpeedFixInfo : public SpeedFixInfo {
00147  private:
00148   qreal distanceBefore(int i) const;
00149 };
00150 
00152 class TrackIdFixInfo : public FixInfo {
00153  public:
00154   explicit TrackIdFixInfo(int id);
00155 
00156   qreal value(int i) const;
00157  private:
00158   int id;
00159 };
00160 
00163 class TimeFixInfo : public FixInfo {
00164  public:
00165   void init(const QList<TrackFix> *fixList);
00166   qreal value(int i) const;
00167  private:
00168 };
00169 
00172 class SegmentInfo {
00173  public:
00174   void init(const QList<TrackFix>* fixList_);
00175   qreal avgSpeed(int startIndex, int endIndex);
00176   qreal avgRise(int startIndex, int endIndex);
00177   qreal distance(int startIndex, int endIndex);
00178   qreal heightDifference(int startIndex, int endIndex);
00179 
00180   QTime timestamp(int index);
00181 
00182  private:
00183   const QList<TrackFix>* fixList;
00184 };
00185 
00186 }  // End namespace IgcViewer
00187 }  // End namespace Updraft
00188 
00189 #endif  // UPDRAFT_SRC_PLUGINS_IGCVIEWER_IGCINFO_H_
00190 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines