1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
---|
2 | * Qwt Widget Library
|
---|
3 | * Copyright (C) 1997 Josef Wilgen
|
---|
4 | * Copyright (C) 2002 Uwe Rathmann
|
---|
5 | *
|
---|
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 | *****************************************************************************/
|
---|
9 |
|
---|
10 | #ifndef QWT_PLOT_INTERVAL_CURVE_H
|
---|
11 | #define QWT_PLOT_INTERVAL_CURVE_H
|
---|
12 |
|
---|
13 | #include "qwt_global.h"
|
---|
14 | #include "qwt_plot_seriesitem.h"
|
---|
15 | #include "qwt_series_data.h"
|
---|
16 |
|
---|
17 | class QwtIntervalSymbol;
|
---|
18 |
|
---|
19 | /*!
|
---|
20 | \brief QwtPlotIntervalCurve represents a series of samples, where each value
|
---|
21 | is associated with an interval ( \f$[y1,y2] = f(x)\f$ ).
|
---|
22 |
|
---|
23 | The representation depends on the style() and an optional symbol()
|
---|
24 | that is displayed for each interval. QwtPlotIntervalCurve might be used
|
---|
25 | to disply error bars or the area between 2 curves.
|
---|
26 | */
|
---|
27 |
|
---|
28 | class QWT_EXPORT QwtPlotIntervalCurve: public QwtPlotSeriesItem<QwtIntervalSample>
|
---|
29 | {
|
---|
30 | public:
|
---|
31 | /*!
|
---|
32 | \brief Curve styles.
|
---|
33 | The default setting is QwtPlotIntervalCurve::Tube.
|
---|
34 |
|
---|
35 | \sa setStyle(), style()
|
---|
36 | */
|
---|
37 |
|
---|
38 | enum CurveStyle
|
---|
39 | {
|
---|
40 | /*!
|
---|
41 | Don't draw a curve. Note: This doesn't affect the symbols.
|
---|
42 | */
|
---|
43 | NoCurve,
|
---|
44 |
|
---|
45 | /*!
|
---|
46 | Build 2 curves from the upper and lower limits of the intervals
|
---|
47 | and draw them with the pen(). The area between the curves is
|
---|
48 | filled with the brush().
|
---|
49 | */
|
---|
50 | Tube,
|
---|
51 |
|
---|
52 | /*!
|
---|
53 | Styles >= QwtPlotIntervalCurve::UserCurve are reserved for derived
|
---|
54 | classes that overload drawSeries() with
|
---|
55 | additional application specific curve types.
|
---|
56 | */
|
---|
57 | UserCurve = 100
|
---|
58 | };
|
---|
59 |
|
---|
60 | /*!
|
---|
61 | Attributes to modify the drawing algorithm.
|
---|
62 | \sa setPaintAttribute(), testPaintAttribute()
|
---|
63 | */
|
---|
64 | enum PaintAttribute
|
---|
65 | {
|
---|
66 | /*!
|
---|
67 | Clip polygons before painting them. In situations, where points
|
---|
68 | are far outside the visible area (f.e when zooming deep) this
|
---|
69 | might be a substantial improvement for the painting performance.
|
---|
70 | */
|
---|
71 | ClipPolygons = 0x01,
|
---|
72 |
|
---|
73 | //! Check if a symbol is on the plot canvas before painting it.
|
---|
74 | ClipSymbol = 0x02
|
---|
75 | };
|
---|
76 |
|
---|
77 | //! Paint attributes
|
---|
78 | typedef QFlags<PaintAttribute> PaintAttributes;
|
---|
79 |
|
---|
80 | explicit QwtPlotIntervalCurve( const QString &title = QString::null );
|
---|
81 | explicit QwtPlotIntervalCurve( const QwtText &title );
|
---|
82 |
|
---|
83 | virtual ~QwtPlotIntervalCurve();
|
---|
84 |
|
---|
85 | virtual int rtti() const;
|
---|
86 |
|
---|
87 | void setPaintAttribute( PaintAttribute, bool on = true );
|
---|
88 | bool testPaintAttribute( PaintAttribute ) const;
|
---|
89 |
|
---|
90 | void setSamples( const QVector<QwtIntervalSample> & );
|
---|
91 |
|
---|
92 | void setPen( const QPen & );
|
---|
93 | const QPen &pen() const;
|
---|
94 |
|
---|
95 | void setBrush( const QBrush & );
|
---|
96 | const QBrush &brush() const;
|
---|
97 |
|
---|
98 | void setStyle( CurveStyle style );
|
---|
99 | CurveStyle style() const;
|
---|
100 |
|
---|
101 | void setSymbol( const QwtIntervalSymbol * );
|
---|
102 | const QwtIntervalSymbol *symbol() const;
|
---|
103 |
|
---|
104 | virtual void drawSeries( QPainter *p,
|
---|
105 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
106 | const QRectF &canvasRect, int from, int to ) const;
|
---|
107 |
|
---|
108 | virtual QRectF boundingRect() const;
|
---|
109 | virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const;
|
---|
110 |
|
---|
111 | protected:
|
---|
112 |
|
---|
113 | void init();
|
---|
114 |
|
---|
115 | virtual void drawTube( QPainter *,
|
---|
116 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
117 | const QRectF &canvasRect, int from, int to ) const;
|
---|
118 |
|
---|
119 | virtual void drawSymbols( QPainter *, const QwtIntervalSymbol &,
|
---|
120 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
121 | const QRectF &canvasRect, int from, int to ) const;
|
---|
122 |
|
---|
123 | private:
|
---|
124 | class PrivateData;
|
---|
125 | PrivateData *d_data;
|
---|
126 | };
|
---|
127 |
|
---|
128 | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotIntervalCurve::PaintAttributes )
|
---|
129 |
|
---|
130 | #endif
|
---|