1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
10 #ifndef QWT_PLOT_INTERVAL_CURVE_H
11 #define QWT_PLOT_INTERVAL_CURVE_H
13 #include "qwt_global.h"
14 #include "qwt_plot_seriesitem.h"
15 #include "qwt_series_data.h"
17 class QwtIntervalSymbol
;
20 \brief QwtPlotIntervalCurve represents a series of samples, where each value
21 is associated with an interval ( \f$[y1,y2] = f(x)\f$ ).
23 The representation depends on the style() and an optional symbol()
24 that is displayed for each interval. QwtPlotIntervalCurve might be used
25 to display error bars or the area between 2 curves.
27 class QWT_EXPORT QwtPlotIntervalCurve
:
28 public QwtPlotSeriesItem
, public QwtSeriesStore
<QwtIntervalSample
>
33 The default setting is QwtPlotIntervalCurve::Tube.
35 \sa setStyle(), style()
40 Don't draw a curve. Note: This doesn't affect the symbols.
45 Build 2 curves from the upper and lower limits of the intervals
46 and draw them with the pen(). The area between the curves is
47 filled with the brush().
52 Styles >= QwtPlotIntervalCurve::UserCurve are reserved for derived
53 classes that overload drawSeries() with
54 additional application specific curve types.
60 Attributes to modify the drawing algorithm.
61 \sa setPaintAttribute(), testPaintAttribute()
66 Clip polygons before painting them. In situations, where points
67 are far outside the visible area (f.e when zooming deep) this
68 might be a substantial improvement for the painting performance.
72 //! Check if a symbol is on the plot canvas before painting it.
77 typedef QFlags
<PaintAttribute
> PaintAttributes
;
79 explicit QwtPlotIntervalCurve( const QString
&title
= QString::null
);
80 explicit QwtPlotIntervalCurve( const QwtText
&title
);
82 virtual ~QwtPlotIntervalCurve();
84 virtual int rtti() const;
86 void setPaintAttribute( PaintAttribute
, bool on
= true );
87 bool testPaintAttribute( PaintAttribute
) const;
89 void setSamples( const QVector
<QwtIntervalSample
> & );
90 void setSamples( QwtSeriesData
<QwtIntervalSample
> * );
92 void setPen( const QColor
&, qreal width
= 0.0, Qt::PenStyle
= Qt::SolidLine
);
93 void setPen( const QPen
& );
94 const QPen
&pen() const;
96 void setBrush( const QBrush
& );
97 const QBrush
&brush() const;
99 void setStyle( CurveStyle style
);
100 CurveStyle
style() const;
102 void setSymbol( const QwtIntervalSymbol
* );
103 const QwtIntervalSymbol
*symbol() const;
105 virtual void drawSeries( QPainter
*p
,
106 const QwtScaleMap
&xMap
, const QwtScaleMap
&yMap
,
107 const QRectF
&canvasRect
, int from
, int to
) const;
109 virtual QRectF
boundingRect() const;
111 virtual QwtGraphic
legendIcon( int index
, const QSizeF
& ) const;
117 virtual void drawTube( QPainter
*,
118 const QwtScaleMap
&xMap
, const QwtScaleMap
&yMap
,
119 const QRectF
&canvasRect
, int from
, int to
) const;
121 virtual void drawSymbols( QPainter
*, const QwtIntervalSymbol
&,
122 const QwtScaleMap
&xMap
, const QwtScaleMap
&yMap
,
123 const QRectF
&canvasRect
, int from
, int to
) const;
130 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotIntervalCurve::PaintAttributes
)