static inline Polygon qwtToPointsFiltered(
    const QRectF &boundingRect,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QwtSeriesData<QPointF> *series, int from, int to )
{
    // F.e. in scatter plots ( no connecting lines ) we
    // can sort out all duplicates ( not only consecutive points )

    Polygon polygon( to - from + 1 );
    Point *points = polygon.data();

    QwtPixelMatrix pixelMatrix( boundingRect.toAlignedRect() );

    int numPoints = 0;
    for ( int i = from; i <= to; i++ )
    {
        const QPointF sample = series->sample( i );

        const int x = qwtRoundValue( xMap.transform( sample.x() ) );
        const int y = qwtRoundValue( yMap.transform( sample.y() ) );

        if ( pixelMatrix.testAndSetPixel( x, y, true ) == false )
        {
            points[ numPoints ].rx() = x;
            points[ numPoints ].ry() = y;

            numPoints++;
        }
    }

    polygon.resize( numPoints );
    return polygon;
}
static Polygon qwtMapPointsQuad( const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QwtSeriesData<QPointF> *series, int from, int to )
{
    const QPointF sample0 = series->sample( from );

    PolygonQuadrupel q;
    q.start( qwtRoundValue( xMap.transform( sample0.x() ) ),
        qwtRoundValue( yMap.transform( sample0.y() ) ) );

    Polygon polyline;
    for ( int i = from; i <= to; i++ )
    {
        const QPointF sample = series->sample( i );

        const int x = qwtRoundValue( xMap.transform( sample.x() ) );
        const int y = qwtRoundValue( yMap.transform( sample.y() ) );

        if ( !q.append( x, y ) )
        {
            q.flush( polyline );
            q.start( x, y );
        }
    }
    q.flush( polyline );

    return polyline;
}
 inline double operator()( double value )
 {
     return static_cast<double>( qwtRoundValue( value ) );
 }
 inline int operator()( double value )
 {
     return qwtRoundValue( value );
 }