/* * Title: BQwtPlot.cpp * Author: M.Thomas BEAM Ltd * Date: 2007-04-19 * * Contents: Enhanced plotting widget. Used for tms testing. * * */ #ifndef BQWTPLOT_H #define BQWTPLOT_H #include <qwt/qwt_plot.h> #include <qdialog.h> #include <qspinbox.h> #include <BList.h> #include <BString.h> #include <BArray.h> class BQwtPlot; class CurveInfo { public: CurveInfo(){}; CurveInfo(BString ititle,BString icolour,BQwtPlot* iplot,double igain = 1,double ioffset = 0); public: void applyGainAndOffset(); BQwtPlot* plot; long curve; BString title; BString colour; double gain; double offset; BArray<double> data; }; class BQwtPlotControl: public QDialog { Q_OBJECT public: BQwtPlotControl(QWidget*p,BQwtPlot* plot); private slots: void update(); void close(); void scroll(); void zoomIn(); void zoomOut(); private: BQwtPlot* oplot; QScrollBar* oscroll; QPushButton* ozoomIn; QPushButton* ozoomOut; QSpinBox* oymin; QSpinBox* oymax; }; class BQwtPlotControlBasic: public QWidget { Q_OBJECT public: BQwtPlotControlBasic(QWidget*p,BQwtPlot* plot); void addPlot(BQwtPlot* plot); // Add plot to be managed private slots: void scroll(); void zoomIn(); void zoomOut(); private: BList<BQwtPlot*> oplots; QScrollBar* oscroll; QPushButton* ozoomIn; QPushButton* ozoomOut; }; class BQwtPlot : public QwtPlot { Q_OBJECT public: BQwtPlot(QWidget *p = 0, const char *name = 0); ~BQwtPlot() {} void setRange(int range); void getRange(int& max,int& actual); void syntheticWheelEvent(QWheelEvent * e ); void setPosition(int pos); void zoomIn(); void zoomOut(); void setAxisScale(int axis,double mn,double mx); BQwtPlotControl* getPlotControls(); // Simple controls- scrollbar. void getYLeftMaxMin(double& min,double& max); signals: void plotEvent(QWheelEvent *e); void plotEvent(); protected: void wheelEvent(QWheelEvent * e ); public slots: void mouseReleased(const QMouseEvent& e ); private: void scroll(int scroll); void zoomX(int zoom,int zoompos); double oyLeftMax; double oyLeftMin; int oxmin; int oxmax; int oxrange; int oxrangeMax; int oxzoom; int oxscroll; BQwtPlotControl* ocontrol; }; #endif