Index: trunk/BNC/qwt/qwt_plot_spectrogram.cpp
===================================================================
--- trunk/BNC/qwt/qwt_plot_spectrogram.cpp	(revision 4271)
+++ trunk/BNC/qwt/qwt_plot_spectrogram.cpp	(revision 8127)
@@ -24,10 +24,15 @@
 #endif
 
+#define DEBUG_RENDER 0
+
+#if DEBUG_RENDER
+#include <QElapsedTimer>
+#endif
+
 class QwtPlotSpectrogram::PrivateData
 {
 public:
     PrivateData():
-        data( NULL ),
-        renderThreadCount( 1 )
+        data( NULL )
     {
         colorMap = new QwtLinearColorMap();
@@ -35,5 +40,7 @@
 
         conrecFlags = QwtRasterData::IgnoreAllVerticesOnLevel;
+#if 0
         conrecFlags |= QwtRasterData::IgnoreOutOfRange;
+#endif
     }
     ~PrivateData()
@@ -46,6 +53,4 @@
     QwtColorMap *colorMap;
     DisplayModes displayMode;
-
-    uint renderThreadCount;
 
     QList<double> contourLevels;
@@ -108,4 +113,5 @@
     }
 
+    legendChanged();
     itemChanged();
 }
@@ -123,35 +129,4 @@
 
 /*!
-   Rendering an image from the raster data can often be done
-   parallel on a multicore system.
-
-   \param numThreads Number of threads to be used for rendering.
-                     If numThreads is set to 0, the system specific
-                     ideal thread count is used.
-
-   The default thread count is 1 ( = no additional threads )
-
-   \warning Rendering in multiple threads is only supported for Qt >= 4.4
-   \sa renderThreadCount(), renderImage(), renderTile()
-*/
-void QwtPlotSpectrogram::setRenderThreadCount( uint numThreads )
-{
-    d_data->renderThreadCount = numThreads;
-}
-
-/*!
-   \return Number of threads to be used for rendering.
-           If numThreads is set to 0, the system specific
-           ideal thread count is used.
-
-   \warning Rendering in multiple threads is only supported for Qt >= 4.4
-   \sa setRenderThreadCount(), renderImage(), renderTile()
-*/
-uint QwtPlotSpectrogram::renderThreadCount() const
-{
-    return d_data->renderThreadCount;
-}
-
-/*!
   Change the color map
 
@@ -173,4 +148,6 @@
 
     invalidateCache();
+
+    legendChanged();
     itemChanged();
 }
@@ -183,4 +160,23 @@
 {
     return d_data->colorMap;
+}
+
+/*! 
+  Build and assign the default pen for the contour lines
+    
+  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 QwtPlotSpectrogram::setDefaultContourPen( 
+    const QColor &color, qreal width, Qt::PenStyle style )
+{   
+    setDefaultContourPen( QPen( color, width, style ) );
 }
 
@@ -200,4 +196,6 @@
     {
         d_data->defaultContourPen = pen;
+
+        legendChanged();
         itemChanged();
     }
@@ -266,4 +264,6 @@
    \return true, is enabled
 
+   The default setting enables QwtRasterData::IgnoreAllVerticesOnLevel
+
    \sa setConrecClag(), renderContourLines(),
        QwtRasterData::contourLines()
@@ -288,9 +288,11 @@
     d_data->contourLevels = levels;
     qSort( d_data->contourLevels );
+
+    legendChanged();
     itemChanged();
 }
 
 /*!
-   \brief Return the levels of the contour lines.
+   \return Levels of the contour lines.
 
    The levels are sorted in increasing order.
@@ -384,5 +386,5 @@
    \brief Render an image from data and color map.
 
-   For each pixel of rect the value is mapped into a color.
+   For each pixel of area the value is mapped into a color.
 
   \param xMap X-Scale Map
@@ -421,6 +423,11 @@
     d_data->data->initRaster( area, image.size() );
 
+#if DEBUG_RENDER
+	QElapsedTimer time;
+	time.start();
+#endif
+
 #if QT_VERSION >= 0x040400 && !defined(QT_NO_QFUTURE)
-    uint numThreads = d_data->renderThreadCount;
+    uint numThreads = renderThreadCount();
 
     if ( numThreads <= 0 )
@@ -456,4 +463,9 @@
 #endif
 
+#if DEBUG_RENDER
+    const qint64 elapsed = time.elapsed();
+    qDebug() << "renderImage" << imageSize << elapsed;
+#endif
+
     d_data->data->discardRaster();
 
@@ -486,5 +498,5 @@
             const double ty = yMap.invTransform( y );
 
-            QRgb *line = ( QRgb * )image->scanLine( y );
+            QRgb *line = reinterpret_cast<QRgb *>( image->scanLine( y ) );
             line += tile.left();
 
@@ -521,5 +533,5 @@
    \brief Return the raster to be used by the CONREC contour algorithm.
 
-   A larger size will improve the precisision of the CONREC algorithm,
+   A larger size will improve the precision of the CONREC algorithm,
    but will slow down the time that is needed to calculate the lines.
 
@@ -527,6 +539,6 @@
    the resolution depending on pixelSize().
 
-   \param area Rect, where to calculate the contour lines
-   \param rect Rect in pixel coordinates, where to paint the contour lines
+   \param area Rectangle, where to calculate the contour lines
+   \param rect Rectangle in pixel coordinates, where to paint the contour lines
    \return Raster to be used by the CONREC contour algorithm.
 
@@ -556,4 +568,5 @@
    \param rect Rectangle, where to calculate the contour lines
    \param raster Raster, used by the CONREC algorithm
+   \return Calculated contour lines
 
    \sa contourLevels(), setConrecFlag(),
@@ -586,6 +599,4 @@
     if ( d_data->data == NULL )
         return;
-
-    const QwtInterval intensityRange = d_data->data->interval( Qt::ZAxis );
 
     const int numLevels = d_data->contourLevels.size();
@@ -622,5 +633,5 @@
   \param xMap Maps x-values into pixel coordinates.
   \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rect of the canvas in painter coordinates
+  \param canvasRect Contents rectangle of the canvas in painter coordinates
 
   \sa setDisplayMode(), renderImage(),
