void OscilloscopePlot::updateCurve() { CurveData *data = static_cast<CurveData *>( d_curve->data() ); data->values().lock(); const int numPoints = data->size(); if ( numPoints > d_paintedPoints ) { const bool doClip = !canvas()->testAttribute( Qt::WA_PaintOnScreen ); if ( doClip ) { /* Depending on the platform setting a clip might be an important performance issue. F.e. for Qt Embedded this reduces the part of the backing store that has to be copied out - maybe to an unaccelerated frame buffer device. */ const QwtScaleMap xMap = canvasMap( d_curve->xAxis() ); const QwtScaleMap yMap = canvasMap( d_curve->yAxis() ); QRectF br = qwtBoundingRect( *data, d_paintedPoints - 1, numPoints - 1 ); const QRect clipRect = QwtScaleMap::transform( xMap, yMap, br ).toRect(); d_directPainter->setClipRegion( clipRect ); } d_directPainter->drawSeries( d_curve, d_paintedPoints - 1, numPoints - 1 ); d_paintedPoints = numPoints; } data->values().unlock(); }
void Plot::replot() { CurveData *data = (CurveData *)d_curve->data(); data->values().lock(); QwtPlot::replot(); d_paintedPoints = data->size(); data->values().unlock(); }
void OscilloscopePlot::replot() { CurveData *data = static_cast<CurveData *>( d_curve->data() ); data->values().lock(); QwtPlot::replot(); d_paintedPoints = data->size(); data->values().unlock(); }
void Plot::updateCurve() { CurveData *data = (CurveData *)d_curve->data(); data->values().lock(); const int numPoints = d_curve->data()->size(); if ( numPoints > d_paintedPoints ) { d_directPainter->drawSeries(d_curve, d_paintedPoints - 1, numPoints - 1); d_paintedPoints = numPoints; } data->values().unlock(); }
void OscilloscopePlot::incrementInterval() { d_interval = QwtInterval( d_interval.maxValue(), d_interval.maxValue() + d_interval.width() ); CurveData *data = static_cast<CurveData *>( d_curve->data() ); data->values().clearStaleValues( d_interval.minValue() ); // To avoid, that the grid is jumping, we disable // the autocalculation of the ticks and shift them // manually instead. QwtScaleDiv scaleDiv = axisScaleDiv( QwtPlot::xBottom ); scaleDiv.setInterval( d_interval ); for ( int i = 0; i < QwtScaleDiv::NTickTypes; i++ ) { QList<double> ticks = scaleDiv.ticks( i ); for ( int j = 0; j < ticks.size(); j++ ) ticks[j] += d_interval.width(); scaleDiv.setTicks( i, ticks ); } setAxisScaleDiv( QwtPlot::xBottom, scaleDiv ); d_origin->setValue( d_interval.minValue() + d_interval.width() / 2.0, 0.0 ); d_paintedPoints = 0; replot(); }