VTK
vtkPiecewisePointHandleItem.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPiecewisePointHandleItem.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
27 #ifndef vtkPiecewisePointHandleItem_h
28 #define vtkPiecewisePointHandleItem_h
29 
30 #include "vtkChartsCoreModule.h" // For export macro
31 #include "vtkContextItem.h"
32 #include "vtkWeakPointer.h" // Needed for weak pointer to the PiecewiseFunction.
33 
34 class vtkContext2D;
36 class vtkCallbackCommand;
38 
39 class VTKCHARTSCORE_EXPORT vtkPiecewisePointHandleItem : public vtkContextItem
40 {
41 public:
43  void PrintSelf(ostream &os, vtkIndent indent) override;
44 
46  static void CallRedraw(vtkObject* sender, unsigned long event, void* receiver, void* params);
47 
51  void SetParent(vtkAbstractContextItem *parent) override;
52 
56  bool Paint(vtkContext2D *painter) override;
57 
59 
62  vtkSetMacro(CurrentPointIndex, vtkIdType);
63  vtkGetMacro(CurrentPointIndex, vtkIdType);
65 
67 
70  virtual void SetPiecewiseFunction(vtkPiecewiseFunction* piecewiseFunc);
71  vtkWeakPointer<vtkPiecewiseFunction> GetPiecewiseFunction();
73 
78  int IsOverHandle(float* pos);
79 
83  bool Hit(const vtkContextMouseEvent &mouse) override;
84 
88  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override;
89 
93  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override;
94 
98  bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override;
99 
100 protected:
102  ~vtkPiecewisePointHandleItem() override;
103 
107  virtual void Redraw();
108 
112 
115 
116 private:
118  void operator=(const vtkPiecewisePointHandleItem &) = delete;
119 
120  class InternalPiecewisePointHandleInfo;
121  InternalPiecewisePointHandleInfo* Internal;
122 
123 };
124 
125 #endif //vtkPiecewisePointHandleItem_h
virtual void SetParent(vtkAbstractContextItem *parent)
Set the parent item.
abstract base class for most VTK objects
Definition: vtkObject.h:59
Defines a 1D piecewise function.
base class for items that are part of a vtkContextScene.
virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
Mouse button down event Return true if the item holds the event, false if the event can be propagated...
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
int vtkIdType
Definition: vtkType.h:347
vtkWeakPointer< vtkPiecewiseFunction > PiecewiseFunction
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
supports function callbacks
a vtkContextItem that draws handles around a point of a piecewise function
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
base class for items that are part of a vtkContextScene.
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...