当前位置: 首页>>代码示例>>C++>>正文


C++ QPointArray::point方法代码示例

本文整理汇总了C++中QPointArray::point方法的典型用法代码示例。如果您正苦于以下问题:C++ QPointArray::point方法的具体用法?C++ QPointArray::point怎么用?C++ QPointArray::point使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPointArray的用法示例。


在下文中一共展示了QPointArray::point方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: customEvent

void ClusterView::customEvent(QCustomEvent* event){
 if(event->type() == QEvent::User + 700){
  QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
  
  ComputeEvent* computeEvent = (ComputeEvent*) event;
  //Get the polygon
  QPointArray polygon = computeEvent->polygon();
  QRegion selectionArea;
  QPointArray reviewPolygon;
  long Xdimension = 0;
  long Ydimension = 0;

   //The QRegion uses rectangles to define its area and the number of rectangles
   //increases with the height of the region (y axis). The more rectangles the longer
   //the search of one point in the region will take. With a dimension like the time
   //the height has an order of the millon (at least 5 going to 80 or more) given a huge amount
   //of rectangles. A way of speeding the search of points is to reduce the number of rectangles.
   //To do so, if the y dimension is the time, x and y axis are inverted.
   //Caution: in Qt graphical coordinate system, the Y axis is inverted (increasing downwards),
   //thus a point (x,y) is drawn as (x,-y), before creating the region the points are reset to there raw value (x,y).
     
  if(view.ordinateDimension() != timeDimension){
    for(uint i = 0; i< polygon.size();++i){
     reviewPolygon.putPoints(i, 1,polygon.point(i).x(),-polygon.point(i).y());
     Xdimension = dimensionX;
     Ydimension = dimensionY;    
    }
  }
  else{    
    for(uint i = 0; i< polygon.size();++i){
     reviewPolygon.putPoints(i, 1,-polygon.point(i).y(),polygon.point(i).x());

     Xdimension = dimensionY;
     Ydimension = dimensionX;         
   }
  }
  //Create a QRegion with the new selection area in order to use the research facilities offer by a QRegion.  
  selectionArea = QRegion(reviewPolygon);
  if(!selectionArea.isNull()){
    //Call any appropriate method
    switch(mode){
     case DELETE_NOISE:
        doc.deleteNoise(selectionArea,view.clusters(),Xdimension,Ydimension);        
        break;
     case DELETE_ARTEFACT:
       doc.deleteArtifact(selectionArea,view.clusters(),Xdimension,Ydimension);
       break;
     case NEW_CLUSTER:
       doc.createNewCluster(selectionArea,view.clusters(),Xdimension,Ydimension);
       break;
     case NEW_CLUSTERS:
        doc.createNewClusters(selectionArea,view.clusters(),Xdimension,Ydimension);
       break;
     case ZOOM:
       break; //nothing to do   
    }
  }
  QApplication::restoreOverrideCursor(); 
 }
}
开发者ID:caffeine-xx,项目名称:klusters,代码行数:60,代码来源:clusterview.cpp

示例2: 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;
}
开发者ID:opieproject,项目名称:qte-opie,代码行数:11,代码来源:qwmatrix.cpp

示例3: 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));
    }
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:24,代码来源:qwt_curve.cpp

示例4: drawEllipses

// --------------------------------------------------------------------------------
void QmvCanvasGrid::drawEllipses( const QPointArray & pa,
                                  int w, int h, const QPen & pen )
{

    QPainter pt;
    pt.begin(&work_pixmap);
    pt.setPen( pen );
    
        // we want the centre at pa.point
    for ( int i = 0; i < pa.count(); i++ )
        pt.drawEllipse( pa.point(i).x() - w/2,
                        pa.point(i).y() - h/2, w, h );
    pt.end();
    
    updateGridImage( work_pixmap );
        
}
开发者ID:py1668,项目名称:xpracman-qt2-final,代码行数:18,代码来源:qmvcanvasgrid.cpp

示例5: 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();
	}
开发者ID:netrunner-debian-kde-extras,项目名称:kvirc,代码行数:45,代码来源:canvaswidget.cpp

示例6: beginDragPolygon

	void KviCanvasView::beginDragPolygon(KviCanvasPolygon * it,const QPoint &p,bool bShift,bool bCtrl)
	{
		m_dragBegin = QPoint((int)(p.x() - it->x()),(int)(p.y() - it->y()));

		QPointArray pa = it->areaPoints();

		for(unsigned int i=0;i<pa.size();i++)
		{
			QPoint pnt = pa.point(i);
			double dX = pnt.x() - p.x();
			double dY = pnt.y() - p.y();
			double dHypot = sqrt((dX * dX) + (dY * dY));
			if(dHypot < 3.0)
			{
				// We're dragging a point
				m_dragMode = SinglePoint;
				m_dragPointIndex = i;
				setCursor(crossCursor);
				return;
			}
		}

		if(bShift)
		{
			m_dragMode = Scale;
			m_dragScaleFactor = it->scaleFactor();
			setCursor(sizeAllCursor);
			return;
		}

		if(bCtrl)
		{
			m_dragMode = Rotate;
			m_dragPointArray = it->internalPoints();
	//		qDebug("Here");
			setCursor(sizeHorCursor);
			return;
		}

		m_dragMode = All;
		setCursor(pointingHandCursor);
	}
开发者ID:netrunner-debian-kde-extras,项目名称:kvirc,代码行数:42,代码来源:canvaswidget.cpp

示例7: drawText

// --------------------------------------------------------------------------------
void QmvCanvasGrid::drawText( const QPointArray & pa,
                              const QPen & pen, const QFont font, QString text, int w, int h )
{

    QPainter pt;
    pt.begin(&work_pixmap);
    
    pt.setPen( pen );
    pt.setFont( font );
    
        // we want the centre at pa.point
    int x, y;
    for ( int i = 0; i < pa.count(); i++ )
    {
        x = pa.point(i).x() - w/2;
        y = pa.point(i).y() - h/2;
        pt.drawText( x, y, w, h,
                     AlignHCenter | AlignVCenter,
                     text, text.length() );
    }
    pt.end();
    
    updateGridImage( work_pixmap );
}
开发者ID:py1668,项目名称:xpracman-qt2-final,代码行数:25,代码来源:qmvcanvasgrid.cpp

示例8: specificPaintData

void KDChartLinesPainter::specificPaintData( QPainter* painter,
                                             const QRect& /*ourClipRect*/,
                                             KDChartTableDataBase* data,
                                             KDChartDataRegionList* regions,
                                             const KDChartAxisParams* ordinatePara,
                                             bool /*bNormalMode*/,
                                             uint chart,
                                             double logWidth,
                                             double /*areaWidthP1000*/,
                                             double logHeight,
                                             double axisYOffset,
                                             double minColumnValue,
                                             double maxColumnValue,
                                             double columnValueDistance,
                                             uint /*chartDatasetStart*/,
                                             uint /*chartDatasetEnd*/,
                                             uint datasetStart,
                                             uint datasetEnd )
{
    if( !data ) return;


    abscissaInfos ai;
    ai.bCenterThePoints = mCenterThePoints;
    calculateAbscissaInfos( *params(), *data,
                            datasetStart, datasetEnd,
                            logWidth, _dataRect,
                            ai );
    mCenterThePoints = ai.bCenterThePoints;

    bool bOrdinateDecreasing = ordinatePara
        ? ordinatePara->axisValuesDecreasing()
        : false;
    bool bOrdinateIsLogarithmic
        = ordinatePara
        ? (KDChartAxisParams::AxisCalcLogarithmic == ordinatePara->axisCalcMode())
        : false;

    //const double ordinatePixelsPerUnit = logHeight / columnValueDistance;
    const double ordinatePixelsPerUnit
        = (    ordinatePara
               && (0.0 != ordinatePara->trueAxisDeltaPixels())
               && (0.0 != ordinatePara->trueAxisDelta()))
        ? ordinatePara->trueAxisDeltaPixels() / ordinatePara->trueAxisDelta()
        : logHeight / columnValueDistance;;
    //qDebug("ordinatePixelsPerUnit: %f",ordinatePixelsPerUnit);


    const bool showThreeDLines = !mIsArea && params()->threeDLines();

    enum { Normal, Stacked, Percent } mode = Normal;
    if (    (    ( mChartType                   == KDChartParams::Line )
                 && ( params()->lineChartSubType() == KDChartParams::LineNormal ) )
            || (    ( mChartType                   == KDChartParams::Area )
                    && ( params()->areaChartSubType() == KDChartParams::AreaNormal ) ) )
        mode = Normal;
    else if (    (    ( mChartType                   == KDChartParams::Line )
                      && ( params()->lineChartSubType() == KDChartParams::LineStacked ) )
                 || (    ( mChartType                   == KDChartParams::Area )
                         && ( params()->areaChartSubType() == KDChartParams::AreaStacked ) ) )
        mode = Stacked;
    else if (    (    ( mChartType                   == KDChartParams::Line )
                      && ( params()->lineChartSubType() == KDChartParams::LinePercent ) )
                 || (    ( mChartType                   == KDChartParams::Area )
                         && ( params()->areaChartSubType() == KDChartParams::AreaPercent ) ) )
        mode = Percent;
    else
        qDebug( "Internal error in KDChartLinesPainter::paintDataInternal(): Unknown subtype" );


    QMap < int, double > currentValueSums;
    if ( mode == Stacked || mode == Percent ) {
        // this array is only used for stacked and percent lines, no need
        // to waste time initializing it for normal types
        for ( int value = 0; value < ai.numValues; ++value )
            currentValueSums[ value ] = 0.0;
    }
    QMap < int, double > totalValueSums;

    // compute the position of the 0 axis
    double zeroXAxisI;
    if ( mode == Percent ) {
        if ( minColumnValue == 0.0 )
            zeroXAxisI = logHeight + axisYOffset;
        else if( maxColumnValue == 0.0 )
            zeroXAxisI = _dataRect.y() + axisYOffset;
        else
            zeroXAxisI = logHeight / 2.0 + _dataRect.y();
    } else
        zeroXAxisI = ordinatePara->axisZeroLineStartY() - _dataRect.y();


    // compute how to shift of the points in case we want them in the
    // middle of their respective columns
    int xShift = mCenterThePoints ? static_cast < int > ( ai.pointDist * 0.5 ) : 0;


    // calculate all points' positions
    // ===============================
    int arrayNumDatasets = 0;
//.........这里部分代码省略.........
开发者ID:sajidji94,项目名称:kmymoney2,代码行数:101,代码来源:KDChartLinesPainter.cpp

示例9: 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() )
//.........这里部分代码省略.........
开发者ID:JustDevZero,项目名称:bulmages,代码行数:101,代码来源:tobarchart.cpp


注:本文中的QPointArray::point方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。