QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
| Public 类型 | Public 成员函数 | Protected 成员函数 | 所有成员列表
QwtPlotRasterItem类 参考abstract

A class, which displays raster data 更多...

#include <qwt_plot_rasteritem.h>

类 QwtPlotRasterItem 继承关系图:
QwtPlotItem QwtPlotSpectrogram

class  PrivateData
 

Public 类型

enum  CachePolicy { NoCache , PaintCache }
 Cache policy 更多...
 
enum  PaintAttribute { PaintInDeviceResolution = 1 }
 Paint attributes 更多...
 
- Public 类型 继承自 QwtPlotItem
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_PlotArrowMarker , Rtti_PlotBoxChart ,
  Rtti_PlotUserItem = 1000
}
 Runtime type information 更多...
 
enum  ItemAttribute { Legend = 0x01 , AutoScale = 0x02 , Margins = 0x04 }
 Plot Item Attributes 更多...
 
enum  ItemInterest { ScaleInterest = 0x01 , LegendInterest = 0x02 }
 Plot Item Interests 更多...
 
enum  RenderHint { RenderAntialiased = 0x1 }
 Render hints 更多...
 

Public 成员函数

 QwtPlotRasterItem (const QString &title=QString())
 Constructor
 
 QwtPlotRasterItem (const QwtText &title)
 
void setPaintAttribute (PaintAttribute, bool on=true)
 Set a paint attribute
 
bool testPaintAttribute (PaintAttribute) const
 Test a paint attribute
 
void setAlpha (int alpha)
 Set an alpha value for the raster data
 
int alpha () const
 Get the alpha value of the raster item
 
void setCachePolicy (CachePolicy)
 Change the cache policy
 
CachePolicy cachePolicy () const
 Get the cache policy
 
void invalidateCache ()
 Invalidate the paint cache
 
virtual void draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override
 Draw the raster data
 
virtual QRectF pixelHint (const QRectF &) const
 Pixel hint
 
virtual QwtInterval interval (Qt::Axis) const
 Get the bounding interval for an axis
 
virtual QRectF boundingRect () const override
 Get the bounding rectangle of the data
 
- Public 成员函数 继承自 QwtPlotItem
 QwtPlotItem ()
 Default constructor
 
 QwtPlotItem (const QString &title)
 Constructor with title as QString
 
 QwtPlotItem (const QwtText &title)
 Constructor with title as QwtText
 
virtual ~QwtPlotItem ()
 Destructor
 
virtual void attach (QwtPlot *plot)
 Attach the item to a plot
 
void detach ()
 Detach the item from the plot
 
QwtPlotplot () const
 Get the plot the item is attached to
 
void setTitle (const QString &title)
 Set the title using a QString
 
void setTitle (const QwtText &title)
 Set the title using a QwtText
 
const QwtTexttitle () const
 Get the title
 
virtual int rtti () const
 Runtime type information
 
void setItemAttribute (ItemAttribute, bool on=true)
 Set an item attribute
 
bool testItemAttribute (ItemAttribute) const
 Test an item attribute
 
void setItemInterest (ItemInterest, bool on=true)
 Set an item interest
 
bool testItemInterest (ItemInterest) const
 Test an item interest
 
void setRenderHint (RenderHint, bool on=true)
 Set a render hint
 
bool testRenderHint (RenderHint) const
 Test a render hint
 
void setRenderThreadCount (uint numThreads)
 Set the number of render threads
 
uint renderThreadCount () const
 Get the number of render threads
 
void setLegendIconSize (const QSize &)
 Set the legend icon size
 
QSize legendIconSize () const
 Get the legend icon size
 
double z () const
 Get the z-value
 
void setZ (double z)
 Set the z-value
 
void show ()
 Show the item
 
void hide ()
 Hide the item
 
virtual void setVisible (bool)
 Set the visibility
 
bool isVisible () const
 Check if the item is visible
 
void setAxes (QwtAxisId xAxis, QwtAxisId yAxis)
 Set both axes
 
void setXAxis (QwtAxisId)
 Set the x-axis
 
QwtAxisId xAxis () const
 Get the x-axis
 
void setYAxis (QwtAxisId)
 Set the y-axis
 
QwtAxisId yAxis () const
 Get the y-axis
 
virtual void itemChanged ()
 Notify the plot that the item has changed
 
virtual void legendChanged ()
 Notify the item that the legend has changed
 
virtual void getCanvasMarginHint (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const
 Get margin hints for the canvas
 
virtual void updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &)
 Update the item with new scale divisions
 
virtual void updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &)
 Update the item with changes of the legend
 
QRectF scaleRect (const QwtScaleMap &, const QwtScaleMap &) const
 Calculate the scale rectangle
 
QRectF paintRect (const QwtScaleMap &, const QwtScaleMap &) const
 Calculate the paint rectangle
 
virtual QList< QwtLegendDatalegendData () const
 Return legend data
 
virtual QwtGraphic legendIcon (int index, const QSizeF &) const
 Return a legend icon
 

Protected 成员函数

virtual QImage renderImage (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &area, const QSize &imageSize) const =0
 
virtual QwtScaleMap imageMap (Qt::Orientation, const QwtScaleMap &map, const QRectF &area, const QSize &imageSize, double pixelSize) const
 Get the image map
 
- Protected 成员函数 继承自 QwtPlotItem
QwtGraphic defaultIcon (const QBrush &, const QSizeF &) const
 Create a default icon
 

详细描述

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. (e.g 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.

参见
QwtPlotSpectrogram

成员枚举类型说明

◆ CachePolicy

Cache policy

The default policy is NoCache

枚举值
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.

◆ PaintAttribute

Paint attributes

Attributes to modify the drawing algorithm.

参见
setPaintAttribute(), testPaintAttribute()
枚举值
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.

构造及析构函数说明

◆ QwtPlotRasterItem()

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

Constructor

参数
[in]titleTitle of the raster item

Constructor with title

参数
[in]titleTitle of the raster item

Destructor

成员函数说明

◆ alpha()

int QwtPlotRasterItem::alpha ( ) const

Get the alpha value of the raster item

返回
Alpha value of the raster item
参见
setAlpha()

◆ boundingRect()

QRectF QwtPlotRasterItem::boundingRect ( ) const
overridevirtual

Get the bounding rectangle of the data

返回
Bounding rectangle of the data
参见
QwtPlotRasterItem::interval()

重载 QwtPlotItem .

◆ cachePolicy()

QwtPlotRasterItem::CachePolicy QwtPlotRasterItem::cachePolicy ( ) const

Get the cache policy

返回
Cache policy
参见
CachePolicy, setCachePolicy()

◆ draw()

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

Draw the raster data

参数
[in]painterPainter
[in]xMapX-Scale Map
[in]yMapY-Scale Map
[in]canvasRectContents rectangle of the plot canvas

实现了 QwtPlotItem.

QwtPlotSpectrogram 重载.

◆ imageMap()

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

Get the image map

Calculate a scale map for painting to an image

参数
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
返回
Calculated scale map

◆ interval()

QwtInterval QwtPlotRasterItem::interval ( Qt::Axis  axis) const
virtual

Get the bounding interval for an axis

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

参数
[in]axisX, Y, or Z axis
返回
Bounding interval for an axis

QwtPlotSpectrogram 重载.

◆ invalidateCache()

void QwtPlotRasterItem::invalidateCache ( )

Invalidate the paint cache

参见
setCachePolicy()

◆ pixelHint()

QRectF QwtPlotRasterItem::pixelHint ( const QRectF &  area) const
virtual

Pixel hint

The geometry of a pixel is used to calculate the resolution and alignment of the rendered image. Width and height of the hint need to be the horizontal and vertical distances between 2 neighboring 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 (e.g. screen) resolution.

参数
[in]areaIn most implementations the resolution of the data doesn't depend on the requested area
返回
Bounding rectangle of a pixel
参见
render(), renderImage()

QwtPlotSpectrogram 重载.

◆ renderImage()

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

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. (e.g. 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 >= 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.
    参数
    [in]alphaAlpha value
    参见
    alpha()

◆ setCachePolicy()

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

Change the cache policy

The default policy is NoCache

参数
[in]policyCache policy
参见
CachePolicy, cachePolicy()

◆ setPaintAttribute()

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

Set a paint attribute

参数
[in]attributePaint attribute
[in]onOn/Off
参见
PaintAttribute, testPaintAttribute()

◆ testPaintAttribute()

bool QwtPlotRasterItem::testPaintAttribute ( PaintAttribute  attribute) const

Test a paint attribute

参数
[in]attributePaint attribute
返回
True, when attribute is enabled
参见
PaintAttribute, setPaintAttribute()

该类的文档由以下文件生成: