VTK  9.3.1
vtkContextTransform.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 
17 #ifndef vtkContextTransform_h
18 #define vtkContextTransform_h
19 
20 #include "vtkAbstractContextItem.h"
21 #include "vtkRenderingContext2DModule.h" // For export macro
22 #include "vtkSmartPointer.h" // Needed for SP ivars.
23 #include "vtkVector.h" // Needed for ivars.
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkTransform2D;
27 
28 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextTransform : public vtkAbstractContextItem
29 {
30 public:
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
37  static vtkContextTransform* New();
38 
44  void Update() override;
45 
49  bool Paint(vtkContext2D* painter) override;
50 
54  virtual void Identity();
55 
60  virtual void Translate(float dx, float dy);
61 
66  virtual void Scale(float dx, float dy);
67 
71  virtual void Rotate(float angle);
72 
76  virtual vtkTransform2D* GetTransform();
77 
81  vtkVector2f MapToParent(const vtkVector2f& point) override;
82 
86  vtkVector2f MapFromParent(const vtkVector2f& point) override;
87 
89 
93  vtkSetMacro(PanMouseButton, int);
94  vtkGetMacro(PanMouseButton, int);
96 
98 
102  vtkSetMacro(PanModifier, int);
103  vtkGetMacro(PanModifier, int);
105 
107 
111  vtkSetMacro(SecondaryPanMouseButton, int);
112  vtkGetMacro(SecondaryPanMouseButton, int);
114 
116 
120  vtkSetMacro(SecondaryPanModifier, int);
121  vtkGetMacro(SecondaryPanModifier, int);
123 
125 
129  vtkSetMacro(ZoomMouseButton, int);
130  vtkGetMacro(ZoomMouseButton, int);
132 
134 
138  vtkSetMacro(ZoomModifier, int);
139  vtkGetMacro(ZoomModifier, int);
141 
143 
147  vtkSetMacro(SecondaryZoomMouseButton, int);
148  vtkGetMacro(SecondaryZoomMouseButton, int);
150 
152 
156  vtkSetMacro(SecondaryZoomModifier, int);
157  vtkGetMacro(SecondaryZoomModifier, int);
159 
161 
164  vtkSetMacro(ZoomOnMouseWheel, bool);
165  vtkGetMacro(ZoomOnMouseWheel, bool);
166  vtkBooleanMacro(ZoomOnMouseWheel, bool);
168 
170 
173  vtkSetMacro(PanYOnMouseWheel, bool);
174  vtkGetMacro(PanYOnMouseWheel, bool);
175  vtkBooleanMacro(PanYOnMouseWheel, bool);
177 
181  bool Hit(const vtkContextMouseEvent& mouse) override;
182 
186  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
187 
191  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
192 
196  bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta) override;
197 
198 protected:
200  ~vtkContextTransform() override;
201 
203 
212 
215 
217 
218 private:
219  vtkContextTransform(const vtkContextTransform&) = delete;
220  void operator=(const vtkContextTransform&) = delete;
221 };
222 
223 VTK_ABI_NAMESPACE_END
224 #endif // vtkContextTransform_h
virtual vtkVector2f MapFromParent(const vtkVector2f &point)
Maps the point from the parent coordinate system.
virtual vtkVector2f MapToParent(const vtkVector2f &point)
Maps the point to the parent coordinate system.
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.
all children of this item are transformed by the vtkTransform2D of this item.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:49
virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta)
Mouse wheel event, positive delta indicates forward movement of the wheel.
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkSmartPointer< vtkTransform2D > Transform
describes linear transformations via a 3x3 matrix
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...
virtual void Update()
Perform any updates to the item that may be necessary before rendering.