VTK  9.5.20250718
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 {
66 return this->Superclass::AddItem(item);
67 }
68
74 {
75 return this->Superclass::GetItem(index);
76 }
77
81 void RemoveAllItems() { this->ClearItems(); }
82
88 void Update() override;
89
93 bool Paint(vtkContext2D* painter) override;
94
98 virtual void Identity();
99
104 virtual void Translate(float dx, float dy);
105
110 virtual void Scale(float dx, float dy);
111
115 virtual void Rotate(float angle);
116
121
125 vtkVector2f MapToParent(const vtkVector2f& point) override;
126
130 vtkVector2f MapFromParent(const vtkVector2f& point) override;
131
133
137 vtkSetMacro(PanMouseButton, int);
138 vtkGetMacro(PanMouseButton, int);
140
142
146 vtkSetMacro(PanModifier, int);
147 vtkGetMacro(PanModifier, int);
149
151
155 vtkSetMacro(SecondaryPanMouseButton, int);
156 vtkGetMacro(SecondaryPanMouseButton, int);
158
160
164 vtkSetMacro(SecondaryPanModifier, int);
165 vtkGetMacro(SecondaryPanModifier, int);
167
169
173 vtkSetMacro(ZoomMouseButton, int);
174 vtkGetMacro(ZoomMouseButton, int);
176
178
182 vtkSetMacro(ZoomModifier, int);
183 vtkGetMacro(ZoomModifier, int);
185
187
191 vtkSetMacro(SecondaryZoomMouseButton, int);
192 vtkGetMacro(SecondaryZoomMouseButton, int);
194
196
200 vtkSetMacro(SecondaryZoomModifier, int);
201 vtkGetMacro(SecondaryZoomModifier, int);
203
205
208 vtkSetMacro(ZoomOnMouseWheel, bool);
209 vtkGetMacro(ZoomOnMouseWheel, bool);
210 vtkBooleanMacro(ZoomOnMouseWheel, bool);
212
214
217 vtkSetMacro(PanYOnMouseWheel, bool);
218 vtkGetMacro(PanYOnMouseWheel, bool);
219 vtkBooleanMacro(PanYOnMouseWheel, bool);
221
225 bool Hit(const vtkContextMouseEvent& mouse) override;
226
230 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
231
235 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
236
240 bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta) override;
241
242protected:
245
247
256
259
261
262private:
264 void operator=(const vtkContextTransform&) = delete;
265};
266
267VTK_ABI_NAMESPACE_END
268#endif // vtkContextTransform_h
base class for items that are part of a vtkContextScene.
void ClearItems()
Remove all child items from this item.
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.
vtkIdType AddItem(vtkAbstractContextItem *item) override
Add child items to this item.
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.
void RemoveAllItems()
Remove all child items from this item.
vtkAbstractContextItem * GetItem(vtkIdType index) override
Get the item at the specified index.
~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.
vtkNew< 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
Allocate and hold a VTK object.
Definition vtkNew.h:167
describes linear transformations via a 3x3 matrix
int vtkIdType
Definition vtkType.h:332
#define VTK_MARSHALAUTO