VTK
dox/Charts/vtkPiecewisePointHandleItem.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkPiecewisePointHandleItem.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 
00026 #ifndef __vtkPiecewisePointHandleItem_h
00027 #define __vtkPiecewisePointHandleItem_h
00028 
00029 #include "vtkContextItem.h"
00030 #include "vtkWeakPointer.h" // Needed for weak pointer to the PiecewiseFunction.
00031 
00032 class vtkContext2D;
00033 class vtkPiecewiseFunction;
00034 class vtkCallbackCommand;
00035 class vtkAbstractContextItem;
00036 
00037 class VTK_CHARTS_EXPORT vtkPiecewisePointHandleItem : public vtkContextItem
00038 {
00039 public:
00040   vtkTypeMacro(vtkPiecewisePointHandleItem, vtkContextItem);
00041   virtual void PrintSelf(ostream &os, vtkIndent indent);
00042 
00043   static vtkPiecewisePointHandleItem *New();
00044   static void CallRedraw(vtkObject* sender, unsigned long event, void* receiver, void* params);
00045 
00047   virtual void SetParent(vtkAbstractContextItem *parent);
00048 
00050   virtual bool Paint(vtkContext2D *painter);
00051 
00053 
00054   vtkSetMacro(CurrentPointIndex, vtkIdType);
00055   vtkGetMacro(CurrentPointIndex, vtkIdType);
00057 
00059 
00060   virtual void SetPiecewiseFunction(vtkPiecewiseFunction* piecewiseFunc);
00061   vtkWeakPointer<vtkPiecewiseFunction> GetPiecewiseFunction();
00063 
00066   int IsOverHandle(float* pos);
00067 
00069   virtual bool Hit(const vtkContextMouseEvent &mouse);
00070 
00072   virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
00073 
00075   virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
00076 
00078   virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse);
00079 
00080 //BTX
00081 protected:
00082   vtkPiecewisePointHandleItem();
00083   ~vtkPiecewisePointHandleItem();
00084 
00086   virtual void Redraw();
00087 
00088   int MouseOverHandleIndex;
00089   vtkIdType CurrentPointIndex;
00090   float HandleRadius;
00091 
00092   vtkWeakPointer<vtkPiecewiseFunction> PiecewiseFunction;
00093   vtkCallbackCommand* Callback;
00094 
00095 private:
00096   vtkPiecewisePointHandleItem(const vtkPiecewisePointHandleItem &); // Not implemented.
00097   void operator=(const vtkPiecewisePointHandleItem &);   // Not implemented.
00098 
00099   class InternalPiecewisePointHandleInfo;
00100   InternalPiecewisePointHandleInfo* Internal;
00101 //ETX
00102 };
00103 
00104 #endif //__vtkPiecewisePointHandleItem_h