This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
PointDrawer.h
91 lines (80 loc) · 2.86 KB
/
PointDrawer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/****************************************************************************
* *
* Nite 1.3 - Point Viewer *
* *
* Author: Oz Magal *
* *
****************************************************************************/
/****************************************************************************
* *
* Nite 1.3 *
* Copyright (C) 2006 PrimeSense Ltd. All Rights Reserved. *
* *
* This file has been provided pursuant to a License Agreement containing *
* restrictions on its use. This data contains valuable trade secrets *
* and proprietary information of PrimeSense Ltd. and is protected by law. *
* *
****************************************************************************/
#ifndef XNV_POINT_DRAWER_H_
#define XNV_POINT_DRAWER_H_
#include <map>
#include <list>
#include <XnCppWrapper.h>
#include <XnVPointControl.h>
typedef enum
{
IN_SESSION,
NOT_IN_SESSION,
QUICK_REFOCUS
} SessionState;
void PrintSessionState(SessionState eState);
/**
* This is a point control, which stores the history of every point
* It can draw all the points as well as the depth map.
*/
class XnVPointDrawer : public XnVPointControl
{
public:
XnVPointDrawer(XnUInt32 nHistorySize, xn::DepthGenerator depthGenerator);
virtual ~XnVPointDrawer();
/**
* Handle a new message.
* Calls other callbacks for each point, then draw the depth map (if needed) and the points
*/
void Update(XnVMessage* pMessage);
/**
* Handle creation of a new point
*/
void OnPointCreate(const XnVHandPointContext* cxt);
/**
* Handle new position of an existing point
*/
void OnPointUpdate(const XnVHandPointContext* cxt);
/**
* Handle destruction of an existing point
*/
void OnPointDestroy(XnUInt32 nID);
/**
* Draw the points, each with its own color.
*/
void Draw() const;
/**
* Change mode - should draw the depth map?
*/
void SetDepthMap(XnBool bDrawDM);
/**
* Change mode - print out the frame id
*/
void SetFrameID(XnBool bFrameID);
protected:
// Number of previous position to store for each hand
XnUInt32 m_nHistorySize;
// previous positions per hand
std::map<XnUInt32, std::list<XnPoint3D> > m_History;
// Source of the depth map
xn::DepthGenerator m_DepthGenerator;
XnFloat* m_pfPositionBuffer;
XnBool m_bDrawDM;
XnBool m_bFrameID;
};
#endif