NITE 1.5.1 - API Reference

XnVMultiItemHysteresis2D.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_MULTI_ITEM_HYSTERESIS_2D_H_
00010 #define _XNV_MULTI_ITEM_HYSTERESIS_2D_H_
00011 
00012 #include "XnVNiteDefs.h"
00013 
00014 class XnVSigmoid;
00015 class XnVPointBuffer;
00016 class XnVIntIntSpecificEvent;
00028 class XNV_NITE_API XnVMultiItemHysteresis2D
00029 {
00030 public:
00034     typedef void (XN_CALLBACK_TYPE *ItemSelectCB)(XnInt32 ItemXIndex, XnInt32 ItemYIndex, void* pUserCxt);
00035 
00044     XnVMultiItemHysteresis2D(XnInt32 nItemXCount, XnInt32 nItemYCount,
00045         XnFloat fBorderWidth = 0,
00046         XnFloat fHysteresisRatio = ms_fDefaultHysteresisRatio);
00047 
00048     ~XnVMultiItemHysteresis2D();
00049 
00054     XnStatus Update(XnFloat fXValue, XnFloat fYValue);
00058     void LostPoint();
00059 
00066     void ItemSelected(XnInt32 nItemXIndex, XnInt32 nItemYIndex);
00067 
00076     XnCallbackHandle RegisterItemSelect(void* cxt, ItemSelectCB pCB);
00082     void UnregisterItemSelect(XnCallbackHandle handle);
00083 
00089     XnUInt32 GetItemXCount() const;
00095     void SetItemXCount(XnUInt32 nItemXCount);
00101     XnUInt32 GetItemYCount() const;
00107     void SetItemYCount(XnUInt32 nItemYCount);
00108 
00115     void SetItemCount(XnUInt32 nItemXCount, XnUInt32 nItemYCount);
00116 
00122     XnFloat GetMinXValue() const;
00128     XnFloat GetMinYValue() const;
00134     XnFloat GetMaxYValue() const;
00140     XnFloat GetMaxXValue() const;
00141 
00147     XnFloat GetBorderWidth() const;
00153     XnStatus SetBorderWidth(XnFloat fWidth);
00154 
00160     XnFloat GetHysteresisRatio() const;
00161 
00162     void SetHysteresisRatio(XnFloat fRatio);
00163 
00164     static const XnFloat ms_fDefaultHysteresisRatio;    // = 0.5f
00165 protected:
00166     void CalculateMinAndMax();
00167 
00168     XnBool IsValueInRange(XnFloat fXValue, XnFloat fYValue);
00169 
00170     XnUInt32 m_nItemXCount;
00171     XnUInt32 m_nItemYCount;
00172 
00173     XnFloat m_fMinXValue, m_fMaxXValue;
00174     XnFloat m_fMinYValue, m_fMaxYValue;
00175 
00176     XnInt32 m_nLastSelectedXIndex;
00177     XnInt32 m_nLastSelectedYIndex;
00178 
00179     XnFloat m_fBorderWidth;
00180 
00181     XnFloat m_fHysteresisRatio;
00182 
00183     XnVIntIntSpecificEvent* m_pItemSelectCBs;
00184 }; // XnVMultiItem2DController
00185 
00186 #endif // _XNV_MULTI_ITEM_HYSTERESIS_1D_H_