A plot item, which displays a spectrogram. More...
#include <qwt_plot_spectrogram.h>
Public Types | |
enum | DisplayMode { ImageMode = 1, ContourMode = 2 } |
Public Member Functions | |
QwtPlotSpectrogram (const QString &title=QString::null) | |
virtual | ~QwtPlotSpectrogram () |
void | setRenderThreadCount (uint numThreads) |
uint | renderThreadCount () const |
void | setDisplayMode (DisplayMode, bool on=true) |
bool | testDisplayMode (DisplayMode) const |
void | setData (QwtRasterData *data) |
const QwtRasterData * | data () const |
QwtRasterData * | data () |
void | setColorMap (QwtColorMap *) |
const QwtColorMap * | colorMap () const |
virtual QwtInterval | interval (Qt::Axis) const |
virtual QRectF | pixelHint (const QRectF &) const |
void | setDefaultContourPen (const QPen &) |
QPen | defaultContourPen () const |
virtual QPen | contourPen (double level) const |
void | setConrecAttribute (QwtRasterData::ConrecAttribute, bool on) |
bool | testConrecAttribute (QwtRasterData::ConrecAttribute) const |
void | setContourLevels (const QList< double > &) |
QList< double > | contourLevels () const |
virtual int | rtti () const |
virtual void | draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &rect) const |
Protected Member Functions | |
virtual QImage | renderImage (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &area, const QSize &imageSize) const |
virtual QSize | contourRasterSize (const QRectF &, const QRect &) const |
virtual QwtRasterData::ContourLines | renderContourLines (const QRectF &rect, const QSize &raster) const |
virtual void | drawContourLines (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtRasterData::ContourLines &lines) const |
void | renderTile (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &imageRect, QImage *image) const |
A plot item, which displays a spectrogram.
A spectrogram displays threedimenional data, where the 3rd dimension ( the intensity ) is displayed using colors. The colors are calculated from the values using a color map.
In ContourMode contour lines are painted for the contour levels.
The display mode controls how the raster data will be represented.
When both modes are enabled the contour lines are painted on top of the spectrogram. The default setting enables ImageMode.
QwtPlotSpectrogram::QwtPlotSpectrogram | ( | const QString & | title = QString::null |
) | [explicit] |
Sets the following item attributes:
The z value is initialized by 8.0.
title | Title |
QwtPlotSpectrogram::~QwtPlotSpectrogram | ( | ) | [virtual] |
Destructor.
const QwtColorMap * QwtPlotSpectrogram::colorMap | ( | ) | const |
QList< double > QwtPlotSpectrogram::contourLevels | ( | ) | const |
Return the levels of the contour lines.
The levels are sorted in increasing order.
QPen QwtPlotSpectrogram::contourPen | ( | double | level | ) | const [virtual] |
Calculate the pen for a contour line.
The color of the pen is the color for level calculated by the color map
level | Contour level |
QSize QwtPlotSpectrogram::contourRasterSize | ( | const QRectF & | area, | |
const QRect & | rect | |||
) | const [protected, virtual] |
Return the raster to be used by the CONREC contour algorithm.
A larger size will improve the precisision of the CONREC algorithm, but will slow down the time that is needed to calculate the lines.
The default implementation returns rect.size() / 2 bounded to the resolution depending on pixelSize().
area | Rect, where to calculate the contour lines | |
rect | Rect in pixel coordinates, where to paint the contour lines |
QwtRasterData * QwtPlotSpectrogram::data | ( | ) |
const QwtRasterData * QwtPlotSpectrogram::data | ( | ) | const |
QPen QwtPlotSpectrogram::defaultContourPen | ( | ) | const |
void QwtPlotSpectrogram::draw | ( | QPainter * | painter, | |
const QwtScaleMap & | xMap, | |||
const QwtScaleMap & | yMap, | |||
const QRectF & | canvasRect | |||
) | const [virtual] |
Draw the spectrogram.
painter | Painter | |
xMap | Maps x-values into pixel coordinates. | |
yMap | Maps y-values into pixel coordinates. | |
canvasRect | Contents rect of the canvas in painter coordinates |
Reimplemented from QwtPlotRasterItem.
void QwtPlotSpectrogram::drawContourLines | ( | QPainter * | painter, | |
const QwtScaleMap & | xMap, | |||
const QwtScaleMap & | yMap, | |||
const QwtRasterData::ContourLines & | contourLines | |||
) | const [protected, virtual] |
Paint the contour lines
painter | Painter | |
xMap | Maps x-values into pixel coordinates. | |
yMap | Maps y-values into pixel coordinates. | |
contourLines | Contour lines |
QwtInterval QwtPlotSpectrogram::interval | ( | Qt::Axis | axis | ) | const [virtual] |
The default implementation returns the interval of the associated raster data object.
axis | X, Y, or Z axis |
Reimplemented from QwtPlotRasterItem.
QRectF QwtPlotSpectrogram::pixelHint | ( | const QRectF & | area | ) | const [virtual] |
Pixel hint.
The geometry of a pixel is used to calculated the resolution and alignment of the rendered image.
The default implementation returns data()->pixelHint( rect );
area | In most implementations the resolution of the data doesn't depend on the requested area. |
Reimplemented from QwtPlotRasterItem.
QwtRasterData::ContourLines QwtPlotSpectrogram::renderContourLines | ( | const QRectF & | rect, | |
const QSize & | raster | |||
) | const [protected, virtual] |
Calculate contour lines
rect | Rectangle, where to calculate the contour lines | |
raster | Raster, used by the CONREC algorithm |
QImage QwtPlotSpectrogram::renderImage | ( | const QwtScaleMap & | xMap, | |
const QwtScaleMap & | yMap, | |||
const QRectF & | area, | |||
const QSize & | imageSize | |||
) | const [protected, virtual] |
Render an image from data and color map.
For each pixel of rect the intensity is mapped into a color.
xMap | X-Scale Map | |
yMap | Y-Scale Map | |
area | Requested area for the image in scale coordinates | |
imageSize | Size of the requested image |
Implements QwtPlotRasterItem.
uint QwtPlotSpectrogram::renderThreadCount | ( | ) | const |
void QwtPlotSpectrogram::renderTile | ( | const QwtScaleMap & | xMap, | |
const QwtScaleMap & | yMap, | |||
const QRect & | tile, | |||
QImage * | image | |||
) | const [protected] |
Render a tile of an image.
Rendering in tiles can be used to composite an image in parallel threads.
xMap | X-Scale Map | |
yMap | Y-Scale Map | |
tile | Geometry of the tile in image coordinates | |
image | Image to be rendered |
int QwtPlotSpectrogram::rtti | ( | ) | const [virtual] |
Reimplemented from QwtPlotItem.
void QwtPlotSpectrogram::setColorMap | ( | QwtColorMap * | colorMap | ) |
Change the color map
Often it is useful to display the mapping between intensities and colors as an additional plot axis, showing a color bar.
colorMap | Color Map |
void QwtPlotSpectrogram::setConrecAttribute | ( | QwtRasterData::ConrecAttribute | attribute, | |
bool | on | |||
) |
Modify an attribute of the CONREC algorithm, used to calculate the contour lines.
attribute | CONREC attribute | |
on | On/Off |
void QwtPlotSpectrogram::setContourLevels | ( | const QList< double > & | levels | ) |
Set the levels of the contour lines
levels | Values of the contour levels |
void QwtPlotSpectrogram::setData | ( | QwtRasterData * | data | ) |
void QwtPlotSpectrogram::setDefaultContourPen | ( | const QPen & | pen | ) |
Set the default pen for the contour lines.
If the spectrogram has a valid default contour pen a contour line is painted using the default contour pen. Otherwise (pen.style() == Qt::NoPen) the pen is calculated for each contour level using contourPen().
void QwtPlotSpectrogram::setDisplayMode | ( | DisplayMode | mode, | |
bool | on = true | |||
) |
The display mode controls how the raster data will be represented.
mode | Display mode | |
on | On/Off |
The default setting enables ImageMode.
void QwtPlotSpectrogram::setRenderThreadCount | ( | uint | numThreads | ) |
Rendering an image from the raster data can often be done parallel on a multicore system.
numThreads | Number of threads to be used for rendering. If numThreads is set to 0, the system specific ideal thread count is used. |
The default thread count is 1 ( = no additional threads )
bool QwtPlotSpectrogram::testConrecAttribute | ( | QwtRasterData::ConrecAttribute | attribute | ) | const |
Test an attribute of the CONREC algorithm, used to calculate the contour lines.
attribute | CONREC attribute |
bool QwtPlotSpectrogram::testDisplayMode | ( | DisplayMode | mode | ) | const |
The display mode controls how the raster data will be represented.
mode | Display mode |