VTK  9.3.20240419
vtkPiecewisePointHandleItem.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
15 #ifndef vtkPiecewisePointHandleItem_h
16 #define vtkPiecewisePointHandleItem_h
17 
18 #include "vtkChartsCoreModule.h" // For export macro
19 #include "vtkContextItem.h"
20 #include "vtkWeakPointer.h" // Needed for weak pointer to the PiecewiseFunction.
21 
22 VTK_ABI_NAMESPACE_BEGIN
23 class vtkContext2D;
25 class vtkCallbackCommand;
27 
28 class VTKCHARTSCORE_EXPORT vtkPiecewisePointHandleItem : public vtkContextItem
29 {
30 public:
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
35  static void CallRedraw(vtkObject* sender, unsigned long event, void* receiver, void* params);
36 
40  void SetParent(vtkAbstractContextItem* parent) override;
41 
45  bool Paint(vtkContext2D* painter) override;
46 
48 
51  vtkSetMacro(CurrentPointIndex, vtkIdType);
52  vtkGetMacro(CurrentPointIndex, vtkIdType);
54 
56 
59  virtual void SetPiecewiseFunction(vtkPiecewiseFunction* piecewiseFunc);
62 
67  int IsOverHandle(float* pos);
68 
72  bool Hit(const vtkContextMouseEvent& mouse) override;
73 
77  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
78 
82  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
83 
87  bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) override;
88 
89 protected:
92 
96  virtual void Redraw();
97 
101 
104 
105 private:
107  void operator=(const vtkPiecewisePointHandleItem&) = delete;
108 
109  class InternalPiecewisePointHandleInfo;
110  InternalPiecewisePointHandleInfo* Internal;
111 };
112 
113 VTK_ABI_NAMESPACE_END
114 #endif // vtkPiecewisePointHandleItem_h
base class for items that are part of a vtkContextScene.
supports function callbacks
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:69
base class for items that are part of a vtkContextScene.
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:162
Defines a 1D piecewise function.
a vtkContextItem that draws handles around a point of a piecewise function
vtkWeakPointer< vtkPiecewiseFunction > GetPiecewiseFunction()
Set the PieceWiseFunction the handles will manipulate.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetPiecewiseFunction(vtkPiecewiseFunction *piecewiseFunc)
Set the PieceWiseFunction the handles will manipulate.
virtual void Redraw()
Redraw all the handles.
int IsOverHandle(float *pos)
Returns the index of the handle if pos is over any of the handles, otherwise return -1;.
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse button down event.
static vtkPiecewisePointHandleItem * New()
static void CallRedraw(vtkObject *sender, unsigned long event, void *receiver, void *params)
vtkWeakPointer< vtkPiecewiseFunction > PiecewiseFunction
bool Paint(vtkContext2D *painter) override
Paint event for the item.
bool Hit(const vtkContextMouseEvent &mouse) override
Returns true if the supplied x, y coordinate is inside the item.
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override
Mouse button release event.
void SetParent(vtkAbstractContextItem *parent) override
Set the parent item, which should be a vtkControlPointItem.
~vtkPiecewisePointHandleItem() override
int vtkIdType
Definition: vtkType.h:315