QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_rasteritem.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *
9 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_PLOT_RASTERITEM_H
28#define QWT_PLOT_RASTERITEM_H
29
30#include "qwt_global.h"
31#include "qwt_plot_item.h"
32
33#include <qstring.h>
34
35class QwtInterval;
36
54class QWT_EXPORT QwtPlotRasterItem : public QwtPlotItem
55{
56public:
63 {
69
79 PaintCache
80 };
81
89 {
102 PaintInDeviceResolution = 1
103 };
104
105 Q_DECLARE_FLAGS(PaintAttributes, PaintAttribute)
106
107 // Constructor
108 explicit QwtPlotRasterItem(const QString& title = QString());
109 // Constructor with title
110 explicit QwtPlotRasterItem(const QwtText& title);
111 // Destructor
112 ~QwtPlotRasterItem() override;
113
114 // Set a paint attribute
115 void setPaintAttribute(PaintAttribute, bool on = true);
116 // Test a paint attribute
117 bool testPaintAttribute(PaintAttribute) const;
118
119 // Set the alpha value
120 void setAlpha(int alpha);
121 // Get the alpha value
122 int alpha() const;
123
124 // Set the cache policy
125 void setCachePolicy(CachePolicy);
126 // Get the cache policy
127 CachePolicy cachePolicy() const;
128
129 // Invalidate the cache
130 void invalidateCache();
131
132 // Draw the raster item
133 virtual void draw(QPainter*, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect) const override;
134
135 // Get the pixel hint
136 virtual QRectF pixelHint(const QRectF&) const;
137
138 // Get the interval for a specific axis
139 virtual QwtInterval interval(Qt::Axis) const;
140 // Get the bounding rectangle
141 virtual QRectF boundingRect() const override;
142
143protected:
144 // Render an image
145 virtual QImage
146 renderImage(const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& area, const QSize& imageSize) const = 0;
147
149 virtual QwtScaleMap
150 imageMap(Qt::Orientation, const QwtScaleMap& map, const QRectF& area, const QSize& imageSize, double pixelSize) const;
151
152private:
153 explicit QwtPlotRasterItem(const QwtPlotRasterItem&);
154 QwtPlotRasterItem& operator=(const QwtPlotRasterItem&);
155
157 void init();
158
160 QImage compose(const QwtScaleMap&,
161 const QwtScaleMap&,
162 const QRectF& imageArea,
163 const QRectF& paintRect,
164 const QSize& imageSize,
165 bool doCache) const;
166
167 QWT_DECLARE_PRIVATE(QwtPlotRasterItem)
168};
169
170Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotRasterItem::PaintAttributes)
171
172#endif
A class representing an interval
Definition qwt_interval.h:39
Base class for items on the plot canvas
Definition qwt_plot_item.h:85
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
Draw the item
virtual QRectF boundingRect() const
Get the bounding rectangle
Definition qwt_plot_item.cpp:593
A class, which displays raster data
Definition qwt_plot_rasteritem.h:55
PaintAttribute
Paint attributes
Definition qwt_plot_rasteritem.h:89
CachePolicy
Cache policy
Definition qwt_plot_rasteritem.h:63
@ NoCache
Definition qwt_plot_rasteritem.h:68
A scale map
Definition qwt_scale_map.h:44
A class representing a text
Definition qwt_text.h:70