qwt_plot_vectorfield.cpp
Go to the documentation of this file.
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 
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 
241 {
242  public:
244  : pen( Qt::black )
245  , brush( Qt::black )
247  , magnitudeScaleFactor( 1.0 )
248  , rasterSize( 20, 20 )
249  , minArrowLength( 0.0 )
250  , maxArrowLength( std::numeric_limits< short >::max() )
252  {
253  colorMap = NULL;
255  }
256 
258  {
259  delete colorMap;
260  delete symbol;
261  }
262 
263  QPen pen;
264  QBrush brush;
265 
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  */
277 
279  QSizeF rasterSize;
280 
283 
284  PaintAttributes paintAttributes;
285  MagnitudeModes magnitudeModes;
286 };
287 
293  : QwtPlotSeriesItem( title )
294 {
295  init();
296 }
297 
303  : QwtPlotSeriesItem( QwtText( title ) )
304 {
305  init();
306 }
307 
310 {
311  delete m_data;
312 }
313 
318 {
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 
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 
380 {
381  return m_data->brush;
382 }
383 
391 {
392  m_data->indicatorOrigin = origin;
393  if ( m_data->indicatorOrigin != origin )
394  {
395  m_data->indicatorOrigin = origin;
396  itemChanged();
397  }
398 }
399 
402 {
403  return m_data->indicatorOrigin;
404 }
405 
418 {
419  if ( factor != m_data->magnitudeScaleFactor )
420  {
421  m_data->magnitudeScaleFactor = factor;
422  itemChanged();
423  }
424 }
425 
441 {
443 }
444 
451 {
452  if ( size != m_data->rasterSize )
453  {
455  itemChanged();
456  }
457 }
458 
464 {
465  return m_data->rasterSize;
466 }
467 
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 
497  PaintAttribute attribute ) const
498 {
499  return ( m_data->paintAttributes & attribute );
500 }
501 
504 {
506 }
507 
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 
533 {
534  return m_data->symbol;
535 }
536 
542 {
543  setData( new QwtVectorFieldData( samples ) );
544 }
545 
557 {
558  setData( data );
559 }
560 
572 {
573  if ( colorMap == NULL )
574  return;
575 
576  if ( colorMap != m_data->colorMap )
577  {
578  delete m_data->colorMap;
580  }
581 
582  legendChanged();
583  itemChanged();
584 }
585 
591 {
592  return m_data->colorMap;
593 }
594 
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 
620 {
621  return m_data->magnitudeModes & mode;
622 }
623 
633 {
635  {
637  itemChanged();
638  }
639 }
640 
646 {
647  return m_data->magnitudeRange;
648 }
649 
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 
676 {
677  return m_data->minArrowLength;
678 }
679 
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 
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 
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 
760 }
761 
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,
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 
858 
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 
986 
987  double length = 0.0;
988 
990  {
991  length = arrowLength( magnitude );
992  }
993 
994  symbol->setLength( length );
995 
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 
1008  {
1009  // Determine color for arrow if colored by magnitude.
1010 
1012 
1013  if ( !range.isValid() )
1014  {
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 
1035 {
1038 }
QwtPlotVectorField::m_data
PrivateData * m_data
Definition: qwt_plot_vectorfield.h:162
QwtInterval::isValid
bool isValid() const
Definition: qwt_interval.h:210
QwtPlotVectorField::~QwtPlotVectorField
virtual ~QwtPlotVectorField()
Destructor.
Definition: qwt_plot_vectorfield.cpp:309
qwt_graphic.h
QwtPlotVectorField::minArrowLength
double minArrowLength() const
Definition: qwt_plot_vectorfield.cpp:675
QwtPlotVectorField::setMaxArrowLength
void setMaxArrowLength(double)
Definition: qwt_plot_vectorfield.cpp:688
QwtPlotVectorField::arrowLength
virtual double arrowLength(double magnitude) const
Definition: qwt_plot_vectorfield.cpp:726
QwtVectorFieldSample
Sample used in vector fields.
Definition: qwt_samples.h:243
QwtVectorFieldData
QwtArraySeriesData< QwtVectorFieldSample > QwtVectorFieldData
Interface for iterating over an array of vector field samples.
Definition: qwt_series_data.h:226
QwtPlotVectorField::PrivateData
Definition: qwt_plot_vectorfield.cpp:240
qwt_plot_vectorfield.h
QwtSeriesStore< QwtVectorFieldSample >::sample
QwtVectorFieldSample sample(int index) const
Definition: qwt_series_store.h:158
QwtVectorFieldSample::y
double y
y coordinate of the position
Definition: qwt_samples.h:260
QwtPlotVectorField::PrivateData::PrivateData
PrivateData()
Definition: qwt_plot_vectorfield.cpp:243
QwtPlotVectorField::indicatorOrigin
IndicatorOrigin indicatorOrigin() const
Definition: qwt_plot_vectorfield.cpp:401
QwtPlotItem::legendChanged
virtual void legendChanged()
Definition: qwt_plot_item.cpp:491
QwtPlotSeriesItem
Base class for plot items representing a series of samples.
Definition: qwt_plot_seriesitem.h:24
QwtPlotVectorField::PrivateData::magnitudeScaleFactor
qreal magnitudeScaleFactor
Definition: qwt_plot_vectorfield.cpp:278
QwtPlotVectorField::magnitudeRange
QwtInterval magnitudeRange() const
Definition: qwt_plot_vectorfield.cpp:645
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:75
s
XmlRpcServer s
QwtPlotVectorField::setIndicatorOrigin
void setIndicatorOrigin(IndicatorOrigin)
Definition: qwt_plot_vectorfield.cpp:390
QwtPlotVectorField::testMagnitudeMode
bool testMagnitudeMode(MagnitudeMode) const
Definition: qwt_plot_vectorfield.cpp:619
QVector
Definition: qwt_clipper.h:23
qwtVector2Magnitude
static double qwtVector2Magnitude(double vx, double vy)
Definition: qwt_plot_vectorfield.cpp:40
QwtPlotVectorField::MagnitudeAsLength
@ MagnitudeAsLength
Definition: qwt_plot_vectorfield.h:87
QwtSeriesStore< QwtVectorFieldSample >::setData
void setData(QwtSeriesData< QwtVectorFieldSample > *series)
Definition: qwt_series_store.h:164
QwtPlotVectorField::PrivateData::brush
QBrush brush
Definition: qwt_plot_vectorfield.cpp:264
mqtt_test_proto.x
x
Definition: mqtt_test_proto.py:34
QwtSeriesStore< QwtVectorFieldSample >::dataRect
virtual QRectF dataRect() const QWT_OVERRIDE
Definition: qwt_series_store.h:184
QwtPlotVectorField::IndicatorOrigin
IndicatorOrigin
Definition: qwt_plot_vectorfield.h:39
qwtVector2Radians
static double qwtVector2Radians(double vx, double vy)
Definition: qwt_plot_vectorfield.cpp:32
qwt_math.h
QwtPlotItem::Legend
@ Legend
The item is represented on the legend.
Definition: qwt_plot_item.h:150
QwtVectorFieldSample::vy
double vy
y coordinate of the vector
Definition: qwt_samples.h:266
QwtPlotVectorField::testPaintAttribute
bool testPaintAttribute(PaintAttribute) const
Definition: qwt_plot_vectorfield.cpp:496
QwtVectorFieldThinArrow
Definition: qwt_vectorfield_symbol.h:81
QwtPlotVectorField::setColorMap
void setColorMap(QwtColorMap *)
Definition: qwt_plot_vectorfield.cpp:571
QwtPainter::roundingAlignment
static bool roundingAlignment()
Definition: qwt_painter.h:183
mqtt_test_proto.y
y
Definition: mqtt_test_proto.py:35
QwtPlotVectorField::OriginHead
@ OriginHead
symbol points to the sample position
Definition: qwt_plot_vectorfield.h:42
QwtScaleMap::isInverting
bool isInverting() const
Definition: qwt_scale_map.h:164
qwtSymbolTransformation
static QTransform qwtSymbolTransformation(const QTransform &oldTransform, double x, double y, double vx, double vy, double magnitude)
Definition: qwt_plot_vectorfield.cpp:77
QwtPlotItem::AutoScale
@ AutoScale
Definition: qwt_plot_item.h:157
nonstd::span_lite::size
span_constexpr std::size_t size(span< T, Extent > const &spn)
Definition: span.hpp:1554
detail::count
constexpr auto count() -> size_t
Definition: core.h:1222
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::FilterVectors
@ FilterVectors
Definition: qwt_plot_vectorfield.h:64
QwtPlotVectorField::PrivateData::magnitudeModes
MagnitudeModes magnitudeModes
Definition: qwt_plot_vectorfield.cpp:285
QwtPlotVectorField::OriginTail
@ OriginTail
The arrow starts at the sample position.
Definition: qwt_plot_vectorfield.h:45
QwtPlotVectorField::PrivateData::paintAttributes
PaintAttributes paintAttributes
Definition: qwt_plot_vectorfield.cpp:284
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:22
QwtPlotVectorField::PrivateData::maxArrowLength
double maxArrowLength
Definition: qwt_plot_vectorfield.cpp:282
QwtVectorFieldSymbol::setLength
virtual void setLength(qreal length)=0
QwtPlotVectorField::dataChanged
virtual void dataChanged() QWT_OVERRIDE
dataChanged() indicates, that the series has been changed.
Definition: qwt_plot_vectorfield.cpp:1034
QwtPlotVectorField::PrivateData::symbol
QwtVectorFieldSymbol * symbol
Definition: qwt_plot_vectorfield.cpp:267
M_PI_2
#define M_PI_2
Definition: qwt_math.h:60
qwt_scale_map.h
QwtPlotVectorField::MagnitudeAsColor
@ MagnitudeAsColor
Definition: qwt_plot_vectorfield.h:81
QwtPlotVectorField::PrivateData::~PrivateData
~PrivateData()
Definition: qwt_plot_vectorfield.cpp:257
QwtText
A class representing a text.
Definition: qwt_text.h:51
QwtPlotVectorField::setBrush
void setBrush(const QBrush &)
Assign a brush.
Definition: qwt_plot_vectorfield.cpp:364
QwtPlotItem::setZ
void setZ(double z)
Set the z value.
Definition: qwt_plot_item.cpp:165
QwtSeriesData< QwtVectorFieldSample >
qwt_color_map.h
QwtPlotItem::Rtti_PlotVectorField
@ Rtti_PlotVectorField
For QwtPlotVectorField.
Definition: qwt_plot_item.h:129
QwtPlotVectorField::legendIcon
virtual QwtGraphic legendIcon(int index, const QSizeF &) const QWT_OVERRIDE
Definition: qwt_plot_vectorfield.cpp:770
qwt_vectorfield_symbol.h
QwtPlotVectorField::setMagnitudeMode
void setMagnitudeMode(MagnitudeMode, bool on=true)
Definition: qwt_plot_vectorfield.cpp:602
qwtMagnitudeRange
static QwtInterval qwtMagnitudeRange(const QwtSeriesData< QwtVectorFieldSample > *series)
Definition: qwt_plot_vectorfield.cpp:45
QwtSeriesData::sample
virtual T sample(size_t i) const =0
QwtPlotVectorField::init
void init()
Initialize data members.
Definition: qwt_plot_vectorfield.cpp:317
QwtPlotVectorField::magnitudeScaleFactor
double magnitudeScaleFactor() const
Definition: qwt_plot_vectorfield.cpp:440
QwtVectorFieldSymbol::length
virtual qreal length() const =0
QwtPlotVectorField::PrivateData::minArrowLength
double minArrowLength
Definition: qwt_plot_vectorfield.cpp:281
QwtSeriesStore< QwtVectorFieldSample >::data
QwtSeriesData< QwtVectorFieldSample > * data()
Definition: qwt_series_store.h:146
QwtScaleMap::transform
double transform(double s) const
Definition: qwt_scale_map.h:137
QwtPlotItem::itemChanged
virtual void itemChanged()
Definition: qwt_plot_item.cpp:481
QwtSeriesStore< QwtVectorFieldSample >::dataSize
virtual size_t dataSize() const QWT_OVERRIDE
Definition: qwt_series_store.h:175
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:26
color::black
@ black
QwtPlotVectorField::QwtPlotVectorField
QwtPlotVectorField(const QString &title=QString())
Definition: qwt_plot_vectorfield.cpp:302
QwtPlotVectorField::rtti
virtual int rtti() const QWT_OVERRIDE
Definition: qwt_plot_vectorfield.cpp:503
QwtVectorFieldSymbol::paint
virtual void paint(QPainter *) const =0
Draw the symbol/arrow.
QwtInterval::invalidate
void invalidate()
Definition: qwt_interval.h:325
QwtVectorFieldSample::vx
double vx
x coordinate of the vector
Definition: qwt_samples.h:263
QwtPlotVectorField::colorMap
const QwtColorMap * colorMap() const
Definition: qwt_plot_vectorfield.cpp:590
QwtPlotSeriesItem::dataChanged
virtual void dataChanged() QWT_OVERRIDE
dataChanged() indicates, that the series has been changed.
Definition: qwt_plot_seriesitem.cpp:112
udp_client.int
int
Definition: udp_client.py:11
qwt_painter.h
QwtPlotVectorField::PrivateData::colorMap
QwtColorMap * colorMap
Definition: qwt_plot_vectorfield.cpp:268
QwtColorMap::rgb
virtual QRgb rgb(const QwtInterval &interval, double value) const =0
QwtPlotItem::setItemAttribute
void setItemAttribute(ItemAttribute, bool on=true)
Definition: qwt_plot_item.cpp:228
QwtPlotVectorField::PaintAttribute
PaintAttribute
Definition: qwt_plot_vectorfield.h:55
QwtPlotVectorField::rasterSize
QSizeF rasterSize() const
Definition: qwt_plot_vectorfield.cpp:463
QwtArraySeriesData
Template class for data, that is organized as QVector.
Definition: qwt_series_data.h:140
QwtPlotVectorField::drawSymbol
virtual void drawSymbol(QPainter *, double x, double y, double vx, double vy) const
Definition: qwt_plot_vectorfield.cpp:975
QwtScaleMap::pDist
double pDist() const
Definition: qwt_scale_map.h:115
QwtScaleMap::sDist
double sDist() const
Definition: qwt_scale_map.h:123
std
QwtPlotVectorField::setMinArrowLength
void setMinArrowLength(double)
Definition: qwt_plot_vectorfield.cpp:658
QwtVectorFieldSample::x
double x
x coordinate of the position
Definition: qwt_samples.h:257
QwtPlotVectorField::boundingRect
virtual QRectF boundingRect() const QWT_OVERRIDE
Definition: qwt_plot_vectorfield.cpp:749
QwtPlotVectorField::setMagnitudeScaleFactor
void setMagnitudeScaleFactor(double factor)
Set the magnitudeScaleFactor.
Definition: qwt_plot_vectorfield.cpp:417
QwtPlotVectorField::maxArrowLength
double maxArrowLength() const
Definition: qwt_plot_vectorfield.cpp:705
QwtPlotVectorField::setRasterSize
void setRasterSize(const QSizeF &)
Definition: qwt_plot_vectorfield.cpp:450
mqtt_test.data
dictionary data
Definition: mqtt_test.py:22
QwtSeriesData::size
virtual size_t size() const =0
QwtInterval::maxValue
double maxValue() const
Definition: qwt_interval.h:198
QwtPlotVectorField::setPaintAttribute
void setPaintAttribute(PaintAttribute, bool on=true)
Definition: qwt_plot_vectorfield.cpp:475
QwtPlotSeriesItem::boundingRect
virtual QRectF boundingRect() const QWT_OVERRIDE
Definition: qwt_plot_seriesitem.cpp:97
QwtPlotVectorField::setMagnitudeRange
void setMagnitudeRange(const QwtInterval &)
Definition: qwt_plot_vectorfield.cpp:632
QwtPlotVectorField::PrivateData::rasterSize
QSizeF rasterSize
Definition: qwt_plot_vectorfield.cpp:279
QwtPlotVectorField::PrivateData::pen
QPen pen
Definition: qwt_plot_vectorfield.cpp:263
QwtPlotVectorField::PrivateData::boundingMagnitudeRange
QwtInterval boundingMagnitudeRange
Definition: qwt_plot_vectorfield.cpp:276
QwtPlotVectorField::MagnitudeMode
MagnitudeMode
Definition: qwt_plot_vectorfield.h:75
QwtPlotVectorField::symbol
const QwtVectorFieldSymbol * symbol() const
Definition: qwt_plot_vectorfield.cpp:532
QwtColorMap
QwtColorMap is used to map values into colors.
Definition: qwt_color_map.h:37
QwtVectorFieldSample::isNull
bool isNull() const
Definition: qwt_samples.h:309
QwtPlotVectorField::setPen
void setPen(const QPen &)
Definition: qwt_plot_vectorfield.cpp:336
QwtPlotVectorField::setSymbol
void setSymbol(QwtVectorFieldSymbol *)
Definition: qwt_plot_vectorfield.cpp:516
QwtVectorFieldSymbol
Definition: qwt_vectorfield_symbol.h:32
QwtPlotItem::testRenderHint
bool testRenderHint(RenderHint) const
Definition: qwt_plot_item.cpp:332
QwtPlotVectorField::OriginCenter
@ OriginCenter
The arrow is centered at the sample position.
Definition: qwt_plot_vectorfield.h:48
qwt_text.h
QwtPlotItem::RenderAntialiased
@ RenderAntialiased
Enable antialiasing.
Definition: qwt_plot_item.h:206
QwtPlotVectorField::brush
QBrush brush() const
Definition: qwt_plot_vectorfield.cpp:379
QwtPlotVectorField::PrivateData::indicatorOrigin
IndicatorOrigin indicatorOrigin
Definition: qwt_plot_vectorfield.cpp:266
QwtPlotVectorField::PrivateData::magnitudeRange
QwtInterval magnitudeRange
Definition: qwt_plot_vectorfield.cpp:275
QwtGraphic::setDefaultSize
void setDefaultSize(const QSizeF &)
Set a default size.
Definition: qwt_graphic.cpp:553
QwtPlotVectorField::drawSeries
virtual void drawSeries(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const QWT_OVERRIDE
Definition: qwt_plot_vectorfield.cpp:807
QwtPlotVectorField
A plot item, that represents a vector field.
Definition: qwt_plot_vectorfield.h:30
QwtPlotVectorField::pen
QPen pen() const
Definition: qwt_plot_vectorfield.cpp:351
QwtPlotVectorField::setSamples
void setSamples(const QVector< QwtVectorFieldSample > &)
Definition: qwt_plot_vectorfield.cpp:541


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Aug 11 2024 02:24:24