本文整理汇总了C++中QPointArray::setPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ QPointArray::setPoint方法的具体用法?C++ QPointArray::setPoint怎么用?C++ QPointArray::setPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPointArray
的用法示例。
在下文中一共展示了QPointArray::setPoint方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createEllipse
void RS_Painter::createEllipse(QPointArray& pa,
const RS_Vector& cp,
double radius1, double radius2,
double angle,
double angle1, double angle2,
bool reversed)
{
double aStep; // Angle Step (rad)
double a; // Current Angle (rad)
aStep=0.01;
RS_Vector vp;
RS_Vector vc(cp.x, cp.y);
vp.set(cp.x+cos(angle1)*radius1,
cp.y-sin(angle1)*radius2);
vp.rotate(vc, -angle);
int i=0;
pa.resize(i+1);
pa.setPoint(i++, toScreenX(vp.x),toScreenY(vp.y));
if(!reversed) {
// Arc Counterclockwise:
if(angle1>angle2-RS_TOLERANCE) {
angle2+=2*M_PI;
}
for(a=angle1+aStep; a<=angle2; a+=aStep) {
vp.set(cp.x+cos(a)*radius1,
cp.y-sin(a)*radius2);
vp.rotate(vc, -angle);
pa.resize(i+1);
pa.setPoint(i++, toScreenX(vp.x),toScreenY(vp.y));
}
} else {
// Arc Clockwise:
if(angle1<angle2+RS_TOLERANCE) {
angle2-=2*M_PI;
}
for(a=angle1-aStep; a>=angle2; a-=aStep) {
vp.set(cp.x+cos(a)*radius1,
cp.y-sin(a)*radius2);
vp.rotate(vc, -angle);
pa.resize(i+1);
pa.setPoint(i++, toScreenX(vp.x),toScreenY(vp.y));
}
}
vp.set(cp.x+cos(angle2)*radius1,
cp.y-sin(angle2)*radius2);
vp.rotate(vc, -angle);
pa.resize(i+1);
pa.setPoint(i++, toScreenX(vp.x),toScreenY(vp.y));
}
示例2: drawDots
/*!
\brief Draw dots
\param painter Painter
\param xMap x map
\param yMap y map
\param from index of the first point to be painted
\param to index of the last point to be painted
\sa QwtCurve::drawPolyline, QwtCurve::drawLine,
QwtCurve::drawLines, QwtCurve::drawSpline, QwtCurve::drawSteps
QwtCurve::drawPolyline, QwtCurve::drawPolygon
*/
void QwtCurve::drawDots(QPainter *painter,
const QwtDiMap &xMap, const QwtDiMap &yMap, int from, int to)
{
const bool doFill = painter->brush().style() != Qt::NoBrush;
QPointArray polyline;
if ( doFill )
polyline.resize(to - from + 1);
for (int i = from; i <= to; i++)
{
int xi = xMap.transform(x(i));
int yi = yMap.transform(y(i));
QwtPainter::drawPoint(painter, xi, yi);
if ( doFill )
polyline.setPoint(i - from, xi, yi);
}
if ( doFill )
{
closePolyline(xMap, yMap, polyline);
painter->setPen(QPen(Qt::NoPen));
QwtPainter::drawPolygon(painter, polyline);
}
}
示例3: dragPolygon
void KviCanvasView::dragPolygon(KviCanvasPolygon * it,const QPoint &p)
{
switch(m_dragMode)
{
case All:
it->move(p.x() - m_dragBegin.x(),p.y() - m_dragBegin.y());
break;
case SinglePoint:
{
QPointArray pnt = it->internalPoints();
pnt.setPoint(m_dragPointIndex,(int)((p.x() - it->x()) / it->scaleFactor()),(int)((p.y() - it->y()) / it->scaleFactor()));
it->setInternalPoints(pnt);
}
break;
case Scale:
{
double dDistance = ssm_hypot(p.x() - it->x(),p.y() - it->y());
double dOriginal = ssm_hypot(m_dragBegin.x(),m_dragBegin.y());
if(dOriginal < 1)dOriginal = 1;
if(dDistance < 0.1)dDistance = 0.1;
it->setScaleFactor(m_dragScaleFactor * dDistance / dOriginal);
}
break;
case Rotate:
{
QPoint act((int)(p.x() - it->x()),(int)(p.y() - it->y()));
double dAngle = ssm_2d_rotationAngle(m_dragBegin.x(),m_dragBegin.y(),act.x(),act.y());
// qDebug("%d,%d %d,%d %f",m_dragBegin.x(),m_dragBegin.y(),act.x(),act.y(),dAngle);
QPointArray thePoints = m_dragPointArray.copy();
for(unsigned int i=0;i<thePoints.size();i++)
{
QPoint tmp = thePoints.point(i);
double dx = tmp.x();
double dy = tmp.y();
ssm_2d_rotate(dx,dy,dAngle);
thePoints.setPoint(i,(int)dx,(int)dy);
}
it->setInternalPoints(thePoints);
}
break;
default:
break;
}
canvas()->update();
}
示例4: map
QPointArray QWMatrix::map( const QPointArray &a ) const
{
QPointArray result = a.copy();
int x, y;
for ( int i=0; i<(int)result.size(); i++ ) {
result.point( i, &x, &y );
map( x, y, &x, &y );
result.setPoint( i, x, y );
}
return result;
}
示例5: calcPolygonPoints
static void calcPolygonPoints(QPointArray &pnts,unsigned int nVertices)
{
double dDelta = (2 * M_PI) / nVertices;
for(unsigned int i=0;i<nVertices;i++)
{
double dAng = dDelta * i;
double theX = 300 * sin(dAng);
double theY = 300 * cos(dAng);
pnts.setPoint(i,(int)theX,(int)theY);
}
}
示例6: showItem
void TimelineSubItem::showItem( bool show, int coordY )
{
KDGanttViewTaskItem::showItem( show, coordY );
int y;
if ( coordY != 0 ) {
y = coordY;
} else {
y = getCoordY();
}
int startX = myGanttView->timeHeaderWidget()->getCoordX( myStartTime );
int endX = myGanttView->timeHeaderWidget()->getCoordX( myEndTime );
const int mw = qMax( 1, qMin( 4, endX - startX ) );
if ( !mLeft || mw != mMarkerWidth ) {
if ( !mLeft ) {
mLeft = new KDCanvasPolygon( myGanttView->timeTableWidget(), this, Type_is_KDGanttViewItem );
mLeft->setBrush( Qt::black );
}
QPointArray a = QPointArray( 4 );
a.setPoint( 0, 0, -mw -myItemSize / 2 - 2 );
a.setPoint( 1, mw, -myItemSize / 2 - 2 );
a.setPoint( 2, mw, myItemSize / 2 + 2 );
a.setPoint( 3, 0, myItemSize / 2 + mw + 2 );
mLeft->setPoints( a );
}
if ( !mRight || mw != mMarkerWidth ) {
if ( !mRight ) {
mRight = new KDCanvasPolygon( myGanttView->timeTableWidget(), this, Type_is_KDGanttViewItem );
mRight->setBrush( Qt::black );
}
QPointArray a = QPointArray( 4 );
a.setPoint( 0, -mw, -myItemSize / 2 - 2 );
a.setPoint( 1, 0, -myItemSize / 2 - mw - 2 );
a.setPoint( 2, 0, myItemSize / 2 + mw + 2 );
a.setPoint( 3, -mw, myItemSize / 2 + 2 );
mRight->setPoints( a );
}
mMarkerWidth = mw;
mLeft->setX( startX );
mLeft->setY( y );
mLeft->setZ( startShape->z() - 1 );
mLeft->show();
mRight->setX( endX );
mRight->setY( y );
mRight->setZ( startShape->z() - 1 );
mRight->show();
}
示例7: closePolyline
void QwtCurve::closePolyline(const QwtDiMap &xMap, const QwtDiMap &yMap,
QPointArray &pa) const
{
const int sz = pa.size();
if ( sz < 2 )
return;
pa.resize(sz + 2);
if ( d_options & QwtCurve::Xfy )
{
pa.setPoint(sz,
xMap.transform(d_ref), pa.point(sz - 1).y());
pa.setPoint(sz + 1,
xMap.transform(d_ref), pa.point(0).y());
}
else
{
pa.setPoint(sz,
pa.point(sz - 1).x(), yMap.transform(d_ref));
pa.setPoint(pa.size() - 1,
pa.point(0).x(), yMap.transform(d_ref));
}
}
示例8: DrawMap
void MarkerBar::DrawMap()
{
QPixmap *pix=new QPixmap(size());
QPainter *p=new QPainter(pix);
QPointArray *pt;
p->fillRect(0,0,size().width(),size().height(),backgroundColor());
if(marker_length>0) {
p->setPen(EVENT_EDITOR_START_MARKER);
p->setBrush(EVENT_EDITOR_START_MARKER);
p->fillRect(size().width()*marker_pos[MarkerBar::Start]/marker_length-2,0,
4,size().height(),EVENT_EDITOR_START_MARKER);
pt=new QPointArray(3);
pt->setPoint(0,size().width()*marker_pos[MarkerBar::Start]/marker_length-2,
size().height()/2-1);
pt->setPoint(1,size().width()*marker_pos[MarkerBar::Start]/marker_length-12,
size().height()-2);
pt->setPoint(2,size().width()*marker_pos[MarkerBar::Start]/marker_length-12,
1);
p->drawPolygon(*pt);
p->fillRect(size().width()*marker_pos[MarkerBar::End]/marker_length-2,0,
4,size().height(),EVENT_EDITOR_START_MARKER);
pt->setPoint(0,size().width()*marker_pos[MarkerBar::End]/marker_length+2,
size().height()/2-1);
pt->setPoint(1,size().width()*marker_pos[MarkerBar::End]/marker_length+12,
size().height()-2);
pt->setPoint(2,size().width()*marker_pos[MarkerBar::End]/marker_length+12,
1);
p->drawPolygon(*pt);
delete pt;
p->setPen(EVENT_EDITOR_PLAY_MARKER);
p->setBrush(EVENT_EDITOR_PLAY_MARKER);
p->fillRect(size().width()*marker_pos[MarkerBar::Play]/marker_length-1,0,
2,size().height(),EVENT_EDITOR_PLAY_MARKER);
}
p->end();
setPixmap(*pix);
delete p;
delete pix;
}
示例9: qDrawMotifArrow
// motif arrows look the same whether they are used or not
// is this correct?
static void qDrawMotifArrow( QPainter *p, Qt::ArrowType type, bool down,
int x, int y, int w, int h,
const QColorGroup &g, bool )
{
QPointArray bFill; // fill polygon
QPointArray bTop; // top shadow.
QPointArray bBot; // bottom shadow.
QPointArray bLeft; // left shadow.
#ifndef QT_NO_TRANSFORMATIONS
QWMatrix matrix; // xform matrix
#endif
bool vertical = type == Qt::UpArrow || type == Qt::DownArrow;
bool horizontal = !vertical;
int dim = w < h ? w : h;
int colspec = 0x0000; // color specification array
if ( dim < 2 ) // too small arrow
return;
if ( dim > 3 ) {
if ( dim > 6 )
bFill.resize( dim & 1 ? 3 : 4 );
bTop.resize( (dim/2)*2 );
bBot.resize( dim & 1 ? dim + 1 : dim );
bLeft.resize( dim > 4 ? 4 : 2 );
bLeft.putPoints( 0, 2, 0,0, 0,dim-1 );
if ( dim > 4 )
bLeft.putPoints( 2, 2, 1,2, 1,dim-3 );
bTop.putPoints( 0, 4, 1,0, 1,1, 2,1, 3,1 );
bBot.putPoints( 0, 4, 1,dim-1, 1,dim-2, 2,dim-2, 3,dim-2 );
for( int i=0; i<dim/2-2 ; i++ ) {
bTop.putPoints( i*2+4, 2, 2+i*2,2+i, 5+i*2, 2+i );
bBot.putPoints( i*2+4, 2, 2+i*2,dim-3-i, 5+i*2,dim-3-i );
}
if ( dim & 1 ) // odd number size: extra line
bBot.putPoints( dim-1, 2, dim-3,dim/2, dim-1,dim/2 );
if ( dim > 6 ) { // dim>6: must fill interior
bFill.putPoints( 0, 2, 1,dim-3, 1,2 );
if ( dim & 1 ) // if size is an odd number
bFill.setPoint( 2, dim - 3, dim / 2 );
else
bFill.putPoints( 2, 2, dim-4,dim/2-1, dim-4,dim/2 );
}
}
else {
if ( dim == 3 ) { // 3x3 arrow pattern
bLeft.setPoints( 4, 0,0, 0,2, 1,1, 1,1 );
bTop .setPoints( 2, 1,0, 1,0 );
bBot .setPoints( 2, 1,2, 2,1 );
}
else { // 2x2 arrow pattern
bLeft.setPoints( 2, 0,0, 0,1 );
bTop .setPoints( 2, 1,0, 1,0 );
bBot .setPoints( 2, 1,1, 1,1 );
}
}
if ( type == Qt::UpArrow || type == Qt::LeftArrow ) {
#ifndef QT_NO_TRANSFORMATIONS // #### fix me!
matrix.translate( x, y );
if ( vertical ) {
matrix.translate( 0, h - 1 );
matrix.rotate( -90 );
} else {
matrix.translate( w - 1, h - 1 );
matrix.rotate( 180 );
}
#endif
if ( down )
colspec = horizontal ? 0x2334 : 0x2343;
else
colspec = horizontal ? 0x1443 : 0x1434;
}
else if ( type == Qt::DownArrow || type == Qt::RightArrow ) {
#ifndef QT_NO_TRANSFORMATIONS // #### fix me!
matrix.translate( x, y );
if ( vertical ) {
matrix.translate( w-1, 0 );
matrix.rotate( 90 );
}
#endif
if ( down )
colspec = horizontal ? 0x2443 : 0x2434;
else
colspec = horizontal ? 0x1334 : 0x1343;
}
QColor *cols[5];
cols[0] = 0;
cols[1] = (QColor *)&g.button();
cols[2] = (QColor *)&g.mid();
cols[3] = (QColor *)&g.light();
cols[4] = (QColor *)&g.dark();
#define CMID *cols[ (colspec>>12) & 0xf ]
#define CLEFT *cols[ (colspec>>8) & 0xf ]
#define CTOP *cols[ (colspec>>4) & 0xf ]
#define CBOT *cols[ colspec & 0xf ]
//.........这里部分代码省略.........
示例10: specificPaintData
//.........这里部分代码省略.........
// determine and store marker properties assigned to this cell
// -----------------------------------------------------------
currentDrawMarkers = defaultDrawMarkers;
int cellPropID;
if( data->cellProp( dataset, value, cellPropID ) &&
cellPropID != curPropSetId ){
if( cellPropID != KDChartPropertySet::UndefinedID &&
params()->calculateProperties( cellPropID,
curPropSet ) )
curPropSetId = cellPropID;
else
curPropSetId = KDChartPropertySet::UndefinedID;
}
if( curPropSetId != KDChartPropertySet::UndefinedID ){
// we can safely call the following functions and ignore their
// return values since they will touch the parameters' values
// if the propSet *contains* corresponding own values only.
int iDummy;
curPropSet.hasOwnShowMarker( iDummy, currentDrawMarkers );
}
int iVec = static_cast < int > ( datasetEnd-dataset ) * arrayNumValues + value;
if( allPoints[ iVec ].bValid && !allPoints[ iVec ].bSkipThis ){
const MyPoint& mp = allPoints[iVec];
//qDebug("\np.x() %i p.y() %i", p.x(), p.y() );
// For 3D lines, we need two points (that lie
// behind each other on the Z axis). For 2D lines and
// areas, we need only one point.
if( showThreeDLines ) {
points[0]->setPoint( point, project( mp.p.x(), mp.p.y(),
(datasetStart+dataset)*params()->threeDLineDepth() ) );
points[1]->setPoint( point, project( mp.p.x(), mp.p.y(),
(datasetStart+dataset + 1)*params()->threeDLineDepth() ) );
oripoints[0]->setPoint( point, mp.p.x(), mp.p.y() );
oripoints[1]->setPoint( point, mp.p.x() - (datasetStart+dataset + 1)*params()->threeDLineDepth(),
mp.p.y() - (datasetStart+dataset + 1)*params()->threeDLineDepth() );
} else
// 2D lines or areas
points[0]->setPoint( point, mp.p );
++point;
int x = mp.p.x();
int y = QMAX(QMIN(mp.p.y(),
static_cast < int > (logHeight +axisYOffset)),
0);
bool markerIsOutside = y != mp.p.y();
// draw the marker and store the region
if ( currentDrawMarkers ){
uint theAlignment = Qt::AlignCenter;
bool hasOwnSize = false;
int theWidth = 0;
int theHeight = 0;
QColor theColor(params()->dataColor( dataset ));
int theStyle = markerStyle;
if( curPropSetId != KDChartPropertySet::UndefinedID ){
// we can safely call the following functions and ignore their
// return values since they will touch the parameters' values
// if the propSet *contains* corresponding own values only.
int iDummy;
curPropSet.hasOwnMarkerAlign( iDummy, theAlignment );
curPropSet.hasOwnMarkerColor( iDummy, theColor );
示例11: addPoint
static void addPoint( QPointArray &a, const QPoint &p )
{
uint n = a.size();
a.resize( n + 1 );
a.setPoint( n, p );
}
示例12: drawArrow
void QCDEStyle::drawArrow( QPainter *p, ArrowType type, bool down,
int x, int y, int w, int h,
const QColorGroup &g, bool enabled, const QBrush * /* fill */ )
{
QPointArray bFill; // fill polygon
QPointArray bTop; // top shadow.
QPointArray bBot; // bottom shadow.
QPointArray bLeft; // left shadow.
QWMatrix matrix; // xform matrix
bool vertical = type == UpArrow || type == DownArrow;
bool horizontal = !vertical;
int dim = w < h ? w : h;
int colspec = 0x0000; // color specification array
if ( dim < 2 ) // too small arrow
return;
// adjust size and center (to fix rotation below)
if ( w > dim ) {
x += (w-dim)/2;
w = dim;
}
if ( h > dim ) {
y += (h-dim)/2;
h = dim;
}
if ( dim > 3 ) {
bFill.resize( dim & 1 ? 3 : 4 );
bTop.resize( 2 );
bBot.resize( 2 );
bLeft.resize( 2 );
bLeft.putPoints( 0, 2, 0,0, 0,dim-1 );
bTop.putPoints( 0, 2, 1,0, dim-1, dim/2);
bBot.putPoints( 0, 2, 1,dim-1, dim-1, dim/2);
if ( dim > 6 ) { // dim>6: must fill interior
bFill.putPoints( 0, 2, 1,dim-1, 1,1 );
if ( dim & 1 ) // if size is an odd number
bFill.setPoint( 2, dim - 2, dim / 2 );
else
bFill.putPoints( 2, 2, dim-2,dim/2-1, dim-2,dim/2 );
}
}
else {
if ( dim == 3 ) { // 3x3 arrow pattern
bLeft.setPoints( 4, 0,0, 0,2, 1,1, 1,1 );
bTop .setPoints( 2, 1,0, 1,0 );
bBot .setPoints( 2, 1,2, 2,1 );
}
else { // 2x2 arrow pattern
bLeft.setPoints( 2, 0,0, 0,1 );
bTop .setPoints( 2, 1,0, 1,0 );
bBot .setPoints( 2, 1,1, 1,1 );
}
}
if ( type == UpArrow || type == LeftArrow ) {
matrix.translate( x, y );
if ( vertical ) {
matrix.translate( 0, h - 1 );
matrix.rotate( -90 );
} else {
matrix.translate( w - 1, h - 1 );
matrix.rotate( 180 );
}
if ( down )
colspec = horizontal ? 0x2334 : 0x2343;
else
colspec = horizontal ? 0x1443 : 0x1434;
}
else if ( type == DownArrow || type == RightArrow ) {
matrix.translate( x, y );
if ( vertical ) {
matrix.translate( w-1, 0 );
matrix.rotate( 90 );
}
if ( down )
colspec = horizontal ? 0x2443 : 0x2434;
else
colspec = horizontal ? 0x1334 : 0x1343;
}
QColor *cols[5];
if ( enabled ) {
cols[0] = 0;
cols[1] = (QColor *)&g.button();
cols[2] = (QColor *)&g.mid();
cols[3] = (QColor *)&g.light();
cols[4] = (QColor *)&g.dark();
} else {
cols[0] = 0;
cols[1] = (QColor *)&g.button();
cols[2] = (QColor *)&g.button();
cols[3] = (QColor *)&g.button();
cols[4] = (QColor *)&g.button();
}
#define CMID *cols[ (colspec>>12) & 0xf ]
#define CLEFT *cols[ (colspec>>8) & 0xf ]
#define CTOP *cols[ (colspec>>4) & 0xf ]
//.........这里部分代码省略.........
示例13: paintChart
void toBarChart::paintChart ( QPainter *p, QRect &rect )
{
QFontMetrics fm = p->fontMetrics();
if ( !Zooming ) {
if ( MinAuto ) {
bool first = true;
std::list<std::list<double> >::reverse_iterator i = Values.rbegin();
if ( i != Values.rend() ) {
for ( std::list<double>::iterator j = ( *i ).begin();j != ( *i ).end();j++ ) {
if ( first ) {
first = false;
zMinValue = *j;
} else if ( zMinValue > *j )
zMinValue = *j;
}
}
}
if ( MaxAuto ) {
bool first = true;
std::list<double> total;
{
for ( std::list<std::list<double> >::iterator i = Values.begin();i != Values.end();i++ ) {
std::list<double>::iterator k = total.begin();
for ( std::list<double>::iterator j = ( *i ).begin();j != ( *i ).end();j++ ) {
if ( k == total.end() ) {
total.insert ( total.end(), *j );
k = total.end();
} else {
*k += *j;
k++;
}
}
}
}
for ( std::list<double>::iterator i = total.begin();i != total.end();i++ ) {
if ( first ) {
first = false;
zMaxValue = *i;
} else if ( zMaxValue < *i )
zMaxValue = *i;
}
}
if ( !MinAuto )
zMinValue = MinValue;
else
zMinValue = round ( zMinValue, false );
if ( !MaxAuto )
zMaxValue = MaxValue;
else
zMaxValue = round ( zMaxValue, true );
}
paintTitle ( p, rect );
paintLegend ( p, rect );
paintAxis ( p, rect );
std::list<QPointArray> Points;
int cp = 0;
int samples = countSamples();
int zeroy = int ( rect.height() - 2 - ( -zMinValue / ( zMaxValue - zMinValue ) * ( rect.height() - 4 ) ) );
if ( samples > 1 ) {
const QWMatrix & mtx = p->worldMatrix();
p->setClipRect ( int ( mtx.dx() + 2 ), int ( mtx.dy() + 2 ), rect.width() - 3, rect.height() - 3 );
if ( Zooming )
p->drawText ( 2, 2, rect.width() - 4, rect.height() - 4,
AlignLeft | AlignTop, "Zoom" );
for ( std::list<std::list<double> >::reverse_iterator i = Values.rbegin();i != Values.rend();i++ ) {
std::list<double> &val = *i;
int count = 0;
int skip = SkipSamples;
QPointArray a ( samples + 10 );
int x = rect.width() - 2;
for ( std::list<double>::reverse_iterator j = val.rbegin();j != val.rend() && x >= 2;j++ ) {
if ( skip > 0 )
skip--;
else {
int val = int ( rect.height() - 2 - ( ( *j - zMinValue ) / ( zMaxValue - zMinValue ) * ( rect.height() - 4 ) ) );
x = rect.width() - 2 - count * ( rect.width() - 4 ) / ( samples - 1 );
a.setPoint ( count, x, val );
count++;
if ( count >= samples )
break;
}
}
a.resize ( count * 2 );
Points.insert ( Points.end(), a );
cp++;
}
}
std::map<int, int> Bottom;
for ( std::list<QPointArray>::iterator i = Points.begin();i != Points.end();i++ ) {
QPointArray a = *i;
int lx = 0;
int lb = 0;
for ( unsigned int j = 0;j < a.size() / 2;j++ ) {
int x, y;
a.point ( j, &x, &y );
if ( Bottom.find ( x ) == Bottom.end() )
//.........这里部分代码省略.........
示例14: drawOnePie
//.........这里部分代码省略.........
datReg = new KDChartDataRegion( region->unite( QRegion( hitregion ) ),
dataset,
pie,
chart );
datReg->points[ KDChartEnums::PosCenter ]
= drawPosition.center();
datReg->points[ KDChartEnums::PosCenterRight ]
= pointOnCircle( drawPosition, 0 );
datReg->points[ KDChartEnums::PosTopRight ]
= pointOnCircle( drawPosition, 720 );
datReg->points[ KDChartEnums::PosTopCenter ]
= pointOnCircle( drawPosition, 1440 );
datReg->points[ KDChartEnums::PosTopLeft ]
= pointOnCircle( drawPosition, 2160 );
datReg->points[ KDChartEnums::PosCenterLeft ]
= pointOnCircle( drawPosition, 2880 );
datReg->points[ KDChartEnums::PosBottomLeft ]
= pointOnCircle( drawPosition, 3600 );
datReg->points[ KDChartEnums::PosBottomCenter ]
= pointOnCircle( drawPosition, 4320 );
datReg->points[ KDChartEnums::PosBottomRight ]
= pointOnCircle( drawPosition, 5040 );
datReg->startAngle = 2880;
datReg->angleLen = 5760;
regions->append( datReg );
}
} else {
// draw the top of this piece
// Start with getting the points for the arc.
const int arcPoints = angleLen;
QPointArray collect(arcPoints+2);
int i=0;
for ( ; i<=angleLen; ++i){
collect.setPoint(i, pointOnCircle( drawPosition, startAngle+i ));
}
// Adding the center point of the piece.
collect.setPoint(i, drawPosition.center() );
painter->drawPolygon( collect );
//if( bHelp ){
// painter->drawPolyline( collect );
//bHelp=false;
//}
if ( regions ) {
QPointArray hitregion;
hitregion.makeArc( drawPosition.x(), drawPosition.y(),
drawPosition.width(),
drawPosition.height(),
( int ) startAngle, ( int ) angleLen );
hitregion.resize( hitregion.size() + 1 );
hitregion.setPoint( hitregion.size() - 1,
drawPosition.center() );
datReg = new KDChartDataRegion( region->unite( QRegion( hitregion ) ),
dataset,
pie,
chart );
datReg->points[ KDChartEnums::PosTopLeft ]
= pointOnCircle( drawPosition, startAngle + angleLen );
datReg->points[ KDChartEnums::PosTopCenter ]