Genericised graph Event & Waveform data classes

This commit is contained in:
Mark Watkins 2011-06-06 20:06:57 +10:00
parent bbbcf67b6d
commit 475357a859
7 changed files with 57 additions and 146 deletions

View File

@ -27,6 +27,8 @@
<Compiler>
<Add option="-O2" />
<Add option="-pg" />
<Add directory="../../src/libs" />
<Add directory="../../src" />
</Compiler>
<Linker>
<Add option="-pg" />
@ -56,8 +58,8 @@
<Compiler>
<Add option="-Wall" />
<Add option="`wx-config --version=2.8 --cflags`" />
<Add directory="libs" />
<Add directory="graphs" />
<Add directory="../../src/libs" />
<Add directory="../../src" />
</Compiler>
<Linker>
<Add option="`wx-config --version=2.8 --libs aui,xrc,qa,html,adv,core,net,base`" />
@ -101,7 +103,7 @@
<lib_finder disable_auto="1" />
<AutoVersioning>
<Scheme minor_max="10" build_max="0" rev_max="0" rev_rand_max="10" build_times_to_increment_minor="300" />
<Settings autoincrement="0" date_declarations="1" do_auto_increment="1" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="version.h" />
<Settings autoincrement="0" date_declarations="1" do_auto_increment="1" ask_to_increment="0" language="C++" svn="0" svn_directory="" header_path="../../src/version.h" />
<Changes_Log show_changes_editor="0" app_title="released version %M.%m.%b of %p" changeslog_path="ChangesLog.txt" />
<Code header_guard="VERSION_H" namespace="AutoVersion" prefix="" />
</AutoVersioning>

View File

@ -8291,11 +8291,11 @@
<map>
"tinyxml/tinyxml.h"
1307330909 /home/mark/projects/git/sleepyhead/src/graphs/graph.h
1307354721 /home/mark/projects/git/sleepyhead/src/graphs/graph.h
<sleeplib/machine.h>
<list>
1307342695 /home/mark/projects/git/sleepyhead/src/version.h
1307354721 /home/mark/projects/git/sleepyhead/src/version.h
1307245704 /home/mark/projects/git/sleepyhead/src/libs/sleeplib/prs1_loader.h
"machine.h"
@ -8312,7 +8312,7 @@
"preferences.h"
"tinyxml/tinyxml.h"
1307342349 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp
1307354717 source:/home/mark/projects/git/sleepyhead/src/SleepyHeadMain.cpp
"wx_pch.h"
"version.h"
<wx/app.h>
@ -8332,7 +8332,7 @@
"sleeplib/profiles.h"
"sleeplib/machine_loader.h"
1307337296 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
1307354731 source:/home/mark/projects/git/sleepyhead/src/graphs/graph.cpp
<wx/settings.h>
<wx/dcbuffer.h>
<wx/log.h>

View File

@ -2,33 +2,36 @@
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
<File name="../../src/SleepyHeadApp.cpp" open="1" top="0" tabpos="1">
<Cursor position="781" topLine="2" />
<Cursor position="1042" topLine="21" />
</File>
<File name="../../src/SleepyHeadMain.cpp" open="1" top="0" tabpos="2">
<Cursor position="35342" topLine="822" />
<File name="../../src/SleepyHeadMain.cpp" open="1" top="1" tabpos="2">
<Cursor position="9011" topLine="191" />
</File>
<File name="../../src/SleepyHeadMain.h" open="1" top="0" tabpos="3">
<Cursor position="1968" topLine="43" />
<Cursor position="546" topLine="0" />
</File>
<File name="../../src/graphs/graph.cpp" open="1" top="0" tabpos="8">
<Cursor position="42531" topLine="1608" />
<File name="../../src/graphs/graph.cpp" open="1" top="0" tabpos="9">
<Cursor position="53959" topLine="2027" />
</File>
<File name="../../src/graphs/graph.h" open="1" top="0" tabpos="11">
<Cursor position="15591" topLine="437" />
<File name="../../src/graphs/graph.h" open="1" top="0" tabpos="10">
<Cursor position="15761" topLine="437" />
</File>
<File name="../../src/libs/sleeplib/loader_plugins/cms50_loader.cpp" open="1" top="1" tabpos="4">
<Cursor position="4412" topLine="127" />
<File name="../../src/libs/sleeplib/binary_file.cpp" open="1" top="0" tabpos="11">
<Cursor position="7148" topLine="269" />
</File>
<File name="../../src/libs/sleeplib/loader_plugins/cms50_loader.cpp" open="1" top="0" tabpos="4">
<Cursor position="3214" topLine="116" />
</File>
<File name="../../src/libs/sleeplib/loader_plugins/cms50_loader.h" open="1" top="0" tabpos="7">
<Cursor position="579" topLine="0" />
</File>
<File name="../../src/libs/sleeplib/machine.cpp" open="1" top="0" tabpos="9">
<Cursor position="25229" topLine="825" />
<File name="../../src/libs/sleeplib/machine.cpp" open="1" top="0" tabpos="8">
<Cursor position="22029" topLine="747" />
</File>
<File name="../../src/libs/sleeplib/machine.h" open="1" top="0" tabpos="5">
<Cursor position="2133" topLine="25" />
</File>
<File name="../../src/libs/sleeplib/prs1_loader.cpp" open="1" top="0" tabpos="6">
<Cursor position="23295" topLine="610" />
<Cursor position="24147" topLine="688" />
</File>
</CodeBlocks_layout_file>

View File

@ -586,7 +586,7 @@ Daily::Daily(wxWindow *win,Profile *p)
l->color.push_back(wxGREEN2);
G_AHI->AddLayer(l);
AddOXIData(pulse=new SkipZeroData(OXI_Pulse,0,32768));
AddOXIData(pulse=new EventData(OXI_Pulse,0,32768,true));
//pulse->ForceMinY(40);
//pulse->ForceMaxY(120);
@ -594,7 +594,7 @@ Daily::Daily(wxWindow *win,Profile *p)
PULSE->AddLayer(new gLineChart(pulse,wxRED,32768,false,false,true));
PULSE->AddLayer(new gXAxis(wxBLACK));
AddOXIData(spo2=new SkipZeroData(OXI_SPO2,0,32768));
AddOXIData(spo2=new EventData(OXI_SPO2,0,32768,true));
//spo2->ForceMinY(60);
//spo2->ForceMaxY(100);
SPO2=new gGraphWindow(ScrolledWindow,-1,wxT("SpO2"),wxPoint(0,0), wxSize(600,130), wxNO_BORDER);
@ -604,23 +604,23 @@ Daily::Daily(wxWindow *win,Profile *p)
PULSE->LinkZoom(SPO2);
AddCPAPData(leakdata=new PressureData(CPAP_Leak,0));
AddCPAPData(leakdata=new EventData(CPAP_Leak,0));
//leakdata->ForceMinY(0);
//leakdata->ForceMaxY(120);
LEAK=new gGraphWindow(ScrolledWindow,-1,wxT("Mask Leaks"),wxPoint(0,0), wxSize(600,130), wxNO_BORDER);
LEAK->AddLayer(new gLineChart(leakdata,wxPURPLE,4096,false,false,true));
LEAK->AddLayer(new gXAxis(wxBLACK));
AddCPAPData(pressure_iap=new PressureData(CPAP_IAP));
AddCPAPData(pressure_eap=new PressureData(CPAP_EAP));
AddCPAPData(prd=new PressureData(CPAP_Pressure));
AddCPAPData(pressure_iap=new EventData(CPAP_IAP));
AddCPAPData(pressure_eap=new EventData(CPAP_EAP));
AddCPAPData(prd=new EventData(CPAP_Pressure));
PRD=new gGraphWindow(ScrolledWindow,-1,wxT("Pressure"),wxPoint(0,0), wxSize(600,130), wxNO_BORDER);
PRD->AddLayer(new gLineChart(prd,wxDARK_GREEN,4096,false,false,true));
PRD->AddLayer(new gLineChart(pressure_iap,wxBLUE,4096,false,true,true));
PRD->AddLayer(new gLineChart(pressure_eap,wxRED,4096,false,true,true));
PRD->AddLayer(new gXAxis(wxBLACK));
AddCPAPData(frw=new FlowData());
AddCPAPData(frw=new WaveData(CPAP_FlowRate));
FRW=new gGraphWindow(ScrolledWindow,-1,wxT("Flow Rate"),wxPoint(0,0), wxSize(600,150), wxNO_BORDER);
AddCPAPData(flags[0]=new FlagData(CPAP_CSR,7,1,0));

View File

@ -1523,14 +1523,14 @@ void gFlagsLine::Plot(wxDC & dc, gGraphWindow & w)
}
FlowData::FlowData()
:gPointData(250000)
WaveData::WaveData(MachineCode _code, int _size)
:gPointData(_size),code(_code)
{
}
FlowData::~FlowData()
WaveData::~WaveData()
{
}
void FlowData::Reload(Day *day)
void WaveData::Reload(Day *day)
{
vc=0;
if (!day) {
@ -1538,7 +1538,6 @@ void FlowData::Reload(Day *day)
return;
}
//wxRealPoint *rpl;
MachineCode code=CPAP_FlowRate;
min_x=day->first().GetMJD();
max_x=day->last().GetMJD();
max_y=0;
@ -1576,7 +1575,7 @@ void FlowData::Reload(Day *day)
max_y=ceil(max_y);
//double t1=MAX(fabs(min_y),fabs(max_y));
// Get clever here..
if (max_y>128) {
} else if (max_y>90) {
max_y=120;
@ -1603,15 +1602,14 @@ void FlowData::Reload(Day *day)
}
// This can be merged back in with PressureData (and can be renamed while we are at it)
SkipZeroData::SkipZeroData(MachineCode _code,int _field,int _size)
:gPointData(_size),code(_code),field(_field)
EventData::EventData(MachineCode _code,int _field,int _size,bool _skipzero)
:gPointData(_size),code(_code),field(_field),skipzero(_skipzero)
{
}
SkipZeroData::~SkipZeroData()
EventData::~EventData()
{
}
void SkipZeroData::Reload(Day *day)
void EventData::Reload(Day *day)
{
vc=0;
if (!day) {
@ -1636,7 +1634,7 @@ void SkipZeroData::Reload(Day *day)
EventDataType p;
for (vector<Event *>::iterator ev=(*s)->events[code].begin(); ev!=(*s)->events[code].end(); ev++) {
p=(*(*ev))[field];
if (p!=0) {
if (((p!=0) && skipzero) || !skipzero) {
wxRealPoint r((*ev)->time().GetMJD(),p);
point[vc][t++]=r;
assert(t<max_points);
@ -1686,90 +1684,6 @@ void SkipZeroData::Reload(Day *day)
}
PressureData::PressureData(MachineCode _code,int _field,int _size)
:gPointData(_size),code(_code),field(_field)
{
}
PressureData::~PressureData()
{
}
void PressureData::Reload(Day *day)
{
vc=0;
if (!day) {
m_ready=false;
return;
}
min_x=day->first().GetMJD();
max_x=day->last().GetMJD();
assert(min_x<max_x);
min_y=max_y=0;
int tt=0;
bool first=true;
for (vector<Session *>::iterator s=day->begin();s!=day->end(); s++) {
if ((*s)->events.find(code)==(*s)->events.end()) continue;
if (vc>=(int)point.size()) {
AddSegment(max_points);
}
int t=0;
EventDataType p; //,lastp=-1;
for (vector<Event *>::iterator ev=(*s)->events[code].begin(); ev!=(*s)->events[code].end(); ev++) {
p=(*(*ev))[field];
wxRealPoint r((*ev)->time().GetMJD(),p);
point[vc][t++]=r;
assert(t<max_points);
if (first) {
max_y=min_y=r.y;
first=false;
} else {
if (r.y<min_y) min_y=r.y;
if (r.y>max_y) max_y=r.y;
}
//lastp=p;
}
np[vc]=t;
tt+=t;
vc++;
}
/*if ((code==CPAP_Pressure) || (code==CPAP_EAP) || (code==CPAP_IAP)) {
if (day->summary_max(CPAP_Mode)==MODE_CPAP) {
min_y=4;
max_y=ceil(max_y+1);
} else {
if (min_y>day->summary_min(CPAP_PressureMin)) min_y=day->summary_min(CPAP_PressureMin);
if (max_y<day->summary_max(CPAP_PressureMax)) max_y=day->summary_min(CPAP_PressureMax);
//max_y=ceil(day->summary_max(CPAP_PressureMax));
min_y=floor(min_y);
max_y=ceil(max_y);
}
} else { */
if (tt>0) {
min_y=floor(min_y);
max_y=ceil(max_y+1);
if (min_y>1) min_y-=1;
}
//}
if (force_min_y!=force_max_y) {
min_y=force_min_y;
max_y=force_max_y;
}
real_min_x=min_x;
real_min_y=min_y;
real_max_x=max_x;
real_max_y=max_y;
m_ready=true;
//max_y=25;
//max_y=max_y/25)*25;
//graph->Refresh(false);
}
TAPData::TAPData(MachineCode _code)
:gPointData(256),code(_code)

View File

@ -457,34 +457,26 @@ public:
};
class FlowData:public gPointData
class WaveData:public gPointData
{
public:
FlowData();
virtual ~FlowData();
WaveData(MachineCode _code,int _size=250000);
virtual ~WaveData();
virtual void Reload(Day *day=NULL);
protected:
MachineCode code;
};
class PressureData:public gPointData
class EventData:public gPointData
{
public:
PressureData(MachineCode _code,int _field=0,int _size=4096);
virtual ~PressureData();
virtual void Reload(Day *day=NULL);
protected:
MachineCode code;
int field;
};
class SkipZeroData:public gPointData
{
public:
SkipZeroData(MachineCode _code,int _field=0,int _size=4096);
virtual ~SkipZeroData();
EventData(MachineCode _code,int _field=0,int _size=4096,bool _skipzero=false);
virtual ~EventData();
virtual void Reload(Day *day=NULL);
protected:
MachineCode code;
int field;
bool skipzero;
};

View File

@ -16,14 +16,14 @@ namespace AutoVersion{
//Standard Version Type
static const long MAJOR = 0;
static const long MINOR = 7;
static const long BUILD = 3267;
static const long REVISION = 949;
static const long BUILD = 3279;
static const long REVISION = 1025;
//Miscellaneous Version Types
static const long BUILDS_COUNT = 339;
#define RC_FILEVERSION 0,7,3267,949
#define RC_FILEVERSION_STRING "0, 7, 3267, 949\0"
static const char FULLVERSION_STRING[] = "0.7.3267.949";
static const long BUILDS_COUNT = 369;
#define RC_FILEVERSION 0,7,3279,1025
#define RC_FILEVERSION_STRING "0, 7, 3279, 1025\0"
static const char FULLVERSION_STRING[] = "0.7.3279.1025";
//These values are to keep track of your versioning state, don't modify them.
static const long BUILD_HISTORY = 0;