2016-08-09 01:16:19 +02:00
|
|
|
#ifndef ROUTEITEM_H
|
|
|
|
#define ROUTEITEM_H
|
|
|
|
|
|
|
|
#include <QGraphicsItem>
|
|
|
|
#include "markeritem.h"
|
|
|
|
#include "route.h"
|
2016-08-30 21:26:28 +02:00
|
|
|
#include "units.h"
|
|
|
|
|
2016-08-09 01:16:19 +02:00
|
|
|
|
|
|
|
class RouteItem : public QGraphicsItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RouteItem(const Route &route, QGraphicsItem *parent = 0);
|
|
|
|
|
2016-08-30 21:26:28 +02:00
|
|
|
QPainterPath shape() const {return _shape;}
|
|
|
|
QRectF boundingRect() const {return _shape.boundingRect();}
|
2016-08-09 01:16:19 +02:00
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|
|
|
QWidget *widget);
|
|
|
|
|
|
|
|
const QPainterPath &path() const {return _path;}
|
|
|
|
|
|
|
|
void setScale(qreal scale);
|
|
|
|
void setColor(const QColor &color);
|
2016-08-30 21:26:28 +02:00
|
|
|
void setUnits(enum Units units);
|
2016-08-09 01:16:19 +02:00
|
|
|
|
|
|
|
void showMarker(bool show) {_marker->setVisible(show);}
|
2016-08-10 20:35:39 +02:00
|
|
|
void moveMarker(qreal distance);
|
2016-08-09 01:16:19 +02:00
|
|
|
|
2016-08-09 10:47:49 +02:00
|
|
|
void showWaypoints(bool show);
|
2016-08-09 23:08:49 +02:00
|
|
|
void showWaypointLabels(bool show);
|
2016-08-09 10:47:49 +02:00
|
|
|
|
2016-08-09 01:16:19 +02:00
|
|
|
private:
|
2016-08-30 21:26:28 +02:00
|
|
|
void updateShape();
|
|
|
|
QString toolTip();
|
|
|
|
|
2016-08-09 01:16:19 +02:00
|
|
|
QPainterPath _path;
|
2016-08-30 21:26:28 +02:00
|
|
|
QPainterPath _shape;
|
2016-08-09 01:16:19 +02:00
|
|
|
QPen _pen;
|
|
|
|
|
|
|
|
MarkerItem *_marker;
|
2016-08-10 20:35:39 +02:00
|
|
|
|
2016-08-30 21:26:28 +02:00
|
|
|
Units _units;
|
2016-08-10 20:35:39 +02:00
|
|
|
qreal _distance;
|
2016-08-09 01:16:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ROUTEITEM_H
|