VTK
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 
30 
32 class vtkRectd;
33 
34 class VTKCHARTSCORE_EXPORT vtkInteractiveArea : public vtkContextArea
35 {
36 public:
38 
39  static vtkInteractiveArea* New();
40  void PrintSelf(ostream &os, vtkIndent indent) override;
41 
43 
46  bool Paint(vtkContext2D *painter) override;
47  bool Hit(const vtkContextMouseEvent& mouse) override;
48  bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta) override;
49  bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override;
50  bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override;
52 
53 protected:
55  ~vtkInteractiveArea() override;
56 
58 
61  void SetAxisRange(vtkRectd const& data) override;
62 
63 private:
67  void RecalculateTickSpacing(vtkAxis* axis, int const numClicks);
68 
72  void ComputeViewTransform() override;
73 
74  void ComputeZoom(vtkVector2d const& origin, vtkVector2d & scale,
75  vtkVector2d& shift, vtkVector2d& factor);
76 
77  class MouseActions;
78  MouseActions* Actions;
79 
80  vtkInteractiveArea(const vtkInteractiveArea &) = delete;
81  void operator=(const vtkInteractiveArea &) = delete;
82 };
83 
84 #endif //vtkInteractiveArea_h
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:40
vtkX3D::scale
Definition: vtkX3D.h:229
vtkInteractiveArea
Implements zooming and panning in a vtkContextArea.
Definition: vtkInteractiveArea.h:34
vtkContextArea::New
static vtkContextArea * New()
vtkX3D::data
Definition: vtkX3D.h:315
vtkContextArea
Clipped, transformed area with axes for context items.
Definition: vtkContextArea.h:57
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
vtkRectd
Definition: vtkRect.h:341
vtkVector2d
Definition: vtkVector.h:427
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:39
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:39
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:71
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.