Some more SummaryChart fixes

This commit is contained in:
Mark Watkins 2011-09-10 18:26:21 +10:00
parent c8f17fe819
commit e2c649d6b1
4 changed files with 16 additions and 11 deletions

View File

@ -18,6 +18,7 @@ SummaryChart::SummaryChart(Profile *p,QString label,GraphType type)
addGLBuf(quads=new GLBuffer(color,20000,GL_QUADS));
addGLBuf(lines=new GLBuffer(color,20000,GL_LINES));
quads->forceAntiAlias(true);
//lines->setSize(2);
m_empty=true;
hl_day=-1;
}
@ -272,7 +273,8 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
short px2=px+barw;
short py2=top+height-1-h;
if (lastdaygood) {
lines->add(lastX[j],lastY[j],px2,py2,col);
lines->add(lastX[j],lastY[j],px,py2,m_colors[j]);
lines->add(px,py2,px2,py2,col);
} else {
lines->add(x1,py2,x2,py2,col);
}
@ -293,14 +295,12 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
lines->scissor(left,w.flipY(top+height+2),width+1,height+1);
// Draw Ledgend
px=left+width;
px=left+width-10;
py=top+10;
int wid=120;
QString a;
int x,y;
for (int j=0;j<m_colors.size();j++) {
px-=wid;
lines->add(px,py,px+20,py,m_colors[j]);
lines->add(px,py+1,px+20,py+1,m_colors[j]);
a=channel[m_codes[j]].label();
a+=" ";
switch(m_type[j]) {
@ -312,7 +312,11 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
case ST_HOURS: a+="Hours"; break;
default:break;
}
GetTextExtent(a,x,y);
px-=30+x;
w.renderText(a,px+24,py+5);
lines->add(px,py,px+20,py,m_colors[j]);
lines->add(px,py+1,px+20,py+1,m_colors[j]);
}
QString z=m_label;

View File

@ -369,7 +369,7 @@ int ResmedLoader::Open(QString & path,Profile *profile)
ChannelID e[]={
CPAP_Obstructive, CPAP_Hypopnea, CPAP_ClearAirway, CPAP_Apnea
};
for (unsigned i=0;i<sizeof(e)/sizeof(ChannelID);i++) {
/*for (unsigned i=0;i<sizeof(e)/sizeof(ChannelID);i++) {
// Merge this crap together where possible
sess->count(e[i]);
@ -379,11 +379,11 @@ int ResmedLoader::Open(QString & path,Profile *profile)
//sess->p90(e[i]);
sess->cph(e[i]);
sess->sph(e[i]);
}
}*/
sess->setCph(CPAP_AHI,sess->cph(CPAP_Obstructive)+sess->cph(CPAP_Hypopnea)+sess->cph(CPAP_ClearAirway)+sess->cph(CPAP_Apnea));
sess->setSph(CPAP_AHI,sess->sph(CPAP_Obstructive)+sess->sph(CPAP_Hypopnea)+sess->sph(CPAP_ClearAirway)+sess->sph(CPAP_Apnea));
ChannelID a[]={
/*ChannelID a[]={
CPAP_Leak, CPAP_Snore, CPAP_EPAP,
CPAP_IPAP, CPAP_TidalVolume, CPAP_RespiratoryRate,
CPAP_PatientTriggeredBreaths,CPAP_MinuteVentilation,
@ -414,7 +414,7 @@ int ResmedLoader::Open(QString & path,Profile *profile)
//sess->p90(b[i]);
sess->cph(b[i]);
}
}
} */
sess->settings[CPAP_Mode]=MODE_APAP;
}

View File

@ -412,6 +412,7 @@ void Session::UpdateSummaries()
QHash<ChannelID,QVector<EventList *> >::iterator c;
for (c=eventlist.begin();c!=eventlist.end();c++) {
id=c.key();
if ((id==CPAP_FlowRate) || (id==CPAP_MaskPressure)) continue;
if ((channel[id].channeltype()==CT_Event) || (channel[id].channeltype()==CT_Graph)) {
//sum(id); // avg calculates this and cnt.
min(id);

View File

@ -83,10 +83,10 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
pr=new SummaryChart(profile,"cmH2O",GT_LINE);
pr->addSlice(CPAP_Pressure,QColor("dark green"),ST_WAVG);
pr->addSlice(CPAP_Pressure,QColor("orange"),ST_MIN);
pr->addSlice(CPAP_Pressure,QColor("dark green"),ST_WAVG);
pr->addSlice(CPAP_Pressure,QColor("red"),ST_MAX);
pr->addSlice(CPAP_EPAP,QColor("light green"),ST_MAX);
pr->addSlice(CPAP_EPAP,QColor("light green"),ST_MIN);
pr->addSlice(CPAP_IPAP,QColor("light blue"),ST_MAX);
PR->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);