blob: 714bf09f929d2eddb6cfb01cb1e6aa721bdd2ab8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#ifndef RULERITEM_H
#define RULERITEM_H
#include <QObject>
#include <QGraphicsEllipseItem>
#include <QGraphicsObject>
#include "divecartesianaxis.h"
#include "display.h"
struct plot_data;
class RulerItem2;
class RulerNodeItem2 : public QObject, public QGraphicsEllipseItem
{
Q_OBJECT
friend class RulerItem2;
public:
explicit RulerNodeItem2(struct plot_info& info);
void setRuler(RulerItem2 *r);
void recalculate();
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant & value );
private:
struct plot_info &pInfo;
struct plot_data *entry;
RulerItem2* ruler;
DiveCartesianAxis *timeAxis;
DiveCartesianAxis *depthAxis;
};
class RulerItem2 : public QGraphicsObject
{
Q_OBJECT
public:
explicit RulerItem2();
void recalculate();
void setPlotInfo(struct plot_info pInfo);
RulerNodeItem2* sourceNode() const;
RulerNodeItem2* destNode() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget * widget = 0);
QRectF boundingRect() const;
QPainterPath shape() const;
void setAxis(DiveCartesianAxis *time, DiveCartesianAxis *depth);
private:
struct plot_info pInfo;
QPointF startPoint, endPoint;
RulerNodeItem2 *source, *dest;
QString text;
int height;
int paint_direction;
DiveCartesianAxis *timeAxis;
DiveCartesianAxis *depthAxis;
};
#endif
|