00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PLOT_VIEWER_PANEL_HH_
00020 #define PLOT_VIEWER_PANEL_HH_
00021
00022
00023
00024
00025
00026
00027 #include <QWidget>
00028 #include <QHash>
00029 #include <QPair>
00030 #include <QGraphicsView>
00031 #include "plot_axis_horizontal.hh"
00032 #include "plot_axis_vertical.hh"
00033
00034 namespace ost{namespace gui{
00035
00036 class DLLEXPORT_OST_GUI PlotViewerPanel:public QGraphicsView
00037 {
00038 Q_OBJECT
00039 public:
00040 PlotViewerPanel(QGraphicsScene * scene, QWidget* parent=0);
00041 virtual ~PlotViewerPanel();
00042 void SetMinimumX(Real x);
00043 void SetMaximumX(Real x);
00044 void SetMinimumY(Real x);
00045 void SetMaximumY(Real x);
00046 void SetMinMax(Real xmin,Real maxx,Real miny, Real maxy);
00047 void SetAutofit(bool fit=true);
00048 Real GetMinimumX() const;
00049 Real GetMaximumX() const;
00050 Real GetMinimumY() const;
00051 Real GetMaximumY() const;
00052 Real GetDelta() const;
00053 public slots:
00054 void OnZoomX(int delta,QPoint pos);
00055 void OnZoomY(int delta,QPoint pos);
00056 void OnTranslate(Real dx, Real dy);
00057 void update();
00058 signals:
00059 void rangeChanged(Real start, Real end, Real delta);
00060 protected:
00061 virtual void wheelEvent ( QWheelEvent * e );
00062 virtual void resizeEvent ( QResizeEvent * event );
00063 virtual void scrollContentsBy ( int dx, int dy );
00064 virtual void mousePressEvent ( QMouseEvent * event );
00065 virtual void mouseMoveEvent ( QMouseEvent * event );
00066 void UpdateAxes();
00067 QTransform GetTransform(QRectF scenerect, QRect viewrect);
00068 PlotAxisHorizontal* axis_horizontal_;
00069 PlotAxisVertical* axis_vertical_;
00070 QPointF global_mouse_pos_;
00071 bool autofit_;
00072 };
00073
00074 }}
00075
00076 #endif