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


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Jun 19 2023 03:01:38