Qwt User's Guide  6.1.3
QwtMatrixRasterData Class Reference

A class representing a matrix of values as raster data. More...

#include <qwt_matrix_raster_data.h>

Inheritance diagram for QwtMatrixRasterData:

Public Types

enum  ResampleMode { NearestNeighbour, BilinearInterpolation }
 Resampling algorithm The default setting is NearestNeighbour;. More...
- Public Types inherited from QwtRasterData
enum  ConrecFlag { IgnoreAllVerticesOnLevel = 0x01, IgnoreOutOfRange = 0x02 }
 Flags to modify the contour algorithm. More...
typedef QMap< double, QPolygonF > ContourLines
 Contour lines.
typedef QFlags< ConrecFlagConrecFlags
 Flags to modify the contour algorithm.

Public Member Functions

 QwtMatrixRasterData ()
virtual ~QwtMatrixRasterData ()
void setResampleMode (ResampleMode mode)
 Set the resampling algorithm. More...
ResampleMode resampleMode () const
virtual void setInterval (Qt::Axis, const QwtInterval &)
 Assign the bounding interval for an axis. More...
void setValueMatrix (const QVector< double > &values, int numColumns)
 Assign a value matrix. More...
const QVector< double > valueMatrix () const
void setValue (int row, int col, double value)
 Change a single value in the matrix. More...
int numColumns () const
int numRows () const
virtual QRectF pixelHint (const QRectF &) const
 Calculate the pixel hint. More...
virtual double value (double x, double y) const
- Public Member Functions inherited from QwtRasterData
 QwtRasterData ()
virtual ~QwtRasterData ()
const QwtIntervalinterval (Qt::Axis) const
virtual void initRaster (const QRectF &, const QSize &raster)
 Initialize a raster. More...
virtual void discardRaster ()
 Discard a raster. More...
virtual ContourLines contourLines (const QRectF &rect, const QSize &raster, const QList< double > &levels, ConrecFlags) const

Detailed Description

A class representing a matrix of values as raster data.

QwtMatrixRasterData implements an interface for a matrix of equidistant values, that can be used by a QwtPlotRasterItem. It implements a couple of resampling algorithms, to provide values for positions, that or not on the value matrix.

Member Enumeration Documentation

Resampling algorithm The default setting is NearestNeighbour;.


Return the value from the matrix, that is nearest to the the requested position.


Interpolate the value from the distances and values of the 4 surrounding values in the matrix,

Member Function Documentation

int QwtMatrixRasterData::numColumns ( ) const
Number of columns of the value matrix
See also
valueMatrix(), numRows(), setValueMatrix()
int QwtMatrixRasterData::numRows ( ) const
Number of rows of the value matrix
See also
valueMatrix(), numColumns(), setValueMatrix()
QRectF QwtMatrixRasterData::pixelHint ( const QRectF &  area) const

Calculate the pixel hint.

pixelHint() returns the geometry of a pixel, that can be used to calculate the resolution and alignment of the plot item, that is representing the data.

  • NearestNeighbour
    pixelHint() returns the surrounding pixel of the top left value in the matrix.
  • BilinearInterpolation
    Returns an empty rectangle recommending to render in target device ( f.e. screen ) resolution.
areaRequested area, ignored
Calculated hint
See also
ResampleMode, setMatrix(), setInterval()

Reimplemented from QwtRasterData.

QwtMatrixRasterData::ResampleMode QwtMatrixRasterData::resampleMode ( ) const
resampling algorithm
See also
setResampleMode(), value()
void QwtMatrixRasterData::setInterval ( Qt::Axis  axis,
const QwtInterval interval 

Assign the bounding interval for an axis.

Setting the bounding intervals for the X/Y axis is mandatory to define the positions for the values of the value matrix. The interval in Z direction defines the possible range for the values in the matrix, what is f.e used by QwtPlotSpectrogram to map values to colors. The Z-interval might be the bounding interval of the values in the matrix, but usually it isn't. ( f.e a interval of 0.0-100.0 for values in percentage )

axisX, Y or Z axis
See also
QwtRasterData::interval(), setValueMatrix()

Reimplemented from QwtRasterData.

void QwtMatrixRasterData::setResampleMode ( ResampleMode  mode)

Set the resampling algorithm.

modeResampling mode
See also
resampleMode(), value()
void QwtMatrixRasterData::setValue ( int  row,
int  col,
double  value 

Change a single value in the matrix.

rowRow index
colColumn index
valueNew value
See also
value(), setValueMatrix()
void QwtMatrixRasterData::setValueMatrix ( const QVector< double > &  values,
int  numColumns 

Assign a value matrix.

The positions of the values are calculated by dividing the bounding rectangle of the X/Y intervals into equidistant rectangles ( pixels ). Each value corresponds to the center of a pixel.

valuesVector of values
numColumnsNumber of columns
See also
valueMatrix(), numColumns(), numRows(), setInterval()()
double QwtMatrixRasterData::value ( double  x,
double  y 
) const
the value at a raster position
xX value in plot coordinates
yY value in plot coordinates
See also

Implements QwtRasterData.

const QVector< double > QwtMatrixRasterData::valueMatrix ( ) const
Value matrix
See also
setValueMatrix(), numColumns(), numRows(), setInterval()