Eneboo - Documentación para desarrolladores
Clases | Tipos públicos | Métodos públicos | Métodos protegidos
Referencia de la Clase QwtPlotCurve

A class which draws curves. Más...

#include <qwt_plot_curve.h>

Diagrama de herencias de QwtPlotCurve
QwtPlotItem QwtLegendItemManager

Lista de todos los miembros.

Clases

class  PrivateData

Tipos públicos

enum  CurveType { Yfx, Xfy }
enum  CurveStyle {
  NoCurve, Lines, Sticks, Steps,
  Dots, UserCurve = 100
}
enum  CurveAttribute { Inverted = 1, Fitted = 2 }
enum  PaintAttribute { PaintFiltered = 1, ClipPolygons = 2 }

Métodos públicos

 QwtPlotCurve ()
 Constructor.
 QwtPlotCurve (const QwtText &title)
 QwtPlotCurve (const QString &title)
virtual ~QwtPlotCurve ()
 Destructor.
virtual int rtti () const
void setCurveType (CurveType)
CurveType curveType () const
void setPaintAttribute (PaintAttribute, bool on=true)
 Specify an attribute how to draw the curve.
bool testPaintAttribute (PaintAttribute) const
 Return the current paint attributes.
void setRawData (const double *x, const double *y, int size)
 Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve.
void setData (const double *xData, const double *yData, int size)
void setData (const QwtArray< double > &xData, const QwtArray< double > &yData)
 Initialize data with x- and y-arrays (explicitly shared)
void setData (const QwtArray< QwtDoublePoint > &data)
void setData (const QwtData &data)
int closestPoint (const QPoint &pos, double *dist=NULL) const
QwtDatadata ()
const QwtDatadata () const
int dataSize () const
double x (int i) const
double y (int i) const
virtual QwtDoubleRect boundingRect () const
double minXValue () const
 boundingRect().left()
double maxXValue () const
 boundingRect().right()
double minYValue () const
 boundingRect().top()
double maxYValue () const
 boundingRect().bottom()
void setCurveAttribute (CurveAttribute, bool on=true)
 Specify an attribute for drawing the curve.
bool testCurveAttribute (CurveAttribute) const
void setPen (const QPen &)
 Assign a pen.
const QPenpen () const
 Return the pen used to draw the lines.
void setBrush (const QBrush &)
 Assign a brush. In case of brush.style() != QBrush::NoBrush and style() != QwtPlotCurve::Sticks the area between the curve and the baseline will be filled. In case !brush.color().isValid() the area will be filled by pen.color(). The fill algorithm simply connects the first and the last curve point to the baseline. So the curve data has to be sorted (ascending or descending).
const QBrushbrush () const
 Return the brush used to fill the area between lines and the baseline.
void setBaseline (double ref)
 Set the value of the baseline.
double baseline () const
void setStyle (CurveStyle style)
 Set the curve's drawing style.
CurveStyle style () const
 Return the current style.
void setSymbol (const QwtSymbol &s)
 Assign a symbol.
const QwtSymbolsymbol () const
 Return the current symbol.
void setCurveFitter (QwtCurveFitter *)
QwtCurveFittercurveFitter () const
virtual void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &) const
 Draw the complete curve.
virtual void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
 Draw an interval of the curve.
void draw (int from, int to) const
 Draw a set of points of a curve.
virtual void updateLegend (QwtLegend *) const
 Update the widget that represents the curve on the legend.

Métodos protegidos

void init ()
 Initialize data members.
virtual void drawCurve (QPainter *p, int style, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
 Draw the line part (without symbols) of a curve interval.
virtual void drawSymbols (QPainter *p, const QwtSymbol &, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
 Draw symbols.
void drawLines (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
 Draw lines.
void drawSticks (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
void drawDots (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
void drawSteps (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
void fillCurve (QPainter *, const QwtScaleMap &, const QwtScaleMap &, QwtPolygon &) const
void closePolyline (const QwtScaleMap &, const QwtScaleMap &, QwtPolygon &) const
 Complete a polygon to be a closed polygon including the area between the original polygon and the baseline.

Descripción detallada

A class which draws curves.

This class can be used to display data as a curve in the x-y plane. It supports different display styles, spline interpolation and symbols.

Usage
A. Assign curve properties
When a curve is created, it is configured to draw black solid lines with QwtPlotCurve::Lines and no symbols. You can change this by calling setPen(), setStyle() and setSymbol().
B. Assign or change data.
Data can be set in two ways:
  • setData() is overloaded to initialize the x and y data by copying from different data structures with different kind of copy semantics.
  • setRawData() only stores the pointers and size information and is provided for backwards compatibility. This function is less safe (you must not delete the data while they are attached), but has been more efficient, and has been more convenient for dynamically changing data. Use of setData() in combination with a problem-specific subclass of QwtData is always preferrable.
C. Draw
draw() maps the data into pixel coordinates and paints them.
Example:
see examples/curvdemo
Ver también:
QwtData, QwtSymbol, QwtScaleMap

Documentación de las enumeraciones miembro de la clase

Curve attributes.

Ver también:
setCurveAttribute, testCurveAttribute
Valores de enumeraciones:
Inverted 
Fitted 

Curve styles.

Ver también:
setStyle
Valores de enumeraciones:
NoCurve 
Lines 
Sticks 
Steps 
Dots 
UserCurve 
Valores de enumeraciones:
Yfx 
Xfy 

Paint attributes

Ver también:
setPaintAttribute, testPaintAttribute
Valores de enumeraciones:
PaintFiltered 
ClipPolygons 

Documentación del constructor y destructor

QwtPlotCurve::QwtPlotCurve ( ) [explicit]

Constructor.

QwtPlotCurve::QwtPlotCurve ( const QwtText title) [explicit]

Constructor

Parámetros:
titletitle of the curve
QwtPlotCurve::QwtPlotCurve ( const QString title) [explicit]

Constructor

Parámetros:
titletitle of the curve
QwtPlotCurve::~QwtPlotCurve ( ) [virtual]

Destructor.


Documentación de las funciones miembro

double QwtPlotCurve::baseline ( ) const

Return the value of the baseline

Ver también:
setBaseline
QwtDoubleRect QwtPlotCurve::boundingRect ( ) const [virtual]

Returns the bounding rectangle of the curve data. If there is no bounding rect, like for empty data the rectangle is invalid.

Ver también:
QwtData::boundingRect(), QwtDoubleRect::isValid()

Reimplementado de QwtPlotItem.

const QBrush & QwtPlotCurve::brush ( ) const

Return the brush used to fill the area between lines and the baseline.

Ver también:
setBrush(), setBaseline(), baseline()
void QwtPlotCurve::closePolyline ( const QwtScaleMap xMap,
const QwtScaleMap yMap,
QwtPolygon pa 
) const [protected]

Complete a polygon to be a closed polygon including the area between the original polygon and the baseline.

Parámetros:
xMapX map
yMapY map
paPolygon to be completed
int QwtPlotCurve::closestPoint ( const QPoint pos,
double *  dist = NULL 
) const
QwtCurveFitter * QwtPlotCurve::curveFitter ( ) const
QwtPlotCurve::CurveType QwtPlotCurve::curveType ( ) const

Return the curve type

Ver también:
setCurveType()
QwtData & QwtPlotCurve::data ( ) [inline]
Devuelve:
the the curve data
const QwtData & QwtPlotCurve::data ( ) const [inline]
Devuelve:
the the curve data
int QwtPlotCurve::dataSize ( ) const

Return the size of the data arrays

Ver también:
setData()
void QwtPlotCurve::draw ( QPainter painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRect  
) const [virtual]

Draw the complete curve.

Parámetros:
painterPainter
xMapMaps x-values into pixel coordinates.
yMapMaps y-values into pixel coordinates.
Ver también:
drawCurve(), drawSymbols()

Implementa QwtPlotItem.

void QwtPlotCurve::draw ( QPainter painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
int  from,
int  to 
) const [virtual]

Draw an interval of the curve.

Parámetros:
painterPainter
xMapmaps x-values into pixel coordinates.
yMapmaps y-values into pixel coordinates.
fromindex of the first point to be painted
toindex of the last point to be painted. If to < 0 the curve will be painted to its last point.
Ver también:
drawCurve(), drawSymbols(),
void QwtPlotCurve::draw ( int  from,
int  to 
) const

Draw a set of points of a curve.

When observing an measurement while it is running, new points have to be added to an existing curve. drawCurve can be used to display them avoiding a complete redraw of the canvas.

Setting plot()->canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, true); will result in faster painting, if the paint engine of the canvas widget supports this feature.

Parámetros:
fromIndex of the first point to be painted
toIndex of the last point to be painted. If to < 0 the curve will be painted to its last point.
Ver también:
drawCurve(), drawSymbols()
void QwtPlotCurve::drawCurve ( QPainter painter,
int  style,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
int  from,
int  to 
) const [protected, virtual]

Draw the line part (without symbols) of a curve interval.

Parámetros:
painterPainter
stylecurve style, see QwtPlotCurve::CurveStyle
xMapx map
yMapy map
fromindex of the first point to be painted
toindex of the last point to be painted
Ver también:
draw(), drawDots(), drawLines(), drawSteps(), drawSticks()
void QwtPlotCurve::drawDots ( QPainter painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
int  from,
int  to 
) const [protected]

Draw dots

Parámetros:
painterPainter
xMapx map
yMapy map
fromindex of the first point to be painted
toindex of the last point to be painted
Ver también:
draw(), drawCurve(), drawSticks(), drawLines(), drawSteps()
void QwtPlotCurve::drawLines ( QPainter painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
int  from,
int  to 
) const [protected]

Draw lines.

If the CurveAttribute Fitted is enabled a QwtCurveFitter tries to interpolate/smooth the curve, before it is painted.

Parámetros:
painterPainter
xMapx map
yMapy map
fromindex of the first point to be painted
toindex of the last point to be painted
Ver también:
setCurveAttribute(), setCurveFitter(), draw(), drawLines(), drawDots(), drawSteps(), drawSticks()
void QwtPlotCurve::drawSteps ( QPainter painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
int  from,
int  to 
) const [protected]

Draw step function

The direction of the steps depends on Inverted attribute.

Parámetros:
painterPainter
xMapx map
yMapy map
fromindex of the first point to be painted
toindex of the last point to be painted
Ver también:
CurveAttribute, setCurveAttribute(), draw(), drawCurve(), drawDots(), drawLines(), drawSticks()
void QwtPlotCurve::drawSticks ( QPainter painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
int  from,
int  to 
) const [protected]

Draw sticks

Parámetros:
painterPainter
xMapx map
yMapy map
fromindex of the first point to be painted
toindex of the last point to be painted
Ver también:
draw(), drawCurve(), drawDots(), drawLines(), drawSteps()
void QwtPlotCurve::drawSymbols ( QPainter painter,
const QwtSymbol symbol,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
int  from,
int  to 
) const [protected, virtual]

Draw symbols.

Parámetros:
painterPainter
symbolCurve symbol
xMapx map
yMapy map
fromindex of the first point to be painted
toindex of the last point to be painted
Ver también:
setSymbol(), draw(), drawCurve()
void QwtPlotCurve::fillCurve ( QPainter painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
QwtPolygon pa 
) const [protected]

Fill the area between the curve and the baseline with the curve brush

Parámetros:
painterPainter
xMapx map
yMapy map
paPolygon
Ver también:
setBrush(), setBaseline(), setCurveType()
void QwtPlotCurve::init ( ) [protected]

Initialize data members.

double QwtPlotCurve::maxXValue ( ) const [inline]

boundingRect().right()

double QwtPlotCurve::maxYValue ( ) const [inline]

boundingRect().bottom()

double QwtPlotCurve::minXValue ( ) const [inline]
double QwtPlotCurve::minYValue ( ) const [inline]
const QPen & QwtPlotCurve::pen ( ) const

Return the pen used to draw the lines.

Ver también:
setPen(), brush()
int QwtPlotCurve::rtti ( ) const [virtual]
Devuelve:
QwtPlotItem::Rtti_PlotCurve

Reimplementado de QwtPlotItem.

void QwtPlotCurve::setBaseline ( double  reference)

Set the value of the baseline.

The baseline is needed for filling the curve with a brush or the Sticks drawing style. The default value is 0.0. The interpretation of the baseline depends on the CurveType. With QwtPlotCurve::Yfx, the baseline is interpreted as a horizontal line at y = baseline(), with QwtPlotCurve::Yfy, it is interpreted as a vertical line at x = baseline().

Parámetros:
referencebaseline
Ver también:
baseline(), setBrush(), setStyle(), setCurveType()
void QwtPlotCurve::setBrush ( const QBrush brush)

Assign a brush. In case of brush.style() != QBrush::NoBrush and style() != QwtPlotCurve::Sticks the area between the curve and the baseline will be filled. In case !brush.color().isValid() the area will be filled by pen.color(). The fill algorithm simply connects the first and the last curve point to the baseline. So the curve data has to be sorted (ascending or descending).

Parámetros:
brushNew brush
Ver también:
brush(), setBaseline(), baseline()
void QwtPlotCurve::setCurveAttribute ( CurveAttribute  attribute,
bool  on = true 
)

Specify an attribute for drawing the curve.

The attributes can be used to modify the drawing style. The following attributes are defined:

Fitted
For Lines only. A QwtCurveFitter tries to interpolate/smooth the curve, before it is painted. Note that curve fitting requires temorary memory for calculating coefficients and additional points. If painting in Fitted mode is slow it might be better to fit the points, before they are passed to QwtPlotCurve.
Inverted
For Steps only. Draws a step function from the right to the left.
Parámetros:
attributeCurve attribute
onOn/Off

/sa testCurveAttribute(), setCurveFitter()

void QwtPlotCurve::setCurveFitter ( QwtCurveFitter curveFitter)
void QwtPlotCurve::setCurveType ( CurveType  curveType)

Assign the curve type

QwtPlotCurve::Yfx Draws y as a function of x (the default). The baseline is interpreted as a horizontal line with y = baseline().

QwtPlotCurve::Xfy Draws x as a function of y. The baseline is interpreted as a vertical line with x = baseline().

The baseline is used for aligning the sticks, or filling the curve with a brush.

Ver también:
curveType()
void QwtPlotCurve::setData ( const QwtArray< QwtDoublePoint > &  data)

Initialize data with an array of points (explicitly shared).

Parámetros:
dataData
Ver también:
QwtPolygonFData
void QwtPlotCurve::setData ( const QwtArray< double > &  xData,
const QwtArray< double > &  yData 
)

Initialize data with x- and y-arrays (explicitly shared)

Parámetros:
xDatax data
yDatay data
Ver también:
QwtArrayData
void QwtPlotCurve::setData ( const QwtData data)

Initialize data with a pointer to QwtData.

Parámetros:
dataData
Ver también:
QwtData::copy()
void QwtPlotCurve::setData ( const double *  xData,
const double *  yData,
int  size 
)

Set data by copying x- and y-values from specified memory blocks. Contrary to setCurveRawData(), this function makes a 'deep copy' of the data.

Parámetros:
xDatapointer to x values
yDatapointer to y values
sizesize of xData and yData
Ver también:
QwtCPointerData
void QwtPlotCurve::setPaintAttribute ( PaintAttribute  attribute,
bool  on = true 
)

Specify an attribute how to draw the curve.

The attributes can be used to modify the drawing algorithm.

The following attributes are defined:

PaintFiltered
Tries to reduce the data that has to be painted, by sorting out duplicates, or paintings outside the visible area. Might have a notable impact on curves with many close points. Only a couple of very basic filtering algos are implemented.
ClipPolygons
Clip polygons before painting them. In situations, where points are far outside the visible area this might be a great improvement for the painting performance ( especially on Windows ).

The default is, that no paint attributes are enabled.

Parámetros:
attributePaint attribute
onOn/Off /sa testPaintAttribute()
void QwtPlotCurve::setPen ( const QPen pen)

Assign a pen.

Parámetros:
penNew pen
Ver también:
pen(), brush()
void QwtPlotCurve::setRawData ( const double *  xData,
const double *  yData,
int  size 
)

Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve.

setRawData is provided for efficiency. It is important to keep the pointers during the lifetime of the underlying QwtCPointerData class.

Parámetros:
xDatapointer to x data
yDatapointer to y data
sizesize of x and y
Ver también:
QwtCPointerData::setData.
void QwtPlotCurve::setStyle ( CurveStyle  style)

Set the curve's drawing style.

Valid styles are:

NoCurve
Don't draw a curve. Note: This doesn't affect the symbol.
Lines
Connect the points with straight lines. The lines might be interpolated depending on the 'Fitted' option. Curve fitting can be configured using setCurveFitter.
Sticks
Draw vertical sticks from a baseline which is defined by setBaseline().
Steps
Connect the points with a step function. The step function is drawn from the left to the right or vice versa, depending on the 'Inverted' option.
Dots
Draw dots at the locations of the data points. Note: This is different from a dotted line (see setPen()).
UserCurve ...
Styles >= UserCurve are reserved for derived classes of QwtPlotCurve that overload drawCurve() with additional application specific curve types.
Ver también:
style()
void QwtPlotCurve::setSymbol ( const QwtSymbol symbol)

Assign a symbol.

Parámetros:
symbolSymbol
Ver también:
symbol()
QwtPlotCurve::CurveStyle QwtPlotCurve::style ( ) const

Return the current style.

Ver también:
setStyle()
const QwtSymbol & QwtPlotCurve::symbol ( ) const

Return the current symbol.

Ver también:
setSymbol()
bool QwtPlotCurve::testCurveAttribute ( CurveAttribute  attribute) const
Devuelve:
true, if attribute is enabled
Ver también:
setCurveAttribute()
bool QwtPlotCurve::testPaintAttribute ( PaintAttribute  attribute) const

Return the current paint attributes.

Ver también:
setPaintAttribute
void QwtPlotCurve::updateLegend ( QwtLegend legend) const [virtual]

Update the widget that represents the curve on the legend.

Reimplementado de QwtPlotItem.

double QwtPlotCurve::x ( int  i) const [inline]
Parámetros:
iindex
Devuelve:
x-value at position i
double QwtPlotCurve::y ( int  i) const [inline]
Parámetros:
iindex
Devuelve:
y-value at position i

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'