本文整理汇总了C++中QwtDoubleRect::x方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoubleRect::x方法的具体用法?C++ QwtDoubleRect::x怎么用?C++ QwtDoubleRect::x使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtDoubleRect
的用法示例。
在下文中一共展示了QwtDoubleRect::x方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: boundingRect
QwtDoubleRect HistogramItem::boundingRect() const
{
QwtDoubleRect rect = d_data->data.boundingRect();
if ( !rect.isValid() )
return rect;
if ( d_data->attributes & Xfy )
{
rect = QwtDoubleRect( rect.y(), rect.x(),
rect.height(), rect.width() );
if ( rect.left() > d_data->reference )
rect.setLeft( d_data->reference );
else if ( rect.right() < d_data->reference )
rect.setRight( d_data->reference );
}
else
{
if ( rect.bottom() < d_data->reference )
rect.setBottom( d_data->reference );
else if ( rect.top() > d_data->reference )
rect.setTop( d_data->reference );
}
return rect;
}
示例2: render
/*!
Render the SVG data
\param painter Painter
\param viewBox View Box, see QSvgRenderer::viewBox
\param rect Traget rectangle on the paint device
*/
void QwtPlotSvgItem::render(QPainter *painter,
const QwtDoubleRect &viewBox, const QRect &rect) const
{
if ( !viewBox.isValid() )
return;
#if QT_VERSION >= 0x040200
d_data->renderer.setViewBox(viewBox);
d_data->renderer.render(painter, rect);
return;
#else
#if QT_VERSION >= 0x040100
const QSize paintSize(painter->window().width(),
painter->window().height());
if ( !paintSize.isValid() )
return;
const double xRatio = paintSize.width() / viewBox.width();
const double yRatio = paintSize.height() / viewBox.height();
const double dx = rect.left() / xRatio + 1.0;
const double dy = rect.top() / yRatio + 1.0;
const double mx = double(rect.width()) / paintSize.width();
const double my = double(rect.height()) / paintSize.height();
painter->save();
painter->translate(dx, dy);
painter->scale(mx, my);
d_data->renderer.setViewBox(viewBox.toRect());
d_data->renderer.render(painter);
painter->restore();
#else
const double mx = rect.width() / viewBox.width();
const double my = rect.height() / viewBox.height();
const double dx = rect.x() - mx * viewBox.x();
const double dy = rect.y() - my * viewBox.y();
painter->save();
painter->translate(dx, dy);
painter->scale(mx, my);
d_data->picture.play(painter);
painter->restore();
#endif // < 0x040100
#endif // < 0x040200
}
示例3: drawItems
/*!
Redraw the canvas items.
\param painter Painter used for drawing
\param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
\param radialMap Maps radius values into painter coordinates.
\param pole Position of the pole in painter coordinates
\param radius Radius of the complete plot area in painter coordinates
\param canvasRect Contents rect of the canvas in painter coordinates
*/
void QwtPolarPlot::drawItems( QPainter *painter,
const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
const QwtDoublePoint &pole, double radius,
const QwtDoubleRect &canvasRect ) const
{
const QwtDoubleRect pr = plotRect( canvasRect.toRect() );
const QwtPolarItemList& itmList = itemList();
for ( QwtPolarItemIterator it = itmList.begin();
it != itmList.end(); ++it )
{
QwtPolarItem *item = *it;
if ( item && item->isVisible() )
{
painter->save();
// Unfortunately circular clipping slows down
// painting a lot. So we better try to avoid it.
bool doClipping = false;
if ( item->rtti() != QwtPolarItem::Rtti_PolarGrid )
{
const QwtDoubleInterval intv =
item->boundingInterval( QwtPolar::Radius );
if ( !intv.isValid() )
doClipping = true;
else
{
if ( radialMap.s1() < radialMap.s2() )
doClipping = intv.maxValue() > radialMap.s2();
else
doClipping = intv.minValue() < radialMap.s2();
}
}
if ( doClipping )
{
const int margin = item->marginHint();
const QwtDoubleRect clipRect( pr.x() - margin, pr.y() - margin,
pr.width() + 2 * margin, pr.height() + 2 * margin );
if ( !clipRect.contains( canvasRect ) )
{
QRegion clipRegion( clipRect.toRect(), QRegion::Ellipse );
#if QT_VERSION >= 0x040000
painter->setClipRegion( clipRegion, Qt::IntersectClip );
#else
if ( painter->hasClipping() )
clipRegion &= painter->clipRegion();
painter->setClipRegion( clipRegion );
#endif
}
}
#if QT_VERSION >= 0x040000
painter->setRenderHint( QPainter::Antialiasing,
item->testRenderHint( QwtPolarItem::RenderAntialiased ) );
#endif
item->draw( painter, azimuthMap, radialMap,
pole, radius, canvasRect );
painter->restore();
}
}
}
示例4: contourLines
const QList<double> &levels, int flags) const
#else
QwtRasterData::ContourLines QwtRasterData::contourLines(
const QwtDoubleRect &rect, const QSize &raster,
const QValueList<double> &levels, int flags) const
#endif
{
ContourLines contourLines;
if ( levels.size() == 0 || !rect.isValid() || !raster.isValid() )
return contourLines;
const double dx = rect.width() / raster.width();
const double dy = rect.height() / raster.height();
const bool ignoreOnPlane =
flags & QwtRasterData::IgnoreAllVerticesOnLevel;
const QwtDoubleInterval range = this->range();
bool ignoreOutOfRange = false;
if ( range.isValid() )
ignoreOutOfRange = flags & IgnoreOutOfRange;
((QwtRasterData*)this)->initRaster(rect, raster);
for ( int y = 0; y < raster.height() - 1; y++ )
{
enum Position
{
Center,
TopLeft,
TopRight,
BottomRight,
BottomLeft,
NumPositions
};
Contour3DPoint xy[NumPositions];
for ( int x = 0; x < raster.width() - 1; x++ )
{
const QwtDoublePoint pos(rect.x() + x * dx, rect.y() + y * dy);
if ( x == 0 )
{
xy[TopRight].setPos(pos.x(), pos.y());
xy[TopRight].setZ(
value( xy[TopRight].x(), xy[TopRight].y())
);
xy[BottomRight].setPos(pos.x(), pos.y() + dy);
xy[BottomRight].setZ(
value(xy[BottomRight].x(), xy[BottomRight].y())
);
}
xy[TopLeft] = xy[TopRight];
xy[BottomLeft] = xy[BottomRight];
xy[TopRight].setPos(pos.x() + dx, pos.y());
xy[BottomRight].setPos(pos.x() + dx, pos.y() + dy);
xy[TopRight].setZ(
value(xy[TopRight].x(), xy[TopRight].y())
);
xy[BottomRight].setZ(
value(xy[BottomRight].x(), xy[BottomRight].y())
);
double zMin = xy[TopLeft].z();
double zMax = zMin;
double zSum = zMin;
for ( int i = TopRight; i <= BottomLeft; i++ )
{
const double z = xy[i].z();
zSum += z;
if ( z < zMin )
zMin = z;
if ( z > zMax )
zMax = z;
}
if ( ignoreOutOfRange )
{
if ( !range.contains(zMin) || !range.contains(zMax) )
continue;
}
if ( zMax < levels[0] ||
zMin > levels[levels.size() - 1] )
{
continue;
}
xy[Center].setPos(pos.x() + 0.5 * dx, pos.y() + 0.5 * dy);
xy[Center].setZ(0.25 * zSum);
//.........这里部分代码省略.........