本文整理汇总了C++中QPolygonF::pop_back方法的典型用法代码示例。如果您正苦于以下问题:C++ QPolygonF::pop_back方法的具体用法?C++ QPolygonF::pop_back怎么用?C++ QPolygonF::pop_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPolygonF
的用法示例。
在下文中一共展示了QPolygonF::pop_back方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vertices
QPolygonF Shape::vertices() const
{
QPolygonF result = vertices_;
switch (type_) {
case SEGMENT:
case POLYLINE:
case CLOSED_POLYLINE:
case POLYGON:
break;
case RECTANGLE:
if (result.size() == 2) {
result = QPolygonF(QRectF(result[0], result[1]));
result.pop_back();
}
break;
}
return result;
}
示例2: draw
void QgsComposerMapOverview::draw( QPainter *painter )
{
if ( !mEnabled || mFrameMapId == -1 || !mComposerMap || !mComposerMap->composition() )
{
return;
}
if ( !painter )
{
return;
}
const QgsComposerMap* overviewFrameMap = mComposerMap->composition()->getComposerMapById( mFrameMapId );
if ( !overviewFrameMap )
{
return;
}
//get polygon for other overview frame map's extent (use visibleExtentPolygon as it accounts for map rotation)
QPolygonF otherExtent = overviewFrameMap->visibleExtentPolygon();
//get current map's extent as a QPolygonF
QPolygonF thisExtent = mComposerMap->visibleExtentPolygon();
//intersect the two
QPolygonF intersectExtent = thisExtent.intersected( otherExtent );
//setup painter scaling to dots so that raster symbology is drawn to scale
double dotsPerMM = painter->device()->logicalDpiX() / 25.4;
//setup render context
QgsMapSettings ms = mComposerMap->composition()->mapSettings();
//context units should be in dots
ms.setOutputSize( QSizeF( mComposerMap->rect().width() * dotsPerMM, mComposerMap->rect().height() * dotsPerMM ).toSize() );
ms.setExtent( *mComposerMap->currentMapExtent() );
ms.setOutputDpi( painter->device()->logicalDpiX() );
QgsRenderContext context = QgsRenderContext::fromMapSettings( ms );
context.setForceVectorOutput( true );
context.setPainter( painter );
QgsExpressionContext* expressionContext = createExpressionContext();
context.setExpressionContext( *expressionContext );
delete expressionContext;
painter->save();
painter->setCompositionMode( mBlendMode );
painter->translate( mComposerMap->mXOffset, mComposerMap->mYOffset );
painter->scale( 1 / dotsPerMM, 1 / dotsPerMM ); // scale painter from mm to dots
painter->setRenderHint( QPainter::Antialiasing );
mFrameSymbol->startRender( context );
//construct a polygon corresponding to the intersecting map extent
//need to scale line to dots, rather then mm, since the painter has been scaled to dots
QTransform mapTransform;
QPolygonF thisRectPoly = QPolygonF( QRectF( 0, 0, dotsPerMM * mComposerMap->rect().width(), dotsPerMM * mComposerMap->rect().height() ) );
//workaround QT Bug #21329
thisRectPoly.pop_back();
thisExtent.pop_back();
//create transform from map coordinates to painter coordinates
QTransform::quadToQuad( thisExtent, thisRectPoly, mapTransform );
QPolygonF intersectPolygon;
intersectPolygon = mapTransform.map( intersectExtent );
QList<QPolygonF> rings; //empty list
if ( !mInverted )
{
//Render the intersecting map extent
mFrameSymbol->renderPolygon( intersectPolygon, &rings, nullptr, context );
}
else
{
//We are inverting the overview frame (ie, shading outside the intersecting extent)
//Construct a polygon corresponding to the overview map extent
QPolygonF outerPolygon;
outerPolygon << QPointF( 0, 0 )
<< QPointF( mComposerMap->rect().width() * dotsPerMM, 0 )
<< QPointF( mComposerMap->rect().width() * dotsPerMM, mComposerMap->rect().height() * dotsPerMM )
<< QPointF( 0, mComposerMap->rect().height() * dotsPerMM )
<< QPointF( 0, 0 );
//Intersecting extent is an inner ring for the shaded area
rings.append( intersectPolygon );
mFrameSymbol->renderPolygon( outerPolygon, &rings, nullptr, context );
}
mFrameSymbol->stopRender( context );
painter->restore();
}
示例3: digitalPattern_Rotate
bool DataConverter::digitalPattern_Rotate(QPolygonF &points, qreal angle)
{
if (angle == 0.0)
return true;
if (angle < -180.0 || angle > 180.0)
{
qDebug("[DataConverter::digitalPattern_Rotate] Error: Angle: [%f]", angle);
return false;
}
if (points.size() < 10)
{
qDebug("[DataConverter::digitalPattern_Rotate] Error: Polygon Point Count: [%d]", points.size());
return false;
}
//
QTransform transform;
transform.rotate(angle);
points = transform.map(points);
//
int bottomIndex = 0;
{
qreal tmpX = -9999.99;
for (int i = 0; i < points.size(); i++)
{
if (points.at(i).y() < 0.0)
continue;
if (points.at(i).x() > 0.0)
continue;
if (points.at(i).x() > tmpX)
{
tmpX = points.at(i).x();
bottomIndex = i;
}
}
}
qDebug("** bottomIndex: [%d]", bottomIndex);
if (bottomIndex > 0)
{
QPointF tmpPoint;
for (int i = points.size() - 1; i >= bottomIndex; i--)
{
tmpPoint = points.last();
points.pop_back();
points.push_front(tmpPoint);
}
}
return true;
}