tagging release
[dasher.git] / Src / DasherCore / UserLocation.h
blobc1b240f64a45c660673255843617882ecf301097
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 "FileLogger.h"
14 #include <string>
15 #include <time.h>
16 #include "TimeSpan.h"
17 #include <math.h>
18 #include "XMLUtil.h"
20 using namespace std;
22 extern CFileLogger* g_pLogger;
24 class CUserLocation;
26 typedef vector<CUserLocation> VECTOR_USER_LOCATION;
27 typedef vector<CUserLocation>::iterator VECTOR_USER_LOCATION_ITER;
28 typedef vector<CUserLocation*> VECTOR_USER_LOCATION_PTR;
29 typedef vector<CUserLocation*>::iterator VECTOR_USER_LOCATION_PTR_ITER;
31 /// \ingroup Logging
32 /// @{
33 class CUserLocation
35 public:
36 CUserLocation(int iX, int iY, float dNats);
37 CUserLocation(float iX, float iY, float dNats);
38 CUserLocation(int iX1, int iY1, float iX2, float iY2, float dNats);
39 CUserLocation(int iX, int iY, int iTop, int iLeft, int iBottom, int iRight, bool bStoreIntegerRep, float dNats);
40 ~CUserLocation();
42 string GetXML(const string& strPrefix = "");
43 static double ComputeNormalizedX(int iX, int iLeft, int iRight);
44 static double ComputeNormalizedY(int iY, int iTop, int iBottom);
46 // Used when we want to post-process a XML log file:
47 CUserLocation(const string& strXML);
48 string GetTabMouseXY(bool bReturnNormalized);
49 void GetMouseGridLocation(int iGridSize, int* pRow, int* pCol);
51 private:
52 string m_strTime;
53 int m_iLocationX;
54 int m_iLocationY;
55 float m_dNormalizedLocationX;
56 float m_dNormalizedLocationY;
57 bool m_bHasNormalized; // Are we storing a normalized representation?
58 bool m_bHasInteger; // Are we storing an integer representation?
59 float m_dNats;
61 void InitMemeberVars();
63 /// @}
65 #endif