Qwt User's Guide 6.2.0

qwt_plot_vectorfield.cpp
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 #include "qwt_plot_vectorfield.h"
11 #include "qwt_vectorfield_symbol.h"
12 #include "qwt_scale_map.h"
13 #include "qwt_color_map.h"
14 #include "qwt_painter.h"
15 #include "qwt_text.h"
16 #include "qwt_graphic.h"
17 #include "qwt_math.h"
18
19 #include <qpainter.h>
20 #include <qpainterpath.h>
21 #include <qdebug.h>
22 #include <cstdlib>
23 #include <limits>
24
25 #define DEBUG_RENDER 0
26
27 #if DEBUG_RENDER
28 #include <qelapsedtimer.h>
29 #endif
30
31
32 static inline double qwtVector2Radians( double vx, double vy )
33 {
34 if ( vx == 0.0 )
35 return ( vy >= 0 ) ? M_PI_2 : 3 * M_PI_2;
36
37 return std::atan2( vy, vx );
38 }
39
40 static inline double qwtVector2Magnitude( double vx, double vy )
41 {
42 return sqrt( vx * vx + vy * vy );
43 }
44
45 static QwtInterval qwtMagnitudeRange(
46 const QwtSeriesData< QwtVectorFieldSample >* series )
47 {
48 if ( series->size() == 0 )
49 return QwtInterval( 0, 1 );
50
51 const QwtVectorFieldSample s0 = series->sample( 0 );
52
53 double min = s0.vx * s0.vx + s0.vy * s0.vy;
54 double max = min;
55
56 for ( uint i = 1; i < series->size(); i++ )
57 {
58 const QwtVectorFieldSample s = series->sample( i );
59 const double l = s.vx * s.vx + s.vy * s.vy;
60
61 if ( l < min )
62 min = l;
63
64 if ( l > max )
65 max = l;
66 }
67
68 min = std::sqrt( min );
69 max = std::sqrt( max );
70
71 if ( max == min )
72 max += 1.0;
73
74 return QwtInterval( min, max );
75 }
76
77 static inline QTransform qwtSymbolTransformation(
78 const QTransform& oldTransform, double x, double y,
79 double vx, double vy, double magnitude )
80 {
81 QTransform transform = oldTransform;
82
83 if ( !transform.isIdentity() )
84 {
85 transform.translate( x, y );
86
87 const double radians = qwtVector2Radians( vx, vy );
88 transform.rotateRadians( radians );
89 }
90 else
91 {
92 /*
93 When starting with no transformation ( f.e on screen )
94 the matrix can be found without having to use
95 trigonometric functions
96 */
97
98 qreal sin, cos;
99 if ( magnitude == 0.0 )
100 {
101 // something
102 sin = 1.0;
103 cos = 0.0;
104 }
105 else
106 {
107 sin = vy / magnitude;
108 cos = vx / magnitude;
109 }
110
111 transform.setMatrix( cos, sin, 0.0, -sin, cos, 0.0, x, y, 1.0 );
112 }
113
114 return transform;
115 }
116
117 namespace
118 {
119 class FilterMatrix
120 {
121 public:
122 class Entry
123 {
124 public:
125 inline void addSample( double sx, double sy,
126 double svx, double svy )
127 {
128 x += sx;
129 y += sy;
130
131 vx += svx;
132 vy += svy;
133
134 count++;
135 }
136
137 quint32 count;
138
139 // screen positions -> float is good enough
140 float x;
141 float y;
142 float vx;
143 float vy;
144 };
145
146 FilterMatrix( const QRectF& dataRect,
147 const QRectF& canvasRect, const QSizeF& cellSize )
148 {
149 m_dx = cellSize.width();
150 m_dy = cellSize.height();
151
152 m_x0 = dataRect.x();
153 if ( m_x0 < canvasRect.x() )
154 m_x0 += int( ( canvasRect.x() - m_x0 ) / m_dx ) * m_dx;
155
156 m_y0 = dataRect.y();
157 if ( m_y0 < canvasRect.y() )
158 m_y0 += int( ( canvasRect.y() - m_y0 ) / m_dy ) * m_dy;
159
160 m_numColumns = canvasRect.width() / m_dx + 1;
161 m_numRows = canvasRect.height() / m_dy + 1;
162
163 #if 1
164 /*
165 limit column and row count to a maximum of 1000000,
166 so that memory usage is not an issue
167 */
168 if ( m_numColumns > 1000 )
169 {
170 m_dx = canvasRect.width() / 1000;
171 m_numColumns = canvasRect.width() / m_dx + 1;
172 }
173
174 if ( m_numRows > 1000 )
175 {
176 m_dy = canvasRect.height() / 1000;
177 m_numRows = canvasRect.height() / m_dx + 1;
178 }
179 #endif
180
181 m_x1 = m_x0 + m_numColumns * m_dx;
182 m_y1 = m_y0 + m_numRows * m_dy;
183
184 m_entries = ( Entry* )::calloc( m_numRows * m_numColumns, sizeof( Entry ) );
185 if ( m_entries == NULL )
186 {
187 qWarning() << "QwtPlotVectorField: raster for filtering too fine - running out of memory";
188 }
189 }
190
191 ~FilterMatrix()
192 {
193 if ( m_entries )
194 std::free( m_entries );
195 }
196
197 inline int numColumns() const
198 {
199 return m_numColumns;
200 }
201
202 inline int numRows() const
203 {
204 return m_numRows;
205 }
206
207 inline void addSample( double x, double y,
208 double u, double v )
209 {
210 if ( x >= m_x0 && x < m_x1
211 && y >= m_y0 && y < m_y1 )
212 {
213 Entry& entry = m_entries[ indexOf( x, y ) ];
214 entry.addSample( x, y, u, v );
215 }
216 }
217
218 const FilterMatrix::Entry* entries() const
219 {
220 return m_entries;
221 }
222
223 private:
224 inline int indexOf( qreal x, qreal y ) const
225 {
226 const int col = ( x - m_x0 ) / m_dx;
227 const int row = ( y - m_y0 ) / m_dy;
228
229 return row * m_numColumns + col;
230 }
231
232 qreal m_x0, m_x1, m_y0, m_y1, m_dx, m_dy;
233 int m_numColumns;
234 int m_numRows;
235
236 Entry* m_entries;
237 };
238 }
239
240 class QwtPlotVectorField::PrivateData
241 {
242 public:
243 PrivateData()
244 : pen( Qt::black )
245 , brush( Qt::black )
246 , indicatorOrigin( QwtPlotVectorField::OriginHead )
247 , magnitudeScaleFactor( 1.0 )
248 , rasterSize( 20, 20 )
249 , minArrowLength( 0.0 )
250 , maxArrowLength( std::numeric_limits< short >::max() )
251 , magnitudeModes( MagnitudeAsLength )
252 {
253 colorMap = NULL;
254 symbol = new QwtVectorFieldThinArrow();
255 }
256
257 ~PrivateData()
258 {
259 delete colorMap;
260 delete symbol;
261 }
262
263 QPen pen;
264 QBrush brush;
265
266 IndicatorOrigin indicatorOrigin;
267 QwtVectorFieldSymbol* symbol;
268 QwtColorMap* colorMap;
269
270 /*
271 Stores the range of magnitudes to be used for the color map.
272 If invalid (min=max or negative values), the range is determined
273 from the data samples themselves.
274 */
275 QwtInterval magnitudeRange;
276 QwtInterval boundingMagnitudeRange;
277
278 qreal magnitudeScaleFactor;
279 QSizeF rasterSize;
280
281 double minArrowLength;
282 double maxArrowLength;
283
284 PaintAttributes paintAttributes;
285 MagnitudeModes magnitudeModes;
286 };
287
292 QwtPlotVectorField::QwtPlotVectorField( const QwtText& title )
293 : QwtPlotSeriesItem( title )
294 {
295 init();
296 }
297
302 QwtPlotVectorField::QwtPlotVectorField( const QString& title )
303 : QwtPlotSeriesItem( QwtText( title ) )
304 {
305 init();
306 }
307
309 QwtPlotVectorField::~QwtPlotVectorField()
310 {
311 delete m_data;
312 }
313
317 void QwtPlotVectorField::init()
318 {
319 setItemAttribute( QwtPlotItem::Legend );
320 setItemAttribute( QwtPlotItem::AutoScale );
321
322 m_data = new PrivateData;
323 setData( new QwtVectorFieldData() );
324
325 setZ( 20.0 );
326 }
327
336 void QwtPlotVectorField::setPen( const QPen& pen )
337 {
338 if ( m_data->pen != pen )
339 {
340 m_data->pen = pen;
341
342 itemChanged();
343 legendChanged();
344 }
345 }
346
351 QPen QwtPlotVectorField::pen() const
352 {
353 return m_data->pen;
354 }
355
364 void QwtPlotVectorField::setBrush( const QBrush& brush )
365 {
366 if ( m_data->brush != brush )
367 {
368 m_data->brush = brush;
369
370 itemChanged();
371 legendChanged();
372 }
373 }
374
379 QBrush QwtPlotVectorField::brush() const
380 {
381 return m_data->brush;
382 }
383
390 void QwtPlotVectorField::setIndicatorOrigin( IndicatorOrigin origin )
391 {
392 m_data->indicatorOrigin = origin;
393 if ( m_data->indicatorOrigin != origin )
394 {
395 m_data->indicatorOrigin = origin;
396 itemChanged();
397 }
398 }
399
401 QwtPlotVectorField::IndicatorOrigin QwtPlotVectorField::indicatorOrigin() const
402 {
403 return m_data->indicatorOrigin;
404 }
405
417 void QwtPlotVectorField::setMagnitudeScaleFactor( double factor )
418 {
419 if ( factor != m_data->magnitudeScaleFactor )
420 {
421 m_data->magnitudeScaleFactor = factor;
422 itemChanged();
423 }
424 }
425
440 double QwtPlotVectorField::magnitudeScaleFactor() const
441 {
442 return m_data->magnitudeScaleFactor;
443 }
444
450 void QwtPlotVectorField::setRasterSize( const QSizeF& size )
451 {
452 if ( size != m_data->rasterSize )
453 {
454 m_data->rasterSize = size;
455 itemChanged();
456 }
457 }
458
463 QSizeF QwtPlotVectorField::rasterSize() const
464 {
465 return m_data->rasterSize;
466 }
467
475 void QwtPlotVectorField::setPaintAttribute(
476 PaintAttribute attribute, bool on )
477 {
478 PaintAttributes attributes = m_data->paintAttributes;
479
480 if ( on )
481 attributes |= attribute;
482 else
483 attributes &= ~attribute;
484
485 if ( m_data->paintAttributes != attributes )
486 {
487 m_data->paintAttributes = attributes;
488 itemChanged();
489 }
490 }
491
496 bool QwtPlotVectorField::testPaintAttribute(
497 PaintAttribute attribute ) const
498 {
499 return ( m_data->paintAttributes & attribute );
500 }
501
503 int QwtPlotVectorField::rtti() const
504 {
505 return QwtPlotItem::Rtti_PlotVectorField;
506 }
507
516 void QwtPlotVectorField::setSymbol( QwtVectorFieldSymbol* symbol )
517 {
518 if ( m_data->symbol == symbol )
519 return;
520
521 delete m_data->symbol;
522 m_data->symbol = symbol;
523
524 itemChanged();
525 legendChanged();
526 }
527
532 const QwtVectorFieldSymbol* QwtPlotVectorField::symbol() const
533 {
534 return m_data->symbol;
535 }
536
541 void QwtPlotVectorField::setSamples( const QVector< QwtVectorFieldSample >& samples )
542 {
543 setData( new QwtVectorFieldData( samples ) );
544 }
545
556 void QwtPlotVectorField::setSamples( QwtVectorFieldData* data )
557 {
558 setData( data );
559 }
560
571 void QwtPlotVectorField::setColorMap( QwtColorMap* colorMap )
572 {
573 if ( colorMap == NULL )
574 return;
575
576 if ( colorMap != m_data->colorMap )
577 {
578 delete m_data->colorMap;
579 m_data->colorMap = colorMap;
580 }
581
582 legendChanged();
583 itemChanged();
584 }
585
590 const QwtColorMap* QwtPlotVectorField::colorMap() const
591 {
592 return m_data->colorMap;
593 }
594
602 void QwtPlotVectorField::setMagnitudeMode( MagnitudeMode mode, bool on )
603 {
604 if ( on == testMagnitudeMode( mode ) )
605 return;
606
607 if ( on )
608 m_data->magnitudeModes |= mode;
609 else
610 m_data->magnitudeModes &= ~mode;
611
612 itemChanged();
613 }
614
619 bool QwtPlotVectorField::testMagnitudeMode( MagnitudeMode mode ) const
620 {
621 return m_data->magnitudeModes & mode;
622 }
623
632 void QwtPlotVectorField::setMagnitudeRange( const QwtInterval& magnitudeRange )
633 {
634 if ( m_data->magnitudeRange != magnitudeRange )
635 {
636 m_data->magnitudeRange = magnitudeRange;
637 itemChanged();
638 }
639 }
640
645 QwtInterval QwtPlotVectorField::magnitudeRange() const
646 {
647 return m_data->magnitudeRange;
648 }
649
658 void QwtPlotVectorField::setMinArrowLength( double length )
659 {
660 length = qMax( length, 0.0 );
661
662 if ( m_data->minArrowLength != length )
663 {
664 m_data->minArrowLength = length;
665 itemChanged();
666 }
667 }
668
675 double QwtPlotVectorField::minArrowLength() const
676 {
677 return m_data->minArrowLength;
678 }
679
688 void QwtPlotVectorField::setMaxArrowLength( double length )
689 {
690 length = qMax( length, 0.0 );
691
692 if ( m_data->maxArrowLength != length )
693 {
694 m_data->maxArrowLength = length;
695 itemChanged();
696 }
697 }
698
705 double QwtPlotVectorField::maxArrowLength() const
706 {
707 return m_data->maxArrowLength;
708 }
709
726 double QwtPlotVectorField::arrowLength( double magnitude ) const
727 {
728 #if 0
729 /*
730 Normalize magnitude with respect to value range. Then, magnitudeScaleFactor
731 is the number of pixels to draw for a vector of length equal to
732 magnitudeRange.maxValue(). The relative scaling ensures that change of data
733 samples of very different magnitudes will always lead to a reasonable
734 display on screen.
735 */
736 const QwtVectorFieldData* vectorData = dynamic_cast< const QwtVectorFieldData* >( data() );
737 if ( m_data->magnitudeRange.maxValue() > 0 )
738 magnitude /= m_data->magnitudeRange.maxValue();
739 #endif
740
741 double length = magnitude * m_data->magnitudeScaleFactor;
742
743 if ( length > 0.0 )
744 length = qBound( m_data->minArrowLength, length, m_data->maxArrowLength );
745
746 return length;
747 }
748
749 QRectF QwtPlotVectorField::boundingRect() const
750 {
751 #if 0
752 /*
753 The bounding rectangle of the samples comes from the origins
754 only, but as we know the scaling factor for the magnitude
755 ( qwtVector2Magnitude ) here, we could try to include it ?
756 */
757 #endif
758
759 return QwtPlotSeriesItem::boundingRect();
760 }
761
770 QwtGraphic QwtPlotVectorField::legendIcon(
771 int index, const QSizeF& size ) const
772 {
773 Q_UNUSED( index );
774
775 QwtGraphic icon;
776 icon.setDefaultSize( size );
777
778 if ( size.isEmpty() )
779 return icon;
780
781 QPainter painter( &icon );
782 painter.setRenderHint( QPainter::Antialiasing,
783 testRenderHint( QwtPlotItem::RenderAntialiased ) );
784
785 painter.translate( -size.width(), -0.5 * size.height() );
786
787 painter.setPen( m_data->pen );
788 painter.setBrush( m_data->brush );
789
790 m_data->symbol->setLength( size.width() - 2 );
791 m_data->symbol->paint( &painter );
792
793 return icon;
794 }
795
807 void QwtPlotVectorField::drawSeries( QPainter* painter,
808 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
809 const QRectF& canvasRect, int from, int to ) const
810 {
811 if ( !painter || dataSize() <= 0 )
812 return;
813
814 if ( to < 0 )
815 to = dataSize() - 1;
816
817 if ( from < 0 )
818 from = 0;
819
820 if ( from > to )
821 return;
822
823 #if DEBUG_RENDER
824 QElapsedTimer timer;
825 timer.start();
826 #endif
827
828 drawSymbols( painter, xMap, yMap, canvasRect, from, to );
829
830 #if DEBUG_RENDER
831 qDebug() << timer.elapsed();
832 #endif
833 }
834
847 void QwtPlotVectorField::drawSymbols( QPainter* painter,
848 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
849 const QRectF& canvasRect, int from, int to ) const
850 {
851 const bool doAlign = QwtPainter::roundingAlignment( painter );
852 const bool doClip = false;
853
854 const bool isInvertingX = xMap.isInverting();
855 const bool isInvertingY = yMap.isInverting();
856
857 const QwtSeriesData< QwtVectorFieldSample >* series = data();
858
859 if ( m_data->magnitudeModes & MagnitudeAsColor )
860 {
861 // user input error, can't draw without color map
862 // TODO: Discuss! Without colormap, silently fall back to uniform colors?
863 if ( m_data->colorMap == NULL)
864 return;
865 }
866 else
867 {
868 painter->setPen( m_data->pen );
869 painter->setBrush( m_data->brush );
870 }
871
872 if ( ( m_data->paintAttributes & FilterVectors ) && !m_data->rasterSize.isEmpty() )
873 {
874 const QRectF dataRect = QwtScaleMap::transform(
875 xMap, yMap, boundingRect() );
876
877 // TODO: Discuss. How to handle raster size when switching from screen to print size!
878 // DPI-aware adjustment of rastersize? Or make "rastersize in screen coordinate"
879 // or "rastersize in plotcoordinetes" a user option?
880 #if 1
881 // define filter matrix based on screen/print coordinates
882 FilterMatrix matrix( dataRect, canvasRect, m_data->rasterSize );
883 #else
884 // define filter matrix based on real coordinates
885
886 // get scale factor from real coordinates to screen coordinates
887 double xScale = 1;
888 if (xMap.sDist() != 0)
889 xScale = xMap.pDist() / xMap.sDist();
890
891 double yScale = 1;
892 if (yMap.sDist() != 0)
893 yScale = yMap.pDist() / yMap.sDist();
894
895 QSizeF canvasRasterSize(xScale * m_data->rasterSize.width(), yScale * m_data->rasterSize.height() );
896 FilterMatrix matrix( dataRect, canvasRect, canvasRasterSize );
897 #endif
898
899 for ( int i = from; i <= to; i++ )
900 {
901 const QwtVectorFieldSample sample = series->sample( i );
902 if ( !sample.isNull() )
903 {
904 matrix.addSample( xMap.transform( sample.x ),
905 yMap.transform( sample.y ), sample.vx, sample.vy );
906 }
907 }
908
909 const int numEntries = matrix.numRows() * matrix.numColumns();
910 const FilterMatrix::Entry* entries = matrix.entries();
911
912 for ( int i = 0; i < numEntries; i++ )
913 {
914 const FilterMatrix::Entry& entry = entries[i];
915
916 if ( entry.count == 0 )
917 continue;
918
919 double xi = entry.x / entry.count;
920 double yi = entry.y / entry.count;
921
922 if ( doAlign )
923 {
924 xi = qRound( xi );
925 yi = qRound( yi );
926 }
927
928 const double vx = entry.vx / entry.count;
929 const double vy = entry.vy / entry.count;
930
931 drawSymbol( painter, xi, yi,
932 isInvertingX ? -vx : vx, isInvertingY ? -vy : vy );
933 }
934 }
935 else
936 {
937 for ( int i = from; i <= to; i++ )
938 {
939 const QwtVectorFieldSample sample = series->sample( i );
940
941 // arrows with zero length are never drawn
942 if ( sample.isNull() )
943 continue;
944
945 double xi = xMap.transform( sample.x );
946 double yi = yMap.transform( sample.y );
947
948 if ( doAlign )
949 {
950 xi = qRound( xi );
951 yi = qRound( yi );
952 }
953
954 if ( doClip )
955 {
956 if ( !canvasRect.contains( xi, yi ) )
957 continue;
958 }
959
960 drawSymbol( painter, xi, yi,
961 isInvertingX ? -sample.vx : sample.vx,
962 isInvertingY ? -sample.vy : sample.vy );
963 }
964 }
965 }
966
975 void QwtPlotVectorField::drawSymbol( QPainter* painter,
976 double x, double y, double vx, double vy ) const
977 {
978 const double magnitude = qwtVector2Magnitude( vx, vy );
979
980 const QTransform oldTransform = painter->transform();
981
982 QTransform transform = qwtSymbolTransformation( oldTransform,
983 x, y, vx, vy, magnitude );
984
985 QwtVectorFieldSymbol* symbol = m_data->symbol;
986
987 double length = 0.0;
988
989 if ( m_data->magnitudeModes & MagnitudeAsLength )
990 {
991 length = arrowLength( magnitude );
992 }
993
994 symbol->setLength( length );
995
996 if( m_data->indicatorOrigin == OriginTail )
997 {
998 const qreal dx = symbol->length();
999 transform.translate( dx, 0.0 );
1000 }
1001 else if ( m_data->indicatorOrigin == OriginCenter )
1002 {
1003 const qreal dx = symbol->length();
1004 transform.translate( 0.5 * dx, 0.0 );
1005 }
1006
1007 if ( m_data->magnitudeModes & MagnitudeAsColor )
1008 {
1009 // Determine color for arrow if colored by magnitude.
1010
1011 QwtInterval range = m_data->magnitudeRange;
1012
1013 if ( !range.isValid() )
1014 {
1015 if ( !m_data->boundingMagnitudeRange.isValid() )
1016 m_data->boundingMagnitudeRange = qwtMagnitudeRange( data() );
1017
1018 range = m_data->boundingMagnitudeRange;
1019 }
1020
1021 const QColor c = m_data->colorMap->rgb( range, magnitude );
1022
1023 #if 1
1024 painter->setBrush( c );
1025 painter->setPen( c );
1026 #endif
1027 }
1028
1029 painter->setWorldTransform( transform, false );
1030 symbol->paint( painter );
1031 painter->setWorldTransform( oldTransform, false );
1032 }
1033
1034 void QwtPlotVectorField::dataChanged()
1035 {
1036 m_data->boundingMagnitudeRange.invalidate();
1037 QwtPlotSeriesItem::dataChanged();
1038 }
QVector
Definition: qwt_clipper.h:23
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
QwtGraphic::setDefaultSize
void setDefaultSize(const QSizeF &)
Set a default size.
Definition: qwt_graphic.cpp:553
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:23
QwtInterval::isValid
bool isValid() const
Definition: qwt_interval.h:210
QwtPainter::roundingAlignment
static bool roundingAlignment()
Definition: qwt_painter.h:183
QwtPlotItem::legendChanged
virtual void legendChanged()
Definition: qwt_plot_item.cpp:491
QwtPlotItem::setZ
void setZ(double z)
Set the z value.
Definition: qwt_plot_item.cpp:165
QwtPlotItem::setItemAttribute
void setItemAttribute(ItemAttribute, bool on=true)
Definition: qwt_plot_item.cpp:228
QwtPlotItem::Rtti_PlotVectorField
@ Rtti_PlotVectorField
For QwtPlotVectorField.
Definition: qwt_plot_item.h:129
QwtPlotItem::RenderAntialiased
@ RenderAntialiased
Enable antialiasing.
Definition: qwt_plot_item.h:206
QwtPlotItem::testRenderHint
bool testRenderHint(RenderHint) const
Definition: qwt_plot_item.cpp:332
QwtPlotItem::itemChanged
virtual void itemChanged()
Definition: qwt_plot_item.cpp:481
QwtPlotItem::Legend
@ Legend
The item is represented on the legend.
Definition: qwt_plot_item.h:150
QwtPlotItem::AutoScale
@ AutoScale
Definition: qwt_plot_item.h:157
QwtPlotSeriesItem
Base class for plot items representing a series of samples.
Definition: qwt_plot_seriesitem.h:26
QwtPlotSeriesItem::dataChanged
virtual void dataChanged() override
dataChanged() indicates, that the series has been changed.
Definition: qwt_plot_seriesitem.cpp:112
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::brush
QBrush brush() const
Definition: qwt_plot_vectorfield.cpp:379
QwtPlotVectorField::legendIcon
virtual QwtGraphic legendIcon(int index, const QSizeF &) const override
Definition: qwt_plot_vectorfield.cpp:770
QwtPlotVectorField::IndicatorOrigin
IndicatorOrigin
Definition: qwt_plot_vectorfield.h:40
QwtPlotVectorField::OriginCenter
@ OriginCenter
The arrow is centered at the sample position.
Definition: qwt_plot_vectorfield.h:48
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::rtti
virtual int rtti() const override
Definition: qwt_plot_vectorfield.cpp:503
QwtPlotVectorField::colorMap
const QwtColorMap * colorMap() const
Definition: qwt_plot_vectorfield.cpp:590
QwtPlotVectorField::magnitudeScaleFactor
double magnitudeScaleFactor() const
Definition: qwt_plot_vectorfield.cpp:440
QwtPlotVectorField::pen
QPen pen() const
Definition: qwt_plot_vectorfield.cpp:351
QwtPlotVectorField::setSamples
void setSamples(const QVector< QwtVectorFieldSample > &)
Definition: qwt_plot_vectorfield.cpp:541
QwtPlotVectorField::setRasterSize
void setRasterSize(const QSizeF &)
Definition: qwt_plot_vectorfield.cpp:450
QwtPlotVectorField::drawSeries
virtual void drawSeries(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const override
Definition: qwt_plot_vectorfield.cpp:807
QwtPlotVectorField::setBrush
void setBrush(const QBrush &)
Assign a brush.
Definition: qwt_plot_vectorfield.cpp:364
QwtPlotVectorField::setMinArrowLength
void setMinArrowLength(double)
Definition: qwt_plot_vectorfield.cpp:658
QwtPlotVectorField::setSymbol
void setSymbol(QwtVectorFieldSymbol *)
Definition: qwt_plot_vectorfield.cpp:516
QwtPlotVectorField::testPaintAttribute
bool testPaintAttribute(PaintAttribute) const
Definition: qwt_plot_vectorfield.cpp:496
QwtPlotVectorField::drawSymbol
virtual void drawSymbol(QPainter *, double x, double y, double vx, double vy) const
Definition: qwt_plot_vectorfield.cpp:975
QwtPlotVectorField::boundingRect
virtual QRectF boundingRect() const override
Definition: qwt_plot_vectorfield.cpp:749
QwtPlotVectorField::testMagnitudeMode
bool testMagnitudeMode(MagnitudeMode) const
Definition: qwt_plot_vectorfield.cpp:619
QwtPlotVectorField::setMagnitudeScaleFactor
void setMagnitudeScaleFactor(double factor)
Set the magnitudeScaleFactor.
Definition: qwt_plot_vectorfield.cpp:417
QwtPlotVectorField::symbol
const QwtVectorFieldSymbol * symbol() const
Definition: qwt_plot_vectorfield.cpp:532
QwtPlotVectorField::setMaxArrowLength
void setMaxArrowLength(double)
Definition: qwt_plot_vectorfield.cpp:688
QwtPlotVectorField::drawSymbols
virtual void drawSymbols(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
Definition: qwt_plot_vectorfield.cpp:847
QwtPlotVectorField::setColorMap
void setColorMap(QwtColorMap *)
Definition: qwt_plot_vectorfield.cpp:571
QwtPlotVectorField::MagnitudeMode
MagnitudeMode
Definition: qwt_plot_vectorfield.h:76
QwtPlotVectorField::MagnitudeAsLength
@ MagnitudeAsLength
Definition: qwt_plot_vectorfield.h:87
QwtPlotVectorField::MagnitudeAsColor
@ MagnitudeAsColor
Definition: qwt_plot_vectorfield.h:81
QwtPlotVectorField::PaintAttribute
PaintAttribute
Definition: qwt_plot_vectorfield.h:56
QwtPlotVectorField::QwtPlotVectorField
QwtPlotVectorField(const QString &title=QString())
Definition: qwt_plot_vectorfield.cpp:302
QwtPlotVectorField::setMagnitudeRange
void setMagnitudeRange(const QwtInterval &)
Definition: qwt_plot_vectorfield.cpp:632
QwtPlotVectorField::setPen
void setPen(const QPen &)
Definition: qwt_plot_vectorfield.cpp:336
QwtPlotVectorField::MagnitudeModes
QFlags< MagnitudeMode > MagnitudeModes
Definition: qwt_plot_vectorfield.h:90
QwtPlotVectorField::rasterSize
QSizeF rasterSize() const
Definition: qwt_plot_vectorfield.cpp:463
QwtPlotVectorField::~QwtPlotVectorField
virtual ~QwtPlotVectorField()
Destructor.
Definition: qwt_plot_vectorfield.cpp:309
QwtPlotVectorField::PaintAttributes
QFlags< PaintAttribute > PaintAttributes
Definition: qwt_plot_vectorfield.h:67
QwtPlotVectorField::setPaintAttribute
void setPaintAttribute(PaintAttribute, bool on=true)
Definition: qwt_plot_vectorfield.cpp:475
QwtPlotVectorField::maxArrowLength
double maxArrowLength() const
Definition: qwt_plot_vectorfield.cpp:705
QwtPlotVectorField::dataChanged
virtual void dataChanged() override
dataChanged() indicates, that the series has been changed.
Definition: qwt_plot_vectorfield.cpp:1034
QwtPlotVectorField::magnitudeRange
QwtInterval magnitudeRange() const
Definition: qwt_plot_vectorfield.cpp:645
QwtPlotVectorField::setIndicatorOrigin
void setIndicatorOrigin(IndicatorOrigin)
Definition: qwt_plot_vectorfield.cpp:390
QwtPlotVectorField::arrowLength
virtual double arrowLength(double magnitude) const
Definition: qwt_plot_vectorfield.cpp:726
QwtPlotVectorField::indicatorOrigin
IndicatorOrigin indicatorOrigin() const
Definition: qwt_plot_vectorfield.cpp:401
QwtPlotVectorField::minArrowLength
double minArrowLength() const
Definition: qwt_plot_vectorfield.cpp:675
QwtPlotVectorField::setMagnitudeMode
void setMagnitudeMode(MagnitudeMode, bool on=true)
Definition: qwt_plot_vectorfield.cpp:602
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:27
QwtScaleMap::isInverting
bool isInverting() const
Definition: qwt_scale_map.h:164
QwtScaleMap::pDist
double pDist() const
Definition: qwt_scale_map.h:115
QwtScaleMap::transform
double transform(double s) const
Definition: qwt_scale_map.h:137
QwtScaleMap::sDist
double sDist() const
Definition: qwt_scale_map.h:123
QwtSeriesData
Abstract interface for iterating over samples.
Definition: qwt_series_data.h:50
QwtSeriesData::size
virtual size_t size() const =0
QwtSeriesData::sample
virtual T sample(size_t i) const =0
QwtSeriesStore< QwtVectorFieldSample >::sample
QwtVectorFieldSample sample(int index) const
Definition: qwt_series_store.h:158
QwtSeriesStore< QwtVectorFieldSample >::dataSize
virtual size_t dataSize() const override
Definition: qwt_series_store.h:175
QwtSeriesStore< QwtVectorFieldSample >::data
QwtSeriesData< QwtVectorFieldSample > * data()
Definition: qwt_series_store.h:146
QwtSeriesStore< QwtVectorFieldSample >::setData
void setData(QwtSeriesData< QwtVectorFieldSample > *series)
Definition: qwt_series_store.h:164
QwtSeriesStore< QwtVectorFieldSample >::dataRect
virtual QRectF dataRect() const override
Definition: qwt_series_store.h:184
QwtText
A class representing a text.
Definition: qwt_text.h:52
QwtVectorFieldData
Interface for iterating over an array of vector field samples.
Definition: qwt_series_data.h:250
QwtVectorFieldSample
Sample used in vector fields.
Definition: qwt_samples.h:244
QwtVectorFieldSample::y
double y
y coordinate of the position
Definition: qwt_samples.h:260
QwtVectorFieldSample::isNull
bool isNull() const
Definition: qwt_samples.h:309
QwtVectorFieldSample::vx
double vx
x coordinate of the vector
Definition: qwt_samples.h:263
QwtVectorFieldSample::x
double x
x coordinate of the position
Definition: qwt_samples.h:257
QwtVectorFieldSample::vy
double vy
y coordinate of the vector
Definition: qwt_samples.h:266
QwtVectorFieldSymbol
Definition: qwt_vectorfield_symbol.h:33
QwtVectorFieldSymbol::length
virtual qreal length() const =0
QwtVectorFieldSymbol::paint
virtual void paint(QPainter *) const =0
Draw the symbol/arrow.
QwtVectorFieldSymbol::setLength
virtual void setLength(qreal length)=0
QwtVectorFieldThinArrow
Definition: qwt_vectorfield_symbol.h:82