virtual QRectF boundingRect() const
    {
        if ( d_boundingRect.width() < 0.0 )
            d_boundingRect = qwtBoundingRect( *this );

        return d_boundingRect;
    }
/*!
  \brief Calculate the bounding rect

  The bounding rectangle is calculated once by iterating over all
  points and is stored for all following requests.

  \return Bounding rectangle
*/
QRectF QwtPointSeriesData::boundingRect() const
{
    if ( d_boundingRect.width() < 0.0 )
        d_boundingRect = qwtBoundingRect( *this );

    return d_boundingRect;
}
Example #3
0
/*!
  \brief Calculate the bounding rectangle

  The bounding rectangle is calculated once by iterating over all
  points and is stored for all following requests.

  \return Bounding rectangle
*/
QRectF QwtTradingChartData::boundingRect() const
{
    if ( d_boundingRect.width() < 0.0 )
        d_boundingRect = qwtBoundingRect( *this );

    return d_boundingRect;
}
void arnTimeBasedVectorPlot::updateCurve()
{
    CurveData *data = (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();
}
Example #5
0
/*!
  \brief Calculate the bounding rectangle

  The bounding rectangle is calculated once by iterating over all
  points and is stored for all following requests.

  \return Bounding rectangle
*/
QRectF QwtVectorFieldData::boundingRect() const
{
    if ( d_boundingRect.width() < 0.0 )
        d_boundingRect = qwtBoundingRect( *this );

    return d_boundingRect;
}
/*!
  \brief Calculate the bounding rect

  The bounding rectangle is calculated once by iterating over all
  points and is stored for all following requests.

  \return Bounding rectangle
*/
QRectF QwtCPointerData::boundingRect() const
{
    if ( d_boundingRect.width() < 0 )
        d_boundingRect = qwtBoundingRect( *this );

    return d_boundingRect;
}
Example #7
0
void Plot::updateCurve()
{
    CurveData *data0 = (CurveData *)d_curve0->data();
    CurveData *data1 = (CurveData *)d_curve1->data();
    const int numPoints0 = data0->size();
    const int numPoints1 = data1->size();

    if ((numPoints0 > d_paintedPoints0)||(numPoints1 > d_paintedPoints1))
    {
        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 xMap0 = canvasMap( d_curve0->xAxis() );
            const QwtScaleMap yMap0 = canvasMap( d_curve0->yAxis() );

            const QwtScaleMap xMap1 = canvasMap( d_curve1->xAxis() );
            const QwtScaleMap yMap1 = canvasMap( d_curve1->yAxis() );

            QRectF br0 = qwtBoundingRect( *data0,
                d_paintedPoints0 - 1, numPoints0 - 1 );

            QRectF br1 = qwtBoundingRect( *data1,
                d_paintedPoints1 - 1, numPoints1 - 1 );

            const QRect clipRect0 = QwtScaleMap::transform( xMap0, yMap0, br0 ).toRect();
            const QRect clipRect1 = QwtScaleMap::transform( xMap1, yMap1, br1 ).toRect();
            const QRect clipRect = clipRect0.united(clipRect1);
            d_directPainter0->setClipRegion(clipRect);
            //d_directPainter1->setClipRegion(clipRect1);
        }

        d_directPainter0->drawSeries(d_curve0,
            d_paintedPoints0 - 1, numPoints0 - 1);
        d_paintedPoints0 = numPoints0;

        d_directPainter0->drawSeries(d_curve1,
            d_paintedPoints1 - 1, numPoints1 - 1);
        d_paintedPoints1 = numPoints1;
    }
}
Example #8
0
QRectF qwtBoundingRectT(
    const QwtSeriesData<T>& series, int from, int to )
{
    QRectF boundingRect( 1.0, 1.0, -2.0, -2.0 ); // invalid;

    if ( from < 0 )
        from = 0;

    if ( to < 0 )
        to = series.size() - 1;

    if ( to < from )
        return boundingRect;

    int i;
    for ( i = from; i <= to; i++ )
    {
        const QRectF rect = qwtBoundingRect( series.sample( i ) );
        if ( rect.width() >= 0.0 && rect.height() >= 0.0 )
        {
            boundingRect = rect;
            i++;
            break;
        }
    }

    for ( ; i <= to; i++ )
    {
        const QRectF rect = qwtBoundingRect( series.sample( i ) );
        if ( rect.width() >= 0.0 && rect.height() >= 0.0 )
        {
          if (!qIsNaN(rect.left()))
            boundingRect.setLeft( qMin( boundingRect.left(), rect.left() ) );
          if (!qIsNaN(rect.right()))
            boundingRect.setRight( qMax( boundingRect.right(), rect.right() ) );
          if (!qIsNaN(rect.top()))
            boundingRect.setTop( qMin( boundingRect.top(), rect.top() ) );
          if (!qIsNaN(rect.bottom()))
            boundingRect.setBottom( qMax( boundingRect.bottom(), rect.bottom() ) );
        }
    }

    return boundingRect;
}
Example #9
0
/*!
  \brief Calculate the bounding rectangle

  This implementation iterates over all points, what could often
  be implemented much faster using the characteristics of the series.
  When there are many points it is recommended to overload and
  reimplement this method using the characteristics of the series
  ( if possible ).

  \return Bounding rectangle
*/
QRectF QwtSyntheticPointData::boundingRect() const
{
    if ( d_size == 0 ||
        !( d_interval.isValid() || d_intervalOfInterest.isValid() ) )
    {
        return QRectF( 1.0, 1.0, -2.0, -2.0 ); // something invalid
    }

    return qwtBoundingRect( *this );
}
Example #10
0
QRectF PlotInstanceSampler::calculateBoundingRect(size_t from, size_t to) const
{
    // From qwt_series_data.cpp
    QRectF boundingRect(1.0, 1.0, -2.0, -2.0); // invalid;

    if (to == ~(size_t)(0u))
    {
        to = size() - 1;
    }

    if (!size() || to < from)
    {
        return boundingRect;
    }

    size_t i;
    for (i = from; i <= to; i++)
    {
        const QRectF rect = qwtBoundingRect(sample(i));
        if (rect.width() >= 0.0 && rect.height() >= 0.0)
        {
            boundingRect = rect;
            i++;
            break;
        }
    }

    for (; i <= to; i++)
    {
        const QRectF rect = qwtBoundingRect(sample(i));
        if (rect.width() >= 0.0 && rect.height() >= 0.0)
        {
            boundingRect.setLeft(qMin(boundingRect.left(), rect.left()));
            boundingRect.setRight(qMax(boundingRect.right(), rect.right()));
            boundingRect.setTop(qMin(boundingRect.top(), rect.top()));
            boundingRect.setBottom(qMax(boundingRect.bottom(), rect.bottom()));
        }
    }

    return boundingRect;
}
Example #11
0
void Plot::appendPoint1(double u)
{
    double elapsed = d_clock.elapsed() / 1000.0;
    qDebug() << "d_clock1: " << elapsed;
    qDebug() << "udouble1: " << u;
    QPointF point(elapsed,(u*5/1024));
    CurveData *data = static_cast<CurveData *>( d_curve1->data() );
    data->append(point);
    RecToFile1(elapsed,u);

    const int numPoints = data->size();
    if ( numPoints > d_paintedPoints1 )
    {
        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_curve1->xAxis() );
            const QwtScaleMap yMap = canvasMap( d_curve1->yAxis() );

            QRectF br = qwtBoundingRect( *data,
                d_paintedPoints1 - 1, numPoints - 1 );

            const QRect clipRect = QwtScaleMap::transform( xMap, yMap, br ).toRect();
            d_directPainter0->setClipRegion( clipRect );
        }

        d_directPainter0->drawSeries(d_curve1,
            d_paintedPoints1 - 1, numPoints - 1);
        d_paintedPoints1 = numPoints;
    }
}
Example #12
0
		virtual QRectF boundingRect () const { return qwtBoundingRect(*this); }
Example #13
0
QRectF CCurveData::boundingRect(void) const
{
	d_boundingRect = qwtBoundingRect(*this);
	return d_boundingRect;
}