mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-09 04:30:43 +00:00
Remove unused AHIChart class.
Signed-off-by: Mark Watkins <jedimark@users.sourceforge.net>
This commit is contained in:
parent
9a2d536057
commit
f02ff92296
@ -701,202 +701,3 @@ void gLineChart::paint(QPainter &painter, gGraph &w, int left, int top, int widt
|
||||
painter.setClipping(false);
|
||||
painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
}
|
||||
|
||||
|
||||
AHIChart::AHIChart(QColor col)
|
||||
: Layer(NoChannel), m_color(col)
|
||||
{
|
||||
m_miny = m_maxy = 0;
|
||||
}
|
||||
|
||||
AHIChart::~AHIChart()
|
||||
{
|
||||
}
|
||||
|
||||
void AHIChart::paint(QPainter &painter, gGraph &w, int left, int top, int width, int height)
|
||||
{
|
||||
if (!m_visible) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_day) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Draw bounding box
|
||||
painter.setPen(QColor(Qt::black));
|
||||
painter.drawLine(left, top, left, top + height);
|
||||
painter.drawLine(left, top + height, left + width, top + height);
|
||||
painter.drawLine(left + width, top + height, left + width, top);
|
||||
painter.drawLine(left + width, top, left, top);
|
||||
width--;
|
||||
height -= 2;
|
||||
|
||||
EventDataType miny, maxy;
|
||||
double minx, maxx;
|
||||
|
||||
maxx = w.max_x, minx = w.min_x;
|
||||
|
||||
// hmmm.. subtract_offset..
|
||||
|
||||
if (w.zoomY() == 0 && PROFILE.appearance->allowYAxisScaling()) {
|
||||
miny = w.physMinY();
|
||||
maxy = w.physMaxY();
|
||||
} else {
|
||||
miny = w.min_y, maxy = w.max_y;
|
||||
}
|
||||
|
||||
w.roundY(miny, maxy);
|
||||
|
||||
double xx = maxx - minx;
|
||||
double xmult = double(width) / xx;
|
||||
|
||||
EventDataType yy = maxy - miny;
|
||||
EventDataType ymult = EventDataType(height - 3) / yy; // time to pixel conversion multiplier
|
||||
|
||||
bool first = true;
|
||||
double px, py;
|
||||
double lastpx, lastpy;
|
||||
double top1 = top + height;
|
||||
bool done = false;
|
||||
|
||||
painter.setPen(QPen(m_color,p_profile->appearance->lineThickness()));
|
||||
painter.setClipRect(left, top, width, height);
|
||||
painter.setClipping(true);
|
||||
|
||||
for (int i = 0; i < m_time.size(); i++) {
|
||||
qint64 ti = m_time[i];
|
||||
EventDataType v = m_data[i];
|
||||
|
||||
if (ti < minx) { continue; }
|
||||
|
||||
if (ti > maxx) { done = true; }
|
||||
|
||||
if (first) {
|
||||
if (i > 0) {
|
||||
ti = m_time[i - 1];
|
||||
v = m_data[i - 1];
|
||||
i--;
|
||||
}
|
||||
|
||||
px = left + (double(ti - minx) * xmult);
|
||||
py = top1 - (double(v - miny) * ymult);
|
||||
first = false;
|
||||
} else {
|
||||
px = left + (double(ti - minx) * xmult);
|
||||
py = top1 - (double(v - miny) * ymult);
|
||||
painter.drawLine(px, py, lastpx, lastpy);
|
||||
}
|
||||
|
||||
lastpx = px;
|
||||
lastpy = py;
|
||||
|
||||
if (done) { break; }
|
||||
}
|
||||
painter.setClipping(false);
|
||||
}
|
||||
|
||||
void AHIChart::SetDay(Day *d)
|
||||
{
|
||||
m_day = d;
|
||||
m_data.clear();
|
||||
m_time.clear();
|
||||
m_maxy = 0;
|
||||
m_miny = 0;
|
||||
|
||||
if (!d) { return; }
|
||||
|
||||
m_miny = 9999;
|
||||
QList<Session *>::iterator s;
|
||||
qint64 first = d->first();
|
||||
qint64 last = d->last();
|
||||
qint64 f;
|
||||
|
||||
qint64 winsize = 30000; // 30 second windows
|
||||
|
||||
for (qint64 ti = first; ti < last; ti += winsize) {
|
||||
f = ti - 3600000L;
|
||||
//if (f<first) f=first;
|
||||
EventList *el[6];
|
||||
EventDataType ahi = 0;
|
||||
int cnt = 0;
|
||||
|
||||
qint64 clockdrift = (qint64(PROFILE.cpap->clockDrift()) * 1000L), drift = 0;
|
||||
|
||||
bool fnd = false;
|
||||
|
||||
for (s = d->begin(); s != d->end(); s++) {
|
||||
if (!(*s)->enabled()) { continue; }
|
||||
|
||||
Session *sess = *s;
|
||||
|
||||
if ((ti < sess->first()) || (f > sess->last())) { continue; }
|
||||
|
||||
drift = (sess->machine()->GetType() == MT_CPAP) ? clockdrift : 0;
|
||||
|
||||
// Drop off suddenly outside of sessions
|
||||
//if (ti>sess->last()) continue;
|
||||
|
||||
fnd = true;
|
||||
|
||||
if (sess->eventlist.contains(CPAP_Obstructive)) {
|
||||
el[0] = sess->eventlist[CPAP_Obstructive][0];
|
||||
} else { el[0] = nullptr; }
|
||||
|
||||
if (sess->eventlist.contains(CPAP_Apnea)) {
|
||||
el[1] = sess->eventlist[CPAP_Apnea][0];
|
||||
} else { el[1] = nullptr; }
|
||||
|
||||
if (sess->eventlist.contains(CPAP_Hypopnea)) {
|
||||
el[2] = sess->eventlist[CPAP_Hypopnea][0];
|
||||
} else { el[2] = nullptr; }
|
||||
|
||||
if (sess->eventlist.contains(CPAP_ClearAirway)) {
|
||||
el[3] = sess->eventlist[CPAP_ClearAirway][0];
|
||||
} else { el[3] = nullptr; }
|
||||
|
||||
if (sess->eventlist.contains(CPAP_NRI)) {
|
||||
el[4] = sess->eventlist[CPAP_NRI][0];
|
||||
} else { el[4] = nullptr; }
|
||||
|
||||
int znt = 5;
|
||||
|
||||
if (PROFILE.general->calculateRDI()) {
|
||||
if (sess->eventlist.contains(CPAP_RERA)) {// What about ExP??
|
||||
el[5] = sess->eventlist[CPAP_RERA][0];
|
||||
znt++;
|
||||
} else { el[5] = nullptr; }
|
||||
}
|
||||
|
||||
qint64 t;
|
||||
|
||||
for (int i = 0; i < znt; i++) {
|
||||
if (!el[i]) { continue; }
|
||||
|
||||
for (quint32 j = 0; j < el[i]->count(); j++) {
|
||||
t = el[i]->time(j) + drift;
|
||||
|
||||
if ((t >= f) && (t < ti)) {
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!fnd) { cnt = 0; }
|
||||
|
||||
double g = double(ti - f) / 3600000.0;
|
||||
|
||||
if (g > 0) { ahi = cnt / g; }
|
||||
|
||||
if (ahi < m_miny) { m_miny = ahi; }
|
||||
|
||||
if (ahi > m_maxy) { m_maxy = ahi; }
|
||||
|
||||
m_time.append(ti);
|
||||
m_data.append(ahi);
|
||||
}
|
||||
|
||||
m_minx = first;
|
||||
m_maxx = last;
|
||||
}
|
||||
|
@ -18,44 +18,6 @@
|
||||
#include "SleepLib/event.h"
|
||||
#include "SleepLib/day.h"
|
||||
|
||||
/*! \class AHIChart
|
||||
\brief Another graph calculating the AHI/hour, this one looks at all the sessions for a day. Currently Unused.
|
||||
*/
|
||||
class AHIChart: public Layer
|
||||
{
|
||||
public:
|
||||
//! \brief Constructs an AHIChart object, with QColor col for the line plots.
|
||||
AHIChart(QColor col = QColor("black"));
|
||||
~AHIChart();
|
||||
|
||||
//! \brief Draws the precalculated data to the Vertex buffers
|
||||
virtual void paint(QPainter &painter, gGraph &w, int left, int top, int width, int height);
|
||||
|
||||
//! \brief AHI/hr Calculations are done for this day here.
|
||||
//! This also uses the sliding window method
|
||||
virtual void SetDay(Day *d);
|
||||
|
||||
//! \brief Returns the minimum AHI/hr value caculated
|
||||
virtual EventDataType Miny() { return m_miny; }
|
||||
|
||||
//! \brief Returns the maximum AHI/hr value caculated
|
||||
virtual EventDataType Maxy() { return m_maxy; }
|
||||
|
||||
//! \brief Returns true if no data was available
|
||||
virtual bool isEmpty() { return m_data.size() == 0; }
|
||||
|
||||
protected:
|
||||
//! \brief Contains the plot data (Y-axis) generated for this day
|
||||
QVector<EventDataType> m_data;
|
||||
|
||||
//! \brief Contains the time codes (X-axis) generated for this day
|
||||
QVector<quint64> m_time;
|
||||
|
||||
EventDataType m_miny;
|
||||
EventDataType m_maxy;
|
||||
QColor m_color;
|
||||
};
|
||||
|
||||
/*! \class gLineChart
|
||||
\brief Draws a 2D linechart from all Session data in a day. EVL_Waveforms typed EventLists are accelerated.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user