mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Simplify gPressureChart upper label formatting.
This commit is contained in:
parent
d13109bbed
commit
c5768a64fe
@ -12,50 +12,53 @@
|
||||
gPressureChart::gPressureChart()
|
||||
: gSummaryChart("Pressure", MT_CPAP)
|
||||
{
|
||||
addCalc(CPAP_Pressure, ST_SETMAX); // 00
|
||||
addCalc(CPAP_Pressure, ST_MID); // 01
|
||||
addCalc(CPAP_Pressure, ST_90P); // 02
|
||||
addCalc(CPAP_PressureMin, ST_SETMIN); // 03
|
||||
addCalc(CPAP_PressureMax, ST_SETMAX); // 04
|
||||
addCalc(CPAP_Pressure, ST_SETMAX);
|
||||
addCalc(CPAP_Pressure, ST_MID);
|
||||
addCalc(CPAP_Pressure, ST_90P);
|
||||
addCalc(CPAP_PressureMin, ST_SETMIN);
|
||||
addCalc(CPAP_PressureMax, ST_SETMAX);
|
||||
|
||||
addCalc(CPAP_EPAP, ST_SETMAX); // 05
|
||||
addCalc(CPAP_IPAP, ST_SETMAX); // 06
|
||||
addCalc(CPAP_EPAPLo, ST_SETMAX); // 07
|
||||
addCalc(CPAP_IPAPHi, ST_SETMAX); // 08
|
||||
addCalc(CPAP_EPAP, ST_SETMAX);
|
||||
addCalc(CPAP_IPAP, ST_SETMAX);
|
||||
addCalc(CPAP_EPAPLo, ST_SETMAX);
|
||||
addCalc(CPAP_IPAPHi, ST_SETMAX);
|
||||
|
||||
addCalc(CPAP_EPAP, ST_MID); // 09
|
||||
addCalc(CPAP_EPAP, ST_90P); // 10
|
||||
addCalc(CPAP_IPAP, ST_MID); // 11
|
||||
addCalc(CPAP_IPAP, ST_90P); // 12
|
||||
addCalc(CPAP_EPAP, ST_MID);
|
||||
addCalc(CPAP_EPAP, ST_90P);
|
||||
addCalc(CPAP_IPAP, ST_MID);
|
||||
addCalc(CPAP_IPAP, ST_90P);
|
||||
}
|
||||
|
||||
int gPressureChart::addCalc(ChannelID code, SummaryType type) {
|
||||
|
||||
int gPressureChart::addCalc(ChannelID code, SummaryType type)
|
||||
{
|
||||
QColor color = schema::channel[code].defaultColor();
|
||||
if (type == ST_90P) {
|
||||
color = brighten(color, 1.33f);
|
||||
}
|
||||
|
||||
int index = gSummaryChart::addCalc(code, type, color);
|
||||
|
||||
// Save the code and type used to add this calculation so that getCalc()
|
||||
// can retrieve it by code and type instead of by hard-coded index.
|
||||
m_calcs[code][type] = index;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
SummaryCalcItem* gPressureChart::getCalc(ChannelID code, SummaryType type)
|
||||
{
|
||||
return &calcitems[m_calcs[code][type]];
|
||||
}
|
||||
|
||||
|
||||
void gPressureChart::afterDraw(QPainter &, gGraph &graph, QRectF rect)
|
||||
{
|
||||
QStringList presstr;
|
||||
SummaryCalcItem* calc;
|
||||
|
||||
calc = getCalc(CPAP_Pressure);
|
||||
if (calc->cnt > 0) {
|
||||
presstr.append(QString("%1 %2/%3/%4").
|
||||
arg(STR_TR_CPAP).
|
||||
arg(calc->min,0,'f',1).
|
||||
arg(calc->mid(), 0, 'f', 1).
|
||||
arg(calc->max,0,'f',1));
|
||||
if (getCalc(CPAP_Pressure)->cnt > 0) {
|
||||
presstr.append(channelRange(CPAP_Pressure, STR_TR_CPAP));
|
||||
}
|
||||
if (getCalc(CPAP_PressureMin, ST_SETMIN)->cnt > 0) {
|
||||
presstr.append(QString("%1 %2/%3/%4/%5").
|
||||
@ -66,37 +69,17 @@ void gPressureChart::afterDraw(QPainter &, gGraph &graph, QRectF rect)
|
||||
arg(getCalc(CPAP_PressureMax, ST_SETMAX)->max, 0, 'f', 1));
|
||||
|
||||
}
|
||||
calc = getCalc(CPAP_EPAP);
|
||||
if (calc->cnt > 0) {
|
||||
presstr.append(QString("%1 %2/%3/%4").
|
||||
arg(STR_TR_EPAP).
|
||||
arg(calc->min,0,'f',1).
|
||||
arg(calc->mid(), 0, 'f', 1).
|
||||
arg(calc->max, 0, 'f', 1));
|
||||
if (getCalc(CPAP_EPAP)->cnt > 0) {
|
||||
presstr.append(channelRange(CPAP_EPAP, STR_TR_EPAP));
|
||||
}
|
||||
calc = getCalc(CPAP_IPAP);
|
||||
if (calc->cnt > 0) {
|
||||
presstr.append(QString("%1 %2/%3/%4").
|
||||
arg(STR_TR_IPAP).
|
||||
arg(calc->min,0,'f',1).
|
||||
arg(calc->mid(), 0, 'f', 1).
|
||||
arg(calc->max, 0, 'f', 1));
|
||||
if (getCalc(CPAP_IPAP)->cnt > 0) {
|
||||
presstr.append(channelRange(CPAP_IPAP, STR_TR_IPAP));
|
||||
}
|
||||
calc = getCalc(CPAP_EPAPLo);
|
||||
if (calc->cnt > 0) {
|
||||
presstr.append(QString("%1 %2/%3/%4").
|
||||
arg(STR_TR_EPAPLo).
|
||||
arg(calc->min,0,'f',1).
|
||||
arg(calc->mid(), 0, 'f', 1).
|
||||
arg(calc->max, 0, 'f', 1));
|
||||
if (getCalc(CPAP_EPAPLo)->cnt > 0) {
|
||||
presstr.append(channelRange(CPAP_EPAPLo, STR_TR_EPAPLo));
|
||||
}
|
||||
calc = getCalc(CPAP_IPAPHi);
|
||||
if (calc->cnt > 0) {
|
||||
presstr.append(QString("%1 %2/%3/%4").
|
||||
arg(STR_TR_IPAPHi).
|
||||
arg(calc->min,0,'f',1).
|
||||
arg(calc->mid(), 0, 'f', 1).
|
||||
arg(calc->max, 0, 'f', 1));
|
||||
if (getCalc(CPAP_IPAPHi)->cnt > 0) {
|
||||
presstr.append(channelRange(CPAP_IPAPHi, STR_TR_IPAPHi));
|
||||
}
|
||||
QString txt = presstr.join(" ");
|
||||
graph.renderText(txt, rect.left(), rect.top()-5*graph.printScaleY(), 0);
|
||||
@ -104,6 +87,17 @@ void gPressureChart::afterDraw(QPainter &, gGraph &graph, QRectF rect)
|
||||
}
|
||||
|
||||
|
||||
QString gPressureChart::channelRange(ChannelID code, const QString & label)
|
||||
{
|
||||
SummaryCalcItem* calc = getCalc(code);
|
||||
return QString("%1 %2/%3/%4").
|
||||
arg(label).
|
||||
arg(calc->min, 0, 'f', 1).
|
||||
arg(calc->mid(), 0, 'f', 1).
|
||||
arg(calc->max, 0, 'f', 1);
|
||||
}
|
||||
|
||||
|
||||
void gPressureChart::populate(Day * day, int idx)
|
||||
{
|
||||
float tmp;
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
|
||||
protected:
|
||||
SummaryCalcItem* getCalc(ChannelID code, SummaryType type = ST_SETMAX);
|
||||
QString channelRange(ChannelID code, const QString & label);
|
||||
|
||||
QHash<ChannelID,QHash<SummaryType,int>> m_calcs;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user