mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-07 03:30:44 +00:00
MinY/MaxY improvements.
This commit is contained in:
parent
0c000c6140
commit
430dc64063
@ -7869,11 +7869,11 @@
|
|||||||
<map>
|
<map>
|
||||||
"tinyxml/tinyxml.h"
|
"tinyxml/tinyxml.h"
|
||||||
|
|
||||||
1306647783 /home/mark/projects/git/sleepyhead/graphs/graph.h
|
1306652249 /home/mark/projects/git/sleepyhead/graphs/graph.h
|
||||||
<sleeplib/machine.h>
|
<sleeplib/machine.h>
|
||||||
<list>
|
<list>
|
||||||
|
|
||||||
1306649352 /home/mark/projects/git/sleepyhead/version.h
|
1306652337 /home/mark/projects/git/sleepyhead/version.h
|
||||||
|
|
||||||
1306549105 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h
|
1306549105 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h
|
||||||
"machine.h"
|
"machine.h"
|
||||||
@ -7890,7 +7890,7 @@
|
|||||||
"preferences.h"
|
"preferences.h"
|
||||||
"tinyxml/tinyxml.h"
|
"tinyxml/tinyxml.h"
|
||||||
|
|
||||||
1306649351 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp
|
1306650852 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp
|
||||||
"wx_pch.h"
|
"wx_pch.h"
|
||||||
"version.h"
|
"version.h"
|
||||||
<wx/app.h>
|
<wx/app.h>
|
||||||
@ -7905,7 +7905,7 @@
|
|||||||
"SleepyHeadMain.h"
|
"SleepyHeadMain.h"
|
||||||
"sleeplib/profiles.h"
|
"sleeplib/profiles.h"
|
||||||
|
|
||||||
1306648364 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp
|
1306652144 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp
|
||||||
<wx/settings.h>
|
<wx/settings.h>
|
||||||
<wx/dcbuffer.h>
|
<wx/dcbuffer.h>
|
||||||
<wx/log.h>
|
<wx/log.h>
|
||||||
@ -7951,7 +7951,7 @@
|
|||||||
"machine_loader.h"
|
"machine_loader.h"
|
||||||
"tinyxml/tinyxml.h"
|
"tinyxml/tinyxml.h"
|
||||||
|
|
||||||
1306645407 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.cpp
|
1306650068 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.cpp
|
||||||
<wx/dir.h>
|
<wx/dir.h>
|
||||||
<wx/filename.h>
|
<wx/filename.h>
|
||||||
<wx/ffile.h>
|
<wx/ffile.h>
|
||||||
|
@ -263,14 +263,13 @@ void SleepyHeadFrame::OnImportSD(wxCommandEvent &event)
|
|||||||
int idx=main_auinotebook->GetPageIndex(daily);
|
int idx=main_auinotebook->GetPageIndex(daily);
|
||||||
if (idx!=wxNOT_FOUND) {
|
if (idx!=wxNOT_FOUND) {
|
||||||
daily->RefreshData(m);
|
daily->RefreshData(m);
|
||||||
|
daily->Refresh();
|
||||||
}
|
}
|
||||||
idx=main_auinotebook->GetPageIndex(summary);
|
idx=main_auinotebook->GetPageIndex(summary);
|
||||||
if (idx!=wxNOT_FOUND) {
|
if (idx!=wxNOT_FOUND) {
|
||||||
summary->RefreshData(m);
|
summary->RefreshData(m);
|
||||||
}
|
|
||||||
summary->Refresh();
|
summary->Refresh();
|
||||||
daily->Refresh();
|
}
|
||||||
Refresh();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void SleepyHeadFrame::OnViewMenuDaily( wxCommandEvent& event )
|
void SleepyHeadFrame::OnViewMenuDaily( wxCommandEvent& event )
|
||||||
@ -280,9 +279,13 @@ void SleepyHeadFrame::OnViewMenuDaily( wxCommandEvent& event )
|
|||||||
if (idx==wxNOT_FOUND) {
|
if (idx==wxNOT_FOUND) {
|
||||||
daily=new Daily(this);
|
daily=new Daily(this);
|
||||||
main_auinotebook->AddPage(daily,_("Daily"),true);
|
main_auinotebook->AddPage(daily,_("Daily"),true);
|
||||||
|
if (pref.Exists(wxT("DefaultMachine")))
|
||||||
id=pref["DefaultMachine"].GetInteger();
|
id=pref["DefaultMachine"].GetInteger();
|
||||||
|
else id=0;
|
||||||
|
if (id<cpap_machines.size()) {
|
||||||
Machine *m=cpap_machines[id];
|
Machine *m=cpap_machines[id];
|
||||||
if (m) daily->RefreshData(m);
|
if (m) daily->RefreshData(m);
|
||||||
|
}
|
||||||
daily->Refresh();
|
daily->Refresh();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -298,11 +301,14 @@ void SleepyHeadFrame::OnViewMenuSummary( wxCommandEvent& event )
|
|||||||
if (idx==wxNOT_FOUND) {
|
if (idx==wxNOT_FOUND) {
|
||||||
summary=new Summary(this);
|
summary=new Summary(this);
|
||||||
main_auinotebook->AddPage(summary,_("Summary"),true);
|
main_auinotebook->AddPage(summary,_("Summary"),true);
|
||||||
|
if (pref.Exists(wxT("DefaultMachine")))
|
||||||
id=pref["DefaultMachine"].GetInteger();
|
id=pref["DefaultMachine"].GetInteger();
|
||||||
|
else id=0;
|
||||||
|
if (id<cpap_machines.size()) {
|
||||||
Machine *m=cpap_machines[id];
|
Machine *m=cpap_machines[id];
|
||||||
if (m) summary->RefreshData(m);
|
if (m) summary->RefreshData(m);
|
||||||
|
}
|
||||||
summary->Refresh();
|
summary->Refresh();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
main_auinotebook->SetSelection(idx);
|
main_auinotebook->SetSelection(idx);
|
||||||
}
|
}
|
||||||
@ -317,7 +323,7 @@ Summary::Summary(wxWindow *win)
|
|||||||
|
|
||||||
AddData(ahidata=new HistoryData(machine,days_shown));
|
AddData(ahidata=new HistoryData(machine,days_shown));
|
||||||
AddData(pressure=new HistoryCodeData(machine,CPAP_PressureAverage,days_shown));
|
AddData(pressure=new HistoryCodeData(machine,CPAP_PressureAverage,days_shown));
|
||||||
AddData(leak=new HistoryCodeData(machine,CPAP_LeakAverage,days_shown));
|
AddData(leak=new HistoryCodeData(machine,CPAP_LeakMedian,days_shown));
|
||||||
AddData(usage=new UsageHistoryData(machine,days_shown,UHD_Hours));
|
AddData(usage=new UsageHistoryData(machine,days_shown,UHD_Hours));
|
||||||
AddData(waketime=new UsageHistoryData(machine,days_shown,UHD_Waketime));
|
AddData(waketime=new UsageHistoryData(machine,days_shown,UHD_Waketime));
|
||||||
AddData(bedtime=new UsageHistoryData(machine,days_shown,UHD_Bedtime));
|
AddData(bedtime=new UsageHistoryData(machine,days_shown,UHD_Bedtime));
|
||||||
@ -438,8 +444,8 @@ Daily::Daily(wxWindow *win)
|
|||||||
AddData(prd=new PressureData(CPAP_Pressure));
|
AddData(prd=new PressureData(CPAP_Pressure));
|
||||||
PRD=new gGraphWindow(ScrolledWindow,-1,wxT("Pressure"),wxPoint(0,0), wxSize(600,150), wxNO_BORDER);
|
PRD=new gGraphWindow(ScrolledWindow,-1,wxT("Pressure"),wxPoint(0,0), wxSize(600,150), wxNO_BORDER);
|
||||||
PRD->AddLayer(new gLineChart(prd,wxDARK_GREEN,4096,false));
|
PRD->AddLayer(new gLineChart(prd,wxDARK_GREEN,4096,false));
|
||||||
PRD->AddLayer(new gLineChart(pressure_iap,wxBLUE,4096,false));
|
PRD->AddLayer(new gLineChart(pressure_iap,wxBLUE,4096,false,true));
|
||||||
PRD->AddLayer(new gLineChart(pressure_eap,wxRED,4096,false));
|
PRD->AddLayer(new gLineChart(pressure_eap,wxRED,4096,false,true));
|
||||||
|
|
||||||
AddData(frw=new FlowData());
|
AddData(frw=new FlowData());
|
||||||
FRW=new gGraphWindow(ScrolledWindow,-1,wxT("Flow Rate"),wxPoint(0,0), wxSize(600,150), wxNO_BORDER);
|
FRW=new gGraphWindow(ScrolledWindow,-1,wxT("Flow Rate"),wxPoint(0,0), wxSize(600,150), wxNO_BORDER);
|
||||||
|
@ -458,13 +458,17 @@ double gGraphWindow::MinY()
|
|||||||
//f=false;
|
//f=false;
|
||||||
|
|
||||||
bool first=true;
|
bool first=true;
|
||||||
double val;
|
double val,tmp;
|
||||||
for (auto l=layers.begin();l!=layers.end();l++) {
|
for (auto l=layers.begin();l!=layers.end();l++) {
|
||||||
if (first) {
|
if (first) {
|
||||||
val=(*l)->MinY();
|
val=(*l)->MinY();
|
||||||
|
if (!((val==(*l)->MaxY()) && (val==0)))
|
||||||
first=false;
|
first=false;
|
||||||
} else {
|
} else {
|
||||||
if ((*l)->MinY() < val) val = (*l)->MinY();
|
tmp=(*l)->MinY();
|
||||||
|
if (!((tmp==(*l)->MaxY()) && (tmp==0))) { // Ignore this layer if both are 0
|
||||||
|
if (tmp < val) val = tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return min_y=val;
|
return min_y=val;
|
||||||
@ -476,13 +480,17 @@ double gGraphWindow::MaxY()
|
|||||||
//f=false;
|
//f=false;
|
||||||
|
|
||||||
bool first=true;
|
bool first=true;
|
||||||
double val;
|
double val,tmp;
|
||||||
for (auto l=layers.begin();l!=layers.end();l++) {
|
for (auto l=layers.begin();l!=layers.end();l++) {
|
||||||
if (first) {
|
if (first) {
|
||||||
val=(*l)->MaxY();
|
val=(*l)->MaxY();
|
||||||
|
if (!((val==(*l)->MinY()) && (val==0)))
|
||||||
first=false;
|
first=false;
|
||||||
} else {
|
} else {
|
||||||
if ((*l)->MaxY()>val) val = (*l)->MaxY();
|
tmp=(*l)->MaxY();
|
||||||
|
if (!((tmp==(*l)->MinY()) && (tmp==0))) { // Ignore this layer if both are 0
|
||||||
|
if (tmp > val) val = tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return max_y=val;
|
return max_y=val;
|
||||||
@ -531,13 +539,17 @@ double gGraphWindow::RealMinY()
|
|||||||
//f=false;
|
//f=false;
|
||||||
|
|
||||||
bool first=true;
|
bool first=true;
|
||||||
double val;
|
double val,tmp;
|
||||||
for (auto l=layers.begin();l!=layers.end();l++) {
|
for (auto l=layers.begin();l!=layers.end();l++) {
|
||||||
if (first) {
|
if (first) {
|
||||||
val=(*l)->RealMinY();
|
val=(*l)->RealMinY();
|
||||||
|
if (!((val==(*l)->RealMaxY()) && (val==0)))
|
||||||
first=false;
|
first=false;
|
||||||
} else {
|
} else {
|
||||||
if ((*l)->RealMinY() < val) val = (*l)->RealMinY();
|
tmp=(*l)->RealMinY();
|
||||||
|
if (!((tmp==(*l)->RealMaxY()) && (tmp==0))) { // Ignore this if both are 0
|
||||||
|
if (tmp < val) val = tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rmin_y=val;
|
return rmin_y=val;
|
||||||
@ -549,13 +561,17 @@ double gGraphWindow::RealMaxY()
|
|||||||
//f=false;
|
//f=false;
|
||||||
|
|
||||||
bool first=true;
|
bool first=true;
|
||||||
double val;
|
double val,tmp;
|
||||||
for (auto l=layers.begin();l!=layers.end();l++) {
|
for (auto l=layers.begin();l!=layers.end();l++) {
|
||||||
if (first) {
|
if (first) {
|
||||||
val=(*l)->RealMaxY();
|
val=(*l)->RealMaxY();
|
||||||
|
if (!((val==(*l)->RealMinY()) && (val==0))) // Does this create a loop??
|
||||||
first=false;
|
first=false;
|
||||||
} else {
|
} else {
|
||||||
if ((*l)->RealMaxY()>val) val = (*l)->RealMaxY();
|
tmp=(*l)->RealMaxY();
|
||||||
|
if (!((tmp==(*l)->RealMinY()) && (tmp==0))) { // Ignore this if both are 0
|
||||||
|
if (tmp > val) val = tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rmax_y=val;
|
return rmax_y=val;
|
||||||
@ -998,8 +1014,8 @@ void gBarChart::Plot(wxDC & dc, gGraphWindow & w)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gLineChart::gLineChart(gPointData *d,const wxColor * col,int dlsize,bool a)
|
gLineChart::gLineChart(gPointData *d,const wxColor * col,int dlsize,bool a,bool _hide_axes)
|
||||||
:gLayer(d),m_accelerate(a),m_drawlist_size(dlsize)
|
:gLayer(d),m_accelerate(a),m_drawlist_size(dlsize),m_hide_axes(_hide_axes)
|
||||||
{
|
{
|
||||||
m_drawlist=new wxPoint [dlsize];
|
m_drawlist=new wxPoint [dlsize];
|
||||||
color.clear();
|
color.clear();
|
||||||
@ -1238,7 +1254,6 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w)
|
|||||||
if (yy<=0)
|
if (yy<=0)
|
||||||
return;
|
return;
|
||||||
// assert(xx>=0);
|
// assert(xx>=0);
|
||||||
static wxPoint screen[4096]; // max screen size
|
|
||||||
|
|
||||||
static wxPen pen1(*wxLIGHT_GREY, 1, wxDOT);
|
static wxPen pen1(*wxLIGHT_GREY, 1, wxDOT);
|
||||||
|
|
||||||
@ -1261,8 +1276,10 @@ void gLineChart::Plot(wxDC & dc, gGraphWindow & w)
|
|||||||
dc.DrawLine(start_px+px,start_py+height+8,start_px+px,start_py+height+12);
|
dc.DrawLine(start_px+px,start_py+height+8,start_px+px,start_py+height+12);
|
||||||
dc.DrawLine(start_px+py,start_py+height+8,start_px+py,start_py+height+12);
|
dc.DrawLine(start_px+py,start_py+height+8,start_px+py,start_py+height+12);
|
||||||
|
|
||||||
|
if (!m_hide_axes) {
|
||||||
DrawYTicks(dc,w);
|
DrawYTicks(dc,w);
|
||||||
DrawXTicks(dc,w);
|
DrawXTicks(dc,w);
|
||||||
|
}
|
||||||
|
|
||||||
wxPen pen(*color[0], 1, wxSOLID);
|
wxPen pen(*color[0], 1, wxSOLID);
|
||||||
dc.SetPen(pen);
|
dc.SetPen(pen);
|
||||||
@ -1655,8 +1672,8 @@ void FlowData::Reload(Day *day)
|
|||||||
|
|
||||||
//max_y=t1;
|
//max_y=t1;
|
||||||
//min_y=-t1;
|
//min_y=-t1;
|
||||||
min_y=-100;
|
min_y=-90;
|
||||||
max_y=100;
|
max_y=90;
|
||||||
|
|
||||||
real_min_x=min_x;
|
real_min_x=min_x;
|
||||||
real_min_y=min_y;
|
real_min_y=min_y;
|
||||||
@ -1685,7 +1702,8 @@ void PressureData::Reload(Day *day)
|
|||||||
if (min_x>max_x) {
|
if (min_x>max_x) {
|
||||||
max_x=max_x;
|
max_x=max_x;
|
||||||
}
|
}
|
||||||
max_y=0;
|
min_y=max_y=0;
|
||||||
|
int tt=0;
|
||||||
bool first=true;
|
bool first=true;
|
||||||
for (auto s=day->begin();s!=day->end(); s++) {
|
for (auto s=day->begin();s!=day->end(); s++) {
|
||||||
if ((*s)->events.find(code)==(*s)->events.end()) continue;
|
if ((*s)->events.find(code)==(*s)->events.end()) continue;
|
||||||
@ -1706,16 +1724,17 @@ void PressureData::Reload(Day *day)
|
|||||||
point[vc][t++]=r;
|
point[vc][t++]=r;
|
||||||
assert(t<max_points);
|
assert(t<max_points);
|
||||||
if (first) {
|
if (first) {
|
||||||
min_y=r.y;
|
max_y=min_y=r.y;
|
||||||
first=false;
|
first=false;
|
||||||
} else {
|
} else {
|
||||||
if (r.y<min_y) min_y=r.y;
|
if (r.y<min_y) min_y=r.y;
|
||||||
}
|
|
||||||
if (r.y>max_y) max_y=r.y;
|
if (r.y>max_y) max_y=r.y;
|
||||||
|
}
|
||||||
|
|
||||||
lastp=p;
|
lastp=p;
|
||||||
}
|
}
|
||||||
np[vc]=t;
|
np[vc]=t;
|
||||||
|
tt+=t;
|
||||||
vc++;
|
vc++;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1731,8 +1750,11 @@ void PressureData::Reload(Day *day)
|
|||||||
max_y=ceil(max_y);
|
max_y=ceil(max_y);
|
||||||
}
|
}
|
||||||
} else { */
|
} else { */
|
||||||
|
if (tt>0) {
|
||||||
min_y=floor(min_y);
|
min_y=floor(min_y);
|
||||||
max_y=ceil(max_y+1);
|
max_y=ceil(max_y+1);
|
||||||
|
if (min_y>1) min_y-=1;
|
||||||
|
}
|
||||||
//}
|
//}
|
||||||
|
|
||||||
real_min_x=min_x;
|
real_min_x=min_x;
|
||||||
@ -1761,8 +1783,6 @@ void TAPData::Reload(Day *day)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int max_slots=256;
|
|
||||||
static wxTimeSpan pTime[max_slots];
|
|
||||||
|
|
||||||
for (int i=0;i<max_slots;i++) pTime[i]=wxTimeSpan::Seconds(0);
|
for (int i=0;i<max_slots;i++) pTime[i]=wxTimeSpan::Seconds(0);
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ class gCandleStick:public gLayer
|
|||||||
class gLineChart:public gLayer
|
class gLineChart:public gLayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
gLineChart(gPointData *d=NULL,const wxColor * col=wxBLACK,int dlsize=4096,bool a=false);
|
gLineChart(gPointData *d=NULL,const wxColor * col=wxBLACK,int dlsize=4096,bool a=false,bool _hide_axes=false);
|
||||||
virtual ~gLineChart();
|
virtual ~gLineChart();
|
||||||
|
|
||||||
virtual void Plot(wxDC & dc, gGraphWindow & w);
|
virtual void Plot(wxDC & dc, gGraphWindow & w);
|
||||||
@ -327,6 +327,9 @@ class gLineChart:public gLayer
|
|||||||
wxPoint *m_drawlist;
|
wxPoint *m_drawlist;
|
||||||
bool m_show_grid;
|
bool m_show_grid;
|
||||||
bool m_show_minor_grid;
|
bool m_show_minor_grid;
|
||||||
|
bool m_hide_axes;
|
||||||
|
wxPoint screen[4096]; // max screen pixel width for accelerated plot usage only.
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -402,6 +405,10 @@ public:
|
|||||||
TAPData();
|
TAPData();
|
||||||
virtual ~TAPData();
|
virtual ~TAPData();
|
||||||
virtual void Reload(Day *day=NULL);
|
virtual void Reload(Day *day=NULL);
|
||||||
|
|
||||||
|
static const int max_slots=256;
|
||||||
|
wxTimeSpan pTime[max_slots];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class FlowData:public gPointData
|
class FlowData:public gPointData
|
||||||
|
@ -501,7 +501,7 @@ bool PRS1Loader::Parse002(Session *session,unsigned char *buffer,int size,time_t
|
|||||||
} else if (code==0x03) {
|
} else if (code==0x03) {
|
||||||
data0/=10.0;
|
data0/=10.0;
|
||||||
data1/=10.0;
|
data1/=10.0;
|
||||||
session->AddEvent(new Event(t,CPAP_EAP, {data1,data0}));
|
session->AddEvent(new Event(t,CPAP_EAP, {data1}));
|
||||||
session->AddEvent(new Event(t,CPAP_IAP, {data0}));
|
session->AddEvent(new Event(t,CPAP_IAP, {data0}));
|
||||||
} else {
|
} else {
|
||||||
session->AddEvent(new Event(t,cpapcode, {data0,data1}));
|
session->AddEvent(new Event(t,cpapcode, {data0,data1}));
|
||||||
|
12
version.h
12
version.h
@ -16,14 +16,14 @@ namespace AutoVersion{
|
|||||||
//Standard Version Type
|
//Standard Version Type
|
||||||
static const long MAJOR = 0;
|
static const long MAJOR = 0;
|
||||||
static const long MINOR = 7;
|
static const long MINOR = 7;
|
||||||
static const long BUILD = 1775;
|
static const long BUILD = 1804;
|
||||||
static const long REVISION = 4252;
|
static const long REVISION = 4413;
|
||||||
|
|
||||||
//Miscellaneous Version Types
|
//Miscellaneous Version Types
|
||||||
static const long BUILDS_COUNT = 6021;
|
static const long BUILDS_COUNT = 6086;
|
||||||
#define RC_FILEVERSION 0,7,1775,4252
|
#define RC_FILEVERSION 0,7,1804,4413
|
||||||
#define RC_FILEVERSION_STRING "0, 7, 1775, 4252\0"
|
#define RC_FILEVERSION_STRING "0, 7, 1804, 4413\0"
|
||||||
static const char FULLVERSION_STRING[] = "0.7.1775.4252";
|
static const char FULLVERSION_STRING[] = "0.7.1804.4413";
|
||||||
|
|
||||||
//These values are to keep track of your versioning state, don't modify them.
|
//These values are to keep track of your versioning state, don't modify them.
|
||||||
static const long BUILD_HISTORY = 62;
|
static const long BUILD_HISTORY = 62;
|
||||||
|
Loading…
Reference in New Issue
Block a user