Qwt User's Guide  6.0.2
Public Types | Public Member Functions | Protected Member Functions
QwtPlotSpectrogram Class Reference

#include <qwt_plot_spectrogram.h>

Inheritance diagram for QwtPlotSpectrogram:
Inheritance graph
[legend]

List of all members.

Public Types

enum  DisplayMode {
  ImageMode = 0x01,
  ContourMode = 0x02
}
typedef QFlags< DisplayModeDisplayModes
- Public Types inherited from QwtPlotRasterItem
enum  CachePolicy {
  NoCache,
  PaintCache
}
enum  PaintAttribute { PaintInDeviceResolution = 1 }
typedef QFlags< PaintAttributePaintAttributes
- Public Types inherited from QwtPlotItem
enum  ItemAttribute {
  Legend = 0x01,
  AutoScale = 0x02
}
typedef QFlags< ItemAttributeItemAttributes
enum  RenderHint { RenderAntialiased = 1 }
typedef QFlags< RenderHintRenderHints
enum  RttiValues {
  Rtti_PlotItem = 0,
  Rtti_PlotGrid,
  Rtti_PlotScale,
  Rtti_PlotMarker,
  Rtti_PlotCurve,
  Rtti_PlotSpectroCurve,
  Rtti_PlotIntervalCurve,
  Rtti_PlotHistogram,
  Rtti_PlotSpectrogram,
  Rtti_PlotSVG,
  Rtti_PlotUserItem = 1000
}

Public Member Functions

 QwtPlotSpectrogram (const QString &title=QString::null)
virtual ~QwtPlotSpectrogram ()
const QwtColorMapcolorMap () const
QList< double > contourLevels () const
virtual QPen contourPen (double level) const
const QwtRasterDatadata () const
QwtRasterDatadata ()
QPen defaultContourPen () const
virtual void draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &rect) const
virtual QwtInterval interval (Qt::Axis) const
virtual QRectF pixelHint (const QRectF &) const
uint renderThreadCount () const
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 QPen &)
void setDisplayMode (DisplayMode, bool on=true)
void setRenderThreadCount (uint numThreads)
bool testConrecFlag (QwtRasterData::ConrecFlag) const
bool testDisplayMode (DisplayMode) const
- Public Member Functions inherited from QwtPlotRasterItem
 QwtPlotRasterItem (const QString &title=QString::null)
 QwtPlotRasterItem (const QwtText &title)
virtual ~QwtPlotRasterItem ()
int alpha () const
virtual QRectF boundingRect () const
CachePolicy cachePolicy () const
void invalidateCache ()
void setAlpha (int alpha)
void setCachePolicy (CachePolicy)
void setPaintAttribute (PaintAttribute, bool on=true)
bool testPaintAttribute (PaintAttribute) const
- Public Member Functions inherited from QwtPlotItem
 QwtPlotItem (const QwtText &title=QwtText())
virtual ~QwtPlotItem ()
void attach (QwtPlot *plot)
void detach ()
void hide ()
bool isVisible () const
virtual void itemChanged ()
virtual QWidget * legendItem () const
QRectF paintRect (const QwtScaleMap &, const QwtScaleMap &) const
QwtPlotplot () const
QRectF scaleRect (const QwtScaleMap &, const QwtScaleMap &) const
void setAxes (int xAxis, int yAxis)
void setItemAttribute (ItemAttribute, bool on=true)
void setRenderHint (RenderHint, bool on=true)
void setTitle (const QString &title)
void setTitle (const QwtText &title)
virtual void setVisible (bool)
void setXAxis (int axis)
void setYAxis (int axis)
void setZ (double z)
void show ()
bool testItemAttribute (ItemAttribute) const
bool testRenderHint (RenderHint) const
const QwtTexttitle () const
virtual void updateLegend (QwtLegend *) const
virtual void updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &)
int xAxis () const
int yAxis () const
double z () const
- Public Member Functions inherited from QwtLegendItemManager
 QwtLegendItemManager ()
virtual ~QwtLegendItemManager ()
virtual void drawLegendIdentifier (QPainter *, const QRectF &) const

Protected Member Functions

virtual QSize contourRasterSize (const QRectF &, const QRect &) const
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
void renderTile (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &imageRect, QImage *image) const
- Protected Member Functions inherited from QwtPlotRasterItem
virtual QwtScaleMap imageMap (Qt::Orientation, const QwtScaleMap &map, const QRectF &area, const QSize &imageSize, double pixelSize) const

Detailed Description

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.

spectrogram3.png
See also:
QwtRasterData, QwtColorMap

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.


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

Member Function Documentation

const QwtColorMap * QwtPlotSpectrogram::colorMap ( ) const
Returns:
Color Map used for mapping the intensity values to colors
See also:
setColorMap()
QList< double > QwtPlotSpectrogram::contourLevels ( ) const

Return the levels of the contour lines.

The levels are sorted in increasing order.

See also:
contourLevels(), renderContourLines(), QwtRasterData::contourLines()
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()
QSize QwtPlotSpectrogram::contourRasterSize ( const QRectF &  area,
const QRect &  rect 
) const
protectedvirtual

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

Parameters:
areaRect, where to calculate the contour lines
rectRect 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()
const QwtRasterData * QwtPlotSpectrogram::data ( ) const
Returns:
Spectrogram data
See also:
setData()
QwtRasterData * QwtPlotSpectrogram::data ( )
Returns:
Spectrogram data
See also:
setData()
QPen QwtPlotSpectrogram::defaultContourPen ( ) const
Returns:
Default contour pen
See also:
setDefaultContourPen()
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 rect of the canvas in painter coordinates
See also:
setDisplayMode(), renderImage(), QwtPlotRasterItem::draw(), drawContourLines()

Reimplemented from QwtPlotRasterItem.

void QwtPlotSpectrogram::drawContourLines ( QPainter *  painter,
const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QwtRasterData::ContourLines contourLines 
) const
protectedvirtual

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

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.

QwtRasterData::ContourLines QwtPlotSpectrogram::renderContourLines ( const QRectF &  rect,
const QSize &  raster 
) const
protectedvirtual

Calculate contour lines

Parameters:
rectRectangle, where to calculate the contour lines
rasterRaster, used by the CONREC algorithm
See also:
contourLevels(), setConrecFlag(), QwtRasterData::contourLines()
QImage QwtPlotSpectrogram::renderImage ( const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRectF &  area,
const QSize &  imageSize 
) const
protectedvirtual

Render an image from data and color map.

For each pixel of rect 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.

uint QwtPlotSpectrogram::renderThreadCount ( ) const
Returns:
Number of threads to be used for rendering. If numThreads is set to 0, the system specific ideal thread count is used.
Warning:
Rendering in multiple threads is only supported for Qt >= 4.4
See also:
setRenderThreadCount(), renderImage(), renderTile()
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
int QwtPlotSpectrogram::rtti ( ) const
virtual
Returns:
QwtPlotItem::Rtti_PlotSpectrogram

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.

Parameters:
colorMapColor Map
See also:
colorMap(), QwtScaleWidget::setColorBarEnabled(), QwtScaleWidget::setColorMap()
void QwtPlotSpectrogram::setConrecFlag ( QwtRasterData::ConrecFlag  flag,
bool  on 
)

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

Parameters:
flagCONREC flag
onOn/Off
See also:
testConrecFlag(), renderContourLines(), QwtRasterData::contourLines()
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.
void QwtPlotSpectrogram::setData ( QwtRasterData data)

Set the data to be displayed

Parameters:
dataSpectrogram Data
See also:
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().

See also:
defaultContourPen(), contourPen()
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()
void QwtPlotSpectrogram::setRenderThreadCount ( uint  numThreads)

Rendering an image from the raster data can often be done parallel on a multicore system.

Parameters:
numThreadsNumber 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 )

Warning:
Rendering in multiple threads is only supported for Qt >= 4.4
See also:
renderThreadCount(), renderImage(), renderTile()
bool QwtPlotSpectrogram::testConrecFlag ( QwtRasterData::ConrecFlag  flag) const

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

Parameters:
flagCONREC flag
Returns:
true, is enabled
See also:
setConrecClag(), renderContourLines(), QwtRasterData::contourLines()
bool QwtPlotSpectrogram::testDisplayMode ( DisplayMode  mode) const

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

Parameters:
modeDisplay mode
Returns:
true if mode is enabled