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 #include "qwt_series_data.h"
16 #include "qwt_text.h"
17 #include <qpen.h>
18 #include <qstring.h>
19 
20 class QPainter;
21 class QPolygonF;
22 class QwtScaleMap;
23 class QwtSymbol;
24 class QwtCurveFitter;
25 
56  public QwtPlotSeriesItem, public QwtSeriesStore<QPointF>
57 {
58 public:
64  {
68  NoCurve = -1,
69 
76 
82 
89 
97 
99 
105  UserCurve = 100
106  };
107 
113  {
118  Inverted = 0x01,
119 
130  Fitted = 0x02
131  };
132 
134  typedef QFlags<CurveAttribute> CurveAttributes;
135 
144  {
149  LegendNoAttribute = 0x00,
150 
155  LegendShowLine = 0x01,
156 
160  LegendShowSymbol = 0x02,
161 
166  LegendShowBrush = 0x04
167  };
168 
170  typedef QFlags<LegendAttribute> LegendAttributes;
171 
179  {
185  ClipPolygons = 0x01,
186 
193  FilterPoints = 0x02,
194 
200  MinimizeMemory = 0x04,
201 
209  ImageBuffer = 0x08,
210 
233  FilterPointsAggressive = 0x10,
234  };
235 
237  typedef QFlags<PaintAttribute> PaintAttributes;
238 
239  explicit QwtPlotCurve( const QString &title = QString() );
240  explicit QwtPlotCurve( const QwtText &title );
241 
242  virtual ~QwtPlotCurve();
243 
244  virtual int rtti() const;
245 
246  void setPaintAttribute( PaintAttribute, bool on = true );
247  bool testPaintAttribute( PaintAttribute ) const;
248 
249  void setLegendAttribute( LegendAttribute, bool on = true );
250  bool testLegendAttribute( LegendAttribute ) const;
251 
252 #ifndef QWT_NO_COMPAT
253  void setRawSamples( const double *xData, const double *yData, int size );
254  void setSamples( const double *xData, const double *yData, int size );
255  void setSamples( const QVector<double> &xData, const QVector<double> &yData );
256 #endif
257  void setSamples( const QVector<QPointF> & );
258  void setSamples( QwtSeriesData<QPointF> * );
259 
260  virtual int closestPoint( const QPoint &pos, double *dist = NULL ) const;
261 
262  double minXValue() const;
263  double maxXValue() const;
264  double minYValue() const;
265  double maxYValue() const;
266 
267  void setCurveAttribute( CurveAttribute, bool on = true );
268  bool testCurveAttribute( CurveAttribute ) const;
269 
270  void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
271  void setPen( const QPen & );
272  const QPen &pen() const;
273 
274  void setBrush( const QBrush & );
275  const QBrush &brush() const;
276 
277  void setBaseline( double );
278  double baseline() const;
279 
280  void setStyle( CurveStyle style );
281  CurveStyle style() const;
282 
283  void setSymbol( QwtSymbol * );
284  const QwtSymbol *symbol() const;
285 
286  void setCurveFitter( QwtCurveFitter * );
287  QwtCurveFitter *curveFitter() const;
288 
289  virtual void drawSeries( QPainter *,
290  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
291  const QRectF &canvasRect, int from, int to ) const;
292 
293  virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
294 
295 protected:
296 
297  void init();
298 
299  virtual void drawCurve( QPainter *p, int style,
300  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
301  const QRectF &canvasRect, int from, int to ) const;
302 
303  virtual void drawSymbols( QPainter *p, const QwtSymbol &,
304  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
305  const QRectF &canvasRect, int from, int to ) const;
306 
307  virtual void drawLines( QPainter *p,
308  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
309  const QRectF &canvasRect, int from, int to ) const;
310 
311  virtual void drawSticks( QPainter *p,
312  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
313  const QRectF &canvasRect, int from, int to ) const;
314 
315  virtual void drawDots( QPainter *p,
316  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
317  const QRectF &canvasRect, int from, int to ) const;
318 
319  virtual void drawSteps( QPainter *p,
320  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
321  const QRectF &canvasRect, int from, int to ) const;
322 
323  virtual void fillCurve( QPainter *,
324  const QwtScaleMap &, const QwtScaleMap &,
325  const QRectF &canvasRect, QPolygonF & ) const;
326 
327  void closePolyline( QPainter *,
328  const QwtScaleMap &, const QwtScaleMap &, QPolygonF & ) const;
329 
330 private:
331  class PrivateData;
333 };
334 
336 inline double QwtPlotCurve::minXValue() const
337 {
338  return boundingRect().left();
339 }
340 
342 inline double QwtPlotCurve::maxXValue() const
343 {
344  return boundingRect().right();
345 }
346 
348 inline double QwtPlotCurve::minYValue() const
349 {
350  return boundingRect().top();
351 }
352 
354 inline double QwtPlotCurve::maxYValue() const
355 {
356  return boundingRect().bottom();
357 }
358 
359 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::PaintAttributes )
360 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::LegendAttributes )
361 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::CurveAttributes )
362 
363 #endif
A plot item, that represents a series of points.
virtual int rtti() const
#define QWT_EXPORT
Definition: qwt_global.h:38
PrivateData * d_data
QFlags< CurveAttribute > CurveAttributes
Curve attributes.
A class for drawing symbols.
Definition: qwt_symbol.h:30
Class storing a QwtSeriesData object.
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const =0
A class representing a text.
Definition: qwt_text.h:51
A paint device for scalable graphics.
Definition: qwt_graphic.h:74
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
virtual QRectF boundingRect() const
double minYValue() const
boundingRect().top()
A scale map.
Definition: qwt_scale_map.h:30
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.
double minXValue() const
boundingRect().left()


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17