# QwtMatrixRasterData Class Reference

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

`#include <qwt_matrix_raster_data.h>`

Inheritance diagram for QwtMatrixRasterData:
[legend]

List of all members.

## Public Types

enum | ConrecFlag { IgnoreAllVerticesOnLevel = 0x01, IgnoreOutOfRange = 0x02 }
typedef QFlags< ConrecFlag > | ConrecFlags
typedef QMap< double, QPolygonF > | ContourLines
enum | ResampleMode { NearestNeighbour, BilinearInterpolation }

## Public Member Functions

virtual ContourLines | contourLines (const QRectF &rect, const QSize &raster, const QList< double > &levels, ConrecFlags) const
virtual void | discardRaster ()
virtual void | initRaster (const QRectF &, const QSize &raster)
const QwtInterval & | interval (Qt::Axis) const
size_t | numColumns () const
size_t | numRows () const
virtual QRectF | pixelHint (const QRectF &) const
| QwtMatrixRasterData ()
ResampleMode | resampleMode () const
virtual void | setInterval (Qt::Axis, const QwtInterval &)
void | setResampleMode (ResampleMode mode)
void | setValueMatrix (const QVector< double > &values, size_t numColumns)
virtual double | value (double x, double y) const
const QVector< double > | valueMatrix () const
virtual | ~QwtMatrixRasterData ()

## 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 Typedef Documentation

typedef QFlags<ConrecFlag> QwtRasterData::ConrecFlags `[inherited]`

Flags to modify the contour algorithm.

typedef QMap<double, QPolygonF> QwtRasterData::ContourLines `[inherited]`

Contour lines.

## Member Enumeration Documentation

enum QwtRasterData::ConrecFlag `[inherited]`

Flags to modify the contour algorithm.

Enumerator:

  IgnoreAllVerticesOnLevel | Ignore all verices on the same level.
  IgnoreOutOfRange | Ignore all values, that are out of range.

enum QwtMatrixRasterData::ResampleMode

Resampling algorithm The default setting is NearestNeighbour;.

Enumerator:

  NearestNeighbour | Return the value from the matrix, that is nearest to the the requested position.
  BilinearInterpolation | Interpolate the value from the distances and values of the 4 surrounding values in the matrix,

## Constructor & Destructor Documentation

QwtMatrixRasterData::QwtMatrixRasterData | ( |  | ) |

Constructor.

QwtMatrixRasterData::~QwtMatrixRasterData | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

QwtRasterData::ContourLines QwtRasterData::contourLines | ( | const QRectF & | rect,
|  | const QSize & | raster,
|  | const QList< double > & | levels,
|  | ConrecFlags | flags
| ) |  | const`[virtual, inherited]`

Calculate contour lines

An adaption of CONREC, a simple contouring algorithm. http://local.wasp.uwa.edu.au/~pbourke/papers/conrec/

void QwtRasterData::discardRaster | ( |  | ) | `[virtual, inherited]`

Discard a raster.

After the composition of an image QwtPlotSpectrogram calls discardRaster().

The default implementation does nothing, but if data has been loaded in initRaster(), it could deleted now.

See also:
  initRaster(), value()

void QwtRasterData::initRaster | ( | const QRectF & | area,
|  | const QSize & | raster
| ) |  | `[virtual, inherited]`

Initialize a raster.

Before the composition of an image QwtPlotSpectrogram calls initRaster, announcing the area and its resolution that will be requested.

The default implementation does nothing, but for data sets that are stored in files, it might be good idea to reimplement initRaster, where the data is resampled and loaded into memory.

Parameters:

  area | Area of the raster
  raster | Number of horizontal and vertical pixels

See also:
  initRaster(), value()

const QwtInterval & QwtRasterData::interval | ( | Qt::Axis | axis | ) | const`[inline, inherited]`

Returns:
  Bounding interval for a axis

See also:
  setInterval

size_t QwtMatrixRasterData::numColumns | ( |  | ) | const

Returns:
  Number of columns of the value matrix

See also:
  valueMatrix(), numRows(), setValueMatrix()

size_t QwtMatrixRasterData::numRows | ( |  | ) | const

Returns:
  Number of rows of the value matrix

See also:
  valueMatrix(), numColumns(), setValueMatrix()

QRectF QwtMatrixRasterData::pixelHint | ( | const QRectF & |  | ) | const`[virtual]`

Pixel hint.

- 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.

See also:
  ResampleMode, setMatrix(), setInterval()

Reimplemented from QwtRasterData.

QwtMatrixRasterData::ResampleMode QwtMatrixRasterData::resampleMode | ( |  | ) | const

Returns:
  resampling algorithm

See also:
  setResampleMode(), value()

void QwtMatrixRasterData::setInterval | ( | Qt::Axis | axis,
|  | const QwtInterval & | interval
| ) |  | `[virtual]`

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 )

Parameters:

  axis | X, Y or Z axis
  interval | Interval

See also:
  QwtRasterData::interval(), setValueMatrix()

Reimplemented from QwtRasterData.

void QwtMatrixRasterData::setResampleMode | ( | ResampleMode | mode | ) |

Set the resampling algorithm.

Parameters:

  mode | Resampling mode

See also:
  resampleMode(), value()

void QwtMatrixRasterData::setValueMatrix | ( | const QVector< double > & | values,
|  | size_t | 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.

Parameters:

  values | Vector of values
  numColumns | Number of columns

See also:
  valueMatrix(), numColumns(), numRows(), setInterval()()

double QwtMatrixRasterData::value | ( | double | x,
|  | double | y
| ) |  | const`[virtual]`

Returns:
  the value at a raster position

Parameters:

  x | X value in plot coordinates
  y | Y value in plot coordinates

See also:
  ResampleMode

Implements QwtRasterData.

const QVector< double > QwtMatrixRasterData::valueMatrix | ( |  | ) | const

Returns:
  Value matrix

See also:
  setValueMatrix(), numColumns(), numRows(), setInterval()