2019-02-17 20:20:20 +01:00
|
|
|
#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);
|
|
|
|
|
2020-11-13 20:15:17 +01:00
|
|
|
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);
|
2019-04-02 22:40:46 +02:00
|
|
|
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);
|
2019-02-17 20:20:20 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void updateBoundingRect();
|
2021-12-04 15:05:30 +01:00
|
|
|
QString text() const;
|
2019-02-17 20:20:20 +01:00
|
|
|
|
|
|
|
Coordinates _c;
|
2021-12-04 15:05:30 +01:00
|
|
|
qreal _ele;
|
2019-02-17 20:20:20 +01:00
|
|
|
CoordinatesFormat _format;
|
2021-12-04 15:05:30 +01:00
|
|
|
Units _units;
|
2019-02-17 20:20:20 +01:00
|
|
|
QRectF _boundingRect;
|
|
|
|
QFont _font;
|
2019-04-02 22:40:46 +02:00
|
|
|
qreal _digitalZoom;
|
2021-12-04 15:05:30 +01:00
|
|
|
QColor _color, _bgColor;
|
|
|
|
bool _drawBackground;
|
2019-02-17 20:20:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // COORDINATESITEM_H
|