2014-02-27 16:28:58 +00:00
|
|
|
#ifndef RULERITEM_H
|
|
|
|
#define RULERITEM_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QGraphicsEllipseItem>
|
|
|
|
#include <QGraphicsObject>
|
2014-02-27 17:59:41 +00:00
|
|
|
#include "divecartesianaxis.h"
|
2014-02-27 19:28:19 +00:00
|
|
|
#include "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);
|
2014-03-07 15:08:31 +00:00
|
|
|
void setPlotInfo(struct plot_info& info);
|
2014-02-27 16:28:58 +00:00
|
|
|
void recalculate();
|
|
|
|
|
|
|
|
protected:
|
2014-02-28 04:09:57 +00:00
|
|
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
2014-02-27 16:28:58 +00:00
|
|
|
|
|
|
|
private:
|
2014-03-07 15:08:31 +00:00
|
|
|
struct plot_info pInfo;
|
2014-02-27 16:28:58 +00:00
|
|
|
struct plot_data *entry;
|
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-03-09 13:59:31 +00:00
|
|
|
class RulerItem2 : public QGraphicsLineItem {
|
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();
|
|
|
|
|
2014-02-27 19:28:19 +00:00
|
|
|
void setPlotInfo(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-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;
|
|
|
|
int height;
|
|
|
|
int paint_direction;
|
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
|