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


C++ QPolygon::size方法代码示例

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


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

示例1: small

vector<int> PerimeterWindow::boundaryFromPolygon(QPolygon poly, int xo, int yo, int gw){
    // not sure of the best way of doing this, but lets have a go..
    vector<int> points;
    if(poly.size() < 2){
	cerr << "PerimeterWindow::boundaryFromPolygon, points is too small (less than 2) " << poly.size() << endl;
	return(points);
    }
    for(uint i=1; i < poly.size(); i++){   
	// Fill in the points from i-1 to i
	QPoint p1 = poly[i-1];
	QPoint p2 = poly[i];
//	points.push_back((p1.y() + yo) * gw + p1.x() + xo);
	// then work out how to get the other points..
	int dx = p2.x() - p1.x();
	int dy = p2.y() - p1.y();
	int stepNo = abs(dx) > abs(dy) ? abs(dx) : abs(dy);  
        // in the funny world of pixels a diagonal is only as long as the longer side..
	for(int i=0; i < stepNo; i++){
	    int lx = p1.x() + (i * dx)/stepNo;
	    int ly = p1.y() + (i * dy)/stepNo;
	    // then convert and push back..
	    points.push_back((ly + yo) * gw + lx + xo);
	}
    }
    // but at this point we have not added the last point so we need to do that..
    QPoint p = poly.back();
    points.push_back( (p.y() + yo) * gw + p.x() + xo);
    return(points);
}
开发者ID:lmjakt,项目名称:dvreader,代码行数:29,代码来源:perimeterWindow.cpp

示例2: PolygonSize

// public static
kpCommandSize::SizeType kpCommandSize::PolygonSize (const QPolygon &points)
{
#if DEBUG_KP_COMMAND_SIZE && 1
    qCDebug(kpLogCommands) << "kpCommandSize::PolygonSize() points.size="
               << points.size ()
               << " sizeof(QPoint)=" << sizeof (QPoint)
               << endl;
#endif

    return ((SizeType) points.size () * sizeof (QPoint));
}
开发者ID:KDE,项目名称:kolourpaint,代码行数:12,代码来源:kpCommandSize.cpp

示例3: getArea

double RS_InfoArea::getArea(const QPolygon& polygon)
{
    double ret= 0.0;
    if(polygon.size()<3) return ret;

    for(int i=0;i<polygon.size(); ++i){
        const QPoint& p0=polygon.at(i);
        const QPoint& p1=polygon.at((i+1)%polygon.size());
        ret += p0.x()*p1.y()-p0.y()*p1.x();
    }
    return 0.5*fabs(ret);
}
开发者ID:CERobertson,项目名称:LibreCAD,代码行数:12,代码来源:rs_infoarea.cpp

示例4: map

// The new function using fixed point multiplication
QPolygon MapMatrix::map(const QPolygon &a) const
{
  int size = a.size();
  int64_t fx;
  int64_t fy;
  int32_t curx;
  int32_t cury;
  int32_t lastx = 0;
  int32_t lasty = 0;

  QPolygon p;

  for( int i = 0; i < size; i++ )
    {
      a.point(i, &curx, &cury);
      fx = itofp24p8( curx );
      fy = itofp24p8( cury );
      // some cheating involved; multiplication with the "wrong" macro
      // after "left shifting" the "m" value in createMatrix
      curx = fp24p8toi( mulfp8p24(m11,fx) + mulfp8p24(m21,fy) + dx);
      cury = fp24p8toi( mulfp8p24(m22,fy) + mulfp8p24(m12,fx) + dy);

      if ( (i==0) | ( ((curx - lastx) | (cury - lasty)) != 0) )
        {
          p.append(QPoint(curx, cury));
          lastx = curx;
          lasty = cury;
        }
    }

  return p;
}
开发者ID:Exadios,项目名称:Cumulus,代码行数:33,代码来源:mapmatrix.cpp

示例5: drawAidPolygon

void CDrawBase::drawAidPolygon(QPolygon _polygon, QPen *pen)
{
   if(!aidBufferRegistered)
   {
      return;
   }

   if(_polygon.size() >= 2)
   {
      // draw new aid polyline
      QPainter painter(m_aidBuffer);

      QPen usePen;
      if (0 != pen)
      {
         usePen = *pen;
      }
      else
      {
         usePen = QPen(Qt::lightGray, 1);
         usePen.setStyle(Qt::DashLine);
      }
      painter.setPen(usePen);
      painter.drawPolygon(_polygon);
   }

   emit requestUpdate();
}
开发者ID:Broentech,项目名称:sdraw,代码行数:28,代码来源:draw_Base.cpp

示例6: trackerTextF

//将位置转换成字符串
QwtText RectPicker::trackerTextF(const QPointF &pos) const
{
	QwtText text;

	const QPolygon points = selection();//选择的点
	if (!points.isEmpty())
	{
		QString num;
		QPoint point = points[0];
		QPointF point2 = invTransform(point);
		num = QString("(%1,%2),(,)").arg(point2.x()).arg(point2.y());
		QColor bg(Qt::white);
		bg.setAlpha(200);
		if (points.size() == 2)
		{

			QPointF point0 = invTransform(points[0]);
			QPointF point1 = invTransform(points[1]);
			num = QString("(%1,%2),(%3,%4)").arg(point0.x()).arg(point0.y()).arg(point1.x()).arg(point1.y());
		}
		text.setBackgroundBrush(QBrush(bg));
		text.setText(num);
	}
	return text;
}
开发者ID:qimo601,项目名称:FCS,代码行数:26,代码来源:RectPicker.cpp

示例7: toRect

QRect toRect(QPolygon polygon)
{
    if(polygon.size() != 4)
        return QRect();

    return QRect(polygon.first(), polygon.at(2));
}
开发者ID:NicolasSchnitzler,项目名称:dtk,代码行数:7,代码来源:dtkComposerCompass.cpp

示例8: addPoint

inline void GraphPolygonClipper::addPoint(
    QPolygon &pa, uint pos, const QPoint &point) const
{
    if ( uint(pa.size()) <= pos ) 
        pa.resize(pos + 5);

    pa.setPoint(pos, point);
}
开发者ID:ongbe,项目名称:xchart,代码行数:8,代码来源:graph_clipper.cpp

示例9: getZoomedPolygon

QPolygon Zoomer::getZoomedPolygon(const QPolygon &poly)
{
   QPolygon newPoly;
   for(int i=0; i<poly.size(); i++)
   {
      newPoly << getZoomedPoint(poly.at(i));
   }
   return newPoly;
}
开发者ID:Broentech,项目名称:sdraw,代码行数:9,代码来源:zoomer.cpp

示例10: to_sexp

SEXP to_sexp(QPolygon polygon) {
  SEXP rpolygon = allocMatrix(INTSXP, polygon.size(), 2);
  int nr = nrows(rpolygon);
  for (int i = 0; i < nr; i++) {
    INTEGER(rpolygon)[i] = polygon[i].x();
    INTEGER(rpolygon)[i + nr] = polygon[i].y();
  }
  return rpolygon;
}
开发者ID:NickSpyrison,项目名称:qtbase,代码行数:9,代码来源:convert.cpp

示例11: Mat

RegionMask::RegionMask(int height, int width, const QPolygon &boundary, const QList<QPolygon> &holes) : Mat(height,
                                                                                                            width,
                                                                                                            CV_8UC1, cvScalarAll(0)),
                                                                                                        boundary(
                                                                                                                boundary),
                                                                                                        holes(holes) {
    assert(boundary.size() > 0);
    QPolygon2Mask(*this, boundary, holes);
}
开发者ID:lopespt,项目名称:PhD-Thesis,代码行数:9,代码来源:RegionMask.cpp

示例12:

QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule)
{
    if (a.size() < 3) {
        d = &shared_empty;
        d->ref.ref();
    } else {
        d = new QRegionData;
        d->ref = 1;
        d->rgn = qt_tryCreatePolygonRegion(a, fillRule);
    }
}
开发者ID:pk-codebox-evo,项目名称:remixos-usb-tool,代码行数:11,代码来源:qregion_win.cpp

示例13: map

QPolygon QMatrix::map(const QPolygon &a) const
{
    int size = a.size();
    int i;
    QPolygon p(size);
    const QPoint *da = a.constData();
    QPoint *dp = p.data();
    for(i = 0; i < size; i++) {
        MAPINT(da[i].x(), da[i].y(), dp[i].rx(), dp[i].ry());
    }
    return p;
}
开发者ID:12307,项目名称:VLC-for-VS2010,代码行数:12,代码来源:qmatrix.cpp

示例14: qt_tryCreatePolygonRegion

HRGN qt_tryCreatePolygonRegion(const QPolygon &a, Qt::FillRule fillRule)
{
    const int tries = 10;
    for (int i = 0; i < tries; ++i) {
        HRGN region = CreatePolygonRgn(reinterpret_cast<const POINT*>(a.data()), a.size(),
                                       fillRule == Qt::OddEvenFill ? ALTERNATE : WINDING);
        if (region) {
            if (GetRegionData(region, 0, 0))
                return region;
            else
                DeleteObject(region);
        }
    }
    return 0;
}
开发者ID:pk-codebox-evo,项目名称:remixos-usb-tool,代码行数:15,代码来源:qregion_win.cpp

示例15: painter

/*!
 * \see drawBoundingBoxes(QPainter *aPainter, QPen *aPen)
 * \see drawPolygons(QPainter *aPainter, QPen *aPen)
 *
 * It contains drawing of the confirmed and not confirmed selections either.
 */
void
ImageHolder::paintEvent(QPaintEvent *anEvent)
{
	QLabel::paintEvent(anEvent);

	QPainter painter(this);
	painter.setRenderHint(QPainter::Antialiasing);
	//painter.setRenderHint(QPainter::SmoothPixmapTransform);
	QPen pen;

	if (NoTool != tool_) {
		pen.setWidth(1);
		pen.setColor(QColor(Qt::black));
		pen.setStyle(Qt::DashLine);
		painter.setPen(pen);

		if (BoundingBoxTool == tool_) {
			/* scaling */
			QRect bbox = bounding_box_.rect;
			QPoint bboxTopLeft = bbox.topLeft() * scale_;
			QPoint bboxBottomRight = bbox.bottomRight() * scale_;

			bbox.setTopLeft(bboxTopLeft);
			bbox.setBottomRight(bboxBottomRight);

			painter.drawRect(bbox);
		}
		else if (PolygonTool == tool_) {
			/* scaling */
			QPoint point;
			QPolygon poly = polygon_.poly;
			for (int i = 0; i < poly.size(); i++) {
				point.setX(poly.at(i).x());
				point.setY(poly.at(i).y());
				point *= scale_;
				poly.remove(i);
				poly.insert(i, point);
			}
			painter.drawPolygon(poly);
		}
	}

	/* drawing bounding boxes */
	drawBoundingBoxes(&painter, &pen);
	drawPolygons(&painter, &pen);
}
开发者ID:gavlig,项目名称:Image-labeling-tool,代码行数:52,代码来源:ImageHolder.cpp


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