tagging release
[dasher.git] / trunk / Src / DasherCore / UserLocation.h
blobef4cd8566dca3a4c9a7dffb7bd8f5c89404641ef
2 // Keeps track of the user's mouse location at a certain point in time.
3 //
4 // Can store a integer x, y coordinate and/or a normalized floating
5 // point x, y pair where (1.0, 1.0) is the lower right corener of the
6 // window.
7 //
8 // Copyright 2005 by Keith Vertanen
10 #ifndef __USER_LOCATION_H__
11 #define __USER_LOCATION_H__
13 #include <cstdlib>
14 #include "FileLogger.h"
15 #include <string>
16 #include <time.h>
17 #include "TimeSpan.h"
18 #include <math.h>
19 #include "XMLUtil.h"
21 using namespace std;
23 extern CFileLogger* g_pLogger;
25 class CUserLocation;
27 typedef vector<CUserLocation> VECTOR_USER_LOCATION;
28 typedef vector<CUserLocation>::iterator VECTOR_USER_LOCATION_ITER;
29 typedef vector<CUserLocation*> VECTOR_USER_LOCATION_PTR;
30 typedef vector<CUserLocation*>::iterator VECTOR_USER_LOCATION_PTR_ITER;
32 /// \ingroup Logging
33 /// @{
34 class CUserLocation
36 public:
37 CUserLocation(int iX, int iY, float dNats);
38 CUserLocation(float iX, float iY, float dNats);
39 CUserLocation(int iX1, int iY1, float iX2, float iY2, float dNats);
40 CUserLocation(int iX, int iY, int iTop, int iLeft, int iBottom, int iRight, bool bStoreIntegerRep, float dNats);
41 ~CUserLocation();
43 string GetXML(const string& strPrefix = "");
44 static double ComputeNormalizedX(int iX, int iLeft, int iRight);
45 static double ComputeNormalizedY(int iY, int iTop, int iBottom);
47 // Used when we want to post-process a XML log file:
48 CUserLocation(const string& strXML);
49 string GetTabMouseXY(bool bReturnNormalized);
50 void GetMouseGridLocation(int iGridSize, int* pRow, int* pCol);
52 private:
53 string m_strTime;
54 int m_iLocationX;
55 int m_iLocationY;
56 float m_dNormalizedLocationX;
57 float m_dNormalizedLocationY;
58 bool m_bHasNormalized; // Are we storing a normalized representation?
59 bool m_bHasInteger; // Are we storing an integer representation?
60 float m_dNats;
62 void InitMemeberVars();
64 /// @}
66 #endif