2014-02-27 13:28:58 -03:00
|
|
|
#ifndef RULERITEM_H
|
|
|
|
#define RULERITEM_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QGraphicsEllipseItem>
|
|
|
|
#include <QGraphicsObject>
|
2016-04-04 22:02:03 -07:00
|
|
|
#include "profile-widget/divecartesianaxis.h"
|
|
|
|
#include "core/display.h"
|
2014-02-27 13:28:58 -03:00
|
|
|
|
|
|
|
struct plot_data;
|
|
|
|
class RulerItem2;
|
|
|
|
|
2014-02-27 20:09:57 -08:00
|
|
|
class RulerNodeItem2 : public QObject, public QGraphicsEllipseItem {
|
2014-02-27 13:28:58 -03:00
|
|
|
Q_OBJECT
|
|
|
|
friend class RulerItem2;
|
2014-02-27 20:09:57 -08:00
|
|
|
|
2014-02-27 13:28:58 -03:00
|
|
|
public:
|
2014-03-07 12:08:31 -03:00
|
|
|
explicit RulerNodeItem2();
|
2014-02-27 13:28:58 -03:00
|
|
|
void setRuler(RulerItem2 *r);
|
2014-05-22 11:40:22 -07:00
|
|
|
void setPlotInfo(struct plot_info &info);
|
2014-02-27 13:28:58 -03:00
|
|
|
void recalculate();
|
|
|
|
|
|
|
|
protected:
|
2014-06-01 19:27:44 -03:00
|
|
|
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
2014-02-27 13:28:58 -03:00
|
|
|
private:
|
2014-03-07 12:08:31 -03:00
|
|
|
struct plot_info pInfo;
|
2014-02-27 13:28:58 -03:00
|
|
|
struct plot_data *entry;
|
2014-02-27 20:09:57 -08:00
|
|
|
RulerItem2 *ruler;
|
2014-02-27 14:59:41 -03:00
|
|
|
DiveCartesianAxis *timeAxis;
|
|
|
|
DiveCartesianAxis *depthAxis;
|
2014-02-27 13:28:58 -03:00
|
|
|
};
|
|
|
|
|
2014-05-22 11:40:22 -07:00
|
|
|
class RulerItem2 : public QObject, public QGraphicsLineItem {
|
2014-05-21 14:24:19 -03:00
|
|
|
Q_OBJECT
|
2014-02-27 13:28:58 -03:00
|
|
|
public:
|
2014-02-27 14:59:41 -03:00
|
|
|
explicit RulerItem2();
|
2014-02-27 13:28:58 -03:00
|
|
|
void recalculate();
|
|
|
|
|
2014-02-27 16:28:19 -03:00
|
|
|
void setPlotInfo(struct plot_info pInfo);
|
2014-02-27 20:09:57 -08:00
|
|
|
RulerNodeItem2 *sourceNode() const;
|
|
|
|
RulerNodeItem2 *destNode() const;
|
2014-02-27 16:28:19 -03:00
|
|
|
void setAxis(DiveCartesianAxis *time, DiveCartesianAxis *depth);
|
2014-05-21 12:18:05 -03:00
|
|
|
void setVisible(bool visible);
|
2014-05-21 14:24:19 -03:00
|
|
|
|
2014-05-22 11:40:22 -07:00
|
|
|
public
|
|
|
|
slots:
|
2016-01-25 18:15:06 -02:00
|
|
|
void settingsChanged(bool toggled);
|
2014-05-21 14:24:19 -03:00
|
|
|
|
2014-02-27 13:28:58 -03:00
|
|
|
private:
|
2014-02-27 16:28:19 -03:00
|
|
|
struct plot_info pInfo;
|
2014-02-27 13:28:58 -03:00
|
|
|
QPointF startPoint, endPoint;
|
|
|
|
RulerNodeItem2 *source, *dest;
|
|
|
|
QString text;
|
2014-02-27 14:59:41 -03:00
|
|
|
DiveCartesianAxis *timeAxis;
|
|
|
|
DiveCartesianAxis *depthAxis;
|
2014-03-12 00:09:53 +02:00
|
|
|
QGraphicsRectItem *textItemBack;
|
2014-02-27 22:52:03 -03:00
|
|
|
QGraphicsSimpleTextItem *textItem;
|
2014-02-27 13:28:58 -03:00
|
|
|
};
|
2014-03-12 00:09:53 +02:00
|
|
|
#endif
|