[4271] | 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
|
---|
[8127] | 25 | to display error bars or the area between 2 curves.
|
---|
[4271] | 26 | */
|
---|
[8127] | 27 | class QWT_EXPORT QwtPlotIntervalCurve:
|
---|
| 28 | public QwtPlotSeriesItem, public QwtSeriesStore<QwtIntervalSample>
|
---|
[4271] | 29 | {
|
---|
| 30 | public:
|
---|
| 31 | /*!
|
---|
| 32 | \brief Curve styles.
|
---|
| 33 | The default setting is QwtPlotIntervalCurve::Tube.
|
---|
| 34 |
|
---|
| 35 | \sa setStyle(), style()
|
---|
| 36 | */
|
---|
| 37 | enum CurveStyle
|
---|
| 38 | {
|
---|
| 39 | /*!
|
---|
| 40 | Don't draw a curve. Note: This doesn't affect the symbols.
|
---|
| 41 | */
|
---|
| 42 | NoCurve,
|
---|
| 43 |
|
---|
| 44 | /*!
|
---|
| 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().
|
---|
| 48 | */
|
---|
| 49 | Tube,
|
---|
| 50 |
|
---|
| 51 | /*!
|
---|
| 52 | Styles >= QwtPlotIntervalCurve::UserCurve are reserved for derived
|
---|
| 53 | classes that overload drawSeries() with
|
---|
| 54 | additional application specific curve types.
|
---|
| 55 | */
|
---|
| 56 | UserCurve = 100
|
---|
| 57 | };
|
---|
| 58 |
|
---|
| 59 | /*!
|
---|
| 60 | Attributes to modify the drawing algorithm.
|
---|
| 61 | \sa setPaintAttribute(), testPaintAttribute()
|
---|
| 62 | */
|
---|
| 63 | enum PaintAttribute
|
---|
| 64 | {
|
---|
| 65 | /*!
|
---|
| 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.
|
---|
| 69 | */
|
---|
| 70 | ClipPolygons = 0x01,
|
---|
| 71 |
|
---|
| 72 | //! Check if a symbol is on the plot canvas before painting it.
|
---|
| 73 | ClipSymbol = 0x02
|
---|
| 74 | };
|
---|
| 75 |
|
---|
| 76 | //! Paint attributes
|
---|
| 77 | typedef QFlags<PaintAttribute> PaintAttributes;
|
---|
| 78 |
|
---|
| 79 | explicit QwtPlotIntervalCurve( const QString &title = QString::null );
|
---|
| 80 | explicit QwtPlotIntervalCurve( const QwtText &title );
|
---|
| 81 |
|
---|
| 82 | virtual ~QwtPlotIntervalCurve();
|
---|
| 83 |
|
---|
| 84 | virtual int rtti() const;
|
---|
| 85 |
|
---|
| 86 | void setPaintAttribute( PaintAttribute, bool on = true );
|
---|
| 87 | bool testPaintAttribute( PaintAttribute ) const;
|
---|
| 88 |
|
---|
| 89 | void setSamples( const QVector<QwtIntervalSample> & );
|
---|
[8127] | 90 | void setSamples( QwtSeriesData<QwtIntervalSample> * );
|
---|
[4271] | 91 |
|
---|
[8127] | 92 | void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
|
---|
[4271] | 93 | void setPen( const QPen & );
|
---|
| 94 | const QPen &pen() const;
|
---|
| 95 |
|
---|
| 96 | void setBrush( const QBrush & );
|
---|
| 97 | const QBrush &brush() const;
|
---|
| 98 |
|
---|
| 99 | void setStyle( CurveStyle style );
|
---|
| 100 | CurveStyle style() const;
|
---|
| 101 |
|
---|
| 102 | void setSymbol( const QwtIntervalSymbol * );
|
---|
| 103 | const QwtIntervalSymbol *symbol() const;
|
---|
| 104 |
|
---|
| 105 | virtual void drawSeries( QPainter *p,
|
---|
| 106 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 107 | const QRectF &canvasRect, int from, int to ) const;
|
---|
| 108 |
|
---|
| 109 | virtual QRectF boundingRect() const;
|
---|
| 110 |
|
---|
[8127] | 111 | virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
|
---|
| 112 |
|
---|
[4271] | 113 | protected:
|
---|
| 114 |
|
---|
| 115 | void init();
|
---|
| 116 |
|
---|
| 117 | virtual void drawTube( QPainter *,
|
---|
| 118 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 119 | const QRectF &canvasRect, int from, int to ) const;
|
---|
| 120 |
|
---|
| 121 | virtual void drawSymbols( QPainter *, const QwtIntervalSymbol &,
|
---|
| 122 | const QwtScaleMap &xMap, const QwtScaleMap &yMap,
|
---|
| 123 | const QRectF &canvasRect, int from, int to ) const;
|
---|
| 124 |
|
---|
| 125 | private:
|
---|
| 126 | class PrivateData;
|
---|
| 127 | PrivateData *d_data;
|
---|
| 128 | };
|
---|
| 129 |
|
---|
| 130 | Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotIntervalCurve::PaintAttributes )
|
---|
| 131 |
|
---|
| 132 | #endif
|
---|