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 QPointF& pos, double* dist = NULL ) const;
276  virtual int adjacentPoint( Qt::Orientation orientation, qreal value ) const;
277 
278  qreal interpolatedValueAt( Qt::Orientation, double ) 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* m_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
QwtPlotCurve::Dots
@ Dots
Definition: qwt_plot_curve.h:98
QwtPlotSeriesItem
Base class for plot items representing a series of samples.
Definition: qwt_plot_seriesitem.h:24
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:75
QwtPlotCurve::Lines
@ Lines
Definition: qwt_plot_curve.h:77
QVector
Definition: qwt_clipper.h:23
qwt_global.h
QwtPlotCurve::LegendAttribute
LegendAttribute
Definition: qwt_plot_curve.h:144
QwtPlotCurve::maxYValue
double maxYValue() const
boundingRect().bottom()
Definition: qwt_plot_curve.h:372
QwtPlotCurve::maxXValue
double maxXValue() const
boundingRect().right()
Definition: qwt_plot_curve.h:360
QwtPlotCurve::Steps
@ Steps
Definition: qwt_plot_curve.h:90
nonstd::span_lite::size
span_constexpr std::size_t size(span< T, Extent > const &spn)
Definition: span.hpp:1554
QwtPlotCurve::CurveStyle
CurveStyle
Definition: qwt_plot_curve.h:65
QwtPlotCurve::Sticks
@ Sticks
Definition: qwt_plot_curve.h:83
QwtText
A class representing a text.
Definition: qwt_text.h:51
QwtSymbol
A class for drawing symbols.
Definition: qwt_symbol.h:31
QwtCurveFitter
Abstract base class for a curve fitter.
Definition: qwt_curve_fitter.h:21
QwtSeriesData
Abstract interface for iterating over samples.
Definition: qwt_plot_barchart.h:18
QwtPlotCurve::CurveAttribute
CurveAttribute
Definition: qwt_plot_curve.h:114
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:26
qwt_plot_seriesitem.h
QWT_OVERRIDE
#define QWT_OVERRIDE
Definition: qwt_global.h:53
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38
QwtPlotSeriesItem::boundingRect
virtual QRectF boundingRect() const QWT_OVERRIDE
Definition: qwt_plot_seriesitem.cpp:97
QwtPlotCurve::PrivateData
Definition: qwt_plot_curve.cpp:74
QwtSeriesStore
Class storing a QwtSeriesData object.
Definition: qwt_series_store.h:66
QwtPlotItem::rtti
virtual int rtti() const
Definition: qwt_plot_item.cpp:136
QwtPlotCurve::LinesAndDots
@ LinesAndDots
Definition: qwt_plot_curve.h:100
QwtPlotCurve::minYValue
double minYValue() const
boundingRect().top()
Definition: qwt_plot_curve.h:366
QwtPlotCurve
A plot item, that represents a series of points.
Definition: qwt_plot_curve.h:56
QwtPlotCurve::PaintAttribute
PaintAttribute
Definition: qwt_plot_curve.h:178


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Aug 11 2024 02:24:24