Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_matrix_raster_data.cpp
- Timestamp:
- May 10, 2017, 3:20:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_matrix_raster_data.cpp
r4271 r8127 21 21 } 22 22 23 inline double value( size_t row, size_t col) const23 inline double value(int row, int col) const 24 24 { 25 25 return values.data()[ row * numColumns + col ]; … … 29 29 30 30 QVector<double> values; 31 size_t numColumns;32 size_t numRows;31 int numColumns; 32 int numRows; 33 33 34 34 double dx; … … 55 55 \sa resampleMode(), value() 56 56 */ 57 void QwtMatrixRasterData::setResampleMode( ResampleMode mode)57 void QwtMatrixRasterData::setResampleMode( ResampleMode mode ) 58 58 { 59 59 d_data->resampleMode = mode; … … 106 106 */ 107 107 void QwtMatrixRasterData::setValueMatrix( 108 const QVector<double> &values, size_t numColumns )108 const QVector<double> &values, int numColumns ) 109 109 { 110 110 d_data->values = values; 111 d_data->numColumns = numColumns;111 d_data->numColumns = qMax( numColumns, 0 ); 112 112 update(); 113 113 } … … 123 123 124 124 /*! 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 */ 133 void 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 /*! 125 144 \return Number of columns of the value matrix 126 145 \sa valueMatrix(), numRows(), setValueMatrix() 127 146 */ 128 size_t QwtMatrixRasterData::numColumns() const147 int QwtMatrixRasterData::numColumns() const 129 148 { 130 149 return d_data->numColumns; … … 135 154 \sa valueMatrix(), numColumns(), setValueMatrix() 136 155 */ 137 size_t QwtMatrixRasterData::numRows() const156 int QwtMatrixRasterData::numRows() const 138 157 { 139 158 return d_data->numRows; … … 141 160 142 161 /*! 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. 144 167 145 168 - NearestNeighbour\n … … 151 174 to render in target device ( f.e. screen ) resolution. 152 175 176 \param area Requested area, ignored 177 \return Calculated hint 178 153 179 \sa ResampleMode, setMatrix(), setInterval() 154 180 */ 155 QRectF QwtMatrixRasterData::pixelHint( const QRectF & ) const 156 { 181 QRectF QwtMatrixRasterData::pixelHint( const QRectF &area ) const 182 { 183 Q_UNUSED( area ) 184 157 185 QRectF rect; 158 186 if ( d_data->resampleMode == NearestNeighbour ) … … 199 227 if ( col1 < 0 ) 200 228 col1 = col2; 201 else if ( col2 >= (int)d_data->numColumns)229 else if ( col2 >= static_cast<int>( d_data->numColumns ) ) 202 230 col2 = col1; 203 231 204 232 if ( row1 < 0 ) 205 233 row1 = row2; 206 else if ( row2 >= (int)d_data->numRows)234 else if ( row2 >= static_cast<int>( d_data->numRows ) ) 207 235 row2 = row1; 208 236 … … 230 258 default: 231 259 { 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 ); 234 262 235 263 // In case of intervals, where the maximum is included
Note:
See TracChangeset
for help on using the changeset viewer.