Qwt User's Guide 6.3.0
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
10#ifndef QWT_PLOT_VECTOR_FIELD_H
11#define QWT_PLOT_VECTOR_FIELD_H
12
13#include "qwt_global.h"
14#include "qwt_plot_seriesitem.h"
15
17class QwtColorMap;
18class QPen;
19class QBrush;
20
30class QWT_EXPORT QwtPlotVectorField
31 : public QwtPlotSeriesItem
32 , public QwtSeriesStore< QwtVectorFieldSample >
33{
34 public:
40 {
43
46
48 OriginCenter
49 };
50
56 {
57 /*
58 FilterVectors calculates an average sample from all samples
59 that lie in the same cell of a grid that is determined by
60 setting the rasterSize().
61
62 \sa setRasterSize()
63 */
64 FilterVectors = 0x01
65 };
66
67 Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
68
69
76 {
81 MagnitudeAsColor = 0x01,
82
87 MagnitudeAsLength = 0x02
88 };
89
90 Q_DECLARE_FLAGS( MagnitudeModes, MagnitudeMode )
91
92 explicit QwtPlotVectorField( const QString& title = QString() );
93 explicit QwtPlotVectorField( const QwtText& title );
94
95 virtual ~QwtPlotVectorField();
96
97 void setPaintAttribute( PaintAttribute, bool on = true );
98 bool testPaintAttribute( PaintAttribute ) const;
99
100 void setMagnitudeMode( MagnitudeMode, bool on = true );
101 bool testMagnitudeMode( MagnitudeMode ) const;
102
103 void setSymbol( QwtVectorFieldSymbol* );
104 const QwtVectorFieldSymbol* symbol() const;
105
106 void setPen( const QPen& );
107 QPen pen() const;
108
109 void setBrush( const QBrush& );
110 QBrush brush() const;
111
112 void setRasterSize( const QSizeF& );
113 QSizeF rasterSize() const;
114
115 void setIndicatorOrigin( IndicatorOrigin );
116 IndicatorOrigin indicatorOrigin() const;
117
118 void setSamples( const QVector< QwtVectorFieldSample >& );
119 void setSamples( QwtVectorFieldData* );
120
121 void setColorMap( QwtColorMap* );
122 const QwtColorMap* colorMap() const;
123
124 void setMagnitudeRange( const QwtInterval& );
125 QwtInterval magnitudeRange() const;
126
127 void setMinArrowLength( double );
128 double minArrowLength() const;
129
130 void setMaxArrowLength( double );
131 double maxArrowLength() const;
132
133 virtual double arrowLength( double magnitude ) const;
134
135 virtual QRectF boundingRect() const QWT_OVERRIDE;
136
137 virtual void drawSeries( QPainter*,
138 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
139 const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
140
141 virtual int rtti() const QWT_OVERRIDE;
142
143 virtual QwtGraphic legendIcon(
144 int index, const QSizeF& ) const QWT_OVERRIDE;
145
146 void setMagnitudeScaleFactor( double factor );
147 double magnitudeScaleFactor() const;
148
149 protected:
150 virtual void drawSymbols( QPainter*,
151 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
152 const QRectF& canvasRect, int from, int to ) const;
153
154 virtual void drawSymbol( QPainter*,
155 double x, double y, double vx, double vy ) const;
156
157 virtual void dataChanged() QWT_OVERRIDE;
158
159 private:
160 void init();
161
162 class PrivateData;
163 PrivateData* m_data;
164};
165
166Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotVectorField::PaintAttributes )
167Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotVectorField::MagnitudeModes )
168
169#endif
Template class for data, that is organized as QVector.
QwtColorMap is used to map values into colors.
A paint device for scalable graphics.
Definition qwt_graphic.h:76
A class representing an interval.
Base class for plot items representing a series of samples.
virtual QRectF boundingRect() const override
A plot item, that represents a vector field.
@ OriginHead
symbol points to the sample position
@ OriginTail
The arrow starts at the sample position.
QFlags< MagnitudeMode > MagnitudeModes
QFlags< PaintAttribute > PaintAttributes
A scale map.
Class storing a QwtSeriesData object.
A class representing a text.
Definition qwt_text.h:52