QWT 7.0.1
Loading...
Searching...
No Matches
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"
32
34class QwtColorMap;
35class QPen;
36class QBrush;
37
47class QWT_EXPORT QwtPlotVectorField
48 : public QwtPlotSeriesItem
49 , public QwtSeriesStore< QwtVectorFieldSample >
50{
51 public:
57 {
60
63
65 OriginCenter
66 };
67
73 {
74 /*
75 FilterVectors calculates an average sample from all samples
76 that lie in the same cell of a grid that is determined by
77 setting the rasterSize().
78
79 \sa setRasterSize()
80 */
81 FilterVectors = 0x01
82 };
83
84 Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
85
86
93 {
98 MagnitudeAsColor = 0x01,
99
104 MagnitudeAsLength = 0x02
105 };
106
107 Q_DECLARE_FLAGS( MagnitudeModes, MagnitudeMode )
108
109 explicit QwtPlotVectorField( const QString& title = QString() );
110 explicit QwtPlotVectorField( const QwtText& title );
111
112 virtual ~QwtPlotVectorField();
113
114 void setPaintAttribute( PaintAttribute, bool on = true );
115 bool testPaintAttribute( PaintAttribute ) const;
116
117 void setMagnitudeMode( MagnitudeMode, bool on = true );
118 bool testMagnitudeMode( MagnitudeMode ) const;
119
120 void setSymbol( QwtVectorFieldSymbol* );
121 const QwtVectorFieldSymbol* symbol() const;
122
123 void setPen( const QPen& );
124 QPen pen() const;
125
126 void setBrush( const QBrush& );
127 QBrush brush() const;
128
129 void setRasterSize( const QSizeF& );
130 QSizeF rasterSize() const;
131
132 void setIndicatorOrigin( IndicatorOrigin );
133 IndicatorOrigin indicatorOrigin() const;
134
135 void setSamples( const QVector< QwtVectorFieldSample >& );
136 void setSamples( QwtVectorFieldData* );
137
138 void setColorMap( QwtColorMap* );
139 const QwtColorMap* colorMap() const;
140
141 void setMagnitudeRange( const QwtInterval& );
142 QwtInterval magnitudeRange() const;
143
144 void setMinArrowLength( double );
145 double minArrowLength() const;
146
147 void setMaxArrowLength( double );
148 double maxArrowLength() const;
149
150 virtual double arrowLength( double magnitude ) const;
151
152 virtual QRectF boundingRect() const QWT_OVERRIDE;
153
154 virtual void drawSeries( QPainter*,
155 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
156 const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
157
158 virtual int rtti() const QWT_OVERRIDE;
159
160 virtual QwtGraphic legendIcon(
161 int index, const QSizeF& ) const QWT_OVERRIDE;
162
163 void setMagnitudeScaleFactor( double factor );
164 double magnitudeScaleFactor() const;
165
166 protected:
167 virtual void drawSymbols( QPainter*,
168 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
169 const QRectF& canvasRect, int from, int to ) const;
170
171 virtual void drawSymbol( QPainter*,
172 double x, double y, double vx, double vy ) const;
173
174 virtual void dataChanged() QWT_OVERRIDE;
175
176 private:
177 void init();
178
179 class PrivateData;
180 PrivateData* m_data;
181};
182
183Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotVectorField::PaintAttributes )
184Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotVectorField::MagnitudeModes )
185
186#endif
QwtColorMap is used to map values into colors.
Definition qwt_color_map.h:56
A paint device for scalable graphics.
Definition qwt_graphic.h:93
A class representing an interval.
Definition qwt_interval.h:40
Base class for plot items representing a series of samples.
Definition qwt_plot_seriesitem.h:43
virtual QRectF boundingRect() const QWT_OVERRIDE
Definition qwt_plot_seriesitem.cpp:114
A plot item, that represents a vector field.
Definition qwt_plot_vectorfield.h:50
IndicatorOrigin
Depending on the origin the indicator symbol ( usually an arrow ) will be to the position of the corr...
Definition qwt_plot_vectorfield.h:57
@ OriginHead
symbol points to the sample position
Definition qwt_plot_vectorfield.h:59
@ OriginTail
The arrow starts at the sample position.
Definition qwt_plot_vectorfield.h:62
MagnitudeMode
Depending on the MagnitudeMode the magnitude component will have an impact on the attributes of the s...
Definition qwt_plot_vectorfield.h:93
PaintAttribute
Attributes to modify the rendering.
Definition qwt_plot_vectorfield.h:73
A scale map.
Definition qwt_scale_map.h:44
Class storing a QwtSeriesData object.
Definition qwt_series_store.h:96
A class representing a text.
Definition qwt_text.h:69
Interface for iterating over an array of vector field samples.
Definition qwt_series_data.h:284
Defines abstract interface for arrow drawing routines.
Definition qwt_vectorfield_symbol.h:50