VTK  9.7.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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkTransform2D;
28 
29 class VTKRENDERINGCONTEXT2D_EXPORT VTK_MARSHALAUTO vtkContextTransform
30  : public vtkAbstractContextItem
31 {
32 public:
34  void PrintSelf(ostream& os, vtkIndent indent) override;
35 
39  static vtkContextTransform* New();
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 
101  virtual vtkTransform2D* GetTransform();
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 
223 protected:
225  ~vtkContextTransform() override;
226 
228 
237 
240 
242 
243 private:
244  vtkContextTransform(const vtkContextTransform&) = delete;
245  void operator=(const vtkContextTransform&) = delete;
246 };
247 
248 VTK_ABI_NAMESPACE_END
249 #endif // vtkContextTransform_h
void RemoveAllItems()
Remove all child items from this item.
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.
vtkIdType AddItem(vtkAbstractContextItem *item) override
Add child items to this item.
void ClearItems()
Remove all child items from this item.
int vtkIdType
Definition: vtkType.h:363
all children of this item are transformed by the vtkTransform2D of this item.
vtkAbstractContextItem * GetItem(vtkIdType index) override
Get the item at the specified index.
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
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.
vtkNew< vtkTransform2D > Transform
#define VTK_MARSHALAUTO
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.