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