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

deprecated functions exchanged libs updated

File:
1 edited

Legend:

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

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    1212#include "qwt_scale_map.h"
    1313#include "qwt_painter.h"
     14#include "qwt_text.h"
     15
    1416#include <qpainter.h>
    1517
    1618class QwtPlotSpectroCurve::PrivateData
    1719{
    18 public:
    19     PrivateData():
    20         colorRange( 0.0, 1000.0 ),
    21         penWidth(0.0),
    22         paintAttributes( QwtPlotSpectroCurve::ClipPoints )
     20  public:
     21    PrivateData()
     22        : colorRange( 0.0, 1000.0 )
     23        , penWidth( 0.0 )
     24        , paintAttributes( QwtPlotSpectroCurve::ClipPoints )
    2325    {
    2426        colorMap = new QwtLinearColorMap();
    … …  
    3032    }
    3133
    32     QwtColorMap *colorMap;
     34    QwtColorMap* colorMap;
    3335    QwtInterval colorRange;
    34     QVector<QRgb> colorTable;
     36    QVector< QRgb > colorTable;
    3537    double penWidth;
    3638    QwtPlotSpectroCurve::PaintAttributes paintAttributes;
    … …  
    3840
    3941/*!
    40   Constructor
    41   \param title Title of the curve
    42 */
    43 QwtPlotSpectroCurve::QwtPlotSpectroCurve( const QwtText &title ):
    44     QwtPlotSeriesItem( title )
     42   Constructor
     43   \param title Title of the curve
     44 */
     45QwtPlotSpectroCurve::QwtPlotSpectroCurve( const QwtText& title )
     46    : QwtPlotSeriesItem( title )
    4547{
    4648    init();
    … …  
    4850
    4951/*!
    50   Constructor
    51   \param title Title of the curve
    52 */
    53 QwtPlotSpectroCurve::QwtPlotSpectroCurve( const QString &title ):
    54     QwtPlotSeriesItem( QwtText( title ) )
     52   Constructor
     53   \param title Title of the curve
     54 */
     55QwtPlotSpectroCurve::QwtPlotSpectroCurve( const QString& title )
     56    : QwtPlotSeriesItem( QwtText( title ) )
    5557{
    5658    init();
    … …  
    6062QwtPlotSpectroCurve::~QwtPlotSpectroCurve()
    6163{
    62     delete d_data;
    63 }
    64 
    65 /*!
    66   \brief Initialize data members
    67 */
     64    delete m_data;
     65}
     66
     67/*!
     68   \brief Initialize data members
     69 */
    6870void QwtPlotSpectroCurve::init()
    6971{
    … …  
    7173    setItemAttribute( QwtPlotItem::AutoScale );
    7274
    73     d_data = new PrivateData;
     75    m_data = new PrivateData;
    7476    setData( new QwtPoint3DSeriesData() );
    7577
    … …  
    8486
    8587/*!
    86   Specify an attribute how to draw the curve
    87 
    88   \param attribute Paint attribute
    89   \param on On/Off
    90   /sa PaintAttribute, testPaintAttribute()
    91 */
     88   Specify an attribute how to draw the curve
     89
     90   \param attribute Paint attribute
     91   \param on On/Off
     92   /sa PaintAttribute, testPaintAttribute()
     93 */
    9294void QwtPlotSpectroCurve::setPaintAttribute( PaintAttribute attribute, bool on )
    9395{
    9496    if ( on )
    95         d_data->paintAttributes |= attribute;
     97        m_data->paintAttributes |= attribute;
    9698    else
    97         d_data->paintAttributes &= ~attribute;
     99        m_data->paintAttributes &= ~attribute;
    98100}
    99101
    … …  
    101103    \return True, when attribute is enabled
    102104    \sa PaintAttribute, setPaintAttribute()
    103 */
     105 */
    104106bool QwtPlotSpectroCurve::testPaintAttribute( PaintAttribute attribute ) const
    105107{
    106     return ( d_data->paintAttributes & attribute );
    107 }
    108 
    109 /*!
    110   Initialize data with an array of samples.
    111   \param samples Vector of points
    112 */
    113 void QwtPlotSpectroCurve::setSamples( const QVector<QwtPoint3D> &samples )
     108    return ( m_data->paintAttributes & attribute );
     109}
     110
     111/*!
     112   Initialize data with an array of samples.
     113   \param samples Vector of points
     114 */
     115void QwtPlotSpectroCurve::setSamples( const QVector< QwtPoint3D >& samples )
    114116{
    115117    setData( new QwtPoint3DSeriesData( samples ) );
    … …  
    117119
    118120/*!
    119   Assign a series of samples
    120 
    121   setSamples() is just a wrapper for setData() without any additional
    122   value - beside that it is easier to find for the developer.
    123 
    124   \param data Data
    125   \warning The item takes ownership of the data object, deleting
     121   Assign a series of samples
     122
     123   setSamples() is just a wrapper for setData() without any additional
     124   value - beside that it is easier to find for the developer.
     125
     126   \param data Data
     127   \warning The item takes ownership of the data object, deleting
    126128           it when its not used anymore.
    127 */
     129 */
    128130void QwtPlotSpectroCurve::setSamples(
    129     QwtSeriesData<QwtPoint3D> *data )
     131    QwtSeriesData< QwtPoint3D >* data )
    130132{
    131133    setData( data );
    … …  
    133135
    134136/*!
    135   Change the color map
    136 
    137   Often it is useful to display the mapping between intensities and
    138   colors as an additional plot axis, showing a color bar.
    139 
    140   \param colorMap Color Map
    141 
    142   \sa colorMap(), setColorRange(), QwtColorMap::color(),
     137   Change the color map
     138
     139   Often it is useful to display the mapping between intensities and
     140   colors as an additional plot axis, showing a color bar.
     141
     142   \param colorMap Color Map
     143
     144   \sa colorMap(), setColorRange(), QwtColorMap::color(),
    143145      QwtScaleWidget::setColorBarEnabled(), QwtScaleWidget::setColorMap()
    144 */
    145 void QwtPlotSpectroCurve::setColorMap( QwtColorMap *colorMap )
    146 {
    147     if ( colorMap != d_data->colorMap )
    148     {
    149         delete d_data->colorMap;
    150         d_data->colorMap = colorMap;
     146 */
     147void QwtPlotSpectroCurve::setColorMap( QwtColorMap* colorMap )
     148{
     149    if ( colorMap != m_data->colorMap )
     150    {
     151        delete m_data->colorMap;
     152        m_data->colorMap = colorMap;
    151153    }
    152154
    … …  
    158160   \return Color Map used for mapping the intensity values to colors
    159161   \sa setColorMap(), setColorRange(), QwtColorMap::color()
    160 */
    161 const QwtColorMap *QwtPlotSpectroCurve::colorMap() const
    162 {
    163     return d_data->colorMap;
     162 */
     163const QwtColorMap* QwtPlotSpectroCurve::colorMap() const
     164{
     165    return m_data->colorMap;
    164166}
    165167
    … …  
    171173
    172174   \sa colorRange(), setColorMap(), QwtColorMap::color()
    173 */
    174 void QwtPlotSpectroCurve::setColorRange( const QwtInterval &interval )
    175 {
    176     if ( interval != d_data->colorRange )
    177     {
    178         d_data->colorRange = interval;
     175 */
     176void QwtPlotSpectroCurve::setColorRange( const QwtInterval& interval )
     177{
     178    if ( interval != m_data->colorRange )
     179    {
     180        m_data->colorRange = interval;
    179181
    180182        legendChanged();
    … …  
    184186
    185187/*!
    186   \return Value interval, that corresponds to the color map
    187   \sa setColorRange(), setColorMap(), QwtColorMap::color()
    188 */
    189 QwtInterval &QwtPlotSpectroCurve::colorRange() const
    190 {
    191     return d_data->colorRange;
    192 }
    193 
    194 /*!
    195   Assign a pen width
    196 
    197   \param penWidth New pen width
    198   \sa penWidth()
    199 */
     188   \return Value interval, that corresponds to the color map
     189   \sa setColorRange(), setColorMap(), QwtColorMap::color()
     190 */
     191QwtInterval& QwtPlotSpectroCurve::colorRange() const
     192{
     193    return m_data->colorRange;
     194}
     195
     196/*!
     197   Assign a pen width
     198
     199   \param penWidth New pen width
     200   \sa penWidth()
     201 */
    200202void QwtPlotSpectroCurve::setPenWidth(double penWidth)
    201203{
    … …  
    203205        penWidth = 0.0;
    204206
    205     if ( d_data->penWidth != penWidth )
    206     {
    207         d_data->penWidth = penWidth;
     207    if ( m_data->penWidth != penWidth )
     208    {
     209        m_data->penWidth = penWidth;
    208210
    209211        legendChanged();
    … …  
    213215
    214216/*!
    215   \return Pen width used to draw a dot
    216   \sa setPenWidth()
    217 */
     217   \return Pen width used to draw a dot
     218   \sa setPenWidth()
     219 */
    218220double QwtPlotSpectroCurve::penWidth() const
    219221{
    220     return d_data->penWidth;
    221 }
    222 
    223 /*!
    224   Draw a subset of the points
    225 
    226   \param painter Painter
    227   \param xMap Maps x-values into pixel coordinates.
    228   \param yMap Maps y-values into pixel coordinates.
    229   \param canvasRect Contents rectangle of the canvas
    230   \param from Index of the first sample to be painted
    231   \param to Index of the last sample to be painted. If to < 0 the
     222    return m_data->penWidth;
     223}
     224
     225/*!
     226   Draw a subset of the points
     227
     228   \param painter Painter
     229   \param xMap Maps x-values into pixel coordinates.
     230   \param yMap Maps y-values into pixel coordinates.
     231   \param canvasRect Contents rectangle of the canvas
     232   \param from Index of the first sample to be painted
     233   \param to Index of the last sample to be painted. If to < 0 the
    232234         series will be painted to its last sample.
    233235
    234   \sa drawDots()
    235 */
    236 void QwtPlotSpectroCurve::drawSeries( QPainter *painter,
    237     const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    238     const QRectF &canvasRect, int from, int to ) const
     236   \sa drawDots()
     237 */
     238void QwtPlotSpectroCurve::drawSeries( QPainter* painter,
     239    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     240    const QRectF& canvasRect, int from, int to ) const
    239241{
    240242    if ( !painter || dataSize() <= 0 )
    … …  
    254256
    255257/*!
    256   Draw a subset of the points
    257 
    258   \param painter Painter
    259   \param xMap Maps x-values into pixel coordinates.
    260   \param yMap Maps y-values into pixel coordinates.
    261   \param canvasRect Contents rectangle of the canvas
    262   \param from Index of the first sample to be painted
    263   \param to Index of the last sample to be painted. If to < 0 the
     258   Draw a subset of the points
     259
     260   \param painter Painter
     261   \param xMap Maps x-values into pixel coordinates.
     262   \param yMap Maps y-values into pixel coordinates.
     263   \param canvasRect Contents rectangle of the canvas
     264   \param from Index of the first sample to be painted
     265   \param to Index of the last sample to be painted. If to < 0 the
    264266         series will be painted to its last sample.
    265267
    266   \sa drawSeries()
    267 */
    268 void QwtPlotSpectroCurve::drawDots( QPainter *painter,
    269     const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    270     const QRectF &canvasRect, int from, int to ) const
    271 {
    272     if ( !d_data->colorRange.isValid() )
     268   \sa drawSeries()
     269 */
     270void QwtPlotSpectroCurve::drawDots( QPainter* painter,
     271    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     272    const QRectF& canvasRect, int from, int to ) const
     273{
     274    if ( !m_data->colorRange.isValid() )
    273275        return;
    274276
    275277    const bool doAlign = QwtPainter::roundingAlignment( painter );
    276278
    277     const QwtColorMap::Format format = d_data->colorMap->format();
     279    const QwtColorMap::Format format = m_data->colorMap->format();
    278280    if ( format == QwtColorMap::Indexed )
    279         d_data->colorTable = d_data->colorMap->colorTable( d_data->colorRange );
    280 
    281     const QwtSeriesData<QwtPoint3D> *series = data();
     281        m_data->colorTable = m_data->colorMap->colorTable256();
     282
     283    const QwtSeriesData< QwtPoint3D >* series = data();
    282284
    283285    for ( int i = from; i <= to; i++ )
    … …  
    293295        }
    294296
    295         if ( d_data->paintAttributes & QwtPlotSpectroCurve::ClipPoints )
     297        if ( m_data->paintAttributes & QwtPlotSpectroCurve::ClipPoints )
    296298        {
    297299            if ( !canvasRect.contains( xi, yi ) )
    … …  
    301303        if ( format == QwtColorMap::RGB )
    302304        {
    303             const QRgb rgb = d_data->colorMap->rgb(
    304                 d_data->colorRange, sample.z() );
    305 
    306             painter->setPen( QPen( QColor::fromRgba( rgb ), d_data->penWidth ) );
     305            const QRgb rgb = m_data->colorMap->rgb(
     306                m_data->colorRange, sample.z() );
     307
     308            painter->setPen( QPen( QColor::fromRgba( rgb ), m_data->penWidth ) );
    307309        }
    308310        else
    309311        {
    310             const unsigned char index = d_data->colorMap->colorIndex(
    311                 d_data->colorRange, sample.z() );
    312 
    313             painter->setPen( QPen( QColor::fromRgba( d_data->colorTable[index] ),
    314                 d_data->penWidth ) );
     312            const unsigned char index = m_data->colorMap->colorIndex(
     313                256, m_data->colorRange, sample.z() );
     314
     315            painter->setPen( QPen( QColor::fromRgba( m_data->colorTable[index] ),
     316                m_data->penWidth ) );
    315317        }
    316318
    … …  
    318320    }
    319321
    320     d_data->colorTable.clear();
    321 }
     322    m_data->colorTable.clear();
     323}
Note: See TracChangeset for help on using the changeset viewer.