VTK  9.0.1
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 
23 #ifndef vtkInteractiveArea_h
24 #define vtkInteractiveArea_h
25 
26 #include "vtkChartsCoreModule.h" // For export macro
27 #include "vtkContextArea.h"
28 #include "vtkNew.h" // For vtkNew
29 
31 class vtkRectd;
32 
33 class VTKCHARTSCORE_EXPORT vtkInteractiveArea : public vtkContextArea
34 {
35 public:
37 
38  static vtkInteractiveArea* New();
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
42 
45  bool Paint(vtkContext2D* painter) override;
46  bool Hit(const vtkContextMouseEvent& mouse) override;
47  bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta) override;
48  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
49  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
51 
52 protected:
54  ~vtkInteractiveArea() override;
55 
57 
60  void SetAxisRange(vtkRectd const& data) override;
61 
62 private:
66  void RecalculateTickSpacing(vtkAxis* axis, int const numClicks);
67 
71  void ComputeViewTransform() override;
72 
73  void ComputeZoom(
74  vtkVector2d const& origin, vtkVector2d& scale, vtkVector2d& shift, vtkVector2d& factor);
75 
76  class MouseActions;
77  MouseActions* Actions;
78 
79  vtkInteractiveArea(const vtkInteractiveArea&) = delete;
80  void operator=(const vtkInteractiveArea&) = delete;
81 };
82 
83 #endif // vtkInteractiveArea_h
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:34
vtkX3D::scale
@ scale
Definition: vtkX3D.h:235
vtkInteractiveArea
Implements zooming and panning in a vtkContextArea.
Definition: vtkInteractiveArea.h:33
vtkContextArea::New
static vtkContextArea * New()
vtkX3D::data
@ data
Definition: vtkX3D.h:321
vtkContextArea
Clipped, transformed area with axes for context items.
Definition: vtkContextArea.h:54
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:52
vtkRectd
Definition: vtkRect.h:340
vtkVector2d
Definition: vtkVector.h:444
vtkContextArea::Paint
bool Paint(vtkContext2D *painter) override
Paint event for the item, called whenever the item needs to be drawn.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkAbstractContextItem::Hit
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
vtkContextArea::SetAxisRange
virtual void SetAxisRange(vtkRectd const &data)
vtkAbstractContextItem::MouseMoveEvent
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
vtkContextArea::ComputeViewTransform
virtual void ComputeViewTransform()
vtkContextArea.h
vtkContextTransform
all children of this item are transformed by the vtkTransform2D of this item.
Definition: vtkContextTransform.h:36
vtkContextArea::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkNew.h
vtkAxis
takes care of drawing 2D axes
Definition: vtkAxis.h:68
vtkAbstractContextItem::MouseButtonPressEvent
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...
vtkAbstractContextItem::MouseWheelEvent
virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta)
Mouse wheel event, positive delta indicates forward movement of the wheel.