00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_PLOT_ITEM_H
00011 #define QWT_PLOT_ITEM_H
00012
00013 #include "qwt_global.h"
00014 #include "qwt_legend_itemmanager.h"
00015 #include "qwt_text.h"
00016 #include <qrect.h>
00017
00018 class QString;
00019 class QPainter;
00020 class QWidget;
00021 class QwtPlot;
00022 class QwtLegend;
00023 class QwtScaleMap;
00024 class QwtScaleDiv;
00025
00064 class QWT_EXPORT QwtPlotItem: public QwtLegendItemManager
00065 {
00066 public:
00073 enum RttiValues
00074 {
00075 Rtti_PlotItem = 0,
00076
00077 Rtti_PlotGrid,
00078 Rtti_PlotScale,
00079 Rtti_PlotMarker,
00080 Rtti_PlotCurve,
00081 Rtti_PlotCurve3D,
00082 Rtti_PlotIntervalCurve,
00083 Rtti_PlotHistogram,
00084 Rtti_PlotSpectrogram,
00085 Rtti_PlotSVG,
00086
00087 Rtti_PlotUserItem = 1000
00088 };
00089
00101 enum ItemAttribute
00102 {
00103 Legend = 1,
00104 AutoScale = 2
00105 };
00106
00108 enum RenderHint
00109 {
00110 RenderAntialiased = 1
00111 };
00112
00113 explicit QwtPlotItem(const QwtText &title = QwtText());
00114 virtual ~QwtPlotItem();
00115
00116 void attach(QwtPlot *plot);
00117
00125 void detach() { attach(NULL); }
00126
00127 QwtPlot *plot() const;
00128
00129 void setTitle(const QString &title);
00130 void setTitle(const QwtText &title);
00131 const QwtText &title() const;
00132
00133 virtual int rtti() const;
00134
00135 void setItemAttribute(ItemAttribute, bool on = true);
00136 bool testItemAttribute(ItemAttribute) const;
00137
00138 void setRenderHint(RenderHint, bool on = true);
00139 bool testRenderHint(RenderHint) const;
00140
00141 double z() const;
00142 void setZ(double z);
00143
00144 void show();
00145 void hide();
00146 virtual void setVisible(bool);
00147 bool isVisible () const;
00148
00149 void setAxis(int xAxis, int yAxis);
00150
00151 void setXAxis(int axis);
00152 int xAxis() const;
00153
00154 void setYAxis(int axis);
00155 int yAxis() const;
00156
00157 virtual void itemChanged();
00158
00167 virtual void draw(QPainter *painter,
00168 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
00169 const QRectF &canvasRect) const = 0;
00170
00171 virtual QRectF boundingRect() const;
00172
00173 virtual void updateLegend(QwtLegend *) const;
00174 virtual void updateScaleDiv(const QwtScaleDiv&,
00175 const QwtScaleDiv&);
00176
00177 virtual QWidget *legendItem() const;
00178
00179 QRectF scaleRect(const QwtScaleMap &, const QwtScaleMap &) const;
00180 QRectF paintRect(const QwtScaleMap &, const QwtScaleMap &) const;
00181
00182 QRectF xTransform(const QwtScaleMap &, const QwtScaleMap &,
00183 const QRectF&) const;
00184 QRectF invTransform(const QwtScaleMap &, const QwtScaleMap &,
00185 const QRectF &) const;
00186
00187 private:
00188
00189 QwtPlotItem( const QwtPlotItem & );
00190 QwtPlotItem &operator=( const QwtPlotItem & );
00191
00192 class PrivateData;
00193 PrivateData *d_data;
00194 };
00195
00196 #endif