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
16 class QwtVectorFieldSymbol;
17 class QwtColorMap;
18 class QPen;
19 class QBrush;
20
30 class QWT_EXPORT QwtPlotVectorField
31 : public QwtPlotSeriesItem
32 , public QwtSeriesStore< QwtVectorFieldSample >
33{
34 public:
39 enum IndicatorOrigin
40 {
42 OriginHead,
43
45 OriginTail,
46
48 OriginCenter
49 };
50
55 enum PaintAttribute
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
75 enum MagnitudeMode
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
QVector
Definition qwt_clipper.h:23
QwtArraySeriesData
Template class for data, that is organized as QVector.
Definition qwt_series_data.h:153
QwtColorMap
QwtColorMap is used to map values into colors.
Definition qwt_color_map.h:38
QwtGraphic
A paint device for scalable graphics.
Definition qwt_graphic.h:76
QwtInterval
A class representing an interval.
Definition qwt_interval.h:23
QwtPlotSeriesItem
Base class for plot items representing a series of samples.
Definition qwt_plot_seriesitem.h:26
QwtPlotSeriesItem::boundingRect
virtual QRectF boundingRect() const override
Definition qwt_plot_seriesitem.cpp:97
QwtPlotVectorField
A plot item, that represents a vector field.
Definition qwt_plot_vectorfield.h:33
QwtPlotVectorField::IndicatorOrigin
IndicatorOrigin
Definition qwt_plot_vectorfield.h:40
QwtPlotVectorField::OriginHead
@ OriginHead
symbol points to the sample position
Definition qwt_plot_vectorfield.h:42
QwtPlotVectorField::OriginTail
@ OriginTail
The arrow starts at the sample position.
Definition qwt_plot_vectorfield.h:45
QwtPlotVectorField::MagnitudeMode
MagnitudeMode
Definition qwt_plot_vectorfield.h:76
QwtPlotVectorField::PaintAttribute
PaintAttribute
Definition qwt_plot_vectorfield.h:56
QwtPlotVectorField::MagnitudeModes
QFlags< MagnitudeMode > MagnitudeModes
Definition qwt_plot_vectorfield.h:90
QwtPlotVectorField::PaintAttributes
QFlags< PaintAttribute > PaintAttributes
Definition qwt_plot_vectorfield.h:67
QwtScaleMap
A scale map.
Definition qwt_scale_map.h:27
QwtSeriesStore
Class storing a QwtSeriesData object.
Definition qwt_series_store.h:67
QwtText
A class representing a text.
Definition qwt_text.h:52
QwtVectorFieldSymbol
Definition qwt_vectorfield_symbol.h:33