VTK  9.3.1
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);
60  vtkWeakPointer<vtkPiecewiseFunction> GetPiecewiseFunction();
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:
91  ~vtkPiecewisePointHandleItem() override;
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
virtual void SetParent(vtkAbstractContextItem *parent)
Set the parent item.
abstract base class for most VTK objects
Definition: vtkObject.h:51
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:315
vtkWeakPointer< vtkPiecewiseFunction > PiecewiseFunction
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:49
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:28
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...