qwt_plot_curve.h
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_PLOT_CURVE_H
#define QWT_PLOT_CURVE_H
#include "qwt_global.h"
#include "qwt_plot_seriesitem.h"
#include <qstring.h>
class QwtScaleMap;
class QwtSymbol;
class QwtCurveFitter;
template< typename T > class QwtSeriesData;
class QwtText;
class QPainter;
class QPolygonF;
class QPen;
class QWT_EXPORT QwtPlotCurve
: public QwtPlotSeriesItem
, public QwtSeriesStore< QPointF >
{
public:
enum CurveStyle
{
NoCurve = -1,
Lines,
Sticks,
Steps,
Dots,
UserCurve = 100
};
enum CurveAttribute
{
Inverted = 0x01,
Fitted = 0x02
};
Q_DECLARE_FLAGS( CurveAttributes, CurveAttribute )
enum LegendAttribute
{
LegendNoAttribute = 0x00,
LegendShowLine = 0x01,
LegendShowSymbol = 0x02,
LegendShowBrush = 0x04
};
Q_DECLARE_FLAGS( LegendAttributes, LegendAttribute )
enum PaintAttribute
{
ClipPolygons = 0x01,
FilterPoints = 0x02,
MinimizeMemory = 0x04,
ImageBuffer = 0x08,
FilterPointsAggressive = 0x10,
};
Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
explicit QwtPlotCurve( const QString& title = QString() );
explicit QwtPlotCurve( const QwtText& title );
virtual ~QwtPlotCurve();
virtual int rtti() const QWT_OVERRIDE;
void setPaintAttribute( PaintAttribute, bool on = true );
bool testPaintAttribute( PaintAttribute ) const;
void setLegendAttribute( LegendAttribute, bool on = true );
bool testLegendAttribute( LegendAttribute ) const;
void setLegendAttributes( LegendAttributes );
LegendAttributes legendAttributes() const;
void setRawSamples( const double* xData, const double* yData, int size );
void setRawSamples( const float* xData, const float* yData, int size );
void setRawSamples( const double* yData, int size );
void setRawSamples( const float* yData, int size );
void setSamples( const double* xData, const double* yData, int size );
void setSamples( const float* xData, const float* yData, int size );
void setSamples( const double* yData, int size );
void setSamples( const float* yData, int size );
void setSamples( const QVector< double >& yData );
void setSamples( const QVector< float >& yData );
void setSamples( const QVector< double >& xData, const QVector< double >& yData );
void setSamples( const QVector< float >& xData, const QVector< float >& yData );
void setSamples( const QVector< QPointF >& );
void setSamples( QwtSeriesData< QPointF >* );
virtual int closestPoint( const QPointF& pos, double* dist = NULL ) const;
double minXValue() const;
double maxXValue() const;
double minYValue() const;
double maxYValue() const;
void setCurveAttribute( CurveAttribute, bool on = true );
bool testCurveAttribute( CurveAttribute ) const;
void setPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
void setPen( const QPen& );
const QPen& pen() const;
void setBrush( const QBrush& );
const QBrush& brush() const;
void setBaseline( double );
double baseline() const;
void setStyle( CurveStyle style );
CurveStyle style() const;
void setSymbol( QwtSymbol* );
const QwtSymbol* symbol() const;
void setCurveFitter( QwtCurveFitter* );
QwtCurveFitter* curveFitter() const;
virtual void drawSeries( QPainter*,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
virtual QwtGraphic legendIcon( int index, const QSizeF& ) const QWT_OVERRIDE;
protected:
void init();
virtual void drawCurve( QPainter*, int style,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to ) const;
virtual void drawSymbols( QPainter*, const QwtSymbol&,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to ) const;
virtual void drawLines( QPainter*,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to ) const;
virtual void drawSticks( QPainter*,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to ) const;
virtual void drawDots( QPainter*,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to ) const;
virtual void drawSteps( QPainter*,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to ) const;
virtual void fillCurve( QPainter*,
const QwtScaleMap&, const QwtScaleMap&,
const QRectF& canvasRect, QPolygonF& ) const;
void closePolyline( QPainter*,
const QwtScaleMap&, const QwtScaleMap&, QPolygonF& ) const;
private:
class PrivateData;
PrivateData* m_data;
};
inline double QwtPlotCurve::minXValue() const
{
return boundingRect().left();
}
inline double QwtPlotCurve::maxXValue() const
{
return boundingRect().right();
}
inline double QwtPlotCurve::minYValue() const
{
return boundingRect().top();
}
inline double QwtPlotCurve::maxYValue() const
{
return boundingRect().bottom();
}
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::PaintAttributes )
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::LegendAttributes )
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotCurve::CurveAttributes )
#endif
QVector
Definition: qwt_clipper.h:23
QwtCurveFitter
Abstract base class for a curve fitter.
Definition: qwt_curve_fitter.h:22
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:76
QwtPlotCurve
A plot item, that represents a series of points.
Definition: qwt_plot_curve.h:59
QwtPlotCurve::CurveStyle
CurveStyle
Definition: qwt_plot_curve.h:66
QwtPlotCurve::Steps
@ Steps
Definition: qwt_plot_curve.h:90
QwtPlotCurve::Sticks
@ Sticks
Definition: qwt_plot_curve.h:83
QwtPlotCurve::Lines
@ Lines
Definition: qwt_plot_curve.h:77
QwtPlotCurve::Dots
@ Dots
Definition: qwt_plot_curve.h:98
QwtPlotCurve::LegendAttributes
QFlags< LegendAttribute > LegendAttributes
Definition: qwt_plot_curve.h:168
QwtPlotCurve::CurveAttribute
CurveAttribute
Definition: qwt_plot_curve.h:113
QwtPlotCurve::maxXValue
double maxXValue() const
boundingRect().right()
Definition: qwt_plot_curve.h:355
QwtPlotCurve::LegendAttribute
LegendAttribute
Definition: qwt_plot_curve.h:143
QwtPlotCurve::minYValue
double minYValue() const
boundingRect().top()
Definition: qwt_plot_curve.h:361
QwtPlotCurve::PaintAttribute
PaintAttribute
Definition: qwt_plot_curve.h:177
QwtPlotCurve::maxYValue
double maxYValue() const
boundingRect().bottom()
Definition: qwt_plot_curve.h:367
QwtPlotCurve::PaintAttributes
QFlags< PaintAttribute > PaintAttributes
Definition: qwt_plot_curve.h:234
QwtPlotCurve::CurveAttributes
QFlags< CurveAttribute > CurveAttributes
Definition: qwt_plot_curve.h:133
QwtPlotItem::rtti
virtual int rtti() const
Definition: qwt_plot_item.cpp:136
QwtPlotSeriesItem
Base class for plot items representing a series of samples.
Definition: qwt_plot_seriesitem.h:26
QwtPlotSeriesItem::boundingRect
virtual QRectF boundingRect() const override
Definition: qwt_plot_seriesitem.cpp:97
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:27
QwtSeriesData
Abstract interface for iterating over samples.
Definition: qwt_series_data.h:50
QwtSeriesStore
Class storing a QwtSeriesData object.
Definition: qwt_series_store.h:67
QwtSymbol
A class for drawing symbols.
Definition: qwt_symbol.h:32
QwtText
A class representing a text.
Definition: qwt_text.h:52