Cosmetics
[GPXSee.git] / src / waypointitem.h
blobe9be5dff63407ffd80759c48eb14ddb0fba8e6d9
1 #ifndef WAYPOINTITEM_H
2 #define WAYPOINTITEM_H
4 #include <cmath>
5 #include <QGraphicsItem>
6 #include "waypoint.h"
7 #include "units.h"
8 #include "map.h"
10 class WaypointItem : public QGraphicsItem
12 public:
13 WaypointItem(const Waypoint &waypoint, Map *map, QGraphicsItem *parent = 0);
15 const Waypoint &waypoint() const {return _waypoint;}
17 void setMap(Map *map) {setPos(map->ll2xy(_waypoint.coordinates()));}
18 void setUnits(Units units);
19 void showLabel(bool show);
20 void setDigitalZoom(int zoom) {setScale(pow(2, -zoom));}
22 QPainterPath shape() const {return _shape;}
23 QRectF boundingRect() const {return _shape.boundingRect();}
24 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
25 QWidget *widget);
27 private:
28 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
29 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
31 void updateShape();
32 QString toolTip(Units units);
34 QPainterPath _shape;
35 Waypoint _waypoint;
37 bool _hover;
38 bool _showLabel;
41 #endif // WAYPOINTITEM_H