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-02-28 04:09:57 +00:00
|
|
|
explicit RulerNodeItem2(struct plot_info &info);
|
2014-02-27 16:28:58 +00:00
|
|
|
void setRuler(RulerItem2 *r);
|
|
|
|
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-02-27 19:28:19 +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-02-28 04:09:57 +00:00
|
|
|
class RulerItem2 : public QGraphicsObject {
|
2014-02-27 16:28:58 +00:00
|
|
|
Q_OBJECT
|
|
|
|
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;
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
2014-02-27 16:28:58 +00:00
|
|
|
QRectF boundingRect() const;
|
|
|
|
QPainterPath shape() 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-02-28 01:52:03 +00:00
|
|
|
QGraphicsSimpleTextItem *textItem;
|
2014-02-27 16:28:58 +00:00
|
|
|
};
|
|
|
|
#endif
|