You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.9 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. *
  3. * This file is part of QMapControl,
  4. * an open-source cross-platform map widget
  5. *
  6. * Copyright (C) 2007 - 2008 Kai Winter
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Lesser General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public License
  19. * along with QMapControl. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. * Contact e-mail: kaiwinter@gmx.de
  22. * Program URL : http://qmapcontrol.sourceforge.net/
  23. *
  24. */
  25. #include "circlepoint.h"
  26. CirclePoint::CirclePoint(qreal x, qreal y, int radius, QString name, Alignment alignment, QPen* pen)
  27. : mapPoint(x, y, name, alignment)
  28. {
  29. size = QSize(radius, radius);
  30. mypen = pen;
  31. mypixmap = QPixmap(radius+1, radius+1);
  32. drawCircle();
  33. }
  34. CirclePoint::CirclePoint(qreal x, qreal y, QString name, Alignment alignment, QPen* pen)
  35. : mapPoint(x, y, name, alignment)
  36. {
  37. int radius = 10;
  38. size = QSize(radius, radius);
  39. mypen = pen;
  40. mypixmap = QPixmap(radius+1, radius+1);
  41. drawCircle();
  42. }
  43. CirclePoint::~CirclePoint()
  44. {
  45. }
  46. void CirclePoint::setPen(QPen* pen)
  47. {
  48. mypen = pen;
  49. drawCircle();
  50. }
  51. void CirclePoint::drawCircle()
  52. {
  53. mypixmap.fill(Qt::transparent);
  54. QPainter painter(&mypixmap);
  55. //#if !defined Q_WS_MAEMO_5 //FIXME Maemo has a bug - it will antialias our point out of existence
  56. painter.setRenderHints(QPainter::Antialiasing|QPainter::HighQualityAntialiasing);
  57. //#endif
  58. if (mypen != 0)
  59. {
  60. painter.setPen(*mypen);
  61. }
  62. painter.drawEllipse(0,0, size.width(), size.height());
  63. }