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


C++ QPolygonF::push_back方法代码示例

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


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

示例1: paintPolygon

void QgsHighlight::paintPolygon( QPainter *p, QgsPolygon polygon )
{
  // OddEven fill rule by default
  QPainterPath path;

  p->setPen( mPen );
  p->setBrush( mBrush );

  for ( int i = 0; i < polygon.size(); i++ )
  {
    if ( polygon[i].empty() ) continue;

    QPolygonF ring;
    ring.reserve( polygon[i].size() + 1 );

    for ( int j = 0; j < polygon[i].size(); j++ )
    {
      //adding point only if it is more than a pixel appart from the previous one
      const QPointF cur = toCanvasCoordinates( polygon[i][j] ) - pos();
      if ( 0 == j || std::abs( ring.back().x() - cur.x() ) > 1 || std::abs( ring.back().y() - cur.y() ) > 1 )
      {
        ring.push_back( cur );
      }
    }

    ring.push_back( ring[ 0 ] );

    path.addPolygon( ring );
  }

  p->drawPath( path );
}
开发者ID:ColeCummins,项目名称:QGIS,代码行数:32,代码来源:qgshighlight.cpp

示例2: resize

void NodeBackDrop::resize(int w,int h)
{
    QMutexLocker l(&_imp->bboxMutex);
    QPointF p = pos();
    QPointF thisItemPos = mapFromParent(p);
    
    QRectF textBbox = _imp->name->boundingRect();
    if (w < textBbox.width()) {
        w = textBbox.width();
    }
    
    int minH = (textBbox.height() * 1.5) + 20;
    
    if (h < minH) {
        h = minH;
    }
    
    
    setRect(QRectF(thisItemPos.x(),thisItemPos.y(),w,h));
    
    _imp->header->setRect(QRect(thisItemPos.x(),thisItemPos.y(),w,textBbox.height() * 1.5));
    
    _imp->name->setPos(thisItemPos.x() + w / 2 - textBbox.width() / 2,thisItemPos.y() + 0.25 * textBbox.height());
    _imp->label->setPos(thisItemPos.x(), thisItemPos.y() + textBbox.height() * 1.5 + 10);
    _imp->label->setTextWidth(w);
    
    QPolygonF resizeHandle;
    QPointF bottomRight(thisItemPos.x() + w,thisItemPos.y() + h);
    resizeHandle.push_back(QPointF(bottomRight.x() - 20,bottomRight.y()));
    resizeHandle.push_back(bottomRight);
    resizeHandle.push_back(QPointF(bottomRight.x(), bottomRight.y() - 20));
    _imp->resizeHandle->setPolygon(resizeHandle);
}
开发者ID:blackearth2014,项目名称:Natron,代码行数:33,代码来源:NodeBackDrop.cpp

示例3: transformerEnPolygone

void Triangle::transformerEnPolygone(QPolygonF &polygone , QVector<QPointF>& points)
{
    polygone.clear();
    polygone.push_back(points[this->sommets[0]]);
    polygone.push_back(points[this->sommets[1]]);
    polygone.push_back(points[this->sommets[2]]);

}
开发者ID:khalilBF,项目名称:Incremental-Delaunay,代码行数:8,代码来源:triangle.cpp

示例4: containsPoint

/**
  * whether a given point is within image region
  *@ coord, a point
  *@ returns true, if the point is within borders of image
  */
bool RS_Image::containsPoint(const RS_Vector& coord) const{
    QPolygonF paf;
    RS_VectorSolutions corners =getCorners();
	for(const RS_Vector& vp: corners){
		paf.push_back(QPointF(vp.x, vp.y));
    }
    paf.push_back(paf.at(0));
    return paf.containsPoint(QPointF(coord.x,coord.y),Qt::OddEvenFill);
}
开发者ID:PlastecProfiles,项目名称:LibreCAD,代码行数:14,代码来源:rs_image.cpp

示例5: if

std::vector<QPolygonF> GraphicsArrowItem::compose() {
	const qreal pi = 3.14;
	QLineF l = QLineF(line());
	double arrowSize = (l.length() < 200.0) ? 10.0 : l.length()/20.0;
	//double arrowSize = 10.0;
	int dx = l.p2().x() - l.p1().x();
	int dy = l.p2().y() - l.p1().y();
	double angle = ::acos(dx/l.length());
	if (dx >= 0 && dy > 0)
		angle = (pi * 2) - angle;
	else if (dx >= 0 && dy <= 0)
		{ }
	else if (dx < 0 && dy > 0)
		angle = (pi * 2) - angle;
	else if (dx < 0 && dy <= 0)
		{ }
	QPointF P1 = l.p1() + QPointF(::sin(angle+pi/3.0)*arrowSize, ::cos(angle+pi/3.0)*arrowSize);
	QPointF P2 = l.p1() + QPointF(::sin(angle+pi-pi/3.0)*arrowSize, ::cos(angle+pi-pi/3.0)*arrowSize);
	QPointF P3 = l.p2() + QPointF(::sin(angle-pi/3.0)*arrowSize, ::cos(angle-pi/3.0)*arrowSize);
	QPointF P4 = l.p2() + QPointF(::sin(angle+pi+pi/3.0)*arrowSize, ::cos(angle+pi+pi/3.0)*arrowSize);

	std::vector<QPolygonF> cont;
	//double off = 0.5*arrowSize*1.732;
	//QPointF offset(off, off);
	if (arrowHead == Start) {
		QPolygonF polybuilder;
		polybuilder.push_back(P1);
		polybuilder.push_back(l.p1());
		polybuilder.push_back(P2);
		polybuilder.push_back(P1);
		cont.push_back(polybuilder);
		//QLineF newline(line());
		//newline.setP1(newline.p1()-offset);
	}
	else if (arrowHead == End) {
		QPolygonF polybuilder;
		polybuilder.push_back(P3);
		polybuilder.push_back(l.p2());
		polybuilder.push_back(P4);
		polybuilder.push_back(P3);
		cont.push_back(polybuilder);
	}
	else if (arrowHead == Both) {
		QPolygonF polybuilder;
		polybuilder.push_back(P1);
		polybuilder.push_back(l.p1());
		polybuilder.push_back(P2);
		polybuilder.push_back(P1);
		QPolygonF polybuilder2;
		polybuilder2.push_back(P3);
		polybuilder2.push_back(l.p2());
		polybuilder2.push_back(P4);
		polybuilder2.push_back(P3);
		cont.push_back(polybuilder);
		cont.push_back(polybuilder2);
	}
	return cont;
}
开发者ID:lebenasa,项目名称:ImageRasterReboot,代码行数:58,代码来源:GraphicsItem.cpp

示例6: modelDataChanged

void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
	// We don't have enougth data to calculate things, quit.
	if (!shouldCalculateStuff(topLeft, bottomRight))
		return;
	int last_index = -1;
	QPolygonF boundingPoly; // This is the "Whole Item", but a pressure can be divided in N Polygons.
	polygons.clear();

	for (int i = 0, count = dataModel->rowCount(); i < count; i++) {
		plot_data *entry = dataModel->data().entry + i;
		int mbar = GET_PRESSURE(entry);

		if (entry->cylinderindex != last_index) {
			polygons.append(QPolygonF()); // this is the polygon that will be actually drawned on screen.
			last_index = entry->cylinderindex;
		}
		if (!mbar) {
			continue;
		}

		QPointF point(hAxis->posAtValue(entry->sec), vAxis->posAtValue(mbar));
		boundingPoly.push_back(point);    // The BoundingRect
		polygons.last().push_back(point); // The polygon thta will be plotted.
	}
	setPolygon(boundingPoly);
	qDeleteAll(texts);
	texts.clear();
	int mbar, cyl;
	int seen_cyl[MAX_CYLINDERS] = { false, };
	int last_pressure[MAX_CYLINDERS] = { 0, };
	int last_time[MAX_CYLINDERS] = { 0, };
	struct plot_data *entry;

	cyl = -1;
	for (int i = 0, count = dataModel->rowCount(); i < count; i++) {
		entry = dataModel->data().entry + i;
		mbar = GET_PRESSURE(entry);

		if (!mbar)
			continue;
		if (cyl != entry->cylinderindex) {
			cyl = entry->cylinderindex;
			if (!seen_cyl[cyl]) {
				plotPressureValue(mbar, entry->sec, Qt::AlignRight | Qt::AlignTop);
				plotGasValue(mbar, entry->sec, Qt::AlignRight | Qt::AlignBottom,
					       displayed_dive.cylinder[cyl].gasmix);
				seen_cyl[cyl] = true;
			}
		}
		last_pressure[cyl] = mbar;
		last_time[cyl] = entry->sec;
	}

	for (cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
		if (last_time[cyl]) {
			plotPressureValue(last_pressure[cyl], last_time[cyl], Qt::AlignLeft | Qt::AlignTop);
		}
	}
}
开发者ID:codesong,项目名称:subsurface,代码行数:60,代码来源:diveprofileitem.cpp

示例7: DrawAccumulateEnergy

void AccumulateEnergy::DrawAccumulateEnergy(QPainter &painter)
{
    float y = draw_area_range.bottom() - dheight_ - 15;
    float x = draw_area_range.left();

    QPolygonF points;

    float accumulateenergydata = 0;
    float maxaccumulateenergy = maxaccumulateenergy_;
    if (maxaccumulateenergy == 0)
    {
       maxaccumulateenergy = 1;
    }

    for(int i = 0;i<datas_.size();i++)
    {
        EnergyData ei = datas_.value(i);
        accumulateenergydata += ei.energy;
        float xt =  x + i* draw_area_range.width() / days_;
        float yt =  y - accumulateenergydata*(uheight_ - 15) / maxaccumulateenergy;
        points.push_back(QPointF(xt,yt));

    }
    painter.save();
    QPen pen;
    pen.setColor(Qt::blue);
    painter.setPen(pen);
    painter.drawPolyline(points);
    painter.restore();
}
开发者ID:liye0005,项目名称:QT_POJ,代码行数:30,代码来源:accumulateenergy.cpp

示例8: fillLine

QPolygonF fillLine(const QPointF &first_, const QPointF &second_)
{
    QPolygonF filled;
    
    QPointF first = first_, second = second_;
    
    double m = 0;
    
    double x1 = first.x();
    double y1 = first.y();
    double x2 = second.x();
    double y2 = second.y();
    
    filled << first;
    
    if (x2 == x1)
        return filled;
    
    m = (y2 - y1) / (x2 - x1);
    
    for (double x = x1; x < qMax(first.x(), second.x()); x += 1) {
         QPointF point;
         point.setX(x);
    
         point.setY(y1+m*(x-x1));
        
         if (m < 0)
             filled.push_back(point);
         else if (m > 0)
                  filled << point;
    }
    
    return filled;
}
开发者ID:KDE,项目名称:tupi,代码行数:34,代码来源:tupgraphicalgorithm.cpp

示例9: modelDataChanged

void PartialPressureGasItem::modelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight)
{
	//AbstractProfilePolygonItem::modelDataChanged();
	if (!shouldCalculateStuff(topLeft, bottomRight))
		return;

	plot_data *entry = dataModel->data().entry;
	QPolygonF poly;
	alertPoly.clear();
	QSettings s;
	s.beginGroup("TecDetails");
	double threshould = s.value(threshouldKey).toDouble();
	for(int i = 0;  i < dataModel->rowCount(); i++, entry++){
		double value = dataModel->index(i, vDataColumn).data().toDouble();
		int time = dataModel->index(i, hDataColumn).data().toInt();
		QPointF point(hAxis->posAtValue(time), vAxis->posAtValue(value));
		poly.push_back( point );
		if (value >= threshould)
			alertPoly.push_back(point);
	}
	setPolygon(poly);
	/*
	createPPLegend(trUtf8("pN" UTF8_SUBSCRIPT_2),getColor(PN2), legendPos);
	*/
}
开发者ID:danilocesar,项目名称:subsurface,代码行数:25,代码来源:diveprofileitem.cpp

示例10: minusPolygon

QPolygonF ObstacleBitmap::minusPolygon(const QPolygonF& polygon)const{
	QPolygonF ret;
	for (int i = 0; i < polygon.size(); i++)
	{
		ret.push_back(polygon.at(i) * -1.0);
	}
	return ret;
}
开发者ID:gwpandia,项目名称:MotionPlannerQt,代码行数:8,代码来源:ObstacleBitmap.cpp

示例11: get_part_polygon

void get_part_polygon(const PartBBox &part_bbox, QPolygonF &polygon)
{
  polygon.clear();

  boost_math::double_vector t(2);
  t = part_bbox.part_x_axis*part_bbox.min_proj_x + part_bbox.part_y_axis*part_bbox.min_proj_y + part_bbox.part_pos;
  polygon.push_back(QPointF(t(0), t(1)));
    
  t = part_bbox.part_x_axis*part_bbox.max_proj_x + part_bbox.part_y_axis*part_bbox.min_proj_y + part_bbox.part_pos;
  polygon.push_back(QPointF(t(0), t(1)));

  t = part_bbox.part_x_axis*part_bbox.max_proj_x + part_bbox.part_y_axis*part_bbox.max_proj_y + part_bbox.part_pos;
  polygon.push_back(QPointF(t(0), t(1)));

  t = part_bbox.part_x_axis*part_bbox.min_proj_x + part_bbox.part_y_axis*part_bbox.max_proj_y + part_bbox.part_pos;
  polygon.push_back(QPointF(t(0), t(1)));
}
开发者ID:caomw,项目名称:partapp,代码行数:17,代码来源:partdef.cpp

示例12: read_line

QPolygonF read_line(uint8_t byte_order, InputIterator& itr, const frame& fr)
{
  const uint32_t count(brig::detail::ogc::read<uint32_t>(byte_order, itr));
  QPolygonF line; line.reserve(count);
  for (uint32_t i(0); i < count; ++i)
    line.push_back( read_point(byte_order, itr, fr) );
  return line;
}
开发者ID:respu,项目名称:brig,代码行数:8,代码来源:draw_line.hpp

示例13: showForm

void FormView::showForm(AbstractForm * form)
{

    QGraphicsScene *s = scene();

    s->clear();
    resetTransform();

    if(form == 0){
        return;
    }
    if(form->get_number_of_points() <= 0) {
        return;
    }

    int factor = 100;

    QPolygonF polygon;
    for(int i=0; i<form->get_number_of_points(); ++i){
        Point point = form->get_point_at_index(i);
        polygon.push_back(QPointF(point.get_x()*factor, point.get_y()*factor));
    }



    s->addPolygon(polygon, QPen(), QBrush(Qt::SolidPattern));

    QRectF bound = polygon.boundingRect();

    s->setSceneRect(bound);



    float realwidth = container->width() - 50;
    float width = bound.width();
    float realheight = container->height() - 50;
    float height = bound.height();

    float relw = 1;
    if(width > 0){
        relw =  realwidth / width;
    }

    float relh = 1;
    if(height > 0){
        relh = realheight / height;
    }

    float rel = relw;
    if(relh < relw){
        rel = relh;
    }

    scale(rel,rel);



}
开发者ID:CSNWEB,项目名称:gi-2015,代码行数:58,代码来源:formview.cpp

示例14: paintTriangle

void KisCategorizedItemDelegate::paintTriangle(QPainter* painter, qint32 x, qint32 y, qint32 size, bool rotate) const
{
    QPolygonF triangle;
    triangle.push_back(QPointF(-0.2,-0.2));
    triangle.push_back(QPointF( 0.2,-0.2));
    triangle.push_back(QPointF( 0.0, 0.2));

    QTransform transform;
    transform.translate(x + size/2, y + size/2);
    transform.scale(size, size);

    if(rotate)
        transform.rotate(-90);

    QPalette palette = QApplication::palette();
    painter->setBrush(palette.buttonText());
    painter->drawPolygon(transform.map(triangle));
}
开发者ID:ChrisJong,项目名称:krita,代码行数:18,代码来源:kis_categorized_item_delegate.cpp

示例15: createShape

static QPolygonF createShape(QSize const& image_size, double radius)
{
	QPointF const center(0.5 * image_size.width(), 0.5 * image_size.height());
	double const PI = 3.14159265;
	double angle = PI / 2.0;
	int const num_steps = 5;
	double const step = PI * 2.0 / num_steps;
	
	QPolygonF poly;
	
	poly.push_back(center + QPointF(cos(angle), sin(angle)) * radius);
	for (int i = 1; i < num_steps; ++i) {
		angle += step * 2;
		poly.push_back(center + QPointF(cos(angle), sin(angle)) * radius);
	}
	
	return poly;
}
开发者ID:4sp1r3,项目名称:scantailor,代码行数:18,代码来源:TestPolygonRasterizer.cpp


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