mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-08 12:10:43 +00:00
Reduction in assert usage, as Debug window is functioning now
This commit is contained in:
parent
563734ae26
commit
20e8bf7704
@ -249,9 +249,11 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
|
||||
vertarray[vertcnt++]=start_px+px;
|
||||
vertarray[vertcnt++]=start_py+py;
|
||||
#if defined(EXTRA_ASSERTS)
|
||||
assert(vertcnt<maxverts);
|
||||
#endif
|
||||
|
||||
if (vertcnt>=maxverts) break;
|
||||
//#if defined(EXTRA_ASSERTS)
|
||||
//assert(vertcnt<maxverts);
|
||||
//#endif
|
||||
}
|
||||
lastpx=start_px+px;
|
||||
lastpy=start_py+py;
|
||||
@ -288,9 +290,10 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
vertarray[vertcnt++]=start_px+i+1;
|
||||
vertarray[vertcnt++]=start_py+m_drawlist[i].y();
|
||||
|
||||
#if defined(EXTRA_ASSERTS)
|
||||
assert(vertcnt<maxverts);
|
||||
#endif
|
||||
if (vertcnt>=maxverts) break;
|
||||
//#if defined(EXTRA_ASSERTS)
|
||||
//assert(vertcnt<maxverts);
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,11 +133,13 @@ void gLineOverlayBar::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
|
||||
}
|
||||
}
|
||||
if ((vertcnt>=maxverts) || (quadcnt>=maxverts) || (pointcnt>=maxverts)) break;
|
||||
}
|
||||
}
|
||||
assert (vertcnt<maxverts);
|
||||
assert (quadcnt<maxverts);
|
||||
assert (pointcnt<maxverts);
|
||||
|
||||
//assert (vertcnt<maxverts);
|
||||
//assert (quadcnt<maxverts);
|
||||
//assert (pointcnt<maxverts);
|
||||
glColor4ub(col.red(),col.green(),col.blue(),col.alpha());
|
||||
if (quadcnt>0) {
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
@ -5,6 +5,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#include <QDebug>
|
||||
#include "gXAxis.h"
|
||||
|
||||
gXAxis::gXAxis(QColor col)
|
||||
@ -53,7 +54,10 @@ void gXAxis::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
}
|
||||
float x,y;
|
||||
GetTextExtent(fd,x,y);
|
||||
assert(x>0);
|
||||
if (x<=0) {
|
||||
qWarning() << "gXAxis::Plot() x<=0";
|
||||
return;
|
||||
}
|
||||
|
||||
double max_ticks=(x+25.0)/width; // y+50 for rotated text
|
||||
double jj=1/max_ticks;
|
||||
@ -92,7 +96,8 @@ void gXAxis::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
//if (min_tick>10) min_tick=10;
|
||||
}
|
||||
if (min_tick<=0) {
|
||||
assert(min_tick>0);
|
||||
qWarning() << "gXAxis::Plot() min_tick<=0 :(";
|
||||
return;
|
||||
}
|
||||
|
||||
double st3=st;
|
||||
@ -115,7 +120,10 @@ void gXAxis::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
vertarray[vertcnt++]=py;
|
||||
vertarray[vertcnt++]=px;
|
||||
vertarray[vertcnt++]=py-4;
|
||||
assert(vertcnt<maxverts);
|
||||
if (vertcnt>maxverts) {
|
||||
qWarning() << "gXAxis::Plot() maxverts exceeded trying to draw minor ticks";
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +167,10 @@ void gXAxis::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
vertarray[vertcnt++]=py;
|
||||
vertarray[vertcnt++]=px;
|
||||
vertarray[vertcnt++]=py-6;
|
||||
assert(vertcnt<maxverts);
|
||||
if (vertcnt>maxverts) {
|
||||
qWarning() << "gXAxis::Plot() maxverts exceeded trying to draw Major ticks";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GetTextExtent(fd,x,y);
|
||||
@ -174,7 +185,10 @@ void gXAxis::Plot(gGraphWindow & w,float scrx,float scry)
|
||||
|
||||
}
|
||||
// Draw the little ticks.
|
||||
assert(vertcnt<maxverts);
|
||||
if (vertcnt>=maxverts) {
|
||||
qWarning() << "maxverts exceeded in gYAxis::Plot()";
|
||||
return;
|
||||
}
|
||||
|
||||
glLineWidth(1);
|
||||
glColor3f(0,0,0);
|
||||
|
@ -5,6 +5,7 @@
|
||||
*********************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#include <QDebug>
|
||||
#include "gYAxis.h"
|
||||
|
||||
gYAxis::gYAxis(QColor col)
|
||||
@ -95,8 +96,6 @@ void gYAxis::Plot(gGraphWindow &w,float scrx,float scry)
|
||||
if (x>labelW) labelW=x;
|
||||
h=start_py+ty;
|
||||
DrawText(fd,start_px-12-x,scry-(h-(y/2.0)),0);
|
||||
//glColor3ub(0,0,0);
|
||||
//w.renderText(start_px-15-x, scry-(h - (y / 2)),fd);
|
||||
|
||||
vertarray[vertcnt++]=start_px-4;
|
||||
vertarray[vertcnt++]=h;
|
||||
@ -111,7 +110,10 @@ void gYAxis::Plot(gGraphWindow &w,float scrx,float scry)
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
assert(vertcnt<maxverts);
|
||||
if (vertcnt>=maxverts) {
|
||||
qDebug() << "maxverts exceeded in gYAxis::Plot()";
|
||||
return;
|
||||
}
|
||||
|
||||
// Draw the little ticks.
|
||||
glLineWidth(1);
|
||||
|
@ -4,7 +4,8 @@
|
||||
License: GPL
|
||||
*********************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
#include <QDebug>
|
||||
#include "graphdata_custom.h"
|
||||
|
||||
|
||||
@ -50,7 +51,11 @@ void WaveData::Reload(Day *day)
|
||||
QPointD r(st,(*w)[i]);
|
||||
st+=rate;
|
||||
(point[vc][t++])=r;
|
||||
assert(t<max_points);
|
||||
if (t>=max_points) {
|
||||
qWarning()<< "WaveData max_points exceeded";
|
||||
break;
|
||||
}
|
||||
//assert(t<max_points);
|
||||
if (first) {
|
||||
max_y=min_y=r.y();
|
||||
first=false;
|
||||
@ -117,8 +122,8 @@ void EventData::Reload(Day *day)
|
||||
min_x=day->first()/86400000.0;
|
||||
max_x=day->last()/86400000.0;
|
||||
if (min_x>max_x) {
|
||||
//int a=5;
|
||||
assert(min_x<max_x);
|
||||
qWarning() << "EventData min_x > max_x";
|
||||
return;
|
||||
}
|
||||
min_y=max_y=0;
|
||||
int tt=0;
|
||||
@ -137,7 +142,10 @@ void EventData::Reload(Day *day)
|
||||
if (((p!=0) && skipzero) || !skipzero) {
|
||||
QPointD r((*ev)->time()/86400000.0,p);
|
||||
point[vc][t++]=r;
|
||||
assert(t<max_points);
|
||||
if (t>=max_points) {
|
||||
qWarning() << "EventData max_points exceeded";
|
||||
break;
|
||||
}
|
||||
if (first) {
|
||||
max_y=min_y=r.y();
|
||||
//lastp=p;
|
||||
@ -225,8 +233,10 @@ void TAPData::Reload(Day *day)
|
||||
first=false; // only bother setting lastval (below) this time.
|
||||
} else {
|
||||
double d=(ev.time()-last)/1000.0;
|
||||
|
||||
assert(lastval<max_slots);
|
||||
if (lastval>=max_slots) {
|
||||
qWarning() << "TapData: lastval<max_slots";
|
||||
break;
|
||||
}
|
||||
pTime[lastval]+=d;
|
||||
}
|
||||
cnt++;
|
||||
@ -304,6 +314,7 @@ void FlagData::Reload(Day *day)
|
||||
min_x=day->first()/86400000.0;
|
||||
max_x=day->last()/86400000.0;
|
||||
|
||||
bool done=false;
|
||||
for (vector<Session *>::iterator s=day->begin();s!=day->end();s++) {
|
||||
if ((*s)->events.find(code)==(*s)->events.end()) continue;
|
||||
//first=true;
|
||||
@ -318,7 +329,11 @@ void FlagData::Reload(Day *day)
|
||||
v2=point[vc][c].y();
|
||||
//point[vc][c].z=value;
|
||||
c++;
|
||||
assert(c<max_points);
|
||||
if (c>=max_points) {
|
||||
qWarning() << "FlagData: max_points exceeded";
|
||||
done=true;
|
||||
break;
|
||||
}
|
||||
/*if (first) {
|
||||
min_y=v1;
|
||||
first=false;
|
||||
@ -328,6 +343,7 @@ void FlagData::Reload(Day *day)
|
||||
}
|
||||
if (v2>max_x) max_x=v2; */
|
||||
}
|
||||
if (done) break;
|
||||
}
|
||||
min_y=-value;
|
||||
max_y=value;
|
||||
|
@ -262,7 +262,7 @@ void gGraphWindow::updateSelectionTime()
|
||||
seconds=int(f*24*3600.0) % 60;
|
||||
QString s;
|
||||
if (f>1) {
|
||||
s.sprintf("%.1f days",f);
|
||||
s.sprintf("%.0f days",f);
|
||||
} else if (f>(1.0/(24.0*12.0))) {
|
||||
s.sprintf("%02i:%02i:%02i",hours,minutes,seconds);
|
||||
} else {
|
||||
@ -355,7 +355,10 @@ void gGraphWindow::mouseMoveEvent(QMouseEvent * event)
|
||||
SetXBounds(qx,ex);
|
||||
if (pref["LinkGraphMovement"].toBool()) {
|
||||
for (list<gGraphWindow *>::iterator g=link_zoom.begin();g!=link_zoom.end();g++) {
|
||||
assert((*g)!=this);
|
||||
if (*g==this) {
|
||||
qWarning() << "mouseMoveEvent *g should not equal this";
|
||||
continue;
|
||||
}
|
||||
(*g)->SetXBounds(qx,ex);
|
||||
}
|
||||
}
|
||||
@ -397,7 +400,7 @@ void gGraphWindow::mouseMoveEvent(QMouseEvent * event)
|
||||
seconds=int(f*3600.0) % 60;
|
||||
QString s;
|
||||
if (z>1) {
|
||||
s.sprintf("%.1f days",q*z);
|
||||
s.sprintf("%.0f days",q*z);
|
||||
} else if (z>(1.0/(24.0*12.0))) {
|
||||
s.sprintf("%02i:%02i:%02i",hours,minutes,seconds);
|
||||
} else {
|
||||
@ -670,11 +673,6 @@ void gGraphWindow::OnMouseLeftDown(QMouseEvent * event)
|
||||
LastGraphLDown=this;
|
||||
}
|
||||
}
|
||||
void gGraphWindow::dropEvent ( QDropEvent * event )
|
||||
{
|
||||
assert(splitter!=NULL);
|
||||
//m_dragGraph=false;
|
||||
}
|
||||
|
||||
void gGraphWindow::OnMouseLeftRelease(QMouseEvent * event)
|
||||
{
|
||||
|
@ -32,7 +32,6 @@ public:
|
||||
|
||||
signals:
|
||||
public slots:
|
||||
void dropEvent(QDropEvent * event);
|
||||
public:
|
||||
QBitmap * RenderBitmap(int width,int height);
|
||||
|
||||
|
@ -285,7 +285,11 @@ qint64 Day::last(MachineCode code)
|
||||
Session & sess=*(*s);
|
||||
if (sess.events.find(code)!=sess.events.end()) {
|
||||
vector<Event *>::reverse_iterator i=sess.events[code].rbegin();
|
||||
assert(i!=sess.events[code].rend());
|
||||
if (i==sess.events[code].rend()) {
|
||||
qWarning() << "Day::last() i==sess.events[code].rend()";
|
||||
continue;
|
||||
}
|
||||
//assert(i!=sess.events[code].rend());
|
||||
tmp=(*i)->time();
|
||||
if (!date) {
|
||||
date=tmp;
|
||||
|
@ -963,7 +963,10 @@ bool PRS1Loader::OpenWaveforms(Session *session,QString filename)
|
||||
unsigned char sum=0,hchk;
|
||||
for (int i=0; i<hl; i++) sum+=header[i];
|
||||
|
||||
assert(numsignals<max_signals);
|
||||
if (numsignals>=max_signals) {
|
||||
qWarning() << "PRS1Loader::OpenWaveforms() numsignals >= max_signals";
|
||||
return false;
|
||||
}
|
||||
char buf[3];
|
||||
for (int i=0;i<numsignals;i++) {
|
||||
f.read(buf,3);
|
||||
|
@ -185,7 +185,10 @@ bool Preferences::Open(QString filename)
|
||||
for( ; pElem; pElem=pElem->NextSiblingElement()) {
|
||||
|
||||
TiXmlAttribute *attr=pElem->FirstAttribute();
|
||||
assert(attr!=NULL);
|
||||
if (!attr) {
|
||||
qWarning() << "Preferences::Open() attr==NULL!";
|
||||
return false;
|
||||
}
|
||||
QString type=attr->Value();
|
||||
type=type.toLower();
|
||||
QString pKey=pElem->Value();
|
||||
|
@ -99,8 +99,10 @@ void Profile::ExtraLoad(TiXmlHandle *root)
|
||||
}
|
||||
for(; elem; elem=elem->NextSiblingElement()) {
|
||||
QString pKey=elem->Value();
|
||||
assert(pKey=="Machine");
|
||||
|
||||
if (pKey!="Machine") {
|
||||
qWarning() << "Profile::ExtraLoad() pKey!=\"Machine\"";
|
||||
continue;
|
||||
}
|
||||
int m_id;
|
||||
elem->QueryIntAttribute("id",&m_id);
|
||||
int mt;
|
||||
@ -235,7 +237,10 @@ vector<Machine *> Profile::GetMachines(MachineType t)
|
||||
map<MachineID,Machine *>::iterator i;
|
||||
|
||||
for (i=machlist.begin(); i!=machlist.end(); i++) {
|
||||
assert(i->second!=NULL);
|
||||
if (!i->second) {
|
||||
qWarning() << "Profile::GetMachines() i->second == NULL";
|
||||
continue;
|
||||
}
|
||||
if (i->second->GetType()==t) {
|
||||
vec.push_back(i->second);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#ifndef SESSION_H
|
||||
#define SESSION_H
|
||||
|
||||
#include <QDebug>
|
||||
#include "SleepLib/machine.h"
|
||||
|
||||
class Machine;
|
||||
@ -51,7 +52,10 @@ public:
|
||||
else if (d<s_first) s_first=d;
|
||||
};
|
||||
void set_last(qint64 d) {
|
||||
assert(d>s_first);
|
||||
if (d<=s_first) {
|
||||
qWarning() << "Session::set_last() d<=s_first";
|
||||
return;
|
||||
}
|
||||
if (!s_last) s_last=d;
|
||||
else if (s_last<d) s_last=d;
|
||||
};
|
||||
|
@ -150,7 +150,7 @@ Daily::Daily(QWidget *parent,QGLContext *context) :
|
||||
FRW->AddLayer(new gLineOverlayBar(flags[2],QColor("#40c0ff"),"OA"));
|
||||
FRW->AddLayer(new gLineOverlayBar(flags[1],QColor("purple"),"CA"));
|
||||
|
||||
FRW->setMinimumHeight(190);
|
||||
FRW->setMinimumHeight(150);
|
||||
|
||||
AddCPAPData(snore=new EventData(CPAP_Snore,0));
|
||||
SNORE=new gGraphWindow(gSplitter,tr("Snore"),SF);
|
||||
|
11
overview.cpp
11
overview.cpp
@ -49,7 +49,7 @@ Overview::Overview(QWidget *parent,QGLContext *context) :
|
||||
AddGraph(AHI=new gGraphWindow(ui->SummaryGraphWindow,tr("AHI"),(QGLWidget *)NULL));
|
||||
AHI->SetTopMargin(10);
|
||||
AHI->SetBottomMargin(AHI->GetBottomMargin()+gXAxis::Margin+25);
|
||||
AHI->AddLayer(new gFooBar(7));
|
||||
//AHI->AddLayer(new gFooBar(7));
|
||||
AHI->AddLayer(new gYAxis());
|
||||
AHI->AddLayer(new gBarChart(ahidata,QColor("red")));
|
||||
AHI->setMinimumHeight(170);
|
||||
@ -58,7 +58,7 @@ Overview::Overview(QWidget *parent,QGLContext *context) :
|
||||
//PRESSURE->SetMargins(10,15,65,80);
|
||||
PRESSURE->AddLayer(new gYAxis());
|
||||
PRESSURE->AddLayer(new gXAxis());
|
||||
PRESSURE->AddLayer(new gFooBar(7));
|
||||
//PRESSURE->AddLayer(new gFooBar(7));
|
||||
PRESSURE->AddLayer(prmax=new gLineChart(pressure_max,QColor("blue"),6192,false,true,true));
|
||||
PRESSURE->AddLayer(prmin=new gLineChart(pressure_min,QColor("red"),6192,false,true,true));
|
||||
PRESSURE->AddLayer(eap=new gLineChart(pressure_eap,QColor("blue"),6192,false,true,true));
|
||||
@ -70,13 +70,13 @@ Overview::Overview(QWidget *parent,QGLContext *context) :
|
||||
AddGraph(LEAK=new gGraphWindow(ui->SummaryGraphWindow,tr("Leak"),AHI));
|
||||
LEAK->AddLayer(new gXAxis());
|
||||
LEAK->AddLayer(new gYAxis());
|
||||
LEAK->AddLayer(new gFooBar(7));
|
||||
//LEAK->AddLayer(new gFooBar(7));
|
||||
LEAK->AddLayer(new gLineChart(leak,QColor("purple"),6192,false,false,true));
|
||||
LEAK->SetBottomMargin(LEAK->GetBottomMargin()+25);
|
||||
LEAK->setMinimumHeight(170);
|
||||
|
||||
AddGraph(USAGE=new gGraphWindow(ui->SummaryGraphWindow,tr("Usage (Hours)"),AHI));
|
||||
USAGE->AddLayer(new gFooBar(7));
|
||||
//USAGE->AddLayer(new gFooBar(7));
|
||||
USAGE->AddLayer(new gYAxis());
|
||||
USAGE->AddLayer(new gBarChart(usage,QColor("green")));
|
||||
USAGE->SetBottomMargin(USAGE->GetBottomMargin()+gXAxis::Margin+25);
|
||||
@ -86,7 +86,7 @@ Overview::Overview(QWidget *parent,QGLContext *context) :
|
||||
|
||||
AddGraph(SESSTIMES=new gGraphWindow(ui->SummaryGraphWindow,tr("Session Times"),AHI));
|
||||
//SESSTIMES->SetMargins(10,15,65,80);
|
||||
SESSTIMES->AddLayer(new gFooBar(7));
|
||||
//SESSTIMES->AddLayer(new gFooBar(7));
|
||||
SESSTIMES->AddLayer(new gTimeYAxis());
|
||||
SESSTIMES->AddLayer(new gSessionTime(session_times,QColor("green")));
|
||||
SESSTIMES->SetBottomMargin(SESSTIMES->GetBottomMargin()+gXAxis::Margin+25);
|
||||
@ -106,6 +106,7 @@ Overview::Overview(QWidget *parent,QGLContext *context) :
|
||||
|
||||
for (int i=0;i<ss;i++) {
|
||||
AddGraph(graphs[i]);
|
||||
graphs[i]->AddLayer(new gFooBar(7));
|
||||
for (int j=0;j<ss;j++) {
|
||||
if (graphs[i]!=graphs[j])
|
||||
graphs[i]->LinkZoom(graphs[j]);
|
||||
|
Loading…
Reference in New Issue
Block a user