Cosmetics
[GPXSee.git] / src / pathview.h
blob3e3ee14beba72b7a7c8e12990a809921a3369ca1
1 #ifndef TRACKVIEW_H
2 #define TRACKVIEW_H
4 #include <QGraphicsView>
5 #include <QVector>
6 #include <QHash>
7 #include <QList>
8 #include "units.h"
9 #include "palette.h"
10 #include "waypoint.h"
12 class Data;
13 class POI;
14 class Map;
15 class Track;
16 class Route;
17 class TrackItem;
18 class RouteItem;
19 class WaypointItem;
20 class ScaleItem;
21 class PathItem;
23 class PathView : public QGraphicsView
25 Q_OBJECT
27 public:
28 PathView(Map *map, POI *poi, QWidget *parent = 0);
29 ~PathView();
31 QList<PathItem*> loadData(const Data &data);
33 void setPalette(const Palette &palette);
34 void setPOI(POI *poi);
35 void setMap(Map *map);
36 void setUnits(enum Units units);
38 void plot(QPainter *painter, const QRectF &target);
40 int trackCount() const {return _tracks.count();}
41 int routeCount() const {return _routes.count();}
42 int waypointCount() const {return _waypoints.count();}
44 void clear();
46 void useOpenGL(bool use);
48 public slots:
49 void redraw();
51 void showMap(bool show);
52 void showPOI(bool show);
53 void setPOIOverlap(bool overlap);
54 void showWaypointLabels(bool show);
55 void showPOILabels(bool show);
56 void showTracks(bool show);
57 void showRoutes(bool show);
58 void showWaypoints(bool show);
59 void showRouteWaypoints(bool show);
60 void setTrackWidth(int width);
61 void setRouteWidth(int width);
62 void setTrackStyle(Qt::PenStyle style);
63 void setRouteStyle(Qt::PenStyle style);
65 private slots:
66 void updatePOI();
68 private:
69 PathItem *addTrack(const Track &track);
70 PathItem *addRoute(const Route &route);
71 void addWaypoints(const QList<Waypoint> &waypoints);
72 void addPOI(const QVector<Waypoint> &waypoints);
73 void loadPOI();
74 void clearPOI();
76 qreal mapScale() const;
77 QPointF contentCenter() const;
78 void rescale();
79 void zoom(int zoom, const QPoint &pos, const Coordinates &c);
80 void digitalZoom(int zoom);
81 void resetDigitalZoom();
82 void updatePOIVisibility();
83 void updateWaypointsBoundingRect(const QPointF &wp);
85 void mouseDoubleClickEvent(QMouseEvent *event);
86 void wheelEvent(QWheelEvent *event);
87 void keyPressEvent(QKeyEvent *event);
88 void drawBackground(QPainter *painter, const QRectF &rect);
89 void resizeEvent(QResizeEvent *event);
90 void paintEvent(QPaintEvent *event);
91 void scrollContentsBy(int dx, int dy);
93 QGraphicsScene *_scene;
94 ScaleItem *_mapScale;
95 QList<TrackItem*> _tracks;
96 QList<RouteItem*> _routes;
97 QList<WaypointItem*> _waypoints;
98 QHash<Waypoint, WaypointItem*> _pois;
100 QRectF _tr, _rr, _wr;
101 QPointF _wp;
102 qreal _res;
104 Map *_map;
105 POI *_poi;
106 Palette _palette;
107 Units _units;
109 bool _showMap;
110 bool _showTracks;
111 bool _showRoutes;
112 bool _showWaypoints;
113 bool _showWaypointLabels;
114 bool _showPOI;
115 bool _showPOILabels;
116 bool _overlapPOIs;
117 bool _showRouteWaypoints;
118 int _trackWidth;
119 int _routeWidth;
120 Qt::PenStyle _trackStyle;
121 Qt::PenStyle _routeStyle;
123 int _digitalZoom;
124 bool _plot;
127 #endif // TRACKVIEW_H