VTK  9.6.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
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 {
47 return this->Superclass::AddItem(item);
48 }
49
55 {
56 return this->Superclass::GetItem(index);
57 }
58
62 void RemoveAllItems() { this->ClearItems(); }
63
69 void Update() override;
70
74 bool Paint(vtkContext2D* painter) override;
75
79 virtual void Identity();
80
85 virtual void Translate(float dx, float dy);
86
91 virtual void Scale(float dx, float dy);
92
96 virtual void Rotate(float angle);
97
102
106 vtkVector2f MapToParent(const vtkVector2f& point) override;
107
111 vtkVector2f MapFromParent(const vtkVector2f& point) override;
112
114
118 vtkSetMacro(PanMouseButton, int);
119 vtkGetMacro(PanMouseButton, int);
121
123
127 vtkSetMacro(PanModifier, int);
128 vtkGetMacro(PanModifier, int);
130
132
136 vtkSetMacro(SecondaryPanMouseButton, int);
137 vtkGetMacro(SecondaryPanMouseButton, int);
139
141
145 vtkSetMacro(SecondaryPanModifier, int);
146 vtkGetMacro(SecondaryPanModifier, int);
148
150
154 vtkSetMacro(ZoomMouseButton, int);
155 vtkGetMacro(ZoomMouseButton, int);
157
159
163 vtkSetMacro(ZoomModifier, int);
164 vtkGetMacro(ZoomModifier, int);
166
168
172 vtkSetMacro(SecondaryZoomMouseButton, int);
173 vtkGetMacro(SecondaryZoomMouseButton, int);
175
177
181 vtkSetMacro(SecondaryZoomModifier, int);
182 vtkGetMacro(SecondaryZoomModifier, int);
184
186
189 vtkSetMacro(ZoomOnMouseWheel, bool);
190 vtkGetMacro(ZoomOnMouseWheel, bool);
191 vtkBooleanMacro(ZoomOnMouseWheel, bool);
193
195
198 vtkSetMacro(PanYOnMouseWheel, bool);
199 vtkGetMacro(PanYOnMouseWheel, bool);
200 vtkBooleanMacro(PanYOnMouseWheel, bool);
202
206 bool Hit(const vtkContextMouseEvent& mouse) override;
207
211 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
212
216 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
217
221 bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta) override;
222
223protected:
226
228
237
240
242
243private:
245 void operator=(const vtkContextTransform&) = delete;
246};
247
248VTK_ABI_NAMESPACE_END
249#endif // vtkContextTransform_h
virtual vtkAbstractContextItem * GetItem(vtkIdType index)
Get the item at the specified index.
virtual vtkIdType AddItem(vtkAbstractContextItem *item)
Add child items to this item.
void ClearItems()
Remove all child items from this item.
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.
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:29
Allocate and hold a VTK object.
Definition vtkNew.h:58
describes linear transformations via a 3x3 matrix
int vtkIdType
Definition vtkType.h:368
#define VTK_MARSHALAUTO