kchart
KDChartDataRegion.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef __KDCHARTDATAREGION__
00030 #define __KDCHARTDATAREGION__
00031
00032 #include <qregion.h>
00033 #include <qpointarray.h>
00034
00035 #include "KDChartGlobal.h"
00036
00040 struct KDCHART_EXPORT KDChartDataRegion
00041 {
00042 KDChartDataRegion()
00043 {
00044 init();
00045 }
00046
00047 KDChartDataRegion( QRegion region, uint r, uint c, uint ch )
00048 {
00049 init();
00050 pRegion = new QRegion( region );
00051 row = r;
00052 col = c;
00053 chart = ch;
00054 }
00055
00056 KDChartDataRegion( uint r, uint c, uint ch, QPointArray array )
00057 {
00058 init();
00059 pArray = new QPointArray( array );
00060 row = r;
00061 col = c;
00062 chart = ch;
00063 }
00064
00065 KDChartDataRegion( uint r, uint c, uint ch, QRect rect )
00066 {
00067 init();
00068 pRect = new QRect( rect );
00069 row = r;
00070 col = c;
00071 chart = ch;
00072 }
00073
00074 ~KDChartDataRegion()
00075 {
00076
00077 if( pRegion )
00078 delete pRegion;
00079 if( pArray )
00080 delete pArray;
00081 if( pRect )
00082 delete pRect;
00083 if( pTextRegion )
00084 delete pTextRegion;
00085 }
00086
00087 QRegion region() const
00088 {
00089 if( pRegion )
00090 return *pRegion;
00091 if( pArray )
00092 return QRegion( *pArray );
00093 if( pRect )
00094 return QRegion( *pRect );
00095 return QRegion();
00096 }
00097
00098 QRect rect() const
00099 {
00100 if( pRegion )
00101 return pRegion->boundingRect();
00102 if( pArray )
00103 return pArray->boundingRect();
00104 if( pRect )
00105 return *pRect;
00106 return QRect();
00107 }
00108
00109 void init()
00110 {
00111 pRegion = 0;
00112 pArray = 0;
00113 pRect = 0;
00114 pTextRegion = 0;
00115 row = 0;
00116 col = 0;
00117 chart = 0;
00118 negative = false;
00119 points.resize( 9 );
00120 startAngle = 1440;
00121 angleLen = 1;
00122 }
00123
00124 QRegion* pRegion;
00125 QPointArray* pArray;
00126 QRect* pRect;
00127 QRegion* pTextRegion;
00128
00129
00130
00131
00132
00133
00134
00135 QPointArray points;
00136
00137 int startAngle;
00138 int angleLen;
00139
00140 uint row;
00141 uint col;
00142
00143 uint chart;
00144 QString text;
00145 bool negative;
00146 };
00147
00148
00168 typedef QPtrList < KDChartDataRegion > KDChartDataRegionList;
00169
00170 #endif
|