Go to the documentation of this file.00001
00002
00003
00004
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
00019 class XNV_NITE_API XnVPointControl :
00020 public XnVMessageListener
00021 {
00022 public:
00026 typedef void (XN_CALLBACK_TYPE*PointCreateCB)(const XnVHandPointContext* pContext, void* cxt);
00030 typedef void (XN_CALLBACK_TYPE*PointUpdateCB)(const XnVHandPointContext* pContext, void* cxt);
00034 typedef void (XN_CALLBACK_TYPE*PointDestroyCB)(XnUInt32 nID, void* cxt);
00035
00039 typedef void (XN_CALLBACK_TYPE*PrimaryPointCreateCB)(const XnVHandPointContext* pContext, const XnPoint3D& ptFocus, void* cxt);
00043 typedef void (XN_CALLBACK_TYPE*PrimaryPointUpdateCB)(const XnVHandPointContext* pContext, void* cxt);
00047 typedef void (XN_CALLBACK_TYPE*PrimaryPointReplaceCB)(XnUInt32 nOldId, const XnVHandPointContext* pContext, void* cxt);
00051 typedef void (XN_CALLBACK_TYPE*PrimaryPointDestroyCB)(XnUInt32 nID, void* cxt);
00052
00053 typedef void (XN_CALLBACK_TYPE*NoPointsCB)(void* cxt);
00054
00058 typedef void (XN_CALLBACK_TYPE*HandsUpdateCB)(const XnVMultipleHands& mh, void* cxt);
00059
00065 XnVPointControl(const XnChar* strName = "XnVPointControl");
00066 ~XnVPointControl();
00070 void Update(XnVMessage* pMessage);
00074 virtual void Update(const XnVMultipleHands& hands);
00075
00081 virtual void OnPointCreate(const XnVHandPointContext* pContext) {}
00087 virtual void OnPointUpdate(const XnVHandPointContext* pContext) {}
00093 virtual void OnPointDestroy(XnUInt32 nID) {}
00094
00101 virtual void OnPrimaryPointCreate(const XnVHandPointContext* pContext, const XnPoint3D& ptSessionStarter) {}
00107 virtual void OnPrimaryPointUpdate(const XnVHandPointContext* pContext) {}
00114 virtual void OnPrimaryPointReplace(XnUInt32 nOldId, const XnVHandPointContext* pContext) {}
00120 virtual void OnPrimaryPointDestroy(XnUInt32 nID) {}
00121
00125 virtual void OnNoPoints() {}
00126
00135 XnCallbackHandle RegisterPointCreate(void* cxt, PointCreateCB CB);
00144 XnCallbackHandle RegisterPointUpdate(void* cxt, PointUpdateCB CB);
00153 XnCallbackHandle RegisterPointDestroy(void* cxt, PointDestroyCB CB);
00154
00163 XnCallbackHandle RegisterPrimaryPointCreate(void* cxt, PrimaryPointCreateCB CB);
00172 XnCallbackHandle RegisterPrimaryPointUpdate(void* cxt, PrimaryPointUpdateCB CB);
00181 XnCallbackHandle RegisterPrimaryPointReplace(void* cxt, PrimaryPointReplaceCB CB);
00190 XnCallbackHandle RegisterPrimaryPointDestroy(void* cxt, PrimaryPointDestroyCB CB);
00199 XnCallbackHandle RegisterNoPoints(void* cxt, NoPointsCB CB);
00200
00209 XnCallbackHandle RegisterHandsUpdate(void* cxt, HandsUpdateCB CB);
00210
00216 void UnregisterPointCreate(XnCallbackHandle hCB);
00222 void UnregisterPointUpdate(XnCallbackHandle hCB);
00228 void UnregisterPointDestroy(XnCallbackHandle hCB);
00229
00235 void UnregisterPrimaryPointCreate(XnCallbackHandle hCB);
00241 void UnregisterPrimaryPointUpdate(XnCallbackHandle hCB);
00247 void UnregisterPrimaryPointReplace(XnCallbackHandle hCB);
00253 void UnregisterPrimaryPointDestroy(XnCallbackHandle hCB);
00259 void UnregisterNoPoints(XnCallbackHandle hCB);
00260
00266 void UnregisterHandsUpdate(XnCallbackHandle hCB);
00267
00273 XnUInt32 GetPrimaryID() const;
00274 private:
00275 XN_DECLARE_EVENT_1ARG(XnVHandPointContextSpecificEvent, XnVHandPointContextEvent, const XnVHandPointContext*, pContext);
00276 XN_DECLARE_EVENT_1ARG(XnVMultipleHandsSpecificEvent, XnVMultipleHandsEvent, const XnVMultipleHands&, pContext);
00277
00278 XN_DECLARE_EVENT_2ARG(XnVHandPointContextPointSpecificEvent, XnVHandPointContextPointEvent, const XnVHandPointContext*, pContext, const XnPoint3D&, ptPos);
00279 XN_DECLARE_EVENT_2ARG(XnVUintHandPointContextSpecificEvent, XnVUintHandPointContextEvent, XnUInt32, nValue, const XnVHandPointContext*, pContext);
00280
00281 XnVHandPointContextSpecificEvent m_PointCreateCBs;
00282 XnVHandPointContextSpecificEvent m_PointUpdateCBs;
00283 XnVUintSpecificEvent m_PointDestroyCBs;
00284
00285 XnVHandPointContextPointSpecificEvent m_PrimaryPointCreateCBs;
00286 XnVHandPointContextSpecificEvent m_PrimaryPointUpdateCBs;
00287 XnVUintHandPointContextSpecificEvent m_PrimaryPointReplaceCBs;
00288 XnVUintSpecificEvent m_PrimaryPointDestroyCBs;
00289
00290 XnVEvent m_NoPointsCBs;
00291
00292 XnVMultipleHandsSpecificEvent m_HandsUpdateCBs;
00293
00294 XnUInt32 m_nPrimaryID;
00295 protected:
00296 XnUInt32 m_nOverridePrimary;
00297 };
00298
00299 #endif