NITE 1.5.1 - API Reference

XnVPointControl.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 *                                                                              *
00003 *   PrimeSense NITE 1.3                                                        *
00004 *   Copyright (C) 2010 PrimeSense Ltd.                                         *
00005 *                                                                              *
00006 *******************************************************************************/
00007 
00008 
00009 #ifndef _XNV_POINT_CONTROL_H_
00010 #define _XNV_POINT_CONTROL_H_
00011 
00012 #include "XnVMessageListener.h"
00013 #include "XnVMultipleHands.h"
00014 
00015 class XnEvent;
00016 class XnVHandPointContextSpecificEvent;
00017 class XnVMultipleHandsSpecificEvent;
00018 class XnVHandPointContextPointSpecificEvent;
00019 class XnVUintHandPointContextSpecificEvent;
00020 class XnVUintSpecificEvent;
00021 
00026 class XNV_NITE_API XnVPointControl :
00027     public XnVMessageListener
00028 {
00029 public:
00033     typedef void (XN_CALLBACK_TYPE*PointCreateCB)(const XnVHandPointContext* pContext, void* cxt);
00037     typedef void (XN_CALLBACK_TYPE*PointUpdateCB)(const XnVHandPointContext* pContext, void* cxt);
00041     typedef void (XN_CALLBACK_TYPE*PointDestroyCB)(XnUInt32 nID, void* cxt);
00042 
00046     typedef void (XN_CALLBACK_TYPE*PrimaryPointCreateCB)(const XnVHandPointContext* pContext, const XnPoint3D& ptFocus, void* cxt);
00050     typedef void (XN_CALLBACK_TYPE*PrimaryPointUpdateCB)(const XnVHandPointContext* pContext, void* cxt);
00054     typedef void (XN_CALLBACK_TYPE*PrimaryPointReplaceCB)(XnUInt32 nOldId, const XnVHandPointContext* pContext, void* cxt);
00058     typedef void (XN_CALLBACK_TYPE*PrimaryPointDestroyCB)(XnUInt32 nID, void* cxt);
00059 
00060     typedef void (XN_CALLBACK_TYPE*NoPointsCB)(void* cxt);
00061 
00065     typedef void (XN_CALLBACK_TYPE*HandsUpdateCB)(const XnVMultipleHands& mh, void* cxt);
00066 
00072     XnVPointControl(const XnChar* strName = "XnVPointControl");
00073     ~XnVPointControl();
00077     void Update(XnVMessage* pMessage);
00081     virtual void Update(const XnVMultipleHands& hands);
00082 
00088     virtual void OnPointCreate(const XnVHandPointContext* pContext) {}
00094     virtual void OnPointUpdate(const XnVHandPointContext* pContext) {}
00100     virtual void OnPointDestroy(XnUInt32 nID) {}
00101 
00108     virtual void OnPrimaryPointCreate(const XnVHandPointContext* pContext, const XnPoint3D& ptSessionStarter) {}
00114     virtual void OnPrimaryPointUpdate(const XnVHandPointContext* pContext) {}
00121     virtual void OnPrimaryPointReplace(XnUInt32 nOldId, const XnVHandPointContext* pContext) {}
00127     virtual void OnPrimaryPointDestroy(XnUInt32 nID) {}
00128 
00132     virtual void OnNoPoints() {}
00133 
00142     XnCallbackHandle RegisterPointCreate(void* cxt, PointCreateCB CB);
00151     XnCallbackHandle RegisterPointUpdate(void* cxt, PointUpdateCB CB);
00160     XnCallbackHandle RegisterPointDestroy(void* cxt, PointDestroyCB CB);
00161 
00170     XnCallbackHandle RegisterPrimaryPointCreate(void* cxt, PrimaryPointCreateCB CB);
00179     XnCallbackHandle RegisterPrimaryPointUpdate(void* cxt, PrimaryPointUpdateCB CB);
00188     XnCallbackHandle RegisterPrimaryPointReplace(void* cxt, PrimaryPointReplaceCB CB);
00197     XnCallbackHandle RegisterPrimaryPointDestroy(void* cxt, PrimaryPointDestroyCB CB);
00206     XnCallbackHandle RegisterNoPoints(void* cxt, NoPointsCB CB);
00207 
00216     XnCallbackHandle RegisterHandsUpdate(void* cxt, HandsUpdateCB CB);
00217 
00223     void UnregisterPointCreate(XnCallbackHandle hCB);
00229     void UnregisterPointUpdate(XnCallbackHandle hCB);
00235     void UnregisterPointDestroy(XnCallbackHandle hCB);
00236 
00242     void UnregisterPrimaryPointCreate(XnCallbackHandle hCB);
00248     void UnregisterPrimaryPointUpdate(XnCallbackHandle hCB);
00254     void UnregisterPrimaryPointReplace(XnCallbackHandle hCB);
00260     void UnregisterPrimaryPointDestroy(XnCallbackHandle hCB);
00266     void UnregisterNoPoints(XnCallbackHandle hCB);
00267 
00273     void UnregisterHandsUpdate(XnCallbackHandle hCB);
00274 
00280     XnUInt32 GetPrimaryID() const;
00281 private:
00282     XnVHandPointContextSpecificEvent* m_pPointCreateCBs;
00283     XnVHandPointContextSpecificEvent* m_pPointUpdateCBs;
00284     XnVUintSpecificEvent* m_pPointDestroyCBs;
00285 
00286     XnVHandPointContextPointSpecificEvent* m_pPrimaryPointCreateCBs;
00287     XnVHandPointContextSpecificEvent* m_pPrimaryPointUpdateCBs;
00288     XnVUintHandPointContextSpecificEvent* m_pPrimaryPointReplaceCBs;
00289     XnVUintSpecificEvent* m_pPrimaryPointDestroyCBs;
00290 
00291     XnVEvent* m_pNoPointsCBs;
00292 
00293     XnVMultipleHandsSpecificEvent* m_pHandsUpdateCBs;
00294 
00295     XnUInt32 m_nPrimaryID;
00296 protected:
00297     XnUInt32 m_nOverridePrimary;
00298 };
00299 
00300 #endif