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

131 lines
2.8 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"
#include "rectc.h"
#include "searchpointer.h"
2016-10-23 11:09:20 +02:00
class Data;
2016-02-12 10:23:14 +01:00
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;
2016-09-19 00:56:10 +02:00
class PathItem;
2016-09-26 21:01:58 +02:00
class PathView : public QGraphicsView
{
Q_OBJECT
public:
PathView(Map *map, POI *poi, QWidget *parent = 0);
2016-09-26 21:01:58 +02:00
~PathView();
2016-10-23 11:09:20 +02:00
QList<PathItem*> loadData(const Data &data);
2016-12-06 01:48:26 +01:00
void setPalette(const Palette &palette);
2016-10-08 14:53:10 +02:00
void setPOI(POI *poi);
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
2016-10-08 14:53:10 +02:00
void clear();
2016-12-06 01:48:26 +01:00
void useOpenGL(bool use);
public slots:
void redraw();
void showMap(bool show);
2016-10-08 14:53:10 +02:00
void showPOI(bool show);
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-12-06 01:48:26 +01:00
void setTrackWidth(int width);
void setRouteWidth(int width);
void setTrackStyle(Qt::PenStyle style);
void setRouteStyle(Qt::PenStyle style);
void setMapOpacity(int opacity);
2016-08-09 01:16:19 +02:00
2016-10-09 23:46:30 +02:00
private slots:
void updatePOI();
private:
2016-09-19 00:56:10 +02:00
PathItem *addTrack(const Track &track);
PathItem *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-10-08 14:53:10 +02:00
void loadPOI();
void clearPOI();
2016-03-15 01:20:24 +01:00
qreal mapZoom() const;
QPointF contentCenter() const;
void rescale();
2017-04-05 22:53:25 +02:00
void zoom(int zoom, const QPoint &pos, const Coordinates &c);
void digitalZoom(int zoom);
void resetDigitalZoom();
2016-10-08 14:53:10 +02:00
void updatePOIVisibility();
void updateWaypointsBoundingRect(const Coordinates &wp);
void mouseDoubleClickEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
void keyPressEvent(QKeyEvent *event);
void drawBackground(QPainter *painter, const QRectF &rect);
void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event);
2017-01-16 09:54:12 +01:00
void scrollContentsBy(int dx, int dy);
QGraphicsScene *_scene;
2016-10-08 14:53:10 +02:00
ScaleItem *_mapScale;
2016-08-09 01:16:19 +02:00
QList<TrackItem*> _tracks;
QList<RouteItem*> _routes;
QList<WaypointItem*> _waypoints;
QHash<SearchPointer<Waypoint>, WaypointItem*> _pois;
RectC _tr, _rr, _wr;
2017-01-16 09:54:12 +01:00
qreal _res;
2016-11-11 17:58:18 +01:00
Map *_map;
2016-10-08 14:53:10 +02:00
POI *_poi;
2016-03-02 09:34:39 +01:00
Palette _palette;
2016-07-25 19:32:36 +02:00
Units _units;
qreal _opacity;
2016-08-09 01:16:19 +02:00
bool _showMap;
2016-08-09 01:16:19 +02:00
bool _showTracks;
bool _showRoutes;
bool _showWaypoints;
bool _showWaypointLabels;
2016-10-08 14:53:10 +02:00
bool _showPOI;
2016-08-09 01:16:19 +02:00
bool _showPOILabels;
bool _overlapPOIs;
2016-08-09 10:47:49 +02:00
bool _showRouteWaypoints;
2016-12-06 01:48:26 +01:00
int _trackWidth;
int _routeWidth;
Qt::PenStyle _trackStyle;
Qt::PenStyle _routeStyle;
2016-08-09 01:16:19 +02:00
2017-04-05 22:53:25 +02:00
int _digitalZoom;
bool _plot;
};
#endif // TRACKVIEW_H