Index: trunk/BNC/qwt/qwt_plot_curve.cpp
===================================================================
--- trunk/BNC/qwt/qwt_plot_curve.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_plot_curve.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -15,13 +15,26 @@
 #include "qwt_scale_map.h"
 #include "qwt_plot.h"
-#include "qwt_curve_fitter.h"
+#include "qwt_spline_curve_fitter.h"
 #include "qwt_symbol.h"
 #include "qwt_point_mapper.h"
+#include "qwt_text.h"
+#include "qwt_graphic.h"
+
 #include <qpainter.h>
-#include <qpixmap.h>
-#include <qalgorithms.h>
-#include <qmath.h>
-
-static void qwtUpdateLegendIconSize( QwtPlotCurve *curve )
+#include <qpainterpath.h>
+#include <qnumeric.h>
+
+#include <climits>
+
+static inline QRectF qwtIntersectedClipRect( const QRectF& rect, QPainter* painter )
+{
+    QRectF clipRect = rect;
+    if ( painter->hasClipping() )
+        clipRect &= painter->clipBoundingRect();
+
+    return clipRect;
+}
+
+static void qwtUpdateLegendIconSize( QwtPlotCurve* curve )
 {
     if ( curve->symbol() &&
@@ -35,5 +48,5 @@
             // Avoid, that the line is completely covered by the symbol
 
-            int w = qCeil( 1.5 * sz.width() );
+            int w = qwtCeil( 1.5 * sz.width() );
             if ( w % 2 )
                 w++;
@@ -46,5 +59,5 @@
 }
 
-static int qwtVerifyRange( int size, int &i1, int &i2 )
+static int qwtVerifyRange( int size, int& i1, int& i2 )
 {
     if ( size < 1 )
@@ -62,15 +75,12 @@
 class QwtPlotCurve::PrivateData
 {
-public:
-    PrivateData():
-        style( QwtPlotCurve::Lines ),
-        baseline( 0.0 ),
-        symbol( NULL ),
-        attributes( 0 ),
-        paintAttributes(
-            QwtPlotCurve::ClipPolygons | QwtPlotCurve::FilterPoints ),
-        legendAttributes( 0 )
-    {
-        pen = QPen( Qt::black );
+  public:
+    PrivateData()
+        : style( QwtPlotCurve::Lines )
+        , baseline( 0.0 )
+        , symbol( NULL )
+        , pen( Qt::black )
+        , paintAttributes( QwtPlotCurve::ClipPolygons | QwtPlotCurve::FilterPoints )
+    {
         curveFitter = new QwtSplineCurveFitter;
     }
@@ -85,6 +95,6 @@
     double baseline;
 
-    const QwtSymbol *symbol;
-    QwtCurveFitter *curveFitter;
+    const QwtSymbol* symbol;
+    QwtCurveFitter* curveFitter;
 
     QPen pen;
@@ -98,9 +108,9 @@
 
 /*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotCurve::QwtPlotCurve( const QwtText &title ):
-    QwtPlotSeriesItem( title )
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotCurve::QwtPlotCurve( const QwtText& title )
+    : QwtPlotSeriesItem( title )
 {
     init();
@@ -108,9 +118,9 @@
 
 /*!
-  Constructor
-  \param title Title of the curve
-*/
-QwtPlotCurve::QwtPlotCurve( const QString &title ):
-    QwtPlotSeriesItem( QwtText( title ) )
+   Constructor
+   \param title Title of the curve
+ */
+QwtPlotCurve::QwtPlotCurve( const QString& title )
+    : QwtPlotSeriesItem( QwtText( title ) )
 {
     init();
@@ -120,5 +130,5 @@
 QwtPlotCurve::~QwtPlotCurve()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -129,5 +139,5 @@
     setItemAttribute( QwtPlotItem::AutoScale );
 
-    d_data = new PrivateData;
+    m_data = new PrivateData;
     setData( new QwtPointSeriesData() );
 
@@ -142,16 +152,16 @@
 
 /*!
-  Specify an attribute how to draw the curve
-
-  \param attribute Paint attribute
-  \param on On/Off
-  \sa testPaintAttribute()
-*/
+   Specify an attribute how to draw the curve
+
+   \param attribute Paint attribute
+   \param on On/Off
+   \sa testPaintAttribute()
+ */
 void QwtPlotCurve::setPaintAttribute( PaintAttribute attribute, bool on )
 {
     if ( on )
-        d_data->paintAttributes |= attribute;
+        m_data->paintAttributes |= attribute;
     else
-        d_data->paintAttributes &= ~attribute;
+        m_data->paintAttributes &= ~attribute;
 }
 
@@ -159,17 +169,17 @@
     \return True, when attribute is enabled
     \sa setPaintAttribute()
-*/
+ */
 bool QwtPlotCurve::testPaintAttribute( PaintAttribute attribute ) const
 {
-    return ( d_data->paintAttributes & attribute );
-}
-
-/*!
-  Specify an attribute how to draw the legend icon
-
-  \param attribute Attribute
-  \param on On/Off
-  /sa testLegendAttribute(). legendIcon()
-*/
+    return ( m_data->paintAttributes & attribute );
+}
+
+/*!
+   Specify an attribute how to draw the legend icon
+
+   \param attribute Attribute
+   \param on On/Off
+   /sa testLegendAttribute(). legendIcon()
+ */
 void QwtPlotCurve::setLegendAttribute( LegendAttribute attribute, bool on )
 {
@@ -177,7 +187,7 @@
     {
         if ( on )
-            d_data->legendAttributes |= attribute;
+            m_data->legendAttributes |= attribute;
         else
-            d_data->legendAttributes &= ~attribute;
+            m_data->legendAttributes &= ~attribute;
 
         qwtUpdateLegendIconSize( this );
@@ -187,23 +197,49 @@
 
 /*!
-  \return True, when attribute is enabled
-  \sa setLegendAttribute()
-*/
+   \return True, when attribute is enabled
+   \sa setLegendAttribute()
+ */
 bool QwtPlotCurve::testLegendAttribute( LegendAttribute attribute ) const
 {
-    return ( d_data->legendAttributes & attribute );
-}
-
-/*!
-  Set the curve's drawing style
-
-  \param style Curve style
-  \sa style()
-*/
+    return ( m_data->legendAttributes & attribute );
+}
+
+/*!
+   Specify the attributes how to draw the legend icon
+
+   \param attributes Attributes
+   /sa setLegendAttribute(). legendIcon()
+ */
+void QwtPlotCurve::setLegendAttributes( LegendAttributes attributes )
+{
+    if ( attributes != m_data->legendAttributes )
+    {
+        m_data->legendAttributes = attributes;
+
+        qwtUpdateLegendIconSize( this );
+        legendChanged();
+    }
+}
+
+/*!
+   \return Attributes how to draw the legend icon
+   \sa setLegendAttributes(), testLegendAttribute()
+ */
+QwtPlotCurve::LegendAttributes QwtPlotCurve::legendAttributes() const
+{
+    return m_data->legendAttributes;
+}
+
+/*!
+   Set the curve's drawing style
+
+   \param style Curve style
+   \sa style()
+ */
 void QwtPlotCurve::setStyle( CurveStyle style )
 {
-    if ( style != d_data->style )
-    {
-        d_data->style = style;
+    if ( style != m_data->style )
+    {
+        m_data->style = style;
 
         legendChanged();
@@ -213,28 +249,28 @@
 
 /*!
-  \return Style of the curve
-  \sa setStyle()
-*/
+   \return Style of the curve
+   \sa setStyle()
+ */
 QwtPlotCurve::CurveStyle QwtPlotCurve::style() const
 {
-    return d_data->style;
-}
-
-/*!
-  \brief Assign a symbol
-
-  The curve will take the ownership of the symbol, hence the previously
-  set symbol will be delete by setting a new one. If \p symbol is
-  \c NULL no symbol will be drawn.
-
-  \param symbol Symbol
-  \sa symbol()
-*/
-void QwtPlotCurve::setSymbol( QwtSymbol *symbol )
-{
-    if ( symbol != d_data->symbol )
-    {
-        delete d_data->symbol;
-        d_data->symbol = symbol;
+    return m_data->style;
+}
+
+/*!
+   \brief Assign a symbol
+
+   The curve will take the ownership of the symbol, hence the previously
+   set symbol will be delete by setting a new one. If \p symbol is
+   \c NULL no symbol will be drawn.
+
+   \param symbol Symbol
+   \sa symbol()
+ */
+void QwtPlotCurve::setSymbol( QwtSymbol* symbol )
+{
+    if ( symbol != m_data->symbol )
+    {
+        delete m_data->symbol;
+        m_data->symbol = symbol;
 
         qwtUpdateLegendIconSize( this );
@@ -246,26 +282,26 @@
 
 /*!
-  \return Current symbol or NULL, when no symbol has been assigned
-  \sa setSymbol()
-*/
-const QwtSymbol *QwtPlotCurve::symbol() const
-{
-    return d_data->symbol;
-}
-
-/*!
-  Build and assign a pen
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtPlotCurve::setPen( const QColor &color, qreal width, Qt::PenStyle style )
+   \return Current symbol or NULL, when no symbol has been assigned
+   \sa setSymbol()
+ */
+const QwtSymbol* QwtPlotCurve::symbol() const
+{
+    return m_data->symbol;
+}
+
+/*!
+   Build and assign a pen
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtPlotCurve::setPen( const QColor& color, qreal width, Qt::PenStyle style )
 {
     setPen( QPen( color, width, style ) );
@@ -273,14 +309,14 @@
 
 /*!
-  Assign a pen
-
-  \param pen New pen
-  \sa pen(), brush()
-*/
-void QwtPlotCurve::setPen( const QPen &pen )
-{
-    if ( pen != d_data->pen )
-    {
-        d_data->pen = pen;
+   Assign a pen
+
+   \param pen New pen
+   \sa pen(), brush()
+ */
+void QwtPlotCurve::setPen( const QPen& pen )
+{
+    if ( pen != m_data->pen )
+    {
+        m_data->pen = pen;
 
         legendChanged();
@@ -290,14 +326,14 @@
 
 /*!
-  \return Pen used to draw the lines
-  \sa setPen(), brush()
-*/
+   \return Pen used to draw the lines
+   \sa setPen(), brush()
+ */
 const QPen& QwtPlotCurve::pen() const
 {
-    return d_data->pen;
-}
-
-/*!
-  \brief Assign a brush.
+    return m_data->pen;
+}
+
+/*!
+   \brief Assign a brush.
 
    In case of brush.style() != QBrush::NoBrush
@@ -310,12 +346,12 @@
    (ascending or descending).
 
-  \param brush New brush
-  \sa brush(), setBaseline(), baseline()
-*/
-void QwtPlotCurve::setBrush( const QBrush &brush )
-{
-    if ( brush != d_data->brush )
-    {
-        d_data->brush = brush;
+   \param brush New brush
+   \sa brush(), setBaseline(), baseline()
+ */
+void QwtPlotCurve::setBrush( const QBrush& brush )
+{
+    if ( brush != m_data->brush )
+    {
+        m_data->brush = brush;
 
         legendChanged();
@@ -325,28 +361,28 @@
 
 /*!
-  \return Brush used to fill the area between lines and the baseline
-  \sa setBrush(), setBaseline(), baseline()
-*/
+   \return Brush used to fill the area between lines and the baseline
+   \sa setBrush(), setBaseline(), baseline()
+ */
 const QBrush& QwtPlotCurve::brush() const
 {
-    return d_data->brush;
-}
-
-/*!
-  Draw an interval of the curve
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted. If to < 0 the
+    return m_data->brush;
+}
+
+/*!
+   Draw an interval of the curve
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted. If to < 0 the
          curve will be painted to its last point.
 
-  \sa drawCurve(), drawSymbols(),
-*/
-void QwtPlotCurve::drawSeries( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   \sa drawCurve(), drawSymbols(),
+ */
+void QwtPlotCurve::drawSeries( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     const size_t numSamples = dataSize();
@@ -361,20 +397,20 @@
     {
         painter->save();
-        painter->setPen( d_data->pen );
+        painter->setPen( m_data->pen );
 
         /*
-          Qt 4.0.0 is slow when drawing lines, but it's even
-          slower when the painter has a brush. So we don't
-          set the brush before we really need it.
+           Qt 4.0.0 is slow when drawing lines, but it's even
+           slower when the painter has a brush. So we don't
+           set the brush before we really need it.
          */
 
-        drawCurve( painter, d_data->style, xMap, yMap, canvasRect, from, to );
+        drawCurve( painter, m_data->style, xMap, yMap, canvasRect, from, to );
         painter->restore();
 
-        if ( d_data->symbol &&
-            ( d_data->symbol->style() != QwtSymbol::NoSymbol ) )
+        if ( m_data->symbol &&
+            ( m_data->symbol->style() != QwtSymbol::NoSymbol ) )
         {
             painter->save();
-            drawSymbols( painter, *d_data->symbol,
+            drawSymbols( painter, *m_data->symbol,
                 xMap, yMap, canvasRect, from, to );
             painter->restore();
@@ -384,17 +420,17 @@
 
 /*!
-  \brief Draw the line part (without symbols) of a curve interval.
-  \param painter Painter
-  \param style curve style, see QwtPlotCurve::CurveStyle
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from index of the first point to be painted
-  \param to index of the last point to be painted
-  \sa draw(), drawDots(), drawLines(), drawSteps(), drawSticks()
-*/
-void QwtPlotCurve::drawCurve( QPainter *painter, int style,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   \brief Draw the line part (without symbols) of a curve interval.
+   \param painter Painter
+   \param style curve style, see QwtPlotCurve::CurveStyle
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted
+   \sa draw(), drawDots(), drawLines(), drawSteps(), drawSticks()
+ */
+void QwtPlotCurve::drawCurve( QPainter* painter, int style,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     switch ( style )
@@ -426,116 +462,111 @@
 
 /*!
-  \brief Draw lines
-
-  If the CurveAttribute Fitted is enabled a QwtCurveFitter tries
-  to interpolate/smooth the curve, before it is painted.
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from index of the first point to be painted
-  \param to index of the last point to be painted
-
-  \sa setCurveAttribute(), setCurveFitter(), draw(),
+   \brief Draw lines
+
+   If the CurveAttribute Fitted is enabled a QwtCurveFitter tries
+   to interpolate/smooth the curve, before it is painted.
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted
+
+   \sa setCurveAttribute(), setCurveFitter(), draw(),
       drawLines(), drawDots(), drawSteps(), drawSticks()
-*/
-void QwtPlotCurve::drawLines( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+ */
+void QwtPlotCurve::drawLines( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     if ( from > to )
         return;
 
-    const bool doAlign = QwtPainter::roundingAlignment( painter );
-    const bool doFit = ( d_data->attributes & Fitted ) && d_data->curveFitter;
-    const bool doFill = ( d_data->brush.style() != Qt::NoBrush )
-            && ( d_data->brush.color().alpha() > 0 );
+    const bool doFit = ( m_data->attributes & Fitted ) && m_data->curveFitter;
+    const bool doAlign = !doFit && QwtPainter::roundingAlignment( painter );
+    const bool doFill = ( m_data->brush.style() != Qt::NoBrush )
+        && ( m_data->brush.color().alpha() > 0 );
 
     QRectF clipRect;
-    if ( d_data->paintAttributes & ClipPolygons )
-    {
-        qreal pw = qMax( qreal( 1.0 ), painter->pen().widthF());
-        clipRect = canvasRect.adjusted(-pw, -pw, pw, pw);
-    }
-
-    bool doIntegers = false;
-
-#if QT_VERSION < 0x040800
-
-    // For Qt <= 4.7 the raster paint engine is significantly faster
-    // for rendering QPolygon than for QPolygonF. So let's
-    // see if we can use it.
-
-    if ( painter->paintEngine()->type() == QPaintEngine::Raster )
-    {
-        // In case of filling or fitting performance doesn't count
-        // because both operations are much more expensive
-        // then drawing the polyline itself
-
-        if ( !doFit && !doFill )
-            doIntegers = true;
-    }
-#endif
-
-    const bool noDuplicates = d_data->paintAttributes & FilterPoints;
+    if ( m_data->paintAttributes & ClipPolygons )
+    {
+        clipRect = qwtIntersectedClipRect( canvasRect, painter );
+
+        const qreal pw = QwtPainter::effectivePenWidth( painter->pen() );
+        clipRect = clipRect.adjusted(-pw, -pw, pw, pw);
+    }
 
     QwtPointMapper mapper;
-    mapper.setFlag( QwtPointMapper::RoundPoints, doAlign );
-    mapper.setFlag( QwtPointMapper::WeedOutPoints, noDuplicates );
+
+    if ( doAlign )
+    {
+        mapper.setFlag( QwtPointMapper::RoundPoints, true );
+        mapper.setFlag( QwtPointMapper::WeedOutIntermediatePoints,
+            testPaintAttribute( FilterPointsAggressive ) );
+    }
+
+    mapper.setFlag( QwtPointMapper::WeedOutPoints,
+        testPaintAttribute( FilterPoints ) ||
+        testPaintAttribute( FilterPointsAggressive ) );
+
     mapper.setBoundingRect( canvasRect );
 
-    if ( doIntegers )
-    {
-        QPolygon polyline = mapper.toPolygon(
-            xMap, yMap, data(), from, to );
-
-        if ( d_data->paintAttributes & ClipPolygons )
-        {
-            polyline = QwtClipper::clipPolygon(
-                clipRect.toAlignedRect(), polyline, false );
-        }
-
-        QwtPainter::drawPolyline( painter, polyline );
+    QPolygonF polyline = mapper.toPolygonF( xMap, yMap, data(), from, to );
+
+    if ( doFill )
+    {
+        if ( doFit )
+        {
+            // it might be better to extend and draw the curvePath, but for
+            // the moment we keep an implementation, where we translate the
+            // path back to a polyline.
+
+            polyline = m_data->curveFitter->fitCurve( polyline );
+        }
+
+        if ( painter->pen().style() != Qt::NoPen )
+        {
+            // here we are wasting memory for the filled copy,
+            // do polygon clipping twice etc .. TODO
+
+            QPolygonF filled = polyline;
+            fillCurve( painter, xMap, yMap, canvasRect, filled );
+            filled.clear();
+
+            if ( m_data->paintAttributes & ClipPolygons )
+                QwtClipper::clipPolygonF( clipRect, polyline, false );
+
+            QwtPainter::drawPolyline( painter, polyline );
+        }
+        else
+        {
+            fillCurve( painter, xMap, yMap, canvasRect, polyline );
+        }
     }
     else
     {
-        QPolygonF polyline = mapper.toPolygonF( xMap, yMap, data(), from, to );
+        if ( testPaintAttribute( ClipPolygons ) )
+        {
+            QwtClipper::clipPolygonF( clipRect, polyline, false );
+        }
 
         if ( doFit )
-            polyline = d_data->curveFitter->fitCurve( polyline );
-
-        if ( doFill )
-        {
-            if ( painter->pen().style() != Qt::NoPen )
+        {
+            if ( m_data->curveFitter->mode() == QwtCurveFitter::Path )
             {
-                // here we are wasting memory for the filled copy,
-                // do polygon clipping twice etc .. TODO
-
-                QPolygonF filled = polyline;
-                fillCurve( painter, xMap, yMap, canvasRect, filled );
-                filled.clear();
-
-                if ( d_data->paintAttributes & ClipPolygons )
-                {
-                    polyline = QwtClipper::clipPolygonF(
-                        clipRect, polyline, false );
-                }
-
-                QwtPainter::drawPolyline( painter, polyline );
+                const QPainterPath curvePath =
+                    m_data->curveFitter->fitCurvePath( polyline );
+
+                painter->drawPath( curvePath );
             }
             else
             {
-                fillCurve( painter, xMap, yMap, canvasRect, polyline );
+                polyline = m_data->curveFitter->fitCurve( polyline );
+                QwtPainter::drawPolyline( painter, polyline );
             }
         }
         else
         {
-            if ( d_data->paintAttributes & ClipPolygons )
-            {
-                polyline = QwtClipper::clipPolygonF(
-                    clipRect, polyline, false );
-            }
-
             QwtPainter::drawPolyline( painter, polyline );
         }
@@ -544,18 +575,18 @@
 
 /*!
-  Draw sticks
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from index of the first point to be painted
-  \param to index of the last point to be painted
-
-  \sa draw(), drawCurve(), drawDots(), drawLines(), drawSteps()
-*/
-void QwtPlotCurve::drawSticks( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   Draw sticks
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted
+
+   \sa draw(), drawCurve(), drawDots(), drawLines(), drawSteps()
+ */
+void QwtPlotCurve::drawSticks( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     Q_UNUSED( canvasRect )
@@ -566,6 +597,6 @@
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
-    double x0 = xMap.transform( d_data->baseline );
-    double y0 = yMap.transform( d_data->baseline );
+    double x0 = xMap.transform( m_data->baseline );
+    double y0 = yMap.transform( m_data->baseline );
     if ( doAlign )
     {
@@ -576,5 +607,5 @@
     const Qt::Orientation o = orientation();
 
-    const QwtSeriesData<QPointF> *series = data();
+    const QwtSeriesData< QPointF >* series = data();
 
     for ( int i = from; i <= to; i++ )
@@ -599,18 +630,18 @@
 
 /*!
-  Draw dots
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from index of the first point to be painted
-  \param to index of the last point to be painted
-
-  \sa draw(), drawCurve(), drawSticks(), drawLines(), drawSteps()
-*/
-void QwtPlotCurve::drawDots( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   Draw dots
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted
+
+   \sa draw(), drawCurve(), drawSticks(), drawLines(), drawSteps()
+ */
+void QwtPlotCurve::drawDots( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     const QColor color = painter->pen().color();
@@ -621,6 +652,6 @@
     }
 
-    const bool doFill = ( d_data->brush.style() != Qt::NoBrush )
-            && ( d_data->brush.color().alpha() > 0 );
+    const bool doFill = ( m_data->brush.style() != Qt::NoBrush )
+        && ( m_data->brush.color().alpha() > 0 );
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
@@ -629,5 +660,5 @@
     mapper.setFlag( QwtPointMapper::RoundPoints, doAlign );
 
-    if ( d_data->paintAttributes & FilterPoints )
+    if ( m_data->paintAttributes & FilterPoints )
     {
         if ( ( color.alpha() == 255 )
@@ -642,5 +673,5 @@
         mapper.setFlag( QwtPointMapper::WeedOutPoints, false );
 
-        QPolygonF points = mapper.toPointsF(
+        QPolygonF points = mapper.toPolygonF(
             xMap, yMap, data(), from, to );
 
@@ -648,8 +679,8 @@
         fillCurve( painter, xMap, yMap, canvasRect, points );
     }
-    else if ( d_data->paintAttributes & ImageBuffer )
+    else if ( m_data->paintAttributes & ImageBuffer )
     {
         const QImage image = mapper.toImage( xMap, yMap,
-            data(), from, to, d_data->pen,
+            data(), from, to, m_data->pen,
             painter->testRenderHint( QPainter::Antialiasing ),
             renderThreadCount() );
@@ -657,7 +688,7 @@
         painter->drawImage( canvasRect.toAlignedRect(), image );
     }
-    else if ( d_data->paintAttributes & MinimizeMemory )
-    {
-        const QwtSeriesData<QPointF> *series = data();
+    else if ( m_data->paintAttributes & MinimizeMemory )
+    {
+        const QwtSeriesData< QPointF >* series = data();
 
         for ( int i = from; i <= to; i++ )
@@ -697,32 +728,32 @@
 
 /*!
-  Draw step function
-
-  The direction of the steps depends on Inverted attribute.
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from index of the first point to be painted
-  \param to index of the last point to be painted
-
-  \sa CurveAttribute, setCurveAttribute(),
+   Draw step function
+
+   The direction of the steps depends on Inverted attribute.
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from index of the first point to be painted
+   \param to index of the last point to be painted
+
+   \sa CurveAttribute, setCurveAttribute(),
       draw(), drawCurve(), drawDots(), drawLines(), drawSticks()
-*/
-void QwtPlotCurve::drawSteps( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+ */
+void QwtPlotCurve::drawSteps( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
     QPolygonF polygon( 2 * ( to - from ) + 1 );
-    QPointF *points = polygon.data();
+    QPointF* points = polygon.data();
 
     bool inverted = orientation() == Qt::Vertical;
-    if ( d_data->attributes & Inverted )
+    if ( m_data->attributes & Inverted )
         inverted = !inverted;
 
-    const QwtSeriesData<QPointF> *series = data();
+    const QwtSeriesData< QPointF >* series = data();
 
     int i, ip;
@@ -740,6 +771,6 @@
         if ( ip > 0 )
         {
-            const QPointF &p0 = points[ip - 2];
-            QPointF &p = points[ip - 1];
+            const QPointF& p0 = points[ip - 2];
+            QPointF& p = points[ip - 1];
 
             if ( inverted )
@@ -759,10 +790,12 @@
     }
 
-    if ( d_data->paintAttributes & ClipPolygons )
-    {
-        qreal pw = qMax( qreal( 1.0 ), painter->pen().widthF());
-        const QRectF clipRect = canvasRect.adjusted(-pw, -pw, pw, pw);
-
-        const QPolygonF clipped = QwtClipper::clipPolygonF(
+    if ( m_data->paintAttributes & ClipPolygons )
+    {
+        QRectF clipRect = qwtIntersectedClipRect( canvasRect, painter );
+
+        const qreal pw = QwtPainter::effectivePenWidth( painter->pen() );
+        clipRect = clipRect.adjusted(-pw, -pw, pw, pw);
+
+        const QPolygonF clipped = QwtClipper::clippedPolygonF(
             clipRect, polygon, false );
 
@@ -774,5 +807,5 @@
     }
 
-    if ( d_data->brush.style() != Qt::NoBrush )
+    if ( m_data->brush.style() != Qt::NoBrush )
         fillCurve( painter, xMap, yMap, canvasRect, polygon );
 }
@@ -780,20 +813,20 @@
 
 /*!
-  Specify an attribute for drawing the curve
-
-  \param attribute Curve attribute
-  \param on On/Off
-
-  /sa testCurveAttribute(), setCurveFitter()
-*/
+   Specify an attribute for drawing the curve
+
+   \param attribute Curve attribute
+   \param on On/Off
+
+   /sa testCurveAttribute(), setCurveFitter()
+ */
 void QwtPlotCurve::setCurveAttribute( CurveAttribute attribute, bool on )
 {
-    if ( bool( d_data->attributes & attribute ) == on )
+    if ( bool( m_data->attributes & attribute ) == on )
         return;
 
     if ( on )
-        d_data->attributes |= attribute;
+        m_data->attributes |= attribute;
     else
-        d_data->attributes &= ~attribute;
+        m_data->attributes &= ~attribute;
 
     itemChanged();
@@ -803,31 +836,31 @@
     \return true, if attribute is enabled
     \sa setCurveAttribute()
-*/
+ */
 bool QwtPlotCurve::testCurveAttribute( CurveAttribute attribute ) const
 {
-    return d_data->attributes & attribute;
-}
-
-/*!
-  Assign a curve fitter
-
-  The curve fitter "smooths" the curve points, when the Fitted
-  CurveAttribute is set. setCurveFitter(NULL) also disables curve fitting.
-
-  The curve fitter operates on the translated points ( = widget coordinates)
-  to be functional for logarithmic scales. Obviously this is less performant
-  for fitting algorithms, that reduce the number of points.
-
-  For situations, where curve fitting is used to improve the performance
-  of painting huge series of points it might be better to execute the fitter
-  on the curve points once and to cache the result in the QwtSeriesData object.
-
-  \param curveFitter() Curve fitter
-  \sa Fitted
-*/
-void QwtPlotCurve::setCurveFitter( QwtCurveFitter *curveFitter )
-{
-    delete d_data->curveFitter;
-    d_data->curveFitter = curveFitter;
+    return m_data->attributes & attribute;
+}
+
+/*!
+   Assign a curve fitter
+
+   The curve fitter "smooths" the curve points, when the Fitted
+   CurveAttribute is set. setCurveFitter(NULL) also disables curve fitting.
+
+   The curve fitter operates on the translated points ( = widget coordinates)
+   to be functional for logarithmic scales. Obviously this is less performant
+   for fitting algorithms, that reduce the number of points.
+
+   For situations, where curve fitting is used to improve the performance
+   of painting huge series of points it might be better to execute the fitter
+   on the curve points once and to cache the result in the QwtSeriesData object.
+
+   \param curveFitter() Curve fitter
+   \sa Fitted
+ */
+void QwtPlotCurve::setCurveFitter( QwtCurveFitter* curveFitter )
+{
+    delete m_data->curveFitter;
+    m_data->curveFitter = curveFitter;
 
     itemChanged();
@@ -835,31 +868,31 @@
 
 /*!
-  Get the curve fitter. If curve fitting is disabled NULL is returned.
-
-  \return Curve fitter
-  \sa setCurveFitter(), Fitted
-*/
-QwtCurveFitter *QwtPlotCurve::curveFitter() const
-{
-    return d_data->curveFitter;
-}
-
-/*!
-  Fill the area between the curve and the baseline with
-  the curve brush
-
-  \param painter Painter
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param polygon Polygon - will be modified !
-
-  \sa setBrush(), setBaseline(), setStyle()
-*/
-void QwtPlotCurve::fillCurve( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, QPolygonF &polygon ) const
-{
-    if ( d_data->brush.style() == Qt::NoBrush )
+   Get the curve fitter. If curve fitting is disabled NULL is returned.
+
+   \return Curve fitter
+   \sa setCurveFitter(), Fitted
+ */
+QwtCurveFitter* QwtPlotCurve::curveFitter() const
+{
+    return m_data->curveFitter;
+}
+
+/*!
+   Fill the area between the curve and the baseline with
+   the curve brush
+
+   \param painter Painter
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param polygon Polygon - will be modified !
+
+   \sa setBrush(), setBaseline(), setStyle()
+ */
+void QwtPlotCurve::fillCurve( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, QPolygonF& polygon ) const
+{
+    if ( m_data->brush.style() == Qt::NoBrush )
         return;
 
@@ -868,10 +901,13 @@
         return;
 
-    QBrush brush = d_data->brush;
+    QBrush brush = m_data->brush;
     if ( !brush.color().isValid() )
-        brush.setColor( d_data->pen.color() );
-
-    if ( d_data->paintAttributes & ClipPolygons )
-        polygon = QwtClipper::clipPolygonF( canvasRect, polygon, true );
+        brush.setColor( m_data->pen.color() );
+
+    if ( m_data->paintAttributes & ClipPolygons )
+    {
+        const QRectF clipRect = qwtIntersectedClipRect( canvasRect, painter );
+        QwtClipper::clipPolygonF( clipRect, polygon, true );
+    }
 
     painter->save();
@@ -886,15 +922,15 @@
 
 /*!
-  \brief Complete a polygon to be a closed polygon including the
+   \brief Complete a polygon to be a closed polygon including the
          area between the original polygon and the baseline.
 
-  \param painter Painter
-  \param xMap X map
-  \param yMap Y map
-  \param polygon Polygon to be completed
-*/
-void QwtPlotCurve::closePolyline( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    QPolygonF &polygon ) const
+   \param painter Painter
+   \param xMap X map
+   \param yMap Y map
+   \param polygon Polygon to be completed
+ */
+void QwtPlotCurve::closePolyline( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    QPolygonF& polygon ) const
 {
     if ( polygon.size() < 2 )
@@ -903,5 +939,5 @@
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
-    double baseline = d_data->baseline;
+    double baseline = m_data->baseline;
 
     if ( orientation() == Qt::Vertical )
@@ -911,5 +947,5 @@
 
         double refY = yMap.transform( baseline );
-        if ( doAlign )
+        if ( doAlign && qAbs( refY ) < std::numeric_limits< int >::max() )
             refY = qRound( refY );
 
@@ -923,5 +959,5 @@
 
         double refX = xMap.transform( baseline );
-        if ( doAlign )
+        if ( doAlign && qAbs( refX ) < std::numeric_limits< int >::max() )
             refX = qRound( refX );
 
@@ -932,19 +968,19 @@
 
 /*!
-  Draw symbols
-
-  \param painter Painter
-  \param symbol Curve symbol
-  \param xMap x map
-  \param yMap y map
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-
-  \sa setSymbol(), drawSeries(), drawCurve()
-*/
-void QwtPlotCurve::drawSymbols( QPainter *painter, const QwtSymbol &symbol,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   Draw symbols
+
+   \param painter Painter
+   \param symbol Curve symbol
+   \param xMap x map
+   \param yMap y map
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+
+   \sa setSymbol(), drawSeries(), drawCurve()
+ */
+void QwtPlotCurve::drawSymbols( QPainter* painter, const QwtSymbol& symbol,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     QwtPointMapper mapper;
@@ -953,5 +989,7 @@
     mapper.setFlag( QwtPointMapper::WeedOutPoints,
         testPaintAttribute( QwtPlotCurve::FilterPoints ) );
-    mapper.setBoundingRect( canvasRect );
+
+    const QRectF clipRect = qwtIntersectedClipRect( canvasRect, painter );
+    mapper.setBoundingRect( clipRect );
 
     const int chunkSize = 500;
@@ -970,24 +1008,24 @@
 
 /*!
-  \brief Set the value of the baseline
-
-  The baseline is needed for filling the curve with a brush or
-  the Sticks drawing style.
-
-  The interpretation of the baseline depends on the orientation().
-  With Qt::Vertical, the baseline is interpreted as a horizontal line
-  at y = baseline(), with Qt::Horizontal, it is interpreted as a vertical
-  line at x = baseline().
-
-  The default value is 0.0.
-
-  \param value Value of the baseline
-  \sa baseline(), setBrush(), setStyle(), QwtPlotAbstractSeriesItem::orientation()
-*/
+   \brief Set the value of the baseline
+
+   The baseline is needed for filling the curve with a brush or
+   the Sticks drawing style.
+
+   The interpretation of the baseline depends on the orientation().
+   With Qt::Vertical, the baseline is interpreted as a horizontal line
+   at y = baseline(), with Qt::Horizontal, it is interpreted as a vertical
+   line at x = baseline().
+
+   The default value is 0.0.
+
+   \param value Value of the baseline
+   \sa baseline(), setBrush(), setStyle(), QwtPlotAbstractSeriesItem::orientation()
+ */
 void QwtPlotCurve::setBaseline( double value )
 {
-    if ( d_data->baseline != value )
-    {
-        d_data->baseline = value;
+    if ( m_data->baseline != value )
+    {
+        m_data->baseline = value;
         itemChanged();
     }
@@ -995,34 +1033,38 @@
 
 /*!
-  \return Value of the baseline
-  \sa setBaseline()
-*/
+   \return Value of the baseline
+   \sa setBaseline()
+ */
 double QwtPlotCurve::baseline() const
 {
-    return d_data->baseline;
-}
-
-/*!
-  Find the closest curve point for a specific position
-
-  \param pos Position, where to look for the closest curve point
-  \param dist If dist != NULL, closestPoint() returns the distance between
-              the position and the closest curve point
-  \return Index of the closest curve point, or -1 if none can be found
+    return m_data->baseline;
+}
+
+/*!
+   Find the closest curve point for a specific position
+
+   \param pos Position, where to look for the closest curve point
+   \param dist If dist != NULL, closestPoint() returns the distance between
+              the position and the closest curve point in paint device coordinates
+   \return Index of the closest curve point, or -1 if none can be found
           ( f.e when the curve has no points )
-  \note closestPoint() implements a dumb algorithm, that iterates
+   \note closestPoint() implements a dumb algorithm, that iterates
         over all points
-*/
-int QwtPlotCurve::closestPoint( const QPoint &pos, double *dist ) const
-{
+ */
+int QwtPlotCurve::closestPoint( const QPointF& pos, double* dist ) const
+{
+    const QwtPlot* plot = this->plot();
+
+    if ( ( plot == NULL ) || !plot->isAxisValid( xAxis() ) || !plot->isAxisValid( yAxis() ) )
+        return -1;
+
     const size_t numSamples = dataSize();
-
-    if ( plot() == NULL || numSamples <= 0 )
+    if ( numSamples <= 0 )
         return -1;
 
-    const QwtSeriesData<QPointF> *series = data();
-
-    const QwtScaleMap xMap = plot()->canvasMap( xAxis() );
-    const QwtScaleMap yMap = plot()->canvasMap( yAxis() );
+    const QwtSeriesData< QPointF >* series = data();
+
+    const QwtScaleMap xMap = plot->canvasMap( xAxis() );
+    const QwtScaleMap yMap = plot->canvasMap( yAxis() );
 
     int index = -1;
@@ -1044,7 +1086,128 @@
     }
     if ( dist )
-        *dist = qSqrt( dmin );
+        *dist = std::sqrt( dmin );
 
     return index;
+}
+
+/*!
+   Find the curve point with the smallest coordinate larger than a specific value
+   The coordinates have to be monotonic in direction of the orientation.
+    
+   \param orientation Qt::Horizontal corresponds to x, Qt::Vertical to y coordinates
+   \param value x or y coordinate, depending on the orientation
+
+   \return Index of the curve point with the smalles coordinate above value
+           or -1 if there is none.
+
+   \note The implementation uses a binary search algorithm and requires the
+         points being ordered in direction of the orientation.
+
+   \sa qwtUpperSampleIndex()
+ */
+int QwtPlotCurve::adjacentPoint( Qt::Orientation orientation, qreal value ) const
+{
+    const QwtSeriesData< QPointF >* data = this->data();
+    if ( data == NULL )
+        return -1;
+
+    if ( orientation == Qt::Horizontal )
+    {
+        struct compareX
+        {
+            inline bool operator()( const double x, const QPointF& pos ) const
+            {
+                return ( x < pos.x() );
+            }
+        };
+
+        return qwtUpperSampleIndex< QPointF >( *data, value, compareX() );
+    }
+    else
+    {
+        struct compareY
+        {
+            inline bool operator()( const double y, const QPointF& pos ) const
+            {
+                return ( y < pos.y() );
+            }
+        };
+
+        return qwtUpperSampleIndex< QPointF >( *data, value, compareY() );
+    }
+
+    return -1;
+}
+
+/*!
+   Calculate a fictive curve point by interpolating between the adjacent
+   points. The curve points have to be monotonic in direction of the orientation.
+    
+   \param orientation For Qt::Horizontal value is a x coordinate and a y coordinate
+                      is returned. For Qt::Vertical value is a x coordinate
+   \param value x or y coordinate, depending on the orientation
+
+   \return Interpolated coordinate or qQNaN() if value is outside the bounding
+           rectangle of the curve
+
+   \note The implementation uses a binary search algorithm and requires the
+         points being ordered in direction of the orientation.
+
+   \sa adjacentPoint()
+ */
+qreal QwtPlotCurve::interpolatedValueAt( Qt::Orientation orientation, double value ) const
+{
+    const QRectF br = boundingRect();
+    if ( br.width() <= 0.0 )
+        return qQNaN();
+
+    double v;
+
+    if ( orientation == Qt::Horizontal )
+    {
+        if ( value < br.left() || value > br.right() )
+            return qQNaN();
+
+        const int index = adjacentPoint( orientation, value );
+
+        if ( index == -1 )
+        {
+            const QPointF last = sample( dataSize() - 1 );
+
+            if ( value != last.x() )
+                return qQNaN();
+
+            v = last.y();
+        }
+        else
+        {
+            const QLineF line( sample( index - 1 ), sample( index ) );
+            v = line.pointAt( ( value - line.p1().x() ) / line.dx() ).y();
+        }
+    }
+    else
+    {
+        if ( value < br.top() || value > br.bottom() )
+            return qQNaN();
+
+        const int index = adjacentPoint( orientation, value );
+
+        if ( index == -1 )
+        {
+            const QPointF last = sample( dataSize() - 1 );
+
+            if ( value != last.y() )
+                return qQNaN();
+
+            v = last.x();
+        }
+        else
+        {
+            const QLineF line( sample( index - 1 ), sample( index ) );
+            v = line.pointAt( ( value - line.p1().y() ) / line.dy() ).x();
+        }
+    }
+
+    return v;
 }
 
@@ -1058,6 +1221,5 @@
    \sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()
  */
-QwtGraphic QwtPlotCurve::legendIcon( int index,
-    const QSizeF &size ) const
+QwtGraphic QwtPlotCurve::legendIcon( int index, const QSizeF& size ) const
 {
     Q_UNUSED( index );
@@ -1074,11 +1236,11 @@
         testRenderHint( QwtPlotItem::RenderAntialiased ) );
 
-    if ( d_data->legendAttributes == 0 ||
-        d_data->legendAttributes & QwtPlotCurve::LegendShowBrush )
-    {
-        QBrush brush = d_data->brush;
+    if ( m_data->legendAttributes == 0 ||
+        m_data->legendAttributes & QwtPlotCurve::LegendShowBrush )
+    {
+        QBrush brush = m_data->brush;
 
         if ( brush.style() == Qt::NoBrush &&
-            d_data->legendAttributes == 0 )
+            m_data->legendAttributes == 0 )
         {
             if ( style() != QwtPlotCurve::NoCurve )
@@ -1086,8 +1248,8 @@
                 brush = QBrush( pen().color() );
             }
-            else if ( d_data->symbol &&
-                ( d_data->symbol->style() != QwtSymbol::NoSymbol ) )
+            else if ( m_data->symbol &&
+                ( m_data->symbol->style() != QwtSymbol::NoSymbol ) )
             {
-                brush = QBrush( d_data->symbol->pen().color() );
+                brush = QBrush( m_data->symbol->pen().color() );
             }
         }
@@ -1100,5 +1262,5 @@
     }
 
-    if ( d_data->legendAttributes & QwtPlotCurve::LegendShowLine )
+    if ( m_data->legendAttributes & QwtPlotCurve::LegendShowLine )
     {
         if ( pen() != Qt::NoPen )
@@ -1114,10 +1276,10 @@
     }
 
-    if ( d_data->legendAttributes & QwtPlotCurve::LegendShowSymbol )
-    {
-        if ( d_data->symbol )
+    if ( m_data->legendAttributes & QwtPlotCurve::LegendShowSymbol )
+    {
+        if ( m_data->symbol )
         {
             QRectF r( 0, 0, size.width(), size.height() );
-            d_data->symbol->drawSymbol( &painter, r );
+            m_data->symbol->drawSymbol( &painter, r );
         }
     }
@@ -1127,11 +1289,26 @@
 
 /*!
-  Initialize data with an array of points.
-
-  \param samples Vector of points
-  \note QVector is implicitly shared
-  \note QPolygonF is derived from QVector<QPointF>
-*/
-void QwtPlotCurve::setSamples( const QVector<QPointF> &samples )
+   Assign a series of points
+
+   setSamples() is just a wrapper for setData() without any additional
+   value - beside that it is easier to find for the developer.
+
+   \param data Data
+   \warning The item takes ownership of the data object, deleting
+           it when its not used anymore.
+ */
+void QwtPlotCurve::setSamples( QwtSeriesData< QPointF >* data )
+{
+    setData( data );
+}
+
+/*!
+   Initialize data with an array of points.
+
+   \param samples Vector of points
+   \note QVector is implicitly shared
+   \note QPolygonF is derived from QVector<QPointF>
+ */
+void QwtPlotCurve::setSamples( const QVector< QPointF >& samples )
 {
     setData( new QwtPointSeriesData( samples ) );
@@ -1139,71 +1316,206 @@
 
 /*!
-  Assign a series of points
-
-  setSamples() is just a wrapper for setData() without any additional
-  value - beside that it is easier to find for the developer.
-
-  \param data Data
-  \warning The item takes ownership of the data object, deleting
-           it when its not used anymore.
-*/
-void QwtPlotCurve::setSamples( QwtSeriesData<QPointF> *data )
-{
-    setData( data );
-}
-
-#ifndef QWT_NO_COMPAT
-
-/*!
-  \brief Initialize the data by pointing to memory blocks which
+   \brief Initialize the data by pointing to memory blocks which
          are not managed by QwtPlotCurve.
 
-  setRawSamples is provided for efficiency.
-  It is important to keep the pointers
-  during the lifetime of the underlying QwtCPointerData class.
-
-  \param xData pointer to x data
-  \param yData pointer to y data
-  \param size size of x and y
-
-  \sa QwtCPointerData
-*/
+   setRawSamples is provided for efficiency.
+   It is important to keep the pointers
+   during the lifetime of the underlying QwtCPointerData class.
+
+   \param xData pointer to x data
+   \param yData pointer to y data
+   \param size size of x and y
+
+   \sa QwtCPointerData
+ */
 void QwtPlotCurve::setRawSamples(
-    const double *xData, const double *yData, int size )
-{
-    setData( new QwtCPointerData( xData, yData, size ) );
-}
-
-/*!
-  Set data by copying x- and y-values from specified memory blocks.
-  Contrary to setRawSamples(), this function makes a 'deep copy' of
-  the data.
-
-  \param xData pointer to x values
-  \param yData pointer to y values
-  \param size size of xData and yData
-
-  \sa QwtPointArrayData
-*/
+    const double* xData, const double* yData, int size )
+{
+    setData( new QwtCPointerData< double >( xData, yData, size ) );
+}
+
+/*!
+   \brief Initialize the data by pointing to memory blocks which
+         are not managed by QwtPlotCurve.
+
+   setRawSamples is provided for efficiency.
+   It is important to keep the pointers
+   during the lifetime of the underlying QwtCPointerData class.
+
+   \param xData pointer to x data
+   \param yData pointer to y data
+   \param size size of x and y
+
+   \sa QwtCPointerData
+ */
+void QwtPlotCurve::setRawSamples(
+    const float* xData, const float* yData, int size )
+{
+    setData( new QwtCPointerData< float >( xData, yData, size ) );
+}
+
+/*!
+   \brief Initialize the data by pointing to a memory block which
+         is not managed by QwtPlotCurve.
+
+   The memory contains the y coordinates, while the index is
+   interpreted as x coordinate.
+
+   setRawSamples() is provided for efficiency. It is important to
+   keep the pointers during the lifetime of the underlying
+   QwtCPointerValueData class.
+
+   \param yData pointer to y data
+   \param size size of x and y
+
+   \sa QwtCPointerData
+ */
+void QwtPlotCurve::setRawSamples( const double* yData, int size )
+{
+    setData( new QwtCPointerValueData< double >( yData, size ) );
+}
+
+/*!
+   \brief Initialize the data by pointing to memory blocks which
+         are not managed by QwtPlotCurve.
+
+   The memory contains the y coordinates, while the index is
+   interpreted as x coordinate.
+
+   setRawSamples() is provided for efficiency. It is important to
+   keep the pointers during the lifetime of the underlying
+   QwtCPointerValueData class.
+
+   \param yData pointer to y data
+   \param size size of x and y
+
+   \sa QwtCPointerData
+ */
+void QwtPlotCurve::setRawSamples( const float* yData, int size )
+{
+    setData( new QwtCPointerValueData< float >( yData, size ) );
+}
+
+/*!
+   Set data by copying x- and y-values from specified memory blocks.
+   Contrary to setRawSamples(), this function makes a 'deep copy' of
+   the data.
+
+   \param xData pointer to x values
+   \param yData pointer to y values
+   \param size size of xData and yData
+
+   \sa QwtPointArrayData
+ */
 void QwtPlotCurve::setSamples(
-    const double *xData, const double *yData, int size )
-{
-    setData( new QwtPointArrayData( xData, yData, size ) );
-}
-
-/*!
-  \brief Initialize data with x- and y-arrays (explicitly shared)
-
-  \param xData x data
-  \param yData y data
-
-  \sa QwtPointArrayData
-*/
-void QwtPlotCurve::setSamples( const QVector<double> &xData,
-    const QVector<double> &yData )
-{
-    setData( new QwtPointArrayData( xData, yData ) );
-}
-
-#endif // !QWT_NO_COMPAT
-
+    const double* xData, const double* yData, int size )
+{
+    setData( new QwtPointArrayData< double >( xData, yData, size ) );
+}
+
+/*!
+   Set data by copying x- and y-values from specified memory blocks.
+   Contrary to setRawSamples(), this function makes a 'deep copy' of
+   the data.
+
+   \param xData pointer to x values
+   \param yData pointer to y values
+   \param size size of xData and yData
+
+   \sa QwtPointArrayData
+ */
+void QwtPlotCurve::setSamples(
+    const float* xData, const float* yData, int size )
+{
+    setData( new QwtPointArrayData< float >( xData, yData, size ) );
+}
+
+/*!
+   \brief Initialize data with x- and y-arrays (explicitly shared)
+
+   \param xData x data
+   \param yData y data
+
+   \sa QwtPointArrayData
+ */
+void QwtPlotCurve::setSamples( const QVector< double >& xData,
+    const QVector< double >& yData )
+{
+    setData( new QwtPointArrayData< double >( xData, yData ) );
+}
+
+/*!
+   \brief Initialize data with x- and y-arrays (explicitly shared)
+
+   \param xData x data
+   \param yData y data
+
+   \sa QwtPointArrayData
+ */
+void QwtPlotCurve::setSamples( const QVector< float >& xData,
+    const QVector< float >& yData )
+{
+    setData( new QwtPointArrayData< float >( xData, yData ) );
+}
+
+/*!
+   Set data by copying y-values from a specified memory block.
+
+   The memory contains the y coordinates, while the index is
+   interpreted as x coordinate.
+
+   \param yData y data
+   \param size size of yData
+
+   \sa QwtValuePointData
+ */
+void QwtPlotCurve::setSamples( const double* yData, int size )
+{
+    setData( new QwtValuePointData< double >( yData, size ) );
+}
+
+/*!
+   Set data by copying y-values from a specified memory block.
+
+   The vector contains the y coordinates, while the index is
+   interpreted as x coordinate.
+
+   \param yData y data
+   \param size size of yData
+
+   \sa QwtValuePointData
+ */
+void QwtPlotCurve::setSamples( const float* yData, int size )
+{
+    setData( new QwtValuePointData< float >( yData, size ) );
+}
+
+/*!
+   Initialize data with an array of y values (explicitly shared)
+
+   The vector contains the y coordinates, while the index is
+   the x coordinate.
+
+   \param yData y data
+
+   \sa QwtValuePointData
+ */
+void QwtPlotCurve::setSamples( const QVector< double >& yData )
+{
+    setData( new QwtValuePointData< double >( yData ) );
+}
+
+/*!
+   Initialize data with an array of y values (explicitly shared)
+
+   The vector contains the y coordinates, while the index is
+   the x coordinate.
+
+   \param yData y data
+
+   \sa QwtValuePointData
+ */
+void QwtPlotCurve::setSamples( const QVector< float >& yData )
+{
+    setData( new QwtValuePointData< float >( yData ) );
+}
