VTK  9.4.20250123
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
36#ifndef vtkContextTransform_h
37#define vtkContextTransform_h
38
40#include "vtkRenderingContext2DModule.h" // For export macro
41#include "vtkSmartPointer.h" // Needed for SP ivars.
42#include "vtkVector.h" // Needed for ivars.
43#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
44
45VTK_ABI_NAMESPACE_BEGIN
46class vtkTransform2D;
47
48class VTKRENDERINGCONTEXT2D_EXPORT VTK_MARSHALAUTO vtkContextTransform
50{
51public:
53 void PrintSelf(ostream& os, vtkIndent indent) override;
54
59
65 void Update() override;
66
70 bool Paint(vtkContext2D* painter) override;
71
75 virtual void Identity();
76
81 virtual void Translate(float dx, float dy);
82
87 virtual void Scale(float dx, float dy);
88
92 virtual void Rotate(float angle);
93
98
102 vtkVector2f MapToParent(const vtkVector2f& point) override;
103
107 vtkVector2f MapFromParent(const vtkVector2f& point) override;
108
110
114 vtkSetMacro(PanMouseButton, int);
115 vtkGetMacro(PanMouseButton, int);
117
119
123 vtkSetMacro(PanModifier, int);
124 vtkGetMacro(PanModifier, int);
126
128
132 vtkSetMacro(SecondaryPanMouseButton, int);
133 vtkGetMacro(SecondaryPanMouseButton, int);
135
137
141 vtkSetMacro(SecondaryPanModifier, int);
142 vtkGetMacro(SecondaryPanModifier, int);
144
146
150 vtkSetMacro(ZoomMouseButton, int);
151 vtkGetMacro(ZoomMouseButton, int);
153
155
159 vtkSetMacro(ZoomModifier, int);
160 vtkGetMacro(ZoomModifier, int);
162
164
168 vtkSetMacro(SecondaryZoomMouseButton, int);
169 vtkGetMacro(SecondaryZoomMouseButton, int);
171
173
177 vtkSetMacro(SecondaryZoomModifier, int);
178 vtkGetMacro(SecondaryZoomModifier, int);
180
182
185 vtkSetMacro(ZoomOnMouseWheel, bool);
186 vtkGetMacro(ZoomOnMouseWheel, bool);
187 vtkBooleanMacro(ZoomOnMouseWheel, bool);
189
191
194 vtkSetMacro(PanYOnMouseWheel, bool);
195 vtkGetMacro(PanYOnMouseWheel, bool);
196 vtkBooleanMacro(PanYOnMouseWheel, bool);
198
202 bool Hit(const vtkContextMouseEvent& mouse) override;
203
207 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
208
212 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
213
217 bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta) override;
218
219protected:
222
224
233
236
238
239private:
241 void operator=(const vtkContextTransform&) = delete;
242};
243
244VTK_ABI_NAMESPACE_END
245#endif // vtkContextTransform_h
base class for items that are part of a vtkContextScene.
Class for drawing 2D primitives to a graphical context.
data structure to represent mouse events.
all children of this item are transformed by the vtkTransform2D of this item.
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:108
Hold a reference to a vtkObjectBase instance.
describes linear transformations via a 3x3 matrix
#define VTK_MARSHALAUTO