• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

XnVSlider2D.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_SLIDER_2D_H_
00010 #define _XNV_SLIDER_2D_H_
00011 
00012 #include "XnVNiteDefs.h"
00013 #include "XnVNiteEvents.h"
00014 #include "XnVDirection.h"
00015 
00016 class XnVPointBuffer;
00017 
00025 class XNV_NITE_API XnVSlider2D
00026 {
00027 public:
00031     typedef void (XN_CALLBACK_TYPE *ValueChangeCB)(XnFloat fXValue, XnFloat fYValue, void* pUserCxt);
00035     typedef void (XN_CALLBACK_TYPE *OffAxisMovementCB)(XnVDirection eDir, void* pUserCxt);
00036 
00043     XnVSlider2D(const XnPoint3D& ptMin ,const XnPoint3D& ptMax);
00053     XnVSlider2D(const XnPoint3D& ptInitialPosition, XnFloat fSliderXLength, XnFloat fSliderYLength,
00054                 XnFloat fInitialXValue, XnFloat fInitialYValue);
00055 
00056     ~XnVSlider2D();
00064     XnStatus Update(const XnPoint3D& pt, XnFloat fTime, XnBool bCheckOffAxis = true);
00065 
00074     XnCallbackHandle RegisterValueChange(void* cxt, ValueChangeCB CB); // Add CB to list
00083     XnCallbackHandle RegisterOffAxisMovement(void* cxt, OffAxisMovementCB CB); 
00089     void UnregisterValueChange(XnCallbackHandle hCB);
00095     void UnregisterOffAxisMovement(XnCallbackHandle hCB);
00096 
00097     XnPoint3D GetPosition() const {return m_ptCurrentPosition;}
00098 
00104     XnFloat  GetOffAxisDetectionVelocity() const;
00110     XnFloat  GetOffAxisDetectionAngle() const;
00116     XnUInt32 GetOffAxisDetectionTime() const;
00117 
00123     void SetOffAxisDetectionVelocity(XnFloat fVelocity);
00129     void SetOffAxisDetectionAngle(XnFloat fAngle);
00135     void SetOffAxisDetectionTime(XnUInt32 nTime);
00136 protected:
00137     XnInt32 CheckForOffAxisMovement(const XnPoint3D& pt, XnFloat fTime);
00138 
00139     XnPoint3D m_ptMin, m_ptMax;
00140     XnFloat m_fSizeX, m_fSizeY;
00141 
00142     XnVPointBuffer* m_pPointBuffer;
00143 
00144     XnPoint3D m_ptCurrentPosition;
00145 
00146     // Event broadcast
00147     void ValueChange(XnFloat fXValue, XnFloat fYValue); // go over list and call all functions
00148     void OffAxisMovement(XnVDirection eDir);
00149 
00150     XnVFloatFloatSpecificEvent m_ValueChangeCBs;
00151     XnVDirectionSpecificEvent m_OffAxisMovementCBs;
00152 
00153     static const XnFloat ms_fOffAxisDefaultMininumVelocity; // = 0.17 m/s
00154     static const XnFloat ms_fOffAxisDefaultDetectionAngle;      // = 60.0f
00155     static const XnUInt32 ms_nDefaultTimeForOffAxisDetection;   // = 350 ms
00156 
00157     XnFloat m_fOffAxisDetectionVelocity;
00158     XnFloat m_fOffAxisDetectionAngle;
00159     XnUInt32 m_nOffAxisDetectionTime;
00160 };
00161 
00162 
00163 #endif // _XNV_SLIDER_2D_H_

Generated on Tue Jul 19 2011 20:22:59 for NITE 1.4.1 - API Reference by  doxygen 1.7.1