Classes | Public Types | Public Member Functions | Protected Member Functions | Private Attributes
QwtPlotSpectrogram Class Reference

A plot item, which displays a spectrogram. More...

#include <qwt_plot_spectrogram.h>

Inheritance diagram for QwtPlotSpectrogram:
Inheritance graph
[legend]

List of all members.

Classes

class  PrivateData

Public Types

enum  DisplayMode { ImageMode = 0x01, ContourMode = 0x02 }
typedef QFlags< DisplayModeDisplayModes
 Display modes.

Public Member Functions

const QwtColorMapcolorMap () const
QList< double > contourLevels () const
virtual QPen contourPen (double level) const
 Calculate the pen for a contour line.
const QwtRasterDatadata () const
QwtRasterDatadata ()
QPen defaultContourPen () const
virtual void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &rect) const
 Draw the spectrogram.
virtual QwtInterval interval (Qt::Axis) const
int maxRGBTableSize () const
virtual QRectF pixelHint (const QRectF &) const
 Pixel hint.
 QwtPlotSpectrogram (const QString &title=QString::null)
virtual int rtti () const
void setColorMap (QwtColorMap *)
void setConrecFlag (QwtRasterData::ConrecFlag, bool on)
void setContourLevels (const QList< double > &)
void setData (QwtRasterData *data)
void setDefaultContourPen (const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)
void setDefaultContourPen (const QPen &)
 Set the default pen for the contour lines.
void setDisplayMode (DisplayMode, bool on=true)
void setMaxRGBTableSize (int numColors)
bool testConrecFlag (QwtRasterData::ConrecFlag) const
bool testDisplayMode (DisplayMode) const
virtual ~QwtPlotSpectrogram ()
 Destructor.

Protected Member Functions

virtual QSize contourRasterSize (const QRectF &, const QRect &) const
 Return the raster to be used by the CONREC contour algorithm.
virtual void drawContourLines (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtRasterData::ContourLines &lines) const
virtual QwtRasterData::ContourLines renderContourLines (const QRectF &rect, const QSize &raster) const
virtual QImage renderImage (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &area, const QSize &imageSize) const
 Render an image from data and color map.
void renderTile (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &imageRect, QImage *image) const
 Render a tile of an image.

Private Attributes

PrivateDatad_data

Detailed Description

A plot item, which displays a spectrogram.

A spectrogram displays 3-dimensional data, where the 3rd dimension ( the intensity ) is displayed using colors. The colors are calculated from the values using a color map.

On multi-core systems the performance of the image composition can often be improved by dividing the area into tiles - each of them rendered in a different thread ( see QwtPlotItem::setRenderThreadCount() ).

In ContourMode contour lines are painted for the contour levels.

spectrogram3.png
See also:
QwtRasterData, QwtColorMap, QwtPlotItem::setRenderThreadCount()

Definition at line 38 of file qwt_plot_spectrogram.h.


Member Typedef Documentation

Display modes.

Definition at line 56 of file qwt_plot_spectrogram.h.


Member Enumeration Documentation

The display mode controls how the raster data will be represented.

See also:
setDisplayMode(), testDisplayMode()
Enumerator:
ImageMode 

The values are mapped to colors using a color map.

ContourMode 

The data is displayed using contour lines.

Definition at line 46 of file qwt_plot_spectrogram.h.


Constructor & Destructor Documentation

QwtPlotSpectrogram::QwtPlotSpectrogram ( const QString &  title = QString::null) [explicit]

Sets the following item attributes:

The z value is initialized by 8.0.

Parameters:
titleTitle
See also:
QwtPlotItem::setItemAttribute(), QwtPlotItem::setZ()

Definition at line 105 of file qwt_plot_spectrogram.cpp.

Destructor.

Definition at line 117 of file qwt_plot_spectrogram.cpp.


Member Function Documentation

Returns:
Color Map used for mapping the intensity values to colors
See also:
setColorMap()

Definition at line 197 of file qwt_plot_spectrogram.cpp.

QList< double > QwtPlotSpectrogram::contourLevels ( ) const
Returns:
Levels of the contour lines.

The levels are sorted in increasing order.

See also:
contourLevels(), renderContourLines(), QwtRasterData::contourLines()

Definition at line 357 of file qwt_plot_spectrogram.cpp.

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

Parameters:
levelContour level
Returns:
Pen for the contour line
Note:
contourPen is only used if defaultContourPen().style() == Qt::NoPen
See also:
setDefaultContourPen(), setColorMap(), setContourLevels()

Definition at line 278 of file qwt_plot_spectrogram.cpp.

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

Parameters:
areaRectangle, where to calculate the contour lines
rectRectangle in pixel coordinates, where to paint the contour lines
Returns:
Raster to be used by the CONREC contour algorithm.
Note:
The size will be bounded to rect.size().
See also:
drawContourLines(), QwtRasterData::contourLines()

Definition at line 631 of file qwt_plot_spectrogram.cpp.

Returns:
Spectrogram data
See also:
setData()

Definition at line 384 of file qwt_plot_spectrogram.cpp.

Returns:
Spectrogram data
See also:
setData()

Definition at line 393 of file qwt_plot_spectrogram.cpp.

Returns:
Default contour pen
See also:
setDefaultContourPen()

Definition at line 262 of file qwt_plot_spectrogram.cpp.

void QwtPlotSpectrogram::draw ( QPainter *  painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRectF &  canvasRect 
) const [virtual]

Draw the spectrogram.

Parameters:
painterPainter
xMapMaps x-values into pixel coordinates.
yMapMaps y-values into pixel coordinates.
canvasRectContents rectangle of the canvas in painter coordinates
See also:
setDisplayMode(), renderImage(), QwtPlotRasterItem::draw(), drawContourLines()

Reimplemented from QwtPlotRasterItem.

Definition at line 722 of file qwt_plot_spectrogram.cpp.

void QwtPlotSpectrogram::drawContourLines ( QPainter *  painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QwtRasterData::ContourLines contourLines 
) const [protected, virtual]

Paint the contour lines

Parameters:
painterPainter
xMapMaps x-values into pixel coordinates.
yMapMaps y-values into pixel coordinates.
contourLinesContour lines
See also:
renderContourLines(), defaultContourPen(), contourPen()

Definition at line 677 of file qwt_plot_spectrogram.cpp.

QwtInterval QwtPlotSpectrogram::interval ( Qt::Axis  axis) const [virtual]
Returns:
Bounding interval for an axis

The default implementation returns the interval of the associated raster data object.

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

Reimplemented from QwtPlotRasterItem.

Definition at line 407 of file qwt_plot_spectrogram.cpp.

Definition at line 213 of file qwt_plot_spectrogram.cpp.

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

Parameters:
areaIn most implementations the resolution of the data doesn't depend on the requested area.
Returns:
Bounding rectangle of a pixel
See also:
QwtPlotRasterItem::pixelHint(), QwtRasterData::pixelHint(), render(), renderImage()

Reimplemented from QwtPlotRasterItem.

Definition at line 431 of file qwt_plot_spectrogram.cpp.

QwtRasterData::ContourLines QwtPlotSpectrogram::renderContourLines ( const QRectF &  rect,
const QSize &  raster 
) const [protected, virtual]

Calculate contour lines

Parameters:
rectRectangle, where to calculate the contour lines
rasterRaster, used by the CONREC algorithm
Returns:
Calculated contour lines
See also:
contourLevels(), setConrecFlag(), QwtRasterData::contourLines()

Definition at line 657 of file qwt_plot_spectrogram.cpp.

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 area the value is mapped into a color.

Parameters:
xMapX-Scale Map
yMapY-Scale Map
areaRequested area for the image in scale coordinates
imageSizeSize of the requested image
Returns:
A QImage::Format_Indexed8 or QImage::Format_ARGB32 depending on the color map.
See also:
QwtRasterData::value(), QwtColorMap::rgb(), QwtColorMap::colorIndex()

Implements QwtPlotRasterItem.

Definition at line 455 of file qwt_plot_spectrogram.cpp.

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.

Parameters:
xMapX-Scale Map
yMapY-Scale Map
tileGeometry of the tile in image coordinates
imageImage to be rendered

Definition at line 540 of file qwt_plot_spectrogram.cpp.

int QwtPlotSpectrogram::rtti ( ) const [virtual]
Returns:
QwtPlotItem::Rtti_PlotSpectrogram

Reimplemented from QwtPlotItem.

Definition at line 123 of file qwt_plot_spectrogram.cpp.

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.

Parameters:
colorMapColor Map
See also:
colorMap(), QwtScaleWidget::setColorBarEnabled(), QwtScaleWidget::setColorMap()

Definition at line 174 of file qwt_plot_spectrogram.cpp.

Modify an attribute of the CONREC algorithm, used to calculate the contour lines.

Parameters:
flagCONREC flag
onOn/Off
See also:
testConrecFlag(), renderContourLines(), QwtRasterData::contourLines()

Definition at line 299 of file qwt_plot_spectrogram.cpp.

void QwtPlotSpectrogram::setContourLevels ( const QList< double > &  levels)

Set the levels of the contour lines

Parameters:
levelsValues of the contour levels
See also:
contourLevels(), renderContourLines(), QwtRasterData::contourLines()
Note:
contourLevels returns the same levels but sorted.

Definition at line 340 of file qwt_plot_spectrogram.cpp.

Set the data to be displayed

Parameters:
dataSpectrogram Data
See also:
data()

Definition at line 368 of file qwt_plot_spectrogram.cpp.

void QwtPlotSpectrogram::setDefaultContourPen ( const QColor &  color,
qreal  width = 0.0,
Qt::PenStyle  style = Qt::SolidLine 
)

Build and assign the default pen for the contour lines

In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it non cosmetic ( see QPen::isCosmetic() ). This method has been introduced to hide this incompatibility.

Parameters:
colorPen color
widthPen width
stylePen style
See also:
pen(), brush()

Definition at line 231 of file qwt_plot_spectrogram.cpp.

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

See also:
defaultContourPen(), contourPen()

Definition at line 247 of file qwt_plot_spectrogram.cpp.

void QwtPlotSpectrogram::setDisplayMode ( DisplayMode  mode,
bool  on = true 
)

The display mode controls how the raster data will be represented.

Parameters:
modeDisplay mode
onOn/Off

The default setting enables ImageMode.

See also:
DisplayMode, displayMode()

Definition at line 138 of file qwt_plot_spectrogram.cpp.

void QwtPlotSpectrogram::setMaxRGBTableSize ( int  numColors)

Definition at line 202 of file qwt_plot_spectrogram.cpp.

Test an attribute of the CONREC algorithm, used to calculate the contour lines.

Parameters:
flagCONREC flag
Returns:
true, is enabled

The default setting enables QwtRasterData::IgnoreAllVerticesOnLevel

See also:
setConrecClag(), renderContourLines(), QwtRasterData::contourLines()

Definition at line 325 of file qwt_plot_spectrogram.cpp.

The display mode controls how the raster data will be represented.

Parameters:
modeDisplay mode
Returns:
true if mode is enabled

Definition at line 158 of file qwt_plot_spectrogram.cpp.


Member Data Documentation

Reimplemented from QwtPlotRasterItem.

Definition at line 115 of file qwt_plot_spectrogram.h.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Fri Sep 1 2017 02:41:58