VTK  9.2.6
vtkInteractiveArea.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkInteractiveArea.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 
26 #ifndef vtkInteractiveArea_h
27 #define vtkInteractiveArea_h
28 
29 #include "vtkChartsCoreModule.h" // For export macro
30 #include "vtkContextArea.h"
31 #include "vtkNew.h" // For vtkNew
32 
34 class vtkRectd;
35 
36 class VTKCHARTSCORE_EXPORT vtkInteractiveArea : public vtkContextArea
37 {
38 public:
40 
41  static vtkInteractiveArea* New();
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
45 
48  bool Paint(vtkContext2D* painter) override;
49  bool Hit(const vtkContextMouseEvent& mouse) override;
50  bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta) override;
51  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
52  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
54 
55 protected:
57  ~vtkInteractiveArea() override;
58 
60 
63  void SetAxisRange(vtkRectd const& data) override;
64 
65 private:
69  void RecalculateTickSpacing(vtkAxis* axis, int const numClicks);
70 
74  void ComputeViewTransform() override;
75 
76  void ComputeZoom(
77  vtkVector2d const& origin, vtkVector2d& scale, vtkVector2d& shift, vtkVector2d& factor);
78 
79  class MouseActions;
80  MouseActions* Actions;
81 
82  vtkInteractiveArea(const vtkInteractiveArea&) = delete;
83  void operator=(const vtkInteractiveArea&) = delete;
84 };
85 
86 #endif // vtkInteractiveArea_h
bool Paint(vtkContext2D *painter) override
Paint event for the item, called whenever the item needs to be drawn.
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...
Implements zooming and panning in a vtkContextArea.
all children of this item are transformed by the vtkTransform2D of this item.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:57
virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta)
Mouse wheel event, positive delta indicates forward movement of the wheel.
takes care of drawing 2D axes
Definition: vtkAxis.h:71
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void ComputeViewTransform()
virtual void SetAxisRange(vtkRectd const &data)
Clipped, transformed area with axes for context items.
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkContextArea * New()