All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_plot_curve.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* 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 "qwt_series_data.h"
#include "qwt_text.h"
#include <qpen.h>
#include <qstring.h>
class QPainter;
class QPolygonF;
class QwtScaleMap;
class QwtSymbol;
class QwtCurveFitter;
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
};
typedef QFlags<CurveAttribute> CurveAttributes;
enum LegendAttribute
{
LegendNoAttribute = 0x00,
LegendShowLine = 0x01,
LegendShowSymbol = 0x02,
LegendShowBrush = 0x04
};
typedef QFlags<LegendAttribute> LegendAttributes;
enum PaintAttribute
{
ClipPolygons = 0x01,
FilterPoints = 0x02,
MinimizeMemory = 0x04,
ImageBuffer = 0x08
};
typedef QFlags<PaintAttribute> PaintAttributes;
explicit QwtPlotCurve( const QString &title = QString::null );
explicit QwtPlotCurve( const QwtText &title );
virtual ~QwtPlotCurve();
virtual int rtti() const;
void setPaintAttribute( PaintAttribute, bool on = true );
bool testPaintAttribute( PaintAttribute ) const;
void setLegendAttribute( LegendAttribute, bool on = true );
bool testLegendAttribute( LegendAttribute ) const;
#ifndef QWT_NO_COMPAT
void setRawSamples( const double *xData, const double *yData, int size );
void setSamples( const double *xData, const double *yData, int size );
void setSamples( const QVector<double> &xData, const QVector<double> &yData );
#endif
void setSamples( const QVector<QPointF> & );
void setSamples( QwtSeriesData<QPointF> * );
int closestPoint( const QPoint &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;
virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
protected:
void init();
virtual void drawCurve( QPainter *p, int style,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const;
virtual void drawSymbols( QPainter *p, const QwtSymbol &,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const;
virtual void drawLines( QPainter *p,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const;
virtual void drawSticks( QPainter *p,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const;
virtual void drawDots( QPainter *p,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const;
virtual void drawSteps( QPainter *p,
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 *d_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