A plot item, which displays a spectrogram. More...
#include <qwt_plot_spectrogram.h>
Classes | |
class | PrivateData |
Public Types | |
enum | DisplayMode { ImageMode = 0x01, ContourMode = 0x02 } |
Public Types inherited from QwtPlotRasterItem | |
enum | CachePolicy { NoCache, PaintCache } |
Cache policy The default policy is NoCache. More... | |
enum | PaintAttribute { PaintInDeviceResolution = 1 } |
Public Types inherited from QwtPlotItem | |
enum | ItemAttribute { Legend = 0x01, AutoScale = 0x02, Margins = 0x04 } |
Plot Item Attributes. More... | |
enum | ItemInterest { ScaleInterest = 0x01, LegendInterest = 0x02 } |
Plot Item Interests. More... | |
enum | RenderHint { RenderAntialiased = 0x1 } |
Render hints. More... | |
enum | RttiValues { Rtti_PlotItem = 0, Rtti_PlotGrid, Rtti_PlotScale, Rtti_PlotLegend, Rtti_PlotMarker, Rtti_PlotCurve, Rtti_PlotSpectroCurve, Rtti_PlotIntervalCurve, Rtti_PlotHistogram, Rtti_PlotSpectrogram, Rtti_PlotGraphic, Rtti_PlotTradingCurve, Rtti_PlotBarChart, Rtti_PlotMultiBarChart, Rtti_PlotShape, Rtti_PlotTextLabel, Rtti_PlotZone, Rtti_PlotVectorField, Rtti_PlotUserItem = 1000 } |
Runtime type information. More... | |
Public Member Functions | |
const QwtColorMap * | colorMap () const |
int | colorTableSize () const |
QList< double > | contourLevels () const |
virtual QPen | contourPen (double level) const |
Calculate the pen for a contour line. More... | |
QwtRasterData * | data () |
const QwtRasterData * | data () const |
QPen | defaultContourPen () const |
virtual void | draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const QWT_OVERRIDE |
Draw the spectrogram. More... | |
virtual QwtInterval | interval (Qt::Axis) const QWT_OVERRIDE |
virtual QRectF | pixelHint (const QRectF &) const QWT_OVERRIDE |
Pixel hint. More... | |
QwtPlotSpectrogram (const QString &title=QString()) | |
virtual int | rtti () const QWT_OVERRIDE |
void | setColorMap (QwtColorMap *) |
void | setColorTableSize (int numColors) |
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. More... | |
void | setDisplayMode (DisplayMode, bool on=true) |
bool | testConrecFlag (QwtRasterData::ConrecFlag) const |
bool | testDisplayMode (DisplayMode) const |
virtual | ~QwtPlotSpectrogram () |
Destructor. More... | |
Public Member Functions inherited from QwtPlotRasterItem | |
int | alpha () const |
virtual QRectF | boundingRect () const QWT_OVERRIDE |
CachePolicy | cachePolicy () const |
void | invalidateCache () |
QwtPlotRasterItem (const QString &title=QString()) | |
Constructor. More... | |
QwtPlotRasterItem (const QwtText &title) | |
Constructor. More... | |
void | setAlpha (int alpha) |
Set an alpha value for the raster data. More... | |
void | setCachePolicy (CachePolicy) |
void | setPaintAttribute (PaintAttribute, bool on=true) |
bool | testPaintAttribute (PaintAttribute) const |
virtual | ~QwtPlotRasterItem () |
Destructor. More... | |
Public Member Functions inherited from QwtPlotItem | |
void | attach (QwtPlot *plot) |
Attach the item to a plot. More... | |
void | detach () |
This method detaches a QwtPlotItem from any QwtPlot it has been associated with. More... | |
virtual void | getCanvasMarginHint (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const |
Calculate a hint for the canvas margin. More... | |
void | hide () |
Hide the item. More... | |
bool | isVisible () const |
virtual void | itemChanged () |
virtual void | legendChanged () |
virtual QList< QwtLegendData > | legendData () const |
Return all information, that is needed to represent the item on the legend. More... | |
virtual QwtGraphic | legendIcon (int index, const QSizeF &) const |
QSize | legendIconSize () const |
QRectF | paintRect (const QwtScaleMap &, const QwtScaleMap &) const |
Calculate the bounding paint rectangle of 2 maps. More... | |
QwtPlot * | plot () const |
Return attached plot. More... | |
QwtPlotItem () | |
QwtPlotItem (const QString &title) | |
QwtPlotItem (const QwtText &title) | |
uint | renderThreadCount () const |
QRectF | scaleRect (const QwtScaleMap &, const QwtScaleMap &) const |
Calculate the bounding scale rectangle of 2 maps. More... | |
void | setAxes (QwtAxisId xAxis, QwtAxisId yAxis) |
void | setItemAttribute (ItemAttribute, bool on=true) |
void | setItemInterest (ItemInterest, bool on=true) |
void | setLegendIconSize (const QSize &) |
void | setRenderHint (RenderHint, bool on=true) |
void | setRenderThreadCount (uint numThreads) |
void | setTitle (const QString &title) |
void | setTitle (const QwtText &title) |
virtual void | setVisible (bool) |
void | setXAxis (QwtAxisId) |
void | setYAxis (QwtAxisId) |
void | setZ (double z) |
Set the z value. More... | |
void | show () |
Show the item. More... | |
bool | testItemAttribute (ItemAttribute) const |
bool | testItemInterest (ItemInterest) const |
bool | testRenderHint (RenderHint) const |
const QwtText & | title () const |
virtual void | updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &) |
Update the item to changes of the legend info. More... | |
virtual void | updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &) |
Update the item to changes of the axes scale division. More... | |
QwtAxisId | xAxis () const |
Return xAxis. More... | |
QwtAxisId | yAxis () const |
Return yAxis. More... | |
double | z () const |
virtual | ~QwtPlotItem () |
Destroy the QwtPlotItem. More... | |
Protected Member Functions | |
virtual QSize | contourRasterSize (const QRectF &, const QRect &) const |
Return the raster to be used by the CONREC contour algorithm. More... | |
virtual void | drawContourLines (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtRasterData::ContourLines &) 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 QWT_OVERRIDE |
Render an image from data and color map. More... | |
void | renderTile (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &tile, QImage *) const |
Render a tile of an image. More... | |
Protected Member Functions inherited from QwtPlotRasterItem | |
virtual QwtScaleMap | imageMap (Qt::Orientation, const QwtScaleMap &map, const QRectF &area, const QSize &imageSize, double pixelSize) const |
Calculate a scale map for painting to an image. More... | |
Protected Member Functions inherited from QwtPlotItem | |
QwtGraphic | defaultIcon (const QBrush &, const QSizeF &) const |
Return a default icon from a brush. More... | |
Private Attributes | |
PrivateData * | m_data |
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.
Definition at line 36 of file qwt_plot_spectrogram.h.
The display mode controls how the raster data will be represented.
Enumerator | |
---|---|
ImageMode | The values are mapped to colors using a color map. |
ContourMode | The data is displayed using contour lines. |
Definition at line 44 of file qwt_plot_spectrogram.h.
|
explicit |
Sets the following item attributes:
The z value is initialized by 8.0.
title | Title |
Definition at line 108 of file qwt_plot_spectrogram.cpp.
|
virtual |
Destructor.
Definition at line 120 of file qwt_plot_spectrogram.cpp.
const QwtColorMap * QwtPlotSpectrogram::colorMap | ( | ) | const |
Definition at line 200 of file qwt_plot_spectrogram.cpp.
int QwtPlotSpectrogram::colorTableSize | ( | ) | const |
Definition at line 238 of file qwt_plot_spectrogram.cpp.
QList< double > QwtPlotSpectrogram::contourLevels | ( | ) | const |
The levels are sorted in increasing order.
Definition at line 382 of file qwt_plot_spectrogram.cpp.
|
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 |
Definition at line 303 of file qwt_plot_spectrogram.cpp.
|
protectedvirtual |
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().
area | Rectangle, where to calculate the contour lines |
rect | Rectangle in pixel coordinates, where to paint the contour lines |
Definition at line 663 of file qwt_plot_spectrogram.cpp.
QwtRasterData* QwtPlotSpectrogram::data | ( | ) |
QwtRasterData * QwtPlotSpectrogram::data | ( | ) | const |
QPen QwtPlotSpectrogram::defaultContourPen | ( | ) | const |
Definition at line 287 of file qwt_plot_spectrogram.cpp.
|
virtual |
Draw the spectrogram.
painter | Painter |
xMap | Maps x-values into pixel coordinates. |
yMap | Maps y-values into pixel coordinates. |
canvasRect | Contents rectangle of the canvas in painter coordinates |
Reimplemented from QwtPlotRasterItem.
Definition at line 754 of file qwt_plot_spectrogram.cpp.
|
protectedvirtual |
Paint the contour lines
painter | Painter |
xMap | Maps x-values into pixel coordinates. |
yMap | Maps y-values into pixel coordinates. |
contourLines | Contour lines |
Definition at line 709 of file qwt_plot_spectrogram.cpp.
|
virtual |
The default implementation returns the interval of the associated raster data object.
axis | X, Y, or Z axis |
Reimplemented from QwtPlotRasterItem.
Definition at line 432 of file qwt_plot_spectrogram.cpp.
|
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.
Definition at line 456 of file qwt_plot_spectrogram.cpp.
|
protectedvirtual |
Calculate contour lines
rect | Rectangle, where to calculate the contour lines |
raster | Raster, used by the CONREC algorithm |
Definition at line 689 of file qwt_plot_spectrogram.cpp.
|
protectedvirtual |
Render an image from data and color map.
For each pixel of area the value 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.
Definition at line 480 of file qwt_plot_spectrogram.cpp.
|
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 |
Definition at line 572 of file qwt_plot_spectrogram.cpp.
|
virtual |
Reimplemented from QwtPlotItem.
Definition at line 126 of file qwt_plot_spectrogram.cpp.
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 |
Definition at line 177 of file qwt_plot_spectrogram.cpp.
void QwtPlotSpectrogram::setColorTableSize | ( | int | numColors | ) |
Limit the number of colors being used by the color map
When using a color table the mapping from the value into a color is usually faster as it can be done by simple lookups into a precalculated color table.
Setting a table size > 0 enables using a color table, while setting the size to 0 disables it.
The default size = 0, and no color table is used.
numColors | Number of colors. 0 means not using a color table |
Definition at line 224 of file qwt_plot_spectrogram.cpp.
void QwtPlotSpectrogram::setConrecFlag | ( | QwtRasterData::ConrecFlag | flag, |
bool | on | ||
) |
Modify an attribute of the CONREC algorithm, used to calculate the contour lines.
flag | CONREC flag |
on | On/Off |
Definition at line 324 of file qwt_plot_spectrogram.cpp.
void QwtPlotSpectrogram::setContourLevels | ( | const QList< double > & | levels | ) |
Set the levels of the contour lines
levels | Values of the contour levels |
Definition at line 365 of file qwt_plot_spectrogram.cpp.
void QwtPlotSpectrogram::setData | ( | QwtRasterData * | data | ) |
Set the data to be displayed
data | Spectrogram Data |
Definition at line 393 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.
color | Pen color |
width | Pen width |
style | Pen style |
Definition at line 256 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().
Definition at line 272 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.
mode | Display mode |
on | On/Off |
The default setting enables ImageMode.
Definition at line 141 of file qwt_plot_spectrogram.cpp.
bool QwtPlotSpectrogram::testConrecFlag | ( | QwtRasterData::ConrecFlag | flag | ) | const |
Test an attribute of the CONREC algorithm, used to calculate the contour lines.
flag | CONREC flag |
The default setting enables QwtRasterData::IgnoreAllVerticesOnLevel
Definition at line 350 of file qwt_plot_spectrogram.cpp.
bool QwtPlotSpectrogram::testDisplayMode | ( | DisplayMode | mode | ) | const |
The display mode controls how the raster data will be represented.
mode | Display mode |
Definition at line 161 of file qwt_plot_spectrogram.cpp.
|
private |
Definition at line 112 of file qwt_plot_spectrogram.h.