2015-10-05 01:43:48 +02:00
|
|
|
#ifndef TRACK_H
|
|
|
|
#define TRACK_H
|
|
|
|
|
|
|
|
#include <QGraphicsView>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QHash>
|
|
|
|
#include <QList>
|
|
|
|
#include <QPrinter>
|
|
|
|
#include "poi.h"
|
2015-10-17 12:08:30 +02:00
|
|
|
#include "gpx.h"
|
2015-11-23 02:37:08 +01:00
|
|
|
#include "map.h"
|
2015-10-05 01:43:48 +02:00
|
|
|
#include "colorshop.h"
|
|
|
|
|
|
|
|
|
|
|
|
class POIItem;
|
|
|
|
class MarkerItem;
|
|
|
|
|
|
|
|
class Track : public QGraphicsView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Track(QWidget *parent = 0);
|
|
|
|
~Track();
|
|
|
|
|
2015-10-17 12:08:30 +02:00
|
|
|
void loadGPX(const GPX &gpx);
|
2015-10-05 01:43:48 +02:00
|
|
|
|
2015-11-23 02:37:08 +01:00
|
|
|
void loadPOI(const POI &poi);
|
2015-10-05 01:43:48 +02:00
|
|
|
void clearPOI();
|
|
|
|
void clear();
|
|
|
|
|
2015-11-23 02:37:08 +01:00
|
|
|
void setMap(Map *map);
|
|
|
|
|
2015-10-05 01:43:48 +02:00
|
|
|
void plot(QPainter *painter, const QRectF &target);
|
|
|
|
enum QPrinter::Orientation orientation() const;
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void movePositionMarker(qreal val);
|
|
|
|
|
2015-11-23 02:37:08 +01:00
|
|
|
private slots:
|
|
|
|
void redraw();
|
|
|
|
|
2015-10-05 01:43:48 +02:00
|
|
|
private:
|
2015-12-06 00:51:02 +01:00
|
|
|
QRectF trackBoundingRect() const;
|
2015-11-23 02:37:08 +01:00
|
|
|
qreal trackScale() const;
|
|
|
|
qreal mapScale() const;
|
|
|
|
void rescale(qreal scale);
|
|
|
|
|
|
|
|
void showMarkers(bool show);
|
|
|
|
void setTrackLineWidth(qreal width);
|
|
|
|
|
2015-10-05 01:43:48 +02:00
|
|
|
void wheelEvent(QWheelEvent *event);
|
2015-11-23 02:37:08 +01:00
|
|
|
void drawBackground(QPainter *painter, const QRectF &rect);
|
2015-10-05 01:43:48 +02:00
|
|
|
|
|
|
|
QGraphicsScene *_scene;
|
|
|
|
QList<QVector<QPointF> > _tracks;
|
|
|
|
QList<QGraphicsPathItem*> _trackPaths;
|
|
|
|
QList<MarkerItem*> _markers;
|
|
|
|
QHash<Entry, POIItem*> _pois;
|
2015-11-23 02:37:08 +01:00
|
|
|
Map *_map;
|
2015-10-05 01:43:48 +02:00
|
|
|
|
|
|
|
ColorShop _colorShop;
|
|
|
|
qreal _maxLen;
|
2015-11-23 02:37:08 +01:00
|
|
|
|
|
|
|
qreal _scale;
|
|
|
|
int _zoom;
|
2015-10-05 01:43:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TRACK_H
|