Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef PLOT2D_PLOTITEMS_H
00026 #define PLOT2D_PLOTITEMS_H
00027
00028 #include "Plot2d.h"
00029
00030 #include <qwt_legend_item.h>
00031 #include <qwt_plot_item.h>
00032 #include <qwt_plot_curve.h>
00033 #include <qwt_interval_data.h>
00034 #include <qwt_plot.h>
00035
00036 class PLOT2D_EXPORT Plot2d_QwtLegendItem : public QwtLegendItem
00037 {
00038 public:
00039 enum YAxisIdentifierMode { IM_None = 0, IM_Left, IM_Right };
00040
00041 public:
00042 Plot2d_QwtLegendItem( QWidget* = 0 );
00043 virtual ~Plot2d_QwtLegendItem();
00044
00045 public:
00046 void setYAxisIdentifierMode( const int );
00047
00048 protected:
00049 virtual void drawIdentifier( QPainter*, const QRect& ) const;
00050
00051 private:
00052 int myYAxisIdentifierMode;
00053 QPixmap myYAxisLeftIcon;
00054 QPixmap myYAxisRightIcon;
00055 int mySpacingCollapsed;
00056 int mySpacingExpanded;
00057 };
00058
00059 class PLOT2D_EXPORT Plot2d_QwtPlotCurve : public QwtPlotCurve
00060 {
00061 public:
00062 Plot2d_QwtPlotCurve( const QString&, QwtPlot::Axis = QwtPlot::yLeft );
00063 virtual ~Plot2d_QwtPlotCurve();
00064
00065 public:
00066 virtual void setYAxisIdentifierEnabled( const bool );
00067
00068 protected:
00069 virtual void updateLegend( QwtLegend* ) const;
00070 virtual QWidget* legendItem() const;
00071
00072 private:
00073 QwtPlot::Axis myYAxis;
00074 bool myYAxisIdentifierEnabled;
00075 };
00076
00077 class PLOT2D_EXPORT Plot2d_HistogramQwtItem: public QwtPlotItem
00078 {
00079 public:
00080 enum HistogramAttribute
00081 {
00082 Auto = 0,
00083 Xfy = 1
00084 };
00085
00086 explicit Plot2d_HistogramQwtItem( const QString& = QString() );
00087 explicit Plot2d_HistogramQwtItem( const QwtText& );
00088 virtual ~Plot2d_HistogramQwtItem();
00089
00090 void setData( const QwtIntervalData& );
00091 const QwtIntervalData& data() const;
00092
00093 void setColor( const QColor& );
00094 QColor color() const;
00095
00096 virtual QwtDoubleRect boundingRect() const;
00097 virtual int rtti() const;
00098 virtual void draw( QPainter*, const QwtScaleMap&,
00099 const QwtScaleMap&, const QRect& ) const;
00100
00101 void setBaseline( double );
00102 double baseline() const;
00103
00104 void setHistogramAttribute( HistogramAttribute, bool = true );
00105 bool testHistogramAttribute( HistogramAttribute ) const;
00106
00107 protected:
00108 virtual void drawBar( QPainter*, Qt::Orientation, const QRect& ) const;
00109
00110 private:
00111 void init();
00112
00113 private:
00114 int myAttributes;
00115 QwtIntervalData myData;
00116 QColor myColor;
00117 double myReference;
00118 };
00119
00120 class PLOT2D_EXPORT Plot2d_HistogramItem : public Plot2d_HistogramQwtItem
00121 {
00122 public:
00123 explicit Plot2d_HistogramItem( const QString& = QString() );
00124 explicit Plot2d_HistogramItem( const QwtText& );
00125 virtual ~Plot2d_HistogramItem();
00126
00127 QList<QRect> getBars() const;
00128
00129 virtual void updateLegend( QwtLegend* ) const;
00130 virtual void draw( QPainter*, const QwtScaleMap&,
00131 const QwtScaleMap&, const QRect& ) const;
00132
00133 void setCrossItems( bool theCross );
00134 bool isCrossItems() const;
00135
00136 protected:
00137 void drawRectAndLowers( QPainter*, Qt::Orientation,
00138 const QRect& ) const;
00139 int getCrossedTop( const QRect& ) const;
00140
00141 protected:
00142 QList<QRect> myBarItems;
00143 bool myCrossed;
00144 };
00145
00146 #endif // PLOT2D_PLOTITEMS_H