Qwt Polar User's Guide 1.0.0
|
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ***************************** 00002 * QwtPolar Widget Library 00003 * Copyright (C) 2008 Uwe Rathmann 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the Qwt License, Version 1.0 00007 *****************************************************************************/ 00008 00009 #ifndef QWT_POLAR_CURVE_H 00010 #define QWT_POLAR_CURVE_H 00011 00012 #include "qwt_polar_global.h" 00013 #include "qwt_polar_item.h" 00014 #include <qwt_point_polar.h> 00015 #include <qwt_series_data.h> 00016 00017 class QPainter; 00018 class QwtSymbol; 00019 class QwtCurveFitter; 00020 00030 class QWT_POLAR_EXPORT QwtPolarCurve: public QwtPolarItem 00031 { 00032 public: 00037 enum CurveStyle 00038 { 00040 NoCurve, 00041 00047 Lines, 00048 00050 UserCurve = 100 00051 }; 00052 00064 enum LegendAttribute 00065 { 00070 LegendShowLine = 0x01, 00071 00073 LegendShowSymbol = 0x02 00074 }; 00075 00077 typedef QFlags<LegendAttribute> LegendAttributes; 00078 00079 00080 explicit QwtPolarCurve(); 00081 explicit QwtPolarCurve( const QwtText &title ); 00082 explicit QwtPolarCurve( const QString &title ); 00083 00084 virtual ~QwtPolarCurve(); 00085 00086 virtual int rtti() const; 00087 00088 void setLegendAttribute( LegendAttribute, bool on = true ); 00089 bool testLegendAttribute( LegendAttribute ) const; 00090 00091 void setData( QwtSeriesData<QwtPointPolar> *data ); 00092 const QwtSeriesData<QwtPointPolar> *data() const; 00093 00094 size_t dataSize() const; 00095 QwtPointPolar sample( int i ) const; 00096 00097 void setPen( const QPen & ); 00098 const QPen &pen() const; 00099 00100 void setStyle( CurveStyle style ); 00101 CurveStyle style() const; 00102 00103 void setSymbol( const QwtSymbol * ); 00104 const QwtSymbol *symbol() const; 00105 00106 void setCurveFitter( QwtCurveFitter * ); 00107 QwtCurveFitter *curveFitter() const; 00108 00109 virtual void draw( QPainter *p, 00110 const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, 00111 const QPointF &pole, double radius, 00112 const QRectF &canvasRect ) const; 00113 00114 virtual void draw( QPainter *p, 00115 const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, 00116 const QPointF &pole, int from, int to ) const; 00117 00118 virtual void updateLegend( QwtLegend * ) const; 00119 virtual QwtInterval boundingInterval( int scaleId ) const; 00120 00121 virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const; 00122 00123 protected: 00124 00125 void init(); 00126 00127 virtual void drawCurve( QPainter *, int style, 00128 const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, 00129 const QPointF &pole, int from, int to ) const; 00130 00131 virtual void drawSymbols( QPainter *, const QwtSymbol &, 00132 const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, 00133 const QPointF &pole, int from, int to ) const; 00134 00135 void drawLines( QPainter *, 00136 const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, 00137 const QPointF &pole, int from, int to ) const; 00138 00139 private: 00140 QwtSeriesData<QwtPointPolar> *d_series; 00141 00142 class PrivateData; 00143 PrivateData *d_data; 00144 }; 00145 00147 inline const QwtSeriesData<QwtPointPolar> *QwtPolarCurve::data() const 00148 { 00149 return d_series; 00150 } 00151 00156 inline QwtPointPolar QwtPolarCurve::sample( int i ) const 00157 { 00158 return d_series->sample( i ); 00159 } 00160 00161 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPolarCurve::LegendAttributes ) 00162 00163 #endif