本文整理汇总了C++中QwtDoubleRect::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoubleRect::isValid方法的具体用法?C++ QwtDoubleRect::isValid怎么用?C++ QwtDoubleRect::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtDoubleRect
的用法示例。
在下文中一共展示了QwtDoubleRect::isValid方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: viewBox
/*!
Calculate the viewBox from an rect and boundingRect().
\param rect Rectangle in scale coordinates
\return viewBox View Box, see QSvgRenderer::viewBox
*/
QRect QwtPlotSvgItem::viewBox(const QwtDoubleRect &rect) const
{
#if QT_VERSION >= 0x040100
const QSize sz = d_data->renderer.defaultSize();
#else
#if QT_VERSION > 0x040000
const QSize sz(d_data->picture.width(),
d_data->picture.height());
#else
QPaintDeviceMetrics metrics(&d_data->picture);
const QSize sz(metrics.width(), metrics.height());
#endif
#endif
const QwtDoubleRect br = boundingRect();
if ( !rect.isValid() || !br.isValid() || sz.isNull() )
return QRect();
QwtScaleMap xMap;
xMap.setScaleInterval(br.left(), br.right());
xMap.setPaintInterval(0, sz.width());
QwtScaleMap yMap;
yMap.setScaleInterval(br.top(), br.bottom());
yMap.setPaintInterval(sz.height(), 0);
return transform(xMap, yMap, rect);
}
示例2: 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;
}
示例3: drawCanvas
/*!
Draw the canvas
Paints all plot items to the canvasRect, using QwtPolarPlot::drawCanvas
and updates the paint cache.
\sa QwtPolarPlot::drawCanvas, setPaintAttributes(), testPaintAttributes()
*/
void QwtPolarCanvas::drawCanvas( QPainter *painter,
const QwtDoubleRect& canvasRect )
{
if ( !canvasRect.isValid() )
return;
if ( testPaintAttribute( PaintCached ) && d_data->cache )
{
*d_data->cache = QPixmap( contentsRect().size() );
#ifdef Q_WS_X11
#if QT_VERSION >= 0x040000
if ( d_data->cache->x11Info().screen() != x11Info().screen() )
d_data->cache->x11SetScreen( x11Info().screen() );
#else
if ( d_data->cache->x11Screen() != x11Screen() )
d_data->cache->x11SetScreen( x11Screen() );
#endif
#endif
d_data->cache->fill( this, d_data->cache->rect().topLeft() );
QPainter cachePainter( d_data->cache );
cachePainter.translate( -contentsRect().x(),
-contentsRect().y() );
plot()->drawCanvas( &cachePainter, canvasRect );
cachePainter.end();
painter->drawPixmap( canvasRect.topLeft().toPoint(), *d_data->cache );
}
else
plot()->drawCanvas( painter, canvasRect );
}
示例4: draw
/*!
Draw the SVG item
\param painter Painter
\param xMap X-Scale Map
\param yMap Y-Scale Map
\param canvasRect Contents rect of the plot canvas
*/
void QwtPlotSvgItem::draw(QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRect &canvasRect) const
{
const QwtDoubleRect cRect = invTransform(xMap, yMap, canvasRect);
const QwtDoubleRect bRect = boundingRect();
if ( bRect.isValid() && cRect.isValid() )
{
QwtDoubleRect rect = bRect;
if ( bRect.contains(cRect) )
rect = cRect;
render(painter, viewBox(rect),
transform(xMap, yMap, rect) );
}
}
示例5: updateAxes
//! Rebuild the scales and maps
void QwtPlot::updateAxes()
{
int i;
bool resetDone[axisCnt];
for (i = 0; i < axisCnt; i++)
resetDone[i] = FALSE;
//
// Adjust autoscalers
//
QwtPlotCurveIterator itc = curveIterator();
for (const QwtPlotCurve *c = itc.toFirst(); c != 0; c = ++itc )
{
const int xAxis = c->xAxis();
const int yAxis = c->yAxis();
if ( d_as[xAxis].autoScale() || d_as[yAxis].autoScale() )
{
const QwtDoubleRect rect = c->boundingRect();
if ( rect.isValid() )
{
if ( d_as[xAxis].autoScale() )
{
if ( !resetDone[xAxis] )
{
d_as[xAxis].reset();
resetDone[xAxis] = TRUE;
}
d_as[xAxis].adjust(rect.x1(), rect.x2());
}
if ( d_as[yAxis].autoScale() )
{
if ( !resetDone[yAxis] )
{
d_as[yAxis].reset();
resetDone[yAxis] = TRUE;
}
d_as[yAxis].adjust(rect.y1(), rect.y2());
}
}
}
}
//
// Adjust scales
//
for (i = 0; i < axisCnt; i++)
{
d_scale[i]->setScaleDiv(d_as[i].scaleDiv());
int startDist, endDist;
d_scale[i]->minBorderDist(startDist, endDist);
d_scale[i]->setBorderDist(startDist, endDist);
}
d_grid->setXDiv(d_as[d_grid->xAxis()].scaleDiv());
d_grid->setYDiv(d_as[d_grid->yAxis()].scaleDiv());
}
示例6: 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
}
示例7: boundingRect
QwtDoubleRect QmitkHistogram::boundingRect() const
{
QwtDoubleRect rect = m_Data->data.boundingRect();
if ( !rect.isValid() )
return rect;
if ( rect.bottom() < m_Data->reference )
rect.setBottom( m_Data->reference );
else if ( rect.top() > m_Data->reference )
rect.setTop( m_Data->reference );
return rect;
}
示例8: 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);
//.........这里部分代码省略.........