Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
qwt_plot_curve.h
1/******************************************************************************
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_CURVE_H
11#define QWT_PLOT_CURVE_H
12
13#include "qwt_global.h"
14#include "qwt_plot_seriesitem.h"
15
16#include <qstring.h>
17
18class QwtScaleMap;
19class QwtSymbol;
20class QwtCurveFitter;
21template< typename T > class QwtSeriesData;
22class QwtText;
23class QPainter;
24class QPolygonF;
25class QPen;
26
56class QWT_EXPORT QwtPlotCurve
57 : public QwtPlotSeriesItem
58 , public QwtSeriesStore< QPointF >
59{
60 public:
66 {
70 NoCurve = -1,
71
78
84
91
99
105 UserCurve = 100
106 };
107
113 {
118 Inverted = 0x01,
119
130 Fitted = 0x02
131 };
132
133 Q_DECLARE_FLAGS( CurveAttributes, CurveAttribute )
134
135
143 {
148 LegendNoAttribute = 0x00,
149
154 LegendShowLine = 0x01,
155
159 LegendShowSymbol = 0x02,
160
165 LegendShowBrush = 0x04
166 };
167
169
170
177 {
183 ClipPolygons = 0x01,
184
191 FilterPoints = 0x02,
192
198 MinimizeMemory = 0x04,
199
207 ImageBuffer = 0x08,
208
231 FilterPointsAggressive = 0x10,
232 };
233
234 Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
235
236 explicit QwtPlotCurve( const QString& title = QString() );
237 explicit QwtPlotCurve( const QwtText& title );
238
239 virtual ~QwtPlotCurve();
240
241 virtual int rtti() const QWT_OVERRIDE;
242
243 void setPaintAttribute( PaintAttribute, bool on = true );
244 bool testPaintAttribute( PaintAttribute ) const;
245
246 void setLegendAttribute( LegendAttribute, bool on = true );
247 bool testLegendAttribute( LegendAttribute ) const;
248
249 void setLegendAttributes( LegendAttributes );
250 LegendAttributes legendAttributes() const;
251
252 void setRawSamples( const double* xData, const double* yData, int size );
253 void setRawSamples( const float* xData, const float* yData, int size );
254
255 void setRawSamples( const double* yData, int size );
256 void setRawSamples( const float* yData, int size );
257
258 void setSamples( const double* xData, const double* yData, int size );
259 void setSamples( const float* xData, const float* yData, int size );
260
261 void setSamples( const double* yData, int size );
262 void setSamples( const float* yData, int size );
263
264 void setSamples( const QVector< double >& yData );
265 void setSamples( const QVector< float >& yData );
266
267 void setSamples( const QVector< double >& xData, const QVector< double >& yData );
268 void setSamples( const QVector< float >& xData, const QVector< float >& yData );
269
270 void setSamples( const QVector< QPointF >& );
271 void setSamples( QwtSeriesData< QPointF >* );
272
273 virtual int closestPoint( const QPointF& pos, double* dist = NULL ) const;
274 virtual int adjacentPoint( Qt::Orientation orientation, qreal value ) const;
275
276 qreal interpolatedValueAt( Qt::Orientation, double ) const;
277
278 double minXValue() const;
279 double maxXValue() const;
280 double minYValue() const;
281 double maxYValue() const;
282
283 void setCurveAttribute( CurveAttribute, bool on = true );
284 bool testCurveAttribute( CurveAttribute ) const;
285
286 void setPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
287 void setPen( const QPen& );
288 const QPen& pen() const;
289
290 void setBrush( const QBrush& );
291 const QBrush& brush() const;
292
293 void setBaseline( double );
294 double baseline() const;
295
296 void setStyle( CurveStyle style );
297 CurveStyle style() const;
298
299 void setSymbol( QwtSymbol* );
300 const QwtSymbol* symbol() const;
301
302 void setCurveFitter( QwtCurveFitter* );
303 QwtCurveFitter* curveFitter() const;
304
305 virtual void drawSeries( QPainter*,
306 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
307 const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
308
309 virtual QwtGraphic legendIcon( int index, const QSizeF& ) const QWT_OVERRIDE;
310
311 protected:
312
313 void init();
314
315 virtual void drawCurve( QPainter*, int style,
316 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
317 const QRectF& canvasRect, int from, int to ) const;
318
319 virtual void drawSymbols( QPainter*, const QwtSymbol&,
320 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
321 const QRectF& canvasRect, int from, int to ) const;
322
323 virtual void drawLines( QPainter*,
324 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
325 const QRectF& canvasRect, int from, int to ) const;
326
327 virtual void drawSticks( QPainter*,
328 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
329 const QRectF& canvasRect, int from, int to ) const;
330
331 virtual void drawDots( QPainter*,
332 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
333 const QRectF& canvasRect, int from, int to ) const;
334
335 virtual void drawSteps( QPainter*,
336 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
337 const QRectF& canvasRect, int from, int to ) const;
338
339 virtual void fillCurve( QPainter*,
340 const QwtScaleMap&, const QwtScaleMap&,
341 const QRectF& canvasRect, QPolygonF& ) const;
342
343 void closePolyline( QPainter*,
344 const QwtScaleMap&, const QwtScaleMap&, QPolygonF& ) const;
345
346 private:
347 class PrivateData;
348 PrivateData* m_data;
349};
350
352inline double QwtPlotCurve::minXValue() const
353{
354 return boundingRect().left();
355}
356
358inline double QwtPlotCurve::maxXValue() const
359{
360 return boundingRect().right();
361}
362
364inline double QwtPlotCurve::minYValue() const
365{
366 return boundingRect().top();
367}
368
370inline double QwtPlotCurve::maxYValue() const
371{
372 return boundingRect().bottom();
373}
374
375Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::PaintAttributes )
376Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::LegendAttributes )
377Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::CurveAttributes )
378
379#endif
Abstract base class for a curve fitter.
A paint device for scalable graphics.
Definition qwt_graphic.h:76
A plot item, that represents a series of points.
QFlags< LegendAttribute > LegendAttributes
double maxXValue() const
boundingRect().right()
double minYValue() const
boundingRect().top()
double maxYValue() const
boundingRect().bottom()
QFlags< PaintAttribute > PaintAttributes
QFlags< CurveAttribute > CurveAttributes
virtual int rtti() const
Base class for plot items representing a series of samples.
virtual QRectF boundingRect() const override
A scale map.
Abstract interface for iterating over samples.
Class storing a QwtSeriesData object.
A class for drawing symbols.
Definition qwt_symbol.h:32
A class representing a text.
Definition qwt_text.h:52