Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
QwtPlotRasterItem Class Referenceabstract

A class, which displays raster data. More...

#include <qwt_plot_rasteritem.h>

Inheritance diagram for QwtPlotRasterItem:
Inheritance graph
[legend]

Classes

class  PrivateData
 

Public Types

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

int alpha () const
 
virtual QRectF boundingRect () const QWT_OVERRIDE
 
CachePolicy cachePolicy () const
 
virtual void draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const QWT_OVERRIDE
 Draw the raster data. More...
 
virtual QwtInterval interval (Qt::Axis) const
 
void invalidateCache ()
 
virtual QRectF pixelHint (const QRectF &) const
 Pixel hint. More...
 
 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< QwtLegendDatalegendData () 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...
 
QwtPlotplot () const
 Return attached plot. More...
 
 QwtPlotItem ()
 
 QwtPlotItem (const QString &title)
 
 QwtPlotItem (const QwtText &title)
 
uint renderThreadCount () const
 
virtual int rtti () 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 QwtTexttitle () 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 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...
 
virtual QImage renderImage (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &area, const QSize &imageSize) const =0
 Render 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 Member Functions

QImage compose (const QwtScaleMap &, const QwtScaleMap &, const QRectF &imageArea, const QRectF &paintRect, const QSize &imageSize, bool doCache) const
 
void init ()
 
QwtPlotRasterItemoperator= (const QwtPlotRasterItem &)
 
 QwtPlotRasterItem (const QwtPlotRasterItem &)
 

Private Attributes

PrivateDatam_data
 

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

Definition at line 37 of file qwt_plot_rasteritem.h.

Member Enumeration Documentation

◆ CachePolicy

Cache policy The default policy is NoCache.

Enumerator
NoCache 

renderImage() is called each time 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 useful for improving the performance of hide/show operations or manipulations of the alpha value. All other situations are handled by the canvas backing store.

Definition at line 44 of file qwt_plot_rasteritem.h.

◆ PaintAttribute

Attributes to modify the drawing algorithm.

See also
setPaintAttribute(), testPaintAttribute()
Enumerator
PaintInDeviceResolution 

When the image is rendered according to the data pixels ( QwtRasterData::pixelHint() ) it can be expanded to paint device resolution before it is passed to QPainter. The expansion algorithm rounds the pixel borders in the same way as the axis ticks, what is usually better than the scaling algorithm implemented in Qt. Disabling this flag might make sense, to reduce the size of a document/file. If this is possible for a document format depends on the implementation of the specific QPaintEngine.

Definition at line 66 of file qwt_plot_rasteritem.h.

Constructor & Destructor Documentation

◆ QwtPlotRasterItem() [1/3]

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

Constructor.

Definition at line 434 of file qwt_plot_rasteritem.cpp.

◆ QwtPlotRasterItem() [2/3]

QwtPlotRasterItem::QwtPlotRasterItem ( const QwtText title)
explicit

Constructor.

Definition at line 441 of file qwt_plot_rasteritem.cpp.

◆ ~QwtPlotRasterItem()

QwtPlotRasterItem::~QwtPlotRasterItem ( )
virtual

Destructor.

Definition at line 448 of file qwt_plot_rasteritem.cpp.

◆ QwtPlotRasterItem() [3/3]

QwtPlotRasterItem::QwtPlotRasterItem ( const QwtPlotRasterItem )
explicitprivate

Member Function Documentation

◆ alpha()

int QwtPlotRasterItem::alpha ( ) const
Returns
Alpha value of the raster item
See also
setAlpha()

Definition at line 530 of file qwt_plot_rasteritem.cpp.

◆ boundingRect()

QRectF QwtPlotRasterItem::boundingRect ( ) const
virtual
Returns
Bounding rectangle of the data
See also
QwtPlotRasterItem::interval()

Reimplemented from QwtPlotItem.

Definition at line 800 of file qwt_plot_rasteritem.cpp.

◆ cachePolicy()

QwtPlotRasterItem::CachePolicy QwtPlotRasterItem::cachePolicy ( ) const
Returns
Cache policy
See also
CachePolicy, setCachePolicy()

Definition at line 559 of file qwt_plot_rasteritem.cpp.

◆ compose()

QImage QwtPlotRasterItem::compose ( const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRectF &  imageArea,
const QRectF &  paintRect,
const QSize &  imageSize,
bool  doCache 
) const
private

Definition at line 839 of file qwt_plot_rasteritem.cpp.

◆ draw()

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

Draw the raster data.

Parameters
painterPainter
xMapX-Scale Map
yMapY-Scale Map
canvasRectContents rectangle of the plot canvas

Implements QwtPlotItem.

Reimplemented in QwtPlotSpectrogram.

Definition at line 614 of file qwt_plot_rasteritem.cpp.

◆ imageMap()

QwtScaleMap QwtPlotRasterItem::imageMap ( Qt::Orientation  orientation,
const QwtScaleMap map,
const QRectF &  area,
const QSize &  imageSize,
double  pixelSize 
) const
protectedvirtual

Calculate a scale map for painting to an image.

Parameters
orientationOrientation, Qt::Horizontal means a X axis
mapScale map for rendering the plot item
areaArea to be painted on the image
imageSizeImage size
pixelSizeWidth/Height of a data pixel
Returns
Calculated scale map

Definition at line 939 of file qwt_plot_rasteritem.cpp.

◆ init()

void QwtPlotRasterItem::init ( )
private

Definition at line 453 of file qwt_plot_rasteritem.cpp.

◆ interval()

QwtInterval QwtPlotRasterItem::interval ( Qt::Axis  axis) const
virtual
Returns
Bounding interval for an axis

This method is intended to be reimplemented by derived classes. The default implementation returns an invalid interval.

Parameters
axisX, Y, or Z axis

Reimplemented in QwtPlotSpectrogram.

Definition at line 790 of file qwt_plot_rasteritem.cpp.

◆ invalidateCache()

void QwtPlotRasterItem::invalidateCache ( )

Invalidate the paint cache

See also
setCachePolicy()

Definition at line 568 of file qwt_plot_rasteritem.cpp.

◆ operator=()

QwtPlotRasterItem& QwtPlotRasterItem::operator= ( const QwtPlotRasterItem )
private

◆ pixelHint()

QRectF QwtPlotRasterItem::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.

Width and height of the hint need to be the horizontal and vertical distances between 2 neighbored points. The center of the hint has to be the position of any point ( it doesn't matter which one ).

Limiting the resolution of the image might significantly improve the performance and heavily reduce the amount of memory when rendering a QImage from the raster data.

The default implementation returns an empty rectangle (QRectF()), meaning, that the image will be rendered in target device ( f.e screen ) resolution.

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

Reimplemented in QwtPlotSpectrogram.

Definition at line 601 of file qwt_plot_rasteritem.cpp.

◆ renderImage()

virtual QImage QwtPlotRasterItem::renderImage ( const QwtScaleMap xMap,
const QwtScaleMap yMap,
const QRectF &  area,
const QSize &  imageSize 
) const
protectedpure virtual

Render an image.

An implementation of render() might iterate over all pixels of imageRect. Each pixel has to be translated into the corresponding position in scale coordinates using the maps. This position can be used to look up a value in a implementation specific way and to map it into a color.

Parameters
xMapX-Scale Map
yMapY-Scale Map
areaRequested area for the image in scale coordinates
imageSizeRequested size of the image
Returns
Rendered image

Implemented in QwtPlotSpectrogram.

◆ setAlpha()

void QwtPlotRasterItem::setAlpha ( int  alpha)

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

Definition at line 510 of file qwt_plot_rasteritem.cpp.

◆ setCachePolicy()

void QwtPlotRasterItem::setCachePolicy ( QwtPlotRasterItem::CachePolicy  policy)

Change the cache policy

The default policy is NoCache

Parameters
policyCache policy
See also
CachePolicy, cachePolicy()

Definition at line 543 of file qwt_plot_rasteritem.cpp.

◆ setPaintAttribute()

void QwtPlotRasterItem::setPaintAttribute ( PaintAttribute  attribute,
bool  on = true 
)

Specify an attribute how to draw the raster item

Parameters
attributePaint attribute
onOn/Off /sa PaintAttribute, testPaintAttribute()

Definition at line 470 of file qwt_plot_rasteritem.cpp.

◆ testPaintAttribute()

bool QwtPlotRasterItem::testPaintAttribute ( PaintAttribute  attribute) const
Returns
True, when attribute is enabled
See also
PaintAttribute, setPaintAttribute()

Definition at line 482 of file qwt_plot_rasteritem.cpp.

Member Data Documentation

◆ m_data

PrivateData* QwtPlotRasterItem::m_data
private

Definition at line 145 of file qwt_plot_rasteritem.h.


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


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:51