00001 #ifndef PLOT_SELECTOR_H 00002 #define PLOT_SELECTOR_H 00003 00004 #include <qwt_plot_canvas.h> 00005 #include <qwt_plot_picker.h> 00006 00007 #include "Plot/PlotArea.h" 00008 00009 class PlotSelector : public QwtPlotPicker 00010 { 00011 Q_OBJECT 00012 00013 //===================================================================================== 00014 // Enums 00015 //===================================================================================== 00016 public: 00017 enum Type { Rect, XInterval, YInterval }; 00018 00019 //===================================================================================== 00020 // Constructors and destructor 00021 //===================================================================================== 00022 public: 00023 PlotSelector( QwtPlotCanvas* canvas ); 00024 virtual ~PlotSelector(); 00025 00026 //===================================================================================== 00027 // Signals 00028 //===================================================================================== 00029 00030 //===================================================================================== 00031 // Slots 00032 //===================================================================================== 00033 00034 //===================================================================================== 00035 // Methods 00036 //===================================================================================== 00037 public: 00038 void setType( Type type ) { m_type = type; } 00039 Type type() const { return m_type; } 00040 void setSelectionBrush( QBrush brush ) { m_plotArea->setBrush( brush ); } 00041 QBrush selectionBrush() const { return m_plotArea->brush(); } 00042 void removeSelection(); 00043 QRectF rect() const { return m_plotArea->rect(); } 00044 double xIntervalLowerBound() const { return m_plotArea->xIntervalLowerBound(); } 00045 double xIntervalUpperBound() const { return m_plotArea->xIntervalUpperBound(); } 00046 double yIntervalLowerBound() const { return m_plotArea->yIntervalLowerBound(); } 00047 double yIntervalUpperBound() const { return m_plotArea->yIntervalUpperBound(); } 00048 bool eventFilter( QObject* object, QEvent* event ); 00049 00050 //===================================================================================== 00051 // Members 00052 //===================================================================================== 00053 private: 00054 Type m_type; 00055 QBrush m_brush; 00056 PlotArea* m_plotArea; 00057 bool m_buttonPressed; 00058 QPoint m_beginPoint; 00059 QPoint m_endPoint; 00060 }; 00061 00062 #endif