Updraft  1.0
Open source glider flight visualisation tool.
plotwidget.h
Go to the documentation of this file.
00001 #ifndef UPDRAFT_SRC_PLUGINS_IGCVIEWER_PLOTWIDGET_H_
00002 #define UPDRAFT_SRC_PLUGINS_IGCVIEWER_PLOTWIDGET_H_
00003 
00004 #include <QColor>
00005 #include <QPen>
00006 #include <QWidget>
00007 #include <QTextEdit>
00008 #include <QTime>
00009 
00010 #include "igcinfo.h"
00011 #include "plotaxes.h"
00012 #include "graphlabels.h"
00013 #include "infotexts.h"
00014 #include "plotpainters.h"
00015 
00016 namespace Updraft {
00017 namespace IgcViewer {
00018 
00020 struct PickData {
00021   PickData(int xLine_, int fixIndex_)
00022     : xLine(xLine_), fixIndex(fixIndex_) {}
00023 
00025   int xLine;
00026 
00028   int fixIndex;
00029 };
00030 
00032 class PlotWidget : public QWidget {
00033   Q_OBJECT
00034 
00035  public:
00036   PlotWidget(SegmentInfo* segmentInfo, FixInfo* altitudeInfo,
00037     FixInfo* verticalSpeedInfo, FixInfo *groundSpeedInfo);
00038 
00040   void addPickedFix(int index);
00041 
00046   void addPickedLine(int x);
00047 
00048   QList<QString>* getSegmentsStatTexts();
00049   QList<QString>* getPointsStatTexts();
00050 
00051  signals:
00053   void updateCurrentInfo(const QString& text);
00054 
00057   void updateText();
00058 
00060   void fixWasPicked(int index);
00061 
00063   void fixIsPointedAt(int index);
00064 
00066   void clearMarkers();
00067 
00068  private:
00069   void paintEvent(QPaintEvent* paintEvent);
00070   void mouseMoveEvent(QMouseEvent* mouseEvent);
00071   void mousePressEvent(QMouseEvent* mouseEvent);
00072   void leaveEvent(QEvent* leaveEvent);
00073   void resizeEvent(QResizeEvent* resizeEvent);
00074 
00075   QSize sizeHint() const;
00076 
00077   void redrawGraphPicture();
00078 
00079   QString createPointStatText(int xLine, int fixListIndex);
00080   QString createSegmentStatText(int startPointIndex, int endPointIndex);
00081 
00084   void updatePickedTexts(int i);
00085 
00087   void resetStats();
00088 
00090   QTime getTimeFromSecs(int timeInSecs);
00091 
00093   int chooseFixIndex(int start, int end);
00094 
00096   int xLine;
00097 
00099   QList<PickData> pickedFixes;
00100 
00102   QList<int> pickedPositions;
00103 
00105   QList<QString> segmentsStatTexts;
00106 
00108   QList<QString> pickedFixesStatTexts;
00109 
00110   QImage* graphPicture;
00111 
00112   QVector<Label*> labels;
00113   PickedLabel* pickedLabel;
00114 
00115   PlotAxes *altitudeAxes;
00116   PlotAxes *verticalSpeedAxes;
00117   PlotAxes *groundSpeedAxes;
00118 
00119   AltitudePlotPainter* altitudePlotPainter;
00120   VerticalSpeedPlotPainter* verticalSpeedPlotPainter;
00121   GroundSpeedPlotPainter* groundSpeedPlotPainter;
00122 
00123   SegmentInfo* segmentInfo;
00124   FixInfo* altitudeInfo;
00125   FixInfo* verticalSpeedInfo;
00126   FixInfo *groundSpeedInfo;
00127 
00129   bool mouseOver;
00130 
00132   static const int OFFSET_X = 15;
00133   static const int OFFSET_Y = 10;
00134 
00135   static const QColor BG_COLOR;
00136   static const QPen ALTITUDE_PEN;
00137   static const QPen VERTICAL_SPEED_PEN;
00138   static const QPen GROUND_SPEED_PEN;
00139 
00140   static const QPen MOUSE_LINE_PEN;
00141   static const QPen MOUSE_LINE_PICKED_PEN;
00142 };
00143 
00144 }  // End namespace Updraft
00145 }  // End namespace IgcViewer
00146 
00147 #endif  // UPDRAFT_SRC_PLUGINS_IGCVIEWER_PLOTWIDGET_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines