source: ntrip/branches/BNC_2.12/qwtpolar/qwt_polar_curve.h@ 9336

Last change on this file since 9336 was 4272, checked in by mervart, 12 years ago
File size: 4.4 KB
Line 
1/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * QwtPolar Widget Library
3 * Copyright (C) 2008 Uwe Rathmann
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the Qwt License, Version 1.0
7 *****************************************************************************/
8
9#ifndef QWT_POLAR_CURVE_H
10#define QWT_POLAR_CURVE_H
11
12#include "qwt_polar_global.h"
13#include "qwt_polar_item.h"
14#include <qwt_point_polar.h>
15#include <qwt_series_data.h>
16
17class QPainter;
18class QwtSymbol;
19class QwtCurveFitter;
20
21/*!
22 \brief An item, that represents a series of points
23
24 A curve is the representation of a series of points in polar coordinates.
25 The points are connected to the curve using the abstract QwtData interface.
26
27 \sa QwtPolarPlot, QwtSymbol, QwtScaleMap
28*/
29
30class QWT_POLAR_EXPORT QwtPolarCurve: public QwtPolarItem
31{
32public:
33 /*!
34 Curve styles.
35 \sa setStyle(), style()
36 */
37 enum CurveStyle
38 {
39 //! Don't draw a curve. Note: This doesn't affect the symbols.
40 NoCurve,
41
42 /*!
43 Connect the points with straight lines. The lines might
44 be interpolated depending on the 'Fitted' attribute. Curve
45 fitting can be configured using setCurveFitter().
46 */
47 Lines,
48
49 //! Values > 100 are reserved for user specific curve styles
50 UserCurve = 100
51 };
52
53 /*!
54 \brief Attributes how to represent the curve on the legend
55
56 If none of the flags is activated QwtPlotCurve tries to find
57 a color representing the curve and paints a rectangle with it.
58 In the default setting all attributes are off.
59
60 \sa setLegendAttribute(), testLegendAttribute(),
61 drawLegendIdentifier()
62 */
63
64 enum LegendAttribute
65 {
66 /*!
67 If the curveStyle() is not NoCurve a line is painted with the
68 curvePen().
69 */
70 LegendShowLine = 0x01,
71
72 //! If the curve has a valid symbol it is painted.
73 LegendShowSymbol = 0x02
74 };
75
76 //! Legend attributes
77 typedef QFlags<LegendAttribute> LegendAttributes;
78
79
80 explicit QwtPolarCurve();
81 explicit QwtPolarCurve( const QwtText &title );
82 explicit QwtPolarCurve( const QString &title );
83
84 virtual ~QwtPolarCurve();
85
86 virtual int rtti() const;
87
88 void setLegendAttribute( LegendAttribute, bool on = true );
89 bool testLegendAttribute( LegendAttribute ) const;
90
91 void setData( QwtSeriesData<QwtPointPolar> *data );
92 const QwtSeriesData<QwtPointPolar> *data() const;
93
94 size_t dataSize() const;
95 QwtPointPolar sample( int i ) const;
96
97 void setPen( const QPen & );
98 const QPen &pen() const;
99
100 void setStyle( CurveStyle style );
101 CurveStyle style() const;
102
103 void setSymbol( const QwtSymbol * );
104 const QwtSymbol *symbol() const;
105
106 void setCurveFitter( QwtCurveFitter * );
107 QwtCurveFitter *curveFitter() const;
108
109 virtual void draw( QPainter *p,
110 const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
111 const QPointF &pole, double radius,
112 const QRectF &canvasRect ) const;
113
114 virtual void draw( QPainter *p,
115 const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
116 const QPointF &pole, int from, int to ) const;
117
118 virtual void updateLegend( QwtLegend * ) const;
119 virtual QwtInterval boundingInterval( int scaleId ) const;
120
121 virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const;
122
123protected:
124
125 void init();
126
127 virtual void drawCurve( QPainter *, int style,
128 const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
129 const QPointF &pole, int from, int to ) const;
130
131 virtual void drawSymbols( QPainter *, const QwtSymbol &,
132 const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
133 const QPointF &pole, int from, int to ) const;
134
135 void drawLines( QPainter *,
136 const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
137 const QPointF &pole, int from, int to ) const;
138
139private:
140 QwtSeriesData<QwtPointPolar> *d_series;
141
142 class PrivateData;
143 PrivateData *d_data;
144};
145
146//! \return the the curve data
147inline const QwtSeriesData<QwtPointPolar> *QwtPolarCurve::data() const
148{
149 return d_series;
150}
151
152/*!
153 \param i index
154 \return point at position i
155*/
156inline QwtPointPolar QwtPolarCurve::sample( int i ) const
157{
158 return d_series->sample( i );
159}
160
161Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarCurve::LegendAttributes )
162
163#endif
Note: See TracBrowser for help on using the repository browser.