2014-08-17 12:56:05 +00:00
|
|
|
/* gXAxis Header
|
2014-04-09 21:01:57 +00:00
|
|
|
*
|
2024-01-13 20:27:48 +00:00
|
|
|
* Copyright (c) 2019-2024 The OSCAR Team
|
2024-02-01 00:14:19 +00:00
|
|
|
* Copyright (C) 2011-2018 Mark Watkins
|
2014-04-09 21:01:57 +00:00
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
2018-06-04 20:48:38 +00:00
|
|
|
* License. See the file COPYING in the main directory of the source code
|
|
|
|
* for more details. */
|
2011-06-26 08:30:44 +00:00
|
|
|
|
|
|
|
#ifndef GXAXIS_H
|
|
|
|
#define GXAXIS_H
|
2014-04-23 17:20:38 +00:00
|
|
|
|
2014-05-08 04:46:23 +00:00
|
|
|
#include <QImage>
|
2014-05-10 00:50:35 +00:00
|
|
|
#include <QPixmap>
|
2014-04-23 17:20:38 +00:00
|
|
|
#include "Graphs/layer.h"
|
2011-06-26 08:30:44 +00:00
|
|
|
|
2011-12-19 05:35:05 +00:00
|
|
|
/*! \class gXAxis
|
|
|
|
\brief Draws the XTicker timescales underneath graphs */
|
2023-11-28 20:07:59 +00:00
|
|
|
|
|
|
|
// For daily graphs
|
2014-04-17 05:55:38 +00:00
|
|
|
class gXAxis: public Layer
|
2011-06-26 08:30:44 +00:00
|
|
|
{
|
2014-05-13 17:47:33 +00:00
|
|
|
public:
|
2014-08-29 04:02:16 +00:00
|
|
|
static const int Margin = 30; // How much room does this take up. (Bottom margin)
|
2014-05-13 17:47:33 +00:00
|
|
|
|
2014-04-17 05:55:38 +00:00
|
|
|
public:
|
|
|
|
gXAxis(QColor col = Qt::black, bool fadeout = true);
|
|
|
|
virtual ~gXAxis();
|
2014-05-13 17:47:33 +00:00
|
|
|
|
|
|
|
virtual void paint(QPainter &painter, gGraph &w, const QRegion ®ion);
|
2014-04-17 05:55:38 +00:00
|
|
|
void SetShowMinorLines(bool b) { m_show_minor_lines = b; }
|
|
|
|
void SetShowMajorLines(bool b) { m_show_major_lines = b; }
|
|
|
|
bool ShowMinorLines() { return m_show_minor_lines; }
|
|
|
|
bool ShowMajorLines() { return m_show_major_lines; }
|
|
|
|
void SetShowMinorTicks(bool b) { m_show_minor_ticks = b; }
|
|
|
|
void SetShowMajorTicks(bool b) { m_show_major_ticks = b; }
|
|
|
|
bool ShowMinorTicks() { return m_show_minor_ticks; }
|
|
|
|
bool ShowMajorTicks() { return m_show_major_ticks; }
|
|
|
|
void setUtcFix(bool b) { m_utcfix = b; }
|
2011-09-13 02:51:50 +00:00
|
|
|
|
2014-07-28 13:56:29 +00:00
|
|
|
void setRoundDays(bool b) { m_roundDays = b; }
|
|
|
|
|
2014-08-29 05:32:49 +00:00
|
|
|
//! \brief Returns the minimum height needed to fit
|
|
|
|
virtual int minimumHeight();
|
|
|
|
|
2023-11-28 20:07:59 +00:00
|
|
|
// used to precalculate day information.
|
|
|
|
virtual void SetDay(Day *d);
|
|
|
|
|
2014-08-28 08:01:25 +00:00
|
|
|
virtual Layer * Clone() {
|
|
|
|
gXAxis * xaxis = new gXAxis();
|
|
|
|
Layer::CloneInto(xaxis);
|
|
|
|
CloneInto(xaxis);
|
|
|
|
return xaxis;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CloneInto(gXAxis * layer) {
|
|
|
|
layer->m_show_major_ticks = m_show_major_ticks;
|
|
|
|
layer->m_show_minor_ticks = m_show_minor_ticks;
|
|
|
|
layer->m_show_major_lines = m_show_major_lines;
|
|
|
|
layer->m_show_minor_lines = m_show_minor_lines;
|
|
|
|
layer->m_major_color = m_major_color;
|
|
|
|
layer->m_minor_color = m_minor_color;
|
|
|
|
layer->m_line_color = m_line_color;
|
|
|
|
layer->m_text_color = m_text_color;
|
|
|
|
|
|
|
|
layer->m_utcfix = m_utcfix;
|
|
|
|
layer->m_fadeout = m_fadeout;
|
|
|
|
|
2023-11-28 20:07:59 +00:00
|
|
|
layer->startOfDay = startOfDay;
|
2014-08-28 08:01:25 +00:00
|
|
|
layer->tz_offset = tz_offset;
|
|
|
|
layer->tz_hours = tz_hours;
|
|
|
|
|
|
|
|
layer->m_image = m_image;
|
|
|
|
layer->m_roundDays = m_roundDays;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-17 05:55:38 +00:00
|
|
|
protected:
|
|
|
|
bool m_show_major_lines;
|
|
|
|
bool m_show_minor_lines;
|
|
|
|
bool m_show_minor_ticks;
|
|
|
|
bool m_show_major_ticks;
|
2011-06-26 08:30:44 +00:00
|
|
|
|
2014-04-17 05:55:38 +00:00
|
|
|
bool m_utcfix;
|
2011-08-26 08:18:14 +00:00
|
|
|
|
2014-04-17 05:55:38 +00:00
|
|
|
QColor m_line_color;
|
|
|
|
QColor m_text_color;
|
|
|
|
QColor m_major_color;
|
|
|
|
QColor m_minor_color;
|
|
|
|
bool m_fadeout;
|
2023-11-28 20:07:59 +00:00
|
|
|
qint64 startOfDay;
|
2014-04-17 05:55:38 +00:00
|
|
|
qint64 tz_offset;
|
|
|
|
float tz_hours;
|
2013-01-18 07:33:35 +00:00
|
|
|
|
2014-04-17 05:55:38 +00:00
|
|
|
QImage m_image;
|
2014-07-28 13:56:29 +00:00
|
|
|
|
|
|
|
bool m_roundDays;
|
2011-06-26 08:30:44 +00:00
|
|
|
};
|
2014-05-13 17:47:33 +00:00
|
|
|
|
2023-11-28 20:07:59 +00:00
|
|
|
|
|
|
|
// for overview charts
|
2014-09-11 14:23:08 +00:00
|
|
|
class gXAxisDay: public Layer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static const int Margin = 30; // How much room does this take up. (Bottom margin)
|
|
|
|
|
|
|
|
public:
|
|
|
|
gXAxisDay(QColor col = Qt::black);
|
|
|
|
virtual ~gXAxisDay();
|
|
|
|
|
|
|
|
virtual void paint(QPainter &painter, gGraph &w, const QRegion ®ion);
|
|
|
|
void SetShowMinorLines(bool b) { m_show_minor_lines = b; }
|
|
|
|
void SetShowMajorLines(bool b) { m_show_major_lines = b; }
|
|
|
|
bool ShowMinorLines() { return m_show_minor_lines; }
|
|
|
|
bool ShowMajorLines() { return m_show_major_lines; }
|
|
|
|
void SetShowMinorTicks(bool b) { m_show_minor_ticks = b; }
|
|
|
|
void SetShowMajorTicks(bool b) { m_show_major_ticks = b; }
|
|
|
|
bool ShowMinorTicks() { return m_show_minor_ticks; }
|
|
|
|
bool ShowMajorTicks() { return m_show_major_ticks; }
|
|
|
|
|
|
|
|
//! \brief Returns the minimum height needed to fit
|
|
|
|
virtual int minimumHeight();
|
|
|
|
|
|
|
|
virtual Layer * Clone() {
|
|
|
|
gXAxisDay * xaxis = new gXAxisDay();
|
|
|
|
Layer::CloneInto(xaxis);
|
|
|
|
CloneInto(xaxis);
|
|
|
|
return xaxis;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CloneInto(gXAxisDay * layer) {
|
|
|
|
layer->m_show_major_ticks = m_show_major_ticks;
|
|
|
|
layer->m_show_minor_ticks = m_show_minor_ticks;
|
|
|
|
layer->m_show_major_lines = m_show_major_lines;
|
|
|
|
layer->m_show_minor_lines = m_show_minor_lines;
|
|
|
|
layer->m_major_color = m_major_color;
|
|
|
|
layer->m_minor_color = m_minor_color;
|
|
|
|
layer->m_line_color = m_line_color;
|
|
|
|
layer->m_text_color = m_text_color;
|
|
|
|
|
|
|
|
layer->m_image = m_image;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool m_show_major_lines;
|
|
|
|
bool m_show_minor_lines;
|
|
|
|
bool m_show_minor_ticks;
|
|
|
|
bool m_show_major_ticks;
|
|
|
|
|
|
|
|
QColor m_line_color;
|
|
|
|
QColor m_text_color;
|
|
|
|
QColor m_major_color;
|
|
|
|
QColor m_minor_color;
|
|
|
|
|
|
|
|
QImage m_image;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2023-11-28 20:07:59 +00:00
|
|
|
|
|
|
|
// FOr time at pressure.
|
2016-03-07 09:10:58 +00:00
|
|
|
class gXAxisPressure: public Layer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static const int Margin = 30; // How much room does this take up. (Bottom margin)
|
|
|
|
|
|
|
|
public:
|
|
|
|
gXAxisPressure(QColor col = Qt::black);
|
|
|
|
virtual ~gXAxisPressure();
|
|
|
|
|
|
|
|
virtual void paint(QPainter &painter, gGraph &w, const QRegion ®ion);
|
|
|
|
|
|
|
|
virtual int minimumHeight();
|
|
|
|
|
|
|
|
virtual Layer * Clone() {
|
|
|
|
gXAxisPressure * xaxis = new gXAxisPressure();
|
|
|
|
Layer::CloneInto(xaxis);
|
|
|
|
CloneInto(xaxis);
|
|
|
|
return xaxis;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CloneInto(gXAxisPressure * layer) {
|
|
|
|
layer->m_show_major_ticks = m_show_major_ticks;
|
|
|
|
layer->m_show_minor_ticks = m_show_minor_ticks;
|
|
|
|
layer->m_show_major_lines = m_show_major_lines;
|
|
|
|
layer->m_show_minor_lines = m_show_minor_lines;
|
|
|
|
layer->m_major_color = m_major_color;
|
|
|
|
layer->m_minor_color = m_minor_color;
|
|
|
|
layer->m_line_color = m_line_color;
|
|
|
|
layer->m_text_color = m_text_color;
|
|
|
|
|
|
|
|
//layer->m_image = m_image;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool m_show_major_lines;
|
|
|
|
bool m_show_minor_lines;
|
|
|
|
bool m_show_minor_ticks;
|
|
|
|
bool m_show_major_ticks;
|
|
|
|
|
|
|
|
QColor m_line_color;
|
|
|
|
QColor m_text_color;
|
|
|
|
QColor m_major_color;
|
|
|
|
QColor m_minor_color;
|
|
|
|
};
|
|
|
|
|
2011-06-26 08:30:44 +00:00
|
|
|
#endif // GXAXIS_H
|