Qwt User's Guide 5.2.2
|
A plot item, which displays a spectrogram. More...
#include <qwt_plot_spectrogram.h>
Public Types | |
enum | CachePolicy { NoCache, PaintCache, ScreenCache } |
enum | DisplayMode { ImageMode = 1, ContourMode = 2 } |
enum | ItemAttribute { Legend = 1, AutoScale = 2 } |
enum | RenderHint { RenderAntialiased = 1 } |
enum | RttiValues { Rtti_PlotItem = 0, Rtti_PlotGrid, Rtti_PlotScale, Rtti_PlotMarker, Rtti_PlotCurve, Rtti_PlotHistogram, Rtti_PlotSpectrogram, Rtti_PlotSVG, Rtti_PlotUserItem = 1000 } |
Public Member Functions | |
int | alpha () const |
void | attach (QwtPlot *plot) |
virtual QwtDoubleRect | boundingRect () const |
CachePolicy | cachePolicy () const |
const QwtColorMap & | colorMap () const |
QwtValueList | contourLevels () const |
virtual QPen | contourPen (double level) const |
const QwtRasterData & | data () const |
QPen | defaultContourPen () const |
void | detach () |
virtual void | draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &rect) const |
void | hide () |
void | invalidateCache () |
QwtDoubleRect | invTransform (const QwtScaleMap &, const QwtScaleMap &, const QRect &) const |
bool | isVisible () const |
virtual void | itemChanged () |
virtual QWidget * | legendItem () const |
QRect | paintRect (const QwtScaleMap &, const QwtScaleMap &) const |
QwtPlot * | plot () const |
QwtPlotSpectrogram (const QString &title=QString::null) | |
virtual QSize | rasterHint (const QwtDoubleRect &) const |
virtual int | rtti () const |
QwtDoubleRect | scaleRect (const QwtScaleMap &, const QwtScaleMap &) const |
void | setAlpha (int alpha) |
void | setAxis (int xAxis, int yAxis) |
void | setCachePolicy (CachePolicy) |
void | setColorMap (const QwtColorMap &) |
void | setConrecAttribute (QwtRasterData::ConrecAttribute, bool on) |
void | setContourLevels (const QwtValueList &) |
void | setData (const QwtRasterData &data) |
void | setDefaultContourPen (const QPen &) |
void | setDisplayMode (DisplayMode, bool on=true) |
void | setItemAttribute (ItemAttribute, bool on=true) |
void | setRenderHint (RenderHint, bool on=true) |
void | setTitle (const QwtText &title) |
void | setTitle (const QString &title) |
virtual void | setVisible (bool) |
void | setXAxis (int axis) |
void | setYAxis (int axis) |
void | setZ (double z) |
void | show () |
bool | testConrecAttribute (QwtRasterData::ConrecAttribute) const |
bool | testDisplayMode (DisplayMode) const |
bool | testItemAttribute (ItemAttribute) const |
bool | testRenderHint (RenderHint) const |
const QwtText & | title () const |
QRect | transform (const QwtScaleMap &, const QwtScaleMap &, const QwtDoubleRect &) const |
virtual void | updateLegend (QwtLegend *) const |
virtual void | updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &) |
int | xAxis () const |
int | yAxis () const |
double | z () const |
virtual | ~QwtPlotSpectrogram () |
Protected Member Functions | |
virtual QSize | contourRasterSize (const QwtDoubleRect &, const QRect &) const |
virtual void | drawContourLines (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtRasterData::ContourLines &lines) const |
virtual QwtRasterData::ContourLines | renderContourLines (const QwtDoubleRect &rect, const QSize &raster) const |
virtual QImage | renderImage (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtDoubleRect &rect) 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.
enum QwtPlotRasterItem::CachePolicy [inherited] |
The default policy is NoCache
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.
enum QwtPlotItem::ItemAttribute [inherited] |
Plot Item Attributes
enum QwtPlotItem::RenderHint [inherited] |
Render hints.
enum QwtPlotItem::RttiValues [inherited] |
Runtime type information.
RttiValues is used to cast plot items, without having to enable runtime type information of the compiler.
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.
int QwtPlotRasterItem::alpha | ( | ) | const [inherited] |
void QwtPlotItem::attach | ( | QwtPlot * | plot | ) | [inherited] |
Attach the item to a plot.
This method will attach a QwtPlotItem to the QwtPlot argument. It will first detach the QwtPlotItem from any plot from a previous call to attach (if necessary). If a NULL argument is passed, it will detach from any QwtPlot it was attached to.
plot | Plot widget |
QwtDoubleRect QwtPlotSpectrogram::boundingRect | ( | ) | const [virtual] |
Reimplemented from QwtPlotItem.
QwtPlotRasterItem::CachePolicy QwtPlotRasterItem::cachePolicy | ( | ) | const [inherited] |
const QwtColorMap & QwtPlotSpectrogram::colorMap | ( | ) | const |
QwtValueList 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 QwtDoubleRect & | 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 data().rasterHint().
area | Rect, where to calculate the contour lines |
rect | Rect in pixel coordinates, where to paint the contour lines |
const QwtRasterData & QwtPlotSpectrogram::data | ( | ) | const |
QPen QwtPlotSpectrogram::defaultContourPen | ( | ) | const |
void QwtPlotItem::detach | ( | ) | [inline, inherited] |
This method detaches a QwtPlotItem from any QwtPlot it has been associated with.
detach() is equivalent to calling attach( NULL )
void QwtPlotSpectrogram::draw | ( | QPainter * | painter, |
const QwtScaleMap & | xMap, | ||
const QwtScaleMap & | yMap, | ||
const QRect & | 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 |
void QwtPlotItem::hide | ( | ) | [inherited] |
Hide the item.
void QwtPlotRasterItem::invalidateCache | ( | ) | [inherited] |
Invalidate the paint cache
QwtDoubleRect QwtPlotItem::invTransform | ( | const QwtScaleMap & | xMap, |
const QwtScaleMap & | yMap, | ||
const QRect & | rect | ||
) | const [inherited] |
Transform a rectangle from paint to scale coordinates
xMap | X map |
yMap | Y map |
rect | Rectangle in paint coordinates |
bool QwtPlotItem::isVisible | ( | ) | const [inherited] |
void QwtPlotItem::itemChanged | ( | ) | [virtual, inherited] |
Update the legend and call QwtPlot::autoRefresh for the parent plot.
QWidget * QwtPlotItem::legendItem | ( | ) | const [virtual, inherited] |
Allocate the widget that represents the item on the legend.
The default implementation is made for QwtPlotCurve and returns a QwtLegendItem(), but an item could be represented by any type of widget, by overloading legendItem() and updateLegend().
Implements QwtLegendItemManager.
QRect QwtPlotItem::paintRect | ( | const QwtScaleMap & | xMap, |
const QwtScaleMap & | yMap | ||
) | const [inherited] |
Calculate the bounding paint rect of 2 maps.
xMap | X map |
yMap | X map |
QwtPlot * QwtPlotItem::plot | ( | ) | const [inherited] |
Return attached plot.
QSize QwtPlotSpectrogram::rasterHint | ( | const QwtDoubleRect & | rect | ) | const [virtual] |
Returns the recommended raster for a given rect.
F.e the raster hint is used to limit the resolution of the image that is rendered.
rect | Rect for the raster hint |
Reimplemented from QwtPlotRasterItem.
QwtRasterData::ContourLines QwtPlotSpectrogram::renderContourLines | ( | const QwtDoubleRect & | 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 QwtDoubleRect & | area | ||
) | const [protected, virtual] |
Render an image from the data and color map.
The area is translated into a rect of the paint device. For each pixel of this rect the intensity is mapped into a color.
xMap | X-Scale Map |
yMap | Y-Scale Map |
area | Area that should be rendered in scale coordinates. |
Implements QwtPlotRasterItem.
int QwtPlotSpectrogram::rtti | ( | ) | const [virtual] |
Reimplemented from QwtPlotItem.
QwtDoubleRect QwtPlotItem::scaleRect | ( | const QwtScaleMap & | xMap, |
const QwtScaleMap & | yMap | ||
) | const [inherited] |
Calculate the bounding scale rect of 2 maps.
xMap | X map |
yMap | X map |
void QwtPlotRasterItem::setAlpha | ( | int | alpha | ) | [inherited] |
Set an alpha value for the raster data.
Often a plot has several types of raster data organized in layers. ( f.e a geographical map, with weather statistics ). Using setAlpha() raster items can be stacked easily.
The alpha value is a value [0, 255] to control the transparency of the image. 0 represents a fully transparent color, while 255 represents a fully opaque color.
alpha | Alpha value |
The default alpha value is -1.
void QwtPlotItem::setAxis | ( | int | xAxis, |
int | yAxis | ||
) | [inherited] |
Set X and Y axis
The item will painted according to the coordinates its Axes.
xAxis | X Axis |
yAxis | Y Axis |
void QwtPlotRasterItem::setCachePolicy | ( | QwtPlotRasterItem::CachePolicy | policy | ) | [inherited] |
Change the cache policy
The default policy is NoCache
policy | Cache policy |
void QwtPlotSpectrogram::setColorMap | ( | const 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 QwtValueList & | levels | ) |
Set the levels of the contour lines
levels | Values of the contour levels |
void QwtPlotSpectrogram::setData | ( | const 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 QwtPlotItem::setItemAttribute | ( | ItemAttribute | attribute, |
bool | on = true |
||
) | [inherited] |
Toggle an item attribute
attribute | Attribute type |
on | true/false |
void QwtPlotItem::setRenderHint | ( | RenderHint | hint, |
bool | on = true |
||
) | [inherited] |
Toggle an render hint
hint | Render hint |
on | true/false |
void QwtPlotItem::setTitle | ( | const QwtText & | title | ) | [inherited] |
void QwtPlotItem::setTitle | ( | const QString & | title | ) | [inherited] |
void QwtPlotItem::setVisible | ( | bool | on | ) | [virtual, inherited] |
void QwtPlotItem::setXAxis | ( | int | axis | ) | [inherited] |
Set the X axis
The item will painted according to the coordinates its Axes.
axis | X Axis |
void QwtPlotItem::setYAxis | ( | int | axis | ) | [inherited] |
Set the Y axis
The item will painted according to the coordinates its Axes.
axis | Y Axis |
void QwtPlotItem::setZ | ( | double | z | ) | [inherited] |
Set the z value.
Plot items are painted in increasing z-order.
z | Z-value |
void QwtPlotItem::show | ( | ) | [inherited] |
Show the item.
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 |
bool QwtPlotItem::testItemAttribute | ( | ItemAttribute | attribute | ) | const [inherited] |
Test an item attribute
attribute | Attribute type |
bool QwtPlotItem::testRenderHint | ( | RenderHint | hint | ) | const [inherited] |
Test a render hint
hint | Render hint |
const QwtText & QwtPlotItem::title | ( | ) | const [inherited] |
QRect QwtPlotItem::transform | ( | const QwtScaleMap & | xMap, |
const QwtScaleMap & | yMap, | ||
const QwtDoubleRect & | rect | ||
) | const [inherited] |
Transform a rectangle
xMap | X map |
yMap | Y map |
rect | Rectangle in scale coordinates |
void QwtPlotItem::updateLegend | ( | QwtLegend * | legend | ) | const [virtual, inherited] |
Update the widget that represents the item on the legend.
updateLegend() is called from itemChanged() to adopt the widget representing the item on the legend to its new configuration.
The default implementation is made for QwtPlotCurve and updates a QwtLegendItem(), but an item could be represented by any type of widget, by overloading legendItem() and updateLegend().
legend | Legend |
Implements QwtLegendItemManager.
Reimplemented in QwtPlotCurve.
void QwtPlotItem::updateScaleDiv | ( | const QwtScaleDiv & | , |
const QwtScaleDiv & | |||
) | [virtual, inherited] |
Update the item to changes of the axes scale division.
Update the item, when the axes of plot have changed. The default implementation does nothing, but items that depend on the scale division (like QwtPlotGrid()) have to reimplement updateScaleDiv()
xScaleDiv | Scale division of the x-axis |
yScaleDiv | Scale division of the y-axis |
Reimplemented in QwtPlotGrid, and QwtPlotScaleItem.
int QwtPlotItem::xAxis | ( | ) | const [inherited] |
Return xAxis.
int QwtPlotItem::yAxis | ( | ) | const [inherited] |
Return yAxis.
double QwtPlotItem::z | ( | ) | const [inherited] |
Plot items are painted in increasing z-order.