Ignore:
Timestamp:
May 10, 2017, 3:20:54 PM (7 years ago)
Author:
stoecker
Message:

update qwt and qwtpolar, many QT5 fixes (unfinished)

File:
1 edited

Legend:

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

    r4271 r8127  
    2121    }
    2222
    23     inline double value(size_t row, size_t col) const
     23    inline double value(int row, int col) const
    2424    {
    2525        return values.data()[ row * numColumns + col ];
     
    2929
    3030    QVector<double> values;
    31     size_t numColumns;
    32     size_t numRows;
     31    int numColumns;
     32    int numRows;
    3333
    3434    double dx;
     
    5555   \sa resampleMode(), value()
    5656*/
    57 void QwtMatrixRasterData::setResampleMode(ResampleMode mode)
     57void QwtMatrixRasterData::setResampleMode( ResampleMode mode )
    5858{
    5959    d_data->resampleMode = mode;
     
    106106*/
    107107void QwtMatrixRasterData::setValueMatrix(
    108     const QVector<double> &values, size_t numColumns )
     108    const QVector<double> &values, int numColumns )
    109109{
    110110    d_data->values = values;
    111     d_data->numColumns = numColumns;
     111    d_data->numColumns = qMax( numColumns, 0 );
    112112    update();
    113113}
     
    123123
    124124/*!
     125  \brief Change a single value in the matrix
     126
     127  \param row Row index
     128  \param col Column index
     129  \param value New value
     130
     131  \sa value(), setValueMatrix()
     132*/
     133void QwtMatrixRasterData::setValue( int row, int col, double value )
     134{
     135    if ( row >= 0 && row < d_data->numRows &&
     136        col >= 0 && col < d_data->numColumns )
     137    {
     138        const int index = row * d_data->numColumns + col;
     139        d_data->values.data()[ index ] = value;
     140    }
     141}
     142
     143/*!
    125144   \return Number of columns of the value matrix
    126145   \sa valueMatrix(), numRows(), setValueMatrix()
    127146*/
    128 size_t QwtMatrixRasterData::numColumns() const
     147int QwtMatrixRasterData::numColumns() const
    129148{
    130149    return d_data->numColumns;
     
    135154   \sa valueMatrix(), numColumns(), setValueMatrix()
    136155*/
    137 size_t QwtMatrixRasterData::numRows() const
     156int QwtMatrixRasterData::numRows() const
    138157{
    139158    return d_data->numRows;
     
    141160
    142161/*!
    143    \brief Pixel hint
     162   \brief Calculate the pixel hint
     163
     164   pixelHint() returns the geometry of a pixel, that can be used
     165   to calculate the resolution and alignment of the plot item, that is
     166   representing the data.
    144167
    145168   - NearestNeighbour\n
     
    151174     to render in target device ( f.e. screen ) resolution.
    152175
     176   \param area Requested area, ignored
     177   \return Calculated hint
     178
    153179   \sa ResampleMode, setMatrix(), setInterval()
    154180*/
    155 QRectF QwtMatrixRasterData::pixelHint( const QRectF & ) const
    156 {
     181QRectF QwtMatrixRasterData::pixelHint( const QRectF &area ) const
     182{
     183    Q_UNUSED( area )
     184
    157185    QRectF rect;
    158186    if ( d_data->resampleMode == NearestNeighbour )
     
    199227            if ( col1 < 0 )
    200228                col1 = col2;
    201             else if ( col2 >= (int)d_data->numColumns )
     229            else if ( col2 >= static_cast<int>( d_data->numColumns ) )
    202230                col2 = col1;
    203231
    204232            if ( row1 < 0 )
    205233                row1 = row2;
    206             else if ( row2 >= (int)d_data->numRows )
     234            else if ( row2 >= static_cast<int>( d_data->numRows ) )
    207235                row2 = row1;
    208236
     
    230258        default:
    231259        {
    232             uint row = uint( (y - yInterval.minValue() ) / d_data->dy );
    233             uint col = uint( (x - xInterval.minValue() ) / d_data->dx );
     260            int row = int( (y - yInterval.minValue() ) / d_data->dy );
     261            int col = int( (x - xInterval.minValue() ) / d_data->dx );
    234262
    235263            // In case of intervals, where the maximum is included
Note: See TracChangeset for help on using the changeset viewer.