mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 18:50:44 +00:00
Stop Event Flags dissappearing on zero days, Event Flags and Flow overlay checks and optimisations
This commit is contained in:
parent
21d9d7e32b
commit
194dc3d579
@ -55,6 +55,11 @@ void gFlagsGroup::SetDay(Day * d)
|
||||
}
|
||||
}
|
||||
m_empty=(cnt==0);
|
||||
if (m_empty) {
|
||||
if (d) {
|
||||
m_empty=!d->channelExists(CPAP_Pressure);
|
||||
}
|
||||
}
|
||||
m_barh=0;
|
||||
}
|
||||
|
||||
@ -142,20 +147,28 @@ void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
|
||||
|
||||
qint64 start;
|
||||
quint32 * tptr;
|
||||
EventStoreType *dptr;
|
||||
EventStoreType *dptr, * eptr;
|
||||
int idx;
|
||||
QHash<ChannelID,QVector<EventList *> >::iterator cei;
|
||||
|
||||
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
||||
if (!(*s)->enabled()) continue;
|
||||
if (!(*s)->enabled())
|
||||
continue;
|
||||
|
||||
if ((*s)->eventlist.find(m_code)==(*s)->eventlist.end()) continue;
|
||||
cei=(*s)->eventlist.find(m_code);
|
||||
if (cei==(*s)->eventlist.end())
|
||||
continue;
|
||||
|
||||
EventList & el=*((*s)->eventlist[m_code][0]);
|
||||
QVector<EventList *> & evlist=cei.value();
|
||||
for (int k=0;k<evlist.size();k++) {
|
||||
EventList & el=*(evlist[k]);
|
||||
start=el.first();
|
||||
tptr=el.rawTime();
|
||||
dptr=el.rawData();
|
||||
int np=el.count();
|
||||
eptr=dptr+np;
|
||||
|
||||
for (idx=0; idx < np; idx++) {
|
||||
for (idx=0;dptr < eptr; dptr++, tptr++, idx++) {
|
||||
X=start + *tptr;
|
||||
L=*dptr * 1000;
|
||||
if (X >= minx)
|
||||
@ -163,8 +176,7 @@ void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
|
||||
X2=X-L;
|
||||
if (X2 >= minx)
|
||||
break;
|
||||
dptr++;
|
||||
tptr++;
|
||||
|
||||
}
|
||||
np-=idx;
|
||||
|
||||
@ -184,7 +196,7 @@ void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
|
||||
}
|
||||
|
||||
for (int i=0;i<np;i++) {
|
||||
X=start + * tptr++; //el.time(i);
|
||||
X=start + *tptr++;
|
||||
|
||||
if (X > maxx)
|
||||
break;
|
||||
@ -207,13 +219,13 @@ void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
|
||||
verts_exceeded=true;
|
||||
}
|
||||
|
||||
for (int i=0;i < np; i++) {
|
||||
for (; dptr < eptr; dptr++) {
|
||||
X=start + * tptr++;
|
||||
|
||||
if (X > maxx)
|
||||
break;
|
||||
|
||||
L=*dptr++ * 1000L;
|
||||
L=*dptr * 1000L;
|
||||
X2=X-L;
|
||||
|
||||
x1=double(X - minx) * xmult + left;
|
||||
@ -226,6 +238,8 @@ void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
|
||||
}
|
||||
if (verts_exceeded) break;
|
||||
}
|
||||
if (verts_exceeded) break;
|
||||
}
|
||||
if (verts_exceeded) {
|
||||
qWarning() << "maxverts exceeded in gFlagsLine::plot()";
|
||||
}
|
||||
|
@ -50,7 +50,6 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
||||
double Y;
|
||||
|
||||
bool verts_exceeded=false;
|
||||
QHash<ChannelID,QVector<EventList *> >::iterator cei;
|
||||
|
||||
m_count=0;
|
||||
m_sum=0;
|
||||
@ -64,75 +63,95 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
||||
EventStoreType raw;
|
||||
|
||||
quint32 * tptr;
|
||||
EventStoreType * ptr;
|
||||
EventStoreType * dptr, *eptr;
|
||||
qint64 stime;
|
||||
|
||||
OverlayDisplayType odt=PROFILE.appearance->overlayType();
|
||||
|
||||
QHash<ChannelID,QVector<EventList *> >::iterator cei;
|
||||
int count;
|
||||
// For each session, process it's eventlist
|
||||
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
||||
|
||||
if (!(*s)->enabled()) continue;
|
||||
cei=(*s)->eventlist.find(m_code);
|
||||
if (cei==(*s)->eventlist.end()) continue;
|
||||
if (cei.value().size()==0) continue;
|
||||
QVector<EventList *> & evlist=cei.value();
|
||||
if (evlist.size()==0) continue;
|
||||
|
||||
// Could loop through here, but nowhere uses more than one yet..
|
||||
EventList & el=*cei.value()[0];
|
||||
for (int k=0;k<evlist.size();k++) {
|
||||
EventList & el=*(evlist[k]);
|
||||
count=el.count();
|
||||
stime=el.first();
|
||||
ptr=el.rawData();
|
||||
dptr=el.rawData();
|
||||
eptr=dptr+count;
|
||||
tptr=el.rawTime();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Skip data previous to minx bounds
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
quint32 idx;
|
||||
for (idx=0;idx<el.count();idx++) {
|
||||
for (; dptr < eptr; dptr++) {
|
||||
X=stime + *tptr;
|
||||
if (X >= w.min_x)
|
||||
break;
|
||||
tptr++;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (m_flt==FT_Span) {
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// FT_Span
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
for (quint32 i=idx;i<el.count();i++) {
|
||||
X=stime + *tptr++; //el.time(i);
|
||||
raw=*ptr++; //el.data(i);
|
||||
for (;dptr < eptr; dptr++) {
|
||||
X=stime + *tptr++;
|
||||
raw=*dptr;
|
||||
Y=X-(qint64(raw)*1000.0L); // duration
|
||||
if (Y > w.max_x) break;
|
||||
if (Y > w.max_x)
|
||||
break;
|
||||
x1=double(width)/double(xx)*double(X-w.min_x)+left;
|
||||
m_count++;
|
||||
m_sum+=raw;
|
||||
x2=double(width)/double(xx)*double(Y-w.min_x)+left;
|
||||
if (int(x1)==int(x2)) x2+=1;
|
||||
if (x2<left) x2=left;
|
||||
if (x1>width+left) x1=width+left;
|
||||
//double w1=x2-x1;
|
||||
|
||||
if (int(x1)==int(x2))
|
||||
x2+=1;
|
||||
if (x2<left)
|
||||
x2=left;
|
||||
if (x1>width+left)
|
||||
x1=width+left;
|
||||
|
||||
quads->add(x2,start_py, x1,start_py, x1,start_py+height, x2,start_py+height,m_flag_color.rgba());
|
||||
if (quads->full()) { verts_exceeded=true; break; }
|
||||
if (quads->full()) {
|
||||
verts_exceeded=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (m_flt==FT_Dot) {
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// FT_Dot
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
for (quint32 i=idx;i<el.count();i++) {
|
||||
for (; dptr < eptr; dptr++) {
|
||||
X=stime + *tptr++; //el.time(i);
|
||||
raw=*ptr++; //el.data(i);
|
||||
if (X > w.max_x) break;
|
||||
raw=*dptr; //el.data(i);
|
||||
if (X > w.max_x)
|
||||
break;
|
||||
x1=double(width)/double(xx)*double(X-w.min_x)+left;
|
||||
m_count++;
|
||||
m_sum+=raw;
|
||||
if ((odt==ODT_Bars) || (xx<3600000)) {
|
||||
// show the fat dots in the middle
|
||||
points->add(x1,double(height)/double(yy)*double(-20-w.min_y)+topp);
|
||||
if (points->full()) { verts_exceeded=true; break; }
|
||||
if (points->full()) {
|
||||
verts_exceeded=true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// thin lines down the bottom
|
||||
lines->add(x1,start_py+1,x1,start_py+1+12);
|
||||
if (lines->full()) { verts_exceeded=true; break; }
|
||||
if (lines->full()) {
|
||||
verts_exceeded=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -140,10 +159,11 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// FT_Bar
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
for (quint32 i=idx;i<el.count();i++) {
|
||||
for (; dptr < eptr; dptr++) {
|
||||
X=stime + *tptr++;
|
||||
raw=*ptr++;
|
||||
if (X > w.max_x) break;
|
||||
raw=*dptr;
|
||||
if (X > w.max_x)
|
||||
break;
|
||||
x1=double(width)/double(xx)*double(X-w.min_x)+left;
|
||||
m_count++;
|
||||
m_sum+=raw;
|
||||
@ -153,11 +173,17 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
||||
|
||||
points->add(x1,top);
|
||||
lines->add(x1,top,x1,bottom);
|
||||
if (points->full()) { verts_exceeded=true; break; }
|
||||
if (points->full()) {
|
||||
verts_exceeded=true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
lines->add(x1,z,x1,z-12);
|
||||
}
|
||||
if (lines->full()) { verts_exceeded=true; break; }
|
||||
if (lines->full()) {
|
||||
verts_exceeded=true;
|
||||
break;
|
||||
}
|
||||
if (xx<(1800000)) {
|
||||
GetTextExtent(m_label,x,y);
|
||||
w.renderText(m_label,x1-(x/2),top-y+(3*w.printScaleY()));
|
||||
@ -165,7 +191,11 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
||||
}
|
||||
}
|
||||
|
||||
if (verts_exceeded) break;
|
||||
if (verts_exceeded)
|
||||
break;
|
||||
}
|
||||
if (verts_exceeded)
|
||||
break;
|
||||
}
|
||||
if (verts_exceeded) {
|
||||
qWarning() << "exceeded maxverts in gLineOverlay::Plot()";
|
||||
|
Loading…
Reference in New Issue
Block a user