Summary Tab Average Calculations now Date Dependant

This commit is contained in:
Mark Watkins 2011-06-04 13:18:11 +10:00
parent 507f0bb067
commit 77a8142878
5 changed files with 34 additions and 21 deletions

View File

@ -7877,7 +7877,7 @@
<sleeplib/machine.h> <sleeplib/machine.h>
<list> <list>
1307155688 /home/mark/projects/git/sleepyhead/version.h 1307157388 /home/mark/projects/git/sleepyhead/version.h
1306724655 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h 1306724655 /home/mark/projects/git/sleepyhead/libs/sleeplib/prs1_loader.h
"machine.h" "machine.h"
@ -7894,7 +7894,7 @@
"preferences.h" "preferences.h"
"tinyxml/tinyxml.h" "tinyxml/tinyxml.h"
1307154989 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp 1307157388 source:/home/mark/projects/git/sleepyhead/SleepyHeadMain.cpp
"wx_pch.h" "wx_pch.h"
"version.h" "version.h"
<wx/app.h> <wx/app.h>
@ -7913,7 +7913,7 @@
"sleeplib/profiles.h" "sleeplib/profiles.h"
"sleeplib/machine_loader.h" "sleeplib/machine_loader.h"
1307151759 source:/home/mark/projects/git/sleepyhead/graphs/graph.cpp 1307157064 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>
@ -7928,7 +7928,7 @@
<wx/ffile.h> <wx/ffile.h>
<wx/utils.h> <wx/utils.h>
1307153428 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/machine.cpp 1307156731 source:/home/mark/projects/git/sleepyhead/libs/sleeplib/machine.cpp
<tr1/random> <tr1/random>
<wx/colour.h> <wx/colour.h>
<wx/log.h> <wx/log.h>

View File

@ -408,7 +408,7 @@ void Summary::ResetProfile(Profile *p)
} }
void Summary::RefreshData() void Summary::RefreshData()
{ {
wxDateTime first=StartDatePicker->GetValue(); wxDateTime first=StartDatePicker->GetValue()-wxTimeSpan::Day();
wxDateTime last=EndDatePicker->GetValue(); wxDateTime last=EndDatePicker->GetValue();
for (list<HistoryData *>::iterator h=Data.begin();h!=Data.end();h++) { for (list<HistoryData *>::iterator h=Data.begin();h!=Data.end();h++) {
@ -515,26 +515,30 @@ void Summary::OnRBSelect( wxCommandEvent& event )
StartDatePicker->SetValue(start); StartDatePicker->SetValue(start);
EndDatePicker->SetValue(end); EndDatePicker->SetValue(end);
for (list<HistoryData *>::iterator h=Data.begin();h!=Data.end();h++) { RefreshData();
/*for (list<HistoryData *>::iterator h=Data.begin();h!=Data.end();h++) {
(*h)->SetDateRange(start-wxTimeSpan::Day(),end); (*h)->SetDateRange(start-wxTimeSpan::Day(),end);
} } */
} }
void Summary::OnStartDateChanged( wxDateEvent& event ) void Summary::OnStartDateChanged( wxDateEvent& event )
{ {
RefreshData();
/*
wxDateTime start=StartDatePicker->GetValue()-wxTimeSpan::Days(2); wxDateTime start=StartDatePicker->GetValue()-wxTimeSpan::Days(2);
wxDateTime end=EndDatePicker->GetValue()-wxTimeSpan::Day(); wxDateTime end=EndDatePicker->GetValue()-wxTimeSpan::Day();
for (list<HistoryData *>::iterator h=Data.begin();h!=Data.end();h++) { for (list<HistoryData *>::iterator h=Data.begin();h!=Data.end();h++) {
(*h)->SetDateRange(start,end); (*h)->SetDateRange(start,end);
} } */
} }
void Summary::OnEndDateChanged( wxDateEvent& event ) void Summary::OnEndDateChanged( wxDateEvent& event )
{ {
wxDateTime start=StartDatePicker->GetValue()-wxTimeSpan::Days(2); RefreshData();
/*wxDateTime start=StartDatePicker->GetValue()-wxTimeSpan::Days(2);
wxDateTime end=EndDatePicker->GetValue()-wxTimeSpan::Day(); wxDateTime end=EndDatePicker->GetValue()-wxTimeSpan::Day();
for (list<HistoryData *>::iterator h=Data.begin();h!=Data.end();h++) { for (list<HistoryData *>::iterator h=Data.begin();h!=Data.end();h++) {
(*h)->SetDateRange(start,end); (*h)->SetDateRange(start,end);
} } */
} }
void Summary::OnClose(wxCloseEvent &event) void Summary::OnClose(wxCloseEvent &event)
{ {
@ -711,6 +715,9 @@ void Daily::OnEventTreeSelection( wxTreeEvent& event )
double st=(d-wxTimeSpan::Seconds(180)).GetMJD(); double st=(d-wxTimeSpan::Seconds(180)).GetMJD();
double et=(d+wxTimeSpan::Seconds(180)).GetMJD(); double et=(d+wxTimeSpan::Seconds(180)).GetMJD();
FRW->SetXBounds(st,et); FRW->SetXBounds(st,et);
SF->SetXBounds(st,et);
PRD->SetXBounds(st,et);
LEAK->SetXBounds(st,et);
wxLogMessage(wxT("Tree Selected:")+d.Format()); wxLogMessage(wxT("Tree Selected:")+d.Format());
} }
} }

View File

@ -1939,12 +1939,16 @@ void HistoryData::Reload(Day *day)
} }
double HistoryData::GetAverage() double HistoryData::GetAverage()
{ {
double val=0; double x,val=0;
int cnt=0;
for (int i=0;i<np[0];i++) { for (int i=0;i<np[0];i++) {
x=point[0][i].x;
if ((x<min_x) || (x>max_x)) continue;
val+=point[0][i].y; val+=point[0][i].y;
cnt++;
} }
if (!np[0]) return 0; if (!cnt) return 0;
val/=np[0]; val/=cnt;
return val; return val;
} }
void HistoryData::SetDateRange(wxDateTime start,wxDateTime end) void HistoryData::SetDateRange(wxDateTime start,wxDateTime end)

View File

@ -140,8 +140,10 @@ void InitMapsWithoutAwesomeInitializerLists()
DefaultMCLongNames[PRS1_VSnore2]=wxT("Vibratory Snore 2"); DefaultMCLongNames[PRS1_VSnore2]=wxT("Vibratory Snore 2");
DefaultMCLongNames[PRS1_PressurePulse]=wxT("Pressue Pulse"); DefaultMCLongNames[PRS1_PressurePulse]=wxT("Pressue Pulse");
DefaultMCLongNames[PRS1_Unknown0E]=wxT("Unknown 0E"); DefaultMCLongNames[PRS1_Unknown0E]=wxT("Unknown 0E");
DefaultMCLongNames[PRS1_Unknown00]=wxT("Unknown 00");
DefaultMCLongNames[PRS1_Unknown01]=wxT("Unknown 01");
DefaultMCLongNames[PRS1_Unknown0B]=wxT("Unknown 0B");
DefaultMCLongNames[PRS1_Unknown10]=wxT("Unknown 10");
} }

View File

@ -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 = 3053; static const long BUILD = 3059;
static const long REVISION = 11270; static const long REVISION = 11307;
//Miscellaneous Version Types //Miscellaneous Version Types
static const long BUILDS_COUNT = 8956; static const long BUILDS_COUNT = 8974;
#define RC_FILEVERSION 0,7,3053,11270 #define RC_FILEVERSION 0,7,3059,11307
#define RC_FILEVERSION_STRING "0, 7, 3053, 11270\0" #define RC_FILEVERSION_STRING "0, 7, 3059, 11307\0"
static const char FULLVERSION_STRING[] = "0.7.3053.11270"; static const char FULLVERSION_STRING[] = "0.7.3059.11307";
//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;