A class(3) which displays raster data.

Other Alias

QwtPlotRasterItem

SYNOPSIS


#include <qwt_plot_rasteritem.h>

Inherits QwtPlotItem.

Inherited by QwtPlotSpectrogram.

Public Types


enum CachePolicy { NoCache, PaintCache, ScreenCache }

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

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

QwtPlotRasterItem (const QString &title=QString::null)

QwtPlotRasterItem (const QwtText &title)

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

Protected Member Functions


virtual QImage renderImage (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtDoubleRect &area) const =0

Detailed Description

A class, which displays raster data.

Raster data is a grid of pixel values, that can be represented as a QImage. It is used for many types of information like spectrograms, cartograms, geographical maps ...

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.

QwtPlotRasterItem is only implemented for images of the following formats: QImage::Format_Indexed8, QImage::Format_ARGB32.

See also:

QwtPlotSpectrogram

Member Enumeration Documentation

enum QwtPlotRasterItem::CachePolicy.IP • 2

NoCache

 renderImage() is called, whenever the item has to be repainted
  • PaintCache

     renderImage() is called, whenever the image cache is not valid, or the scales, or the size of the canvas has changed. This type of cache is only useful for improving the performance of hide/show operations. All other situations are already handled by the plot canvas cache.
  • ScreenCache

     The screen cache is an image in size of the screen. As long as the scales don't change the target image is scaled from the cache. This might improve the performance when resizing the plot widget, but suffers from scaling effects.

The default policy is NoCache

enum QwtPlotItem::ItemAttribute [inherited]Plot Item Attributes

  • Legend

     The item is represented on the legend.
  • AutoScale

     The boundingRect() of the item is included in the autoscaling calculation.

See also:

setItemAttribute(), testItemAttribute()

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.

Constructor & Destructor Documentation

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

Constructor.

QwtPlotRasterItem::QwtPlotRasterItem (const QwtText &title) [explicit]

Constructor.

QwtPlotRasterItem::~QwtPlotRasterItem () [virtual]

Destructor.

Member Function Documentation

int QwtPlotRasterItem::alpha () constReturns:

Alpha value of the raster item

See also:

setAlpha()

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.

Parameters:

plot Plot widget

See also:

QwtPlotItem::detach()

QwtDoubleRect QwtPlotItem::boundingRect () const [virtual, inherited]Returns:

An invalid bounding rect: QwtDoubleRect(1.0, 1.0, -2.0, -2.0)

Reimplemented in QwtPlotCurve, QwtPlotMarker, QwtPlotSpectrogram, and QwtPlotSvgItem.

QwtPlotRasterItem::CachePolicy QwtPlotRasterItem::cachePolicy () constReturns:

Cache policy

See also:

CachePolicy, setCachePolicy()

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 )

See also:

attach( QwtPlot* plot )

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

Draw the raster data. Parameters:

painter Painter
xMap X-Scale Map
yMap Y-Scale Map
canvasRect Contents rect of the plot canvas

Implements QwtPlotItem.

Reimplemented in QwtPlotSpectrogram.

void QwtPlotItem::hide () [inherited]

Hide the item.

void QwtPlotRasterItem::invalidateCache ()Invalidate the paint cache

See also:

setCachePolicy()

QwtDoubleRect QwtPlotItem::invTransform (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &rect) const [inherited]Transform a rectangle from paint to scale coordinates

Parameters:

xMap X map
yMap Y map
rect Rectangle in paint coordinates

Returns:

Rectangle in scale coordinates

See also:

transform()

bool QwtPlotItem::isVisible () const [inherited]Returns:

true if visible

See also:

setVisible(), show(), hide()

void QwtPlotItem::itemChanged () [virtual, inherited]Update the legend and call QwtPlot::autoRefresh for the parent plot.

See also:

updateLegend()

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

Returns:

QwtLegendItem()

See also:

updateLegend() QwtLegend()

Implements QwtLegendItemManager.

QRect QwtPlotItem::paintRect (const QwtScaleMap &xMap, const QwtScaleMap &yMap) const [inherited]

Calculate the bounding paint rect of 2 maps. Parameters:

xMap X map
yMap X map

Returns:

Bounding rect of the scale maps

QwtPlot * QwtPlotItem::plot () const [inherited]

Return attached plot.

QSize QwtPlotRasterItem::rasterHint (const QwtDoubleRect &) const [virtual]

Returns the recommended raster for a given rect. F.e the raster hint can be used to limit the resolution of the image that is rendered.

The default implementation returns an invalid size (QSize()), what means: no hint.

Reimplemented in QwtPlotSpectrogram.

virtual QImage QwtPlotRasterItem::renderImage (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtDoubleRect &area) const [protected, pure virtual]Renders an image for an area

The format of the image must be QImage::Format_Indexed8, QImage::Format_RGB32 or QImage::Format_ARGB32

Parameters:

xMap Maps x-values into pixel coordinates.
yMap Maps y-values into pixel coordinates.
area Requested area for the image in scale coordinates

Implemented in QwtPlotSpectrogram.

int QwtPlotItem::rtti () const [virtual, inherited]Return rtti for the specific class represented. QwtPlotItem is simply a virtual interface class, and base classes will implement this method with specific rtti values so a user can differentiate them.

The rtti value is useful for environments, where the runtime type information is disabled and it is not possible to do a dynamic_cast<...>.

Returns:

rtti value

See also:

RttiValues

Reimplemented in QwtPlotCurve, QwtPlotGrid, QwtPlotMarker, QwtPlotScaleItem, QwtPlotSpectrogram, and QwtPlotSvgItem.

QwtDoubleRect QwtPlotItem::scaleRect (const QwtScaleMap &xMap, const QwtScaleMap &yMap) const [inherited]

Calculate the bounding scale rect of 2 maps. Parameters:

xMap X map
yMap X map

Returns:

Bounding rect of the scale maps

void QwtPlotRasterItem::setAlpha (intalpha)

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.

Parameters:

alpha Alpha value

  • alpha >= 0

     All alpha values of the pixels returned by renderImage() will be set to alpha, beside those with an alpha value of 0 (invalid pixels).
  • alpha < 0 The alpha values returned by renderImage() are not changed.

The default alpha value is -1.

See also:

alpha()

void QwtPlotItem::setAxis (intxAxis, intyAxis) [inherited]Set X and Y axis

The item will painted according to the coordinates its Axes.

Parameters:

xAxis X Axis
yAxis Y Axis

See also:

setXAxis(), setYAxis(), xAxis(), yAxis()

void QwtPlotRasterItem::setCachePolicy (QwtPlotRasterItem::CachePolicypolicy)Change the cache policy

The default policy is NoCache

Parameters:

policy Cache policy

See also:

CachePolicy, cachePolicy()

void QwtPlotItem::setItemAttribute (ItemAttributeattribute, boolon = true) [inherited]Toggle an item attribute

Parameters:

attribute Attribute type
on true/false

See also:

testItemAttribute(), ItemAttribute

void QwtPlotItem::setRenderHint (RenderHinthint, boolon = true) [inherited]Toggle an render hint

Parameters:

hint Render hint
on true/false

See also:

testRenderHint(), RenderHint

void QwtPlotItem::setTitle (const QString &title) [inherited]Set a new title

Parameters:

title Title

See also:

title()

void QwtPlotItem::setTitle (const QwtText &title) [inherited]Set a new title

Parameters:

title Title

See also:

title()

void QwtPlotItem::setVisible (boolon) [virtual, inherited]Show/Hide the item

Parameters:

on Show if true, otherwise hide

See also:

isVisible(), show(), hide()

void QwtPlotItem::setXAxis (intaxis) [inherited]Set the X axis

The item will painted according to the coordinates its Axes.

Parameters:

axis X Axis

See also:

setAxis(), setYAxis(), xAxis()

void QwtPlotItem::setYAxis (intaxis) [inherited]Set the Y axis

The item will painted according to the coordinates its Axes.

Parameters:

axis Y Axis

See also:

setAxis(), setXAxis(), yAxis()

void QwtPlotItem::setZ (doublez) [inherited]

Set the z value. Plot items are painted in increasing z-order.

Parameters:

z Z-value

See also:

z(), QwtPlotDict::itemList()

void QwtPlotItem::show () [inherited]

Show the item.

bool QwtPlotItem::testItemAttribute (ItemAttributeattribute) const [inherited]Test an item attribute

Parameters:

attribute Attribute type

Returns:

true/false

See also:

setItemAttribute(), ItemAttribute

bool QwtPlotItem::testRenderHint (RenderHinthint) const [inherited]Test a render hint

Parameters:

hint Render hint

Returns:

true/false

See also:

setRenderHint(), RenderHint

const QwtText & QwtPlotItem::title () const [inherited]Returns:

Title of the item

See also:

setTitle()

QRect QwtPlotItem::transform (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtDoubleRect &rect) const [inherited]Transform a rectangle

Parameters:

xMap X map
yMap Y map
rect Rectangle in scale coordinates

Returns:

Rectangle in paint coordinates

See also:

invTransform()

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

Parameters:

legend Legend

See also:

legendItem(), itemChanged(), QwtLegend()

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

Parameters:

xScaleDiv Scale division of the x-axis
yScaleDiv Scale division of the y-axis

See also:

QwtPlot::updateAxes()

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.

Returns:

setZ(), QwtPlotDict::itemList()

Author

Generated automatically by Doxygen for Qwt User's Guide from the source code.