本文整理汇总了C++中QwtDoubleRect类的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoubleRect类的具体用法?C++ QwtDoubleRect怎么用?C++ QwtDoubleRect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QwtDoubleRect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rasterHint
/** Return how many pixels this area should be rendered as
*
* @param area :: area under view
* @return # of pixels in each direction
*/
QSize QwtRasterDataMD::rasterHint(const QwtDoubleRect &area) const {
if (!m_ws || !m_X || !m_Y)
return QSize();
// Slow mode? Don't give a raster hint. This will be 1 pixel per point
if (!m_fast)
return QSize();
// Fast mode: use the bin size to guess at the pixel density
coord_t binX = m_X->getBinWidth();
coord_t binY = m_Y->getBinWidth();
// Use the overlay workspace, if any, and if its bins are smaller
if (m_overlayWS && m_overlayInSlice) {
coord_t temp;
temp = m_overlayWS->getDimension(m_dimX)->getBinWidth();
if (temp < binX)
binX = temp;
temp = m_overlayWS->getDimension(m_dimY)->getBinWidth();
if (temp < binY)
binY = temp;
}
int w = 3 * int(area.width() / binX);
int h = 3 * int(area.height() / binY);
if (w < 10)
w = 10;
if (h < 10)
h = 10;
return QSize(w, h);
}
示例2: setPaintAttributes
/*!
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 );
}
示例3: boundingRect
QwtDoubleRect Plot::boundingRect ()
{
QMapIterator<int, QwtPlotCurve *> it = d_curves.begin();
QwtPlotCurve *c = (QwtPlotCurve *)it.data();
double minX = c->minXValue();
double minY = c->minYValue();
double maxX = c->maxXValue();
double maxY = c->maxYValue();
it++;
for (it; it != d_curves.end(); ++it)
{
QwtPlotCurve *c = (QwtPlotCurve *)it.data();
if (!c)
continue;
minX = (c->minXValue() < minX) ? c->minXValue() : minX;
maxX = (c->maxXValue() > maxX) ? c->maxXValue() : maxX;
minY = (c->minYValue() < minY) ? c->minYValue() : minY;
maxY = (c->maxYValue() > maxY) ? c->maxYValue() : maxY;
}
QwtDoubleRect r;
r.setLeft(minX);
r.setRight(maxX);
r.setTop(minY);
r.setBottom(maxY);
return r;
}
示例4: boundingRect
virtual QwtDoubleRect boundingRect() const {
QwtDoubleRect retval = QwtData::boundingRect();
double halfspan = std::max(std::max(fabs(retval.top()), fabs(retval.bottom())), 1e-2);
retval.setTop(-halfspan);
retval.setHeight(halfspan*2.0);
return retval;
}
示例5: minZoomSize
/*!
Expand the selected rectangle to minZoomSize() and zoom in
if accepted.
\sa QwtPlotZoomer::accept()a, QwtPlotZoomer::minZoomSize()
*/
bool QwtPlotZoomer::end(bool ok)
{
ok = QwtPlotPicker::end(ok);
if (!ok)
return false;
QwtPlot *plot = QwtPlotZoomer::plot();
if ( !plot )
return false;
const QwtPolygon &pa = selection();
if ( pa.count() < 2 )
return false;
QRect rect = QRect(pa[0], pa[int(pa.count() - 1)]);
#if QT_VERSION < 0x040000
rect = rect.normalize();
#else
rect = rect.normalized();
#endif
QwtDoubleRect zoomRect = invTransform(rect).normalized();
const QwtDoublePoint center = zoomRect.center();
zoomRect.setSize(zoomRect.size().expandedTo(minZoomSize()));
zoomRect.moveCenter(center);
zoom(zoomRect);
return true;
}
示例6: boundingInterval
/*!
Interval, that is necessary to display the item
This interval can be useful for operations like clipping or autoscaling
\param scaleId Scale index
\return bounding interval
\sa QwtData::boundingRect()
*/
QwtDoubleInterval QwtPolarCurve::boundingInterval( int scaleId ) const
{
const QwtDoubleRect boundingRect = d_points->boundingRect();
if ( scaleId == QwtPolar::ScaleAzimuth )
return QwtDoubleInterval( boundingRect.left(), boundingRect.right() );
else if ( scaleId == QwtPolar::ScaleRadius )
return QwtDoubleInterval( boundingRect.top(), boundingRect.bottom() );
return QwtDoubleInterval();
}
示例7: boundingRect
/// Get the bounding rect including all plotted data.
QwtDoubleRect DatasetPlotData::boundingRect() const {
QwtDoubleRect rect = m_dataCurve->boundingRect();
if (m_calcCurve) {
rect = rect.united(m_calcCurve->boundingRect());
}
if (m_diffCurve) {
rect = rect.united(m_diffCurve->boundingRect());
}
return rect;
}
示例8: zoomToRange
/// Set zooming to the current fitting range.
void PlotController::zoomToRange()
{
QwtDoubleRect rect = m_zoomer->zoomRect();
rect.setX( m_rangeSelector->getMinimum() );
rect.setRight( m_rangeSelector->getMaximum() );
// In case the scales were set by the panning tool we need to
// reset the zoomer first.
m_zoomer->zoom(-1);
// Set new zoom level.
m_zoomer->zoom(rect);
}
示例9: transform
/*!
Translate a rectangle from plot into pixel coordinates
\return Rectangle in pixel coordinates
\sa QwtPlotPicker::invTransform()
*/
QRect QwtPlotPicker::transform(const QwtDoubleRect &rect) const
{
QwtScaleMap xMap = plot()->canvasMap(d_xAxis);
QwtScaleMap yMap = plot()->canvasMap(d_yAxis);
const int left = xMap.transform(rect.left());
const int right = xMap.transform(rect.right());
const int top = yMap.transform(rect.top());
const int bottom = yMap.transform(rect.bottom());
return QRect(left, top, right - left, bottom - top);
}
示例10: transform
/*!
Translate a rectangle from plot into pixel coordinates
\return Rectangle in pixel coordinates
\sa QwtPlotPicker::invTransform()
*/
QRect QwtPlotPicker::transform(const QwtDoubleRect &rect) const
{
QwtDiMap xMap = plot()->canvasMap(d_xAxis);
QwtDiMap yMap = plot()->canvasMap(d_yAxis);
const int x1 = xMap.transform(rect.x1());
const int x2 = xMap.transform(rect.x2());
const int y1 = yMap.transform(rect.y1());
const int y2 = yMap.transform(rect.y2());
return QRect(x1, y1, x2 - x1, y2 - y1);
}
示例11: setBoundingRect
void ImageMarker::setBoundingRect(const QwtDoubleRect& rect)
{
if (d_rect == rect)
return;
d_rect = rect;
const QwtScaleMap &xMap = plot()->canvasMap(xAxis());
const QwtScaleMap &yMap = plot()->canvasMap(yAxis());
d_pos = QPoint(xMap.transform(rect.left()), yMap.transform(rect.top()));
}
示例12: plot
/*!
Return normalized bounding rect of the axes
\warning Calling QwtPlot::setAxisScale() while QwtPlot::autoReplot() is FALSE
leaves the axis in an 'intermediate' state.
In this case, to prevent buggy behaviour, you must call
QwtPlot::replot() before calling QwtPlotPicker::scaleRect().
This quirk will be removed in a future release.
\sa QwtPlot::autoReplot(), QwtPlot::replot().
*/
QwtDoubleRect QwtPlotPicker::scaleRect() const
{
const QwtPlot *plt = plot();
const QwtDoubleRect rect(
plt->axisScale(xAxis())->lBound(),
plt->axisScale(xAxis())->hBound(),
plt->axisScale(yAxis())->lBound(),
plt->axisScale(yAxis())->hBound()
);
return rect.normalize();
}
示例13: boundingRect
QwtDoubleRect QwtHistogram::boundingRect() const {
QwtDoubleRect rect = QwtPlotCurve::boundingRect();
rect.setLeft(rect.left() - x(1));
rect.setRight(rect.right() + x(dataSize() - 1));
rect.setTop(0);
rect.setBottom(1.2 * rect.bottom());
return rect;
}
示例14: invTransform
/*!
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) );
}
}
示例15: drawRays
/*!
Draw lines from the pole
\param painter Painter
\param canvasRect Contents rect of the canvas in painter coordinates
\param pole Position of the pole in painter coordinates
\param radius Length of the lines in painter coordinates
\param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
\param values Azimuth values, indicating the direction of the lines
*/
void QwtPolarGrid::drawRays(
QPainter *painter, const QwtDoubleRect &canvasRect,
const QwtDoublePoint &pole, double radius,
const QwtScaleMap &azimuthMap, const QwtValueList &values ) const
{
for ( int i = 0; i < int( values.size() ); i++ )
{
double azimuth = azimuthMap.xTransform( values[i] );
azimuth = ::fmod( azimuth, 2 * M_PI );
bool skipLine = false;
if ( testDisplayFlag( SmartScaleDraw ) )
{
const QwtAbstractScaleDraw::ScaleComponent bone =
QwtAbstractScaleDraw::Backbone;
if ( isClose( azimuth, 0.0 ) )
{
const AxisData &axis = d_data->axisData[QwtPolar::AxisRight];
if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
skipLine = true;
}
else if ( isClose( azimuth, M_PI / 2 ) )
{
const AxisData &axis = d_data->axisData[QwtPolar::AxisTop];
if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
skipLine = true;
}
else if ( isClose( azimuth, M_PI ) )
{
const AxisData &axis = d_data->axisData[QwtPolar::AxisLeft];
if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
skipLine = true;
}
else if ( isClose( azimuth, 3 * M_PI / 2.0 ) )
{
const AxisData &axis = d_data->axisData[QwtPolar::AxisBottom];
if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
skipLine = true;
}
}
if ( !skipLine )
{
const QwtDoublePoint pos = qwtPolar2Pos( pole, radius, azimuth );
/*
Qt4 is horrible slow, when painting primitives,
with coordinates far outside the visible area.
*/
QwtPolygon pa( 2 );
pa.setPoint( 0, pole.toPoint() );
pa.setPoint( 1, pos.toPoint() );
if ( testDisplayFlag( ClipGridLines ) )
pa = QwtClipper::clipPolygon( canvasRect.toRect(), pa );
QwtPainter::drawPolyline( painter, pa );
}
}
}