Index: trunk/BNC/qwt/qwt_point_mapper.cpp
===================================================================
--- trunk/BNC/qwt/qwt_point_mapper.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_point_mapper.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,4 +11,7 @@
 #include "qwt_scale_map.h"
 #include "qwt_pixel_matrix.h"
+#include "qwt_series_data.h"
+#include "qwt_math.h"
+
 #include <qpolygon.h>
 #include <qimage.h>
@@ -16,17 +19,263 @@
 #include <qpainter.h>
 
-#if QT_VERSION >= 0x040400
-
 #include <qthread.h>
 #include <qfuture.h>
 #include <qtconcurrentrun.h>
 
-#if !defined(QT_NO_QFUTURE)
+#if !defined( QT_NO_QFUTURE )
 #define QWT_USE_THREADS 1
 #endif
 
+static QRectF qwtInvalidRect( 0.0, 0.0, -1.0, -1.0 );
+
+static inline int qwtRoundValue( double value )
+{
+    return qRound( value );
+}
+
+static inline double qwtRoundValueF( double value )
+{
+#if 1
+    // MS Windows and at least IRIX does not have C99's nearbyint() function
+    return ( value >= 0.0 ) ? std::floor( value + 0.5 ) : std::ceil( value - 0.5 );
+#else
+    return nearbyint( value );
 #endif
-
-static QRectF qwtInvalidRect( 0.0, 0.0, -1.0, -1.0 );
+}
+
+static Qt::Orientation qwtProbeOrientation(
+    const QwtSeriesData< QPointF >* series, int from, int to )
+{
+    if ( to - from < 20 )
+    {
+        // not enough points to "have an orientation"
+        return Qt::Horizontal;
+    }
+
+    const double x0 = series->sample( from ).x();
+    const double xn = series->sample( to ).x();
+
+    if ( x0 == xn )
+        return Qt::Vertical;
+
+    const int step = ( to - from ) / 10;
+    const bool isIncreasing = xn > x0;
+
+    double x1 = x0;
+    for ( int i = from + step; i < to; i += step )
+    {
+        const double x2 = series->sample( i ).x();
+        if ( x2 != x1 )
+        {
+            if ( ( x2 > x1 ) != isIncreasing )
+                return Qt::Vertical;
+        }
+
+        x1 = x2;
+    }
+
+    return Qt::Horizontal;
+}
+
+namespace
+{
+    template< class Polygon, class Point >
+    class QwtPolygonQuadrupelX
+    {
+      public:
+        inline void start( int x, int y )
+        {
+            m_x0 = x;
+            m_y1 = m_yMin = m_yMax = m_y2 = y;
+        }
+
+        inline bool append( int x, int y )
+        {
+            if ( m_x0 != x )
+                return false;
+
+            if ( y < m_yMin )
+                m_yMin = y;
+            else if ( y > m_yMax )
+                m_yMax = y;
+
+            m_y2 = y;
+
+            return true;
+        }
+
+        inline void flush( Polygon& polyline )
+        {
+            appendTo( m_y1, polyline );
+
+            if ( m_y2 > m_y1 )
+                qSwap( m_yMin, m_yMax );
+
+            if ( m_yMax != m_y1 )
+                appendTo( m_yMax, polyline );
+
+            if ( m_yMin != m_yMax )
+                appendTo( m_yMin, polyline );
+
+            if ( m_y2 != m_yMin )
+                appendTo( m_y2, polyline );
+        }
+
+      private:
+        inline void appendTo( int y, Polygon& polyline )
+        {
+            polyline += Point( m_x0, y );
+        }
+
+      private:
+        int m_x0, m_y1, m_yMin, m_yMax, m_y2;
+    };
+
+    template< class Polygon, class Point >
+    class QwtPolygonQuadrupelY
+    {
+      public:
+        inline void start( int x, int y )
+        {
+            m_y0 = y;
+            m_x1 = m_xMin = m_xMax = m_x2 = x;
+        }
+
+        inline bool append( int x, int y )
+        {
+            if ( m_y0 != y )
+                return false;
+
+            if ( x < m_xMin )
+                m_xMin = x;
+            else if ( x > m_xMax )
+                m_xMax = x;
+
+            m_x2 = x;
+
+            return true;
+        }
+
+        inline void flush( Polygon& polyline )
+        {
+            appendTo( m_x1, polyline );
+
+            if ( m_x2 > m_x1 )
+                qSwap( m_xMin, m_xMax );
+
+            if ( m_xMax != m_x1 )
+                appendTo( m_xMax, polyline );
+
+            if ( m_xMin != m_xMax )
+                appendTo( m_xMin, polyline );
+
+            if ( m_x2 != m_xMin )
+                appendTo( m_x2, polyline );
+        }
+
+      private:
+        inline void appendTo( int x, Polygon& polyline )
+        {
+            polyline += Point( x, m_y0 );
+        }
+
+        int m_y0, m_x1, m_xMin, m_xMax, m_x2;
+    };
+}
+
+template< class Polygon, class Point, class PolygonQuadrupel >
+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;
+}
+
+template< class Polygon, class Point, class PolygonQuadrupel >
+static Polygon qwtMapPointsQuad( const Polygon& polyline )
+{
+    const int numPoints = polyline.size();
+
+    if ( numPoints < 3 )
+        return polyline;
+
+    const Point* points = polyline.constData();
+
+    Polygon polylineXY;
+
+    PolygonQuadrupel q;
+    q.start( points[0].x(), points[0].y() );
+
+    for ( int i = 0; i < numPoints; i++ )
+    {
+        const int x = points[i].x();
+        const int y = points[i].y();
+
+        if ( !q.append( x, y ) )
+        {
+            q.flush( polylineXY );
+            q.start( x, y );
+        }
+    }
+    q.flush( polylineXY );
+
+    return polylineXY;
+}
+
+
+template< class Polygon, class Point >
+static Polygon qwtMapPointsQuad( const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to )
+{
+    Polygon polyline;
+    if ( from > to )
+        return polyline;
+
+    /*
+        probing some values, to decide if it is better
+        to start with x or y coordinates
+     */
+    const Qt::Orientation orientation = qwtProbeOrientation( series, from, to );
+
+    if ( orientation == Qt::Horizontal )
+    {
+        polyline = qwtMapPointsQuad< Polygon, Point,
+            QwtPolygonQuadrupelY< Polygon, Point > >( xMap, yMap, series, from, to );
+
+        polyline = qwtMapPointsQuad< Polygon, Point,
+            QwtPolygonQuadrupelX< Polygon, Point > >( polyline );
+    }
+    else
+    {
+        polyline = qwtMapPointsQuad< Polygon, Point,
+            QwtPolygonQuadrupelX< Polygon, Point > >( xMap, yMap, series, from, to );
+
+        polyline = qwtMapPointsQuad< Polygon, Point,
+            QwtPolygonQuadrupelY< Polygon, Point > >( polyline );
+    }
+
+    return polyline;
+}
 
 // Helper class to work around the 5 parameters
@@ -34,6 +283,6 @@
 class QwtDotsCommand
 {
-public:
-    const QwtSeriesData<QPointF> *series;
+  public:
+    const QwtSeriesData< QPointF >* series;
     int from;
     int to;
@@ -42,9 +291,9 @@
 
 static void qwtRenderDots(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtDotsCommand command, const QPoint &pos, QImage *image )
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtDotsCommand& command, const QPoint& pos, QImage* image )
 {
     const QRgb rgb = command.rgb;
-    QRgb *bits = reinterpret_cast<QRgb *>( image->bits() );
+    QRgb* bits = reinterpret_cast< QRgb* >( image->bits() );
 
     const int w = image->width();
@@ -58,6 +307,6 @@
         const QPointF sample = command.series->sample( i );
 
-        const int x = static_cast<int>( xMap.transform( sample.x() ) + 0.5 ) - x0;
-        const int y = static_cast<int>( yMap.transform( sample.y() ) + 0.5 ) - y0;
+        const int x = static_cast< int >( xMap.transform( sample.x() ) + 0.5 ) - x0;
+        const int y = static_cast< int >( yMap.transform( sample.y() ) + 0.5 ) - y0;
 
         if ( x >= 0 && x < w && y >= 0 && y < h )
@@ -66,13 +315,8 @@
 }
 
-static inline int qwtRoundValue( double value )
-{
-    return qRound( value );
-}
-
 // some functors, so that the compile can inline
 struct QwtRoundI
 {
-    inline int operator()( double value )
+    inline int operator()( double value ) const
     {
         return qwtRoundValue( value );
@@ -82,13 +326,7 @@
 struct QwtRoundF
 {
-    inline double operator()( double value )
-    {
-#if 1
-        // MS Windows and at least IRIX does not have C99's nearbyint() function
-        return ( value >= 0.0 ) ? ::floor( value + 0.5 ) : ::ceil( value - 0.5 );
-#else
-        // slightly faster than the code above
-        return nearbyint( value );
-#endif
+    inline double operator()( double value ) const
+    {
+        return qwtRoundValueF( value );
     }
 };
@@ -96,5 +334,5 @@
 struct QwtNoRoundF
 {
-    inline double operator()( double value )
+    inline double operator()( double value ) const
     {
         return value;
@@ -105,13 +343,13 @@
 // the bounding rectangle
 
-template<class Polygon, class Point, class Round>
+template< class Polygon, class Point, class Round >
 static inline Polygon qwtToPoints(
-    const QRectF &boundingRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series,
+    const QRectF& boundingRect,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series,
     int from, int to, Round round )
 {
     Polygon polyline( to - from + 1 );
-    Point *points = polyline.data();
+    Point* points = polyline.data();
 
     int numPoints = 0;
@@ -164,21 +402,21 @@
 
 static inline QPolygon qwtToPointsI(
-    const QRectF &boundingRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series,
+    const QRectF& boundingRect,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series,
     int from, int to )
 {
-    return qwtToPoints<QPolygon, QPoint>(
+    return qwtToPoints< QPolygon, QPoint >(
         boundingRect, xMap, yMap, series, from, to, QwtRoundI() );
 }
 
-template<class Round>
+template< class Round >
 static inline QPolygonF qwtToPointsF(
-    const QRectF &boundingRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series,
+    const QRectF& boundingRect,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series,
     int from, int to, Round round )
 {
-    return qwtToPoints<QPolygonF, QPointF>(
+    return qwtToPoints< QPolygonF, QPointF >(
         boundingRect, xMap, yMap, series, from, to, round );
 }
@@ -187,8 +425,8 @@
 // points mapped to the same position
 
-template<class Polygon, class Point, class Round>
+template< class Polygon, class Point, class Round >
 static inline Polygon qwtToPolylineFiltered(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series,
     int from, int to, Round round )
 {
@@ -199,5 +437,5 @@
 
     Polygon polyline( to - from + 1 );
-    Point *points = polyline.data();
+    Point* points = polyline.data();
 
     const QPointF sample0 = series->sample( from );
@@ -223,27 +461,27 @@
 
 static inline QPolygon qwtToPolylineFilteredI(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series,
     int from, int to )
 {
-    return qwtToPolylineFiltered<QPolygon, QPoint>(
+    return qwtToPolylineFiltered< QPolygon, QPoint >(
         xMap, yMap, series, from, to, QwtRoundI() );
 }
 
-template<class Round>
+template< class Round >
 static inline QPolygonF qwtToPolylineFilteredF(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series,
     int from, int to, Round round )
 {
-    return qwtToPolylineFiltered<QPolygonF, QPointF>(
+    return qwtToPolylineFiltered< QPolygonF, QPointF >(
         xMap, yMap, series, from, to, round );
 }
 
-template<class Polygon, class Point>
+template< class Polygon, class Point >
 static inline Polygon qwtToPointsFiltered(
-    const QRectF &boundingRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to )
+    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
@@ -251,5 +489,5 @@
 
     Polygon polygon( to - from + 1 );
-    Point *points = polygon.data();
+    Point* points = polygon.data();
 
     QwtPixelMatrix pixelMatrix( boundingRect.toAlignedRect() );
@@ -277,18 +515,18 @@
 
 static inline QPolygon qwtToPointsFilteredI(
-    const QRectF &boundingRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to )
-{
-    return qwtToPointsFiltered<QPolygon, QPoint>(
+    const QRectF& boundingRect,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to )
+{
+    return qwtToPointsFiltered< QPolygon, QPoint >(
         boundingRect, xMap, yMap, series, from, to );
 }
 
 static inline QPolygonF qwtToPointsFilteredF(
-    const QRectF &boundingRect,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to )
-{
-    return qwtToPointsFiltered<QPolygonF, QPointF>(
+    const QRectF& boundingRect,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to )
+{
+    return qwtToPointsFiltered< QPolygonF, QPointF >(
         boundingRect, xMap, yMap, series, from, to );
 }
@@ -296,7 +534,7 @@
 class QwtPointMapper::PrivateData
 {
-public:
-    PrivateData():
-        boundingRect( qwtInvalidRect )
+  public:
+    PrivateData()
+        : boundingRect( qwtInvalidRect )
     {
     }
@@ -309,5 +547,5 @@
 QwtPointMapper::QwtPointMapper()
 {
-    d_data = new PrivateData();
+    m_data = new PrivateData();
 }
 
@@ -315,102 +553,110 @@
 QwtPointMapper::~QwtPointMapper()
 {
-    delete d_data;
-}
-
-/*!
-  Set the flags affecting the transformation process
-
-  \param flags Flags
-  \sa flags(), setFlag()
+    delete m_data;
+}
+
+/*!
+   Set the flags affecting the transformation process
+
+   \param flags Flags
+   \sa flags(), setFlag()
  */
 void QwtPointMapper::setFlags( TransformationFlags flags )
 {
-    d_data->flags = flags;
-}
-
-/*!
-  \return Flags affecting the transformation process
-  \sa setFlags(), setFlag()
+    m_data->flags = flags;
+}
+
+/*!
+   \return Flags affecting the transformation process
+   \sa setFlags(), setFlag()
  */
 QwtPointMapper::TransformationFlags QwtPointMapper::flags() const
 {
-    return d_data->flags;
-}
-
-/*!
-  Modify a flag affecting the transformation process
-
-  \param flag Flag type
-  \param on Value
-
-  \sa flag(), setFlags()
+    return m_data->flags;
+}
+
+/*!
+   Modify a flag affecting the transformation process
+
+   \param flag Flag type
+   \param on Value
+
+   \sa flag(), setFlags()
  */
 void QwtPointMapper::setFlag( TransformationFlag flag, bool on )
 {
     if ( on )
-        d_data->flags |= flag;
+        m_data->flags |= flag;
     else
-        d_data->flags &= ~flag;
-}
-
-/*!
-  \return True, when the flag is set
-  \param flag Flag type
-  \sa setFlag(), setFlags()
+        m_data->flags &= ~flag;
+}
+
+/*!
+   \return True, when the flag is set
+   \param flag Flag type
+   \sa setFlag(), setFlags()
  */
 bool QwtPointMapper::testFlag( TransformationFlag flag ) const
 {
-    return d_data->flags & flag;
-}
-
-/*!
-  Set a bounding rectangle for the point mapping algorithm
-
-  A valid bounding rectangle can be used for optimizations
-
-  \param rect Bounding rectangle
-  \sa boundingRect()
- */
-void QwtPointMapper::setBoundingRect( const QRectF &rect )
-{
-    d_data->boundingRect = rect;
-}
-
-/*!
-  \return Bounding rectangle
-  \sa setBoundingRect()
+    return m_data->flags & flag;
+}
+
+/*!
+   Set a bounding rectangle for the point mapping algorithm
+
+   A valid bounding rectangle can be used for optimizations
+
+   \param rect Bounding rectangle
+   \sa boundingRect()
+ */
+void QwtPointMapper::setBoundingRect( const QRectF& rect )
+{
+    m_data->boundingRect = rect;
+}
+
+/*!
+   \return Bounding rectangle
+   \sa setBoundingRect()
  */
 QRectF QwtPointMapper::boundingRect() const
 {
-    return d_data->boundingRect;
-}
-
-/*!
-  \brief Translate a series of points into a QPolygonF
-
-  When the WeedOutPoints flag is enabled consecutive points,
-  that are mapped to the same position will be one point.
-
-  When RoundPoints is set all points are rounded to integers
-  but returned as PolygonF - what only makes sense
-  when the further processing of the values need a QPolygonF.
-
-  \param xMap x map
-  \param yMap y map
-  \param series Series of points to be mapped
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-
-  \return Translated polygon
-*/
+    return m_data->boundingRect;
+}
+
+/*!
+   \brief Translate a series of points into a QPolygonF
+
+   When the WeedOutPoints flag is enabled consecutive points,
+   that are mapped to the same position will be one point.
+
+   When RoundPoints is set all points are rounded to integers
+   but returned as PolygonF - what only makes sense
+   when the further processing of the values need a QPolygonF.
+
+   When RoundPoints & WeedOutIntermediatePoints is enabled an even more
+   aggressive weeding algorithm is enabled.
+
+   \param xMap x map
+   \param yMap y map
+   \param series Series of points to be mapped
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+
+   \return Translated polygon
+ */
 QPolygonF QwtPointMapper::toPolygonF(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to ) const
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to ) const
 {
     QPolygonF polyline;
 
-    if ( d_data->flags & WeedOutPoints )
-    {
-        if ( d_data->flags & RoundPoints )
+    if ( m_data->flags & RoundPoints )
+    {
+        if ( m_data->flags & WeedOutIntermediatePoints )
+        {
+            polyline = qwtMapPointsQuad< QPolygonF, QPointF >(
+                xMap, yMap, series, from, to );
+        }
+        else if ( m_data->flags & WeedOutPoints )
         {
             polyline = qwtToPolylineFilteredF(
@@ -419,15 +665,15 @@
         else
         {
+            polyline = qwtToPointsF( qwtInvalidRect,
+                xMap, yMap, series, from, to, QwtRoundF() );
+        }
+    }
+    else
+    {
+        if ( m_data->flags & WeedOutPoints )
+        {
             polyline = qwtToPolylineFilteredF(
                 xMap, yMap, series, from, to, QwtNoRoundF() );
         }
-    }
-    else
-    {
-        if ( d_data->flags & RoundPoints )
-        {
-            polyline = qwtToPointsF( qwtInvalidRect,
-                xMap, yMap, series, from, to, QwtRoundF() );
-        }
         else
         {
@@ -441,24 +687,30 @@
 
 /*!
-  \brief Translate a series of points into a QPolygon
-
-  When the WeedOutPoints flag is enabled consecutive points,
-  that are mapped to the same position will be one point.
-
-  \param xMap x map
-  \param yMap y map
-  \param series Series of points to be mapped
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-
-  \return Translated polygon
-*/
+   \brief Translate a series of points into a QPolygon
+
+   When the WeedOutPoints flag is enabled consecutive points,
+   that are mapped to the same position will be one point.
+
+   \param xMap x map
+   \param yMap y map
+   \param series Series of points to be mapped
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+
+   \return Translated polygon
+ */
 QPolygon QwtPointMapper::toPolygon(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to ) const
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to ) const
 {
     QPolygon polyline;
 
-    if ( d_data->flags & WeedOutPoints )
+    if ( m_data->flags & WeedOutIntermediatePoints )
+    {
+        // TODO WeedOutIntermediatePointsY ...
+        polyline = qwtMapPointsQuad< QPolygon, QPoint >(
+            xMap, yMap, series, from, to );
+    }
+    else if ( m_data->flags & WeedOutPoints )
     {
         polyline = qwtToPolylineFilteredI(
@@ -475,47 +727,47 @@
 
 /*!
-  \brief Translate a series into a QPolygonF
-
-  - WeedOutPoints & RoundPoints & boundingRect().isValid()
+   \brief Translate a series into a QPolygonF
+
+   - WeedOutPoints & RoundPoints & boundingRect().isValid()
     All points that are mapped to the same position
     will be one point. Points outside of the bounding
     rectangle are ignored.
 
-  - WeedOutPoints & RoundPoints & !boundingRect().isValid()
+   - WeedOutPoints & RoundPoints & !boundingRect().isValid()
     All consecutive points that are mapped to the same position
     will one point
 
-  - WeedOutPoints & !RoundPoints
+   - WeedOutPoints & !RoundPoints
     All consecutive points that are mapped to the same position
     will one point
 
-  - !WeedOutPoints & boundingRect().isValid()
+   - !WeedOutPoints & boundingRect().isValid()
     Points outside of the bounding rectangle are ignored.
 
-  When RoundPoints is set all points are rounded to integers
-  but returned as PolygonF - what only makes sense
-  when the further processing of the values need a QPolygonF.
-
-  \param xMap x map
-  \param yMap y map
-  \param series Series of points to be mapped
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-
-  \return Translated polygon
-*/
+   When RoundPoints is set all points are rounded to integers
+   but returned as PolygonF - what only makes sense
+   when the further processing of the values need a QPolygonF.
+
+   \param xMap x map
+   \param yMap y map
+   \param series Series of points to be mapped
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+
+   \return Translated polygon
+ */
 QPolygonF QwtPointMapper::toPointsF(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to ) const
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to ) const
 {
     QPolygonF points;
 
-    if ( d_data->flags & WeedOutPoints )
-    {
-        if ( d_data->flags & RoundPoints )
-        {
-            if ( d_data->boundingRect.isValid() )
+    if ( m_data->flags & WeedOutPoints )
+    {
+        if ( m_data->flags & RoundPoints )
+        {
+            if ( m_data->boundingRect.isValid() )
             {
-                points = qwtToPointsFilteredF( d_data->boundingRect,
+                points = qwtToPointsFilteredF( m_data->boundingRect,
                     xMap, yMap, series, from, to );
             }
@@ -541,12 +793,12 @@
     else
     {
-        if ( d_data->flags & RoundPoints )
-        {
-            points = qwtToPointsF( d_data->boundingRect,
+        if ( m_data->flags & RoundPoints )
+        {
+            points = qwtToPointsF( m_data->boundingRect,
                 xMap, yMap, series, from, to, QwtRoundF() );
         }
         else
         {
-            points = qwtToPointsF( d_data->boundingRect,
+            points = qwtToPointsF( m_data->boundingRect,
                 xMap, yMap, series, from, to, QwtNoRoundF() );
         }
@@ -557,37 +809,37 @@
 
 /*!
-  \brief Translate a series of points into a QPolygon
-
-  - WeedOutPoints & boundingRect().isValid()
+   \brief Translate a series of points into a QPolygon
+
+   - WeedOutPoints & boundingRect().isValid()
     All points that are mapped to the same position
     will be one point. Points outside of the bounding
     rectangle are ignored.
 
-  - WeedOutPoints & !boundingRect().isValid()
+   - WeedOutPoints & !boundingRect().isValid()
     All consecutive points that are mapped to the same position
     will one point
 
-  - !WeedOutPoints & boundingRect().isValid()
+   - !WeedOutPoints & boundingRect().isValid()
     Points outside of the bounding rectangle are ignored.
 
-  \param xMap x map
-  \param yMap y map
-  \param series Series of points to be mapped
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-
-  \return Translated polygon
-*/
+   \param xMap x map
+   \param yMap y map
+   \param series Series of points to be mapped
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+
+   \return Translated polygon
+ */
 QPolygon QwtPointMapper::toPoints(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to ) const
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to ) const
 {
     QPolygon points;
 
-    if ( d_data->flags & WeedOutPoints )
-    {
-        if ( d_data->boundingRect.isValid() )
-        {
-            points = qwtToPointsFilteredI( d_data->boundingRect,
+    if ( m_data->flags & WeedOutPoints )
+    {
+        if ( m_data->boundingRect.isValid() )
+        {
+            points = qwtToPointsFilteredI( m_data->boundingRect,
                 xMap, yMap, series, from, to );
         }
@@ -604,5 +856,5 @@
     {
         points = qwtToPointsI(
-            d_data->boundingRect, xMap, yMap, series, from, to );
+            m_data->boundingRect, xMap, yMap, series, from, to );
     }
 
@@ -612,25 +864,25 @@
 
 /*!
-  \brief Translate a series into a QImage
-
-  \param xMap x map
-  \param yMap y map
-  \param series Series of points to be mapped
-  \param from Index of the first point to be painted
-  \param to Index of the last point to be painted
-  \param pen Pen used for drawing a point
+   \brief Translate a series into a QImage
+
+   \param xMap x map
+   \param yMap y map
+   \param series Series of points to be mapped
+   \param from Index of the first point to be painted
+   \param to Index of the last point to be painted
+   \param pen Pen used for drawing a point
              of the image, where a point is mapped to
-  \param antialiased True, when the dots should be displayed
+   \param antialiased True, when the dots should be displayed
                      antialiased
-  \param numThreads Number of threads to be used for rendering.
+   \param numThreads Number of threads to be used for rendering.
                    If numThreads is set to 0, the system specific
                    ideal thread count is used.
 
-  \return Image displaying the series
-*/
+   \return Image displaying the series
+ */
 QImage QwtPointMapper::toImage(
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QwtSeriesData<QPointF> *series, int from, int to,
-    const QPen &pen, bool antialiased, uint numThreads ) const
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QwtSeriesData< QPointF >* series, int from, int to,
+    const QPen& pen, bool antialiased, uint numThreads ) const
 {
     Q_UNUSED( antialiased )
@@ -649,5 +901,5 @@
     // where every sample is mapped to one pixel only.
 
-    const QRect rect = d_data->boundingRect.toAlignedRect();
+    const QRect rect = m_data->boundingRect.toAlignedRect();
 
     QImage image( rect.size(), QImage::Format_ARGB32 );
@@ -663,5 +915,5 @@
         const int numPoints = ( to - from + 1 ) / numThreads;
 
-        QList< QFuture<void> > futures;
+        QList< QFuture< void > > futures;
         for ( uint i = 0; i < numThreads; i++ )
         {
