ToolMap
Loading...
Searching...
No Matches
tmstats.h
1/***************************************************************************
2 tmstats.h
3 -------------------
4 copyright : (C) 2011 CREALP Lucien Schreiber
5 ***************************************************************************/
6
7/***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef _TMSTATS_H
17#define _TMSTATS_H
18
19#include <wx/wxprec.h>
20
21#ifndef WX_PRECOMP
22#include <wx/wx.h>
23#endif
24
25#include <wx/busyinfo.h>
26#include <wx/wupdlock.h>
27
28class DataBaseTM;
29
30/***************************************************************************/
36 public:
37 long m_Id;
38 wxDateTime m_TimeStart;
39 long m_NbClick;
40 long m_NbAttribution;
41 long m_NbIntersection;
42 wxTimeSpan m_TimeElapsed;
43
45
46 virtual ~tmStatsData();
47
48 void Reset();
49
50 void ResetPartial();
51
52 bool IsOk() const;
53};
54
55/***************************************************************************/
61 private:
62 tmStatsData m_StatBufferData;
63 DataBaseTM* m_Database;
64 bool m_IsStarted;
65 static const int m_BufferSize = 50;
66
67 void _FlushBuffer();
68
69 void _StartRecord();
70
71 void _StopRecord();
72
73 // void OnGetStatsMessage(wxCommandEvent & event);
74
75 public:
77
78 virtual ~tmStatsManager();
79
80 void Create(DataBaseTM* database);
81
82 bool IsReady();
83
84 void AppendToBuffer(long click, long attrib, long intersection);
85
86 void ShowStatsDialog(wxWindow* parent);
87};
88
89/***************************************************************************/
94class tmStats_DLG : public wxDialog {
95 private:
96 // controls
97 wxStaticBoxSizer* m_SessionSizerCtrl;
98 wxStaticText* m_SessionClickCtrl;
99 wxStaticText* m_SessionAttribCtrl;
100 wxStaticText* m_SessionIntersectCtrl;
101 wxStaticText* m_SessionElapsedTimeCtrl;
102 wxStaticBoxSizer* m_TotalSizerCtrl;
103 wxStaticText* m_TotalClickCtrl;
104 wxStaticText* m_TotalAttribCtrl;
105 wxStaticText* m_TotalIntersectCtrl;
106 wxStaticText* m_TotalElapsedTimeCtrl;
107 wxButton* m_BtnStartCtrl;
108 wxButton* m_BtnStopCtrl;
109 wxButton* m_BtnExportCtrl;
110 wxButton* m_BtnCloseCtrl;
111
112 const tmStatsData* m_DataActual;
113 const tmStatsData* m_DataTotal;
114 long m_DataTotalRecord;
115 DataBaseTM* m_Database;
116
117 void OnRecordStart(wxCommandEvent& event);
118
119 void OnRecordStop(wxCommandEvent& event);
120
121 void OnExport(wxCommandEvent& event);
122
123 void _CreateControls();
124
125 void _UpdateControls();
126
127 DECLARE_EVENT_TABLE();
128
129 public:
130 tmStats_DLG(wxWindow* parent, const tmStatsData* actual, const tmStatsData* total, long nbrecords,
131 DataBaseTM* database, wxWindowID id = wxID_ANY, const wxString& title = _("Statistics"),
132 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
133 long style = wxDEFAULT_DIALOG_STYLE);
134
135 virtual ~tmStats_DLG();
136
137 void SetStarted(bool recordstarted);
138};
139
140#endif
Definition database_tm.h:80
Statistics data class.
Definition tmstats.h:35
Statistics manager, link event to data and database records.
Definition tmstats.h:60
Statistics dialog.
Definition tmstats.h:94