1
/****************************************************************************
2
** Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. All rights reserved.
4
** This file is part of the KD Chart library.
6
** Licensees holding valid commercial KD Chart licenses may use this file in
7
** accordance with the KD Chart Commercial License Agreement provided with
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 and version 3 as published by the
13
** Free Software Foundation and appearing in the file LICENSE.GPL included.
15
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18
** Contact info@kdab.com if any conditions of this licensing are not
21
**********************************************************************/
23
#ifndef KDCHARTPIEDIAGRAM_H
24
#define KDCHARTPIEDIAGRAM_H
26
#include "KDChartAbstractPieDiagram.h"
30
class DataValueTextInfo;
31
typedef class QVector<DataValueTextInfo> DataValueTextInfoList;
34
* @brief PieDiagram defines a common pie diagram
36
class KDCHART_EXPORT PieDiagram : public AbstractPieDiagram
40
Q_DISABLE_COPY( PieDiagram )
41
KDCHART_DECLARE_DERIVED_DIAGRAM( PieDiagram, PolarCoordinatePlane )
45
QWidget* parent = 0, PolarCoordinatePlane* plane = 0 );
46
virtual ~PieDiagram();
49
// Implement AbstractDiagram
51
virtual void paint ( PaintContext* paintContext );
52
void paintInternal(PaintContext* paintContext, QRectF& textBoundingRect);
56
virtual void resize ( const QSizeF& area );
58
// Implement AbstractPolarDiagram
60
virtual double valueTotals () const;
62
virtual double numberOfValuesPerDataset() const;
64
virtual double numberOfGridRings() const;
66
virtual PieDiagram * clone() const;
70
virtual const QPair<QPointF, QPointF> calculateDataBoundaries() const;
71
void paintEvent( QPaintEvent* );
72
void resizeEvent( QResizeEvent* );
75
QRectF piePosition( uint dataset, uint pie ) const;
76
void drawOnePie( QPainter* painter,
77
DataValueTextInfoList* list,
78
uint dataset, uint pie,
80
qreal threeDPieHeight );
81
void drawPieSurface( QPainter* painter,
82
DataValueTextInfoList* list,
83
uint dataset, uint pie,
85
void draw3DEffect( QPainter* painter,
86
const QRectF& drawPosition,
87
uint dataset, uint pie,
89
const ThreeDPieAttributes& threeDAttrs,
91
void drawStraightEffectSegment( QPainter* painter,
95
void drawUpperBrinkEffect( QPainter* painter,
98
void drawArcEffectSegment( QPainter* painter,
104
void drawArcUpperBrinkEffectSegment( QPainter* painter,
109
uint findPieAt( qreal angle, int columnCount );
110
uint findLeftPie( uint pie, int columnCount );
111
uint findRightPie( uint pie, int columnCount );
112
QPointF pointOnCircle( const QRectF& rect, qreal angle );
113
}; // End of class KDChartPieDiagram
116
#endif // KDCHARTPIEDIAGRAM_H