forked from madtreat/cpd-map
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mapoverlay.h
80 lines (59 loc) · 1.92 KB
/
mapoverlay.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* File: mapoverlay.h
* Author: Madison Treat <madison.treat@tamu.edu>
*
* Created on June 15, 2015, 2:37 PM
*/
#ifndef MAPOVERLAY_
#define MAPOVERLAY_
#include <QWidget>
#include <QImage>
#include <QVector>
#include <QLineF>
#include <QGraphicsSvgItem>
#include "core/aircraft.h"
#include "mapconsts.h"
class QPaintEvent;
class MapSettings;
class MapOverlay : public QWidget {
Q_OBJECT;
typedef QVector<QLineF> TickList;
// compass radius = map_width/2 - COMPASS_PADDING
static const int COMPASS_PADDING = 20;
public:
MapOverlay(MapSettings* _mapSettings, ACMap* _acMap, QWidget* _parent = 0);
MapOverlay(const MapOverlay& orig) = delete;
virtual ~MapOverlay();
QSize sizeHint() const;
void resize(int w, int h);
void resize(const QSize& size);
bool northUp() const;
public slots:
void setZoom(int level);
void panToLocation(float lat, float lon);
void setHeading(float _heading) {heading = _heading; repaint();}
void displayTraffic(bool show);
void satButtonClicked(bool checked);
void setAircraftType(AircraftType type);
protected:
double getDrawAngleRad(double deg);
QLineF getLine(double deg, int from, int to, int cx=0, int cy=0);
void initRangeTicks(int diameter=DEFAULT_MAP_WIDTH);
void paintEvent(QPaintEvent* event);
void drawRangeCircle(QPainter& p);
private:
MapSettings* mapSettings;
ACMap* acMap;
AircraftType type;
double heading; // current heading value in degrees
bool showTraffic; // currently displaying traffic?
bool satMapActive; // is the satellite map currently active?
Qt::GlobalColor overlayColor;
TickList rangeCircleTicks; // list of pre-generated lines for when NORTH_UP
// icons/images
QImage aircraftIcon;
QString ownshipPath; // filepath
QGraphicsSvgItem* ownship; // raw SVG aircraft image
QImage ownshipIcon; // rendered from the ownship SVG item
};
#endif // MAPOVERLAY_