QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
QwtMatrixRasterData Class Reference

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

#include <qwt_matrix_raster_data.h>

Inheritance diagram for QwtMatrixRasterData:
QwtRasterData

Classes

class  PrivateData
 

Public Types

enum  ResampleMode { NearestNeighbour , BilinearInterpolation , BicubicInterpolation }
 Resampling algorithm. More...
 
- Public Types inherited from QwtRasterData
enum  Attribute { WithoutGaps = 0x01 }
 Raster data attributes. More...
 
enum  ConrecFlag { IgnoreAllVerticesOnLevel = 0x01 , IgnoreOutOfRange = 0x02 }
 Flags to modify the contour algorithm. More...
 
using ContourLines = QMap< double, QPolygonF >
 Contour lines.
 

Public Member Functions

 QwtMatrixRasterData ()
 Constructor.
 
void setResampleMode (ResampleMode mode)
 Set the resampling algorithm.
 
ResampleMode resampleMode () const
 Return the resampling algorithm.
 
void setInterval (Qt::Axis, const QwtInterval &)
 Assign the bounding interval for an axis.
 
virtual QwtInterval interval (Qt::Axis axis) const override final
 Return bounding interval for an axis.
 
void setValueMatrix (const QVector< double > &values, int numColumns)
 Assign a value matrix.
 
const QVector< double > valueMatrix () const
 Return value matrix.
 
void setValue (int row, int col, double value)
 Change a single value in the matrix.
 
int numColumns () const
 Return number of columns of the value matrix.
 
int numRows () const
 Return number of rows of the value matrix.
 
virtual QRectF pixelHint (const QRectF &) const override
 Calculate the pixel hint.
 
virtual double value (double x, double y) const override
 Return the value at a raster position.
 
- Public Member Functions inherited from QwtRasterData
 QwtRasterData ()
 Constructor.
 
virtual ~QwtRasterData ()
 Destructor.
 
void setAttribute (Attribute, bool on=true)
 Set an attribute.
 
bool testAttribute (Attribute) const
 Test an attribute.
 
virtual void initRaster (const QRectF &, const QSize &raster)
 Initialize the raster.
 
virtual void discardRaster ()
 Discard the raster.
 
virtual ContourLines contourLines (const QRectF &rect, const QSize &raster, const QList< double > &levels, ConrecFlags) const
 Calculate contour lines.
 

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

◆ ResampleMode

Resampling algorithm.

The default setting is NearestNeighbour.

Enumerator
NearestNeighbour 

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

BilinearInterpolation 

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

BicubicInterpolation 

Interpolate the value from the 16 surrounding values in the matrix using hermite bicubic interpolation.

Constructor & Destructor Documentation

◆ QwtMatrixRasterData()

QwtMatrixRasterData::QwtMatrixRasterData ( )

Constructor.

Destructor

Member Function Documentation

◆ interval()

QwtInterval QwtMatrixRasterData::interval ( Qt::Axis  axis) const
finaloverridevirtual

Return bounding interval for an axis.

Parameters
[in]axisAxis to query.
Returns
Bounding interval for the axis.
See also
setInterval()

Implements QwtRasterData.

◆ numColumns()

int QwtMatrixRasterData::numColumns ( ) const

Return number of columns of the value matrix.

Returns
Number of columns.
See also
valueMatrix(), numRows(), setValueMatrix()

◆ numRows()

int QwtMatrixRasterData::numRows ( ) const

Return number of rows of the value matrix.

Returns
Number of rows.
See also
valueMatrix(), numColumns(), setValueMatrix()

◆ pixelHint()

QRectF QwtMatrixRasterData::pixelHint ( const QRectF &  area) const
overridevirtual

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 resolution.
    Parameters
    [in]areaRequested area, ignored.
    Returns
    Calculated hint.
    See also
    ResampleMode, setMatrix(), setInterval()

Reimplemented from QwtRasterData.

◆ resampleMode()

QwtMatrixRasterData::ResampleMode QwtMatrixRasterData::resampleMode ( ) const

Return the resampling algorithm.

Returns
Resampling algorithm.
See also
setResampleMode(), value()

◆ setInterval()

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

Parameters
[in]axisX, Y or Z axis.
[in]intervalInterval.
See also
QwtRasterData::interval(), setValueMatrix()

◆ setResampleMode()

void QwtMatrixRasterData::setResampleMode ( ResampleMode  mode)

Set the resampling algorithm.

Parameters
[in]modeResampling mode.
See also
resampleMode(), value()

◆ setValue()

void QwtMatrixRasterData::setValue ( int  row,
int  col,
double  value 
)

Change a single value in the matrix.

Parameters
[in]rowRow index.
[in]colColumn index.
[in]valueNew value.
See also
value(), setValueMatrix()

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

Parameters
[in]valuesVector of values.
[in]numColumnsNumber of columns.
See also
valueMatrix(), numColumns(), numRows(), setInterval()

◆ value()

double QwtMatrixRasterData::value ( double  x,
double  y 
) const
overridevirtual

Return the value at a raster position.

Parameters
[in]xX value in plot coordinates.
[in]yY value in plot coordinates.
Returns
Value at the position.
See also
ResampleMode

Implements QwtRasterData.

◆ valueMatrix()

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

Return value matrix.

Returns
Value matrix.
See also
setValueMatrix(), numColumns(), numRows(), setInterval()

The documentation for this class was generated from the following files: