/** 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); }
/*! 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 ); }
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; }
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; }
/*! 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; }
/*! 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(); }
/// 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; }
/// 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); }
/*! 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); }
/*! 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); }
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())); }
/*! 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(); }
void VectorPlot::setupPlot(const QwtDoubleRect &rect) { QwtScaleDiv *hDiv = plot->axisScaleDiv(QwtPlot::xBottom); QwtScaleDiv *vDiv = plot->axisScaleDiv(QwtPlot::yLeft); // In earlier qwt version some member function names are different from newer version #if QWT_VERSION <= 0x050101 double lLimit = std::min(hDiv->lBound(), rect.left()); double rLimit = std::max(hDiv->hBound(), rect.right()); double bLimit = std::min(vDiv->lBound(), rect.bottom()); double tLimit = std::max(vDiv->hBound(), rect.top()); #else double lLimit = std::min(hDiv->lowerBound(), rect.left()); double rLimit = std::max(hDiv->upperBound(), rect.right()); double bLimit = std::min(vDiv->lowerBound(), rect.bottom()); double tLimit = std::max(vDiv->upperBound(), rect.top()); #endif plot->setAxisScale(QwtPlot::xBottom, lLimit, rLimit); plot->setAxisScale(QwtPlot::yLeft, bLimit, tLimit); double xMargin = plot->invTransform(QwtPlot::xBottom, plot->margin()); double yMargin = plot->invTransform(QwtPlot::yLeft, plot->margin()); mBoundingRect = QwtDoubleRect(QwtDoublePoint(lLimit - xMargin, tLimit + yMargin), QwtDoublePoint(rLimit + xMargin, bLimit - yMargin)); qDebug() << "xMargin:" << xMargin; qDebug() << "yMargin:" << yMargin; qDebug() << "mBoundingRect:" << mBoundingRect; // mBoundingRect = rect; }
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; }
/*! 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) ); } }
/*! 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 ); } } }
void QwtPlotZoomer::zoom(const QwtDoubleRect &rect) { if ( d_data->maxStackDepth >= 0 && int(d_data->zoomRectIndex) >= d_data->maxStackDepth ) { return; } const QwtDoubleRect zoomRect = d_data->zoomStack[0] & rect.normalized(); if ( zoomRect != d_data->zoomStack[d_data->zoomRectIndex] ) { for ( uint i = int(d_data->zoomStack.count()) - 1; i > d_data->zoomRectIndex; i-- ) { (void)d_data->zoomStack.pop(); } d_data->zoomStack.push(zoomRect); d_data->zoomRectIndex++; rescale(); emit zoomed(zoomRect); } }
/*! 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); }
/*! Return normalized bounding rect of the axes \sa QwtPlot::autoReplot(), QwtPlot::replot(). */ QwtDoubleRect QwtPlotPicker::scaleRect() const { QwtDoubleRect rect; if ( plot() ) { const QwtScaleDiv *xs = plot()->axisScaleDiv(xAxis()); const QwtScaleDiv *ys = plot()->axisScaleDiv(yAxis()); if ( xs && ys ) { rect = QwtDoubleRect( xs->lowerBound(), ys->lowerBound(), xs->range(), ys->range() ); rect = rect.normalized(); } } return rect; }
/*! 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 }
//! 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()); }
/*! Returns the bounding rectangle of this rectangle and rectangle other. The bounding rectangle of a nonempty rectangle and an empty or invalid rectangle is defined to be the nonempty rectangle. */ QwtDoubleRect QwtDoubleRect::operator|(const QwtDoubleRect &other) const { if ( isEmpty() ) return other; if ( other.isEmpty() ) return *this; const double minX = qwtMin(d_left, other.d_left); const double maxX = qwtMax(d_right, other.d_right); const double minY = qwtMin(d_top, other.d_top); const double maxY = qwtMax(d_bottom, other.d_bottom); return QwtDoubleRect(minX, minY, maxX - minX, maxY - minY); }
void AerolabWindow::zoomInterval(IntervalItem *which) { QwtDoubleRect rect; if (!aerolab->byDistance()) { rect.setLeft(which->start/60); rect.setRight(which->stop/60); } else { rect.setLeft(which->startKM); rect.setRight(which->stopKM); } rect.setTop(aerolab->veCurve->maxYValue()*1.1); rect.setBottom(aerolab->veCurve->minYValue()-10); allZoomer->zoom(rect); }
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; }
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; }
/** * Remove the curve. Rescale the axes if there are stored curves. */ void OneCurvePlot::clearCurve() { // remove the curve if (m_curve) { m_curve->attach(0); m_curve = NULL; } clearPeakLabels(); // if there are stored curves rescale axes to make them fully visible if (hasStored()) { QMap<QString,QwtPlotCurve*>::const_iterator curve = m_stored.begin(); QwtDoubleRect br = (**curve).boundingRect(); double xmin = br.left(); double xmax = br.right(); double ymin = br.top(); double ymax = br.bottom(); ++curve; for(;curve!=m_stored.end();++curve) { QwtDoubleRect br = (**curve).boundingRect(); if (br.left() < xmin) xmin = br.left(); if (br.right() > xmax) xmax = br.right(); if (br.top() < ymin) ymin = br.top(); if (br.bottom() > ymax) ymax = br.bottom(); } setXScale(xmin,xmax); setYScale(ymin,ymax); } }
QwtDoubleRect BoxCurve::boundingRect() const { QwtDoubleRect rect = QwtCurve::boundingRect(); double dy=0.2*(rect.y2()-rect.y1()); rect.setY1(rect.y1()-dy); rect.setY2(rect.y2()+dy); rect.setX1(rect.x1()-0.5); rect.setX2(rect.x2()+0.5); return rect; }
/*! Build a scale map The azimuth map translates between the scale values and angles from [0.0, 2 * PI[. The radial map translates scale values into the distance from the pole. The radial map is calculated from the current geometry of the canvas. \param scaleId Scale index \return Map for the scale on the canvas. With this map pixel coordinates can translated to plot coordinates and vice versa. \sa QwtScaleMap, transform(), invTransform() */ QwtScaleMap QwtPolarPlot::scaleMap( int scaleId ) const { const QwtDoubleRect pr = plotRect(); return scaleMap( scaleId, pr.width() / 2.0 ); }
/*! Redraw the canvas. \param painter Painter used for drawing \param canvasRect Contents rect of the canvas */ void QwtPolarPlot::drawCanvas( QPainter *painter, const QwtDoubleRect &canvasRect ) const { const QwtDoubleRect cr = canvasRect; const QwtDoubleRect pr = plotRect( cr.toRect() ); const double radius = pr.width() / 2.0; if ( d_data->canvasBrush.style() != Qt::NoBrush ) { painter->save(); painter->setPen( Qt::NoPen ); painter->setBrush( d_data->canvasBrush ); if ( qwtDistance( pr.center(), cr.topLeft() ) < radius && qwtDistance( pr.center(), cr.topRight() ) < radius && qwtDistance( pr.center(), cr.bottomRight() ) < radius && qwtDistance( pr.center(), cr.bottomLeft() ) < radius ) { QwtPainter::drawRect( painter, cr.toRect() ); } else { #if QT_VERSION < 0x040000 QwtPainter::drawEllipse( painter, pr.toRect() ); #else painter->setRenderHint( QPainter::Antialiasing, true ); QwtPainter::drawEllipse( painter, pr.toRect() ); #endif } painter->restore(); } drawItems( painter, scaleMap( QwtPolar::Azimuth, radius ), scaleMap( QwtPolar::Radius, radius ), pr.center(), radius, canvasRect ); }
/*! 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(); } } }