VTK  9.4.20251007
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
16
17#ifndef vtkContextTransform_h
18#define vtkContextTransform_h
19
21#include "vtkRenderingContext2DModule.h" // For export macro
22#include "vtkSmartPointer.h" // Needed for SP ivars.
23#include "vtkVector.h" // Needed for ivars.
24#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
25
26VTK_ABI_NAMESPACE_BEGIN
27class vtkTransform2D;
28
29class VTKRENDERINGCONTEXT2D_EXPORT VTK_MARSHALAUTO vtkContextTransform
31{
32public:
34 void PrintSelf(ostream& os, vtkIndent indent) override;
35
40
46 void Update() override;
47
51 bool Paint(vtkContext2D* painter) override;
52
56 virtual void Identity();
57
62 virtual void Translate(float dx, float dy);
63
68 virtual void Scale(float dx, float dy);
69
73 virtual void Rotate(float angle);
74
79
83 vtkVector2f MapToParent(const vtkVector2f& point) override;
84
88 vtkVector2f MapFromParent(const vtkVector2f& point) override;
89
91
95 vtkSetMacro(PanMouseButton, int);
96 vtkGetMacro(PanMouseButton, int);
98
100
104 vtkSetMacro(PanModifier, int);
105 vtkGetMacro(PanModifier, int);
107
109
113 vtkSetMacro(SecondaryPanMouseButton, int);
114 vtkGetMacro(SecondaryPanMouseButton, int);
116
118
122 vtkSetMacro(SecondaryPanModifier, int);
123 vtkGetMacro(SecondaryPanModifier, int);
125
127
131 vtkSetMacro(ZoomMouseButton, int);
132 vtkGetMacro(ZoomMouseButton, int);
134
136
140 vtkSetMacro(ZoomModifier, int);
141 vtkGetMacro(ZoomModifier, int);
143
145
149 vtkSetMacro(SecondaryZoomMouseButton, int);
150 vtkGetMacro(SecondaryZoomMouseButton, int);
152
154
158 vtkSetMacro(SecondaryZoomModifier, int);
159 vtkGetMacro(SecondaryZoomModifier, int);
161
163
166 vtkSetMacro(ZoomOnMouseWheel, bool);
167 vtkGetMacro(ZoomOnMouseWheel, bool);
168 vtkBooleanMacro(ZoomOnMouseWheel, bool);
170
172
175 vtkSetMacro(PanYOnMouseWheel, bool);
176 vtkGetMacro(PanYOnMouseWheel, bool);
177 vtkBooleanMacro(PanYOnMouseWheel, bool);
179
183 bool Hit(const vtkContextMouseEvent& mouse) override;
184
188 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
189
193 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
194
198 bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta) override;
199
200protected:
203
205
214
217
219
220private:
222 void operator=(const vtkContextTransform&) = delete;
223};
224
225VTK_ABI_NAMESPACE_END
226#endif // vtkContextTransform_h
Class for drawing 2D primitives to a graphical context.
data structure to represent mouse events.
static vtkContextTransform * New()
Creates a vtkContextTransform object.
bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta) override
Mouse wheel event.
bool Paint(vtkContext2D *painter) override
Paint event for the item, called whenever the item needs to be drawn.
virtual void Identity()
Reset the transform to the identity transformation.
virtual vtkTransform2D * GetTransform()
Access the vtkTransform2D that controls object transformation.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void Translate(float dx, float dy)
Translate the item by the specified amounts dx and dy in the x and y directions.
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse press event.
vtkVector2f MapToParent(const vtkVector2f &point) override
Transforms a point to the parent coordinate system.
bool Hit(const vtkContextMouseEvent &mouse) override
Returns true if the transform is interactive, false otherwise.
~vtkContextTransform() override
void Update() override
Perform any updates to the item that may be necessary before rendering.
vtkVector2f MapFromParent(const vtkVector2f &point) override
Transforms a point from the parent coordinate system.
virtual void Scale(float dx, float dy)
Scale the item by the specified amounts dx and dy in the x and y directions.
vtkSmartPointer< vtkTransform2D > Transform
virtual void Rotate(float angle)
Rotate the item by the specified angle.
a simple class to control print indentation
Definition vtkIndent.h:29
Hold a reference to a vtkObjectBase instance.
describes linear transformations via a 3x3 matrix
#define VTK_MARSHALAUTO