qwt_symbol.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_symbol.h"
11 #include "qwt_painter.h"
12 #include "qwt_graphic.h"
13 #include "qwt_math.h"
14 
15 #include <qpainter.h>
16 #include <qpainterpath.h>
17 #include <qpixmap.h>
18 #include <qpaintengine.h>
19 #ifndef QWT_NO_SVG
20 #include <qsvgrenderer.h>
21 #endif
22 
23 namespace QwtTriangle
24 {
25  enum Type
26  {
29  Up,
31  };
32 }
33 
34 static QwtGraphic qwtPathGraphic( const QPainterPath &path,
35  const QPen &pen, const QBrush& brush )
36 {
37  QwtGraphic graphic;
39 
40  QPainter painter( &graphic );
41  painter.setPen( pen );
42  painter.setBrush( brush );
43  painter.drawPath( path );
44  painter.end();
45 
46  return graphic;
47 }
48 
49 static inline QRectF qwtScaledBoundingRect(
50  const QwtGraphic &graphic, const QSizeF size )
51 {
52  QSizeF scaledSize = size;
53  if ( scaledSize.isEmpty() )
54  scaledSize = graphic.defaultSize();
55 
56  const QSizeF sz = graphic.controlPointRect().size();
57 
58  double sx = 1.0;
59  if ( sz.width() > 0.0 )
60  sx = scaledSize.width() / sz.width();
61 
62  double sy = 1.0;
63  if ( sz.height() > 0.0 )
64  sy = scaledSize.height() / sz.height();
65 
66  return graphic.scaledBoundingRect( sx, sy );
67 }
68 
69 static inline void qwtDrawPixmapSymbols( QPainter *painter,
70  const QPointF *points, int numPoints, const QwtSymbol &symbol )
71 {
72  QSize size = symbol.size();
73  if ( size.isEmpty() )
74  size = symbol.pixmap().size();
75 
76  const QTransform transform = painter->transform();
77  if ( transform.isScaling() )
78  {
79  const QRect r( 0, 0, size.width(), size.height() );
80  size = transform.mapRect( r ).size();
81  }
82 
83  QPixmap pm = symbol.pixmap();
84  if ( pm.size() != size )
85  pm = pm.scaled( size );
86 
87  QPointF pinPoint( 0.5 * size.width(), 0.5 * size.height() );
88  if ( symbol.isPinPointEnabled() )
89  pinPoint = symbol.pinPoint();
90 
91  painter->resetTransform();
92 
93  for ( int i = 0; i < numPoints; i++ )
94  {
95  const QPointF pos = transform.map( points[i] ) - pinPoint;
96 
97  QwtPainter::drawPixmap( painter,
98  QRect( pos.toPoint(), pm.size() ), pm );
99  }
100 }
101 
102 #ifndef QWT_NO_SVG
103 
104 static inline void qwtDrawSvgSymbols( QPainter *painter,
105  const QPointF *points, int numPoints,
106  QSvgRenderer *renderer, const QwtSymbol &symbol )
107 {
108  if ( renderer == NULL || !renderer->isValid() )
109  return;
110 
111  const QRectF viewBox = renderer->viewBoxF();
112  if ( viewBox.isEmpty() )
113  return;
114 
115  QSizeF sz = symbol.size();
116  if ( !sz.isValid() )
117  sz = viewBox.size();
118 
119  const double sx = sz.width() / viewBox.width();
120  const double sy = sz.height() / viewBox.height();
121 
122  QPointF pinPoint = viewBox.center();
123  if ( symbol.isPinPointEnabled() )
124  pinPoint = symbol.pinPoint();
125 
126  const double dx = sx * ( pinPoint.x() - viewBox.left() );
127  const double dy = sy * ( pinPoint.y() - viewBox.top() );
128 
129  for ( int i = 0; i < numPoints; i++ )
130  {
131  const double x = points[i].x() - dx;
132  const double y = points[i].y() - dy;
133 
134  renderer->render( painter,
135  QRectF( x, y, sz.width(), sz.height() ) );
136  }
137 }
138 
139 #endif
140 
141 static inline void qwtDrawGraphicSymbols( QPainter *painter,
142  const QPointF *points, int numPoints, const QwtGraphic &graphic,
143  const QwtSymbol &symbol )
144 {
145  const QRectF pointRect = graphic.controlPointRect();
146  if ( pointRect.isEmpty() )
147  return;
148 
149  double sx = 1.0;
150  double sy = 1.0;
151 
152  const QSize sz = symbol.size();
153  if ( sz.isValid() )
154  {
155  sx = sz.width() / pointRect.width();
156  sy = sz.height() / pointRect.height();
157  }
158 
159  QPointF pinPoint = pointRect.center();
160  if ( symbol.isPinPointEnabled() )
161  pinPoint = symbol.pinPoint();
162 
163  const QTransform transform = painter->transform();
164 
165  for ( int i = 0; i < numPoints; i++ )
166  {
167  QTransform tr = transform;
168  tr.translate( points[i].x(), points[i].y() );
169  tr.scale( sx, sy );
170  tr.translate( -pinPoint.x(), -pinPoint.y() );
171 
172  painter->setTransform( tr );
173 
174  graphic.render( painter );
175  }
176 
177  painter->setTransform( transform );
178 }
179 
180 static inline void qwtDrawEllipseSymbols( QPainter *painter,
181  const QPointF *points, int numPoints, const QwtSymbol &symbol )
182 {
183  painter->setBrush( symbol.brush() );
184  painter->setPen( symbol.pen() );
185 
186  const QSize size = symbol.size();
187 
188  if ( QwtPainter::roundingAlignment( painter ) )
189  {
190  const int sw = size.width();
191  const int sh = size.height();
192  const int sw2 = size.width() / 2;
193  const int sh2 = size.height() / 2;
194 
195  for ( int i = 0; i < numPoints; i++ )
196  {
197  const int x = qRound( points[i].x() );
198  const int y = qRound( points[i].y() );
199 
200  const QRectF r( x - sw2, y - sh2, sw, sh );
201  QwtPainter::drawEllipse( painter, r );
202  }
203  }
204  else
205  {
206  const double sw = size.width();
207  const double sh = size.height();
208  const double sw2 = 0.5 * size.width();
209  const double sh2 = 0.5 * size.height();
210 
211  for ( int i = 0; i < numPoints; i++ )
212  {
213  const double x = points[i].x();
214  const double y = points[i].y();
215 
216  const QRectF r( x - sw2, y - sh2, sw, sh );
217  QwtPainter::drawEllipse( painter, r );
218  }
219  }
220 }
221 
222 static inline void qwtDrawRectSymbols( QPainter *painter,
223  const QPointF *points, int numPoints, const QwtSymbol &symbol )
224 {
225  const QSize size = symbol.size();
226 
227  QPen pen = symbol.pen();
228  pen.setJoinStyle( Qt::MiterJoin );
229  painter->setPen( pen );
230  painter->setBrush( symbol.brush() );
231  painter->setRenderHint( QPainter::Antialiasing, false );
232 
233  if ( QwtPainter::roundingAlignment( painter ) )
234  {
235  const int sw = size.width();
236  const int sh = size.height();
237  const int sw2 = size.width() / 2;
238  const int sh2 = size.height() / 2;
239 
240  for ( int i = 0; i < numPoints; i++ )
241  {
242  const int x = qRound( points[i].x() );
243  const int y = qRound( points[i].y() );
244 
245  const QRect r( x - sw2, y - sh2, sw, sh );
246  QwtPainter::drawRect( painter, r );
247  }
248  }
249  else
250  {
251  const double sw = size.width();
252  const double sh = size.height();
253  const double sw2 = 0.5 * size.width();
254  const double sh2 = 0.5 * size.height();
255 
256  for ( int i = 0; i < numPoints; i++ )
257  {
258  const double x = points[i].x();
259  const double y = points[i].y();
260 
261  const QRectF r( x - sw2, y - sh2, sw, sh );
262  QwtPainter::drawRect( painter, r );
263  }
264  }
265 }
266 
267 static inline void qwtDrawDiamondSymbols( QPainter *painter,
268  const QPointF *points, int numPoints, const QwtSymbol &symbol )
269 {
270  const QSize size = symbol.size();
271 
272  QPen pen = symbol.pen();
273  pen.setJoinStyle( Qt::MiterJoin );
274  painter->setPen( pen );
275  painter->setBrush( symbol.brush() );
276 
277  if ( QwtPainter::roundingAlignment( painter ) )
278  {
279  for ( int i = 0; i < numPoints; i++ )
280  {
281  const int x = qRound( points[i].x() );
282  const int y = qRound( points[i].y() );
283 
284  const int x1 = x - size.width() / 2;
285  const int y1 = y - size.height() / 2;
286  const int x2 = x1 + size.width();
287  const int y2 = y1 + size.height();
288 
289  QPolygonF polygon;
290  polygon += QPointF( x, y1 );
291  polygon += QPointF( x1, y );
292  polygon += QPointF( x, y2 );
293  polygon += QPointF( x2, y );
294 
295  QwtPainter::drawPolygon( painter, polygon );
296  }
297  }
298  else
299  {
300  for ( int i = 0; i < numPoints; i++ )
301  {
302  const QPointF &pos = points[i];
303 
304  const double x1 = pos.x() - 0.5 * size.width();
305  const double y1 = pos.y() - 0.5 * size.height();
306  const double x2 = x1 + size.width();
307  const double y2 = y1 + size.height();
308 
309  QPolygonF polygon;
310  polygon += QPointF( pos.x(), y1 );
311  polygon += QPointF( x2, pos.y() );
312  polygon += QPointF( pos.x(), y2 );
313  polygon += QPointF( x1, pos.y() );
314 
315  QwtPainter::drawPolygon( painter, polygon );
316  }
317  }
318 }
319 
320 static inline void qwtDrawTriangleSymbols(
321  QPainter *painter, QwtTriangle::Type type,
322  const QPointF *points, int numPoints,
323  const QwtSymbol &symbol )
324 {
325  const QSize size = symbol.size();
326 
327  QPen pen = symbol.pen();
328  pen.setJoinStyle( Qt::MiterJoin );
329  painter->setPen( pen );
330 
331  painter->setBrush( symbol.brush() );
332 
333  const bool doAlign = QwtPainter::roundingAlignment( painter );
334 
335  double sw2 = 0.5 * size.width();
336  double sh2 = 0.5 * size.height();
337 
338  if ( doAlign )
339  {
340  sw2 = std::floor( sw2 );
341  sh2 = std::floor( sh2 );
342  }
343 
344  QPolygonF triangle( 3 );
345  QPointF *trianglePoints = triangle.data();
346 
347  for ( int i = 0; i < numPoints; i++ )
348  {
349  const QPointF &pos = points[i];
350 
351  double x = pos.x();
352  double y = pos.y();
353 
354  if ( doAlign )
355  {
356  x = qRound( x );
357  y = qRound( y );
358  }
359 
360  const double x1 = x - sw2;
361  const double x2 = x1 + size.width();
362  const double y1 = y - sh2;
363  const double y2 = y1 + size.height();
364 
365  switch ( type )
366  {
367  case QwtTriangle::Left:
368  {
369  trianglePoints[0].rx() = x2;
370  trianglePoints[0].ry() = y1;
371 
372  trianglePoints[1].rx() = x1;
373  trianglePoints[1].ry() = y;
374 
375  trianglePoints[2].rx() = x2;
376  trianglePoints[2].ry() = y2;
377 
378  break;
379  }
380  case QwtTriangle::Right:
381  {
382  trianglePoints[0].rx() = x1;
383  trianglePoints[0].ry() = y1;
384 
385  trianglePoints[1].rx() = x2;
386  trianglePoints[1].ry() = y;
387 
388  trianglePoints[2].rx() = x1;
389  trianglePoints[2].ry() = y2;
390 
391  break;
392  }
393  case QwtTriangle::Up:
394  {
395  trianglePoints[0].rx() = x1;
396  trianglePoints[0].ry() = y2;
397 
398  trianglePoints[1].rx() = x;
399  trianglePoints[1].ry() = y1;
400 
401  trianglePoints[2].rx() = x2;
402  trianglePoints[2].ry() = y2;
403 
404  break;
405  }
406  case QwtTriangle::Down:
407  {
408  trianglePoints[0].rx() = x1;
409  trianglePoints[0].ry() = y1;
410 
411  trianglePoints[1].rx() = x;
412  trianglePoints[1].ry() = y2;
413 
414  trianglePoints[2].rx() = x2;
415  trianglePoints[2].ry() = y1;
416 
417  break;
418  }
419  }
420  QwtPainter::drawPolygon( painter, triangle );
421  }
422 }
423 
424 static inline void qwtDrawLineSymbols(
425  QPainter *painter, int orientations,
426  const QPointF *points, int numPoints, const QwtSymbol &symbol )
427 {
428  const QSize size = symbol.size();
429 
430  int off = 0;
431 
432  QPen pen = symbol.pen();
433  if ( pen.width() > 1 )
434  {
435  pen.setCapStyle( Qt::FlatCap );
436  off = 1;
437  }
438 
439  painter->setPen( pen );
440  painter->setRenderHint( QPainter::Antialiasing, false );
441 
442  if ( QwtPainter::roundingAlignment( painter ) )
443  {
444  const int sw = qwtFloor( size.width() );
445  const int sh = qwtFloor( size.height() );
446  const int sw2 = size.width() / 2;
447  const int sh2 = size.height() / 2;
448 
449  for ( int i = 0; i < numPoints; i++ )
450  {
451  if ( orientations & Qt::Horizontal )
452  {
453  const int x = qRound( points[i].x() ) - sw2;
454  const int y = qRound( points[i].y() );
455 
456  QwtPainter::drawLine( painter, x, y, x + sw + off, y );
457  }
458  if ( orientations & Qt::Vertical )
459  {
460  const int x = qRound( points[i].x() );
461  const int y = qRound( points[i].y() ) - sh2;
462 
463  QwtPainter::drawLine( painter, x, y, x, y + sh + off );
464  }
465  }
466  }
467  else
468  {
469  const double sw = size.width();
470  const double sh = size.height();
471  const double sw2 = 0.5 * size.width();
472  const double sh2 = 0.5 * size.height();
473 
474  for ( int i = 0; i < numPoints; i++ )
475  {
476  if ( orientations & Qt::Horizontal )
477  {
478  const double x = points[i].x() - sw2;
479  const double y = points[i].y();
480 
481  QwtPainter::drawLine( painter, x, y, x + sw, y );
482  }
483  if ( orientations & Qt::Vertical )
484  {
485  const double y = points[i].y() - sh2;
486  const double x = points[i].x();
487 
488  QwtPainter::drawLine( painter, x, y, x, y + sh );
489  }
490  }
491  }
492 }
493 
494 static inline void qwtDrawXCrossSymbols( QPainter *painter,
495  const QPointF *points, int numPoints, const QwtSymbol &symbol )
496 {
497  const QSize size = symbol.size();
498  int off = 0;
499 
500  QPen pen = symbol.pen();
501  if ( pen.width() > 1 )
502  {
503  pen.setCapStyle( Qt::FlatCap );
504  off = 1;
505  }
506  painter->setPen( pen );
507 
508 
509  if ( QwtPainter::roundingAlignment( painter ) )
510  {
511  const int sw = size.width();
512  const int sh = size.height();
513  const int sw2 = size.width() / 2;
514  const int sh2 = size.height() / 2;
515 
516  for ( int i = 0; i < numPoints; i++ )
517  {
518  const QPointF &pos = points[i];
519 
520  const int x = qRound( pos.x() );
521  const int y = qRound( pos.y() );
522 
523  const int x1 = x - sw2;
524  const int x2 = x1 + sw + off;
525  const int y1 = y - sh2;
526  const int y2 = y1 + sh + off;
527 
528  QwtPainter::drawLine( painter, x1, y1, x2, y2 );
529  QwtPainter::drawLine( painter, x2, y1, x1, y2 );
530  }
531  }
532  else
533  {
534  const double sw = size.width();
535  const double sh = size.height();
536  const double sw2 = 0.5 * size.width();
537  const double sh2 = 0.5 * size.height();
538 
539  for ( int i = 0; i < numPoints; i++ )
540  {
541  const QPointF &pos = points[i];
542 
543  const double x1 = pos.x() - sw2;
544  const double x2 = x1 + sw;
545  const double y1 = pos.y() - sh2;
546  const double y2 = y1 + sh;
547 
548  QwtPainter::drawLine( painter, x1, y1, x2, y2 );
549  QwtPainter::drawLine( painter, x1, y2, x2, y1 );
550  }
551  }
552 }
553 
554 static inline void qwtDrawStar1Symbols( QPainter *painter,
555  const QPointF *points, int numPoints, const QwtSymbol &symbol )
556 {
557  const QSize size = symbol.size();
558  painter->setPen( symbol.pen() );
559 
560  if ( QwtPainter::roundingAlignment( painter ) )
561  {
562  QRect r( 0, 0, size.width(), size.height() );
563 
564  for ( int i = 0; i < numPoints; i++ )
565  {
566  r.moveCenter( points[i].toPoint() );
567 
568  const double sqrt1_2 = 0.70710678118654752440; /* 1/sqrt(2) */
569 
570  const double d1 = r.width() / 2.0 * ( 1.0 - sqrt1_2 );
571 
572  QwtPainter::drawLine( painter,
573  qRound( r.left() + d1 ), qRound( r.top() + d1 ),
574  qRound( r.right() - d1 ), qRound( r.bottom() - d1 ) );
575  QwtPainter::drawLine( painter,
576  qRound( r.left() + d1 ), qRound( r.bottom() - d1 ),
577  qRound( r .right() - d1), qRound( r.top() + d1 ) );
578 
579  const QPoint c = r.center();
580 
581  QwtPainter::drawLine( painter,
582  c.x(), r.top(), c.x(), r.bottom() );
583  QwtPainter::drawLine( painter,
584  r.left(), c.y(), r.right(), c.y() );
585  }
586  }
587  else
588  {
589  QRectF r( 0, 0, size.width(), size.height() );
590 
591  for ( int i = 0; i < numPoints; i++ )
592  {
593  r.moveCenter( points[i] );
594 
595  const double sqrt1_2 = 0.70710678118654752440; /* 1/sqrt(2) */
596 
597  const QPointF c = r.center();
598  const double d1 = r.width() / 2.0 * ( 1.0 - sqrt1_2 );
599 
600  QwtPainter::drawLine( painter,
601  r.left() + d1, r.top() + d1,
602  r.right() - d1, r.bottom() - d1 );
603  QwtPainter::drawLine( painter,
604  r.left() + d1, r.bottom() - d1,
605  r.right() - d1, r.top() + d1 );
606  QwtPainter::drawLine( painter,
607  c.x(), r.top(),
608  c.x(), r.bottom() );
609  QwtPainter::drawLine( painter,
610  r.left(), c.y(),
611  r.right(), c.y() );
612  }
613  }
614 }
615 
616 static inline void qwtDrawStar2Symbols( QPainter *painter,
617  const QPointF *points, int numPoints, const QwtSymbol &symbol )
618 {
619  QPen pen = symbol.pen();
620  if ( pen.width() > 1 )
621  pen.setCapStyle( Qt::FlatCap );
622  pen.setJoinStyle( Qt::MiterJoin );
623  painter->setPen( pen );
624 
625  painter->setBrush( symbol.brush() );
626 
627  const double cos30 = 0.866025; // cos(30°)
628 
629  const double dy = 0.25 * symbol.size().height();
630  const double dx = 0.5 * symbol.size().width() * cos30 / 3.0;
631 
632  QPolygonF star( 12 );
633  QPointF *starPoints = star.data();
634 
635  const bool doAlign = QwtPainter::roundingAlignment( painter );
636 
637  for ( int i = 0; i < numPoints; i++ )
638  {
639  double x = points[i].x();
640  double y = points[i].y();
641  if ( doAlign )
642  {
643  x = qRound( x );
644  y = qRound( y );
645  }
646 
647  double x1 = x - 3 * dx;
648  double y1 = y - 2 * dy;
649  if ( doAlign )
650  {
651  x1 = qRound( x - 3 * dx );
652  y1 = qRound( y - 2 * dy );
653  }
654 
655  const double x2 = x1 + 1 * dx;
656  const double x3 = x1 + 2 * dx;
657  const double x4 = x1 + 3 * dx;
658  const double x5 = x1 + 4 * dx;
659  const double x6 = x1 + 5 * dx;
660  const double x7 = x1 + 6 * dx;
661 
662  const double y2 = y1 + 1 * dy;
663  const double y3 = y1 + 2 * dy;
664  const double y4 = y1 + 3 * dy;
665  const double y5 = y1 + 4 * dy;
666 
667  starPoints[0].rx() = x4;
668  starPoints[0].ry() = y1;
669 
670  starPoints[1].rx() = x5;
671  starPoints[1].ry() = y2;
672 
673  starPoints[2].rx() = x7;
674  starPoints[2].ry() = y2;
675 
676  starPoints[3].rx() = x6;
677  starPoints[3].ry() = y3;
678 
679  starPoints[4].rx() = x7;
680  starPoints[4].ry() = y4;
681 
682  starPoints[5].rx() = x5;
683  starPoints[5].ry() = y4;
684 
685  starPoints[6].rx() = x4;
686  starPoints[6].ry() = y5;
687 
688  starPoints[7].rx() = x3;
689  starPoints[7].ry() = y4;
690 
691  starPoints[8].rx() = x1;
692  starPoints[8].ry() = y4;
693 
694  starPoints[9].rx() = x2;
695  starPoints[9].ry() = y3;
696 
697  starPoints[10].rx() = x1;
698  starPoints[10].ry() = y2;
699 
700  starPoints[11].rx() = x3;
701  starPoints[11].ry() = y2;
702 
703  QwtPainter::drawPolygon( painter, star );
704  }
705 }
706 
707 static inline void qwtDrawHexagonSymbols( QPainter *painter,
708  const QPointF *points, int numPoints, const QwtSymbol &symbol )
709 {
710  painter->setBrush( symbol.brush() );
711  painter->setPen( symbol.pen() );
712 
713  const double cos30 = 0.866025; // cos(30°)
714  const double dx = 0.5 * ( symbol.size().width() - cos30 );
715 
716  const double dy = 0.25 * symbol.size().height();
717 
718  QPolygonF hexaPolygon( 6 );
719  QPointF *hexaPoints = hexaPolygon.data();
720 
721  const bool doAlign = QwtPainter::roundingAlignment( painter );
722 
723  for ( int i = 0; i < numPoints; i++ )
724  {
725  double x = points[i].x();
726  double y = points[i].y();
727  if ( doAlign )
728  {
729  x = qRound( x );
730  y = qRound( y );
731  }
732 
733  double x1 = x - dx;
734  double y1 = y - 2 * dy;
735  if ( doAlign )
736  {
737  x1 = std::ceil( x1 );
738  y1 = std::ceil( y1 );
739  }
740 
741  const double x2 = x1 + 1 * dx;
742  const double x3 = x1 + 2 * dx;
743 
744  const double y2 = y1 + 1 * dy;
745  const double y3 = y1 + 3 * dy;
746  const double y4 = y1 + 4 * dy;
747 
748  hexaPoints[0].rx() = x2;
749  hexaPoints[0].ry() = y1;
750 
751  hexaPoints[1].rx() = x3;
752  hexaPoints[1].ry() = y2;
753 
754  hexaPoints[2].rx() = x3;
755  hexaPoints[2].ry() = y3;
756 
757  hexaPoints[3].rx() = x2;
758  hexaPoints[3].ry() = y4;
759 
760  hexaPoints[4].rx() = x1;
761  hexaPoints[4].ry() = y3;
762 
763  hexaPoints[5].rx() = x1;
764  hexaPoints[5].ry() = y2;
765 
766  QwtPainter::drawPolygon( painter, hexaPolygon );
767  }
768 }
769 
771 {
772 public:
773  PrivateData( QwtSymbol::Style st, const QBrush &br,
774  const QPen &pn, const QSize &sz ):
775  style( st ),
776  size( sz ),
777  brush( br ),
778  pen( pn ),
779  isPinPointEnabled( false )
780  {
781  cache.policy = QwtSymbol::AutoCache;
782 #ifndef QWT_NO_SVG
783  svg.renderer = NULL;
784 #endif
785  }
786 
788  {
789 #ifndef QWT_NO_SVG
790  delete svg.renderer;
791 #endif
792  }
793 
795  QSize size;
796  QBrush brush;
797  QPen pen;
798 
800  QPointF pinPoint;
801 
802  struct Path
803  {
804  QPainterPath path;
806 
807  } path;
808 
809  struct Pixmap
810  {
811  QPixmap pixmap;
812 
813  } pixmap;
814 
815  struct Graphic
816  {
818 
819  } graphic;
820 
821 #ifndef QWT_NO_SVG
822  struct SVG
823  {
824  QSvgRenderer *renderer;
825  } svg;
826 #endif
827 
828  struct PaintCache
829  {
831  QPixmap pixmap;
832 
833  } cache;
834 };
835 
844 {
845  d_data = new PrivateData( style, QBrush( Qt::gray ),
846  QPen( Qt::black, 0 ), QSize() );
847 }
848 
858 QwtSymbol::QwtSymbol( QwtSymbol::Style style, const QBrush &brush,
859  const QPen &pen, const QSize &size )
860 {
861  d_data = new PrivateData( style, brush, pen, size );
862 }
863 
878 QwtSymbol::QwtSymbol( const QPainterPath &path,
879  const QBrush &brush, const QPen &pen )
880 {
881  d_data = new PrivateData( QwtSymbol::Path, brush, pen, QSize() );
882  setPath( path );
883 }
884 
887 {
888  delete d_data;
889 }
890 
900  QwtSymbol::CachePolicy policy )
901 {
902  if ( d_data->cache.policy != policy )
903  {
904  d_data->cache.policy = policy;
905  invalidateCache();
906  }
907 }
908 
914 {
915  return d_data->cache.policy;
916 }
917 
967 void QwtSymbol::setPath( const QPainterPath &path )
968 {
969  d_data->style = QwtSymbol::Path;
970  d_data->path.path = path;
971  d_data->path.graphic.reset();
972 }
973 
978 const QPainterPath &QwtSymbol::path() const
979 {
980  return d_data->path.path;
981 }
982 
993 void QwtSymbol::setPixmap( const QPixmap &pixmap )
994 {
995  d_data->style = QwtSymbol::Pixmap;
996  d_data->pixmap.pixmap = pixmap;
997 }
998 
1003 const QPixmap &QwtSymbol::pixmap() const
1004 {
1005  return d_data->pixmap.pixmap;
1006 }
1007 
1018 void QwtSymbol::setGraphic( const QwtGraphic &graphic )
1019 {
1020  d_data->style = QwtSymbol::Graphic;
1021  d_data->graphic.graphic = graphic;
1022 }
1023 
1029 {
1030  return d_data->graphic.graphic;
1031 }
1032 
1033 #ifndef QWT_NO_SVG
1034 
1045 void QwtSymbol::setSvgDocument( const QByteArray &svgDocument )
1046 {
1047  d_data->style = QwtSymbol::SvgDocument;
1048  if ( d_data->svg.renderer == NULL )
1049  d_data->svg.renderer = new QSvgRenderer();
1050 
1051  d_data->svg.renderer->load( svgDocument );
1052 }
1053 
1054 #endif
1055 
1068 void QwtSymbol::setSize( int width, int height )
1069 {
1070  if ( ( width >= 0 ) && ( height < 0 ) )
1071  height = width;
1072 
1073  setSize( QSize( width, height ) );
1074 }
1075 
1082 void QwtSymbol::setSize( const QSize &size )
1083 {
1084  if ( size.isValid() && size != d_data->size )
1085  {
1086  d_data->size = size;
1087  invalidateCache();
1088  }
1089 }
1090 
1095 const QSize& QwtSymbol::size() const
1096 {
1097  return d_data->size;
1098 }
1099 
1108 void QwtSymbol::setBrush( const QBrush &brush )
1109 {
1110  if ( brush != d_data->brush )
1111  {
1112  d_data->brush = brush;
1113  invalidateCache();
1114 
1115  if ( d_data->style == QwtSymbol::Path )
1116  d_data->path.graphic.reset();
1117  }
1118 }
1119 
1124 const QBrush& QwtSymbol::brush() const
1125 {
1126  return d_data->brush;
1127 }
1128 
1142 void QwtSymbol::setPen( const QColor &color,
1143  qreal width, Qt::PenStyle style )
1144 {
1145  setPen( QPen( color, width, style ) );
1146 }
1147 
1156 void QwtSymbol::setPen( const QPen &pen )
1157 {
1158  if ( pen != d_data->pen )
1159  {
1160  d_data->pen = pen;
1161  invalidateCache();
1162 
1163  if ( d_data->style == QwtSymbol::Path )
1164  d_data->path.graphic.reset();
1165  }
1166 }
1167 
1172 const QPen& QwtSymbol::pen() const
1173 {
1174  return d_data->pen;
1175 }
1176 
1187 void QwtSymbol::setColor( const QColor &color )
1188 {
1189  switch ( d_data->style )
1190  {
1191  case QwtSymbol::Ellipse:
1192  case QwtSymbol::Rect:
1193  case QwtSymbol::Diamond:
1194  case QwtSymbol::Triangle:
1195  case QwtSymbol::UTriangle:
1196  case QwtSymbol::DTriangle:
1197  case QwtSymbol::RTriangle:
1198  case QwtSymbol::LTriangle:
1199  case QwtSymbol::Star2:
1200  case QwtSymbol::Hexagon:
1201  {
1202  if ( d_data->brush.color() != color )
1203  {
1204  d_data->brush.setColor( color );
1205  invalidateCache();
1206  }
1207  break;
1208  }
1209  case QwtSymbol::Cross:
1210  case QwtSymbol::XCross:
1211  case QwtSymbol::HLine:
1212  case QwtSymbol::VLine:
1213  case QwtSymbol::Star1:
1214  {
1215  if ( d_data->pen.color() != color )
1216  {
1217  d_data->pen.setColor( color );
1218  invalidateCache();
1219  }
1220  break;
1221  }
1222  default:
1223  {
1224  if ( d_data->brush.color() != color ||
1225  d_data->pen.color() != color )
1226  {
1227  invalidateCache();
1228  }
1229 
1230  d_data->brush.setColor( color );
1231  d_data->pen.setColor( color );
1232  }
1233  }
1234 }
1235 
1250 void QwtSymbol::setPinPoint( const QPointF &pos, bool enable )
1251 {
1252  if ( d_data->pinPoint != pos )
1253  {
1254  d_data->pinPoint = pos;
1255  if ( d_data->isPinPointEnabled )
1256  {
1257  invalidateCache();
1258  }
1259  }
1260 
1261  setPinPointEnabled( enable );
1262 }
1263 
1268 QPointF QwtSymbol::pinPoint() const
1269 {
1270  return d_data->pinPoint;
1271 }
1272 
1280 {
1281  if ( d_data->isPinPointEnabled != on )
1282  {
1283  d_data->isPinPointEnabled = on;
1284  invalidateCache();
1285  }
1286 }
1287 
1293 {
1294  return d_data->isPinPointEnabled;
1295 }
1296 
1308 void QwtSymbol::drawSymbols( QPainter *painter,
1309  const QPointF *points, int numPoints ) const
1310 {
1311  if ( numPoints <= 0 )
1312  return;
1313 
1314  bool useCache = false;
1315 
1316  // Don't use the pixmap, when the paint device
1317  // could generate scalable vectors
1318 
1319  if ( QwtPainter::roundingAlignment( painter ) &&
1320  !painter->transform().isScaling() )
1321  {
1322  if ( d_data->cache.policy == QwtSymbol::Cache )
1323  {
1324  useCache = true;
1325  }
1326  else if ( d_data->cache.policy == QwtSymbol::AutoCache )
1327  {
1328  switch( painter->paintEngine()->type() )
1329  {
1330  case QPaintEngine::OpenGL:
1331  case QPaintEngine::OpenGL2:
1332  {
1333  // using a FBO as cache ?
1334  useCache = false;
1335  break;
1336  }
1337  case QPaintEngine::OpenVG:
1338  case QPaintEngine::SVG:
1339  case QPaintEngine::Pdf:
1340  case QPaintEngine::Picture:
1341  {
1342  // vector graphics
1343  useCache = false;
1344  break;
1345  }
1346  case QPaintEngine::X11:
1347  {
1348  switch( d_data->style )
1349  {
1350  case QwtSymbol::XCross:
1351  case QwtSymbol::HLine:
1352  case QwtSymbol::VLine:
1353  case QwtSymbol::Cross:
1354  {
1355  // for the very simple shapes using vector graphics is
1356  // usually faster.
1357 
1358  useCache = false;
1359  break;
1360  }
1361 
1362  case QwtSymbol::Pixmap:
1363  {
1364  if ( d_data->size.isEmpty() ||
1365  d_data->size == d_data->pixmap.pixmap.size() )
1366  {
1367  // no need to have a pixmap cache for a pixmap
1368  // of the same size
1369 
1370  useCache = false;
1371  }
1372  break;
1373  }
1374  default:
1375  break;
1376  }
1377  break;
1378  }
1379  default:
1380  {
1381  useCache = true;
1382  }
1383  }
1384  }
1385  }
1386 
1387  if ( useCache )
1388  {
1389  const QRect br = boundingRect();
1390 
1391  if ( d_data->cache.pixmap.isNull() )
1392  {
1393  d_data->cache.pixmap = QwtPainter::backingStore( NULL, br.size() );
1394  d_data->cache.pixmap.fill( Qt::transparent );
1395 
1396  QPainter p( &d_data->cache.pixmap );
1397  p.setRenderHints( painter->renderHints() );
1398  p.translate( -br.topLeft() );
1399 
1400  const QPointF pos( 0.0, 0.0 );
1401  renderSymbols( &p, &pos, 1 );
1402  }
1403 
1404  const int dx = br.left();
1405  const int dy = br.top();
1406 
1407  for ( int i = 0; i < numPoints; i++ )
1408  {
1409  const int left = qRound( points[i].x() ) + dx;
1410  const int top = qRound( points[i].y() ) + dy;
1411 
1412  painter->drawPixmap( left, top, d_data->cache.pixmap );
1413  }
1414  }
1415  else
1416  {
1417  painter->save();
1418  renderSymbols( painter, points, numPoints );
1419  painter->restore();
1420  }
1421 }
1422 
1435 void QwtSymbol::drawSymbol( QPainter *painter, const QRectF &rect ) const
1436 {
1437  if ( d_data->style == QwtSymbol::NoSymbol )
1438  return;
1439 
1440  if ( d_data->style == QwtSymbol::Graphic )
1441  {
1442  d_data->graphic.graphic.render(
1443  painter, rect, Qt::KeepAspectRatio );
1444  }
1445  else if ( d_data->style == QwtSymbol::Path )
1446  {
1447  if ( d_data->path.graphic.isNull() )
1448  {
1449  d_data->path.graphic = qwtPathGraphic(
1450  d_data->path.path, d_data->pen, d_data->brush );
1451  }
1452 
1453  d_data->path.graphic.render(
1454  painter, rect, Qt::KeepAspectRatio );
1455  return;
1456  }
1457  else if ( d_data->style == QwtSymbol::SvgDocument )
1458  {
1459 #ifndef QWT_NO_SVG
1460  if ( d_data->svg.renderer )
1461  {
1462  QRectF scaledRect;
1463 
1464  QSizeF sz = d_data->svg.renderer->viewBoxF().size();
1465  if ( !sz.isEmpty() )
1466  {
1467  sz.scale( rect.size(), Qt::KeepAspectRatio );
1468  scaledRect.setSize( sz );
1469  scaledRect.moveCenter( rect.center() );
1470  }
1471  else
1472  {
1473  scaledRect = rect;
1474  }
1475 
1476  d_data->svg.renderer->render(
1477  painter, scaledRect );
1478  }
1479 #endif
1480  }
1481  else
1482  {
1483  const QRect br = boundingRect();
1484 
1485  // scale the symbol size to fit into rect.
1486 
1487  const double ratio = qMin( rect.width() / br.width(),
1488  rect.height() / br.height() );
1489 
1490  painter->save();
1491 
1492  painter->translate( rect.center() );
1493  painter->scale( ratio, ratio );
1494 
1495  const bool isPinPointEnabled = d_data->isPinPointEnabled;
1496  d_data->isPinPointEnabled = false;
1497 
1498  const QPointF pos;
1499  renderSymbols( painter, &pos, 1 );
1500 
1501  d_data->isPinPointEnabled = isPinPointEnabled;
1502 
1503  painter->restore();
1504  }
1505 }
1506 
1514 void QwtSymbol::renderSymbols( QPainter *painter,
1515  const QPointF *points, int numPoints ) const
1516 {
1517  switch ( d_data->style )
1518  {
1519  case QwtSymbol::Ellipse:
1520  {
1521  qwtDrawEllipseSymbols( painter, points, numPoints, *this );
1522  break;
1523  }
1524  case QwtSymbol::Rect:
1525  {
1526  qwtDrawRectSymbols( painter, points, numPoints, *this );
1527  break;
1528  }
1529  case QwtSymbol::Diamond:
1530  {
1531  qwtDrawDiamondSymbols( painter, points, numPoints, *this );
1532  break;
1533  }
1534  case QwtSymbol::Cross:
1535  {
1536  qwtDrawLineSymbols( painter, Qt::Horizontal | Qt::Vertical,
1537  points, numPoints, *this );
1538  break;
1539  }
1540  case QwtSymbol::XCross:
1541  {
1542  qwtDrawXCrossSymbols( painter, points, numPoints, *this );
1543  break;
1544  }
1545  case QwtSymbol::Triangle:
1546  case QwtSymbol::UTriangle:
1547  {
1549  points, numPoints, *this );
1550  break;
1551  }
1552  case QwtSymbol::DTriangle:
1553  {
1555  points, numPoints, *this );
1556  break;
1557  }
1558  case QwtSymbol::RTriangle:
1559  {
1561  points, numPoints, *this );
1562  break;
1563  }
1564  case QwtSymbol::LTriangle:
1565  {
1567  points, numPoints, *this );
1568  break;
1569  }
1570  case QwtSymbol::HLine:
1571  {
1572  qwtDrawLineSymbols( painter, Qt::Horizontal,
1573  points, numPoints, *this );
1574  break;
1575  }
1576  case QwtSymbol::VLine:
1577  {
1578  qwtDrawLineSymbols( painter, Qt::Vertical,
1579  points, numPoints, *this );
1580  break;
1581  }
1582  case QwtSymbol::Star1:
1583  {
1584  qwtDrawStar1Symbols( painter, points, numPoints, *this );
1585  break;
1586  }
1587  case QwtSymbol::Star2:
1588  {
1589  qwtDrawStar2Symbols( painter, points, numPoints, *this );
1590  break;
1591  }
1592  case QwtSymbol::Hexagon:
1593  {
1594  qwtDrawHexagonSymbols( painter, points, numPoints, *this );
1595  break;
1596  }
1597  case QwtSymbol::Path:
1598  {
1599  if ( d_data->path.graphic.isNull() )
1600  {
1601  d_data->path.graphic = qwtPathGraphic( d_data->path.path,
1602  d_data->pen, d_data->brush );
1603  }
1604 
1605  qwtDrawGraphicSymbols( painter, points, numPoints,
1606  d_data->path.graphic, *this );
1607  break;
1608  }
1609  case QwtSymbol::Pixmap:
1610  {
1611  qwtDrawPixmapSymbols( painter, points, numPoints, *this );
1612  break;
1613  }
1614  case QwtSymbol::Graphic:
1615  {
1616  qwtDrawGraphicSymbols( painter, points, numPoints,
1617  d_data->graphic.graphic, *this );
1618  break;
1619  }
1621  {
1622 #ifndef QWT_NO_SVG
1623  qwtDrawSvgSymbols( painter, points, numPoints,
1624  d_data->svg.renderer, *this );
1625 #endif
1626  break;
1627  }
1628  default:;
1629  }
1630 }
1631 
1639 {
1640  QRectF rect;
1641 
1642  bool pinPointTranslation = false;
1643 
1644  switch ( d_data->style )
1645  {
1646  case QwtSymbol::Ellipse:
1647  case QwtSymbol::Rect:
1648  case QwtSymbol::Hexagon:
1649  {
1650  qreal pw = 0.0;
1651  if ( d_data->pen.style() != Qt::NoPen )
1652  pw = QwtPainter::effectivePenWidth( d_data->pen );
1653 
1654  rect.setSize( d_data->size + QSizeF( pw, pw ) );
1655  rect.moveCenter( QPointF( 0.0, 0.0 ) );
1656 
1657  break;
1658  }
1659  case QwtSymbol::XCross:
1660  case QwtSymbol::Diamond:
1661  case QwtSymbol::Triangle:
1662  case QwtSymbol::UTriangle:
1663  case QwtSymbol::DTriangle:
1664  case QwtSymbol::RTriangle:
1665  case QwtSymbol::LTriangle:
1666  case QwtSymbol::Star1:
1667  case QwtSymbol::Star2:
1668  {
1669  qreal pw = 0.0;
1670  if ( d_data->pen.style() != Qt::NoPen )
1671  pw = QwtPainter::effectivePenWidth( d_data->pen );
1672 
1673  rect.setSize( d_data->size + QSizeF( 2 * pw, 2 * pw ) );
1674  rect.moveCenter( QPointF( 0.0, 0.0 ) );
1675  break;
1676  }
1677  case QwtSymbol::Path:
1678  {
1679  if ( d_data->path.graphic.isNull() )
1680  {
1681  d_data->path.graphic = qwtPathGraphic(
1682  d_data->path.path, d_data->pen, d_data->brush );
1683  }
1684 
1685  rect = qwtScaledBoundingRect(
1686  d_data->path.graphic, d_data->size );
1687  pinPointTranslation = true;
1688 
1689  break;
1690  }
1691  case QwtSymbol::Pixmap:
1692  {
1693  if ( d_data->size.isEmpty() )
1694  rect.setSize( d_data->pixmap.pixmap.size() );
1695  else
1696  rect.setSize( d_data->size );
1697 
1698  pinPointTranslation = true;
1699 
1700  break;
1701  }
1702  case QwtSymbol::Graphic:
1703  {
1704  rect = qwtScaledBoundingRect(
1705  d_data->graphic.graphic, d_data->size );
1706  pinPointTranslation = true;
1707 
1708  break;
1709  }
1710 #ifndef QWT_NO_SVG
1712  {
1713  if ( d_data->svg.renderer )
1714  rect = d_data->svg.renderer->viewBoxF();
1715 
1716  if ( d_data->size.isValid() && !rect.isEmpty() )
1717  {
1718  QSizeF sz = rect.size();
1719 
1720  const double sx = d_data->size.width() / sz.width();
1721  const double sy = d_data->size.height() / sz.height();
1722 
1723  QTransform transform;
1724  transform.scale( sx, sy );
1725 
1726  rect = transform.mapRect( rect );
1727  }
1728  pinPointTranslation = true;
1729  break;
1730  }
1731 #endif
1732  default:
1733  {
1734  rect.setSize( d_data->size );
1735  rect.moveCenter( QPointF( 0.0, 0.0 ) );
1736  }
1737  }
1738 
1739  if ( pinPointTranslation )
1740  {
1741  QPointF pinPoint( 0.0, 0.0 );
1742  if ( d_data->isPinPointEnabled )
1743  pinPoint = rect.center() - d_data->pinPoint;
1744 
1745  rect.moveCenter( pinPoint );
1746  }
1747 
1748  QRect r;
1749  r.setLeft( qwtFloor( rect.left() ) );
1750  r.setTop( qwtFloor( rect.top() ) );
1751  r.setRight( qwtCeil( rect.right() ) );
1752  r.setBottom( qwtCeil( rect.bottom() ) );
1753 
1754  if ( d_data->style != QwtSymbol::Pixmap )
1755  r.adjust( -1, -1, 1, 1 ); // for antialiasing
1756 
1757  return r;
1758 }
1759 
1772 {
1773  if ( !d_data->cache.pixmap.isNull() )
1774  d_data->cache.pixmap = QPixmap();
1775 }
1776 
1784 {
1785  if ( d_data->style != style )
1786  {
1787  d_data->style = style;
1788  invalidateCache();
1789  }
1790 }
1791 
1797 {
1798  return d_data->style;
1799 }
void setPen(const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)
virtual QRect boundingRect() const
Style style() const
Six-pointed star.
Definition: qwt_symbol.h:83
static void qwtDrawPixmapSymbols(QPainter *painter, const QPointF *points, int numPoints, const QwtSymbol &symbol)
Definition: qwt_symbol.cpp:69
QwtSymbol::CachePolicy policy
Definition: qwt_symbol.cpp:830
void render(QPainter *) const
Replay all recorded painter commands.
static void qwtDrawTriangleSymbols(QPainter *painter, QwtTriangle::Type type, const QPointF *points, int numPoints, const QwtSymbol &symbol)
Definition: qwt_symbol.cpp:320
static void qwtDrawRectSymbols(QPainter *painter, const QPointF *points, int numPoints, const QwtSymbol &symbol)
Definition: qwt_symbol.cpp:222
static void qwtDrawStar2Symbols(QPainter *painter, const QPointF *points, int numPoints, const QwtSymbol &symbol)
Definition: qwt_symbol.cpp:616
QwtSymbol(Style=NoSymbol)
Definition: qwt_symbol.cpp:843
lu_byte right
Definition: lparser.c:1229
static void drawLine(QPainter *, qreal x1, qreal y1, qreal x2, qreal y2)
Wrapper for QPainter::drawLine()
Definition: qwt_painter.h:152
virtual void renderSymbols(QPainter *, const QPointF *, int numPoints) const
void invalidateCache()
void setBrush(const QBrush &)
Assign a brush.
const QPixmap & pixmap() const
lu_byte left
Definition: lparser.c:1228
QRectF scaledBoundingRect(qreal sx, qreal sy) const
Calculate the target rectangle for scaling the graphic.
static void drawPixmap(QPainter *, const QRectF &, const QPixmap &)
Wrapper for QPainter::drawPixmap()
void setGraphic(const QwtGraphic &)
QSizeF defaultSize() const
Default size.
const QwtGraphic & graphic() const
A class for drawing symbols.
Definition: qwt_symbol.h:31
static void qwtDrawSvgSymbols(QPainter *painter, const QPointF *points, int numPoints, QSvgRenderer *renderer, const QwtSymbol &symbol)
Definition: qwt_symbol.cpp:104
Horizontal line.
Definition: qwt_symbol.h:74
Cross (+)
Definition: qwt_symbol.h:68
int qwtFloor(qreal value)
Definition: qwt_math.h:271
void setRenderHint(RenderHint, bool on=true)
void setSvgDocument(const QByteArray &)
QRectF controlPointRect() const
static qreal effectivePenWidth(const QPen &)
Definition: qwt_painter.h:199
Diagonal cross (X)
Definition: qwt_symbol.h:71
const QSize & size() const
static void qwtDrawDiamondSymbols(QPainter *painter, const QPointF *points, int numPoints, const QwtSymbol &symbol)
Definition: qwt_symbol.cpp:267
static void drawPolygon(QPainter *, const QPolygonF &)
Wrapper for QPainter::drawPolygon()
static void qwtDrawEllipseSymbols(QPainter *painter, const QPointF *points, int numPoints, const QwtSymbol &symbol)
Definition: qwt_symbol.cpp:180
QPointF pinPoint() const
Rectangle.
Definition: qwt_symbol.h:47
static void qwtDrawHexagonSymbols(QPainter *painter, const QPointF *points, int numPoints, const QwtSymbol &symbol)
Definition: qwt_symbol.cpp:707
PrivateData(QwtSymbol::Style st, const QBrush &br, const QPen &pn, const QSize &sz)
Definition: qwt_symbol.cpp:773
Triangle pointing right.
Definition: qwt_symbol.h:65
Ellipse or circle.
Definition: qwt_symbol.h:44
static void qwtDrawLineSymbols(QPainter *painter, int orientations, const QPointF *points, int numPoints, const QwtSymbol &symbol)
Definition: qwt_symbol.cpp:424
void setPinPoint(const QPointF &pos, bool enable=true)
Set and enable a pin point.
virtual ~QwtSymbol()
Destructor.
Definition: qwt_symbol.cpp:886
void setCachePolicy(CachePolicy)
Definition: qwt_symbol.cpp:899
static void qwtDrawXCrossSymbols(QPainter *painter, const QPointF *points, int numPoints, const QwtSymbol &symbol)
Definition: qwt_symbol.cpp:494
const QPen & pen() const
backward::SignalHandling sh
Definition: backward.cpp:30
static QwtGraphic qwtPathGraphic(const QPainterPath &path, const QPen &pen, const QBrush &brush)
Definition: qwt_symbol.cpp:34
A paint device for scalable graphics.
Definition: qwt_graphic.h:75
void drawSymbols(QPainter *, const QPolygonF &) const
Draw symbols at the specified points.
Definition: qwt_symbol.h:251
X combined with +.
Definition: qwt_symbol.h:80
Vertical line.
Definition: qwt_symbol.h:77
bool isPinPointEnabled() const
const QPainterPath & path() const
Definition: qwt_symbol.cpp:978
static void drawEllipse(QPainter *, const QRectF &)
Wrapper for QPainter::drawEllipse()
void setPixmap(const QPixmap &)
Definition: qwt_symbol.cpp:993
int top(lua_State *L)
Definition: sol.hpp:10543
static void drawRect(QPainter *, qreal x, qreal y, qreal w, qreal h)
Wrapper for QPainter::drawRect()
MQTTClient c
Definition: test10.c:1656
void setPath(const QPainterPath &)
Set a painter path as symbol.
Definition: qwt_symbol.cpp:967
Triangle pointing upwards.
Definition: qwt_symbol.h:53
static void qwtDrawGraphicSymbols(QPainter *painter, const QPointF *points, int numPoints, const QwtGraphic &graphic, const QwtSymbol &symbol)
Definition: qwt_symbol.cpp:141
static void qwtDrawStar1Symbols(QPainter *painter, const QPointF *points, int numPoints, const QwtSymbol &symbol)
Definition: qwt_symbol.cpp:554
std::enable_if_t< all< Args... >::value, enable_t > enable
Definition: sol.hpp:1726
Triangle pointing upwards.
Definition: qwt_symbol.h:59
void setPinPointEnabled(bool)
void setSize(const QSize &)
Triangle pointing left.
Definition: qwt_symbol.h:62
CachePolicy cachePolicy() const
Definition: qwt_symbol.cpp:913
static QRectF qwtScaledBoundingRect(const QwtGraphic &graphic, const QSizeF size)
Definition: qwt_symbol.cpp:49
void drawSymbol(QPainter *, const QRectF &) const
Draw the symbol into a rectangle.
Always use a pixmap cache.
Definition: qwt_symbol.h:156
void setStyle(Style)
const QBrush & brush() const
int qwtCeil(qreal value)
Definition: qwt_math.h:262
virtual void setColor(const QColor &)
Set the color of the symbol.
static bool roundingAlignment()
Definition: qwt_painter.h:181
Triangle pointing downwards.
Definition: qwt_symbol.h:56
static QPixmap backingStore(QWidget *, const QSize &)
No Style. The symbol cannot be drawn.
Definition: qwt_symbol.h:41


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10