1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 13:41:16 +01:00
GPXSee/src/GUI/coordinatesitem.h

44 lines
1012 B
C
Raw Normal View History

#ifndef COORDINATESITEM_H
#define COORDINATESITEM_H
#include <QGraphicsItem>
#include <QFont>
#include "common/coordinates.h"
#include "format.h"
class CoordinatesItem : public QGraphicsItem
{
public:
CoordinatesItem(QGraphicsItem *parent = 0);
QRectF boundingRect() const {return _boundingRect;}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
CoordinatesFormat format() const {return _format;}
2021-12-04 15:05:30 +01:00
void setCoordinates(const Coordinates &c, qreal elevation = NAN);
void setFormat(CoordinatesFormat format);
void setUnits(Units units);
void setDigitalZoom(qreal zoom);
2021-12-04 15:05:30 +01:00
void setColor(const QColor &color);
void setBackgroundColor(const QColor &color);
void drawBackground(bool draw);
private:
void updateBoundingRect();
2021-12-04 15:05:30 +01:00
QString text() const;
Coordinates _c;
2021-12-04 15:05:30 +01:00
qreal _ele;
CoordinatesFormat _format;
2021-12-04 15:05:30 +01:00
Units _units;
QRectF _boundingRect;
QFont _font;
qreal _digitalZoom;
2021-12-04 15:05:30 +01:00
QColor _color, _bgColor;
bool _drawBackground;
};
#endif // COORDINATESITEM_H