KDChartPieDiagram.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KDCHARTPIEDIAGRAM_H
00024 #define KDCHARTPIEDIAGRAM_H
00025
00026 #include "KDChartAbstractPieDiagram.h"
00027
00028 namespace KDChart {
00029
00030 class DataValueTextInfo;
00031 typedef class QVector<DataValueTextInfo> DataValueTextInfoList;
00032
00036 class KDCHART_EXPORT PieDiagram : public AbstractPieDiagram
00037 {
00038 Q_OBJECT
00039
00040 Q_DISABLE_COPY( PieDiagram )
00041 KDCHART_DECLARE_DERIVED_DIAGRAM( PieDiagram, PolarCoordinatePlane )
00042
00043 public:
00044 explicit PieDiagram(
00045 QWidget* parent = 0, PolarCoordinatePlane* plane = 0 );
00046 virtual ~PieDiagram();
00047
00048 protected:
00049
00051 virtual void paint ( PaintContext* paintContext );
00052 void paintInternal(PaintContext* paintContext, QRectF& textBoundingRect);
00053
00054 public:
00056 virtual void resize ( const QSizeF& area );
00057
00058
00060 virtual double valueTotals () const;
00062 virtual double numberOfValuesPerDataset() const;
00064 virtual double numberOfGridRings() const;
00065
00066 virtual PieDiagram * clone() const;
00067
00068 protected:
00070 virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const;
00071 void paintEvent( QPaintEvent* );
00072 void resizeEvent( QResizeEvent* );
00073
00074 private:
00075 QRectF piePosition( uint dataset, uint pie ) const;
00076 void drawOnePie( QPainter* painter,
00077 DataValueTextInfoList* list,
00078 uint dataset, uint pie,
00079 qreal granularity,
00080 qreal threeDPieHeight );
00081 void drawPieSurface( QPainter* painter,
00082 DataValueTextInfoList* list,
00083 uint dataset, uint pie,
00084 qreal granularity );
00085 void draw3DEffect( QPainter* painter,
00086 const QRectF& drawPosition,
00087 uint dataset, uint pie,
00088 qreal granularity,
00089 const ThreeDPieAttributes& threeDAttrs,
00090 bool );
00091 void drawStraightEffectSegment( QPainter* painter,
00092 const QRectF& rect,
00093 qreal threeDHeight,
00094 qreal angle );
00095 void drawUpperBrinkEffect( QPainter* painter,
00096 const QRectF& rect,
00097 qreal angle );
00098 void drawArcEffectSegment( QPainter* painter,
00099 const QRectF& rect,
00100 qreal threeDHeight,
00101 qreal startAngle,
00102 qreal endAngle,
00103 qreal granularity );
00104 void drawArcUpperBrinkEffectSegment( QPainter* painter,
00105 const QRectF& rect,
00106 qreal startAngle,
00107 qreal endAngle,
00108 qreal granularity );
00109 uint findPieAt( qreal angle, int columnCount );
00110 uint findLeftPie( uint pie, int columnCount );
00111 uint findRightPie( uint pie, int columnCount );
00112 QPointF pointOnCircle( const QRectF& rect, qreal angle );
00113 };
00114
00115 }
00116 #endif // KDCHARTPIEDIAGRAM_H