Go to the documentation of this file.00001
00002
00003
00004
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 #include "XnVNiteEvents.h"
00014
00015 class XnVSigmoid;
00016 class XnVPointBuffer;
00017
00029 class XNV_NITE_API XnVMultiItemHysteresis2D
00030 {
00031 public:
00035 typedef void (XN_CALLBACK_TYPE *ItemSelectCB)(XnInt32 ItemXIndex, XnInt32 ItemYIndex, void* pUserCxt);
00036
00045 XnVMultiItemHysteresis2D(XnInt32 nItemXCount, XnInt32 nItemYCount,
00046 XnFloat fBorderWidth = 0,
00047 XnFloat fHysteresisRatio = ms_fDefaultHysteresisRatio);
00048
00049 ~XnVMultiItemHysteresis2D();
00050
00055 XnStatus Update(XnFloat fXValue, XnFloat fYValue);
00059 void LostPoint();
00060
00067 void ItemSelected(XnInt32 nItemXIndex, XnInt32 nItemYIndex);
00068
00077 XnCallbackHandle RegisterItemSelect(void* cxt, ItemSelectCB pCB);
00083 void UnregisterItemSelect(XnCallbackHandle handle);
00084
00090 XnUInt32 GetItemXCount() const;
00096 void SetItemXCount(XnUInt32 nItemXCount);
00102 XnUInt32 GetItemYCount() const;
00108 void SetItemYCount(XnUInt32 nItemYCount);
00109
00116 void SetItemCount(XnUInt32 nItemXCount, XnUInt32 nItemYCount);
00117
00123 XnFloat GetMinXValue() const;
00129 XnFloat GetMinYValue() const;
00135 XnFloat GetMaxYValue() const;
00141 XnFloat GetMaxXValue() const;
00142
00148 XnFloat GetBorderWidth() const;
00154 XnStatus SetBorderWidth(XnFloat fWidth);
00155
00161 XnFloat GetHysteresisRatio() const;
00162
00163 void SetHysteresisRatio(XnFloat fRatio);
00164
00165 static const XnFloat ms_fDefaultHysteresisRatio;
00166 protected:
00167 void CalculateMinAndMax();
00168
00169 XnBool IsValueInRange(XnFloat fXValue, XnFloat fYValue);
00170
00171 XnUInt32 m_nItemXCount;
00172 XnUInt32 m_nItemYCount;
00173
00174 XnFloat m_fMinXValue, m_fMaxXValue;
00175 XnFloat m_fMinYValue, m_fMaxYValue;
00176
00177 XnInt32 m_nLastSelectedXIndex;
00178 XnInt32 m_nLastSelectedYIndex;
00179
00180 XnFloat m_fBorderWidth;
00181
00182 XnFloat m_fHysteresisRatio;
00183
00184 XnVIntIntSpecificEvent m_ItemSelectCBs;
00185 };
00186
00187 #endif // _XNV_MULTI_ITEM_HYSTERESIS_1D_H_