qwt_plot_curve.cpp
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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_curve.h"
11 #include "qwt_point_data.h"
12 #include "qwt_math.h"
13 #include "qwt_clipper.h"
14 #include "qwt_painter.h"
15 #include "qwt_scale_map.h"
16 #include "qwt_plot.h"
18 #include "qwt_symbol.h"
19 #include "qwt_point_mapper.h"
20 #include <qpainter.h>
21 #include <qpixmap.h>
22 #include <qalgorithms.h>
23 #include <qmath.h>
24 
25 static inline QRectF qwtIntersectedClipRect( const QRectF &rect, QPainter *painter )
26 {
27  QRectF clipRect = rect;
28  if ( painter->hasClipping() )
29  {
30 #if QT_VERSION >= 0x040800
31  const QRectF r = painter->clipBoundingRect();
32 #else
33  const QRectF r = painter->clipRegion().boundingRect();
34 #endif
35  clipRect &= r;
36  }
37 
38  return clipRect;
39 }
40 
42 {
43  if ( curve->symbol() &&
45  {
46  QSize sz = curve->symbol()->boundingRect().size();
47  sz += QSize( 2, 2 ); // margin
48 
50  {
51  // Avoid, that the line is completely covered by the symbol
52 
53  int w = qCeil( 1.5 * sz.width() );
54  if ( w % 2 )
55  w++;
56 
57  sz.setWidth( qMax( 8, w ) );
58  }
59 
60  curve->setLegendIconSize( sz );
61  }
62 }
63 
64 static int qwtVerifyRange( int size, int &i1, int &i2 )
65 {
66  if ( size < 1 )
67  return 0;
68 
69  i1 = qBound( 0, i1, size - 1 );
70  i2 = qBound( 0, i2, size - 1 );
71 
72  if ( i1 > i2 )
73  qSwap( i1, i2 );
74 
75  return ( i2 - i1 + 1 );
76 }
77 
79 {
80 public:
83  baseline( 0.0 ),
84  symbol( NULL ),
85  pen( Qt::black ),
86  attributes( 0 ),
89  legendAttributes( 0 )
90  {
92  }
93 
95  {
96  delete symbol;
97  delete curveFitter;
98  }
99 
101  double baseline;
102 
105 
106  QPen pen;
107  QBrush brush;
108 
111 
113 };
114 
120  QwtPlotSeriesItem( title )
121 {
122  init();
123 }
124 
130  QwtPlotSeriesItem( QwtText( title ) )
131 {
132  init();
133 }
134 
137 {
138  delete d_data;
139 }
140 
143 {
146 
147  d_data = new PrivateData;
148  setData( new QwtPointSeriesData() );
149 
150  setZ( 20.0 );
151 }
152 
155 {
157 }
158 
167 {
168  if ( on )
169  d_data->paintAttributes |= attribute;
170  else
171  d_data->paintAttributes &= ~attribute;
172 }
173 
179 {
180  return ( d_data->paintAttributes & attribute );
181 }
182 
191 {
192  if ( on != testLegendAttribute( attribute ) )
193  {
194  if ( on )
195  d_data->legendAttributes |= attribute;
196  else
197  d_data->legendAttributes &= ~attribute;
198 
199  qwtUpdateLegendIconSize( this );
200  legendChanged();
201  }
202 }
203 
209 {
210  return ( d_data->legendAttributes & attribute );
211 }
212 
220 {
221  if ( style != d_data->style )
222  {
223  d_data->style = style;
224 
225  legendChanged();
226  itemChanged();
227  }
228 }
229 
235 {
236  return d_data->style;
237 }
238 
250 {
251  if ( symbol != d_data->symbol )
252  {
253  delete d_data->symbol;
254  d_data->symbol = symbol;
255 
256  qwtUpdateLegendIconSize( this );
257 
258  legendChanged();
259  itemChanged();
260  }
261 }
262 
268 {
269  return d_data->symbol;
270 }
271 
285 void QwtPlotCurve::setPen( const QColor &color, qreal width, Qt::PenStyle style )
286 {
287  setPen( QPen( color, width, style ) );
288 }
289 
296 void QwtPlotCurve::setPen( const QPen &pen )
297 {
298  if ( pen != d_data->pen )
299  {
300  d_data->pen = pen;
301 
302  legendChanged();
303  itemChanged();
304  }
305 }
306 
311 const QPen& QwtPlotCurve::pen() const
312 {
313  return d_data->pen;
314 }
315 
331 void QwtPlotCurve::setBrush( const QBrush &brush )
332 {
333  if ( brush != d_data->brush )
334  {
335  d_data->brush = brush;
336 
337  legendChanged();
338  itemChanged();
339  }
340 }
341 
346 const QBrush& QwtPlotCurve::brush() const
347 {
348  return d_data->brush;
349 }
350 
364 void QwtPlotCurve::drawSeries( QPainter *painter,
365  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
366  const QRectF &canvasRect, int from, int to ) const
367 {
368  const size_t numSamples = dataSize();
369 
370  if ( !painter || numSamples <= 0 )
371  return;
372 
373  if ( to < 0 )
374  to = numSamples - 1;
375 
376  if ( qwtVerifyRange( numSamples, from, to ) > 0 )
377  {
378  painter->save();
379  painter->setPen( d_data->pen );
380 
381  /*
382  Qt 4.0.0 is slow when drawing lines, but it's even
383  slower when the painter has a brush. So we don't
384  set the brush before we really need it.
385  */
386 
387  drawCurve( painter, d_data->style, xMap, yMap, canvasRect, from, to );
388  painter->restore();
389 
390  if ( d_data->symbol &&
392  {
393  painter->save();
394  drawSymbols( painter, *d_data->symbol,
395  xMap, yMap, canvasRect, from, to );
396  painter->restore();
397  }
398  }
399 }
400 
412 void QwtPlotCurve::drawCurve( QPainter *painter, int style,
413  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
414  const QRectF &canvasRect, int from, int to ) const
415 {
416  switch ( style )
417  {
418  case Lines:
419  if ( testCurveAttribute( Fitted ) )
420  {
421  // we always need the complete
422  // curve for fitting
423  from = 0;
424  to = dataSize() - 1;
425  }
426  drawLines( painter, xMap, yMap, canvasRect, from, to );
427  break;
428  case Sticks:
429  drawSticks( painter, xMap, yMap, canvasRect, from, to );
430  break;
431  case Steps:
432  drawSteps( painter, xMap, yMap, canvasRect, from, to );
433  break;
434  case Dots:
435  drawDots( painter, xMap, yMap, canvasRect, from, to );
436  break;
437  case LinesAndDots:
438  {
439  if ( testCurveAttribute( Fitted ) )
440  {
441  from = 0;
442  to = dataSize() - 1;
443  }
444  drawLines( painter, xMap, yMap, canvasRect, from, to );
445 
446  QPen prev_pen = painter->pen();
447  QPen new_pen = prev_pen;
448  new_pen.setWidth( prev_pen.width() * 3);
449 
450  painter->setPen( new_pen );
451  drawDots( painter, xMap, yMap, canvasRect, from, to );
452  painter->setPen( prev_pen );
453  }
454  break;
455  case NoCurve:
456  default:
457  break;
458  }
459 }
460 
477 void QwtPlotCurve::drawLines( QPainter *painter,
478  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
479  const QRectF &canvasRect, int from, int to ) const
480 {
481  if ( from > to )
482  return;
483 
484  const bool doFit = ( d_data->attributes & Fitted ) && d_data->curveFitter;
485  const bool doAlign = !doFit && QwtPainter::roundingAlignment( painter );
486  const bool doFill = ( d_data->brush.style() != Qt::NoBrush )
487  && ( d_data->brush.color().alpha() > 0 );
488 
489  QRectF clipRect;
491  {
492  clipRect = qwtIntersectedClipRect( canvasRect, painter );
493 
494  const qreal pw = qMax( qreal( 1.0 ), painter->pen().widthF());
495  clipRect = clipRect.adjusted(-pw, -pw, pw, pw);
496  }
497 
498  bool doIntegers = false;
499 
500 #if QT_VERSION < 0x040800
501  if ( painter->paintEngine()->type() == QPaintEngine::Raster )
502  {
503 
504  // For Qt <= 4.7 the raster paint engine is significantly faster
505  // for rendering QPolygon than for QPolygonF. So let's
506  // see if we can use it.
507 
508  // In case of filling or fitting performance doesn't count
509  // because both operations are much more expensive
510  // then drawing the polyline itself
511 
512  if ( !doFit && !doFill )
513  doIntegers = true;
514  }
515 #endif
516 
517  QwtPointMapper mapper;
518 
519  if ( doAlign )
520  {
521  mapper.setFlag( QwtPointMapper::RoundPoints, true );
524  }
525 
529 
530  mapper.setBoundingRect( canvasRect );
531 
532  if ( doIntegers )
533  {
534  QPolygon polyline = mapper.toPolygon(
535  xMap, yMap, data(), from, to );
536 
538  {
539  QwtClipper::clipPolygon( clipRect, polyline, false );
540  }
541 
542  QwtPainter::drawPolyline( painter, polyline );
543  }
544  else
545  {
546  QPolygonF polyline = mapper.toPolygonF( xMap, yMap, data(), from, to );
547 
548  if ( doFill )
549  {
550  if ( doFit )
551  {
552  // it might be better to extend and draw the curvePath, but for
553  // the moment we keep an implementation, where we translate the
554  // path back to a polyline.
555 
556  polyline = d_data->curveFitter->fitCurve( polyline );
557  }
558 
559  if ( painter->pen().style() != Qt::NoPen )
560  {
561  // here we are wasting memory for the filled copy,
562  // do polygon clipping twice etc .. TODO
563 
564  QPolygonF filled = polyline;
565  fillCurve( painter, xMap, yMap, canvasRect, filled );
566  filled.clear();
567 
569  QwtClipper::clipPolygonF( clipRect, polyline, false );
570 
571  QwtPainter::drawPolyline( painter, polyline );
572  }
573  else
574  {
575  fillCurve( painter, xMap, yMap, canvasRect, polyline );
576  }
577  }
578  else
579  {
581  {
582  QwtClipper::clipPolygonF( clipRect, polyline, false );
583  }
584 
585  if ( doFit )
586  {
588  {
589  const QPainterPath curvePath =
590  d_data->curveFitter->fitCurvePath( polyline );
591 
592  painter->drawPath( curvePath );
593  }
594  else
595  {
596  polyline = d_data->curveFitter->fitCurve( polyline );
597  QwtPainter::drawPolyline( painter, polyline );
598  }
599  }
600  else
601  {
602  QwtPainter::drawPolyline( painter, polyline );
603  }
604  }
605  }
606 }
607 
620 void QwtPlotCurve::drawSticks( QPainter *painter,
621  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
622  const QRectF &, int from, int to ) const
623 {
624  painter->save();
625  painter->setRenderHint( QPainter::Antialiasing, false );
626 
627  const bool doAlign = QwtPainter::roundingAlignment( painter );
628 
629  double x0 = xMap.transform( d_data->baseline );
630  double y0 = yMap.transform( d_data->baseline );
631  if ( doAlign )
632  {
633  x0 = qRound( x0 );
634  y0 = qRound( y0 );
635  }
636 
637  const Qt::Orientation o = orientation();
638 
639  const QwtSeriesData<QPointF> *series = data();
640 
641  for ( int i = from; i <= to; i++ )
642  {
643  const QPointF sample = series->sample( i );
644  double xi = xMap.transform( sample.x() );
645  double yi = yMap.transform( sample.y() );
646  if ( doAlign )
647  {
648  xi = qRound( xi );
649  yi = qRound( yi );
650  }
651 
652  if ( o == Qt::Horizontal )
653  QwtPainter::drawLine( painter, x0, yi, xi, yi );
654  else
655  QwtPainter::drawLine( painter, xi, y0, xi, yi );
656  }
657 
658  painter->restore();
659 }
660 
673 void QwtPlotCurve::drawDots( QPainter *painter,
674  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
675  const QRectF &canvasRect, int from, int to ) const
676 {
677  const QColor color = painter->pen().color();
678 
679  if ( painter->pen().style() == Qt::NoPen || color.alpha() == 0 )
680  {
681  return;
682  }
683 
684  const bool doFill = ( d_data->brush.style() != Qt::NoBrush )
685  && ( d_data->brush.color().alpha() > 0 );
686  const bool doAlign = QwtPainter::roundingAlignment( painter );
687 
688  QwtPointMapper mapper;
689  mapper.setBoundingRect( canvasRect );
690  mapper.setFlag( QwtPointMapper::RoundPoints, doAlign );
691 
693  {
694  if ( ( color.alpha() == 255 )
695  && !( painter->renderHints() & QPainter::Antialiasing ) )
696  {
697  mapper.setFlag( QwtPointMapper::WeedOutPoints, true );
698  }
699  }
700 
701  if ( doFill )
702  {
703  mapper.setFlag( QwtPointMapper::WeedOutPoints, false );
704 
705  QPolygonF points = mapper.toPointsF(
706  xMap, yMap, data(), from, to );
707 
708  QwtPainter::drawPoints( painter, points );
709  fillCurve( painter, xMap, yMap, canvasRect, points );
710  }
711  else if ( d_data->paintAttributes & ImageBuffer )
712  {
713  const QImage image = mapper.toImage( xMap, yMap,
714  data(), from, to, d_data->pen,
715  painter->testRenderHint( QPainter::Antialiasing ),
716  renderThreadCount() );
717 
718  painter->drawImage( canvasRect.toAlignedRect(), image );
719  }
720  else if ( d_data->paintAttributes & MinimizeMemory )
721  {
722  const QwtSeriesData<QPointF> *series = data();
723 
724  for ( int i = from; i <= to; i++ )
725  {
726  const QPointF sample = series->sample( i );
727 
728  double xi = xMap.transform( sample.x() );
729  double yi = yMap.transform( sample.y() );
730 
731  if ( doAlign )
732  {
733  xi = qRound( xi );
734  yi = qRound( yi );
735  }
736 
737  QwtPainter::drawPoint( painter, QPointF( xi, yi ) );
738  }
739  }
740  else
741  {
742  if ( doAlign )
743  {
744  const QPolygon points = mapper.toPoints(
745  xMap, yMap, data(), from, to );
746 
747  QwtPainter::drawPoints( painter, points );
748  }
749  else
750  {
751  const QPolygonF points = mapper.toPointsF(
752  xMap, yMap, data(), from, to );
753 
754  QwtPainter::drawPoints( painter, points );
755  }
756  }
757 }
758 
774 void QwtPlotCurve::drawSteps( QPainter *painter,
775  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
776  const QRectF &canvasRect, int from, int to ) const
777 {
778  const bool doAlign = QwtPainter::roundingAlignment( painter );
779 
780  QPolygonF polygon( 2 * ( to - from ) + 1 );
781  QPointF *points = polygon.data();
782 
783  bool inverted = orientation() == Qt::Vertical;
784  if ( d_data->attributes & Inverted )
785  inverted = !inverted;
786 
787  const QwtSeriesData<QPointF> *series = data();
788 
789  int i, ip;
790  for ( i = from, ip = 0; i <= to; i++, ip += 2 )
791  {
792  const QPointF sample = series->sample( i );
793  double xi = xMap.transform( sample.x() );
794  double yi = yMap.transform( sample.y() );
795  if ( doAlign )
796  {
797  xi = qRound( xi );
798  yi = qRound( yi );
799  }
800 
801  if ( ip > 0 )
802  {
803  const QPointF &p0 = points[ip - 2];
804  QPointF &p = points[ip - 1];
805 
806  if ( inverted )
807  {
808  p.rx() = p0.x();
809  p.ry() = yi;
810  }
811  else
812  {
813  p.rx() = xi;
814  p.ry() = p0.y();
815  }
816  }
817 
818  points[ip].rx() = xi;
819  points[ip].ry() = yi;
820  }
821 
823  {
824  QRectF clipRect = qwtIntersectedClipRect( canvasRect, painter );
825 
826  const qreal pw = qMax( qreal( 1.0 ), painter->pen().widthF());
827  clipRect = clipRect.adjusted(-pw, -pw, pw, pw);
828 
829  const QPolygonF clipped = QwtClipper::clippedPolygonF(
830  clipRect, polygon, false );
831 
832  QwtPainter::drawPolyline( painter, clipped );
833  }
834  else
835  {
836  QwtPainter::drawPolyline( painter, polygon );
837  }
838 
839  if ( d_data->brush.style() != Qt::NoBrush )
840  fillCurve( painter, xMap, yMap, canvasRect, polygon );
841 }
842 
843 
853 {
854  if ( bool( d_data->attributes & attribute ) == on )
855  return;
856 
857  if ( on )
858  d_data->attributes |= attribute;
859  else
860  d_data->attributes &= ~attribute;
861 
862  itemChanged();
863 }
864 
870 {
871  return d_data->attributes & attribute;
872 }
873 
892 {
893  delete d_data->curveFitter;
895 
896  itemChanged();
897 }
898 
906 {
907  return d_data->curveFitter;
908 }
909 
922 void QwtPlotCurve::fillCurve( QPainter *painter,
923  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
924  const QRectF &canvasRect, QPolygonF &polygon ) const
925 {
926  if ( d_data->brush.style() == Qt::NoBrush )
927  return;
928 
929  closePolyline( painter, xMap, yMap, polygon );
930  if ( polygon.count() <= 2 ) // a line can't be filled
931  return;
932 
933  QBrush brush = d_data->brush;
934  if ( !brush.color().isValid() )
935  brush.setColor( d_data->pen.color() );
936 
938  {
939  const QRectF clipRect = qwtIntersectedClipRect( canvasRect, painter );
940  QwtClipper::clipPolygonF( clipRect, polygon, true );
941  }
942 
943  painter->save();
944 
945  painter->setPen( Qt::NoPen );
946  painter->setBrush( brush );
947 
948  QwtPainter::drawPolygon( painter, polygon );
949 
950  painter->restore();
951 }
952 
962 void QwtPlotCurve::closePolyline( QPainter *painter,
963  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
964  QPolygonF &polygon ) const
965 {
966  if ( polygon.size() < 2 )
967  return;
968 
969  const bool doAlign = QwtPainter::roundingAlignment( painter );
970 
971  double baseline = d_data->baseline;
972 
973  if ( orientation() == Qt::Vertical )
974  {
975  if ( yMap.transformation() )
976  baseline = yMap.transformation()->bounded( baseline );
977 
978  double refY = yMap.transform( baseline );
979  if ( doAlign )
980  refY = qRound( refY );
981 
982  polygon += QPointF( polygon.last().x(), refY );
983  polygon += QPointF( polygon.first().x(), refY );
984  }
985  else
986  {
987  if ( xMap.transformation() )
988  baseline = xMap.transformation()->bounded( baseline );
989 
990  double refX = xMap.transform( baseline );
991  if ( doAlign )
992  refX = qRound( refX );
993 
994  polygon += QPointF( refX, polygon.last().y() );
995  polygon += QPointF( refX, polygon.first().y() );
996  }
997 }
998 
1012 void QwtPlotCurve::drawSymbols( QPainter *painter, const QwtSymbol &symbol,
1013  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
1014  const QRectF &canvasRect, int from, int to ) const
1015 {
1016  QwtPointMapper mapper;
1018  QwtPainter::roundingAlignment( painter ) );
1021 
1022  const QRectF clipRect = qwtIntersectedClipRect( canvasRect, painter );
1023  mapper.setBoundingRect( clipRect );
1024 
1025  const int chunkSize = 500;
1026 
1027  for ( int i = from; i <= to; i += chunkSize )
1028  {
1029  const int n = qMin( chunkSize, to - i + 1 );
1030 
1031  const QPolygonF points = mapper.toPointsF( xMap, yMap,
1032  data(), i, i + n - 1 );
1033 
1034  if ( points.size() > 0 )
1035  symbol.drawSymbols( painter, points );
1036  }
1037 }
1038 
1055 void QwtPlotCurve::setBaseline( double value )
1056 {
1057  if ( d_data->baseline != value )
1058  {
1059  d_data->baseline = value;
1060  itemChanged();
1061  }
1062 }
1063 
1069 {
1070  return d_data->baseline;
1071 }
1072 
1084 int QwtPlotCurve::closestPoint( const QPoint &pos, double *dist ) const
1085 {
1086  const size_t numSamples = dataSize();
1087 
1088  if ( plot() == NULL || numSamples <= 0 )
1089  return -1;
1090 
1091  const QwtSeriesData<QPointF> *series = data();
1092 
1093  const QwtScaleMap xMap = plot()->canvasMap( xAxis() );
1094  const QwtScaleMap yMap = plot()->canvasMap( yAxis() );
1095 
1096  int index = -1;
1097  double dmin = 1.0e10;
1098 
1099  for ( uint i = 0; i < numSamples; i++ )
1100  {
1101  const QPointF sample = series->sample( i );
1102 
1103  const double cx = xMap.transform( sample.x() ) - pos.x();
1104  const double cy = yMap.transform( sample.y() ) - pos.y();
1105 
1106  const double f = qwtSqr( cx ) + qwtSqr( cy );
1107  if ( f < dmin )
1108  {
1109  index = i;
1110  dmin = f;
1111  }
1112  }
1113  if ( dist )
1114  *dist = qSqrt( dmin );
1115 
1116  return index;
1117 }
1118 
1129  const QSizeF &size ) const
1130 {
1131  Q_UNUSED( index );
1132 
1133  if ( size.isEmpty() )
1134  return QwtGraphic();
1135 
1136  QwtGraphic graphic;
1137  graphic.setDefaultSize( size );
1139 
1140  QPainter painter( &graphic );
1141  painter.setRenderHint( QPainter::Antialiasing,
1143 
1144  if ( d_data->legendAttributes == 0 ||
1146  {
1147  QBrush brush = d_data->brush;
1148 
1149  if ( brush.style() == Qt::NoBrush &&
1150  d_data->legendAttributes == 0 )
1151  {
1152  if ( style() != QwtPlotCurve::NoCurve )
1153  {
1154  brush = QBrush( pen().color() );
1155  }
1156  else if ( d_data->symbol &&
1157  ( d_data->symbol->style() != QwtSymbol::NoSymbol ) )
1158  {
1159  brush = QBrush( d_data->symbol->pen().color() );
1160  }
1161  }
1162 
1163  if ( brush.style() != Qt::NoBrush )
1164  {
1165  QRectF r( 0, 0, size.width(), size.height() );
1166  painter.fillRect( r, brush );
1167  }
1168  }
1169 
1171  {
1172  if ( pen() != Qt::NoPen )
1173  {
1174  QPen pn = pen();
1175  pn.setCapStyle( Qt::FlatCap );
1176 
1177  painter.setPen( pn );
1178 
1179  const double y = 0.5 * size.height();
1180  QwtPainter::drawLine( &painter, 0.0, y, size.width(), y );
1181  }
1182  }
1183 
1185  {
1186  if ( d_data->symbol )
1187  {
1188  QRectF r( 0, 0, size.width(), size.height() );
1189  d_data->symbol->drawSymbol( &painter, r );
1190  }
1191  }
1192 
1193  return graphic;
1194 }
1195 
1203 void QwtPlotCurve::setSamples( const QVector<QPointF> &samples )
1204 {
1205  setData( new QwtPointSeriesData( samples ) );
1206 }
1207 
1219 {
1220  setData( data );
1221 }
1222 
1223 #ifndef QWT_NO_COMPAT
1224 
1240  const double *xData, const double *yData, int size )
1241 {
1242  setData( new QwtCPointerData( xData, yData, size ) );
1243 }
1244 
1257  const double *xData, const double *yData, int size )
1258 {
1259  setData( new QwtPointArrayData( xData, yData, size ) );
1260 }
1261 
1270 void QwtPlotCurve::setSamples( const QVector<double> &xData,
1271  const QVector<double> &yData )
1272 {
1273  setData( new QwtPointArrayData( xData, yData ) );
1274 }
1275 
1276 #endif // !QWT_NO_COMPAT
1277 
virtual void legendChanged()
virtual size_t dataSize() const
Qt::Orientation orientation() const
virtual QRect boundingRect() const
Style style() const
QwtPlotCurve::CurveAttributes attributes
void setRawSamples(const double *xData, const double *yData, int size)
Initialize the data by pointing to memory blocks which are not managed by QwtPlotCurve.
void setStyle(CurveStyle style)
static void drawLine(QPainter *, double x1, double y1, double x2, double y2)
Wrapper for QPainter::drawLine()
Definition: qwt_painter.h:147
Enable antialiasing.
QPolygonF toPointsF(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData< QPointF > *series, int from, int to) const
Translate a series into a QPolygonF.
A plot item, that represents a series of points.
void setBoundingRect(const QRectF &)
f
QwtPlotCurve(const QString &title=QString())
static int qwtVerifyRange(int size, int &i1, int &i2)
static void drawPoints(QPainter *, const QPolygon &)
Wrapper for QPainter::drawPoints()
Definition: qwt_painter.h:135
virtual void drawLines(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
Draw lines.
PrivateData * d_data
const QBrush & brush() const
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
int xAxis() const
Return xAxis.
QwtPlotCurve::PaintAttributes paintAttributes
virtual void drawSticks(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
void setData(QwtSeriesData< QPointF > *series)
double baseline() const
virtual void fillCurve(QPainter *, const QwtScaleMap &, const QwtScaleMap &, const QRectF &canvasRect, QPolygonF &) const
QFlags< CurveAttribute > CurveAttributes
Curve attributes.
A curve fitter using a spline interpolation.
void setPaintAttribute(PaintAttribute, bool on=true)
QwtSeriesData< QPointF > * data()
A class for drawing symbols.
Definition: qwt_symbol.h:30
QPolygon toPolygon(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData< QPointF > *series, int from, int to) const
Translate a series of points into a QPolygon.
QwtPlot * plot() const
Return attached plot.
TFSIMD_FORCE_INLINE const tfScalar & y() const
QwtCurveFitter * curveFitter
static QPolygonF clippedPolygonF(const QRectF &, const QPolygonF &, bool closePolygon=false)
QwtPlotCurve::LegendAttributes legendAttributes
void setSamples(const double *xData, const double *yData, int size)
void setBaseline(double)
Set the value of the baseline.
void closePolyline(QPainter *, const QwtScaleMap &, const QwtScaleMap &, QPolygonF &) const
Complete a polygon to be a closed polygon including the area between the original polygon and the bas...
void setRenderHint(RenderHint, bool on=true)
void setSymbol(QwtSymbol *)
Assign a symbol.
virtual double bounded(double value) const
void setDefaultSize(const QSizeF &)
Set a default size.
The item is represented on the legend.
void setFlag(TransformationFlag, bool on=true)
void init()
Initialize internal members.
virtual int closestPoint(const QPoint &pos, double *dist=NULL) const
QPolygon toPoints(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData< QPointF > *series, int from, int to) const
Translate a series of points into a QPolygon.
const QwtSymbol * symbol() const
static void drawPolygon(QPainter *, const QPolygonF &)
Wrapper for QPainter::drawPolygon()
virtual void drawDots(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
void setCurveFitter(QwtCurveFitter *)
bool testRenderHint(RenderHint) const
Data class containing two pointers to memory blocks of doubles.
virtual void drawCurve(QPainter *p, int style, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
Draw the line part (without symbols) of a curve interval.
static void clipPolygonF(const QRectF &, QPolygonF &, bool closePolygon=false)
virtual QPainterPath fitCurvePath(const QPolygonF &polygon) const =0
const QPen & pen() const
Round points to integer values.
A class representing a text.
Definition: qwt_text.h:51
virtual QwtScaleMap canvasMap(int axisId) const
Definition: qwt_plot.cpp:790
void setZ(double z)
Set the z value.
A paint device for scalable graphics.
Definition: qwt_graphic.h:74
int yAxis() const
Return yAxis.
void drawSymbols(QPainter *, const QPolygonF &) const
Draw symbols at the specified points.
Definition: qwt_symbol.h:250
virtual void drawSteps(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
void setPen(const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)
const QwtTransform * transformation() const
Get the transformation.
A scale map.
Definition: qwt_scale_map.h:30
QPointF sample(int index) const
virtual void itemChanged()
CurveStyle style() const
virtual void drawSymbols(QPainter *p, const QwtSymbol &, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
virtual void drawSeries(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
uint renderThreadCount() const
UnboundConversion o
TFSIMD_FORCE_INLINE const tfScalar & w() const
virtual int rtti() const
static void drawPolyline(QPainter *, const QPolygonF &)
Wrapper for QPainter::drawPolyline()
QPolygonF toPolygonF(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData< QPointF > *series, int from, int to) const
Translate a series of points into a QPolygonF.
QwtPlotCurve::CurveStyle style
QFlags< LegendAttribute > LegendAttributes
Legend attributes.
QFlags< PaintAttribute > PaintAttributes
Paint attributes.
bool testLegendAttribute(LegendAttribute) const
virtual QPolygonF fitCurve(const QPolygonF &polygon) const =0
Mode mode() const
bool testCurveAttribute(CurveAttribute) const
void setBrush(const QBrush &)
Assign a brush.
virtual T sample(size_t i) const =0
static void qwtUpdateLegendIconSize(QwtPlotCurve *curve)
Base class for plot items representing a series of samples.
void setLegendAttribute(LegendAttribute, bool on=true)
QImage toImage(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QwtSeriesData< QPointF > *series, int from, int to, const QPen &, bool antialiased, uint numThreads) const
Translate a series into a QImage.
void setItemAttribute(ItemAttribute, bool on=true)
void setLegendIconSize(const QSize &)
double qwtSqr(double x)
Return the square of a number.
Definition: qwt_math.h:88
double transform(double s) const
static QRectF qwtIntersectedClipRect(const QRectF &rect, QPainter *painter)
QwtCurveFitter * curveFitter() const
int i
Interface for iterating over two QVector<double> objects.
void drawSymbol(QPainter *, const QRectF &) const
Draw the symbol into a rectangle.
static void drawPoint(QPainter *, const QPoint &)
Wrapper for QPainter::drawPoint()
Interface for iterating over an array of points.
Abstract base class for a curve fitter.
bool testPaintAttribute(PaintAttribute) const
const QPen & pen() const
static bool roundingAlignment()
Definition: qwt_painter.h:176
static void clipPolygon(const QRect &, QPolygon &, bool closePolygon=false)
int n
virtual ~QwtPlotCurve()
Destructor.
A helper class for translating a series of points.
const QwtText & title() const
For QwtPlotCurve.
Definition: qwt_plot_item.h:91
No Style. The symbol cannot be drawn.
Definition: qwt_symbol.h:40
void setCurveAttribute(CurveAttribute, bool on=true)


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17