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.

82 lines
2.6 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) 2010 Jeffery MacEachern
  7. * Based on CirclePoint code by Kai Winter
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Lesser General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public License
  20. * along with QMapControl. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. * Contact e-mail: kaiwinter@gmx.de
  23. * Program URL : http://qmapcontrol.sourceforge.net/
  24. *
  25. */
  26. #ifndef ARROWPOINT_H
  27. #define ARROWPOINT_H
  28. #include "qmapcontrol_global.h"
  29. #include "math.h"
  30. #include "point.h"
  31. //! Draws a directed arrow (showing orientation) into the map
  32. /*! This is a convenience class for Point.
  33. * It configures the pixmap of a Point to draw an arrow in a specific direction.
  34. * A QPen could be used to change the color or line-width of the arrow
  35. *
  36. * @author Jeffery MacEachern <j.maceachern@gmail.com>
  37. */
  38. class ArrowPoint : public mapPoint {
  39. public:
  40. //!
  41. /*!
  42. *
  43. * @param x longitude
  44. * @param y latitude
  45. * @param sideLength side length of the arrow's bounding box (square)
  46. * @param heading compass heading determining direction that arrow faces, measured in degrees clockwise from North
  47. * @param name name of the arrow point
  48. * @param alignment alignment (Middle or TopLeft)
  49. * @param pen QPen for drawing
  50. */
  51. ArrowPoint(qreal x, qreal y, int sideLength, qreal heading, QString name = QString(), Alignment alignment = Middle, QPen* pen=0);
  52. virtual ~ArrowPoint();
  53. //! sets the QPen which is used for drawing the arrow
  54. /*!
  55. * A QPen can be used to modify the look of the drawn arrow
  56. * @param pen the QPen which should be used for drawing
  57. * @see http://doc.trolltech.com/4.3/qpen.html
  58. */
  59. virtual void setPen(QPen* pen);
  60. //! sets the heading of the arrow and redraws it in the new orientation
  61. /*!
  62. * @param heading new heading
  63. */
  64. void setHeading(qreal heading);
  65. //! gets the current heading of the arrow
  66. qreal getHeading() const;
  67. private:
  68. void drawArrow();
  69. // Heading
  70. qreal h;
  71. // Brush to fill the arrow with - solid colour, same as pen
  72. QBrush mybrush;
  73. };
  74. #endif