2014-01-14 18:20:15 +00:00
|
|
|
#ifndef DIVECARTESIANAXIS_H
|
|
|
|
#define DIVECARTESIANAXIS_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QGraphicsLineItem>
|
2014-04-28 19:45:42 +00:00
|
|
|
#include <graphicsview-common.h>
|
2014-01-22 19:10:18 +00:00
|
|
|
|
|
|
|
class QPropertyAnimation;
|
2014-01-14 18:20:15 +00:00
|
|
|
class DiveTextItem;
|
|
|
|
class DiveLineItem;
|
2014-01-27 17:14:42 +00:00
|
|
|
class DivePlotDataModel;
|
2014-01-14 18:20:15 +00:00
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
class DiveCartesianAxis : public QObject, public QGraphicsLineItem {
|
2014-01-14 18:20:15 +00:00
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QLineF line WRITE setLine READ line)
|
|
|
|
Q_PROPERTY(QPointF pos WRITE setPos READ pos)
|
|
|
|
Q_PROPERTY(qreal x WRITE setX READ x)
|
|
|
|
Q_PROPERTY(qreal y WRITE setY READ y)
|
|
|
|
public:
|
2014-02-28 04:09:57 +00:00
|
|
|
enum Orientation {
|
|
|
|
TopToBottom,
|
|
|
|
BottomToTop,
|
|
|
|
LeftToRight,
|
|
|
|
RightToLeft
|
|
|
|
};
|
2014-01-14 18:20:15 +00:00
|
|
|
DiveCartesianAxis();
|
|
|
|
virtual ~DiveCartesianAxis();
|
|
|
|
void setMinimum(double minimum);
|
|
|
|
void setMaximum(double maximum);
|
|
|
|
void setTickInterval(double interval);
|
2014-01-16 21:28:33 +00:00
|
|
|
void setOrientation(Orientation orientation);
|
2014-01-14 18:20:15 +00:00
|
|
|
void setTickSize(qreal size);
|
2014-02-15 19:15:57 +00:00
|
|
|
void setFontLabelScale(qreal scale);
|
2014-01-14 18:20:15 +00:00
|
|
|
double minimum() const;
|
|
|
|
double maximum() const;
|
2014-02-07 19:59:21 +00:00
|
|
|
double tickInterval() const;
|
|
|
|
double tickSize() const;
|
2014-02-15 19:15:57 +00:00
|
|
|
double fontLabelScale() const;
|
2014-02-28 04:09:57 +00:00
|
|
|
qreal valueAt(const QPointF &p) const;
|
|
|
|
qreal percentAt(const QPointF &p);
|
2014-01-14 18:20:15 +00:00
|
|
|
qreal posAtValue(qreal value);
|
2014-02-28 04:09:57 +00:00
|
|
|
void setColor(const QColor &color);
|
|
|
|
void setTextColor(const QColor &color);
|
|
|
|
void animateChangeLine(const QLineF &newLine);
|
2014-02-12 16:24:19 +00:00
|
|
|
void setTextVisible(bool arg1);
|
2014-02-16 00:54:41 +00:00
|
|
|
void setLinesVisible(bool arg1);
|
2014-02-15 23:55:31 +00:00
|
|
|
void setLineSize(qreal lineSize);
|
2014-01-14 18:20:15 +00:00
|
|
|
int unitSystem;
|
2014-02-28 04:09:57 +00:00
|
|
|
public
|
|
|
|
slots:
|
2014-04-28 19:45:42 +00:00
|
|
|
virtual void updateTicks(color_indice_t color = TIME_GRID);
|
2014-02-12 16:24:19 +00:00
|
|
|
|
2014-01-16 14:32:45 +00:00
|
|
|
signals:
|
|
|
|
void sizeChanged();
|
2014-01-27 17:14:42 +00:00
|
|
|
void maxChanged();
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2014-01-14 18:20:15 +00:00
|
|
|
protected:
|
|
|
|
virtual QString textForValue(double value);
|
2014-01-19 22:14:48 +00:00
|
|
|
virtual QColor colorForValue(double value);
|
2014-01-16 21:28:33 +00:00
|
|
|
Orientation orientation;
|
2014-02-28 04:09:57 +00:00
|
|
|
QList<DiveTextItem *> labels;
|
|
|
|
QList<DiveLineItem *> lines;
|
2014-01-14 18:20:15 +00:00
|
|
|
double min;
|
|
|
|
double max;
|
|
|
|
double interval;
|
2014-02-07 19:59:21 +00:00
|
|
|
double tick_size;
|
2014-01-14 18:20:15 +00:00
|
|
|
QColor textColor;
|
2014-02-12 16:24:19 +00:00
|
|
|
bool textVisibility;
|
2014-02-16 00:54:41 +00:00
|
|
|
bool lineVisibility;
|
2014-02-15 19:15:57 +00:00
|
|
|
double labelScale;
|
2014-02-15 23:55:31 +00:00
|
|
|
qreal line_size;
|
2014-01-14 18:20:15 +00:00
|
|
|
};
|
|
|
|
|
2014-01-15 12:54:33 +00:00
|
|
|
class DepthAxis : public DiveCartesianAxis {
|
2014-01-22 19:10:18 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
DepthAxis();
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2014-01-15 12:54:33 +00:00
|
|
|
protected:
|
2014-01-16 20:39:13 +00:00
|
|
|
QString textForValue(double value);
|
2014-01-19 22:14:48 +00:00
|
|
|
QColor colorForValue(double value);
|
2014-02-28 04:09:57 +00:00
|
|
|
private
|
|
|
|
slots:
|
2014-01-22 19:10:18 +00:00
|
|
|
void settingsChanged();
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2014-02-04 21:21:57 +00:00
|
|
|
private:
|
|
|
|
bool showWithPPGraph;
|
2014-01-15 12:54:33 +00:00
|
|
|
};
|
|
|
|
|
2014-01-15 13:08:31 +00:00
|
|
|
class TimeAxis : public DiveCartesianAxis {
|
2014-01-27 19:18:35 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
virtual void updateTicks();
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2014-01-15 13:08:31 +00:00
|
|
|
protected:
|
2014-01-16 20:39:13 +00:00
|
|
|
QString textForValue(double value);
|
2014-01-19 22:14:48 +00:00
|
|
|
QColor colorForValue(double value);
|
2014-01-16 20:39:13 +00:00
|
|
|
};
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
class TemperatureAxis : public DiveCartesianAxis {
|
2014-01-16 20:39:13 +00:00
|
|
|
Q_OBJECT
|
|
|
|
protected:
|
|
|
|
QString textForValue(double value);
|
2014-01-15 13:08:31 +00:00
|
|
|
};
|
2014-01-16 14:32:45 +00:00
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
class PartialGasPressureAxis : public DiveCartesianAxis {
|
2014-01-27 17:14:42 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PartialGasPressureAxis();
|
|
|
|
void setModel(DivePlotDataModel *model);
|
2014-02-28 04:09:57 +00:00
|
|
|
public
|
|
|
|
slots:
|
2014-05-21 16:50:26 +00:00
|
|
|
void settingsChanged();
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2014-01-27 17:14:42 +00:00
|
|
|
private:
|
|
|
|
DivePlotDataModel *model;
|
|
|
|
};
|
|
|
|
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // DIVECARTESIANAXIS_H
|