QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_vectorfield.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_VECTOR_FIELD_H
28#define QWT_PLOT_VECTOR_FIELD_H
29
30#include "qwt_global.h"
31#include "qwt_plot_seriesitem.h"
33class QwtColorMap;
34class QPen;
35class QBrush;
36
55class QWT_EXPORT QwtPlotVectorField : public QwtPlotSeriesItem, public QwtSeriesStore< QwtVectorFieldSample >
56{
57public:
72 {
75
78
80 OriginCenter
81 };
82
97 {
114 FilterVectors = 0x01
115 };
116
117 Q_DECLARE_FLAGS(PaintAttributes, PaintAttribute)
118
119
136 {
148 MagnitudeAsColor = 0x01,
149
161 MagnitudeAsLength = 0x02
162 };
163
164 Q_DECLARE_FLAGS(MagnitudeModes, MagnitudeMode)
165
166 // Constructor
167 explicit QwtPlotVectorField(const QString& title = QString());
168 // Constructor with title
169 explicit QwtPlotVectorField(const QwtText& title);
170
171 // Destructor
172 virtual ~QwtPlotVectorField();
173
174 // Set a paint attribute
175 void setPaintAttribute(PaintAttribute, bool on = true);
176 // Test a paint attribute
177 bool testPaintAttribute(PaintAttribute) const;
178
179 // Set a magnitude mode
180 void setMagnitudeMode(MagnitudeMode, bool on = true);
181 // Test a magnitude mode
182 bool testMagnitudeMode(MagnitudeMode) const;
183
184 // Set the symbol
185 void setSymbol(QwtVectorFieldSymbol*);
186 // Get the symbol
187 const QwtVectorFieldSymbol* symbol() const;
188
189 // Set the pen
190 void setPen(const QPen&);
191 // Get the pen
192 QPen pen() const;
193
194 // Set the brush
195 void setBrush(const QBrush&);
196 // Get the brush
197 QBrush brush() const;
198
199 // Set the raster size
200 void setRasterSize(const QSizeF&);
201 // Get the raster size
202 QSizeF rasterSize() const;
203
204 // Set the indicator origin
205 void setIndicatorOrigin(IndicatorOrigin);
206 // Get the indicator origin
207 IndicatorOrigin indicatorOrigin() const;
208
209 // Set the samples
210 void setSamples(const QVector< QwtVectorFieldSample >&);
211 // Set the samples
212 void setSamples(QwtVectorFieldData*);
213
214 // Set the color map
215 void setColorMap(QwtColorMap*);
216 // Get the color map
217 const QwtColorMap* colorMap() const;
218
219 // Set the magnitude range
220 void setMagnitudeRange(const QwtInterval&);
221 // Get the magnitude range
222 QwtInterval magnitudeRange() const;
223
224 // Set the minimum arrow length
225 void setMinArrowLength(double);
226 // Get the minimum arrow length
227 double minArrowLength() const;
228
229 // Set the maximum arrow length
230 void setMaxArrowLength(double);
231 // Get the maximum arrow length
232 double maxArrowLength() const;
233
234 // Calculate the arrow length for a given magnitude
235 virtual double arrowLength(double magnitude) const;
236
237 // Get the bounding rectangle
238 virtual QRectF boundingRect() const override;
239
240 // Draw the series
241 virtual void drawSeries(QPainter*,
242 const QwtScaleMap& xMap,
243 const QwtScaleMap& yMap,
244 const QRectF& canvasRect,
245 int from,
246 int to) const override;
247
248 // Get the runtime type information
249 virtual int rtti() const override;
250
251 // Get the legend icon
252 virtual QwtGraphic legendIcon(int index, const QSizeF&) const override;
253
254 // Set the magnitude scale factor
255 void setMagnitudeScaleFactor(double factor);
256 // Get the magnitude scale factor
257 double magnitudeScaleFactor() const;
258
259protected:
260 virtual void
261 drawSymbols(QPainter*, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect, int from, int to) const;
262
263 virtual void drawSymbol(QPainter*, double x, double y, double vx, double vy) const;
264
265 virtual void dataChanged() override;
266
267private:
268 void init();
269
270 class PrivateData;
271 PrivateData* m_data;
272};
273
274Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotVectorField::PaintAttributes)
275Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotVectorField::MagnitudeModes)
276
277#endif
QwtColorMap 用于将数值映射为颜色。
Definition qwt_color_map.h:62
可缩放图形的绘制设备
Definition qwt_graphic.h:128
表示区间的类
Definition qwt_interval.h:45
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
Return a legend icon
Definition qwt_plot_item.cpp:621
virtual int rtti() const
Runtime type information
Definition qwt_plot_item.cpp:215
表示一系列样本的绘图项的基类
Definition qwt_plot_seriesitem.h:53
virtual void dataChanged() override
dataChanged() indicates, that the series has been changed.
Definition qwt_plot_seriesitem.cpp:202
virtual QRectF boundingRect() const override
获取边界矩形
Definition qwt_plot_seriesitem.cpp:174
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const =0
绘制样本的子集
表示矢量场的绘图项
Definition qwt_plot_vectorfield.h:56
IndicatorOrigin
指示器原点
Definition qwt_plot_vectorfield.h:72
@ OriginHead
symbol points to the sample position
Definition qwt_plot_vectorfield.h:74
@ OriginTail
The arrow starts at the sample position
Definition qwt_plot_vectorfield.h:77
MagnitudeMode
大小模式
Definition qwt_plot_vectorfield.h:136
PaintAttribute
绘制属性
Definition qwt_plot_vectorfield.h:97
刻度映射
Definition qwt_scale_map.h:52
存储 QwtSeriesData 对象的类
Definition qwt_series_store.h:109
表示文本的类
Definition qwt_text.h:93
向量场样本数组迭代接口
Definition qwt_series_data.h:311
定义箭头绘制例程的抽象接口。
Definition qwt_vectorfield_symbol.h:66