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

110 lines
2.2 KiB
C
Raw Normal View History

#ifndef TRACKVIEW_H
#define TRACKVIEW_H
#include <QGraphicsView>
#include <QVector>
#include <QHash>
#include <QList>
#include "units.h"
2016-02-28 09:32:54 +01:00
#include "palette.h"
2016-02-12 10:23:14 +01:00
#include "waypoint.h"
2016-02-12 10:23:14 +01:00
class GPX;
class POI;
2016-02-12 10:09:17 +01:00
class Map;
class Track;
2016-08-09 01:16:19 +02:00
class Route;
class TrackItem;
2016-08-09 01:16:19 +02:00
class RouteItem;
2016-02-19 21:42:54 +01:00
class WaypointItem;
class ScaleItem;
class TrackView : public QGraphicsView
{
Q_OBJECT
public:
TrackView(QWidget *parent = 0);
~TrackView();
void loadGPX(const GPX &gpx);
void loadPOI(const POI &poi);
void clearPOI();
void clear();
void setMap(Map *map);
void setUnits(enum Units units);
void plot(QPainter *painter, const QRectF &target);
2016-08-09 01:16:19 +02:00
int trackCount() const {return _tracks.count();}
int routeCount() const {return _routes.count();}
int waypointCount() const {return _waypoints.count();}
2016-03-25 09:50:19 +01:00
public slots:
void movePositionMarker(qreal val);
void redraw();
2016-08-09 01:16:19 +02:00
void setPOIOverlap(bool overlap);
void showWaypointLabels(bool show);
void showPOILabels(bool show);
void showTracks(bool show);
void showRoutes(bool show);
void showWaypoints(bool show);
2016-08-09 10:47:49 +02:00
void showRouteWaypoints(bool show);
2016-08-09 01:16:19 +02:00
private:
void addTrack(const Track &track);
2016-08-09 01:16:19 +02:00
void addRoute(const Route &route);
2016-03-15 01:20:24 +01:00
void addWaypoints(const QList<Waypoint> &waypoints);
void addPOI(const QVector<Waypoint> &waypoints);
2016-03-15 01:20:24 +01:00
QRectF trackBoundingRect() const;
2016-08-09 01:16:19 +02:00
QRectF routeBoundingRect() const;
2016-03-15 01:20:24 +01:00
QRectF waypointBoundingRect() const;
qreal trackScale() const;
2016-08-09 01:16:19 +02:00
qreal routeScale() const;
2016-03-15 01:20:24 +01:00
qreal waypointScale() const;
qreal mapScale(int zoom) const;
void rescale(qreal scale);
2016-04-05 09:10:19 +02:00
void rescale();
void zoom(int z, const QPointF &pos);
void checkPOIOverlap();
void wheelEvent(QWheelEvent *event);
void keyPressEvent(QKeyEvent *event);
void drawBackground(QPainter *painter, const QRectF &rect);
void resizeEvent(QResizeEvent *e);
void paintEvent(QPaintEvent *e);
QGraphicsScene *_scene;
2016-08-09 01:16:19 +02:00
QList<TrackItem*> _tracks;
QList<RouteItem*> _routes;
QList<WaypointItem*> _waypoints;
2016-02-19 21:42:54 +01:00
QHash<Waypoint, WaypointItem*> _pois;
Map *_map;
ScaleItem *_mapScale;
2016-03-02 09:34:39 +01:00
Palette _palette;
qreal _maxPath, _maxDistance;
qreal _scale;
int _zoom;
2016-07-25 19:32:36 +02:00
Units _units;
2016-08-09 01:16:19 +02:00
bool _showTracks;
bool _showRoutes;
bool _showWaypoints;
bool _showWaypointLabels;
bool _showPOILabels;
bool _overlapPOIs;
2016-08-09 10:47:49 +02:00
bool _showRouteWaypoints;
2016-08-09 01:16:19 +02:00
bool _plot;
};
#endif // TRACKVIEW_H