qwt_plot_curve.h
Go to the documentation of this file.
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_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 
18 class QwtScaleMap;
19 class QwtSymbol;
20 class QwtCurveFitter;
21 template <typename T> class QwtSeriesData;
22 class QwtText;
23 class QPainter;
24 class QPolygonF;
25 class QPen;
26 
57  public QwtPlotSeriesItem, public QwtSeriesStore<QPointF>
58 {
59 public:
65  {
69  NoCurve = -1,
70 
77 
83 
90 
98 
106 
107  UserCurve = 100
108  };
109 
115  {
120  Inverted = 0x01,
121 
132  Fitted = 0x02
133  };
134 
136  typedef QFlags<CurveAttribute> CurveAttributes;
137 
146  {
151  LegendNoAttribute = 0x00,
152 
157  LegendShowLine = 0x01,
158 
162  LegendShowSymbol = 0x02,
163 
168  LegendShowBrush = 0x04
169  };
170 
172  typedef QFlags<LegendAttribute> LegendAttributes;
173 
181  {
187  ClipPolygons = 0x01,
188 
195  FilterPoints = 0x02,
196 
202  MinimizeMemory = 0x04,
203 
211  ImageBuffer = 0x08,
212 
235  FilterPointsAggressive = 0x10,
236  };
237 
239  typedef QFlags<PaintAttribute> PaintAttributes;
240 
241  explicit QwtPlotCurve( const QString &title = QString() );
242  explicit QwtPlotCurve( const QwtText &title );
243 
244  virtual ~QwtPlotCurve();
245 
246  virtual int rtti() const QWT_OVERRIDE;
247 
248  void setPaintAttribute( PaintAttribute, bool on = true );
249  bool testPaintAttribute( PaintAttribute ) const;
250 
251  void setLegendAttribute( LegendAttribute, bool on = true );
252  bool testLegendAttribute( LegendAttribute ) const;
253 
254  void setLegendAttributes( LegendAttributes );
255  LegendAttributes legendAttributes() const;
256 
257  void setRawSamples( const double *xData, const double *yData, int size );
258  void setRawSamples( const float *xData, const float *yData, int size );
259 
260  void setRawSamples( const double *yData, int size );
261  void setRawSamples( const float *yData, int size );
262 
263  void setSamples( const double *xData, const double *yData, int size );
264  void setSamples( const float *xData, const float *yData, int size );
265 
266  void setSamples( const double *yData, int size );
267  void setSamples( const float *yData, int size );
268 
269  void setSamples( const QVector<double> &yData );
270  void setSamples( const QVector<float> &yData );
271 
272  void setSamples( const QVector<double> &xData, const QVector<double> &yData );
273  void setSamples( const QVector<float> &xData, const QVector<float> &yData );
274 
275  void setSamples( const QVector<QPointF> & );
276  void setSamples( QwtSeriesData<QPointF> * );
277 
278  virtual int closestPoint( const QPoint &pos, double *dist = NULL ) const;
279 
280  double minXValue() const;
281  double maxXValue() const;
282  double minYValue() const;
283  double maxYValue() const;
284 
285  void setCurveAttribute( CurveAttribute, bool on = true );
286  bool testCurveAttribute( CurveAttribute ) const;
287 
288  void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
289  void setPen( const QPen & );
290  const QPen &pen() const;
291 
292  void setBrush( const QBrush & );
293  const QBrush &brush() const;
294 
295  void setBaseline( double );
296  double baseline() const;
297 
298  void setStyle( CurveStyle style );
299  CurveStyle style() const;
300 
301  void setSymbol( QwtSymbol * );
302  const QwtSymbol *symbol() const;
303 
304  void setCurveFitter( QwtCurveFitter * );
305  QwtCurveFitter *curveFitter() const;
306 
307  virtual void drawSeries( QPainter *,
308  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
309  const QRectF &canvasRect, int from, int to ) const QWT_OVERRIDE;
310 
311  virtual QwtGraphic legendIcon( int index, const QSizeF & ) const QWT_OVERRIDE;
312 
313 protected:
314 
315  void init();
316 
317  virtual void drawCurve( QPainter *, int style,
318  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
319  const QRectF &canvasRect, int from, int to ) const;
320 
321  virtual void drawSymbols( QPainter *, const QwtSymbol &,
322  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
323  const QRectF &canvasRect, int from, int to ) const;
324 
325  virtual void drawLines( QPainter *,
326  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
327  const QRectF &canvasRect, int from, int to ) const;
328 
329  virtual void drawSticks( QPainter *,
330  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
331  const QRectF &canvasRect, int from, int to ) const;
332 
333  virtual void drawDots( QPainter *,
334  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
335  const QRectF &canvasRect, int from, int to ) const;
336 
337  virtual void drawSteps( QPainter *,
338  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
339  const QRectF &canvasRect, int from, int to ) const;
340 
341  virtual void fillCurve( QPainter *,
342  const QwtScaleMap &, const QwtScaleMap &,
343  const QRectF &canvasRect, QPolygonF & ) const;
344 
345  void closePolyline( QPainter *,
346  const QwtScaleMap &, const QwtScaleMap &, QPolygonF & ) const;
347 
348 private:
349  class PrivateData;
350  PrivateData *d_data;
351 };
352 
354 inline double QwtPlotCurve::minXValue() const
355 {
356  return boundingRect().left();
357 }
358 
360 inline double QwtPlotCurve::maxXValue() const
361 {
362  return boundingRect().right();
363 }
364 
366 inline double QwtPlotCurve::minYValue() const
367 {
368  return boundingRect().top();
369 }
370 
372 inline double QwtPlotCurve::maxYValue() const
373 {
374  return boundingRect().bottom();
375 }
376 
377 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::PaintAttributes )
378 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::LegendAttributes )
379 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::CurveAttributes )
380 
381 #endif
A plot item, that represents a series of points.
virtual int rtti() const
#define QWT_EXPORT
Definition: qwt_global.h:38
Abstract interface for iterating over samples.
QFlags< CurveAttribute > CurveAttributes
Curve attributes.
A class for drawing symbols.
Definition: qwt_symbol.h:31
Class storing a QwtSeriesData object.
A class representing a text.
Definition: qwt_text.h:51
A paint device for scalable graphics.
Definition: qwt_graphic.h:75
double minYValue() const
boundingRect().top()
A scale map.
Definition: qwt_scale_map.h:26
double maxYValue() const
boundingRect().bottom()
QFlags< LegendAttribute > LegendAttributes
Legend attributes.
QFlags< PaintAttribute > PaintAttributes
Paint attributes.
Base class for plot items representing a series of samples.
double maxXValue() const
boundingRect().right()
Abstract base class for a curve fitter.
#define QWT_OVERRIDE
Definition: qwt_global.h:53
virtual QRectF boundingRect() const QWT_OVERRIDE


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10