NITE 1.5.1 - API Reference

XnVMultiItemHysteresis1D.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_1D_H_
00010 #define _XNV_MULTI_ITEM_HYSTERESIS_1D_H_
00011 
00012 #include "XnVNiteDefs.h"
00013 
00014 class XnVIntSpecificEvent;
00025 class XNV_NITE_API XnVMultiItemHysteresis1D
00026 {
00027 public:
00031     typedef void (XN_CALLBACK_TYPE *ItemSelectedCB)(XnInt32 ItemIndex, void* pUserCxt);
00032 
00040     XnVMultiItemHysteresis1D(XnInt32 nItemCount, XnFloat fBorderWidth = 0,
00041         XnFloat fHysteresisRatio = ms_fDefaultHysteresisRatio);
00042 
00043     ~XnVMultiItemHysteresis1D();
00044 
00048     XnStatus Update(XnFloat Value);
00052     void LostPoint();
00053 
00059     void ItemSelect(XnInt32 nItemIndex);
00060 
00069     XnCallbackHandle RegisterItemSelect(void* cxt, ItemSelectedCB pCB);
00075     void UnregisterItemSelect(XnCallbackHandle handle);
00076 
00082     XnFloat GetBorderWidth() const;
00088     XnStatus SetBorderWidth(XnFloat fWidth);
00089 
00095     XnUInt32 GetItemCount() const;
00101     void SetItemCount(XnUInt32 nCount);
00102 
00108     XnFloat GetMinValue() const;
00114     XnFloat GetMaxValue() const;
00115 
00121     XnFloat GetHysteresisRatio() const;
00122 
00128     void SetHysteresisRatio(XnFloat fRatio);
00129     static const XnFloat ms_fDefaultHysteresisRatio;    // = 0.5f
00130 protected:
00131     void CalculateMinAndMax();
00132     bool IsValueInRange(XnFloat Value);
00133 
00134 
00135     XnUInt32 m_nItemCount;
00136     XnFloat m_fMinValue;
00137     XnFloat m_fMaxValue;
00138 
00139     XnInt32 m_nLastSelectedIndex;
00140 
00141     XnFloat m_fBorderWidth;
00142     XnFloat m_fHysteresisRatio;
00143 
00144     XnVIntSpecificEvent* m_pItemSelectCBs;
00145 };
00146 
00147 #endif // _XNV_MULTI_ITEM_HYSTERESIS_1D_H_