/usr/include/qwt-qt4/qwt_plot_curve.h is in libqwt5-qt4-dev 5.2.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | /* -*- 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 <qpen.h>
#include <qstring.h>
#include "qwt_global.h"
#include "qwt_plot_item.h"
#include "qwt_text.h"
#include "qwt_polygon.h"
#include "qwt_data.h"
class QPainter;
class QwtScaleMap;
class QwtSymbol;
class QwtCurveFitter;
/*!
\brief A plot item, that represents a series of points
A curve is the representation of a series of points in the x-y plane.
It supports different display styles, interpolation ( f.e. spline )
and symbols.
\par Usage
<dl><dt>a) Assign curve properties</dt>
<dd>When a curve is created, it is configured to draw black solid lines
with in Lines style and no symbols. You can change this by calling
setPen(), setStyle() and setSymbol().</dd>
<dt>b) Connect/Assign data.</dt>
<dd>QwtPlotCurve gets its points using a QwtData object offering
a bridge to the real storage of the points ( like QAbstractItemModel ).
There are several convenience classes derived from QwtData, that also store
the points inside ( like QStandardItemModel ). QwtPlotCurve also offers
a couple of variations of setData(), that build QwtData objects from
arrays internally.</dd>
<dt>c) Attach the curve to a plot</dt>
<dd>See QwtPlotItem::attach()
</dd></dl>
\par Example:
see examples/bode
\sa QwtPlot, QwtData, QwtSymbol, QwtScaleMap
*/
class QWT_EXPORT QwtPlotCurve: public QwtPlotItem
{
public:
/*!
Curve type.
- Yfx\n
Draws y as a function of x (the default). The
baseline is interpreted as a horizontal line
with y = baseline().
- Xfy\n
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.
\sa setCurveType(), curveType(), baseline() brush()
*/
enum CurveType
{
Yfx,
Xfy
};
/*!
Curve styles.
- NoCurve\n
Don't draw a curve. Note: This doesn't affect the symbols.
- Lines\n
Connect the points with straight lines. The lines might
be interpolated depending on the 'Fitted' attribute. Curve
fitting can be configured using setCurveFitter().
- Sticks\n
Draw vertical(Yfx) or horizontal(Xfy) sticks from a baseline
which is defined by setBaseline().
- Steps\n
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' attribute.
- Dots\n
Draw dots at the locations of the data points. Note:
This is different from a dotted line (see setPen()), and faster
as a curve in NoStyle style and a symbol painting a point.
- UserCurve\n
Styles >= UserCurve are reserved for derived
classes of QwtPlotCurve that overload drawCurve() with
additional application specific curve types.
\sa setStyle(), style()
*/
enum CurveStyle
{
NoCurve,
Lines,
Sticks,
Steps,
Dots,
UserCurve = 100
};
/*!
Attribute for drawing the curve
- Fitted ( in combination with the Lines QwtPlotCurve::CurveStyle only )\n
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\n
For Steps only. Draws a step function
from the right to the left.
\sa setCurveAttribute(), testCurveAttribute(), curveFitter()
*/
enum CurveAttribute
{
Inverted = 1,
Fitted = 2
};
/*!
Attributes to modify the drawing algorithm.
- PaintFiltered\n
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\n
Clip polygons before painting them. In situations, where points
are far outside the visible area (f.e when zooming deep) this
might be a substantial improvement for the painting performance
( especially on Windows ).
The default is, that no paint attributes are enabled.
\sa setPaintAttribute(), testPaintAttribute()
*/
enum PaintAttribute
{
PaintFiltered = 1,
ClipPolygons = 2
};
explicit QwtPlotCurve();
explicit QwtPlotCurve(const QwtText &title);
explicit QwtPlotCurve(const QString &title);
virtual ~QwtPlotCurve();
virtual int rtti() const;
void setCurveType(CurveType);
CurveType curveType() const;
void setPaintAttribute(PaintAttribute, bool on = true);
bool testPaintAttribute(PaintAttribute) const;
void setRawData(const double *x, const double *y, int size);
void setData(const double *xData, const double *yData, int size);
void setData(const QwtArray<double> &xData, const QwtArray<double> &yData);
#if QT_VERSION < 0x040000
void setData(const QwtArray<QwtDoublePoint> &data);
#else
void setData(const QPolygonF &data);
#endif
void setData(const QwtData &data);
int closestPoint(const QPoint &pos, double *dist = NULL) const;
QwtData &data();
const QwtData &data() const;
int dataSize() const;
double x(int i) const;
double y(int i) const;
virtual QwtDoubleRect boundingRect() 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 QPen &);
const QPen &pen() const;
void setBrush(const QBrush &);
const QBrush &brush() const;
void setBaseline(double ref);
double baseline() const;
void setStyle(CurveStyle style);
CurveStyle style() const;
void setSymbol(const QwtSymbol &s);
const QwtSymbol& symbol() const;
void setCurveFitter(QwtCurveFitter *);
QwtCurveFitter *curveFitter() const;
virtual void draw(QPainter *p,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRect &) const;
virtual void draw(QPainter *p,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
int from, int to) const;
void draw(int from, int to) const;
virtual void updateLegend(QwtLegend *) const;
protected:
void init();
virtual void drawCurve(QPainter *p, int style,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
int from, int to) const;
virtual void drawSymbols(QPainter *p, const QwtSymbol &,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
int from, int to) const;
void drawLines(QPainter *p,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
int from, int to) const;
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;
private:
QwtData *d_xy;
class PrivateData;
PrivateData *d_data;
};
//! \return the the curve data
inline QwtData &QwtPlotCurve::data()
{
return *d_xy;
}
//! \return the the curve data
inline const QwtData &QwtPlotCurve::data() const
{
return *d_xy;
}
/*!
\param i index
\return x-value at position i
*/
inline double QwtPlotCurve::x(int i) const
{
return d_xy->x(i);
}
/*!
\param i index
\return y-value at position i
*/
inline double QwtPlotCurve::y(int i) const
{
return d_xy->y(i);
}
//! boundingRect().left()
inline double QwtPlotCurve::minXValue() const
{
return boundingRect().left();
}
//! boundingRect().right()
inline double QwtPlotCurve::maxXValue() const
{
return boundingRect().right();
}
//! boundingRect().top()
inline double QwtPlotCurve::minYValue() const
{
return boundingRect().top();
}
//! boundingRect().bottom()
inline double QwtPlotCurve::maxYValue() const
{
return boundingRect().bottom();
}
#endif
|