Ignore:
Timestamp:
Nov 3, 2026, 10:53:35 AM (8 days ago)
Author:
stuerze
Message:

deprecated functions exchanged libs updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_plot_spectrogram.cpp

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1313#include "qwt_scale_map.h"
    1414#include "qwt_color_map.h"
     15#include "qwt_math.h"
     16
    1517#include <qimage.h>
    1618#include <qpen.h>
    1719#include <qpainter.h>
    18 #include <qmath.h>
    19 #include <qalgorithms.h>
    20 #if QT_VERSION >= 0x040400
    2120#include <qthread.h>
    2221#include <qfuture.h>
    2322#include <qtconcurrentrun.h>
     23
     24#define DEBUG_RENDER 0
     25
     26#if DEBUG_RENDER
     27#include <qelapsedtimer.h>
    2428#endif
    2529
    26 #define DEBUG_RENDER 0
    27 
    28 #if DEBUG_RENDER
    29 #include <QElapsedTimer>
    30 #endif
     30#include <algorithm>
     31
     32static inline bool qwtIsNaN( double d )
     33{
     34    // qt_is_nan is private header and qIsNaN is not inlined
     35    // so we need these code here too
     36
     37    const uchar* ch = (const uchar*)&d;
     38    if ( QSysInfo::ByteOrder == QSysInfo::BigEndian )
     39    {
     40        return ( ch[0] & 0x7f ) == 0x7f && ch[1] > 0xf0;
     41    }
     42    else
     43    {
     44        return ( ch[7] & 0x7f ) == 0x7f && ch[6] > 0xf0;
     45    }
     46}
    3147
    3248class QwtPlotSpectrogram::PrivateData
    3349{
    34 public:
    35     PrivateData():
    36         data( NULL )
     50  public:
     51    PrivateData()
     52        : data( NULL )
     53        , colorTableSize( 0 )
    3754    {
    3855        colorMap = new QwtLinearColorMap();
    … …  
    4461#endif
    4562    }
     63
    4664    ~PrivateData()
    4765    {
    … …  
    5068    }
    5169
    52     QwtRasterData *data;
    53     QwtColorMap *colorMap;
     70    void updateColorTable()
     71    {
     72        if ( colorMap->format() == QwtColorMap::Indexed )
     73        {
     74            colorTable = colorMap->colorTable256();
     75        }
     76        else
     77        {
     78            if ( colorTableSize == 0 )
     79                colorTable.clear();
     80            else
     81                colorTable = colorMap->colorTable( colorTableSize );
     82        }
     83    }
     84
     85    QwtRasterData* data;
     86    QwtColorMap* colorMap;
    5487    DisplayModes displayMode;
    5588
    56     QList<double> contourLevels;
     89    QList< double > contourLevels;
    5790    QPen defaultContourPen;
    5891    QwtRasterData::ConrecFlags conrecFlags;
     92
     93    int colorTableSize;
     94    QVector< QRgb > colorTable;
    5995};
    6096
    … …  
    69105
    70106   \sa QwtPlotItem::setItemAttribute(), QwtPlotItem::setZ()
    71 */
    72 QwtPlotSpectrogram::QwtPlotSpectrogram( const QString &title ):
    73     QwtPlotRasterItem( title )
    74 {
    75     d_data = new PrivateData();
     107 */
     108QwtPlotSpectrogram::QwtPlotSpectrogram( const QString& title )
     109    : QwtPlotRasterItem( title )
     110{
     111    m_data = new PrivateData();
    76112
    77113    setItemAttribute( QwtPlotItem::AutoScale, true );
    … …  
    84120QwtPlotSpectrogram::~QwtPlotSpectrogram()
    85121{
    86     delete d_data;
     122    delete m_data;
    87123}
    88124
    … …  
    102138
    103139   \sa DisplayMode, displayMode()
    104 */
     140 */
    105141void QwtPlotSpectrogram::setDisplayMode( DisplayMode mode, bool on )
    106142{
    107     if ( on != bool( mode & d_data->displayMode ) )
     143    if ( on != bool( mode & m_data->displayMode ) )
    108144    {
    109145        if ( on )
    110             d_data->displayMode |= mode;
     146            m_data->displayMode |= mode;
    111147        else
    112             d_data->displayMode &= ~mode;
     148            m_data->displayMode &= ~mode;
    113149    }
    114150
    … …  
    122158   \param mode Display mode
    123159   \return true if mode is enabled
    124 */
     160 */
    125161bool QwtPlotSpectrogram::testDisplayMode( DisplayMode mode ) const
    126162{
    127     return ( d_data->displayMode & mode );
    128 }
    129 
    130 /*!
    131   Change the color map
    132 
    133   Often it is useful to display the mapping between intensities and
    134   colors as an additional plot axis, showing a color bar.
    135 
    136   \param colorMap Color Map
    137 
    138   \sa colorMap(), QwtScaleWidget::setColorBarEnabled(),
     163    return ( m_data->displayMode & mode );
     164}
     165
     166/*!
     167   Change the color map
     168
     169   Often it is useful to display the mapping between intensities and
     170   colors as an additional plot axis, showing a color bar.
     171
     172   \param colorMap Color Map
     173
     174   \sa colorMap(), QwtScaleWidget::setColorBarEnabled(),
    139175      QwtScaleWidget::setColorMap()
    140 */
    141 void QwtPlotSpectrogram::setColorMap( QwtColorMap *colorMap )
    142 {
    143     if ( d_data->colorMap != colorMap )
    144     {
    145         delete d_data->colorMap;
    146         d_data->colorMap = colorMap;
    147     }
     176 */
     177void QwtPlotSpectrogram::setColorMap( QwtColorMap* colorMap )
     178{
     179    if ( colorMap == NULL )
     180        return;
     181
     182    if ( colorMap != m_data->colorMap )
     183    {
     184        delete m_data->colorMap;
     185        m_data->colorMap = colorMap;
     186    }
     187
     188    m_data->updateColorTable();
    148189
    149190    invalidateCache();
    … …  
    156197   \return Color Map used for mapping the intensity values to colors
    157198   \sa setColorMap()
    158 */
    159 const QwtColorMap *QwtPlotSpectrogram::colorMap() const
    160 {
    161     return d_data->colorMap;
    162 }
    163 
    164 /*!
    165   Build and assign the default pen for the contour lines
    166 
    167   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
    168   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
    169   to hide this incompatibility.
    170 
    171   \param color Pen color
    172   \param width Pen width
    173   \param style Pen style
    174 
    175   \sa pen(), brush()
     199 */
     200const QwtColorMap* QwtPlotSpectrogram::colorMap() const
     201{
     202    return m_data->colorMap;
     203}
     204
     205/*!
     206    Limit the number of colors being used by the color map
     207
     208    When using a color table the mapping from the value into a color
     209    is usually faster as it can be done by simple lookups into a
     210    precalculated color table.
     211
     212    Setting a table size > 0 enables using a color table, while setting
     213    the size to 0 disables it.
     214
     215    The default size = 0, and no color table is used.
     216
     217    \param numColors Number of colors. 0 means not using a color table
     218    \note The colorTableSize has no effect when using a color table
     219          of QwtColorMap::Indexed, where the size is always 256.
     220
     221
     222    \sa QwtColorMap::colorTable(), colorTableSize()
     223 */
     224void QwtPlotSpectrogram::setColorTableSize( int numColors )
     225{
     226    numColors = qMax( numColors, 0 );
     227    if ( numColors != m_data->colorTableSize )
     228    {
     229        m_data->colorTableSize = numColors;
     230        m_data->updateColorTable();
     231        invalidateCache();
     232    }
     233}
     234/*!
     235    \return Size of the color table, 0 means not using a color table
     236    \sa QwtColorMap::colorTable(), setColorTableSize()
     237 */
     238int QwtPlotSpectrogram::colorTableSize() const
     239{
     240    return m_data->colorTableSize;
     241}
     242
     243/*!
     244   Build and assign the default pen for the contour lines
     245
     246   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
     247   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
     248   to hide this incompatibility.
     249
     250   \param color Pen color
     251   \param width Pen width
     252   \param style Pen style
     253
     254   \sa pen(), brush()
    176255 */
    177256void QwtPlotSpectrogram::setDefaultContourPen(
    178     const QColor &color, qreal width, Qt::PenStyle style )
     257    const QColor& color, qreal width, Qt::PenStyle style )
    179258{
    180259    setDefaultContourPen( QPen( color, width, style ) );
    … …  
    190269
    191270   \sa defaultContourPen(), contourPen()
    192 */
    193 void QwtPlotSpectrogram::setDefaultContourPen( const QPen &pen )
    194 {
    195     if ( pen != d_data->defaultContourPen )
    196     {
    197         d_data->defaultContourPen = pen;
     271 */
     272void QwtPlotSpectrogram::setDefaultContourPen( const QPen& pen )
     273{
     274    if ( pen != m_data->defaultContourPen )
     275    {
     276        m_data->defaultContourPen = pen;
    198277
    199278        legendChanged();
    … …  
    205284   \return Default contour pen
    206285   \sa setDefaultContourPen()
    207 */
     286 */
    208287QPen QwtPlotSpectrogram::defaultContourPen() const
    209288{
    210     return d_data->defaultContourPen;
     289    return m_data->defaultContourPen;
    211290}
    212291
    … …  
    221300
    222301   \sa setDefaultContourPen(), setColorMap(), setContourLevels()
    223 */
     302 */
    224303QPen QwtPlotSpectrogram::contourPen( double level ) const
    225304{
    226     if ( d_data->data == NULL || d_data->colorMap == NULL )
     305    if ( m_data->data == NULL || m_data->colorMap == NULL )
    227306        return QPen();
    228307
    229     const QwtInterval intensityRange = d_data->data->interval(Qt::ZAxis);
    230     const QColor c( d_data->colorMap->rgb( intensityRange, level ) );
     308    const QwtInterval intensityRange = m_data->data->interval(Qt::ZAxis);
     309    const QColor c( m_data->colorMap->rgb( intensityRange, level ) );
    231310
    232311    return QPen( c );
    … …  
    242321   \sa testConrecFlag(), renderContourLines(),
    243322       QwtRasterData::contourLines()
    244 */
     323 */
    245324void QwtPlotSpectrogram::setConrecFlag(
    246325    QwtRasterData::ConrecFlag flag, bool on )
    247326{
    248     if ( bool( d_data->conrecFlags & flag ) == on )
     327    if ( bool( m_data->conrecFlags & flag ) == on )
    249328        return;
    250329
    251330    if ( on )
    252         d_data->conrecFlags |= flag;
     331        m_data->conrecFlags |= flag;
    253332    else
    254         d_data->conrecFlags &= ~flag;
     333        m_data->conrecFlags &= ~flag;
    255334
    256335    itemChanged();
    … …  
    268347   \sa setConrecClag(), renderContourLines(),
    269348       QwtRasterData::contourLines()
    270 */
     349 */
    271350bool QwtPlotSpectrogram::testConrecFlag(
    272351    QwtRasterData::ConrecFlag flag ) const
    273352{
    274     return d_data->conrecFlags & flag;
     353    return m_data->conrecFlags & flag;
    275354}
    276355
    … …  
    283362
    284363   \note contourLevels returns the same levels but sorted.
    285 */
    286 void QwtPlotSpectrogram::setContourLevels( const QList<double> &levels )
    287 {
    288     d_data->contourLevels = levels;
    289     qSort( d_data->contourLevels );
     364 */
     365void QwtPlotSpectrogram::setContourLevels( const QList< double >& levels )
     366{
     367    m_data->contourLevels = levels;
     368    std::sort( m_data->contourLevels.begin(), m_data->contourLevels.end() );
    290369
    291370    legendChanged();
    … …  
    300379   \sa contourLevels(), renderContourLines(),
    301380       QwtRasterData::contourLines()
    302 */
    303 QList<double> QwtPlotSpectrogram::contourLevels() const
    304 {
    305     return d_data->contourLevels;
    306 }
    307 
    308 /*!
    309   Set the data to be displayed
    310 
    311   \param data Spectrogram Data
    312   \sa data()
    313 */
    314 void QwtPlotSpectrogram::setData( QwtRasterData *data )
    315 {
    316     if ( data != d_data->data )
    317     {
    318         delete d_data->data;
    319         d_data->data = data;
     381 */
     382QList< double > QwtPlotSpectrogram::contourLevels() const
     383{
     384    return m_data->contourLevels;
     385}
     386
     387/*!
     388   Set the data to be displayed
     389
     390   \param data Spectrogram Data
     391   \sa data()
     392 */
     393void QwtPlotSpectrogram::setData( QwtRasterData* data )
     394{
     395    if ( data != m_data->data )
     396    {
     397        delete m_data->data;
     398        m_data->data = data;
    320399
    321400        invalidateCache();
    … …  
    325404
    326405/*!
    327   \return Spectrogram data
    328   \sa setData()
    329 */
    330 const QwtRasterData *QwtPlotSpectrogram::data() const
    331 {
    332     return d_data->data;
    333 }
    334 
    335 /*!
    336   \return Spectrogram data
    337   \sa setData()
    338 */
    339 QwtRasterData *QwtPlotSpectrogram::data()
    340 {
    341     return d_data->data;
     406   \return Spectrogram data
     407   \sa setData()
     408 */
     409const QwtRasterData* QwtPlotSpectrogram::data() const
     410{
     411    return m_data->data;
     412}
     413
     414/*!
     415   \return Spectrogram data
     416   \sa setData()
     417 */
     418QwtRasterData* QwtPlotSpectrogram::data()
     419{
     420    return m_data->data;
    342421}
    343422
    … …  
    350429   \param axis X, Y, or Z axis
    351430   \sa QwtRasterData::interval()
    352 */
     431 */
    353432QwtInterval QwtPlotSpectrogram::interval(Qt::Axis axis) const
    354433{
    355     if ( d_data->data == NULL )
     434    if ( m_data->data == NULL )
    356435        return QwtInterval();
    357436
    358     return d_data->data->interval( axis );
     437    return m_data->data->interval( axis );
    359438}
    360439
    … …  
    374453   \sa QwtPlotRasterItem::pixelHint(), QwtRasterData::pixelHint(),
    375454       render(), renderImage()
    376 */
    377 QRectF QwtPlotSpectrogram::pixelHint( const QRectF &area ) const
    378 {
    379     if ( d_data->data == NULL )
     455 */
     456QRectF QwtPlotSpectrogram::pixelHint( const QRectF& area ) const
     457{
     458    if ( m_data->data == NULL )
    380459        return QRectF();
    381460
    382     return d_data->data->pixelHint( area );
     461    return m_data->data->pixelHint( area );
    383462}
    384463
    … …  
    388467   For each pixel of area the value is mapped into a color.
    389468
    390   \param xMap X-Scale Map
    391   \param yMap Y-Scale Map
    392   \param area Requested area for the image in scale coordinates
    393   \param imageSize Size of the requested image
     469   \param xMap X-Scale Map
     470   \param yMap Y-Scale Map
     471   \param area Requested area for the image in scale coordinates
     472   \param imageSize Size of the requested image
    394473
    395474   \return A QImage::Format_Indexed8 or QImage::Format_ARGB32 depending
    … …  
    398477   \sa QwtRasterData::value(), QwtColorMap::rgb(),
    399478       QwtColorMap::colorIndex()
    400 */
     479 */
    401480QImage QwtPlotSpectrogram::renderImage(
    402     const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    403     const QRectF &area, const QSize &imageSize ) const
    404 {
    405     if ( imageSize.isEmpty() || d_data->data == NULL
    406         || d_data->colorMap == NULL )
     481    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     482    const QRectF& area, const QSize& imageSize ) const
     483{
     484    if ( imageSize.isEmpty() || m_data->data == NULL
     485        || m_data->colorMap == NULL )
    407486    {
    408487        return QImage();
    409488    }
    410489
    411     const QwtInterval intensityRange = d_data->data->interval( Qt::ZAxis );
     490    const QwtInterval intensityRange = m_data->data->interval( Qt::ZAxis );
    412491    if ( !intensityRange.isValid() )
    413492        return QImage();
    414493
    415     QImage::Format format = ( d_data->colorMap->format() == QwtColorMap::RGB )
     494    const QImage::Format format = ( m_data->colorMap->format() == QwtColorMap::RGB )
    416495        ? QImage::Format_ARGB32 : QImage::Format_Indexed8;
    417496
    418497    QImage image( imageSize, format );
    419498
    420     if ( d_data->colorMap->format() == QwtColorMap::Indexed )
    421         image.setColorTable( d_data->colorMap->colorTable( intensityRange ) );
    422 
    423     d_data->data->initRaster( area, image.size() );
     499    if ( m_data->colorMap->format() == QwtColorMap::Indexed )
     500        image.setColorTable( m_data->colorMap->colorTable256() );
     501
     502    m_data->data->initRaster( area, image.size() );
    424503
    425504#if DEBUG_RENDER
    … …  
    428507#endif
    429508
    430 #if QT_VERSION >= 0x040400 && !defined(QT_NO_QFUTURE)
     509#if !defined( QT_NO_QFUTURE )
    431510    uint numThreads = renderThreadCount();
    432511
    … …  
    439518    const int numRows = imageSize.height() / numThreads;
    440519
    441     QList< QFuture<void> > futures;
     520    QVector< QFuture< void > > futures;
     521    futures.reserve( numThreads - 1 );
     522
    442523    for ( uint i = 0; i < numThreads; i++ )
    443524    {
    … …  
    451532        {
    452533            futures += QtConcurrent::run(
     534#if QT_VERSION >= 0x060000
     535                &QwtPlotSpectrogram::renderTile, this,
     536#else
    453537                this, &QwtPlotSpectrogram::renderTile,
     538#endif
    454539                xMap, yMap, tile, &image );
    455540        }
    456541    }
     542
    457543    for ( int i = 0; i < futures.size(); i++ )
    458544        futures[i].waitForFinished();
    459545
    460 #else // QT_VERSION < 0x040400
     546#else
    461547    const QRect tile( 0, 0, image.width(), image.height() );
    462548    renderTile( xMap, yMap, tile, &image );
    … …  
    468554#endif
    469555
    470     d_data->data->discardRaster();
     556    m_data->data->discardRaster();
    471557
    472558    return image;
    … …  
    483569    \param tile Geometry of the tile in image coordinates
    484570    \param image Image to be rendered
    485 */
     571 */
    486572void QwtPlotSpectrogram::renderTile(
    487     const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    488     const QRect &tile, QImage *image ) const
    489 {
    490     const QwtInterval range = d_data->data->interval( Qt::ZAxis );
    491     if ( !range.isValid() )
     573    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     574    const QRect& tile, QImage* image ) const
     575{
     576    const QwtInterval range = m_data->data->interval( Qt::ZAxis );
     577    if ( range.width() <= 0.0 )
    492578        return;
    493579
    494     if ( d_data->colorMap->format() == QwtColorMap::RGB )
    495     {
     580    const bool hasGaps = !m_data->data->testAttribute( QwtRasterData::WithoutGaps );
     581
     582    if ( m_data->colorMap->format() == QwtColorMap::RGB )
     583    {
     584        const int numColors = m_data->colorTable.size();
     585        const QRgb* rgbTable = m_data->colorTable.constData();
     586        const QwtColorMap* colorMap = m_data->colorMap;
     587
    496588        for ( int y = tile.top(); y <= tile.bottom(); y++ )
    497589        {
    498590            const double ty = yMap.invTransform( y );
    499591
    500             QRgb *line = reinterpret_cast<QRgb *>( image->scanLine( y ) );
     592            QRgb* line = reinterpret_cast< QRgb* >( image->scanLine( y ) );
    501593            line += tile.left();
    502594
    … …  
    505597                const double tx = xMap.invTransform( x );
    506598
    507                 *line++ = d_data->colorMap->rgb( range,
    508                     d_data->data->value( tx, ty ) );
     599                const double value = m_data->data->value( tx, ty );
     600
     601                if ( hasGaps && qwtIsNaN( value ) )
     602                {
     603                    *line++ = 0u;
     604                }
     605                else if ( numColors == 0 )
     606                {
     607                    *line++ = colorMap->rgb( range, value );
     608                }
     609                else
     610                {
     611                    const uint index = colorMap->colorIndex( numColors, range, value );
     612                    *line++ = rgbTable[index];
     613                }
    509614            }
    510615        }
    511616    }
    512     else if ( d_data->colorMap->format() == QwtColorMap::Indexed )
     617    else if ( m_data->colorMap->format() == QwtColorMap::Indexed )
    513618    {
    514619        for ( int y = tile.top(); y <= tile.bottom(); y++ )
    … …  
    516621            const double ty = yMap.invTransform( y );
    517622
    518             unsigned char *line = image->scanLine( y );
     623            unsigned char* line = image->scanLine( y );
    519624            line += tile.left();
    520625
    … …  
    523628                const double tx = xMap.invTransform( x );
    524629
    525                 *line++ = d_data->colorMap->colorIndex( range,
    526                     d_data->data->value( tx, ty ) );
     630                const double value = m_data->data->value( tx, ty );
     631
     632                if ( hasGaps && qwtIsNaN( value ) )
     633                {
     634                    *line++ = 0;
     635                }
     636                else
     637                {
     638                    const uint index = m_data->colorMap->colorIndex( 256, range, value );
     639                    *line++ = static_cast< unsigned char >( index );
     640                }
    527641            }
    528642        }
    … …  
    546660
    547661   \sa drawContourLines(), QwtRasterData::contourLines()
    548 */
     662 */
    549663QSize QwtPlotSpectrogram::contourRasterSize(
    550     const QRectF &area, const QRect &rect ) const
     664    const QRectF& area, const QRect& rect ) const
    551665{
    552666    QSize raster = rect.size() / 2;
    … …  
    555669    if ( !pixelRect.isEmpty() )
    556670    {
    557         const QSize res( qCeil( rect.width() / pixelRect.width() ),
    558             qCeil( rect.height() / pixelRect.height() ) );
     671        const QSize res( qwtCeil( rect.width() / pixelRect.width() ),
     672            qwtCeil( rect.height() / pixelRect.height() ) );
    559673        raster = raster.boundedTo( res );
    560674    }
    … …  
    572686   \sa contourLevels(), setConrecFlag(),
    573687       QwtRasterData::contourLines()
    574 */
     688 */
    575689QwtRasterData::ContourLines QwtPlotSpectrogram::renderContourLines(
    576     const QRectF &rect, const QSize &raster ) const
    577 {
    578     if ( d_data->data == NULL )
     690    const QRectF& rect, const QSize& raster ) const
     691{
     692    if ( m_data->data == NULL )
    579693        return QwtRasterData::ContourLines();
    580694
    581     return d_data->data->contourLines( rect, raster,
    582         d_data->contourLevels, d_data->conrecFlags );
     695    return m_data->data->contourLines( rect, raster,
     696        m_data->contourLevels, m_data->conrecFlags );
    583697}
    584698
    … …  
    592706
    593707   \sa renderContourLines(), defaultContourPen(), contourPen()
    594 */
    595 void QwtPlotSpectrogram::drawContourLines( QPainter *painter,
    596         const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    597         const QwtRasterData::ContourLines &contourLines ) const
    598 {
    599     if ( d_data->data == NULL )
     708 */
     709void QwtPlotSpectrogram::drawContourLines( QPainter* painter,
     710    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     711    const QwtRasterData::ContourLines& contourLines ) const
     712{
     713    if ( m_data->data == NULL )
    600714        return;
    601715
    602     const int numLevels = d_data->contourLevels.size();
     716    const int numLevels = m_data->contourLevels.size();
    603717    for ( int l = 0; l < numLevels; l++ )
    604718    {
    605         const double level = d_data->contourLevels[l];
     719        const double level = m_data->contourLevels[l];
    606720
    607721        QPen pen = defaultContourPen();
    … …  
    614728        painter->setPen( pen );
    615729
    616         const QPolygonF &lines = contourLines[level];
     730        const QPolygonF& lines = contourLines[level];
    617731        for ( int i = 0; i < lines.size(); i += 2 )
    618732        {
    619733            const QPointF p1( xMap.transform( lines[i].x() ),
    620734                yMap.transform( lines[i].y() ) );
    621             const QPointF p2( xMap.transform( lines[i+1].x() ),
    622                 yMap.transform( lines[i+1].y() ) );
     735            const QPointF p2( xMap.transform( lines[i + 1].x() ),
     736                yMap.transform( lines[i + 1].y() ) );
    623737
    624738            QwtPainter::drawLine( painter, p1, p2 );
    … …  
    628742
    629743/*!
    630   \brief Draw the spectrogram
    631 
    632   \param painter Painter
    633   \param xMap Maps x-values into pixel coordinates.
    634   \param yMap Maps y-values into pixel coordinates.
    635   \param canvasRect Contents rectangle of the canvas in painter coordinates
    636 
    637   \sa setDisplayMode(), renderImage(),
     744   \brief Draw the spectrogram
     745
     746   \param painter Painter
     747   \param xMap Maps x-values into pixel coordinates.
     748   \param yMap Maps y-values into pixel coordinates.
     749   \param canvasRect Contents rectangle of the canvas in painter coordinates
     750
     751   \sa setDisplayMode(), renderImage(),
    638752      QwtPlotRasterItem::draw(), drawContourLines()
    639 */
    640 void QwtPlotSpectrogram::draw( QPainter *painter,
    641     const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    642     const QRectF &canvasRect ) const
    643 {
    644     if ( d_data->displayMode & ImageMode )
     753 */
     754void QwtPlotSpectrogram::draw( QPainter* painter,
     755    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     756    const QRectF& canvasRect ) const
     757{
     758    if ( m_data->displayMode & ImageMode )
    645759        QwtPlotRasterItem::draw( painter, xMap, yMap, canvasRect );
    646760
    647     if ( d_data->displayMode & ContourMode )
     761    if ( m_data->displayMode & ContourMode )
    648762    {
    649763        // Add some pixels at the borders
Note: See TracChangeset for help on using the changeset viewer.