1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 23:03:22 +02:00
GPXSee/src/waypointitem.h

42 lines
999 B
C
Raw Normal View History

2016-02-19 21:34:55 +01:00
#ifndef WAYPOINTITEM_H
#define WAYPOINTITEM_H
2015-10-05 01:43:48 +02:00
#include <cmath>
2015-10-05 01:43:48 +02:00
#include <QGraphicsItem>
2016-02-12 10:09:17 +01:00
#include "waypoint.h"
2016-08-02 00:28:56 +02:00
#include "units.h"
#include "map.h"
2016-02-19 21:42:54 +01:00
class WaypointItem : public QGraphicsItem
2015-10-05 01:43:48 +02:00
{
public:
WaypointItem(const Waypoint &waypoint, Map *map, QGraphicsItem *parent = 0);
2015-10-05 01:43:48 +02:00
const Waypoint &waypoint() const {return _waypoint;}
2015-10-05 01:43:48 +02:00
void setMap(Map *map) {setPos(map->ll2xy(_waypoint.coordinates()));}
void setUnits(Units units);
2016-08-09 01:16:19 +02:00
void showLabel(bool show);
void setDigitalZoom(int zoom) {setScale(pow(2, -zoom));}
2016-08-02 00:28:56 +02:00
QPainterPath shape() const {return _shape;}
QRectF boundingRect() const {return _shape.boundingRect();}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
2015-10-05 01:43:48 +02:00
private:
2016-09-10 13:11:46 +02:00
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
void updateShape();
QString toolTip(Units units);
2015-10-05 01:43:48 +02:00
QPainterPath _shape;
Waypoint _waypoint;
2016-09-10 13:11:46 +02:00
bool _hover;
2016-08-09 01:16:19 +02:00
bool _showLabel;
2015-10-05 01:43:48 +02:00
};
2016-02-19 21:34:55 +01:00
#endif // WAYPOINTITEM_H