QWT API (中文) 7.3.0
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
46class QWT_EXPORT QwtPlotVectorField : public QwtPlotSeriesItem, public QwtSeriesStore< QwtVectorFieldSample >
47{
48public:
56 {
59
62
64 OriginCenter
65 };
66
74 {
83 FilterVectors = 0x01
84 };
85
86 Q_DECLARE_FLAGS(PaintAttributes, PaintAttribute)
87
88
97 {
103 MagnitudeAsColor = 0x01,
104
110 MagnitudeAsLength = 0x02
111 };
112
113 Q_DECLARE_FLAGS(MagnitudeModes, MagnitudeMode)
114
115 // Constructor
116 explicit QwtPlotVectorField(const QString& title = QString());
117 // Constructor with title
118 explicit QwtPlotVectorField(const QwtText& title);
119
120 // Destructor
121 ~QwtPlotVectorField() override;
122
123 // Set a paint attribute
124 void setPaintAttribute(PaintAttribute, bool on = true);
125 // Test a paint attribute
126 bool testPaintAttribute(PaintAttribute) const;
127
128 // Set a magnitude mode
129 void setMagnitudeMode(MagnitudeMode, bool on = true);
130 // Test a magnitude mode
131 bool testMagnitudeMode(MagnitudeMode) const;
132
133 // Set the symbol
134 void setSymbol(QwtVectorFieldSymbol*);
135 // Get the symbol
136 const QwtVectorFieldSymbol* symbol() const;
137
138 // Set the pen
139 void setPen(const QPen&);
140 // Get the pen
141 QPen pen() const;
142
143 // Set the brush
144 void setBrush(const QBrush&);
145 // Get the brush
146 QBrush brush() const;
147
148 // Set the raster size
149 void setRasterSize(const QSizeF&);
150 // Get the raster size
151 QSizeF rasterSize() const;
152
153 // Set the indicator origin
154 void setIndicatorOrigin(IndicatorOrigin);
155 // Get the indicator origin
156 IndicatorOrigin indicatorOrigin() const;
157
158 // Set the samples
159 void setSamples(const QVector< QwtVectorFieldSample >&);
160 // Set the samples
161 void setSamples(QwtVectorFieldData*);
162
163 // Set the color map
164 void setColorMap(QwtColorMap*);
165 // Get the color map
166 const QwtColorMap* colorMap() const;
167
168 // Set the magnitude range
169 void setMagnitudeRange(const QwtInterval&);
170 // Get the magnitude range
171 QwtInterval magnitudeRange() const;
172
173 // Set the minimum arrow length
174 void setMinArrowLength(double);
175 // Get the minimum arrow length
176 double minArrowLength() const;
177
178 // Set the maximum arrow length
179 void setMaxArrowLength(double);
180 // Get the maximum arrow length
181 double maxArrowLength() const;
182
183 // Calculate the arrow length for a given magnitude
184 virtual double arrowLength(double magnitude) const;
185
186 // Get the bounding rectangle
187 virtual QRectF boundingRect() const override;
188
189 // Draw the series
190 virtual void drawSeries(QPainter*,
191 const QwtScaleMap& xMap,
192 const QwtScaleMap& yMap,
193 const QRectF& canvasRect,
194 int from,
195 int to) const override;
196
197 // Get the runtime type information
198 virtual int rtti() const override;
199
200 // Get the legend icon
201 virtual QwtGraphic legendIcon(int index, const QSizeF&) const override;
202
203 // Set the magnitude scale factor
204 void setMagnitudeScaleFactor(double factor);
205 // Get the magnitude scale factor
206 double magnitudeScaleFactor() const;
207
208protected:
209 virtual void
210 drawSymbols(QPainter*, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect, int from, int to) const;
211
212 virtual void drawSymbol(QPainter*, double x, double y, double vx, double vy) const;
213
214 virtual void dataChanged() override;
215
216private:
217 void init();
218
219 QWT_DECLARE_PRIVATE(QwtPlotVectorField)
220};
221
222Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotVectorField::PaintAttributes)
223Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotVectorField::MagnitudeModes)
224
225#endif
QwtColorMap is used to map values into colors.
Definition qwt_colormap.h:33
A paint device for scalable graphics
Definition qwt_graphic.h:85
A class representing an interval
Definition qwt_interval.h:39
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
Return a legend icon
Definition qwt_plot_item.cpp:420
virtual int rtti() const
Runtime type information
Definition qwt_plot_item.cpp:155
Base class for plot items representing a series of samples
Definition qwt_plot_seriesitem.h:44
virtual void dataChanged() override
dataChanged() indicates, that the series has been changed.
Definition qwt_plot_seriesitem.cpp:131
virtual QRectF boundingRect() const override
Get the bounding rectangle
Definition qwt_plot_seriesitem.cpp:114
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const =0
Draw a subset of the samples
A plot item, that represents a vector field
Definition qwt_plot_vectorfield.h:47
IndicatorOrigin
Indicator origin
Definition qwt_plot_vectorfield.h:56
@ OriginHead
symbol points to the sample position
Definition qwt_plot_vectorfield.h:58
@ OriginTail
The arrow starts at the sample position
Definition qwt_plot_vectorfield.h:61
MagnitudeMode
Magnitude mode
Definition qwt_plot_vectorfield.h:97
PaintAttribute
Paint attributes
Definition qwt_plot_vectorfield.h:74
A scale map
Definition qwt_scale_map.h:44
Class storing a QwtSeriesData object
Definition qwt_series_store.h:91
A class representing a text
Definition qwt_text.h:70
Interface for iterating over an array of vector field samples
Definition qwt_series_data.h:291
Defines abstract interface for arrow drawing routines.
Definition qwt_vectorfield_symbol.h:51